Downloads · 30 days
11
19% of all-time downloads
bansalaman18/reranker-bert-uncased_L-8_H-256_A-4-msmarco-bce
reranker-bert-uncased_L-8_H-256_A-4-msmarco-bce is a text ranking model from bansalaman18. 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 bansalaman18/bert-uncasedL-8H-256A-4 on the msmarco dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for text reran…
Downloads · 30 days
11
19% of all-time downloads
All-time downloads
59
Public
Parameters
14.3M
57.3 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors57.3 MB · 98%
From the Hugging Face model README
This is a Cross Encoder model finetuned from bansalaman18/bert-uncased_L-8_H-256_A-4 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("bansalaman18/reranker-bert-uncased_L-8_H-256_A-4-msmarco-bce")
# Get scores for pairs of texts
pairs = [
['who is wale the rapper', "Wale (rapper)'s wiki: Olubowale Victor Akintimehin (born September 21, 1984), better known by his stage name Wale (/Ë\x88wÉ\x94Ë\x90leɪ/ WAW-lay), is an American rapper from Washington, D.C. He rose to prominence in 2006, when his song Dig Dug (Shake It) became popular in his hometown. Wale became locally recognized and continued recording music for the regional audience."],
['what is platinum used for', 'The periodic table is a chart that shows how elements are related to one another. Indium is a transition metal that is also part of the platinum family. The metals in the platinum family are also known as the noble metals. They have this name because they do not react well with other elements and compounds. They appear to be too superior to react with most other substances. In fact, iridium is the most corrosion-resistant metal known.'],
['where is the gonzaga university located', 'Where We Are. The Boise State University Department of Public Safety substation is located in Capitol Village at 2245 University Drive. Our office is open 24 hours a day, 7 days a week, so we are always available. Physical Address: 2245 University Drive, Boise, Idaho 83706.'],
['most common protein in the human body', 'Protein is the second category of food that a human body can get energy from. Most people know protein as animal meat-a hamburger, a chicken leg. These are all proteins. You can also extract protein from certain plants.Soy protein isolate is a well known protein that comes from soybeans.uman Body Four Energy Sources. The human body can only metabolize four types of energy sources. These four categories are carbohydrates (sugars and starches), fats (includes oils), proteins (animal and vegetable), and alcohol.'],
['where is azilda ontario', 'Azilda railway station is a Via Rail flag stop station located in Azilda, Ontario, in the city of Greater Sudbury community of Rayside-Balfour. It is on the Canadian Pacific Railway transcontinental main line, and is served by the regional rail Sudbury â\x80\x93 White River train. Map 12 (PDF) (Map). 1 : 1,600,000.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'who is wale the rapper',
[
"Wale (rapper)'s wiki: Olubowale Victor Akintimehin (born September 21, 1984), better known by his stage name Wale (/Ë\x88wÉ\x94Ë\x90leɪ/ WAW-lay), is an American rapper from Washington, D.C. He rose to prominence in 2006, when his song Dig Dug (Shake It) became popular in his hometown. Wale became locally recognized and continued recording music for the regional audience.",
'The periodic table is a chart that shows how elements are related to one another. Indium is a transition metal that is also part of the platinum family. The metals in the platinum family are also known as the noble metals. They have this name because they do not react well with other elements and compounds. They appear to be too superior to react with most other substances. In fact, iridium is the most corrosion-resistant metal known.',
'Where We Are. The Boise State University Department of Public Safety substation is located in Capitol Village at 2245 University Drive. Our office is open 24 hours a day, 7 days a week, so we are always available. Physical Address: 2245 University Drive, Boise, Idaho 83706.',
'Protein is the second category of food that a human body can get energy from. Most people know protein as animal meat-a hamburger, a chicken leg. These are all proteins. You can also extract protein from certain plants.Soy protein isolate is a well known protein that comes from soybeans.uman Body Four Energy Sources. The human body can only metabolize four types of energy sources. These four categories are carbohydrates (sugars and starches), fats (includes oils), proteins (animal and vegetable), and alcohol.',
'Azilda railway station is a Via Rail flag stop station located in Azilda, Ontario, in the city of Greater Sudbury community of Rayside-Balfour. It is on the Canadian Pacific Railway transcontinental main line, and is served by the regional rail Sudbury â\x80\x93 White River train. Map 12 (PDF) (Map). 1 : 1,600,000.',
]
)
# [{'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.0439 (-0.4457) | 0.2612 (+0.0002) | 0.0906 (-0.3290) |
| mrr@10 | 0.0189 (-0.4586) | 0.3655 (-0.1343) | 0.0656 (-0.3611) |
| ndcg@10 | 0.0328 (-0.5076) | 0.2241 (-0.1009) | 0.1033 (-0.3974) |
NanoBEIR_R100_mean{
"dataset_names": [
"msmarco",
"nfcorpus",
"nq"
],
"rerank_k": 100,
"at_k": 10,
"always_rerank_positives": true
}
| Metric | Value |
|---|---|
| map | 0.1319 (-0.2582) |
| mrr@10 | 0.1500 (-0.3180) |
| ndcg@10 | 0.1201 (-0.3353) |
| query | passage | score | |
|---|---|---|---|
| type | string | string | float |
| details | <ul><li>min: 10 characters</li><li>mean: 34.26 characters</li><li>max: 168 characters</li></ul> | <ul><li>min: 60 characters</li><li>mean: 343.34 characters</li><li>max: 984 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.53</li><li>max: 1.0</li></ul> |
| query | passage | score |
|---|---|---|
| <code>who is the actor that plays the tanned colonel for kfc?</code> | <code>James Rebhorn Actor, Scent of a Woman James Robert Rebhorn (September 1, 1948 - March 21, 2014) was an American actor who appeared in over 100 films, television series, and plays. At the time of his death, he had recurring roles in the current series White Collar and Homeland.</code> | <code>0.0</code> |
| <code>asking for an increase in credit limit harm your credit score</code> | <code>If you request a credit line increase, you should ask the lender whether it will result in your credit report being pulled. If it does, this will show up as an inquiry on your report and generally remains on your credit report for two years.Too many inquiries can lower your credit score.f you request a credit line increase, you should ask the lender whether it will result in your credit report being pulled. If it does, this will show up as an inquiry on your report and generally remains on your credit report for two years.</code> | <code>1.0</code> |
| <code>what is a sheep ked</code> | <code>Cysteine is required by sheep to produce wool: It is an essential amino acid that must be taken in from their feed. As a consequence, during drought conditions, sheep produce less wool; however, transgenic sheep that can make their own cysteine have been developed.</code> | <code>0.0</code> |
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
| query | passage | score | |
|---|---|---|---|
| type | string | string | float |
| details | <ul><li>min: 11 characters</li><li>mean: 34.79 characters</li><li>max: 118 characters</li></ul> | <ul><li>min: 86 characters</li><li>mean: 353.31 characters</li><li>max: 970 characters</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.52</li><li>max: 1.0</li></ul> |
| query | passage | score |
|---|---|---|
| <code>who is wale the rapper</code> | <code>Wale (rapper)'s wiki: Olubowale Victor Akintimehin (born September 21, 1984), better known by his stage name Wale (/ËwÉËleɪ/ WAW-lay), is an American rapper from Washington, D.C. He rose to prominence in 2006, when his song Dig Dug (Shake It) became popular in his hometown. Wale became locally recognized and continued recording music for the regional audience.</code> | <code>1.0</code> |
| <code>what is platinum used for</code> | <code>The periodic table is a chart that shows how elements are related to one another. Indium is a transition metal that is also part of the platinum family. The metals in the platinum family are also known as the noble metals. They have this name because they do not react well with other elements and compounds. They appear to be too superior to react with most other substances. In fact, iridium is the most corrosion-resistant metal known.</code> | <code>0.0</code> |
| <code>where is the gonzaga university located</code> | <code>Where We Are. The Boise State University Department of Public Safety substation is located in Capitol Village at 2245 University Drive. Our office is open 24 hours a day, 7 days a week, so we are always available. Physical Address: 2245 University Drive, Boise, Idaho 83706.</code> | <code>0.0</code> |
{
"activation_fn": "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: Truehalf_precision_backend: cpu_ampdataloader_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: cpu_ampbf16_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}tp_size: 0fsdp_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: 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: proportionalrouter_mapping: {}learning_rate_mapping: {}| 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.0200 (-0.5204) | 0.3166 (-0.0084) | 0.0673 (-0.4334) | 0.1346 (-0.3207) |
| 0.0002 | 1 | 0.6624 | - | - | - | - | - |
| 0.1778 | 1000 | 0.6959 | 0.6922 | 0.0329 (-0.5075) | 0.2596 (-0.0654) | 0.0246 (-0.4761) | 0.1057 (-0.3497) |
| 0.3556 | 2000 | 0.6926 | 0.6840 | 0.0482 (-0.4922) | 0.2398 (-0.0852) | 0.0484 (-0.4523) | 0.1121 (-0.3432) |
| 0.5333 | 3000 | 0.682 | 0.6855 | 0.0464 (-0.4940) | 0.2084 (-0.1167) | 0.0698 (-0.4309) | 0.1082 (-0.3472) |
| 0.7111 | 4000 | 0.6789 | 0.6744 | 0.0367 (-0.5037) | 0.2186 (-0.1064) | 0.1015 (-0.3991) | 0.1190 (-0.3364) |
| 0.8889 | 5000 | 0.68 | 0.6723 | 0.0328 (-0.5076) | 0.2241 (-0.1009) | 0.1033 (-0.3974) | 0.1201 (-0.3353) |
| -1 | -1 | - | - | 0.0328 (-0.5076) | 0.2241 (-0.1009) | 0.1033 (-0.3974) | 0.1201 (-0.3353) |
@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.*
-->