CrossEncoder based on cross-encoder/ms-marco-TinyBERT-L2

This is a Cross Encoder model finetuned from cross-encoder/ms-marco-TinyBERT-L2 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("SumedhJoshi/convmix-tinybert-negative-sampling-followup-skip-3")
# Get scores for pairs of inputs
pairs = [
    ['What English football club was the first to achieve the European treble?', "Incidentally, Real Madrid from Spain have won this many by themselves. The most recent English win came in 2012 when Chelsea F.C. beat FC Bayern Munich on penalties at the Allianz Arena after the game ended 1-1 in extra time. A record five teams have won Europe's premier club competition: Liverpool five times, the second English team to retain the cup (1977, 1978, 1981, 1984, 2005), Manchester United three times (1968, 1999, 2008), Nottingham Forest twice, being the second English team to retain the European Cup (1979, 1980), Aston Villa once (1982) and Chelsea once (2012). English clubs also hold the records for the most consecutive tournament victories by clubs from one country (six wins between 1977 and 1982 by Liverpool, Forest, and Villa) as well as the most consecutive defeats in the final (four teams were runners-up once each between 2006 and 2009). European Cup era. Early years: 1955โ€“1967."],
    ['What is the full name of Roque Jรบnior?', 'According to Swivel, an eclectic range of songs were recorded, including ballads, "weird ethereal things" and 1990\'s R&B and Afrobeat-inspired songs.'],
    ['What company originally published the 1973 novel "The Taking of Pelham One Two Three?"', "Graham Greene There have been six editions of the novel, the first from Heinemann in 1935, priced at 7\xa0shillings and sixpence, the equivalent of about ยฃ in 2022. Ten years later a second edition was published by Grey Walls Press, with the addition of illustrations by Felix Kelly. A third edition, for which Graham Greene wrote an introduction focusing on the novel's autobiographical elements, was published by Eyre and Spottiswoode in 1947. The first American edition was published in New York by New Directions in 1948, with an introduction by Kenneth Rexroth. Penguin Books published a fifth edition in 1979, which included the 1947 introduction by Greene. A sixth edition, published by R. Clark, appeared in 1989 and was reprinted in 1995, both containing Greene's introduction."],
    ['Spanish name of the TV series Money Heist?', 'There were four episodes in the first series, which started on 19 June 2011: Series 2 (2012). The first episode of the second series was shown in the UK on 16 September 2012. The series had three episodes: Series 3 (2014). The third series features four episodes. The first episode was first shown on 27 December 2013, on Sweden\'s SVT, with episodes 2 and 3 shown in the following weeks. Philip Mould described the appearance on Swedish television weeks ahead of the British premiere as a "weird BBC World cock-up".'],
    ['What is the release date of the film Swades?', 'The film was known under the working title "Jackpot" but was later renamed as "Sahasam". The film was mostly shot in Ladakh, and Hyderabad. The film\'s first look was released on the eve of Ugadi i.e. 11 April 2013. The film was later dubbed into Hindi as "The Real Jackpot" by Goldmines Telefilms in 2013. Plot. In 2003, a Pakistani Archaeologist Dr. M. Alam Siddiqui after seeking permission from the Government of Pakistan starts researching about the hidden treasure of King Kanishka whose treasure map is hidden in an old box whose key is a Garuda Locket which was last seen in the research books of David, a British archaeologist.'],
]
scores = model.predict(pairs)
print(scores)
# [0.2202 0.0022 0.0959 0.0095 0.0251]

# Or rank different texts based on similarity to a single text
ranks = model.rank(
    'What English football club was the first to achieve the European treble?',
    [
        "Incidentally, Real Madrid from Spain have won this many by themselves. The most recent English win came in 2012 when Chelsea F.C. beat FC Bayern Munich on penalties at the Allianz Arena after the game ended 1-1 in extra time. A record five teams have won Europe's premier club competition: Liverpool five times, the second English team to retain the cup (1977, 1978, 1981, 1984, 2005), Manchester United three times (1968, 1999, 2008), Nottingham Forest twice, being the second English team to retain the European Cup (1979, 1980), Aston Villa once (1982) and Chelsea once (2012). English clubs also hold the records for the most consecutive tournament victories by clubs from one country (six wins between 1977 and 1982 by Liverpool, Forest, and Villa) as well as the most consecutive defeats in the final (four teams were runners-up once each between 2006 and 2009). European Cup era. Early years: 1955โ€“1967.",
        'According to Swivel, an eclectic range of songs were recorded, including ballads, "weird ethereal things" and 1990\'s R&B and Afrobeat-inspired songs.',
        "Graham Greene There have been six editions of the novel, the first from Heinemann in 1935, priced at 7\xa0shillings and sixpence, the equivalent of about ยฃ in 2022. Ten years later a second edition was published by Grey Walls Press, with the addition of illustrations by Felix Kelly. A third edition, for which Graham Greene wrote an introduction focusing on the novel's autobiographical elements, was published by Eyre and Spottiswoode in 1947. The first American edition was published in New York by New Directions in 1948, with an introduction by Kenneth Rexroth. Penguin Books published a fifth edition in 1979, which included the 1947 introduction by Greene. A sixth edition, published by R. Clark, appeared in 1989 and was reprinted in 1995, both containing Greene's introduction.",
        'There were four episodes in the first series, which started on 19 June 2011: Series 2 (2012). The first episode of the second series was shown in the UK on 16 September 2012. The series had three episodes: Series 3 (2014). The third series features four episodes. The first episode was first shown on 27 December 2013, on Sweden\'s SVT, with episodes 2 and 3 shown in the following weeks. Philip Mould described the appearance on Swedish television weeks ahead of the British premiere as a "weird BBC World cock-up".',
        'The film was known under the working title "Jackpot" but was later renamed as "Sahasam". The film was mostly shot in Ladakh, and Hyderabad. The film\'s first look was released on the eve of Ugadi i.e. 11 April 2013. The film was later dubbed into Hindi as "The Real Jackpot" by Goldmines Telefilms in 2013. Plot. In 2003, a Pakistani Archaeologist Dr. M. Alam Siddiqui after seeking permission from the Government of Pakistan starts researching about the hidden treasure of King Kanishka whose treasure map is hidden in an old box whose key is a Garuda Locket which was last seen in the research books of David, a British archaeologist.',
    ]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]

Training Details

Training Dataset

Unnamed Dataset

  • Size: 8,494 training samples
  • Columns: sentence_0, sentence_1, and label
  • Approximate statistics based on the first 100 samples:
    sentence_0 sentence_1 label
    type string string float
    modality text text
    details
    • min: 7 tokens
    • mean: 13.67 tokens
    • max: 22 tokens
    • min: 11 tokens
    • mean: 88.07 tokens
    • max: 272 tokens
    • min: 0.0
    • mean: 0.06
    • max: 1.0
  • Samples:
    sentence_0 sentence_1 label
    What English football club was the first to achieve the European treble? Incidentally, Real Madrid from Spain have won this many by themselves. The most recent English win came in 2012 when Chelsea F.C. beat FC Bayern Munich on penalties at the Allianz Arena after the game ended 1-1 in extra time. A record five teams have won Europe's premier club competition: Liverpool five times, the second English team to retain the cup (1977, 1978, 1981, 1984, 2005), Manchester United three times (1968, 1999, 2008), Nottingham Forest twice, being the second English team to retain the European Cup (1979, 1980), Aston Villa once (1982) and Chelsea once (2012). English clubs also hold the records for the most consecutive tournament victories by clubs from one country (six wins between 1977 and 1982 by Liverpool, Forest, and Villa) as well as the most consecutive defeats in the final (four teams were runners-up once each between 2006 and 2009). European Cup era. Early years: 1955โ€“1967. 1.0
    What is the full name of Roque Jรบnior? According to Swivel, an eclectic range of songs were recorded, including ballads, "weird ethereal things" and 1990's R&B and Afrobeat-inspired songs. 0.0
    What company originally published the 1973 novel "The Taking of Pelham One Two Three?" Graham Greene There have been six editions of the novel, the first from Heinemann in 1935, priced at 7 shillings and sixpence, the equivalent of about ยฃ in 2022. Ten years later a second edition was published by Grey Walls Press, with the addition of illustrations by Felix Kelly. A third edition, for which Graham Greene wrote an introduction focusing on the novel's autobiographical elements, was published by Eyre and Spottiswoode in 1947. The first American edition was published in New York by New Directions in 1948, with an introduction by Kenneth Rexroth. Penguin Books published a fifth edition in 1979, which included the 1947 introduction by Greene. A sixth edition, published by R. Clark, appeared in 1989 and was reprinted in 1995, both containing Greene's introduction. 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: 16
  • num_train_epochs: 5
  • per_device_eval_batch_size: 16

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 16
  • num_train_epochs: 5
  • max_steps: -1
  • learning_rate: 5e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0
  • 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
  • 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: 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: False
  • 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
  • dataloader_multiprocessing_context: None
  • dataloader_in_order: True
  • 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: None
  • fsdp_config: None
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • local_rank: -1
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}
  • warmup_ratio: None

Training Logs

Epoch Step Training Loss
0.9416 500 0.2823
1.8832 1000 0.2272
2.8249 1500 0.2107
3.7665 2000 0.2046
4.7081 2500 0.2016

Training Time

  • Training: 23.2 minutes

Framework Versions

  • Python: 3.13.16
  • Sentence Transformers: 6.2.0
  • Transformers: 5.20.2
  • PyTorch: 2.11.0+cu130
  • Accelerate: 1.15.0
  • Datasets: 5.1.0
  • Tokenizers: 0.23.3

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
24
Safetensors
Model size
4.39M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for SumedhJoshi/convmix-tinybert-negative-sampling-followup-skip-3

Finetuned
(2)
this model

Paper for SumedhJoshi/convmix-tinybert-negative-sampling-followup-skip-3