CoolFace
Modelpublic

dtunkelang/bag-of-documents-minilm-esci-supervised

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes82downloads
Model Card
A supervised baseline: all-MiniLM-L6-v2 fine-tuned with MultipleNegativesRankingLoss on ESCI relevance labels (not bag-derived), used as a comparison point for the bag-of-documents retrieval research.

SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2

This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

Model Description

  • —Model Type: Sentence Transformer
  • —Base model: sentence-transformers/all-MiniLM-L6-v2 <!-- at revision c9745ed1d9f207416be6d2e6f8de32d1f16199bf -->
  • —Maximum Sequence Length: 256 tokens
  • —Output Dimensionality: 384 dimensions
  • —Similarity Function: Cosine Similarity <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'BertModel'})
  (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
  (2): Normalize()
)

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 SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("sentence_transformers_model_id")
# Run inference
sentences = [
    'preservatives free eye drops',
    'Refresh Plus Lubricant Eye Drops, Preservative-Free, 0.01 Fl Oz Single-Use Containers, 30 Count (Pack of 1)',
    'Ocusoft Retaine MGD Ophthalmic Emulsion, Milky White Solution, 30 count Single Use Containers, 0.01 Fluid Ounce',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.7632, 0.4848],
#         [0.7632, 1.0000, 0.4949],
#         [0.4848, 0.4949, 1.0000]])

<!--

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: 125,555 training samples
  • —Columns: <code>sentence0</code>, <code>sentence1</code>, and <code>sentence_2</code>
  • —Approximate statistics based on the first 1000 samples: | | sentence0 | sentence1 | sentence_2 | |:--------|:---------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 3 tokens</li><li>mean: 6.87 tokens</li><li>max: 36 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 26.27 tokens</li><li>max: 91 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 26.04 tokens</li><li>max: 96 tokens</li></ul> |
  • —Samples: | sentence0 | sentence1 | sentence_2 | |:------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>e gift card</code> | <code>App Store & iTunes Gift Cards - Email Delivery</code> | <code>ASURION 4 Year Laptop Accident Protection Plan with Tech Support $600-699.99</code> | | <code>mre's meals ready to eat military</code> | <code>Ozark Outdoorz, LLC 2020 Pack Date/2025 Best by Date - XMRE 1300XT (Meals Ready to Eat) - 4 Pack Random</code> | <code>5000mAh Weather Radio,Solar Hand Crank Emergency Radio,NOAA/AM/FM Shortwave Outdoor Survival Portable Radio, Power Bank USB Charger,Flashlight/Reading Lamp,Headphone Jack,SOS</code> | | <code>nested magnesium glycinate chelate</code> | <code>EquiLife - Full Spectrum Magnesium, Magnesium Glycinate, Boosts Mood, Promotes Restful Sleep, Improves Bone Health, Enhances Energy & Focus, Helps Steady Blood Pressure, Non-GMO, Vegan (90 Servings)</code> | <code>Life Extension, Neuro-Mag, 90 Cápsulas vegetarianas</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false,
      "directions": [
          "query_to_doc"
      ],
      "partition_mode": "joint",
      "hardness_mode": null,
      "hardness_strength": 0.0
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —per_device_train_batch_size: 32
  • —num_train_epochs: 10
  • —per_device_eval_batch_size: 32
  • —multi_dataset_batch_sampler: round_robin
All Hyperparameters

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

  • —per_device_train_batch_size: 32
  • —num_train_epochs: 10
  • —max_steps: -1
  • —learning_rate: 5e-05
  • —lr_scheduler_type: linear
  • —lr_scheduler_kwargs: None
  • —warmup_steps: 0
  • —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
  • —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: trackio
  • —eval_strategy: no
  • —per_device_eval_batch_size: 32
  • —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: {'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_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: round_robin
  • —router_mapping: {}
  • —learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining Loss
0.12745000.9736
0.254810000.8578
0.382315000.8133
0.509720000.7662
0.637125000.7642
0.764530000.7438
0.891935000.7035
1.019440000.6752
1.146845000.6039
1.274250000.5819
1.401655000.5710
1.529160000.5514
1.656565000.5315
1.783970000.5164
1.911375000.5121
2.038780000.4657
2.166285000.3968
2.293690000.3996
2.421095000.3826
2.5484100000.3845
2.6758105000.3783
2.8033110000.3745
2.9307115000.3708
3.0581120000.3310
3.1855125000.2975
3.3129130000.2886
3.4404135000.2926
3.5678140000.2910
3.6952145000.2800
3.8226150000.2918
3.9501155000.2828
4.0775160000.2514
4.2049165000.2344
4.3323170000.2299
4.4597175000.2315
4.5872180000.2357
4.7146185000.2350
4.8420190000.2358
4.9694195000.2350
5.0968200000.2065
5.2243205000.1891
5.3517210000.1934
5.4791215000.1922
5.6065220000.1962
5.7339225000.1927
5.8614230000.1853
5.9888235000.1886
6.1162240000.1669
6.2436245000.1593
6.3710250000.1661
6.4985255000.1674
6.6259260000.1651
6.7533265000.1707
6.8807270000.1619
7.0082275000.1639
7.1356280000.1431
7.2630285000.1525
7.3904290000.1479
7.5178295000.1450
7.6453300000.1430
7.7727305000.1424
7.9001310000.1467
8.0275315000.1416
8.1549320000.1287
8.2824325000.1345
8.4098330000.1349
8.5372335000.1372
8.6646340000.1344
8.7920345000.1294
8.9195350000.1324
9.0469355000.1312
9.1743360000.1295
9.3017365000.1259
9.4292370000.1316
9.5566375000.1228
9.6840380000.1277
9.8114385000.1279
9.9388390000.1228

Framework Versions

  • —Python: 3.14.4
  • —Sentence Transformers: 5.3.0
  • —Transformers: 5.4.0
  • —PyTorch: 2.11.0
  • —Accelerate: 1.13.0
  • —Datasets: 4.8.4
  • —Tokenizers: 0.22.2

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",
}
MultipleNegativesRankingLoss
bibtex
@misc{oord2019representationlearningcontrastivepredictive,
      title={Representation Learning with Contrastive Predictive Coding},
      author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
      year={2019},
      eprint={1807.03748},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1807.03748},
}

<!--

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