sbert
This is a sentence-transformers model finetuned from sentence-transformers/bert-base-nli-mean-tokens on the fin_modern_bert-pairs-sec-synthetic-v1 dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: sentence-transformers/bert-base-nli-mean-tokens
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
- Training Dataset:
- fin_modern_bert-pairs-sec-synthetic-v1
- Language: en
- License: apache-2.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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': 768, 'pooling_mode': 'mean', 'include_prompt': True})
)
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 = [
'What is the reporting currency used for the Ares Management Corporation financial statements?',
]
documents = [
'Financial Statements (Continued) (Dollars in Thousands, Except Share Data and As Otherwise Noted)',
'Factors contributing to a decrease in Genco’s electric margin were as follows: \x95 Lower wholesale margins as Genco purchased additional power at higher costs to supply Marketing Company after the expiration of the cost-based power supply contract between EEI and its affiliates on December 31, 2005. \x95 Higher net emission allowance costs because of a $21 million gain at Genco in the third quarter of 2005... \x95 A 9% increase in coal and transportation prices. \x95 Lower margins on interchange sales in 2006 compared with 2005, primarily because of lower power prices, and a $23 million reduction in 2006 due to the amendment of the JDA among UE, Genco and CIPS. \x95 Higher MISO Day Two Energy Market costs totaling $12 million in 2006 compared with 2005...',
'4.3 Form of Broadridge Financial Solutions, Inc. 3.400% Senior Note due 2026... 4.5 Form of Broadridge Financial Solutions, Inc. 2.900% Senior Note due 2029... 4.8 Form of Broadridge Financial Solutions, Inc. 2.600% Senior Note due 2031',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.6956, 0.2088, 0.5187]])
Evaluation
Metrics
Information Retrieval
- Dataset:
finance-eval - Evaluated with
InformationRetrievalEvaluatorwith these parameters:{ "query_prompt": "", "corpus_prompt": "" }
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.9333 |
| cosine_accuracy@3 | 1.0 |
| cosine_accuracy@5 | 1.0 |
| cosine_accuracy@10 | 1.0 |
| cosine_precision@1 | 0.9333 |
| cosine_precision@3 | 0.3333 |
| cosine_precision@5 | 0.2 |
| cosine_precision@10 | 0.1 |
| cosine_recall@1 | 0.9333 |
| cosine_recall@3 | 1.0 |
| cosine_recall@5 | 1.0 |
| cosine_recall@10 | 1.0 |
| cosine_ndcg@10 | 0.9754 |
| cosine_mrr@10 | 0.9667 |
| cosine_map@100 | 0.9667 |
Training Details
Training Dataset
fin_modern_bert-pairs-sec-synthetic-v1
- Dataset: fin_modern_bert-pairs-sec-synthetic-v1
- Size: 70 training samples
- Columns:
queryandpositive - Approximate statistics based on the first 70 samples:
query positive type string string modality text text details - min: 16 tokens
- mean: 27.47 tokens
- max: 42 tokens
- min: 15 tokens
- mean: 65.44 tokens
- max: 168 tokens
- Samples:
query positive What was the company's adjusted after-tax return on invested capital (ROIC) for fiscal 2021, and how does it compare to the prior year?For the fiscal year ended August 28, 2021, our adjusted after-tax return on invested capital (“ROIC”), which is a non-GAAP measure, was 41.0% as compared to 35.7% for the comparable prior year period.What specific risks does Baxter face when sourcing raw materials for its products, and how does the company mitigate these risks?Although most of these materials are generally available, certain raw materials used in producing some of the company’s products are available only from one or a limited number of suppliers, and Baxter at times may experience shortages of supply. In an effort to manage risk associated with raw materials supply, Baxter works closely with its suppliers to help ensure availability and continuity of supply while maintaining high quality and reliability.What is the company's expected recovery for dip tube repair claims, administrative costs, and legal fees as of December 31, 2002?As of December 31, 2002, the company recorded as a long-term receivable approximately $34.0 million related to dip tube repair claims, administrative costs, legal fees, and related expenses. It is the company's expectation that all or a substantial portion of its costs will be recovered from Perfection, American Meter Company, Manner Plastics Materials, Inc. and their insurers, as well as the company's insurers. - Loss:
CachedMultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "mini_batch_size": 4, "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
Evaluation Dataset
fin_modern_bert-pairs-sec-synthetic-v1
- Dataset: fin_modern_bert-pairs-sec-synthetic-v1
- Size: 15 evaluation samples
- Columns:
queryandpositive - Approximate statistics based on the first 15 samples:
query positive type string string modality text text details - min: 16 tokens
- mean: 28.47 tokens
- max: 39 tokens
- min: 20 tokens
- mean: 66.07 tokens
- max: 156 tokens
- Samples:
query positive What is the company's rationale for the expected decline in stock repurchases during 2013 compared to 2012 and 2011 levels?The company expects to incur significant debt in 2013 related to the planned acquisition of Gambro and, as a result, stock repurchases in 2013 are expected to decline from 2012 and 2011 levels.What is the reporting currency used for the Ares Management Corporation financial statements?Financial Statements (Continued) (Dollars in Thousands, Except Share Data and As Otherwise Noted)What are the specific terms and dates for the Broadridge Financial Solutions, Inc. Senior Notes due in 2026, 2029, and 2031?4.3 Form of Broadridge Financial Solutions, Inc. 3.400% Senior Note due 2026... 4.5 Form of Broadridge Financial Solutions, Inc. 2.900% Senior Note due 2029... 4.8 Form of Broadridge Financial Solutions, Inc. 2.600% Senior Note due 2031 - Loss:
CachedMultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim", "mini_batch_size": 4, "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 16learning_rate: 0.0005warmup_steps: 0.1bf16: Truelogging_nan_inf_filter: Falseper_device_eval_batch_size: 16seed: 777data_seed: 777prompts: {'query': '', 'positive': ''}batch_sampler: no_duplicates
All Hyperparameters
Click to expandper_device_train_batch_size: 16num_train_epochs: 3max_steps: -1learning_rate: 0.0005lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0.1optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Truefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Falseinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 16prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 777data_seed: 777use_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Nonedataloader_multiprocessing_context: Nonedataloader_in_order: Trueremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonelocal_rank: -1prompts: {'query': '', 'positive': ''}batch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None
Training Logs
| Epoch | Step | Validation Loss | finance-eval_cosine_ndcg@10 |
|---|---|---|---|
| -1 | -1 | - | 0.8363 |
| 1.0 | 5 | 0.6339 | 0.9374 |
| 2.0 | 10 | 0.3965 | 0.9591 |
| 3.0 | 15 | 0.2027 | 0.9754 |
| -1 | -1 | - | 0.9754 |
Training Time
- Training: 2.0 seconds
Framework Versions
- Python: 3.13.16
- Sentence Transformers: 5.6.0
- Transformers: 5.22.1
- PyTorch: 2.14.1+cu130
- Accelerate: 1.14.0
- Datasets: 4.8.5
- Tokenizers: 0.23.3
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}
}