sentence-transformers safetensors bert sentence-similarity feature-extraction generated_from_trainer dataset_size:491 loss:MultipleNegativesRankingLoss arxiv:1908.10084 arxiv:1705.00652 base_model:BAAI/bge-small-en-v1.5 base_model:finetune:BAAI/bge-small-en-v1.5 model-index autotrain_compatible text-embeddings-inference endpoints_compatible region:us
---
base_model: BAAI/bge-small-en-v1.5
datasets: []
language: []
library_name: sentence-transformers
metrics:
- cosine_accuracy@1
- cosine_accuracy@3
- cosine_accuracy@5
- cosine_accuracy@10
- cosine_precision@1
- cosine_precision@3
- cosine_precision@5
- cosine_precision@10
- cosine_recall@1
- cosine_recall@3
- cosine_recall@5
- cosine_recall@10
- cosine_ndcg@10
- cosine_mrr@10
- cosine_map@100
- dot_accuracy@1
- dot_accuracy@3
- dot_accuracy@5
- dot_accuracy@10
- dot_precision@1
- dot_precision@3
- dot_precision@5
- dot_precision@10
- dot_recall@1
- dot_recall@3
- dot_recall@5
- dot_recall@10
- dot_ndcg@10
- dot_mrr@10
- dot_map@100
pipeline_tag: sentence-similarity
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:491
- loss:MultipleNegativesRankingLoss
widget:
- source_sentence: do I have money I vested through [TICKER]
  sentences:
  - '[{"get_portfolio([''brokerName''])": "portfolio"}, {"filter(''portfolio'',''brokerName'',''=='',''Magnifi'')":
    "portfolio"}]'
  - '[{"get_attribute([''<TICKER1>''],[''returns''],''<DATES>'')": "price_<TICKER1>"}]'
  - '[{"get_earnings_announcements([''<TICKER1>''],''<DATES>'')": "<TICKER1>_earnings"}]'
- source_sentence: Knock Knock!
  sentences:
  - '[{"get_portfolio([''weight''])": "portfolio"}, {"factor_contribution(''portfolio'',''<DATES>'',''sector'',''sector
    retailing'',''portfolio'')": "portfolio"}]'
  - '[{"get_news_articles([''<TICKER1>''],None,None,None)": "news_data_<TICKER1>"}]'
  - '[]'
- source_sentence: what's the earnings per share of [TICKER]
  sentences:
  - '[{"get_attribute([''<TICKER1>''],[''returns''],''<DATES>'')": "performance_data_<TICKER1>"}]'
  - '[{"get_attribute([''<TICKER1>''],[''earnings per share''],''<DATES>'')": "earnings_per_share_<TICKER1>"}]'
  - '[{"get_portfolio([''weight''])": "portfolio"}, {"factor_contribution(''portfolio'',''<DATES>'',''factor'',''momentum'',''portfolio'')":
    "portfolio"}]'
- source_sentence: returns of [TICKER] since 2017
  sentences:
  - '[{"get_portfolio([''weight''])": "portfolio"}, {"factor_contribution(''portfolio'',''<DATES>'',''factor'',''volatility'',''returns'')":
    "portfolio"}]'
  - '[{"get_attribute([''<TICKER1>''],[''returns''],''<DATES>'')": "performance_data_<TICKER1>"}]'
  - '[{"get_dictionary_definition([''limit order'', ''market order''])": "definitions"}]'
- source_sentence: how should I play [TICKER] futures contracts
  sentences:
  - '[]'
  - '[{"get_attribute([''<TICKER1>''],[''returns''],''<DATES>'')": "live_price_<TICKER1>"}]'
  - '[{"get_news_articles(None,None,None,None)": "latest_news_data"}]'
model-index:
- name: SentenceTransformer based on BAAI/bge-small-en-v1.5
  results:
  - task:
      type: information-retrieval
      name: Information Retrieval
    dataset:
      name: Unknown
      type: unknown
    metrics:
    - type: cosine_accuracy@1
      value: 0.7191780821917808
      name: Cosine Accuracy@1
    - type: cosine_accuracy@3
      value: 0.9246575342465754
      name: Cosine Accuracy@3
    - type: cosine_accuracy@5
      value: 0.952054794520548
      name: Cosine Accuracy@5
    - type: cosine_accuracy@10
      value: 0.9794520547945206
      name: Cosine Accuracy@10
    - type: cosine_precision@1
      value: 0.7191780821917808
      name: Cosine Precision@1
    - type: cosine_precision@3
      value: 0.3082191780821918
      name: Cosine Precision@3
    - type: cosine_precision@5
      value: 0.19041095890410956
      name: Cosine Precision@5
    - type: cosine_precision@10
      value: 0.09794520547945204
      name: Cosine Precision@10
    - type: cosine_recall@1
      value: 0.019977168949771692
      name: Cosine Recall@1
    - type: cosine_recall@3
      value: 0.02568493150684932
      name: Cosine Recall@3
    - type: cosine_recall@5
      value: 0.02644596651445967
      name: Cosine Recall@5
    - type: cosine_recall@10
      value: 0.02720700152207002
      name: Cosine Recall@10
    - type: cosine_ndcg@10
      value: 0.1886992031917713
      name: Cosine Ndcg@10
    - type: cosine_mrr@10
      value: 0.8171314416177428
      name: Cosine Mrr@10
    - type: cosine_map@100
      value: 0.02272901264767703
      name: Cosine Map@100
    - type: dot_accuracy@1
      value: 0.7191780821917808
      name: Dot Accuracy@1
    - type: dot_accuracy@3
      value: 0.9246575342465754
      name: Dot Accuracy@3
    - type: dot_accuracy@5
      value: 0.952054794520548
      name: Dot Accuracy@5
    - type: dot_accuracy@10
      value: 0.9794520547945206
      name: Dot Accuracy@10
    - type: dot_precision@1
      value: 0.7191780821917808
      name: Dot Precision@1
    - type: dot_precision@3
      value: 0.3082191780821918
      name: Dot Precision@3
    - type: dot_precision@5
      value: 0.19041095890410956
      name: Dot Precision@5
    - type: dot_precision@10
      value: 0.09794520547945204
      name: Dot Precision@10
    - type: dot_recall@1
      value: 0.019977168949771692
      name: Dot Recall@1
    - type: dot_recall@3
      value: 0.02568493150684932
      name: Dot Recall@3
    - type: dot_recall@5
      value: 0.02644596651445967
      name: Dot Recall@5
    - type: dot_recall@10
      value: 0.02720700152207002
      name: Dot Recall@10
    - type: dot_ndcg@10
      value: 0.1886992031917713
      name: Dot Ndcg@10
    - type: dot_mrr@10
      value: 0.8171314416177428
      name: Dot Mrr@10
    - type: dot_map@100
      value: 0.02272901264767703
      name: Dot Map@100
---

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

This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [BAAI/bge-small-en-v1.5](https://huggingface.co/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](https://huggingface.co/BAAI/bge-small-en-v1.5) <!-- at revision 5c38ec7c405ec4b44b94cc5a9bb96e735b38267a -->
- **Maximum Sequence Length:** 512 tokens
- **Output Dimensionality:** 384 tokens
- **Similarity Function:** Cosine Similarity
<!-- - **Training Dataset:** Unknown -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)

### 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:

```bash
pip install -U sentence-transformers
```

Then you can load this model and run inference.
```python
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]
```

<!--
### Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details>
-->

<!--
### Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details>
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

## Evaluation

### Metrics

#### Information Retrieval

* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)

| 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     |

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Dataset

#### Unnamed Dataset


* Size: 491 training samples
* Columns: <code>sentence_0</code> and <code>sentence_1</code>
* Approximate statistics based on the first 1000 samples:
  |         | sentence_0                                                                       | sentence_1                                                                         |
  |:--------|:---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------|
  | type    | string                                                                           | string                                                                             |
  | details | <ul><li>min: 4 tokens</li><li>mean: 11.9 tokens</li><li>max: 26 tokens</li></ul> | <ul><li>min: 4 tokens</li><li>mean: 67.55 tokens</li><li>max: 194 tokens</li></ul> |
* Samples:
  | sentence_0                                                  | sentence_1                                                                                                       |
  |:------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------|
  | <code>Profitability of [TICKER]</code>                      | <code>[{"get_attribute(['<TICKER1>'],['cash flow profitability'],'<DATES>')": "profitability_<TICKER1>"}]</code> |
  | <code>[TICKER] momentum</code>                              | <code>[{"get_attribute(['<TICKER1>'],['momentum'],'<DATES>')": "momentum_<TICKER1>"}]</code>                     |
  | <code>what was the total return of [TICKER] for 2023</code> | <code>[{"get_attribute(['<TICKER1>'],['returns'],'<DATES>')": "performance_data_<TICKER1>"}]</code>              |
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
  ```json
  {
      "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
<details><summary>Click to expand</summary>

- `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

</details>

### Training Logs
<details><summary>Click to expand</summary>

| 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         |

</details>

### 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
```bibtex
@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
```bibtex
@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}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->