YAML Metadata
Warning:
The pipeline tag "text-ranking" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, text2text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, other
CrossEncoder based on microsoft/MiniLM-L12-H384-uncased
This is a Cross Encoder model finetuned from microsoft/MiniLM-L12-H384-uncased on the msmarco dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
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 = [
['cost to repair a manifold gasket', 'Parts. The cost of the parts required to repair or replace your intake manifold gasket ranges from $25 to $100 in 2010, according to RepairPal, depending on the year and make of your car. This range applies if you have a 2005 Ford Taurus or a 2011 BMW 750Li.'],
['what county is salisbury missouri in', 'The St. Louis County, Missouri sales tax is 7.11% , consisting of 4.23% Missouri state sales tax and 2.89% St. Louis County local sales taxes.The local sales tax consists of a 1.64% county sales tax and a 1.25% special district sales tax (used to fund transportation districts, local attractions, etc). St. Louis County Missouri Sales Tax Exemptions.'],
['what is life expectancy for someone with lung cancer', 'The two general types of lung cancer include: Small cell lung cancer. Small cell lung cancer occurs almost exclusively in heavy smokers and is less common than non-small cell lung cancer. Non-small cell lung cancer. Non-small cell lung cancer is an umbrella term for several types of lung cancers that behave in a similar way. Non-small cell lung cancers include squamous cell carcinoma, adenocarcinoma and large cell carcinoma.'],
['where does the zambezi river start', 'Where is Zimbabwe? Zimbabwe lies between the Limpopo and Zambezi rivers in south central Africa. It is bounded by Zambia (797km) in the north and northwest, by South Africa (225km) in the south by Mozambique(1 231km) in the east and north-east, and by Botswana (813km)in the south-west. It has no coastline and is totally landlocked.'],
['what is a lichen moth', 'Understanding Oral Lichen Planus. Oral lichen planus can occur anywhere inside the mouth, but is usually seen on the inside of the cheeks and appears as thin white lines, patches, or dots. It is most common between the ages of 30 and 60. While it appears in about one to two percent of the population, women get oral lichen planus twice as often as men.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'cost to repair a manifold gasket',
[
'Parts. The cost of the parts required to repair or replace your intake manifold gasket ranges from $25 to $100 in 2010, according to RepairPal, depending on the year and make of your car. This range applies if you have a 2005 Ford Taurus or a 2011 BMW 750Li.',
'The St. Louis County, Missouri sales tax is 7.11% , consisting of 4.23% Missouri state sales tax and 2.89% St. Louis County local sales taxes.The local sales tax consists of a 1.64% county sales tax and a 1.25% special district sales tax (used to fund transportation districts, local attractions, etc). St. Louis County Missouri Sales Tax Exemptions.',
'The two general types of lung cancer include: Small cell lung cancer. Small cell lung cancer occurs almost exclusively in heavy smokers and is less common than non-small cell lung cancer. Non-small cell lung cancer. Non-small cell lung cancer is an umbrella term for several types of lung cancers that behave in a similar way. Non-small cell lung cancers include squamous cell carcinoma, adenocarcinoma and large cell carcinoma.',
'Where is Zimbabwe? Zimbabwe lies between the Limpopo and Zambezi rivers in south central Africa. It is bounded by Zambia (797km) in the north and northwest, by South Africa (225km) in the south by Mozambique(1 231km) in the east and north-east, and by Botswana (813km)in the south-west. It has no coastline and is totally landlocked.',
'Understanding Oral Lichen Planus. Oral lichen planus can occur anywhere inside the mouth, but is usually seen on the inside of the cheeks and appears as thin white lines, patches, or dots. It is most common between the ages of 30 and 60. While it appears in about one to two percent of the population, women get oral lichen planus twice as often as men.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
Evaluation
Metrics
Cross Encoder Reranking
- Datasets:
NanoMSMARCO_R100
,NanoNFCorpus_R100
andNanoNQ_R100
- Evaluated with
CrossEncoderRerankingEvaluator
with these parameters:{ "at_k": 10, "always_rerank_positives": true }
Metric | NanoMSMARCO_R100 | NanoNFCorpus_R100 | NanoNQ_R100 |
---|---|---|---|
map | 0.5585 (+0.0689) | 0.3318 (+0.0708) | 0.6943 (+0.2747) |
mrr@10 | 0.5533 (+0.0758) | 0.5174 (+0.0175) | 0.7187 (+0.2920) |
ndcg@10 | 0.6413 (+0.1009) | 0.3979 (+0.0728) | 0.7395 (+0.2388) |
Cross Encoder Nano BEIR
- Dataset:
NanoBEIR_R100_mean
- Evaluated with
CrossEncoderNanoBEIREvaluator
with these parameters:{ "dataset_names": [ "msmarco", "nfcorpus", "nq" ], "rerank_k": 100, "at_k": 10, "always_rerank_positives": true }
Metric | Value |
---|---|
map | 0.5282 (+0.1381) |
mrr@10 | 0.5964 (+0.1284) |
ndcg@10 | 0.5929 (+0.1375) |
Training Details
Training Dataset
msmarco
- Dataset: msmarco at 88847c6
- Size: 1,990,000 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.4 characters
- max: 200 characters
- min: 88 characters
- mean: 344.88 characters
- max: 935 characters
- min: 0.0
- mean: 0.48
- max: 1.0
- Samples:
query passage score who is erin anderson?
Erin Anderson is an actress and writer, known for Kittens in a Cage (2015), The Mysteries of Laura (2014) and Insidious: Chapter 3 (2015).
1.0
how long is a food handlers permit good for in california
If you would like to get your California Food Handler card you will need to successfully pass an approved Food Safety for Handlers course. For how long is the California Food Handler card valid? The California Food Handler card is valid throughout most of the state and is valid for three years from issuance. Each food establishment or business must have records documenting that each of its employees has a valid California Food Handler card that can be provided to local enforcement officials upon request.
1.0
matagorda tx is in what county
Matagorda is an unincorporated community in Matagorda County, Texas, United States. It had a population of approximately 710 in 2000. Matagorda is at the end of State Highway 60 and beginning of Farm to Market Road 2031, which runs over the Intracoastal Waterway and south to the Gulf of Mexico. The area is popular for fishing and beach activities. The Matagorda Independent School District serves area students.
1.0
- Loss:
BinaryCrossEntropyLoss
with these parameters:{ "activation_fct": "torch.nn.modules.linear.Identity", "pos_weight": null }
Evaluation Dataset
msmarco
- Dataset: msmarco at 88847c6
- Size: 10,000 evaluation samples
- Columns:
query
,passage
, andscore
- Approximate statistics based on the first 1000 samples:
query passage score type string string float details - min: 7 characters
- mean: 33.41 characters
- max: 114 characters
- min: 52 characters
- mean: 346.04 characters
- max: 892 characters
- min: 0.0
- mean: 0.5
- max: 1.0
- Samples:
query passage score cost to repair a manifold gasket
Parts. The cost of the parts required to repair or replace your intake manifold gasket ranges from $25 to $100 in 2010, according to RepairPal, depending on the year and make of your car. This range applies if you have a 2005 Ford Taurus or a 2011 BMW 750Li.
1.0
what county is salisbury missouri in
The St. Louis County, Missouri sales tax is 7.11% , consisting of 4.23% Missouri state sales tax and 2.89% St. Louis County local sales taxes.The local sales tax consists of a 1.64% county sales tax and a 1.25% special district sales tax (used to fund transportation districts, local attractions, etc). St. Louis County Missouri Sales Tax Exemptions.
0.0
what is life expectancy for someone with lung cancer
The two general types of lung cancer include: Small cell lung cancer. Small cell lung cancer occurs almost exclusively in heavy smokers and is less common than non-small cell lung cancer. Non-small cell lung cancer. Non-small cell lung cancer is an umbrella term for several types of lung cancers that behave in a similar way. Non-small cell lung cancers include squamous cell carcinoma, adenocarcinoma and large cell carcinoma.
0.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
: 16per_device_eval_batch_size
: 16learning_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
: 16per_device_eval_batch_size
: 16per_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_R100_ndcg@10 | NanoNFCorpus_R100_ndcg@10 | NanoNQ_R100_ndcg@10 | NanoBEIR_R100_mean_ndcg@10 |
---|---|---|---|---|---|---|---|
-1 | -1 | - | - | 0.0463 (-0.4941) | 0.2098 (-0.1153) | 0.0229 (-0.4777) | 0.0930 (-0.3624) |
0.0000 | 1 | 0.6924 | - | - | - | - | - |
0.0322 | 4000 | 0.4573 | - | - | - | - | - |
0.0643 | 8000 | 0.2515 | - | - | - | - | - |
0.0804 | 10000 | - | 0.2219 | 0.6264 (+0.0860) | 0.3713 (+0.0463) | 0.7032 (+0.2026) | 0.5670 (+0.1116) |
0.0965 | 12000 | 0.2335 | - | - | - | - | - |
0.1286 | 16000 | 0.2294 | - | - | - | - | - |
0.1608 | 20000 | 0.2172 | 0.2071 | 0.5972 (+0.0568) | 0.3913 (+0.0662) | 0.6825 (+0.1818) | 0.5570 (+0.1016) |
0.1930 | 24000 | 0.2086 | - | - | - | - | - |
0.2251 | 28000 | 0.2075 | - | - | - | - | - |
0.2412 | 30000 | - | 0.1947 | 0.6298 (+0.0893) | 0.3858 (+0.0608) | 0.7129 (+0.2123) | 0.5762 (+0.1208) |
0.2573 | 32000 | 0.2015 | - | - | - | - | - |
0.2894 | 36000 | 0.2003 | - | - | - | - | - |
0.3216 | 40000 | 0.1976 | 0.1759 | 0.6333 (+0.0929) | 0.3757 (+0.0506) | 0.7058 (+0.2052) | 0.5716 (+0.1162) |
0.3538 | 44000 | 0.1945 | - | - | - | - | - |
0.3859 | 48000 | 0.1881 | - | - | - | - | - |
0.4020 | 50000 | - | 0.1735 | 0.6267 (+0.0862) | 0.3752 (+0.0502) | 0.7417 (+0.2410) | 0.5812 (+0.1258) |
0.4181 | 52000 | 0.1875 | - | - | - | - | - |
0.4503 | 56000 | 0.1875 | - | - | - | - | - |
0.4824 | 60000 | 0.1836 | 0.1726 | 0.5941 (+0.0537) | 0.3915 (+0.0665) | 0.7071 (+0.2064) | 0.5642 (+0.1089) |
0.5146 | 64000 | 0.179 | - | - | - | - | - |
0.5467 | 68000 | 0.178 | - | - | - | - | - |
0.5628 | 70000 | - | 0.1622 | 0.6245 (+0.0841) | 0.3920 (+0.0669) | 0.7220 (+0.2213) | 0.5795 (+0.1241) |
0.5789 | 72000 | 0.1791 | - | - | - | - | - |
0.6111 | 76000 | 0.1759 | - | - | - | - | - |
0.6432 | 80000 | 0.1775 | 0.1661 | 0.6413 (+0.1009) | 0.3979 (+0.0728) | 0.7395 (+0.2388) | 0.5929 (+0.1375) |
0.6754 | 84000 | 0.1724 | - | - | - | - | - |
0.7075 | 88000 | 0.1714 | - | - | - | - | - |
0.7236 | 90000 | - | 0.1684 | 0.6535 (+0.1131) | 0.3780 (+0.0529) | 0.7460 (+0.2454) | 0.5925 (+0.1371) |
0.7397 | 92000 | 0.165 | - | - | - | - | - |
0.7719 | 96000 | 0.1678 | - | - | - | - | - |
0.8040 | 100000 | 0.1673 | 0.1497 | 0.6461 (+0.1056) | 0.3637 (+0.0387) | 0.7306 (+0.2300) | 0.5801 (+0.1248) |
0.8362 | 104000 | 0.1644 | - | - | - | - | - |
0.8683 | 108000 | 0.1617 | - | - | - | - | - |
0.8844 | 110000 | - | 0.1513 | 0.6767 (+0.1363) | 0.3674 (+0.0424) | 0.7340 (+0.2334) | 0.5927 (+0.1373) |
0.9005 | 112000 | 0.1605 | - | - | - | - | - |
0.9327 | 116000 | 0.1667 | - | - | - | - | - |
0.9648 | 120000 | 0.1624 | 0.1474 | 0.6530 (+0.1126) | 0.3671 (+0.0420) | 0.7412 (+0.2406) | 0.5871 (+0.1317) |
0.9970 | 124000 | 0.1608 | - | - | - | - | - |
-1 | -1 | - | - | 0.6413 (+0.1009) | 0.3979 (+0.0728) | 0.7395 (+0.2388) | 0.5929 (+0.1375) |
- The bold row denotes the saved checkpoint.
Environmental Impact
Carbon emissions were measured using CodeCarbon.
- Energy Consumed: 0.638 kWh
- Carbon Emitted: 0.248 kg of CO2
- Hours Used: 2.404 hours
Training Hardware
- On Cloud: No
- GPU Model: 1 x NVIDIA GeForce RTX 3090
- CPU Model: 13th Gen Intel(R) Core(TM) i7-13700K
- RAM Size: 31.78 GB
Framework Versions
- Python: 3.11.6
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.49.0
- PyTorch: 2.6.0+cu124
- Accelerate: 1.4.0
- Datasets: 3.3.2
- 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
- 5
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 model has no pipeline_tag.
Model tree for tomaarsen/reranker-MiniLM-L12-H384-uncased-msmarco-bce
Base model
microsoft/MiniLM-L12-H384-uncasedDataset used to train tomaarsen/reranker-MiniLM-L12-H384-uncased-msmarco-bce
Evaluation results
- Map on NanoMSMARCO R100self-reported0.558
- Mrr@10 on NanoMSMARCO R100self-reported0.553
- Ndcg@10 on NanoMSMARCO R100self-reported0.641
- Map on NanoNFCorpus R100self-reported0.332
- Mrr@10 on NanoNFCorpus R100self-reported0.517
- Ndcg@10 on NanoNFCorpus R100self-reported0.398
- Map on NanoNQ R100self-reported0.694
- Mrr@10 on NanoNQ R100self-reported0.719
- Ndcg@10 on NanoNQ R100self-reported0.740
- Map on NanoBEIR R100 meanself-reported0.528