SentenceTransformer based on unsloth/bge-m3

This is a sentence-transformers model finetuned from unsloth/bge-m3. It maps inputs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: unsloth/bge-m3
  • Maximum Sequence Length: 1024 tokens
  • Output Dimensionality: 1024 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'PeftModelForFeatureExtraction'})
  (1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'cls', 'include_prompt': True})
  (2): Normalize({'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
)

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 = [
    'Các sản phẩm bị ảnh hưởng bởi CVE-2024-37242 có thể bị tấn công bằng cách nào?',
]
documents = [
    'CVE ID: CVE-2024-37242 | Cross-Site Request Forgery (CSRF) vulnerability in Automattic Newspack Newsletters newspack-newsletters allows Cross Site Request Forgery.This issue affects Newspack Newsletters: from n/a through <= 2.13.2. | Published: 2025-01-02',
    'CVE ID: CVE-2016-1000213 | Ruckus Wireless H500 web management interface CSRF | Published: 2016-10-25 | CVSS v3: 8.8 HIGH | Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H | AV:NETWORK AC:LOW PR:NONE UI:REQUIRED S:UNCHANGED | Impact: C:HIGH I:HIGH A:HIGH | CVSS v2: 6.8 | AV:N/AC:M/Au:N/C:P/I:P/A:P',
    'CVE ID: CVE-2003-1477 | MAILsweeper for SMTP 4.3.6 and 4.3.7 allows remote attackers to cause a denial of service (CPU consumption) via a PowerPoint attachment that either (1) is corrupt or (2) contains "embedded objects." | Published: 2003-12-31 | CVSS v2: 7.8 | AV:N/AC:L/Au:N/C:N/I:N/A:C',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 1024] [3, 1024]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.5969, 0.5004, 0.5534]])

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.8
cosine_accuracy@5 0.95
cosine_accuracy@10 1.0
cosine_precision@1 0.8
cosine_precision@5 0.19
cosine_precision@10 0.1
cosine_recall@1 0.8
cosine_recall@5 0.95
cosine_recall@10 1.0
cosine_ndcg@10 0.8803
cosine_mrr@10 0.8442
cosine_map@100 0.8442

Training Details

Training Dataset

Unnamed Dataset

  • Size: 50 training samples
  • Columns: anchor and positive
  • Approximate statistics based on the first 50 samples:
    anchor positive
    type string string
    modality text text
    details
    • min: 15 tokens
    • mean: 25.76 tokens
    • max: 39 tokens
    • min: 38 tokens
    • mean: 168.26 tokens
    • max: 364 tokens
  • Samples:
    anchor positive
    Các lỗ hổng tương tự CVE-2010-0629 trong các sản phẩm opensuse khác đã được công bố chưa? CVE ID: CVE-2010-0629 | Use-after-free vulnerability in kadmin/server/server_stubs.c in kadmind in MIT Kerberos 5 (aka krb5) 1.5 through 1.6.3 allows remote authenticated users to cause a denial of service (daemon crash) via a request from a kadmin client that sends an invalid API version number. | Published: 2010-04-07 | CVSS v3: 6.5 MEDIUM | Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H | AV:NETWORK AC:LOW PR:LOW UI:NONE S:UNCHANGED | Impact: C:NONE I:NONE A:HIGH | CVSS v2: 4.0 | AV:N/AC:L/Au:S/C:N/I:N/A:P
    Cách kiểm tra xem hệ thống có bị ảnh hưởng bởi CVE-2003-1477 không, dựa trên sản phẩm all_windows? CVE ID: CVE-2003-1477 | MAILsweeper for SMTP 4.3.6 and 4.3.7 allows remote attackers to cause a denial of service (CPU consumption) via a PowerPoint attachment that either (1) is corrupt or (2) contains "embedded objects." | Published: 2003-12-31 | CVSS v2: 7.8 | AV:N/AC:L/Au:N/C:N/I:N/A:C
    Có thông tin về thời gian phát hiện và công bố CVE-2005-3254 vào năm 2005 không? CVE ID: CVE-2005-3254 | The CGIwrap program before 3.9 on Debian GNU/Linux uses an incorrect minimum value of 100 for a UID to determine whether it can perform a seteuid operation, which could allow attackers to execute code as other system UIDs that are greater than the minimum value, which should be 1000 on Debian systems. | Published: 2005-10-18 | CVSS v2: 10.0 | AV:N/AC:L/Au:N/C:C/I:C/A:C
  • Loss: CachedMultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "mini_batch_size": 8,
        "mini_batch_num_tokens": null,
        "gather_across_devices": false,
        "directions": [
            "query_to_doc"
        ],
        "partition_mode": "joint",
        "hardness_mode": null,
        "hardness_strength": 0.0
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • num_train_epochs: 1.0
  • learning_rate: 2e-05
  • bf16: True

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 8
  • num_train_epochs: 1.0
  • max_steps: -1
  • learning_rate: 2e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0
  • optim: adamw_torch_fused
  • 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.0
  • label_smoothing_factor: 0.0
  • bf16: True
  • 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
  • per_device_eval_batch_size: 8
  • 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: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step validation_cosine_ndcg@10
1.0 7 0.8803

Training Time

  • Training: 4.2 seconds
  • Evaluation: 0.2 seconds
  • Total: 4.3 seconds

Framework Versions

  • Python: 3.12.3
  • Sentence Transformers: 6.0.1
  • Transformers: 5.5.0
  • PyTorch: 2.12.1+cu130
  • Accelerate: 1.15.0
  • Datasets: 4.3.0
  • Tokenizers: 0.22.2

Additional Resources

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",
}

CachedMultipleNegativesRankingLoss

@misc{gao2021scaling,
    title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year={2021},
    eprint={2101.06983},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

MultipleNegativesRankingLoss

@misc{oord2019representationlearningcontrastivepredictive,
      title={Representation Learning with Contrastive Predictive Coding},
      author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
      year={2019},
      eprint={1807.03748},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1807.03748},
}
Downloads last month
29
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for autumn10/sec-embedding-smoke

Base model

unsloth/bge-m3
Finetuned
(6)
this model

Papers for autumn10/sec-embedding-smoke

Evaluation results