CoolFace
Modelpublic

krumeto/snowflake-arctic-embed-xs-ms-marco-triplet

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes83downloads
Model Card

Fine-tuned snowflake actic xs based on MS-Marco triplets

This is a sentence-transformers model finetuned from Snowflake/snowflake-arctic-embed-xs on the sentence-transformers/msmarco-msmarco-mini_lm-l-6-v3 dataset. 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: Snowflake/snowflake-arctic-embed-xs <!-- at revision 236cea8bda4680896324c8058c67e97c135eeb95 -->
  • —Maximum Sequence Length: 512 tokens
  • —Output Dimensionality: 384 tokens
  • —Similarity Function: Cosine Similarity
  • —Training Dataset:
  • —sentence-transformers/msmarco-msmarco-mini_lm-l-6-v3
  • —Language: en
  • —License: apache-2.0

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, '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("krumeto/snowflake-arctic-embed-xs-ms-marco-triplet")
# Run inference
sentences = [
    'Represent this sentence for searching relevant passages: how many pitchers used per game',
    'In modern day baseball, teams generally have five starting pitchers, and they take it in turn to start a game every fifth day (hence the phrase rotation). Sometimes, if the schedule pans out, a team can get away with a four man rotation, and in the distant past some teams managed a three man rotation.',
    'Accroding to the statistics in the Baseball Reference page showing 2014 Major League Baseball Pitching Pitches, 745 pitchers threw 704,983 pitches in 2430 games for an average of 290 pitches per game.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

<!--

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

Evaluation

Metrics

Triplet
MetricValue
cosine_accuracy0.571
dot_accuracy0.4286
manhattan_accuracy0.5728
euclidean_accuracy0.571
max_accuracy0.5728
Triplet
MetricValue
cosine_accuracy0.5696
dot_accuracy0.43
manhattan_accuracy0.5674
euclidean_accuracy0.5696
max_accuracy0.5696

<!--

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

sentence-transformers/msmarco-msmarco-mini_lm-l-6-v3
  • —Dataset: sentence-transformers/msmarco-msmarco-mini_lm-l-6-v3
  • —Size: 100,000 training samples
  • —Columns: <code>query</code>, <code>positive</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | query | positive | negative | |:--------|:-----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 12 tokens</li><li>mean: 17.05 tokens</li><li>max: 36 tokens</li></ul> | <ul><li>min: 19 tokens</li><li>mean: 78.68 tokens</li><li>max: 212 tokens</li></ul> | <ul><li>min: 16 tokens</li><li>mean: 73.73 tokens</li><li>max: 205 tokens</li></ul> |
  • —Samples: | query | positive | negative | |:---------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>Represent this sentence for searching relevant passages: what are the liberal arts?</code> | <code>liberal arts. 1. the academic course of instruction at a college intended to provide general knowledge and comprising the arts, humanities, natural sciences, and social sciences, as opposed to professional or technical subjects.</code> | <code>Liberal Arts Defined. The liberal arts are a set of academic disciplines that include the sciences and the humanities. When you study a liberal arts curriculum, you don't have to have one specific career goal, although you might. Instead, you'll assemble a broad foundation of knowledge that can be used in a wide spectrum of careers.</code> | | <code>Represent this sentence for searching relevant passages: what is the mechanism of action of fibrinolytic or thrombolytic drugs?</code> | <code>Baillière's Clinical Haematology. 6 Mechanism of action of the thrombolytic agents. 6 Mechanism of action of the thrombolytic agents JEFFREY I. WEITZ Fibrin formed during the haemostatic, inflammatory or tissue repair process serves a temporary role, and must be degraded to restore normal tissue function and structure.</code> | <code>Fibrinolytic drug. Fibrinolytic drug, also called thrombolytic drug, any agent that is capable of stimulating the dissolution of a blood clot (thrombus). Fibrinolytic drugs work by activating the so-called fibrinolytic pathway.</code> | | <code>Represent this sentence for searching relevant passages: what is normal plat count</code> | <code>78 Followers. A. Platelets are the tiny blood cells that help stop bleeding by binding together to form a clump or plug at sites of injury inside blood vessels. A normal platelet count is between 150,000 and 450,000 platelets per microliter (one-millionth of a liter, abbreviated mcL).The average platelet count is 237,000 per mcL in men and 266,000 per mcL in women.8 Followers. A. Platelets are the tiny blood cells that help stop bleeding by binding together to form a clump or plug at sites of injury inside blood vessels. A normal platelet count is between 150,000 and 450,000 platelets per microliter (one-millionth of a liter, abbreviated mcL).</code> | <code>In the context of blood work, PLT refers to the platelet count. Platelets are the cells that cause blood clotting and control bleeding. The normal range of platelets for adults is 3.5 to 10.5 billion cells per liter of blood, according to the Mayo Clinic. Continue Reading.</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Evaluation Dataset

sentence-transformers/msmarco-msmarco-mini_lm-l-6-v3
  • —Dataset: sentence-transformers/msmarco-msmarco-mini_lm-l-6-v3
  • —Size: 5,000 evaluation samples
  • —Columns: <code>query</code>, <code>positive</code>, and <code>negative</code>
  • —Approximate statistics based on the first 1000 samples: | | query | positive | negative | |:--------|:-----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 12 tokens</li><li>mean: 17.09 tokens</li><li>max: 35 tokens</li></ul> | <ul><li>min: 21 tokens</li><li>mean: 80.07 tokens</li><li>max: 250 tokens</li></ul> | <ul><li>min: 16 tokens</li><li>mean: 76.73 tokens</li><li>max: 341 tokens</li></ul> |
  • —Samples: | query | positive | negative | |:----------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | <code>Represent this sentence for searching relevant passages: what is the name of the material harder than diamonds</code> | <code>Nano-material is harder than diamonds By Will Knight A material that is harder than diamond has been created in the lab, by packing together tiny “nanorods” of carbon. The new material, known as aggregated carbon nanorods (ACNR), was created by compressing and heating super-strong carbon molecules called buckyballs or carbon-60.</code> | <code>What material is stronger than diamond? Diamonds are famous for their hardness, but not particularly for strength,since they are easily cleaved to create the facets that make the different cuts of diamonds for setting in a ring or necklace. Many materials are stronger than diamonds, only a couple of synthesized materials are harder than diamonds.</code> | | <code>Represent this sentence for searching relevant passages: is pink impression a perennial tulip?</code> | <code>Tulip Pink Impression. close video. VIDEO. Tulip Pink Impression. The rich pink blooms of this hybrid are bound to make an impression, whether used in the landscape or as a cut flower. Robust stems and giant blooms characterise the range, and this hybrid is no exception. ‘Pink Impression’ will continue to impress thanks to the perennial potential of this range.</code> | <code>Tulip Pink Impression. The lustrous petals are a deep, rich rose at the center, shading to a delicate pale pink at the edge, while doing amazing things in between that include shades of both melon and sunset. Tall, strong, long-lasting and reliable, like most Darwin hybrids. An absolutely first-class Tulip.</code> | | <code>Represent this sentence for searching relevant passages: define: colonization</code> | <code>Colonization. the settlement and economic development of the uninhabited borderlands of a country (internal colonization) or the establishment of settlements (engaging primarily in agricultural activity) beyond the frontiers of a country (external colonization).</code> | <code>Colonization is a process by which a central system of power dominates the surrounding land and its components. The term is derived from the Latin word colere, which means to inhabit. Also, colonization refers strictly to migration, for example, to settler colonies in America or Australia, trading posts, and plantations, while colonialism deals with this, along with ruling the existing indigenous peoples of styled new territories. Colonization was linked to the spread of tens of millions fro</code> |
  • —Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • —eval_strategy: steps
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —num_train_epochs: 1
  • —warmup_ratio: 0.1
  • —fp16: True
  • —batch_sampler: no_duplicates
All Hyperparameters

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

  • —overwrite_output_dir: False
  • —do_predict: False
  • —eval_strategy: steps
  • —prediction_loss_only: True
  • —per_device_train_batch_size: 16
  • —per_device_eval_batch_size: 16
  • —per_gpu_train_batch_size: None
  • —per_gpu_eval_batch_size: None
  • —gradient_accumulation_steps: 1
  • —eval_accumulation_steps: None
  • —learning_rate: 5e-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: 42
  • —data_seed: None
  • —jit_mode_eval: False
  • —use_ipex: False
  • —bf16: False
  • —fp16: True
  • —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: False
  • —ignore_data_skip: False
  • —fsdp: []
  • —fsdp_min_num_params: 0
  • —fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • —fsdp_transformer_layer_cls_to_wrap: None
  • —accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': 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: False
  • —hub_always_push: False
  • —gradient_checkpointing: False
  • —gradient_checkpointing_kwargs: None
  • —include_inputs_for_metrics: False
  • —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
  • —batch_sampler: no_duplicates
  • —multi_dataset_batch_sampler: proportional

</details>

Training Logs

EpochStepTraining Losslossxs-msmarco-triplet-train_max_accuracyxs-msmarco-triplet_max_accuracy
00---0.3648
0.0161001.02131.0078-0.3672
0.0322000.97850.9630-0.3764
0.0483000.95910.9190-0.4014
0.0644000.90880.8906-0.4392
0.085000.92150.8707-0.4598
0.0966000.86920.8681-0.4874
0.1127000.88060.8538-0.4964
0.1288000.88010.8477-0.5106
0.1449000.86920.8414-0.5228
0.1610000.86240.8391-0.5194
0.17611000.87370.8397-0.5264
0.19212000.85050.8344-0.5214
0.20813000.88180.8358-0.5164
0.22414000.84640.8269-0.5326
0.2415000.86230.8291-0.5232
0.25616000.82030.8407-0.5328
0.27217000.85660.8257-0.5302
0.28818000.83860.8198-0.5364
0.30419000.85870.8172-0.5388
0.3220000.84720.8233-0.5568
0.33621000.84660.8188-0.5468
0.35222000.82730.8190-0.5386
0.36823000.83560.8183-0.5396
0.38424000.82940.8156-0.5538
0.425000.82740.8168-0.5448
0.41626000.83920.8093-0.5422
0.43227000.85410.8087-0.5426
0.44828000.82180.8086-0.5474
0.46429000.84460.8062-0.554
0.4830000.84050.8076-0.548
0.49631000.84470.8087-0.553
0.51232000.84530.8073-0.5536
0.52833000.83710.8089-0.5504
0.54434000.85480.8005-0.5516
0.5635000.81620.8026-0.5572
0.57636000.85770.7994-0.5558
0.59237000.82890.7990-0.5526
0.60838000.8240.7967-0.562
0.62439000.8330.7959-0.5608
0.6440000.83620.7958-0.5554
0.65641000.80570.7966-0.5578
0.67242000.80010.7943-0.5646
0.68843000.82150.7937-0.5602
0.70444000.82570.7933-0.5614
0.7245000.81730.7942-0.5648
0.73646000.80020.7922-0.5698
0.75247000.84450.7899-0.5626
0.76848000.8250.7897-0.5592
0.78449000.81510.7870-0.5696
0.850000.82230.7895-0.5676
0.81651000.82350.7877-0.5656
0.83252000.83550.7866-0.5688
0.84853000.82180.7864-0.5672
0.86454000.83840.7866-0.5652
0.8855000.79880.7860-0.569
0.89656000.81170.7867-0.5684
0.91257000.81130.7861-0.5734
0.92858000.81290.7860-0.5698
0.94459000.7990.7863-0.5688
0.9660000.82690.7858-0.5708
0.97661000.80660.7857-0.572
0.99262000.83020.7856-0.5728
1.06250--0.5696-

Framework Versions

  • —Python: 3.10.12
  • —Sentence Transformers: 3.0.1
  • —Transformers: 4.42.4
  • —PyTorch: 2.3.1+cu121
  • —Accelerate: 0.32.1
  • —Datasets: 2.20.0
  • —Tokenizers: 0.19.1

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{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply}, 
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}

<!--

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