CrossEncoder based on microsoft/MiniLM-L12-H384-uncased
This is a Cross Encoder model finetuned from microsoft/MiniLM-L12-H384-uncased on the ms-marco-shuffled dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Cross Encoder
- Base model: microsoft/MiniLM-L12-H384-uncased
- Maximum Sequence Length: 512 tokens
- Number of Output Labels: 1 label
- Training Dataset:
- Language: en
Model Sources
- Documentation: Sentence Transformers Documentation
- Documentation: Cross Encoder Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Cross Encoders on Hugging Face
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("tomaarsen/reranker-MiniLM-L12-H384-uncased-msmarco-bce")
# Get scores for pairs of texts
pairs = [
['what is a jewel yam', 'Wild Yam can be very beneficial for nervousness, restlessness and other nervous conditions. As a stimulant for increased bile flow, it can help to relieve hepatic congestion, bilious colic and gallstones.'],
['hours of daytona', '24 Hours of Daytona. The 24 Hours of Daytona, currently known as the Rolex 24 At Daytona for sponsorship reasons, is a 24-hour sports car endurance race held annually at Daytona International Speedway in Daytona Beach, Florida. It is run on a 3.56-mile (5.73 km) combined road course, utilizing portions of the NASCAR tri-oval and an infield road course.'],
['how much do autozone workers get paid', 'The typical AutoZone Sales Associate salary is $9. Sales Associate salaries at AutoZone can range from $7-$12. This estimate is based upon 59 AutoZone Sales Associate salary report(s) provided by employees or estimated based upon statistical methods. See all Sales Associate salaries to learn how this stacks up in the market.'],
['what are the special sensory receptors', 'Sensory Neurons. Sensory Neurons: + add to my flashcards cite this term. You have a few different types of neurons in your body including interneurons, motor neurons, and sensory neurons. Sensory neurons (also known as Afferent Neurons) are responsible for bringing information from sensory receptors (like the nerves in your hand) to the central nervous system (spinal cord and brain).'],
['how long to cook salmon on the grill', 'Place the bag with the marinade and salmon fillets in the refrigerator for 30 minutes. 1 Salmon, like all fish, is not as dense as red meats and poultry. 2 As a result, it does not need to be marinaded for long in order to absorb flavor.3 Remove the salmon from the refrigerator at least 10 minutes prior to cooking.lace the broiler pan 5 1/2 inches (14 cm) away from the top heating element and cook the salmon until done. 1 The salmon is done when you can effortlessly flake the fillets with a fork. 2 The center should be opaque.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'what is a jewel yam',
[
'Wild Yam can be very beneficial for nervousness, restlessness and other nervous conditions. As a stimulant for increased bile flow, it can help to relieve hepatic congestion, bilious colic and gallstones.',
'24 Hours of Daytona. The 24 Hours of Daytona, currently known as the Rolex 24 At Daytona for sponsorship reasons, is a 24-hour sports car endurance race held annually at Daytona International Speedway in Daytona Beach, Florida. It is run on a 3.56-mile (5.73 km) combined road course, utilizing portions of the NASCAR tri-oval and an infield road course.',
'The typical AutoZone Sales Associate salary is $9. Sales Associate salaries at AutoZone can range from $7-$12. This estimate is based upon 59 AutoZone Sales Associate salary report(s) provided by employees or estimated based upon statistical methods. See all Sales Associate salaries to learn how this stacks up in the market.',
'Sensory Neurons. Sensory Neurons: + add to my flashcards cite this term. You have a few different types of neurons in your body including interneurons, motor neurons, and sensory neurons. Sensory neurons (also known as Afferent Neurons) are responsible for bringing information from sensory receptors (like the nerves in your hand) to the central nervous system (spinal cord and brain).',
'Place the bag with the marinade and salmon fillets in the refrigerator for 30 minutes. 1 Salmon, like all fish, is not as dense as red meats and poultry. 2 As a result, it does not need to be marinaded for long in order to absorb flavor.3 Remove the salmon from the refrigerator at least 10 minutes prior to cooking.lace the broiler pan 5 1/2 inches (14 cm) away from the top heating element and cook the salmon until done. 1 The salmon is done when you can effortlessly flake the fillets with a fork. 2 The center should be opaque.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
Evaluation
Metrics
Cross Encoder Reranking
- Datasets:
NanoMSMARCO
,NanoNFCorpus
andNanoNQ
- Evaluated with
CERerankingEvaluator
Metric | NanoMSMARCO | NanoNFCorpus | NanoNQ |
---|---|---|---|
map | 0.6127 (+0.1231) | 0.3432 (+0.0728) | 0.6921 (+0.2715) |
mrr@10 | 0.6019 (+0.1244) | 0.5456 (+0.0457) | 0.7062 (+0.2795) |
ndcg@10 | 0.6648 (+0.1244) | 0.3769 (+0.0519) | 0.7462 (+0.2455) |
Cross Encoder Nano BEIR
- Dataset:
NanoBEIR_mean
- Evaluated with
CENanoBEIREvaluator
Metric | Value |
---|---|
map | 0.5493 (+0.1558) |
mrr@10 | 0.6179 (+0.1499) |
ndcg@10 | 0.5960 (+0.1406) |
Training Details
Training Dataset
ms-marco-shuffled
- Dataset: ms-marco-shuffled at 88847c6
- Size: 397,226,027 training samples
- Columns:
query
,passage
, andscore
- Approximate statistics based on the first 1000 samples:
query passage score type string string float details - min: 10 characters
- mean: 34.03 characters
- max: 148 characters
- min: 72 characters
- mean: 345.31 characters
- max: 913 characters
- min: 0.0
- mean: 0.52
- max: 1.0
- Samples:
query passage score when was ron marhofer founded?
What are the birthdays of Ron Shirley Bobby Brantley and Amy Shirley from Lizard Lick Towing? Ron Shirley's birthday is April 13. His wife Amy Shirley celebrates her birthday on May 4, and Bobby Brantley's birthday is September 26.
0.0
what should the average medical assistant make
For example, the Bureau of Labor Statistics reports that as of May 2014, medical assistant jobs located in Offices of Physicians paid about $31,230 a year on average c. These roles (in Offices of Physicians) made up a large portion of medical assistant jobs, totaling 349,370 positions as of May 2014 c. General Medical and Surgical hospitals were another large employer, carrying 85,040 medical assistants c on their payrolls.
1.0
what type of rock form in warm ocean bottoms
Second, sedimentary rocks form on the bottom of the ocean when particles rain down from the surface. These particles can become compressed and cemented to form limestone. Fossilized sea creatures are often found in these rocks. Most of the mountains around Las Vegas are composed of sedimentary rocks. Red Rock Canyon (photo) provides a spectacular example of both types: the gray mountains are limestone, and the red-and-white hills are sandstone.
1.0
- Loss:
BinaryCrossEntropyLoss
with these parameters:{ "activation_fct": "torch.nn.modules.linear.Identity", "pos_weight": null }
Evaluation Dataset
ms-marco-shuffled
- Dataset: ms-marco-shuffled at 88847c6
- Size: 397,226,027 evaluation samples
- Columns:
query
,passage
, andscore
- Approximate statistics based on the first 1000 samples:
query passage score type string string float details - min: 11 characters
- mean: 33.94 characters
- max: 164 characters
- min: 58 characters
- mean: 346.39 characters
- max: 917 characters
- min: 0.0
- mean: 0.5
- max: 1.0
- Samples:
query passage score what is a jewel yam
Wild Yam can be very beneficial for nervousness, restlessness and other nervous conditions. As a stimulant for increased bile flow, it can help to relieve hepatic congestion, bilious colic and gallstones.
0.0
hours of daytona
24 Hours of Daytona. The 24 Hours of Daytona, currently known as the Rolex 24 At Daytona for sponsorship reasons, is a 24-hour sports car endurance race held annually at Daytona International Speedway in Daytona Beach, Florida. It is run on a 3.56-mile (5.73 km) combined road course, utilizing portions of the NASCAR tri-oval and an infield road course.
1.0
how much do autozone workers get paid
The typical AutoZone Sales Associate salary is $9. Sales Associate salaries at AutoZone can range from $7-$12. This estimate is based upon 59 AutoZone Sales Associate salary report(s) provided by employees or estimated based upon statistical methods. See all Sales Associate salaries to learn how this stacks up in the market.
1.0
- Loss:
BinaryCrossEntropyLoss
with these parameters:{ "activation_fct": "torch.nn.modules.linear.Identity", "pos_weight": null }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 64per_device_eval_batch_size
: 64learning_rate
: 2e-05num_train_epochs
: 1warmup_ratio
: 0.1seed
: 12bf16
: Truedataloader_num_workers
: 4load_best_model_at_end
: True
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 64per_device_eval_batch_size
: 64per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 2e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 1max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.1warmup_steps
: 0log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 12data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Truefp16
: Falsefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 0ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Falsedataloader_num_workers
: 4dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Truelabel_names
: Noneload_best_model_at_end
: Trueignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Nonehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseinclude_for_metrics
: []eval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseuse_liger_kernel
: Falseeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | Validation Loss | NanoMSMARCO_ndcg@10 | NanoNFCorpus_ndcg@10 | NanoNQ_ndcg@10 | NanoBEIR_mean_ndcg@10 |
---|---|---|---|---|---|---|---|
-1 | -1 | - | - | 0.0324 (-0.5080) | 0.2439 (-0.0811) | 0.0361 (-0.4646) | 0.1041 (-0.3512) |
0.0000 | 1 | 0.6941 | - | - | - | - | - |
0.0322 | 1000 | 0.5117 | - | - | - | - | - |
0.0643 | 2000 | 0.2604 | - | - | - | - | - |
0.0965 | 3000 | 0.2258 | - | - | - | - | - |
0.1286 | 4000 | 0.2115 | - | - | - | - | - |
0.1608 | 5000 | 0.1995 | 0.1879 | 0.6145 (+0.0741) | 0.4002 (+0.0751) | 0.6970 (+0.1964) | 0.5706 (+0.1152) |
0.1930 | 6000 | 0.1924 | - | - | - | - | - |
0.2251 | 7000 | 0.1914 | - | - | - | - | - |
0.2573 | 8000 | 0.1859 | - | - | - | - | - |
0.2894 | 9000 | 0.1802 | - | - | - | - | - |
0.3216 | 10000 | 0.1791 | 0.1628 | 0.6311 (+0.0906) | 0.3795 (+0.0545) | 0.7347 (+0.2341) | 0.5818 (+0.1264) |
0.3538 | 11000 | 0.1732 | - | - | - | - | - |
0.3859 | 12000 | 0.1713 | - | - | - | - | - |
0.4181 | 13000 | 0.1756 | - | - | - | - | - |
0.4502 | 14000 | 0.1643 | - | - | - | - | - |
0.4824 | 15000 | 0.166 | 0.1531 | 0.6540 (+0.1136) | 0.3830 (+0.0579) | 0.7315 (+0.2309) | 0.5895 (+0.1341) |
0.5146 | 16000 | 0.161 | - | - | - | - | - |
0.5467 | 17000 | 0.1617 | - | - | - | - | - |
0.5789 | 18000 | 0.1612 | - | - | - | - | - |
0.6111 | 19000 | 0.1591 | - | - | - | - | - |
0.6432 | 20000 | 0.1599 | 0.1428 | 0.6648 (+0.1244) | 0.3769 (+0.0519) | 0.7462 (+0.2455) | 0.5960 (+0.1406) |
0.6754 | 21000 | 0.1599 | - | - | - | - | - |
0.7075 | 22000 | 0.1523 | - | - | - | - | - |
0.7397 | 23000 | 0.1525 | - | - | - | - | - |
0.7719 | 24000 | 0.1549 | - | - | - | - | - |
0.8040 | 25000 | 0.1515 | 0.1386 | 0.6682 (+0.1278) | 0.3686 (+0.0436) | 0.7481 (+0.2474) | 0.5950 (+0.1396) |
0.8362 | 26000 | 0.1556 | - | - | - | - | - |
0.8683 | 27000 | 0.1501 | - | - | - | - | - |
0.9005 | 28000 | 0.1522 | - | - | - | - | - |
0.9327 | 29000 | 0.1493 | - | - | - | - | - |
0.9648 | 30000 | 0.1509 | 0.1354 | 0.6805 (+0.1400) | 0.3593 (+0.0343) | 0.7439 (+0.2433) | 0.5946 (+0.1392) |
0.9970 | 31000 | 0.1481 | - | - | - | - | - |
-1 | -1 | - | - | 0.6648 (+0.1244) | 0.3769 (+0.0519) | 0.7462 (+0.2455) | 0.5960 (+0.1406) |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.11.10
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.49.0.dev0
- PyTorch: 2.6.0.dev20241112+cu121
- Accelerate: 1.2.0
- Datasets: 3.2.0
- Tokenizers: 0.21.0
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
- Downloads last month
- 16
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API:
The HF Inference API does not support text-classification models for sentence-transformers library.
Model tree for tomaarsen/reranker-MiniLM-L12-H384-msmarco-bce
Base model
microsoft/MiniLM-L12-H384-uncased