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

This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2 on the gooaq 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: sentence-transformers/all-MiniLM-L6-v2
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:
  • Language: en

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: 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:

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("ayushexel/emb-all-MiniLM-L6-v2-gooaq-1-epochs")
# Run inference
sentences = [
    'what is usb c ss?',
    'The USB Type-C specification is pretty confusing. ... The standard USB logo to identify USB 2.0 ports or slower. "SS" markings, which stand for SuperSpeed, to identify USB 3.0 ports, otherwise known as USB 3.1 gen 1. "10" markings, which stand for 10 Gbps, to identify USB 3.1 gen 2 ports with ultra-fast connectivity.',
    '“Global warming” refers to the rise in global temperatures due mainly to the increasing concentrations of greenhouse gases in the atmosphere. “Climate change” refers to the increasing changes in the measures of climate over a long period of time – including precipitation, temperature, and wind patterns.',
]
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]

Evaluation

Metrics

Triplet

Metric Value
cosine_accuracy 0.5692

Training Details

Training Dataset

gooaq

  • Dataset: gooaq at b089f72
  • Size: 1,995,000 training samples
  • Columns: question and answer
  • Approximate statistics based on the first 1000 samples:
    question answer
    type string string
    details
    • min: 8 tokens
    • mean: 11.86 tokens
    • max: 23 tokens
    • min: 14 tokens
    • mean: 60.74 tokens
    • max: 133 tokens
  • Samples:
    question answer
    can twine be a noun? noun. a strong thread or string composed of two or more strands twisted together. an act of twining, twisting, or interweaving.
    what is bo id in nsdl? The demat account number allotted to the beneficiary holder(s) by DP is known as the BO-ID. In CDSL it is 16 digits number. It is an intermediary (an institution) between the investor and the depository.
    how much does it cost to run an electric fan all night? The average indoor ceiling fan costs around 0.13c to 1.29c per hour to run, or between $1.90 and $18.85 each year. This will depend on the fan's speed settings, how frequently it's used, and the rate you pay on electricity. Like most electrical appliances, a ceiling fan's power is measured in watts.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Evaluation Dataset

gooaq

  • Dataset: gooaq at b089f72
  • Size: 5,000 evaluation samples
  • Columns: question and answer
  • Approximate statistics based on the first 1000 samples:
    question answer
    type string string
    details
    • min: 8 tokens
    • mean: 11.8 tokens
    • max: 21 tokens
    • min: 14 tokens
    • mean: 60.68 tokens
    • max: 123 tokens
  • Samples:
    question answer
    how much water should a person drink in 8 hours? Health authorities commonly recommend eight 8-ounce glasses, which equals about 2 liters, or half a gallon. This is called the 8×8 rule and is very easy to remember. However, some health gurus believe that you need to sip on water constantly throughout the day, even when you're not thirsty.
    what does this mean in excel #name? Important: The #NAME? error signifies that something needs to be corrected in the syntax, so when you see the error in your formula, resolve it. Do not use any error-handling functions such as IFERROR to mask the error. To avoid typos in formula names, use the Formula Wizard in Excel.
    are hydroflask good for the environment? Hydro Flasks are a new fad among many students and adults to help minimize plastic waste in the oceans. Hydro Flasks are great because they use a type of metal called TempShield, which keeps your beverage or food either hot for up to six hours or cold for up to twenty-four hours.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 256
  • per_device_eval_batch_size: 256
  • num_train_epochs: 1
  • warmup_ratio: 0.1
  • fp16: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 256
  • per_device_eval_batch_size: 256
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_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: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • tp_size: 0
  • 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: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • 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
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss Validation Loss gooqa-dev_cosine_accuracy
-1 -1 - - 0.5368
0.0128 100 0.0756 - -
0.0257 200 0.0701 - -
0.0385 300 0.0661 - -
0.0513 400 0.0655 - -
0.0642 500 0.0667 - -
0.0770 600 0.0683 - -
0.0898 700 0.0665 - -
0.1027 800 0.0641 - -
0.1155 900 0.067 - -
0.1283 1000 0.0655 0.0460 0.5366
0.1412 1100 0.065 - -
0.1540 1200 0.0643 - -
0.1668 1300 0.0607 - -
0.1796 1400 0.0605 - -
0.1925 1500 0.0596 - -
0.2053 1600 0.0609 - -
0.2181 1700 0.0611 - -
0.2310 1800 0.0608 - -
0.2438 1900 0.0613 - -
0.2566 2000 0.0593 0.0393 0.5468
0.2695 2100 0.0599 - -
0.2823 2200 0.0551 - -
0.2951 2300 0.0559 - -
0.3080 2400 0.0573 - -
0.3208 2500 0.0532 - -
0.3336 2600 0.0541 - -
0.3465 2700 0.0554 - -
0.3593 2800 0.055 - -
0.3721 2900 0.0555 - -
0.3850 3000 0.0537 0.0386 0.5452
0.3978 3100 0.057 - -
0.4106 3200 0.0516 - -
0.4235 3300 0.0535 - -
0.4363 3400 0.0554 - -
0.4491 3500 0.0509 - -
0.4620 3600 0.0503 - -
0.4748 3700 0.0496 - -
0.4876 3800 0.0499 - -
0.5004 3900 0.0525 - -
0.5133 4000 0.0484 0.0355 0.5582
0.5261 4100 0.0497 - -
0.5389 4200 0.0476 - -
0.5518 4300 0.0476 - -
0.5646 4400 0.0496 - -
0.5774 4500 0.0497 - -
0.5903 4600 0.0488 - -
0.6031 4700 0.0486 - -
0.6159 4800 0.048 - -
0.6288 4900 0.0496 - -
0.6416 5000 0.049 0.0333 0.5630
0.6544 5100 0.0476 - -
0.6673 5200 0.047 - -
0.6801 5300 0.0474 - -
0.6929 5400 0.0514 - -
0.7058 5500 0.0468 - -
0.7186 5600 0.0477 - -
0.7314 5700 0.0466 - -
0.7443 5800 0.0449 - -
0.7571 5900 0.0458 - -
0.7699 6000 0.0438 0.0325 0.5636
0.7828 6100 0.047 - -
0.7956 6200 0.0463 - -
0.8084 6300 0.0435 - -
0.8212 6400 0.0481 - -
0.8341 6500 0.0448 - -
0.8469 6600 0.0472 - -
0.8597 6700 0.0445 - -
0.8726 6800 0.0452 - -
0.8854 6900 0.0448 - -
0.8982 7000 0.0441 0.0307 0.5670
0.9111 7100 0.0428 - -
0.9239 7200 0.044 - -
0.9367 7300 0.0429 - -
0.9496 7400 0.0436 - -
0.9624 7500 0.0444 - -
0.9752 7600 0.0419 - -
0.9881 7700 0.043 - -
-1 -1 - - 0.5692

Framework Versions

  • Python: 3.11.0
  • Sentence Transformers: 4.0.1
  • Transformers: 4.50.3
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.5.2
  • Datasets: 3.5.0
  • Tokenizers: 0.21.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}
}
Downloads last month
26
Safetensors
Model size
22.7M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ayushexel/emb-all-MiniLM-L6-v2-gooaq-1-epochs

Finetuned
(313)
this model

Dataset used to train ayushexel/emb-all-MiniLM-L6-v2-gooaq-1-epochs

Evaluation results