CoolFace
Modelpublic

rohit-vt/tink-reranker-phase1_minilm

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes9downloads
Model Card

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 Type: Cross Encoder
  • —Base model: cross-encoder/ms-marco-MiniLM-L6-v2 <!-- at revision c5ee24cb16019beea0893ab7796b1df96625c6b8 -->
  • —Maximum Sequence Length: 512 tokens
  • —Number of Output Labels: 1 label
  • —Supported Modality: Text <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

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:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
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)
# [ 8.621   5.0407  1.0124 -1.7446  0.0759]

# 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': ...}, ...]

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

Unnamed Dataset
  • —Size: 10,246 training samples
  • —Columns: <code>sentenceA</code>, <code>sentenceB</code>, and <code>label</code>
  • —Approximate statistics based on the first 100 samples: | | sentenceA | sentenceB | label | |:---------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------| | type | string | string | float | | modality | text | text | | | details | <ul><li>min: 7 tokens</li><li>mean: 8.14 tokens</li><li>max: 11 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 7.94 tokens</li><li>max: 15 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.22</li><li>max: 1.0</li></ul> |
  • —Samples: | sentenceA | sentenceB | label | |:--------------------------------------------|:--------------------------------------------------------|:-----------------| | <code>skill: manage security systems</code> | <code>skill: manage technical security systems</code> | <code>1.0</code> | | <code>skill: manage security systems</code> | <code>skill: Physical access management software</code> | <code>0.0</code> | | <code>skill: manage security systems</code> | <code>skill: manage theft prevention</code> | <code>0.0</code> |
  • —Loss: <code>BinaryCrossEntropyLoss</code> with these parameters:
json
  {
      "activation_fn": "torch.nn.modules.linear.Identity",
      "pos_weight": null
  }

Evaluation Dataset

Unnamed Dataset
  • —Size: 1,416 evaluation samples
  • —Columns: <code>sentenceA</code>, <code>sentenceB</code>, and <code>label</code>
  • —Approximate statistics based on the first 100 samples: | | sentenceA | sentenceB | label | |:---------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------| | type | string | string | float | | modality | text | text | | | details | <ul><li>min: 6 tokens</li><li>mean: 9.23 tokens</li><li>max: 14 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 8.06 tokens</li><li>max: 16 tokens</li></ul> | <ul><li>min: 0.0</li><li>mean: 0.21</li><li>max: 1.0</li></ul> |
  • —Samples: | sentenceA | sentenceB | label | |:---------------------------------------------|:-----------------------------------------------|:-----------------| | <code>skill: manage health care staff</code> | <code>skill: manage healthcare staff</code> | <code>1.0</code> | | <code>skill: manage health care staff</code> | <code>skill: manage staff</code> | <code>0.0</code> | | <code>skill: manage health care staff</code> | <code>skill: manage physiotherapy staff</code> | <code>0.0</code> |
  • —Loss: <code>BinaryCrossEntropyLoss</code> with these parameters:
json
  {
      "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

<details><summary>Click to expand</summary>

  • —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: adamwtorchfused
  • —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: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_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: {}

</details>

Training Logs

EpochStepTraining LossValidation Loss
0.0623200.2485-
0.1246400.1945-
0.1869600.1679-
0.2492800.1314-
0.31151000.1673-
0.37381200.1750-
0.43611400.1375-
0.49841600.1779-
0.56071800.1119-
0.62312000.1516-
0.68542200.1284-
0.74772400.1068-
0.81002600.1367-
0.87232800.0968-
0.93463000.0934-
0.99693200.1276-
1.0321-0.1635
1.05923400.1069-
1.12153600.0679-
1.18383800.0987-
1.24614000.0829-
1.30844200.0646-
1.37074400.1205-
1.43304600.0682-
1.49534800.1087-
1.55765000.0874-
1.61995200.0880-
1.68225400.0678-
1.74455600.0743-
1.80695800.1250-
1.86926000.1010-
1.93156200.0914-
1.99386400.0813-
2.0642-0.1889
  • —The bold row denotes the saved checkpoint.

Training Time

  • —Training: 48.1 seconds
  • —Evaluation: 1.0 seconds
  • —Total: 49.1 seconds

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
bibtex
@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",
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->