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
queries = [
    "Cho t\u00f4i kh\u00f3a h\u1ecdc trung c\u1ea5p v\u1ec1 Software Architecture and Design c\u00f3 nhi\u1ec1u b\u00e0i t\u1eadp th\u1ef1c h\u00e0nh",
]
documents = [
    "Architectural Styles (Monolith vs. Microservices) - (O'Reilly, YouTube) | Compares monolithic and microservices architectural styles. Explains trade-offs related to development speed, deployment complexity, scalability, and operational overhead to help teams choose an appropriate architecture. | So sánh hai phong cách kiến trúc phổ biến: monolith và microservices. Giải thích các trade-off về tốc độ phát triển, độ phức tạp triển khai, khả năng mở rộng và chi phí vận hành để giúp đội ngũ lựa chọn kiến trúc phù hợp. | Architectural Styles, Monolith, Microservices, System Design, Scalability, Trade-offs, Distributed Systems",
    'Input Handling: Mouse, Keyboard, and Mobile Touch | Techniques for capturing player input in C#. Covers both the legacy Input Manager and the modern **Input System** package for handling keyboard, mouse clicks, and touch events on mobile platforms. | Các kỹ thuật thu thập **đầu vào (Input)** của người chơi trong C#. Đề cập đến cả Input Manager cũ và **Input System** hiện đại cho bàn phím, chuột và cảm ứng di động. | Input System, Xử lý đầu vào, Keyboard Input, Mouse Input, Touch Input, MonoBehaviour, C# Scripting',
    'Academic Writing Style and Tone - Purdue OWL | Focuses on the mechanics of clear, formal academic writing. Covers concise sentences, correct terminology, objective tone, and coherent paragraph structure. | Tập trung vào kỹ thuật viết học thuật rõ ràng và trang trọng. Trình bày cách viết câu ngắn gọn, dùng thuật ngữ phù hợp, giữ giọng văn khách quan và cấu trúc đoạn văn mạch lạc. | academic style, writing tone, clarity, conciseness, formal writing, paragraph structure, objective tone, academic mechanics',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 384] [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[ 0.6604, -0.1001,  0.0158]])

Training Details

Training Dataset

Unnamed Dataset

  • Size: 32,440 training samples
  • Columns: query, positive, and negative
  • Approximate statistics based on the first 1000 samples:
    query positive negative
    type string string string
    details
    • min: 10 tokens
    • mean: 26.97 tokens
    • max: 63 tokens
    • min: 72 tokens
    • mean: 157.54 tokens
    • max: 256 tokens
    • min: 75 tokens
    • mean: 155.26 tokens
    • max: 256 tokens
  • Samples:
    query positive negative
    Em muốn ôn lại kiến thức cơ bản Introduction to computing, nên xem khóa nào? edX – Computing in Python (Georgia Tech) | Covers program execution models, state changes, loops, functions, and the conceptual mechanics behind code execution. | Bao quát mô hình thực thi chương trình, thay đổi trạng thái, vòng lặp, hàm và cơ chế hoạt động của mã nguồn. | python programming, execution model, control flow, state changes, functions, intro Python course, lập trình Python cơ bản Performance Optimization: Image and Asset Loading | Techniques for optimizing website speed by properly sizing, compressing, and serving images (WebP, SVG) and other assets, including lazy loading and caching strategies. | Các kỹ thuật tối ưu hóa tốc độ trang web bằng cách định cỡ, nén và phân phát hình ảnh (WebP, SVG) và các tài sản khác một cách hợp lý, bao gồm chiến lược tải lười (lazy loading) và bộ nhớ đệm (caching). | Web Performance, Optimization, Image Compression, Lazy Loading, Caching, Tối ưu hiệu suất, Tốc độ tải, Bộ nhớ đệm
    Beginner friendly material to understand the basics of Database Systems Advanced SQL: MySQL Data Analysis & Business Intelligence on Udemy | Teaches advanced SQL techniques for data analysis and business intelligence reporting using MySQL. Learners master complex queries, window functions, and subqueries to extract meaningful insights from data. | Giảng dạy các kỹ thuật SQL nâng cao dành cho phân tích dữ liệu và báo cáo Business Intelligence với MySQL. Người học sẽ nắm vững truy vấn phức tạp, hàm cửa sổ và truy vấn lồng để khai thác insight ý nghĩa từ dữ liệu. | analytical SQL, business intelligence, window functions, CTEs, reporting queries, MySQL analysis Essence of linear algebra & Essence of calculus by 3Blue1Brown on YouTube | Develops a deep, visual intuition for the core ideas of linear algebra and calculus. This series helps learners understand the 'why' behind the formulas, focusing on concepts like vectors, matrices, and the geometric meaning of derivatives. | Phát triển trực giác hình học sâu sắc cho các ý tưởng cốt lõi của đại số tuyến tính và giải tích. Series này giúp người học hiểu được “vì sao” đằng sau các công thức, tập trung vào các khái niệm như vectơ, ma trận và ý nghĩa hình học của đạo hàm. | visual intuition, geometric thinking, vector spaces, matrix intuition, calculus intuition
    What will I learn in the course Introduction to Mobile Development: Native vs. Hybrid vs. Cross-Platform? Introduction to Mobile Development: Native vs. Hybrid vs. Cross-Platform | Defines the three main approaches to mobile development: Native (Swift/Kotlin), Hybrid (Web views), and Cross-Platform (single codebase for multiple OS). Highlights the pros and cons of each. | Định nghĩa ba cách tiếp cận chính trong phát triển di động: Native (bản địa), Hybrid (lai), và Cross-Platform (đa nền tảng). Nêu bật ưu và nhược điểm của từng phương pháp. | Cross-Platform, Đa nền tảng, Native, Hybrid, Mobile Development, Phát triển ứng dụng, Single Codebase Generics in C#: Defining Type-Safe Collections and Methods | Explains the concept of Generics in C# for creating reusable, type-safe data structures and methods without committing to a specific data type. Focuses on generic collections like List<T> and Dictionary<TKey, TValue>. | Giải thích khái niệm Generics trong C# để tạo ra các cấu trúc dữ liệu và phương thức an toàn kiểu dữ liệu, có thể tái sử dụng mà không cần cam kết với một kiểu dữ liệu cụ thể. Tập trung vào các collection generic. | Generics, Generic Collections, Type Safety, An toàn kiểu dữ liệu, List, Dictionary, Code Reusability
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "gather_across_devices": false
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • learning_rate: 2e-05
  • num_train_epochs: 1
  • warmup_ratio: 0.1

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
  • torch_empty_cache_steps: None
  • learning_rate: 2e-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
  • 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}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch_fused
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • project: huggingface
  • trackio_space_id: trackio
  • 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: no
  • 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: True
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss
0.0123 50 1.16
0.0247 100 0.9162
0.0370 150 0.7569
0.0493 200 0.6174
0.0617 250 0.5075
0.0740 300 0.4455
0.0863 350 0.4044
0.0986 400 0.4089
0.1110 450 0.426
0.1233 500 0.3669
0.1356 550 0.3157
0.1480 600 0.3908
0.1603 650 0.2838
0.1726 700 0.2972
0.1850 750 0.2958
0.1973 800 0.3037
0.2096 850 0.3593
0.2219 900 0.2557
0.2343 950 0.2758
0.2466 1000 0.3339
0.2589 1050 0.2672
0.2713 1100 0.3247
0.2836 1150 0.3204
0.2959 1200 0.2364
0.3083 1250 0.2132
0.3206 1300 0.2417
0.3329 1350 0.2815
0.3453 1400 0.2677
0.3576 1450 0.2271
0.3699 1500 0.2083
0.3822 1550 0.2475
0.3946 1600 0.2006
0.4069 1650 0.2167
0.4192 1700 0.2538
0.4316 1750 0.1796
0.4439 1800 0.2479
0.4562 1850 0.2176
0.4686 1900 0.2082
0.4809 1950 0.2303
0.4932 2000 0.1672
0.5055 2050 0.2042
0.5179 2100 0.1664
0.5302 2150 0.159
0.5425 2200 0.1508
0.5549 2250 0.2056
0.5672 2300 0.1705
0.5795 2350 0.1747
0.5919 2400 0.124
0.6042 2450 0.251
0.6165 2500 0.1777
0.6289 2550 0.1611
0.6412 2600 0.1714
0.6535 2650 0.1842
0.6658 2700 0.2243
0.6782 2750 0.2016
0.6905 2800 0.1855
0.7028 2850 0.1639
0.7152 2900 0.2506
0.7275 2950 0.1663
0.7398 3000 0.2081
0.7522 3050 0.1653
0.7645 3100 0.1706
0.7768 3150 0.2046
0.7891 3200 0.1553
0.8015 3250 0.1659
0.8138 3300 0.1664
0.8261 3350 0.1824
0.8385 3400 0.1275
0.8508 3450 0.1528
0.8631 3500 0.1654
0.8755 3550 0.1825
0.8878 3600 0.1466
0.9001 3650 0.1581
0.9125 3700 0.189
0.9248 3750 0.1769
0.9371 3800 0.1264
0.9494 3850 0.1393
0.9618 3900 0.1481
0.9741 3950 0.1756
0.9864 4000 0.1675
0.9988 4050 0.1672

Framework Versions

  • Python: 3.12.12
  • Sentence Transformers: 5.1.2
  • Transformers: 4.57.1
  • PyTorch: 2.9.0+cu126
  • Accelerate: 1.11.0
  • Datasets: 4.0.0
  • Tokenizers: 0.22.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
-
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 TribalChiefBanana/Embedding_miniV2_upgrade

Finetuned
(751)
this model

Papers for TribalChiefBanana/Embedding_miniV2_upgrade