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
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 128, '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("sentence_transformers_model_id")
# Run inference
sentences = [
    'No.',
    'Today, while mankind as a whole can make no headway in abolishing war, there is again a group of people who have achieved this same remarkable goal.',
    'Do not Jesus ’ words help us to appreciate what Jehovah really wants from us?',
]
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

Semantic Similarity

Metric STSbenchmark-en-test JSTS-validation
pearson_cosine 0.79 0.8303
spearman_cosine 0.8206 0.7833

Training Details

Training Dataset

Unnamed Dataset

  • Size: 16,681,525 training samples
  • Columns: english and label
  • Approximate statistics based on the first 1000 samples:
    english label
    type string list
    details
    • min: 4 tokens
    • mean: 24.06 tokens
    • max: 128 tokens
    • size: 384 elements
  • Samples:
    english label
    Before being used as a Kingdom Hall, it is cleared of any relics of false worship. [0.07804396003484726, -0.03384765610098839, -0.02494540810585022, -0.07025666534900665, 0.07451561838388443, ...]
    That girl always appeared from somewhere and followed me around. [0.032411519438028336, -0.014580070041120052, -0.005011037457734346, -0.030591191723942757, 0.10543882101774216, ...]
    いいえ そういう高い創造力を 保ち続ける科学者は 平均すると 最初の研究論文100編で 43回もトピックを変えていました [0.041001513600349426, -0.0013687843456864357, -0.017593644559383392, -0.03798963502049446, 0.07939894497394562, ...]
  • Loss: MSELoss

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 512
  • per_device_eval_batch_size: 512
  • gradient_accumulation_steps: 2
  • learning_rate: 0.0003
  • num_train_epochs: 8
  • warmup_ratio: 0.15
  • bf16: True
  • dataloader_num_workers: 8
  • load_best_model_at_end: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 512
  • per_device_eval_batch_size: 512
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 2
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 0.0003
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 8
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.15
  • 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: True
  • 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: 8
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • 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
  • 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: batch_sampler
  • multi_dataset_batch_sampler: proportional

Training Logs

Click to expand
Epoch Step Training Loss STSbenchmark-en-test_spearman_cosine JSTS-validation_spearman_cosine
0.0307 500 0.004 - -
0.0614 1000 0.0013 - -
0.0921 1500 0.0011 - -
0.1228 2000 0.0011 0.1715 0.2170
0.1535 2500 0.0011 - -
0.1842 3000 0.001 - -
0.2148 3500 0.001 - -
0.2455 4000 0.001 0.3243 0.3289
0.2762 4500 0.0009 - -
0.3069 5000 0.0009 - -
0.3376 5500 0.0008 - -
0.3683 6000 0.0008 0.4725 0.5123
0.3990 6500 0.0007 - -
0.4297 7000 0.0007 - -
0.4604 7500 0.0007 - -
0.4911 8000 0.0006 0.5669 0.6228
0.5218 8500 0.0006 - -
0.5525 9000 0.0006 - -
0.5831 9500 0.0006 - -
0.6138 10000 0.0005 0.6407 0.6840
0.6445 10500 0.0005 - -
0.6752 11000 0.0005 - -
0.7059 11500 0.0005 - -
0.7366 12000 0.0005 0.6953 0.7212
0.7673 12500 0.0005 - -
0.7980 13000 0.0004 - -
0.8287 13500 0.0004 - -
0.8594 14000 0.0004 0.7358 0.7510
0.8901 14500 0.0004 - -
0.9208 15000 0.0004 - -
0.9514 15500 0.0004 - -
0.9821 16000 0.0004 0.7550 0.7612
1.0128 16500 0.0003 - -
1.0435 17000 0.0003 - -
1.0742 17500 0.0003 - -
1.1049 18000 0.0003 0.7807 0.7739
1.1356 18500 0.0003 - -
1.1663 19000 0.0003 - -
1.1970 19500 0.0003 - -
1.2277 20000 0.0003 0.8003 0.7781
1.2584 20500 0.0003 - -
1.2891 21000 0.0003 - -
1.3197 21500 0.0003 - -
1.3504 22000 0.0002 0.8050 0.7780
1.3811 22500 0.0002 - -
1.4118 23000 0.0002 - -
1.4425 23500 0.0002 - -
1.4732 24000 0.0002 0.8098 0.7788
1.5039 24500 0.0002 - -
1.5346 25000 0.0002 - -
1.5653 25500 0.0002 - -
1.5960 26000 0.0002 0.8147 0.7804
1.6267 26500 0.0002 - -
1.6574 27000 0.0002 - -
1.6880 27500 0.0002 - -
1.7187 28000 0.0002 0.8136 0.7762
1.7494 28500 0.0002 - -
1.7801 29000 0.0002 - -
1.8108 29500 0.0002 - -
1.8415 30000 0.0002 0.8138 0.7784
1.8722 30500 0.0002 - -
1.9029 31000 0.0002 - -
1.9336 31500 0.0002 - -
1.9643 32000 0.0002 0.8161 0.7812
1.9950 32500 0.0002 - -
2.0257 33000 0.0002 - -
2.0564 33500 0.0002 - -
2.0870 34000 0.0002 0.8140 0.7790
2.1177 34500 0.0002 - -
2.1484 35000 0.0002 - -
2.1791 35500 0.0002 - -
2.2098 36000 0.0002 0.8136 0.7815
2.2405 36500 0.0002 - -
2.2712 37000 0.0002 - -
2.3019 37500 0.0002 - -
2.3326 38000 0.0002 0.8165 0.7811
2.3633 38500 0.0002 - -
2.3940 39000 0.0002 - -
2.4247 39500 0.0002 - -
2.4553 40000 0.0002 0.8157 0.7822
2.4860 40500 0.0002 - -
2.5167 41000 0.0002 - -
2.5474 41500 0.0002 - -
2.5781 42000 0.0002 0.8149 0.7819
2.6088 42500 0.0002 - -
2.6395 43000 0.0002 - -
2.6702 43500 0.0002 - -
2.7009 44000 0.0002 0.8167 0.7812
2.7316 44500 0.0002 - -
2.7623 45000 0.0002 - -
2.7930 45500 0.0002 - -
2.8236 46000 0.0002 0.8146 0.7829
2.8543 46500 0.0002 - -
2.8850 47000 0.0002 - -
2.9157 47500 0.0002 - -
2.9464 48000 0.0002 0.8162 0.7817
2.9771 48500 0.0002 - -
3.0078 49000 0.0002 - -
3.0385 49500 0.0002 - -
3.0692 50000 0.0002 0.8155 0.7818
3.0999 50500 0.0002 - -
3.1306 51000 0.0002 - -
3.1613 51500 0.0002 - -
3.1919 52000 0.0002 0.8160 0.7813
3.2226 52500 0.0001 - -
3.2533 53000 0.0001 - -
3.2840 53500 0.0001 - -
3.3147 54000 0.0001 0.8190 0.7822
3.3454 54500 0.0001 - -
3.3761 55000 0.0001 - -
3.4068 55500 0.0001 - -
3.4375 56000 0.0001 0.8172 0.7834
3.4682 56500 0.0001 - -
3.4989 57000 0.0001 - -
3.5296 57500 0.0001 - -
3.5602 58000 0.0001 0.8175 0.7822
3.5909 58500 0.0001 - -
3.6216 59000 0.0001 - -
3.6523 59500 0.0001 - -
3.6830 60000 0.0001 0.8188 0.7827
3.7137 60500 0.0001 - -
3.7444 61000 0.0001 - -
3.7751 61500 0.0001 - -
3.8058 62000 0.0001 0.8162 0.7829
3.8365 62500 0.0001 - -
3.8672 63000 0.0001 - -
3.8979 63500 0.0001 - -
3.9285 64000 0.0001 0.8185 0.7814
3.9592 64500 0.0001 - -
3.9899 65000 0.0001 - -
4.0206 65500 0.0001 - -
4.0513 66000 0.0001 0.8174 0.7839
4.0820 66500 0.0001 - -
4.1127 67000 0.0001 - -
4.1434 67500 0.0001 - -
4.1741 68000 0.0001 0.8174 0.7827
4.2048 68500 0.0001 - -
4.2355 69000 0.0001 - -
4.2662 69500 0.0001 - -
4.2969 70000 0.0001 0.8166 0.7833
4.3275 70500 0.0001 - -
4.3582 71000 0.0001 - -
4.3889 71500 0.0001 - -
4.4196 72000 0.0001 0.8190 0.7837
4.4503 72500 0.0001 - -
4.4810 73000 0.0001 - -
4.5117 73500 0.0001 - -
4.5424 74000 0.0001 0.8188 0.7837
4.5731 74500 0.0001 - -
4.6038 75000 0.0001 - -
4.6345 75500 0.0001 - -
4.6652 76000 0.0001 0.8186 0.7829
4.6958 76500 0.0001 - -
4.7265 77000 0.0001 - -
4.7572 77500 0.0001 - -
4.7879 78000 0.0001 0.8188 0.7839
4.8186 78500 0.0001 - -
4.8493 79000 0.0001 - -
4.8800 79500 0.0001 - -
4.9107 80000 0.0001 0.8187 0.7830
4.9414 80500 0.0001 - -
4.9721 81000 0.0001 - -
5.0028 81500 0.0001 - -
5.0335 82000 0.0001 0.8200 0.7829
5.0641 82500 0.0001 - -
5.0948 83000 0.0001 - -
5.1255 83500 0.0001 - -
5.1562 84000 0.0001 0.8195 0.7842
5.1869 84500 0.0001 - -
5.2176 85000 0.0001 - -
5.2483 85500 0.0001 - -
5.2790 86000 0.0001 0.8205 0.7835
5.3097 86500 0.0001 - -
5.3404 87000 0.0001 - -
5.3711 87500 0.0001 - -
5.4018 88000 0.0001 0.8201 0.7840
5.4324 88500 0.0001 - -
5.4631 89000 0.0001 - -
5.4938 89500 0.0001 - -
5.5245 90000 0.0001 0.8199 0.7830
5.5552 90500 0.0001 - -
5.5859 91000 0.0001 - -
5.6166 91500 0.0001 - -
5.6473 92000 0.0001 0.8204 0.7830
5.6780 92500 0.0001 - -
5.7087 93000 0.0001 - -
5.7394 93500 0.0001 - -
5.7701 94000 0.0001 0.8206 0.7832
5.8007 94500 0.0001 - -
5.8314 95000 0.0001 - -
5.8621 95500 0.0001 - -
5.8928 96000 0.0001 0.8212 0.7833
5.9235 96500 0.0001 - -
5.9542 97000 0.0001 - -
5.9849 97500 0.0001 - -
6.0156 98000 0.0001 0.8210 0.7839
6.0463 98500 0.0001 - -
6.0770 99000 0.0001 - -
6.1077 99500 0.0001 - -
6.1384 100000 0.0001 0.8206 0.7850
6.1691 100500 0.0001 - -
6.1997 101000 0.0001 - -
6.2304 101500 0.0001 - -
6.2611 102000 0.0001 0.8200 0.7839
6.2918 102500 0.0001 - -
6.3225 103000 0.0001 - -
6.3532 103500 0.0001 - -
6.3839 104000 0.0001 0.8197 0.7827
6.4146 104500 0.0001 - -
6.4453 105000 0.0001 - -
6.4760 105500 0.0001 - -
6.5067 106000 0.0001 0.8197 0.7837
6.5374 106500 0.0001 - -
6.5680 107000 0.0001 - -
6.5987 107500 0.0001 - -
6.6294 108000 0.0001 0.8214 0.7837
6.6601 108500 0.0001 - -
6.6908 109000 0.0001 - -
6.7215 109500 0.0001 - -
6.7522 110000 0.0001 0.8195 0.7823
6.7829 110500 0.0001 - -
6.8136 111000 0.0001 - -
6.8443 111500 0.0001 - -
6.8750 112000 0.0001 0.8203 0.7836
6.9057 112500 0.0001 - -
6.9363 113000 0.0001 - -
6.9670 113500 0.0001 - -
6.9977 114000 0.0001 0.8213 0.7832
7.0284 114500 0.0001 - -
7.0591 115000 0.0001 - -
7.0898 115500 0.0001 - -
7.1205 116000 0.0001 0.8213 0.7844
7.1512 116500 0.0001 - -
7.1819 117000 0.0001 - -
7.2126 117500 0.0001 - -
7.2433 118000 0.0001 0.8202 0.7831
7.2740 118500 0.0001 - -
7.3046 119000 0.0001 - -
7.3353 119500 0.0001 - -
7.3660 120000 0.0001 0.8203 0.7837
7.3967 120500 0.0001 - -
7.4274 121000 0.0001 - -
7.4581 121500 0.0001 - -
7.4888 122000 0.0001 0.8207 0.7833
7.5195 122500 0.0001 - -
7.5502 123000 0.0001 - -
7.5809 123500 0.0001 - -
7.6116 124000 0.0001 0.8202 0.7835
7.6423 124500 0.0001 - -
7.6729 125000 0.0001 - -
7.7036 125500 0.0001 - -
7.7343 126000 0.0001 0.8209 0.7832
7.7650 126500 0.0001 - -
7.7957 127000 0.0001 - -
7.8264 127500 0.0001 - -
7.8571 128000 0.0001 0.8206 0.7837
7.8878 128500 0.0001 - -
7.9185 129000 0.0001 - -
7.9492 129500 0.0001 - -
7.9799 130000 0.0001 0.8206 0.7833

Framework Versions

  • Python: 3.10.16
  • Sentence Transformers: 3.3.1
  • Transformers: 4.51.3
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.2.1
  • Datasets: 3.2.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",
}

MSELoss

@inproceedings{reimers-2020-multilingual-sentence-bert,
    title = "Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation",
    author = "Reimers, Nils and Gurevych, Iryna",
    booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing",
    month = "11",
    year = "2020",
    publisher = "Association for Computational Linguistics",
    url = "https://arxiv.org/abs/2004.09813",
}
Downloads last month
64
Safetensors
Model size
35.6M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for jvanhoof/all-miniLM-L6-v2-mE5s-distilled-ja-en-64K-vocab-mean-17M-test

Finetuned
(419)
this model

Evaluation results