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 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
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
model = CrossEncoder("yjoonjang/reranker-msmarco-v1.1-MiniLM-L12-H384-uncased-plistmle-tanh")
pairs = [
['How many calories in an egg', 'There are on average between 55 and 80 calories in an egg depending on its size.'],
['How many calories in an egg', 'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.'],
['How many calories in an egg', 'Most of the calories in an egg come from the yellow yolk in the center.'],
]
scores = model.predict(pairs)
print(scores.shape)
ranks = model.rank(
'How many calories in an egg',
[
'There are on average between 55 and 80 calories in an egg depending on its size.',
'Egg whites are very low in calories, have no fat, no cholesterol, and are loaded with protein.',
'Most of the calories in an egg come from the yellow yolk in the center.',
]
)
Evaluation
Metrics
Cross Encoder Reranking
| Metric |
NanoMSMARCO_R100 |
NanoNFCorpus_R100 |
NanoNQ_R100 |
| map |
0.4793 (-0.0103) |
0.3262 (+0.0652) |
0.5706 (+0.1510) |
| mrr@10 |
0.4667 (-0.0108) |
0.5391 (+0.0393) |
0.5727 (+0.1460) |
| ndcg@10 |
0.5367 (-0.0038) |
0.3374 (+0.0124) |
0.6188 (+0.1182) |
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.4587 (+0.0686) |
| mrr@10 |
0.5262 (+0.0582) |
| ndcg@10 |
0.4976 (+0.0423) |
Training Details
Training Dataset
ms_marco
- Dataset: ms_marco at a47ee7a
- Size: 78,704 training samples
- Columns:
query, docs, and labels
- Approximate statistics based on the first 1000 samples:
|
query |
docs |
labels |
| type |
string |
list |
list |
| details |
- min: 11 characters
- mean: 33.21 characters
- max: 83 characters
|
- min: 2 elements
- mean: 6.00 elements
- max: 10 elements
|
- min: 2 elements
- mean: 6.00 elements
- max: 10 elements
|
- Samples:
| query |
docs |
labels |
what is dubbin made of |
["A recipe for Dubbin. One of the disadvantages of living out in the sticks is that when and idea or urge pops into your head and you need to purchase something to complete it, you need to be patient. I had a bit of a browse on tinternet to find out if you could make it. turns out it is made from tallow, beeswax and fish or mink oil. Found a website where they make their own and got the recipe, tweaked it a bit and Bob's your uncle, got it made, Go Mel !!", 'I have successfully made my own Dubbin: I rendered sheep fat for the tallow (beautiful white stuff-also good for cooking and preparing cast iron cookware), and then I added Beeswax and Neatsfoot oil and a few other extras. 1 DUBBIN Can be used over any non-sealing finish, such as spirit dyes and water based dyes as well as water based inks. 2 DUBBIN allows leather to become supple without loosing its shape-it helps the leather to stay alive and always as beautiful as new.', "Dubbin is made from tallow, natural wax and OIL. The wax... |
[1, 0, 0, 0, 0, ...] |
is chromogranin a a tumor marker |
['Chromogranin A (CGA) is a protein found in and released from neuroendocrine cells. The Chromogranin A test is used as a tumor marker. It may be ordered in combination with or in place of serotonin to help as an aid to diagnose carcinoid syndrome. Typical carcinoid symptoms include: 1 Flushing. 2 Diarrhea. 3 Abdominal pain. 4 Wheezing. 5 Valvular heart disease. ', 'Chromogranin A. Chromogranins are a family of glycoproteins with dense-core secretory vesicles that are found in neuronal and endocrine tissues. 3 Despite certain limitations, CgA is currently the most useful circulating marker for carcinoid tumors and PNET 5 and is elevated in 60% to 100% of NET. 4.', '* a_mamdouh8@hotmail.com Abstract: Evaluation of Serum Chromogranin A as a Useful Tumor Marker for Diagnosis of Hepatocellular Carcinoma. Journal of American Science 2011; 7(1):999-1007]. (ISSN: 1545-1003). http://www.americanscience.org. ', 'Chromogranin A (CgA) is an acidic glycoprotein expressed in the secretory gran... |
[1, 0, 0, 0, 0, ...] |
what is an MRA |
['Magnetic Resonance Angiogram (MRA). Guide. A magnetic resonance angiogram (MRA) is a type of magnetic resonance imaging (MRI) scan that uses a magnetic field and pulses of radio wave energy to provide pictures of blood vessels inside the body.', 'Why It Is Done. A magnetic resonance angiogram (MRA) is done to look for: 1 A bulge (aneurysm), clot, or the buildup of fat and calcium deposits (stenosis caused by plaque) in the blood vessels leading to the brain. 2 An aneurysm or tear (dissection) in the aorta, which carries blood from the heart to the rest of the body.', 'MRA: The magnetic resonance angiogram, or MRA, is a noninvasive test that has demonstrated usefulness in defining the anatomy of blood vessels of certain size in the head and neck. MRA serves as a complement to traditional MRI scanning in evaluation of the brain and neck.', '2. MRA. An MRA is a troglodyte that writes “women’s rights --- ROFLOL!“ and “a woman is the useless skin around the vagina” on Urban Dictionary. ... |
[1, 0, 0, 0, 0, ...] |
- Loss:
ListMLELoss with these parameters:{
"lambda_weight": "sentence_transformers.cross_encoder.losses.ListMLELoss.ListMLELambdaWeight",
"activation_fct": "torch.nn.modules.activation.Tanh",
"mini_batch_size": 16,
"respect_input_order": true
}
Evaluation Dataset
ms_marco
- Dataset: ms_marco at a47ee7a
- Size: 1,000 evaluation samples
- Columns:
query, docs, and labels
- Approximate statistics based on the first 1000 samples:
|
query |
docs |
labels |
| type |
string |
list |
list |
| details |
- min: 11 characters
- mean: 33.85 characters
- max: 109 characters
|
- min: 3 elements
- mean: 6.50 elements
- max: 10 elements
|
- min: 3 elements
- mean: 6.50 elements
- max: 10 elements
|
- Samples:
| query |
docs |
labels |
what is an xc mountain bike |
['A cross-country mountain biker on a trail in Utah. Cross-country (XC) cycling is the most common discipline of mountain biking. Cross-country cycling became an Olympic sport in 1996 and is the only form of mountain biking practiced at the Olympics. Cross-country bicycles are some of the lightest mountain bikes, typically between 7 and 16 kilograms (15 and 35 lb). They usually feature suspension forks in front and sometimes have suspension in the rear', 'All Mountain, or Enduro bikes, are very similar to XC Trail bikes, but will have stronger frames, and a bit more travel in the suspension. Most of these bike will be in the full suspension category, and will have around 140-160 mm travel in them. The cold hard reality of modern mountain biking is that there as many bike types as there are riding disciplines. For people who are really into riding, and for whom riding is a way of life, it really isn’t uncommon for them to own 2 or 3 different types of mountain bike.', "Posts. 12. XC cou... |
[1, 0, 0, 0, 0, ...] |
when did colorado become a state |
["Colorado Became a State August 1, 1876. The 1846-1848 war between Mexico and the United States ended in the Treaty of Guadalupe Hidalgo (1848). The impetus for the organization of the Colorado territory was the discovery of gold. On 28 February 1861, the U.S. government organized the Territory of Colorado. (Colorado City and Golden served as the territory's capital, before Denver was declared the capital in 1867.). Colorado became a state on 1 August 1876. Due to the expansion of the railroads across the plains and into the mountains, and the subsequent increase in economic linkages, the state's population quickly grew", "The impetus for the organization of the Colorado territory was the discovery of gold. On 28 February 1861, the U.S. government organized the Territory of Colorado. (Colorado City and Golden served as the territory's capital, before Denver was declared the capital in 1867.) Colorado became a state on 1 August 1876.", 'It took sixteen years, four Colorado votes, three... |
[1, 0, 0, 0, 0, ...] |
how much for roth ira value |
['For details, see more on Roth IRA conversions). For 2015, you can contribute the maximum $5,500 to a Roth IRA ($6,500 if you are age 50 or older by the end of the year) if you are single or the single head of a household and your modified adjusted gross income (MAGI) is less than $164,000.', 'Calculate your after tax deposit amount and how much you will save in a Roth IRA. Add this retirement calculator to your site to keep your customers coming back. This Roth IRA calculator will integrate right into your existing website automatically.', 'The current balance of your Roth IRA. Annual contribution. The amount you will contribute to your Roth IRA each year. This calculator assumes that you make your contribution at the beginning of each year. The maximum annual IRA contribution of $5,500 is unchanged for 2015. It is important to note that this is the maximum total contributed to all of your IRA accounts.', 'Contribution Limits. As of 2013 you can contribute up to $5,500 each year to y... |
[1, 0, 0, 0, 0, ...] |
- Loss:
ListMLELoss with these parameters:{
"lambda_weight": "sentence_transformers.cross_encoder.losses.ListMLELoss.ListMLELambdaWeight",
"activation_fct": "torch.nn.modules.activation.Tanh",
"mini_batch_size": 16,
"respect_input_order": true
}
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: steps
per_device_train_batch_size: 16
per_device_eval_batch_size: 16
learning_rate: 2e-05
num_train_epochs: 1
warmup_ratio: 0.1
seed: 12
bf16: True
load_best_model_at_end: True
All Hyperparameters
Click to expand
overwrite_output_dir: False
do_predict: False
eval_strategy: steps
prediction_loss_only: True
per_device_train_batch_size: 16
per_device_eval_batch_size: 16
per_gpu_train_batch_size: None
per_gpu_eval_batch_size: None
gradient_accumulation_steps: 1
eval_accumulation_steps: None
torch_empty_cache_steps: None
learning_rate: 2e-05
weight_decay: 0.0
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-08
max_grad_norm: 1.0
num_train_epochs: 1
max_steps: -1
lr_scheduler_type: linear
lr_scheduler_kwargs: {}
warmup_ratio: 0.1
warmup_steps: 0
log_level: passive
log_level_replica: warning
log_on_each_node: True
logging_nan_inf_filter: True
save_safetensors: True
save_on_each_node: False
save_only_model: False
restore_callback_states_from_checkpoint: False
no_cuda: False
use_cpu: False
use_mps_device: False
seed: 12
data_seed: None
jit_mode_eval: False
use_ipex: False
bf16: True
fp16: False
fp16_opt_level: O1
half_precision_backend: auto
bf16_full_eval: False
fp16_full_eval: False
tf32: None
local_rank: 0
ddp_backend: None
tpu_num_cores: None
tpu_metrics_debug: False
debug: []
dataloader_drop_last: False
dataloader_num_workers: 0
dataloader_prefetch_factor: None
past_index: -1
disable_tqdm: False
remove_unused_columns: True
label_names: None
load_best_model_at_end: True
ignore_data_skip: False
fsdp: []
fsdp_min_num_params: 0
fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
fsdp_transformer_layer_cls_to_wrap: None
accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
deepspeed: None
label_smoothing_factor: 0.0
optim: adamw_torch
optim_args: None
adafactor: False
group_by_length: False
length_column_name: length
ddp_find_unused_parameters: None
ddp_bucket_cap_mb: None
ddp_broadcast_buffers: False
dataloader_pin_memory: True
dataloader_persistent_workers: False
skip_memory_metrics: True
use_legacy_prediction_loop: False
push_to_hub: False
resume_from_checkpoint: None
hub_model_id: None
hub_strategy: every_save
hub_private_repo: None
hub_always_push: False
gradient_checkpointing: False
gradient_checkpointing_kwargs: None
include_inputs_for_metrics: False
include_for_metrics: []
eval_do_concat_batches: True
fp16_backend: auto
push_to_hub_model_id: None
push_to_hub_organization: None
mp_parameters:
auto_find_batch_size: False
full_determinism: False
torchdynamo: None
ray_scope: last
ddp_timeout: 1800
torch_compile: False
torch_compile_backend: None
torch_compile_mode: None
dispatch_batches: None
split_batches: None
include_tokens_per_second: False
include_num_input_tokens_seen: False
neftune_noise_alpha: None
optim_target_modules: None
batch_eval_metrics: False
eval_on_start: False
use_liger_kernel: False
eval_use_gather_object: False
average_tokens_across_devices: False
prompts: None
batch_sampler: batch_sampler
multi_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.0669 (-0.4735) |
0.2492 (-0.0759) |
0.0338 (-0.4669) |
0.1166 (-0.3387) |
| 0.0002 |
1 |
1172.8087 |
- |
- |
- |
- |
- |
| 0.0508 |
250 |
927.3161 |
- |
- |
- |
- |
- |
| 0.1016 |
500 |
922.4274 |
900.2140 |
0.1417 (-0.3987) |
0.2186 (-0.1064) |
0.3470 (-0.1536) |
0.2358 (-0.2196) |
| 0.1525 |
750 |
887.1161 |
- |
- |
- |
- |
- |
| 0.2033 |
1000 |
883.4986 |
890.5686 |
0.3210 (-0.2194) |
0.3210 (-0.0040) |
0.5384 (+0.0377) |
0.3935 (-0.0619) |
| 0.2541 |
1250 |
893.9945 |
- |
- |
- |
- |
- |
| 0.3049 |
1500 |
882.1399 |
886.1149 |
0.4382 (-0.1023) |
0.3402 (+0.0151) |
0.6326 (+0.1319) |
0.4703 (+0.0149) |
| 0.3558 |
1750 |
893.6919 |
- |
- |
- |
- |
- |
| 0.4066 |
2000 |
860.9903 |
883.2151 |
0.4323 (-0.1081) |
0.3507 (+0.0256) |
0.5919 (+0.0913) |
0.4583 (+0.0029) |
| 0.4574 |
2250 |
864.9159 |
- |
- |
- |
- |
- |
| 0.5082 |
2500 |
879.1681 |
880.0072 |
0.4801 (-0.0603) |
0.3309 (+0.0058) |
0.5657 (+0.0651) |
0.4589 (+0.0035) |
| 0.5591 |
2750 |
871.9338 |
- |
- |
- |
- |
- |
| 0.6099 |
3000 |
876.5861 |
876.0945 |
0.5367 (-0.0038) |
0.3374 (+0.0124) |
0.6188 (+0.1182) |
0.4976 (+0.0423) |
| 0.6607 |
3250 |
869.3333 |
- |
- |
- |
- |
- |
| 0.7115 |
3500 |
877.5201 |
878.9338 |
0.4719 (-0.0685) |
0.3416 (+0.0166) |
0.5921 (+0.0914) |
0.4685 (+0.0132) |
| 0.7624 |
3750 |
874.4561 |
- |
- |
- |
- |
- |
| 0.8132 |
4000 |
869.9234 |
875.8646 |
0.5169 (-0.0236) |
0.3306 (+0.0055) |
0.5979 (+0.0973) |
0.4818 (+0.0264) |
| 0.8640 |
4250 |
876.4072 |
- |
- |
- |
- |
- |
| 0.9148 |
4500 |
873.4344 |
875.6801 |
0.5085 (-0.0319) |
0.3286 (+0.0036) |
0.6254 (+0.1248) |
0.4875 (+0.0322) |
| 0.9656 |
4750 |
858.7703 |
- |
- |
- |
- |
- |
| -1 |
-1 |
- |
- |
0.5367 (-0.0038) |
0.3374 (+0.0124) |
0.6188 (+0.1182) |
0.4976 (+0.0423) |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.11.11
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.49.0
- PyTorch: 2.6.0+cu124
- Accelerate: 1.5.2
- Datasets: 3.4.0
- Tokenizers: 0.21.1
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",
}
ListMLELoss
@inproceedings{lan2013position,
title={Position-aware ListMLE: a sequential learning process for ranking},
author={Lan, Yanyan and Guo, Jiafeng and Cheng, Xueqi and Liu, Tie-Yan},
booktitle={Proceedings of the Twenty-Ninth Conference on Uncertainty in Artificial Intelligence},
pages={333--342},
year={2013}
}