CrossEncoder based on cross-encoder/ms-marco-MiniLM-L6-v2

This is a Cross Encoder model finetuned from cross-encoder/ms-marco-MiniLM-L6-v2 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

Full Model Architecture

CrossEncoder(
  (0): Transformer({'transformer_task': 'sequence-classification', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'logits'}}, 'module_output_name': 'scores', 'architecture': 'BertForSequenceClassification'})
)

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("cross_encoder_model_id")
# Get scores for pairs of inputs
pairs = [
    ['skill: manage health care staff', 'skill: manage healthcare staff'],
    ['skill: manage health care staff', 'skill: manage staff'],
    ['skill: manage health care staff', 'skill: manage physiotherapy staff'],
    ['skill: manage health care staff', 'skill: work with nursing staff'],
    ['skill: manage health care staff', 'skill: manage chiropractic staff'],
]
scores = model.predict(pairs)
print(scores)
# [ 6.9497  2.0168 -0.5377 -3.4953 -4.3348]

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    'skill: manage health care staff',
    [
        'skill: manage healthcare staff',
        'skill: manage staff',
        'skill: manage physiotherapy staff',
        'skill: work with nursing staff',
        'skill: manage chiropractic staff',
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Training Details

Training Dataset

Unnamed Dataset

  • Size: 93,031 training samples
  • Columns: sentence_A, sentence_B, and label
  • Approximate statistics based on the first 100 samples:
    sentence_A sentence_B label
    type string string float
    modality text text
    details
    • min: 7 tokens
    • mean: 8.14 tokens
    • max: 11 tokens
    • min: 6 tokens
    • mean: 7.94 tokens
    • max: 15 tokens
    • min: 0.0
    • mean: 0.22
    • max: 1.0
  • Samples:
    sentence_A sentence_B label
    skill: manage security systems skill: manage technical security systems 1.0
    skill: manage security systems skill: Physical access management software 0.0
    skill: manage security systems skill: manage theft prevention 0.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Evaluation Dataset

Unnamed Dataset

  • Size: 11,562 evaluation samples
  • Columns: sentence_A, sentence_B, and label
  • Approximate statistics based on the first 100 samples:
    sentence_A sentence_B label
    type string string float
    modality text text
    details
    • min: 6 tokens
    • mean: 9.23 tokens
    • max: 14 tokens
    • min: 6 tokens
    • mean: 8.06 tokens
    • max: 16 tokens
    • min: 0.0
    • mean: 0.21
    • max: 1.0
  • Samples:
    sentence_A sentence_B label
    skill: manage health care staff skill: manage healthcare staff 1.0
    skill: manage health care staff skill: manage staff 0.0
    skill: manage health care staff skill: manage physiotherapy staff 0.0
  • Loss: BinaryCrossEntropyLoss with these parameters:
    {
        "activation_fn": "torch.nn.modules.linear.Identity",
        "pos_weight": null
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • num_train_epochs: 2
  • learning_rate: 2e-05
  • warmup_steps: 0.1
  • per_device_eval_batch_size: 64
  • load_best_model_at_end: True

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 32
  • num_train_epochs: 2
  • 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: False
  • 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: None
  • trackio_bucket_id: None
  • trackio_static_space_id: None
  • per_device_eval_batch_size: 64
  • 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: 42
  • 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_static_graph: None
  • 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

Click to expand
Epoch Step Training Loss Validation Loss
0.0069 20 0.5247 -
0.0138 40 0.5615 -
0.0206 60 0.5603 -
0.0275 80 0.5108 -
0.0344 100 0.5295 -
0.0413 120 0.4418 -
0.0481 140 0.4539 -
0.0550 160 0.3991 -
0.0619 180 0.3650 -
0.0688 200 0.3651 -
0.0757 220 0.3455 -
0.0825 240 0.3742 -
0.0894 260 0.3396 -
0.0963 280 0.3533 -
0.1032 300 0.3732 -
0.1100 320 0.3413 -
0.1169 340 0.3560 -
0.1238 360 0.3473 -
0.1307 380 0.3159 -
0.1376 400 0.3627 -
0.1444 420 0.3376 -
0.1513 440 0.3022 -
0.1582 460 0.3330 -
0.1651 480 0.3373 -
0.1719 500 0.2894 -
0.1788 520 0.3176 -
0.1857 540 0.3271 -
0.1926 560 0.3519 -
0.1994 580 0.3560 -
0.2063 600 0.2581 -
0.2132 620 0.3213 -
0.2201 640 0.2766 -
0.2270 660 0.2782 -
0.2338 680 0.2782 -
0.2407 700 0.3027 -
0.2476 720 0.2784 -
0.2545 740 0.2814 -
0.2613 760 0.2240 -
0.2682 780 0.3190 -
0.2751 800 0.2623 -
0.2820 820 0.2815 -
0.2889 840 0.2631 -
0.2957 860 0.2360 -
0.3026 880 0.2930 -
0.3095 900 0.2815 -
0.3164 920 0.3000 -
0.3232 940 0.3035 -
0.3301 960 0.2495 -
0.3370 980 0.2447 -
0.3439 1000 0.2272 -
0.3508 1020 0.2600 -
0.3576 1040 0.2717 -
0.3645 1060 0.2830 -
0.3714 1080 0.2944 -
0.3783 1100 0.3230 -
0.3851 1120 0.2521 -
0.3920 1140 0.3050 -
0.3989 1160 0.2201 -
0.4058 1180 0.2504 -
0.4127 1200 0.2545 -
0.4195 1220 0.2230 -
0.4264 1240 0.2741 -
0.4333 1260 0.2679 -
0.4402 1280 0.2870 -
0.4470 1300 0.2602 -
0.4539 1320 0.2448 -
0.4608 1340 0.2764 -
0.4677 1360 0.2452 -
0.4746 1380 0.2668 -
0.4814 1400 0.2914 -
0.4883 1420 0.2683 -
0.4952 1440 0.2193 -
0.5021 1460 0.2097 -
0.5089 1480 0.2783 -
0.5158 1500 0.2634 -
0.5227 1520 0.2414 -
0.5296 1540 0.2544 -
0.5365 1560 0.2405 -
0.5433 1580 0.2488 -
0.5502 1600 0.1917 -
0.5571 1620 0.2446 -
0.5640 1640 0.2279 -
0.5708 1660 0.1966 -
0.5777 1680 0.2259 -
0.5846 1700 0.2440 -
0.5915 1720 0.2458 -
0.5983 1740 0.2644 -
0.6052 1760 0.2301 -
0.6121 1780 0.2677 -
0.6190 1800 0.2589 -
0.6259 1820 0.2259 -
0.6327 1840 0.2254 -
0.6396 1860 0.2591 -
0.6465 1880 0.2786 -
0.6534 1900 0.2170 -
0.6602 1920 0.2169 -
0.6671 1940 0.2377 -
0.6740 1960 0.2485 -
0.6809 1980 0.2069 -
0.6878 2000 0.2270 -
0.6946 2020 0.2587 -
0.7015 2040 0.2071 -
0.7084 2060 0.2137 -
0.7153 2080 0.2102 -
0.7221 2100 0.2204 -
0.7290 2120 0.2049 -
0.7359 2140 0.2361 -
0.7428 2160 0.2325 -
0.7497 2180 0.2066 -
0.7565 2200 0.2569 -
0.7634 2220 0.2270 -
0.7703 2240 0.2498 -
0.7772 2260 0.2130 -
0.7840 2280 0.2353 -
0.7909 2300 0.2301 -
0.7978 2320 0.2369 -
0.8047 2340 0.2350 -
0.8116 2360 0.2178 -
0.8184 2380 0.2277 -
0.8253 2400 0.2412 -
0.8322 2420 0.2329 -
0.8391 2440 0.2469 -
0.8459 2460 0.2300 -
0.8528 2480 0.1999 -
0.8597 2500 0.2254 -
0.8666 2520 0.2136 -
0.8735 2540 0.2640 -
0.8803 2560 0.2424 -
0.8872 2580 0.2097 -
0.8941 2600 0.2025 -
0.9010 2620 0.1984 -
0.9078 2640 0.2355 -
0.9147 2660 0.1924 -
0.9216 2680 0.2269 -
0.9285 2700 0.2381 -
0.9354 2720 0.2347 -
0.9422 2740 0.1967 -
0.9491 2760 0.2288 -
0.9560 2780 0.2521 -
0.9629 2800 0.2560 -
0.9697 2820 0.1999 -
0.9766 2840 0.2412 -
0.9835 2860 0.2209 -
0.9904 2880 0.2096 -
0.9972 2900 0.2422 -
1.0 2908 - 0.2988
1.0041 2920 0.2426 -
1.0110 2940 0.1935 -
1.0179 2960 0.2526 -
1.0248 2980 0.1720 -
1.0316 3000 0.2255 -
1.0385 3020 0.2009 -
1.0454 3040 0.1999 -
1.0523 3060 0.2123 -
1.0591 3080 0.1861 -
1.0660 3100 0.1810 -
1.0729 3120 0.2397 -
1.0798 3140 0.2054 -
1.0867 3160 0.1856 -
1.0935 3180 0.2092 -
1.1004 3200 0.1599 -
1.1073 3220 0.2012 -
1.1142 3240 0.2093 -
1.1210 3260 0.2028 -
1.1279 3280 0.1608 -
1.1348 3300 0.2049 -
1.1417 3320 0.2233 -
1.1486 3340 0.2247 -
1.1554 3360 0.1906 -
1.1623 3380 0.1881 -
1.1692 3400 0.2060 -
1.1761 3420 0.1893 -
1.1829 3440 0.2335 -
1.1898 3460 0.2169 -
1.1967 3480 0.2061 -
1.2036 3500 0.1862 -
1.2105 3520 0.1943 -
1.2173 3540 0.1754 -
1.2242 3560 0.1826 -
1.2311 3580 0.2380 -
1.2380 3600 0.2279 -
1.2448 3620 0.2203 -
1.2517 3640 0.2410 -
1.2586 3660 0.1571 -
1.2655 3680 0.2157 -
1.2724 3700 0.2192 -
1.2792 3720 0.2153 -
1.2861 3740 0.2307 -
1.2930 3760 0.1739 -
1.2999 3780 0.2120 -
1.3067 3800 0.2165 -
1.3136 3820 0.1765 -
1.3205 3840 0.1777 -
1.3274 3860 0.1772 -
1.3343 3880 0.2254 -
1.3411 3900 0.2183 -
1.3480 3920 0.2020 -
1.3549 3940 0.2100 -
1.3618 3960 0.1925 -
1.3686 3980 0.1794 -
1.3755 4000 0.2011 -
1.3824 4020 0.1543 -
1.3893 4040 0.1909 -
1.3961 4060 0.1938 -
1.4030 4080 0.1802 -
1.4099 4100 0.2081 -
1.4168 4120 0.2081 -
1.4237 4140 0.1646 -
1.4305 4160 0.1885 -
1.4374 4180 0.1925 -
1.4443 4200 0.1769 -
1.4512 4220 0.1669 -
1.4580 4240 0.1686 -
1.4649 4260 0.2476 -
1.4718 4280 0.2286 -
1.4787 4300 0.1728 -
1.4856 4320 0.1854 -
1.4924 4340 0.1959 -
1.4993 4360 0.2048 -
1.5062 4380 0.1991 -
1.5131 4400 0.2075 -
1.5199 4420 0.2041 -
1.5268 4440 0.1922 -
1.5337 4460 0.2105 -
1.5406 4480 0.1713 -
1.5475 4500 0.1831 -
1.5543 4520 0.1975 -
1.5612 4540 0.1769 -
1.5681 4560 0.1843 -
1.5750 4580 0.1789 -
1.5818 4600 0.1695 -
1.5887 4620 0.2102 -
1.5956 4640 0.1782 -
1.6025 4660 0.1929 -
1.6094 4680 0.1753 -
1.6162 4700 0.2114 -
1.6231 4720 0.1518 -
1.6300 4740 0.1843 -
1.6369 4760 0.2096 -
1.6437 4780 0.1401 -
1.6506 4800 0.2266 -
1.6575 4820 0.1895 -
1.6644 4840 0.1863 -
1.6713 4860 0.1654 -
1.6781 4880 0.2123 -
1.6850 4900 0.2300 -
1.6919 4920 0.2338 -
1.6988 4940 0.2037 -
1.7056 4960 0.1678 -
1.7125 4980 0.1867 -
1.7194 5000 0.1795 -
1.7263 5020 0.1478 -
1.7331 5040 0.2140 -
1.7400 5060 0.2166 -
1.7469 5080 0.1704 -
1.7538 5100 0.1770 -
1.7607 5120 0.2272 -
1.7675 5140 0.1665 -
1.7744 5160 0.1787 -
1.7813 5180 0.1377 -
1.7882 5200 0.1696 -
1.7950 5220 0.2295 -
1.8019 5240 0.1893 -
1.8088 5260 0.2273 -
1.8157 5280 0.2121 -
1.8226 5300 0.1870 -
1.8294 5320 0.1963 -
1.8363 5340 0.1970 -
1.8432 5360 0.2161 -
1.8501 5380 0.1744 -
1.8569 5400 0.1885 -
1.8638 5420 0.1869 -
1.8707 5440 0.1699 -
1.8776 5460 0.2254 -
1.8845 5480 0.1932 -
1.8913 5500 0.2139 -
1.8982 5520 0.1921 -
1.9051 5540 0.1888 -
1.9120 5560 0.1721 -
1.9188 5580 0.1971 -
1.9257 5600 0.2195 -
1.9326 5620 0.2034 -
1.9395 5640 0.1702 -
1.9464 5660 0.1827 -
1.9532 5680 0.1951 -
1.9601 5700 0.1685 -
1.9670 5720 0.1577 -
1.9739 5740 0.2155 -
1.9807 5760 0.1811 -
1.9876 5780 0.1779 -
1.9945 5800 0.2156 -
2.0 5816 - 0.3412
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 11.7 minutes
  • Evaluation: 22.5 seconds
  • Total: 12.1 minutes

Framework Versions

  • Python: 3.13.13
  • Sentence Transformers: 5.5.0
  • Transformers: 5.8.1
  • PyTorch: 2.12.0
  • Accelerate: 1.14.0
  • Datasets: 5.0.0
  • Tokenizers: 0.22.2

Additional Resources

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
202
Safetensors
Model size
22.7M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rohit-vt/tink-reranker-phase5_minilm_multikind

Paper for rohit-vt/tink-reranker-phase5_minilm_multikind