SentenceTransformer based on BAAI/bge-small-en-v1.5

This is a sentence-transformers model finetuned from BAAI/bge-small-en-v1.5. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for retrieval.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: BAAI/bge-small-en-v1.5
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 384 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': 'BertModel'})
  (1): Pooling({'embedding_dimension': 384, 'pooling_mode': 'cls', '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 = [
    'Represent this sentence for searching relevant passages: In Guru Vachaka Kovai, how does the ego dissolve and what does the jiva become when it merges with Siva?',
    '[Verse 514] If the jiva’s head but merges / In Siva’s Feet, the jiva shines / As Siva Himself. The ego-ripple dies / And gains the stillness of true Being | Topics: guru_vachaka_kovai',
    '[Verse 406] By the transmuting touch of daily, / Methodical, untiring self-enquiry, / The base metal jiva shines forth clear / As Siva, freed from the mental rust, / The demon ego | Topics: guru_vachaka_kovai',
]
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.7078, 0.5582],
#         [0.7078, 1.0000, 0.5088],
#         [0.5582, 0.5088, 1.0000]])

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.6785
cosine_accuracy@3 0.8372
cosine_accuracy@5 0.8841
cosine_accuracy@10 0.9301
cosine_precision@1 0.6785
cosine_precision@3 0.2791
cosine_precision@5 0.1768
cosine_precision@10 0.093
cosine_recall@1 0.6785
cosine_recall@3 0.8372
cosine_recall@5 0.8841
cosine_recall@10 0.9301
cosine_ndcg@3 0.7719
cosine_ndcg@10 0.8065
cosine_mrr@3 0.7493
cosine_mrr@10 0.7666
cosine_map@100 0.7698

Training Details

Training Dataset

Unnamed Dataset

  • Size: 3,830 training samples
  • Columns: anchor, positive, negative_1, negative_2, and negative_3
  • Approximate statistics based on the first 1000 samples:
    anchor positive negative_1 negative_2 negative_3
    type string string string string string
    details
    • min: 13 tokens
    • mean: 25.15 tokens
    • max: 49 tokens
    • min: 13 tokens
    • mean: 42.27 tokens
    • max: 123 tokens
    • min: 14 tokens
    • mean: 44.49 tokens
    • max: 123 tokens
    • min: 15 tokens
    • mean: 43.86 tokens
    • max: 116 tokens
    • min: 13 tokens
    • mean: 44.95 tokens
    • max: 128 tokens
  • Samples:
    anchor positive negative_1 negative_2 negative_3
    Represent this sentence for searching relevant passages: What is Jnana according to Ramana Maharshi? [] This knowledge that there is nothing but God or the Self... is Jnana | Topics: citation_sentences [Upadesa Saram] Verse 30: All ego gone, Living as That alone Is penance good for growth, Sings Ramana, the Self. | Topics: ego-extinction, self-abidance, tapas, ramana [Birth name and family] Bhagavan Sri Ramana Maharshi, born Venkataraman Iyer, was the second of four children born to a devout family in Tiruchuzhi, Tamil Nadu, India. [] Everything happens according to each individual’s karma | Topics: citation_sentences
    Represent this sentence for searching relevant passages: What does it mean to have the knowledge that nothing exists except God? [] This knowledge that there is nothing but God or the Self... is Jnana | Topics: citation_sentences [] That silence could not be understood except by the very advanced | Topics: citation_sentences [] What exists apart from yourself? You ought to understand that by the Self neither the physical body nor the subtle body is meant | Topics: citation_sentences [] The flag of vairagya will never move. What greater sign does a Jnani require than that? | Topics: citation_sentences
    Represent this sentence for searching relevant passages: What did the Guru say a disciple should do to repay his Guru's grace? [] When the disciple asked what he could do in return for his Guru’s grace, the Guru said that he should always be in meditation | Topics: citation_sentences [Verse 304] The service rendered to the Guru / By the chela called and chosen by him / Should be respectful and correct, / Like a woman’s to her husband / In company | Topics: guru_vachaka_kovai [] The Guru’s grace... is beyond words or thoughts | Topics: citation_sentences [Verse 165] Why did the three-eyed Lord ordain / That Kannappa should pluck and plant / Those eyes of which he was so proud? / It was to save him from the death, / The deadly folly of deeming he / Was flesh inert. Such is the might / Of Siva’s grace, of love for Him | Topics: guru_vachaka_kovai
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "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: 2.0
  • learning_rate: 2e-05
  • warmup_steps: 0.1
  • weight_decay: 0.01
  • load_best_model_at_end: True

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 8
  • num_train_epochs: 2.0
  • max_steps: -1
  • learning_rate: 2e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0.1
  • optim: adamw_torch_fused
  • optim_args: None
  • weight_decay: 0.01
  • 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: 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: None
  • trackio_bucket_id: None
  • trackio_static_space_id: None
  • 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: True
  • 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_static_graph: None
  • 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 Training Loss atmic-val_cosine_ndcg@10
0.1044 50 1.2508 -
0.2088 100 0.6565 -
0.3132 150 0.4788 -
0.4175 200 0.4233 -
0.5219 250 0.4443 -
0.6263 300 0.4010 -
0.7307 350 0.3524 -
0.8351 400 0.3802 -
0.9395 450 0.3525 -
1.0 479 - 0.8065

Training Time

  • Training: 3.7 minutes
  • Evaluation: 8.9 seconds
  • Total: 3.8 minutes

Framework Versions

  • Python: 3.11.9
  • Sentence Transformers: 5.4.1
  • Transformers: 5.7.0
  • PyTorch: 2.10.0
  • Accelerate: 1.13.0
  • Datasets: 4.8.4
  • 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{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
108
Safetensors
Model size
33.4M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for SriRamanaAtmic/AtmicQuoterv1

Finetuned
(364)
this model

Papers for SriRamanaAtmic/AtmicQuoterv1

Evaluation results