Sentence Similarity
sentence-transformers
Safetensors
English
Spanish
xlm-roberta
feature-extraction
Generated from Trainer
dataset_size:58270
loss:MultipleNegativesRankingLoss
loss:CoSENTLoss
dataset_size:38270
dataset_size:18270
Inference Endpoints
text-embeddings-inference
Edit model card

SentenceTransformer based on sentence-transformers/paraphrase-multilingual-mpnet-base-v2

This is a sentence-transformers model finetuned from sentence-transformers/paraphrase-multilingual-mpnet-base-v2 on the dataset, distilbert, spanish, all-nli-triplet and stsb datasets. It maps sentences & paragraphs to a 768-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 Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel 
  (1): Pooling({'word_embedding_dimension': 768, '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})
)

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 SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("saraleivam/GURU-model2")
# Run inference
sentences = [
    'what creates a bunion',
    "A bunionette , or tailor's bunion, is one that develops at the base of the little toe. When the long bone that connects to the toe (metatarsal ) bends away from the foot, the little toe bends inward and the joint swells or enlarges. Other factors that can lead to a bunion include: Loose ligaments in the foot.",
    'A bunion is a bony bump that forms on the joint at the base of your big toe. It forms when your big toe pushes against your next toe, forcing the joint of your big toe to get bigger and stick out. The skin over the bunion might be red and sore. Wearing tight, narrow shoes might cause bunions or make them worse. Bunions also can develop as a result of an inherited structural defect, stress on your foot or a medical condition, such as arthritis. Smaller bunions (bunionettes) can develop on the joint of your little toe. Nov. 08, 2016.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]

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

Training Details

Training Datasets

dataset

  • Dataset: dataset
  • Size: 521 training samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative
    type string string string
    details
    • min: 5 tokens
    • mean: 18.41 tokens
    • max: 128 tokens
    • min: 4 tokens
    • mean: 19.98 tokens
    • max: 128 tokens
    • min: 4 tokens
    • mean: 15.84 tokens
    • max: 128 tokens
  • Samples:
    anchor positive negative
    Advanced data analysis with R. Data analyst with R and statistical modeling experience. Interior designer with space decoration skills.
    Introduction to quantum machine learning. AI researcher with quantum machine learning skills. Pharmacist with pharmaceutical care skills.
    Fundamentos de diseño de experiencia de usuario (UX). Diseñador UX con habilidades en investigación de usuarios. Abogado con habilidades en derecho civil.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

distilbert

  • Dataset: distilbert at e63dd83
  • Size: 1,000 training samples
  • Columns: query, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    query positive negative
    type string string string
    details
    • min: 4 tokens
    • mean: 9.95 tokens
    • max: 28 tokens
    • min: 18 tokens
    • mean: 84.21 tokens
    • max: 128 tokens
    • min: 4 tokens
    • mean: 79.55 tokens
    • max: 128 tokens
  • Samples:
    query positive negative
    what are the liberal arts? 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. liberal arts definition The areas of learning that cultivate general intellectual ability rather than technical or professional skills. Liberal arts is often used as a synonym for humanities, because literature, languages, history, and philosophy are often considered the primary subjects of the liberal arts.
    what is the mechanism of action of fibrinolytic or thrombolytic drugs? 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. Thrombolytic drugs such as tPA are often the first line of defense in treating some forms of ischemic stroke. The stroke occurs when fibrin strands in the blood trap blood cells and platelets, forming a clot in an artery to the brain (A).
    what is normal plat count 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). The normal number of platelets is between 150 and 400 million per millilitre (ml) of blood. Most pregnant women have normal numbers of platelets, but about eight per cent of pregnant women have a slight drop in their platelet count.Your count is below normal if you have between 100 and 150 million platelets per ml of blood.our platelet count will look something like Plat. 160x10.9/L, which means you have a platelet count of 160, which is in the normal range. If your platelet count is low, the blood test should be done again. This will keep track of whether or not your count is dropping.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

spanish

  • Dataset: spanish at de18671
  • Size: 1,000 training samples
  • Columns: sentence1, sentence2, score, and source
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 score source
    type string string float string
    details
    • min: 9 tokens
    • mean: 27.57 tokens
    • max: 49 tokens
    • min: 10 tokens
    • mean: 27.6 tokens
    • max: 56 tokens
    • min: 0.0
    • mean: 0.51
    • max: 1.0
    • min: 4 tokens
    • mean: 4.0 tokens
    • max: 4 tokens
  • Samples:
    sentence1 sentence2 score source
    La comida china tradicional se basa en la filosofía de equilibrio entre el yin y el yang, y el uso de ingredientes frescos. Los principios de la cocina china se centran en el equilibrio entre los sabores dulce y salado, así como en el uso de productos naturales. 0.4 GPT
    El neokantismo es una corriente filosófica que busca revitalizar los principios del pensamiento de Immanuel Kant en el contexto moderno. Los neokantianos buscan actualizar los conceptos de Immanuel Kant para aplicarlos a la filosofía contemporánea. 0.4 GPT
    La teoría de la paridad del poder adquisitivo sostiene que en el largo plazo, los tipos de cambio entre dos monedas deben ajustarse para reflejar las diferencias en los niveles de precios de los países. La teoría de la paridad del poder adquisitivo se refiere a la relación entre los niveles de precios de los países y los tipos de cambio entre dos monedas, con el objetivo de mantener el equilibrio a largo plazo. 0.3 GPT
  • Loss: CoSENTLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "pairwise_cos_sim"
    }
    

all-nli-triplet

  • Dataset: all-nli-triplet at d482672
  • Size: 10,000 training samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative
    type string string string
    details
    • min: 7 tokens
    • mean: 10.9 tokens
    • max: 52 tokens
    • min: 6 tokens
    • mean: 13.62 tokens
    • max: 42 tokens
    • min: 5 tokens
    • mean: 14.76 tokens
    • max: 55 tokens
  • Samples:
    anchor positive negative
    A person on a horse jumps over a broken down airplane. A person is outdoors, on a horse. A person is at a diner, ordering an omelette.
    Children smiling and waving at camera There are children present The kids are frowning
    A boy is jumping on skateboard in the middle of a red bridge. The boy does a skateboarding trick. The boy skates down the sidewalk.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

stsb

  • Dataset: stsb at ab7a5ac
  • Size: 5,749 training samples
  • Columns: sentence1, sentence2, and score
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 score
    type string string float
    details
    • min: 6 tokens
    • mean: 11.08 tokens
    • max: 30 tokens
    • min: 7 tokens
    • mean: 11.05 tokens
    • max: 30 tokens
    • min: 0.0
    • mean: 0.54
    • max: 1.0
  • Samples:
    sentence1 sentence2 score
    A plane is taking off. An air plane is taking off. 1.0
    A man is playing a large flute. A man is playing a flute. 0.76
    A man is spreading shreded cheese on a pizza. A man is spreading shredded cheese on an uncooked pizza. 0.76
  • Loss: CoSENTLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "pairwise_cos_sim"
    }
    

Evaluation Datasets

dataset

  • Dataset: dataset
  • Size: 131 evaluation samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative
    type string string string
    details
    • min: 7 tokens
    • mean: 19.38 tokens
    • max: 128 tokens
    • min: 4 tokens
    • mean: 20.61 tokens
    • max: 128 tokens
    • min: 6 tokens
    • mean: 16.47 tokens
    • max: 122 tokens
  • Samples:
    anchor positive negative
    Curso de matemáticas avanzadas para ingeniería Ingeniero con habilidades en cálculo y álgebra avanzada Chef con experiencia en repostería
    Fundamentos de análisis financiero y gestión de riesgos Analista financiero con habilidades en gestión de riesgos y análisis de inversiones Chef con experiencia en cocina tradicion
    Project Management with Agile Methodologies and Scrum. Project manager with skills in Scrum and agile methodologies. Mechanical engineer with structural design experience.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

distilbert

  • Dataset: distilbert at e63dd83
  • Size: 100 evaluation samples
  • Columns: query, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    query positive negative
    type string string string
    details
    • min: 5 tokens
    • mean: 9.87 tokens
    • max: 19 tokens
    • min: 28 tokens
    • mean: 86.98 tokens
    • max: 128 tokens
    • min: 23 tokens
    • mean: 80.97 tokens
    • max: 128 tokens
  • Samples:
    query positive negative
    when was the town of farragut tn incorporated In January of 1980, residents decided to incorporate by an overwhelming margin. The Town of Farragut was incorporated on January 16, 1980, with the first board of Mayor and Alderman elected on April 1, 1980. Farragut is a town which straddles both Knox and Loudon counties in Tennessee. It is a suburb of Knoxville. The town's population was 20,676 at the 2010 census. It is included in the Knoxville Metropolitan Area. The town is named in honor of American Civil War Admiral David Farragut, who was born just east of Farragut at Campbell's Station in 1801.
    how long to roast a chicken There are two methods for roasting a whole chicken: Regular method: 1 Preheat oven to 350 degrees F (175 degrees C). 2 Roast whole (thawed) chickens for 20 minutes per pound, plus an additional 15 minutes. 1 Roast the chicken at 450 degrees for 20 minutes, then reduce the heat to 400 degrees and continue roasting for about 40 minutes (or until the internal temperature reaches about 175 to 180 degrees F. about 1 hour or a little less).
    what is a hormone? What Are Hormones, And What Do They Do? Hormones are special chemical messengers in the body that are created in the endocrine glands. These messengers control most major bodily functions, from simple basic needs like hunger to complex systems like reproduction, and even the emotions and mood. Understanding the major hormones and what they do will help patients take control of their health. Prostaglandins. Hormone is a chemical substance that is produced in one part of the body (by an endocrine gland) and is carried in the blood to other distant organs or tissues where it acts to modify their structure or function.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

all-nli-triplet

  • Dataset: all-nli-triplet at d482672
  • Size: 100 evaluation samples
  • Columns: anchor, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative
    type string string string
    details
    • min: 7 tokens
    • mean: 7.0 tokens
    • max: 7 tokens
    • min: 9 tokens
    • mean: 20.62 tokens
    • max: 78 tokens
    • min: 11 tokens
    • mean: 16.0 tokens
    • max: 21 tokens
  • Samples:
    anchor positive negative
    The men are outside. A man in a green and white "Irish" baseball uniform is lunging forward as though to throw the ball underhand as an older man in umpire's uniform looks on. Two men are leaning out of a window and looking at something to the right of them.
    The men are outside. Three men getting some kind of grass together on a windy day. Two women work on a project outdoors.
    The men are outside. Three men getting some kind of grass together on a windy day. Two men are leaning out of a window and looking at something to the right of them.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

stsb

  • Dataset: stsb at ab7a5ac
  • Size: 1,500 evaluation samples
  • Columns: sentence1, sentence2, and score
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 score
    type string string float
    details
    • min: 5 tokens
    • mean: 16.55 tokens
    • max: 47 tokens
    • min: 7 tokens
    • mean: 16.5 tokens
    • max: 47 tokens
    • min: 0.0
    • mean: 0.47
    • max: 1.0
  • Samples:
    sentence1 sentence2 score
    A man with a hard hat is dancing. A man wearing a hard hat is dancing. 1.0
    A young child is riding a horse. A child is riding a horse. 0.95
    A man is feeding a mouse to a snake. The man is feeding a mouse to the snake. 1.0
  • Loss: CoSENTLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "pairwise_cos_sim"
    }
    

Training Hyperparameters

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 8
  • per_device_eval_batch_size: 8
  • 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: 3.0
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • 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: False
  • 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: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': 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
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss distilbert loss all-nli-triplet loss stsb loss dataset loss
0.2188 500 1.9313 - - - -
0.4376 1000 1.766 - - - -
0.6565 1500 1.6605 - - - -
0.8753 2000 1.6541 - - - -
1.0941 2500 1.6496 - - - -
1.3129 3000 1.4151 - - - -
1.5317 3500 1.3921 - - - -
1.7505 4000 1.301 - - - -
1.9694 4500 1.3356 - - - -
2.1882 5000 1.212 - - - -
2.4070 5500 1.1476 - - - -
2.6258 6000 1.1854 - - - -
2.8446 6500 1.0177 - - - -
3.0 6855 - 1.3369 2.6425 4.8295 0.0736

Framework Versions

  • Python: 3.9.13
  • Sentence Transformers: 3.0.1
  • Transformers: 4.41.2
  • PyTorch: 2.3.1+cpu
  • Accelerate: 0.31.0
  • Datasets: 2.20.0
  • Tokenizers: 0.19.1

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

MultipleNegativesRankingLoss

@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}
}

CoSENTLoss

@online{kexuefm-8847,
    title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
    author={Su Jianlin},
    year={2022},
    month={Jan},
    url={https://kexue.fm/archives/8847},
}
Downloads last month
11
Safetensors
Model size
278M params
Tensor type
F32
·
Inference API
This model can be loaded on Inference API (serverless).

Finetuned from

Datasets used to train saraleivam/GURU-model2