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 = [
    '[OFFER] Лен | 10.0 упаковка',
    '[ORDER] Лен | 10.0 упаковка',
    '[OFFER] Арматура 8А500С L=11,7 м | 8.5 т',
]
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.9970, -0.0349],
#         [ 0.9970,  1.0000, -0.0279],
#         [-0.0349, -0.0279,  1.0000]])

Evaluation

Metrics

Triplet

Metric Value
cosine_accuracy 0.9561

Training Details

Training Dataset

Unnamed Dataset

  • Size: 204,810 training samples
  • Columns: sentence_0 and sentence_1
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1
    type string string
    details
    • min: 13 tokens
    • mean: 40.47 tokens
    • max: 256 tokens
    • min: 14 tokens
    • mean: 43.67 tokens
    • max: 256 tokens
  • Samples:
    sentence_0 sentence_1
    [OFFER] 231625 Болт | 24.0 шт [ORDER] Болт для крепления углового карданного вала МАНИТУ МТ732 231625 | 24.0 шт
    [OFFER] BPL2930 Профиль П-обр. PSL L3000 1,5мм ДКС | 30.0 м [ORDER] Профиль П-образный PSL 29х48х3000 1.5 мм (BPL2930) / DKC | 30.0 м
    [OFFER] Счетчик электроэнергии трехфазный многотарифный (2 тарифа) Меркурий-231 АТ-011 5-60А IrDA DIN ЖКИ Инкотекс | 2.0 шт [ORDER] Электросчетчик "Меркурий 231AT-01 I", мн.т. ЖКИ, IrDA 5(60)A | 2.0 шт
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "gather_across_devices": false
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 24
  • num_train_epochs: 4
  • eval_strategy: steps
  • per_device_eval_batch_size: 24
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 24
  • num_train_epochs: 4
  • max_steps: -1
  • learning_rate: 5e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0
  • optim: adamw_torch
  • optim_args: None
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 1
  • average_tokens_across_devices: True
  • max_grad_norm: 1
  • label_smoothing_factor: 0.0
  • bf16: False
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: False
  • project: huggingface
  • trackio_space_id: trackio
  • eval_strategy: steps
  • per_device_eval_batch_size: 24
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: False
  • hub_private_repo: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 42
  • data_seed: None
  • use_cpu: False
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: []
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • warmup_ratio: None
  • local_rank: -1
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss goods-val_cosine_accuracy
0.0586 500 0.8426 -
0.1172 1000 0.2536 -
0.1758 1500 0.2174 -
0.2344 2000 0.1768 -
0.2929 2500 0.1701 -
0.3515 3000 0.1486 -
0.4101 3500 0.1418 -
0.4687 4000 0.1197 -
0.5 4267 - 0.9440
0.5273 4500 0.1159 -
0.5859 5000 0.1029 -
0.6445 5500 0.0910 -
0.7031 6000 0.0887 -
0.7617 6500 0.0819 -
0.8202 7000 0.0709 -
0.8788 7500 0.0708 -
0.9374 8000 0.0708 -
0.9960 8500 0.0608 -
1.0 8534 - 0.9530
1.0546 9000 0.0520 -
1.1132 9500 0.0492 -
1.1718 10000 0.0520 -
1.2304 10500 0.0487 -
1.2890 11000 0.0503 -
1.3476 11500 0.0455 -
1.4061 12000 0.0444 -
1.4647 12500 0.0454 -
1.5 12801 - 0.9550
1.5233 13000 0.0421 -
1.5819 13500 0.0412 -
1.6405 14000 0.0449 -
1.6991 14500 0.0374 -
1.7577 15000 0.0358 -
1.8163 15500 0.0360 -
1.8749 16000 0.0349 -
1.9334 16500 0.0386 -
1.9920 17000 0.0365 -
2.0 17068 - 0.9520
2.0506 17500 0.0287 -
2.1092 18000 0.0336 -
2.1678 18500 0.0274 -
2.2264 19000 0.0256 -
2.2850 19500 0.0278 -
2.3436 20000 0.0240 -
2.4022 20500 0.0276 -
2.4607 21000 0.0266 -
2.5 21335 - 0.9557
2.5193 21500 0.0274 -
2.5779 22000 0.0240 -
2.6365 22500 0.0249 -
2.6951 23000 0.0253 -
2.7537 23500 0.0244 -
2.8123 24000 0.0256 -
2.8709 24500 0.0261 -
2.9295 25000 0.0225 -
2.9880 25500 0.0231 -
3.0 25602 - 0.9549
3.0466 26000 0.0250 -
3.1052 26500 0.0201 -
3.1638 27000 0.0159 -
3.2224 27500 0.0206 -
3.2810 28000 0.0230 -
3.3396 28500 0.0193 -
3.3982 29000 0.0185 -
3.4568 29500 0.0178 -
3.5 29869 - 0.9557
3.5154 30000 0.0209 -
3.5739 30500 0.0193 -
3.6325 31000 0.0194 -
3.6911 31500 0.0170 -
3.7497 32000 0.0191 -
3.8083 32500 0.0161 -
3.8669 33000 0.0190 -
3.9255 33500 0.0197 -
3.9841 34000 0.0189 -
4.0 34136 - 0.9561

Framework Versions

  • Python: 3.11.10
  • Sentence Transformers: 5.2.3
  • Transformers: 5.2.0
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.12.0
  • Datasets: 4.6.1
  • Tokenizers: 0.22.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",
}

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
3
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 olegGerbylev/all-MiniLM-L6-v2-goods

Finetuned
(819)
this model

Papers for olegGerbylev/all-MiniLM-L6-v2-goods

Evaluation results