Downloads · 30 days
7
3% of all-time downloads
tomaarsen/reranker-MiniLM-L12-H384-uncased-msmarco-bce
reranker-MiniLM-L12-H384-uncased-msmarco-bce is a text ranking model from tomaarsen. Use it for the text ranking task on the model card, and read the license before you ship it in a product. It is set up for sentence-transformers.
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 rerankin…
Downloads · 30 days
7
3% of all-time downloads
All-time downloads
207
Public
Parameters
33.4M
133 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors133 MB · 99%
From the Hugging Face model README
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.
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': ...}, ...]
<!--
### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>
-->
<!--
### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
NanoMSMARCO_R100, NanoNFCorpus_R100 and NanoNQ_R100{
"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) |
NanoBEIR_R100_mean{
"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) |
| query | passage | score | |
|---|---|---|---|
| type | string | string | float |
| details | <ul><li>min: 10 characters</li><li>mean: 34.4 characters</li><li>max: 200 characters</li></ul> | <ul><li>min: 88 characters</li><li>mean: 344.88 characters</li><li>max: 935 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.48</li><li>max: 1.0</li></ul> |
| query | passage | score |
|---|---|---|
| <code>who is erin anderson?</code> | <code>Erin Anderson is an actress and writer, known for Kittens in a Cage (2015), The Mysteries of Laura (2014) and Insidious: Chapter 3 (2015).</code> | <code>1.0</code> |
| <code>how long is a food handlers permit good for in california</code> | <code>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.</code> | <code>1.0</code> |
| <code>matagorda tx is in what county</code> | <code>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.</code> | <code>1.0</code> |
{
"activation_fct": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
| query | passage | score | |
|---|---|---|---|
| type | string | string | float |
| details | <ul><li>min: 7 characters</li><li>mean: 33.41 characters</li><li>max: 114 characters</li></ul> | <ul><li>min: 52 characters</li><li>mean: 346.04 characters</li><li>max: 892 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.5</li><li>max: 1.0</li></ul> |
| query | passage | score |
|---|---|---|
| <code>cost to repair a manifold gasket</code> | <code>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.</code> | <code>1.0</code> |
| <code>what county is salisbury missouri in</code> | <code>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.</code> | <code>0.0</code> |
| <code>what is life expectancy for someone with lung cancer</code> | <code>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.</code> | <code>0.0</code> |
{
"activation_fct": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
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: Trueoverwrite_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| 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) |
Carbon emissions were measured using CodeCarbon.
@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",
}
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->