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("tomaarsen/reranker-msmarco-v1.1-MiniLM-L12-H384-uncased-adrmse-pr3690")
pairs = [
['define monogenic trait', 'An allele is a version of a gene. For example, in fruitflies there is a gene which determines eye colour: one allele gives red eyes, and another gives white eyes; it is the same *gene*, just different versions of that gene. A monogenic trait is one which is encoded by a single gene. e.g. - cystic fibrosis in humans. There is a single gene which determines this trait: the wild-type allele is healthy, while the disease allele gives you cystic fibrosis'],
['define monogenic trait', 'Abstract. Monogenic inheritance refers to genetic control of a phenotype or trait by a single gene. For a monogenic trait, mutations in one (dominant) or both (recessive) copies of the gene are sufficient for the trait to be expressed. Digenic inheritance refers to mutation on two genes interacting to cause a genetic phenotype or disease. Triallelic inheritance is a special case of digenic inheritance that requires homozygous mutations at one locus and heterozygous mutations at a second locus to express a phenotype.'],
['define monogenic trait', 'A trait that is controlled by a group of nonallelic genes. Supplement. Polygenic traits are controlled by two or more than two genes (usually by many different genes) at different loci on different chromosomes. These genes are described as polygenes.'],
['define monogenic trait', "Monogenic Disorders (Single Abnormal Gene). Monogenic autosomal dominant disorders occur through the inheritance of a single copy of a defective gene. These disorders are the result of a single defective gene on the autosomes. They are inherited according to Mendel's Laws (Mendelian disorders). The mutation can be spontaneous and where there is no previous family history. Inheritance patterns can be autosomal dominant, autosomal recessive or X-linked recessive."],
['define monogenic trait', 'Adj. 1. monogenic-of or relating to an inheritable character that is controlled by a single pair of genes. genetic science, genetics-the branch of biology that studies heredity and variation in organisms. heritable, inheritable-capable of being inherited; inheritable traits such as eye color; an inheritable title. monogenic. adj. 1. (Genetics) genetics of or relating to an inherited character difference that is controlled by a single gene. 2. (Biology) (of animals) producing offspring of one sex. (ˌmɒn əˈdʒɛn ɪk).'],
]
scores = model.predict(pairs)
print(scores.shape)
ranks = model.rank(
'define monogenic trait',
[
'An allele is a version of a gene. For example, in fruitflies there is a gene which determines eye colour: one allele gives red eyes, and another gives white eyes; it is the same *gene*, just different versions of that gene. A monogenic trait is one which is encoded by a single gene. e.g. - cystic fibrosis in humans. There is a single gene which determines this trait: the wild-type allele is healthy, while the disease allele gives you cystic fibrosis',
'Abstract. Monogenic inheritance refers to genetic control of a phenotype or trait by a single gene. For a monogenic trait, mutations in one (dominant) or both (recessive) copies of the gene are sufficient for the trait to be expressed. Digenic inheritance refers to mutation on two genes interacting to cause a genetic phenotype or disease. Triallelic inheritance is a special case of digenic inheritance that requires homozygous mutations at one locus and heterozygous mutations at a second locus to express a phenotype.',
'A trait that is controlled by a group of nonallelic genes. Supplement. Polygenic traits are controlled by two or more than two genes (usually by many different genes) at different loci on different chromosomes. These genes are described as polygenes.',
"Monogenic Disorders (Single Abnormal Gene). Monogenic autosomal dominant disorders occur through the inheritance of a single copy of a defective gene. These disorders are the result of a single defective gene on the autosomes. They are inherited according to Mendel's Laws (Mendelian disorders). The mutation can be spontaneous and where there is no previous family history. Inheritance patterns can be autosomal dominant, autosomal recessive or X-linked recessive.",
'Adj. 1. monogenic-of or relating to an inheritable character that is controlled by a single pair of genes. genetic science, genetics-the branch of biology that studies heredity and variation in organisms. heritable, inheritable-capable of being inherited; inheritable traits such as eye color; an inheritable title. monogenic. adj. 1. (Genetics) genetics of or relating to an inherited character difference that is controlled by a single gene. 2. (Biology) (of animals) producing offspring of one sex. (ˌmɒn əˈdʒɛn ɪk).',
]
)
Evaluation
Metrics
Cross Encoder Reranking
| Metric |
NanoMSMARCO_R100 |
NanoNFCorpus_R100 |
NanoNQ_R100 |
| map |
0.0119 (-0.4777) |
0.2769 (+0.0159) |
0.0119 (-0.4077) |
| mrr@10 |
0.0000 (-0.4775) |
0.4572 (-0.0426) |
0.0000 (-0.4267) |
| ndcg@10 |
0.0000 (-0.5404) |
0.2911 (-0.0340) |
0.0000 (-0.5006) |
Cross Encoder Nano BEIR
- Dataset:
NanoBEIR_R100_mean
- Evaluated with
CrossEncoderNanoBEIREvaluator with these parameters:{
"dataset_names": [
"msmarco",
"nfcorpus",
"nq"
],
"dataset_id": "sentence-transformers/NanoBEIR-en",
"rerank_k": 100,
"at_k": 10,
"always_rerank_positives": true
}
| Metric |
Value |
| map |
0.1002 (-0.2898) |
| mrr@10 |
0.1524 (-0.3156) |
| ndcg@10 |
0.0970 (-0.3583) |
Training Details
Training Dataset
ms_marco
Evaluation Dataset
ms_marco
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 16
num_train_epochs: 1
learning_rate: 2e-05
warmup_steps: 0.1
bf16: True
eval_strategy: steps
per_device_eval_batch_size: 16
load_best_model_at_end: True
seed: 12
All Hyperparameters
Click to expand
per_device_train_batch_size: 16
num_train_epochs: 1
max_steps: -1
learning_rate: 2e-05
lr_scheduler_type: linear
lr_scheduler_kwargs: None
warmup_steps: 0.1
optim: adamw_torch_fused
optim_args: None
weight_decay: 0.0
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-08
optim_target_modules: None
gradient_accumulation_steps: 1
average_tokens_across_devices: True
max_grad_norm: 1.0
label_smoothing_factor: 0.0
bf16: True
fp16: False
bf16_full_eval: False
fp16_full_eval: False
tf32: None
gradient_checkpointing: False
gradient_checkpointing_kwargs: None
torch_compile: False
torch_compile_backend: None
torch_compile_mode: None
use_liger_kernel: False
liger_kernel_config: None
use_cache: False
neftune_noise_alpha: None
torch_empty_cache_steps: None
auto_find_batch_size: False
log_on_each_node: True
logging_nan_inf_filter: True
include_num_input_tokens_seen: no
log_level: passive
log_level_replica: warning
disable_tqdm: False
project: huggingface
trackio_space_id: trackio
eval_strategy: steps
per_device_eval_batch_size: 16
prediction_loss_only: True
eval_on_start: False
eval_do_concat_batches: True
eval_use_gather_object: False
eval_accumulation_steps: None
include_for_metrics: []
batch_eval_metrics: False
save_only_model: False
save_on_each_node: False
enable_jit_checkpoint: False
push_to_hub: False
hub_private_repo: None
hub_model_id: None
hub_strategy: every_save
hub_always_push: False
hub_revision: None
load_best_model_at_end: True
ignore_data_skip: False
restore_callback_states_from_checkpoint: False
full_determinism: False
seed: 12
data_seed: None
use_cpu: False
accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
parallelism_config: None
dataloader_drop_last: False
dataloader_num_workers: 0
dataloader_pin_memory: True
dataloader_persistent_workers: False
dataloader_prefetch_factor: None
remove_unused_columns: True
label_names: None
train_sampling_strategy: random
length_column_name: length
ddp_find_unused_parameters: None
ddp_bucket_cap_mb: None
ddp_broadcast_buffers: False
ddp_backend: None
ddp_timeout: 1800
fsdp: []
fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
deepspeed: None
debug: []
skip_memory_metrics: True
do_predict: False
resume_from_checkpoint: None
warmup_ratio: None
local_rank: -1
prompts: None
batch_sampler: batch_sampler
multi_dataset_batch_sampler: proportional
router_mapping: {}
learning_rate_mapping: {}
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.0300 (-0.5104) |
0.2528 (-0.0723) |
0.0168 (-0.4839) |
0.0999 (-0.3555) |
| 0.0002 |
1 |
3.9366 |
- |
- |
- |
- |
- |
| 0.0508 |
250 |
3.4133 |
- |
- |
- |
- |
- |
| 0.1016 |
500 |
3.2421 |
3.1803 |
0.0000 (-0.5404) |
0.2948 (-0.0302) |
0.0000 (-0.5006) |
0.0983 (-0.3571) |
| 0.1525 |
750 |
3.1528 |
- |
- |
- |
- |
- |
| 0.2033 |
1000 |
3.1311 |
3.0493 |
0.0000 (-0.5404) |
0.2736 (-0.0514) |
0.0000 (-0.5006) |
0.0912 (-0.3642) |
| 0.2541 |
1250 |
3.0680 |
- |
- |
- |
- |
- |
| 0.3049 |
1500 |
3.0694 |
3.0414 |
0.0000 (-0.5404) |
0.2614 (-0.0637) |
0.0000 (-0.5006) |
0.0871 (-0.3682) |
| 0.3558 |
1750 |
3.0869 |
- |
- |
- |
- |
- |
| 0.4066 |
2000 |
3.0396 |
3.0147 |
0.0000 (-0.5404) |
0.2783 (-0.0467) |
0.0000 (-0.5006) |
0.0928 (-0.3626) |
| 0.4574 |
2250 |
3.0689 |
- |
- |
- |
- |
- |
| 0.5082 |
2500 |
3.0394 |
3.0311 |
0.0000 (-0.5404) |
0.2718 (-0.0532) |
0.0000 (-0.5006) |
0.0906 (-0.3648) |
| 0.5591 |
2750 |
3.0261 |
- |
- |
- |
- |
- |
| 0.6099 |
3000 |
3.0575 |
3.0015 |
0.0000 (-0.5404) |
0.2854 (-0.0396) |
0.0000 (-0.5006) |
0.0951 (-0.3602) |
| 0.6607 |
3250 |
3.0334 |
- |
- |
- |
- |
- |
| 0.7115 |
3500 |
2.9976 |
2.9902 |
0.0000 (-0.5404) |
0.2779 (-0.0471) |
0.0000 (-0.5006) |
0.0926 (-0.3627) |
| 0.7624 |
3750 |
3.0210 |
- |
- |
- |
- |
- |
| 0.8132 |
4000 |
3.0223 |
2.9917 |
0.0000 (-0.5404) |
0.2774 (-0.0477) |
0.0000 (-0.5006) |
0.0925 (-0.3629) |
| 0.8640 |
4250 |
3.0282 |
- |
- |
- |
- |
- |
| 0.9148 |
4500 |
3.0142 |
2.9831 |
0.0000 (-0.5404) |
0.2858 (-0.0392) |
0.0000 (-0.5006) |
0.0953 (-0.3601) |
| 0.9656 |
4750 |
3.0121 |
- |
- |
- |
- |
- |
| -1 |
-1 |
- |
- |
0.0000 (-0.5404) |
0.2911 (-0.0340) |
0.0000 (-0.5006) |
0.0970 (-0.3583) |
- The bold row denotes the saved checkpoint.
Framework Versions
- Python: 3.11.6
- Sentence Transformers: 5.4.0.dev0
- Transformers: 5.3.0.dev0
- PyTorch: 2.10.0+cu128
- Accelerate: 1.13.0.dev0
- Datasets: 4.3.0
- Tokenizers: 0.22.2
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",
}
ADRMSELoss
@inproceedings{reddy2024rankdistillm,
title={Rank-DistiLLM: Closing the Effectiveness Gap Between Cross-Encoders and LLMs for Passage Re-Ranking},
author={Reddy, Revanth Gangi and Doo, JaeHyeok and Xu, Yifei and Sultan, Arafat and Bhat, Ganesh and Zhai, ChengXiang and Ji, Heng},
year={2024},
eprint={2405.07920},
archivePrefix={arXiv},
primaryClass={cs.IR}
}