Edit model card

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 semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: BAAI/bge-small-en-v1.5
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 384 tokens
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': True}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, '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 = [
    'how should I play [TICKER] futures contracts',
    '[]',
    '[{"get_attribute([\'<TICKER1>\'],[\'returns\'],\'<DATES>\')": "live_price_<TICKER1>"}]',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.7192
cosine_accuracy@3 0.9247
cosine_accuracy@5 0.9521
cosine_accuracy@10 0.9795
cosine_precision@1 0.7192
cosine_precision@3 0.3082
cosine_precision@5 0.1904
cosine_precision@10 0.0979
cosine_recall@1 0.02
cosine_recall@3 0.0257
cosine_recall@5 0.0264
cosine_recall@10 0.0272
cosine_ndcg@10 0.1887
cosine_mrr@10 0.8171
cosine_map@100 0.0227
dot_accuracy@1 0.7192
dot_accuracy@3 0.9247
dot_accuracy@5 0.9521
dot_accuracy@10 0.9795
dot_precision@1 0.7192
dot_precision@3 0.3082
dot_precision@5 0.1904
dot_precision@10 0.0979
dot_recall@1 0.02
dot_recall@3 0.0257
dot_recall@5 0.0264
dot_recall@10 0.0272
dot_ndcg@10 0.1887
dot_mrr@10 0.8171
dot_map@100 0.0227

Training Details

Training Dataset

Unnamed Dataset

  • Size: 491 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: 4 tokens
    • mean: 11.9 tokens
    • max: 26 tokens
    • min: 4 tokens
    • mean: 67.55 tokens
    • max: 194 tokens
  • Samples:
    sentence_0 sentence_1
    Profitability of [TICKER] [{"get_attribute([''],['cash flow profitability'],'')": "profitability_"}]
    [TICKER] momentum [{"get_attribute([''],['momentum'],'')": "momentum_"}]
    what was the total return of [TICKER] for 2023 [{"get_attribute([''],['returns'],'')": "performance_data_"}]
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 10
  • per_device_eval_batch_size: 10
  • num_train_epochs: 6
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 10
  • per_device_eval_batch_size: 10
  • 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: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 6
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • 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: 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}
  • 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: False
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • 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
  • dispatch_batches: None
  • split_batches: 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
  • eval_use_gather_object: False
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin

Training Logs

Click to expand
Epoch Step cosine_map@100
0.04 2 0.0137
0.08 4 0.0137
0.12 6 0.0138
0.16 8 0.0142
0.2 10 0.0144
0.24 12 0.0147
0.28 14 0.0149
0.32 16 0.0151
0.36 18 0.0155
0.4 20 0.0166
0.44 22 0.0170
0.48 24 0.0174
0.52 26 0.0179
0.56 28 0.0181
0.6 30 0.0184
0.64 32 0.0186
0.68 34 0.0189
0.72 36 0.0191
0.76 38 0.0192
0.8 40 0.0195
0.84 42 0.0195
0.88 44 0.0195
0.92 46 0.0195
0.96 48 0.0196
1.0 50 0.0197
1.04 52 0.0196
1.08 54 0.0198
1.12 56 0.0200
1.16 58 0.0202
1.2 60 0.0202
1.24 62 0.0205
1.28 64 0.0206
1.32 66 0.0207
1.3600 68 0.0208
1.4 70 0.0208
1.44 72 0.0209
1.48 74 0.0210
1.52 76 0.0211
1.56 78 0.0211
1.6 80 0.0209
1.6400 82 0.0210
1.6800 84 0.0209
1.72 86 0.0209
1.76 88 0.0210
1.8 90 0.0211
1.8400 92 0.0211
1.88 94 0.0211
1.92 96 0.0214
1.96 98 0.0216
2.0 100 0.0218
2.04 102 0.0217
2.08 104 0.0217
2.12 106 0.0219
2.16 108 0.0221
2.2 110 0.0219
2.24 112 0.0217
2.2800 114 0.0217
2.32 116 0.0217
2.36 118 0.0218
2.4 120 0.0219
2.44 122 0.0219
2.48 124 0.0219
2.52 126 0.0222
2.56 128 0.0220
2.6 130 0.0221
2.64 132 0.0221
2.68 134 0.0221
2.7200 136 0.0221
2.76 138 0.0222
2.8 140 0.0222
2.84 142 0.0224
2.88 144 0.0224
2.92 146 0.0223
2.96 148 0.0224
3.0 150 0.0223
3.04 152 0.0223
3.08 154 0.0223
3.12 156 0.0223
3.16 158 0.0223
3.2 160 0.0223
3.24 162 0.0223
3.2800 164 0.0223
3.32 166 0.0223
3.36 168 0.0223
3.4 170 0.0223
3.44 172 0.0224
3.48 174 0.0224
3.52 176 0.0225
3.56 178 0.0224
3.6 180 0.0224
3.64 182 0.0224
3.68 184 0.0225
3.7200 186 0.0225
3.76 188 0.0225
3.8 190 0.0225
3.84 192 0.0225
3.88 194 0.0225
3.92 196 0.0226
3.96 198 0.0226
4.0 200 0.0226
4.04 202 0.0226
4.08 204 0.0226
4.12 206 0.0226
4.16 208 0.0225
4.2 210 0.0225
4.24 212 0.0225
4.28 214 0.0225
4.32 216 0.0225
4.36 218 0.0226
4.4 220 0.0227

Framework Versions

  • Python: 3.10.9
  • Sentence Transformers: 3.0.1
  • Transformers: 4.44.0
  • PyTorch: 2.4.0+cu121
  • Accelerate: 0.33.0
  • Datasets: 2.20.0
  • Tokenizers: 0.19.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
10
Safetensors
Model size
33.4M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for magnifi/bge-small-en-v1.5-ft-orc-0813

Finetuned
(118)
this model

Evaluation results