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 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 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

# Download from the 🤗 Hub
model = CrossEncoder("tomaarsen/reranker-msmarco-v1.1-MiniLM-L12-H384-uncased-bce")
# Get scores for pairs of texts
pairs = [
    ['is the calla lily poisonous', 'wholeblossoms.com. Even just a bite or two of the elegant calla lily can cause liver failure in pets and the mouths and tongues of humans to swell. The protein asparagine, found particularly concentrated in the roots of this plant, is poisonous, so be extra prudent with this popular cut flower. Bob Vila. Calla Lily. Even just a bite or two of the elegant calla lily can cause liver failure in pets and the mouths and tongues of humans to swell.'],
    ['how long do you have to go to school to be a nurse practitioner', "A: To become a nurse practitioner at the quickest, you can take up the certificate of nursing which is a one year program and the shortest to get nursing education. Certificate in nursing allows students to be able to practice and have introductory level knowledge and skills in the field of nursing. A: In order to become a nurse, you must complete a 2 year associate's or 4 years bachelor's degree program in nursing. Upon graduation, you should obtain an RN certification and pursue a specialization through an accredited MSN degree program."],
    ['what is true about atp molecule', 'Energy is usually liberated from the ATP molecule to do work in the cell by a reaction that removes one of the phosphate-oxygen groups, leaving adenosine diphosphate (ADP). When the ATP converts to ADP, the ATP is said to be spent. '],
    ['matter ejected from lungs is called', 'sputum. mucous secretion from the lungs, bronchi, and trachea that is ejected through the mouth, in contrast to saliva, which is the secretion of the salivary glands. Called also expectoration. sputum. mucous secretion from the lungs, bronchi and trachea which is ejected through the mouth by humans but not so in animals and it is assumed that it is swallowed. sputum cup. a small—1 inch diameter—cup on a long handle for the collection of sputum from the pharynx of a large animal. sputum specime'],
    ['average iron distances for senior golfers', 'Woods. Although is difficult to take all of these factors into consideration and determine an average distance for each club, there are charts that try. For the driver, a typical woman amateur can expect to get up to 180 yards. The 3-wood can provide 160 yards and the 5-wood 140. While there are charts that list the average distance for each golf club for women, the numbers are only averages and don’t reflect how far individuals actually hit the ball. There are many factors that influence distance, including your physical characteristics and conditions on the course.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    'is the calla lily poisonous',
    [
        'wholeblossoms.com. Even just a bite or two of the elegant calla lily can cause liver failure in pets and the mouths and tongues of humans to swell. The protein asparagine, found particularly concentrated in the roots of this plant, is poisonous, so be extra prudent with this popular cut flower. Bob Vila. Calla Lily. Even just a bite or two of the elegant calla lily can cause liver failure in pets and the mouths and tongues of humans to swell.',
        "A: To become a nurse practitioner at the quickest, you can take up the certificate of nursing which is a one year program and the shortest to get nursing education. Certificate in nursing allows students to be able to practice and have introductory level knowledge and skills in the field of nursing. A: In order to become a nurse, you must complete a 2 year associate's or 4 years bachelor's degree program in nursing. Upon graduation, you should obtain an RN certification and pursue a specialization through an accredited MSN degree program.",
        'Energy is usually liberated from the ATP molecule to do work in the cell by a reaction that removes one of the phosphate-oxygen groups, leaving adenosine diphosphate (ADP). When the ATP converts to ADP, the ATP is said to be spent. ',
        'sputum. mucous secretion from the lungs, bronchi, and trachea that is ejected through the mouth, in contrast to saliva, which is the secretion of the salivary glands. Called also expectoration. sputum. mucous secretion from the lungs, bronchi and trachea which is ejected through the mouth by humans but not so in animals and it is assumed that it is swallowed. sputum cup. a small—1 inch diameter—cup on a long handle for the collection of sputum from the pharynx of a large animal. sputum specime',
        'Woods. Although is difficult to take all of these factors into consideration and determine an average distance for each club, there are charts that try. For the driver, a typical woman amateur can expect to get up to 180 yards. The 3-wood can provide 160 yards and the 5-wood 140. While there are charts that list the average distance for each golf club for women, the numbers are only averages and don’t reflect how far individuals actually hit the ball. There are many factors that influence distance, including your physical characteristics and conditions on the course.',
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Evaluation

Metrics

Cross Encoder Reranking

  • Datasets: NanoMSMARCO_R100, NanoNFCorpus_R100 and NanoNQ_R100
  • Evaluated with CrossEncoderRerankingEvaluator with these parameters:
    {
        "at_k": 10,
        "always_rerank_positives": true
    }
    
Metric NanoMSMARCO_R100 NanoNFCorpus_R100 NanoNQ_R100
map 0.4241 (-0.0655) 0.2867 (+0.0257) 0.5166 (+0.0970)
mrr@10 0.4173 (-0.0602) 0.4599 (-0.0399) 0.5251 (+0.0984)
ndcg@10 0.5014 (-0.0390) 0.2880 (-0.0370) 0.5684 (+0.0678)

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.4091 (+0.0191)
mrr@10 0.4674 (-0.0006)
ndcg@10 0.4526 (-0.0027)

Training Details

Training Dataset

ms_marco

  • Dataset: ms_marco at a47ee7a
  • Size: 666,193 training samples
  • Columns: query, passage, and label
  • Approximate statistics based on the first 1000 samples:
    query passage label
    type string string int
    details
    • min: 11 characters
    • mean: 34.43 characters
    • max: 90 characters
    • min: 62 characters
    • mean: 423.32 characters
    • max: 866 characters
    • 0: ~85.50%
    • 1: ~14.50%
  • Samples:
    query passage label
    is a meal allowance taxable 1 An exemption applies of up to three months for meal payments if the employee is required to work away from their normal work location because they're travelling on business. 2 This may be for a specific short-term, work-related journey or for a longer period such as a secondment to a distant work location. The rules also don't apply in the case where fringe benefit tax (FBT) is payable on meals directly provided by the employer such as a discount in the work canteen. The rules that limit employers' deductions of entertainment expenses also continue to apply. 0
    average temperature may alaska Precipitation [edit]. Juneau averages over 50 inches (1,270 mm) of precipitation a year, while some other areas in southeast Alaska receive as much as 275 inches (6,980 mm). Average monthly precipitation generally peaks in September or October, and is lowest in May and June. 0
    asic registered fixed and floating charge Fixed and Floating Charge. Definition: A fixed and floating charge is a form of security interest usually taken by a lender from a company to secure repayment of a loan. The company granting the charge is usually referred to as the Chargor and the person in whose favour the charge is granted is typically called the Chargee . This form of security is called fixed and floating because the chargee has: The true ingenuity of the fixed and floating charge is that it permits the chargor to deal with and sell their stock etc in the ordinary course of business without requiring consent from the chargor. 0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fct": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Evaluation Dataset

ms_marco

  • Dataset: ms_marco at a47ee7a
  • Size: 10,000 evaluation samples
  • Columns: query, passage, and label
  • Approximate statistics based on the first 1000 samples:
    query passage label
    type string string int
    details
    • min: 11 characters
    • mean: 34.23 characters
    • max: 137 characters
    • min: 88 characters
    • mean: 427.89 characters
    • max: 867 characters
    • 0: ~86.70%
    • 1: ~13.30%
  • Samples:
    query passage label
    is the calla lily poisonous wholeblossoms.com. Even just a bite or two of the elegant calla lily can cause liver failure in pets and the mouths and tongues of humans to swell. The protein asparagine, found particularly concentrated in the roots of this plant, is poisonous, so be extra prudent with this popular cut flower. Bob Vila. Calla Lily. Even just a bite or two of the elegant calla lily can cause liver failure in pets and the mouths and tongues of humans to swell. 1
    how long do you have to go to school to be a nurse practitioner A: To become a nurse practitioner at the quickest, you can take up the certificate of nursing which is a one year program and the shortest to get nursing education. Certificate in nursing allows students to be able to practice and have introductory level knowledge and skills in the field of nursing. A: In order to become a nurse, you must complete a 2 year associate's or 4 years bachelor's degree program in nursing. Upon graduation, you should obtain an RN certification and pursue a specialization through an accredited MSN degree program. 0
    what is true about atp molecule Energy is usually liberated from the ATP molecule to do work in the cell by a reaction that removes one of the phosphate-oxygen groups, leaving adenosine diphosphate (ADP). When the ATP converts to ADP, the ATP is said to be spent. 0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fct": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • 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: 32
  • per_device_eval_batch_size: 32
  • 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.0357 (-0.5047) 0.2806 (-0.0444) 0.0527 (-0.4479) 0.1230 (-0.3323)
0.0000 1 0.6838 - - - - -
0.0480 1000 0.4514 - - - - -
0.0961 2000 0.385 - - - - -
0.1441 3000 0.3892 - - - - -
0.1921 4000 0.3819 0.3777 0.2751 (-0.2653) 0.2555 (-0.0696) 0.2689 (-0.2318) 0.2665 (-0.1889)
0.2402 5000 0.3694 - - - - -
0.2882 6000 0.3641 - - - - -
0.3362 7000 0.3679 - - - - -
0.3843 8000 0.3674 0.3566 0.4745 (-0.0660) 0.2459 (-0.0792) 0.4967 (-0.0040) 0.4057 (-0.0497)
0.4323 9000 0.3677 - - - - -
0.4803 10000 0.3606 - - - - -
0.5284 11000 0.3651 - - - - -
0.5764 12000 0.3586 0.3556 0.4666 (-0.0738) 0.2720 (-0.0531) 0.5513 (+0.0506) 0.4300 (-0.0254)
0.6244 13000 0.3535 - - - - -
0.6725 14000 0.3551 - - - - -
0.7205 15000 0.3552 - - - - -
0.7685 16000 0.3516 0.3439 0.5014 (-0.0390) 0.2880 (-0.0370) 0.5684 (+0.0678) 0.4526 (-0.0027)
0.8166 17000 0.3486 - - - - -
0.8646 18000 0.3528 - - - - -
0.9126 19000 0.3526 - - - - -
0.9607 20000 0.3415 0.3423 0.4898 (-0.0507) 0.2794 (-0.0457) 0.5792 (+0.0785) 0.4494 (-0.0059)
-1 -1 - - 0.5014 (-0.0390) 0.2880 (-0.0370) 0.5684 (+0.0678) 0.4526 (-0.0027)
  • The bold row denotes the saved checkpoint.

Environmental Impact

Carbon emissions were measured using CodeCarbon.

  • Energy Consumed: 0.178 kWh
  • Carbon Emitted: 0.069 kg of CO2
  • Hours Used: 0.525 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
7
Safetensors
Model size
33.4M params
Tensor type
F32
·
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-msmarco-v1.1-MiniLM-L12-H384-uncased-bce

Finetuned
(54)
this model

Dataset used to train tomaarsen/reranker-msmarco-v1.1-MiniLM-L12-H384-uncased-bce

Evaluation results