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: 256 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity

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:

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 = [
    'install new Actuator Switch',
    'replace fan switch',
    'replace hi limit switch',
]
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.8039, 0.8263],
#         [0.8039, 1.0000, 0.7918],
#         [0.8263, 0.7918, 1.0000]])

Training Details

Training Dataset

Unnamed Dataset

  • Size: 78,106 training samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 label
    type string string int
    details
    • min: 4 tokens
    • mean: 6.97 tokens
    • max: 16 tokens
    • min: 4 tokens
    • mean: 7.08 tokens
    • max: 19 tokens
    • 1: 100.00%
  • Samples:
    sentence1 sentence2 label
    Solid state relay contacts not making contact Solid state relay not closing 1
    Single pole relay is stuck closed Relay is stuck closed 1
    Relay potentially damaged due to wiring issue Relay faulty 1
  • Loss: OnlineContrastiveLoss

Evaluation Dataset

Unnamed Dataset

  • Size: 818 evaluation samples
  • Columns: sentence1, sentence2, and label
  • Approximate statistics based on the first 818 samples:
    sentence1 sentence2 label
    type string string int
    details
    • min: 3 tokens
    • mean: 5.53 tokens
    • max: 10 tokens
    • min: 3 tokens
    • mean: 5.93 tokens
    • max: 14 tokens
    • 0: ~50.00%
    • 1: ~50.00%
  • Samples:
    sentence1 sentence2 label
    Power Relay needs replacement relay needs replacement 1
    Target needs replacement ceramic tile needs replacement 1
    install new Infinite Switch install new inf switch 1
  • Loss: OnlineContrastiveLoss

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: epoch
  • per_device_train_batch_size: 256
  • per_device_eval_batch_size: 256
  • learning_rate: 1e-05
  • num_train_epochs: 4
  • warmup_ratio: 0.02
  • bf16: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: epoch
  • 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: 1e-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: 4
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.02
  • 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: 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: None
  • hub_always_push: False
  • hub_revision: None
  • 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
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss Validation Loss
1.0 7 - 28.7758
2.0 14 - 20.5461
3.0 21 - 14.5468
4.0 28 - 12.2789
5.0 35 - 7.4563
6.0 42 - 4.7709
7.0 49 - 3.7263
8.0 56 - 3.2799
9.0 63 - 3.4937
10.0 70 - 3.3956
11.0 77 - 3.2518
12.0 84 - 2.4912
13.0 91 - 1.7859
14.0 98 - 1.4185
14.2857 100 9.9923 -
15.0 105 - 1.4582
16.0 112 - 1.4355
17.0 119 - 1.2700
18.0 126 - 0.9766
19.0 133 - 0.9087
20.0 140 - 0.8227
21.0 147 - 0.7897
22.0 154 - 0.6956
23.0 161 - 0.7913
24.0 168 - 0.7902
25.0 175 - 0.7534
26.0 182 - 0.6562
27.0 189 - 0.5444
28.0 196 - 0.4464
28.5714 200 0.2576 -
29.0 203 - 0.4410
30.0 210 - 0.4314
31.0 217 - 0.3471
32.0 224 - 0.3472
33.0 231 - 0.3445
34.0 238 - 0.3404
35.0 245 - 0.3378
36.0 252 - 0.3370
37.0 259 - 0.3355
38.0 266 - 0.3339
39.0 273 - 0.3326
40.0 280 - 0.3328
41.0 287 - 0.3308
42.0 294 - 0.3308
42.8571 300 0.1918 -
43.0 301 - 0.3306
44.0 308 - 0.3304
45.0 315 - 0.3294
46.0 322 - 0.3295
47.0 329 - 0.3295
48.0 336 - 0.3297
49.0 343 - 0.3295
50.0 350 - 0.3295
1.0 4 - 0.1957
2.0 8 - 0.1227
3.0 12 - 0.1132
4.0 16 - 0.0720
5.0 20 - 0.0629
6.0 24 - 0.0591
7.0 28 - 0.0
8.0 32 - 0.0
9.0 36 - 0.0
10.0 40 - 0.0
11.0 44 - 0.0
12.0 48 - 0.0
12.5 50 0.441 -
13.0 52 - 0.0
14.0 56 - 0.0
15.0 60 - 0.0
16.0 64 - 0.0
17.0 68 - 0.0
18.0 72 - 0.0
19.0 76 - 0.0
20.0 80 - 0.0
21.0 84 - 0.0
22.0 88 - 0.0
23.0 92 - 0.0
24.0 96 - 0.0
25.0 100 0.3348 0.0
26.0 104 - 0.0
27.0 108 - 0.0
28.0 112 - 0.0
29.0 116 - 0.0
30.0 120 - 0.0
0.6536 200 7.707 -
1.0 306 - 0.7959
1.3072 400 6.7597 -
1.9608 600 6.4126 -
2.0 612 - 1.0730
2.6144 800 6.2623 -
3.0 918 - 1.1429
3.2680 1000 6.1651 -
3.9216 1200 6.12 -
4.0 1224 - 1.2153
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.11.0rc1
  • Sentence Transformers: 5.0.0
  • Transformers: 4.53.1
  • PyTorch: 2.7.1+cu126
  • Accelerate: 1.8.1
  • Datasets: 3.6.0
  • Tokenizers: 0.21.2

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",
}
Downloads last month
1
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 InstalilyAI/sentence-transformer-synonyms

Finetuned
(666)
this model