SBERT base trained on BatuhanECB/FinModernBERT-pairs-sec-synthetic-v1
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 semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: sentence-transformers/bert-base-nli-mean-tokens
- Maximum Sequence Length: 128 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("kokitabayashi/sbert_FinModernBERT_query")
# Run inference
queries = [
'What were the primary drivers for the increase in net income for the year ended December 31, 2021?',
]
documents = [
'The increase in net income was primarily due to (i) an increase in our operating profit and (ii) a decrease in other expenses, primarily due to foreign currency gains in the current period as compared to foreign currency losses in the prior-year period, partially offset by (a) an increase in depreciation, amortization and accretion expense, (b) an increase in other operating expense, primarily attributable to acquisition related costs associated with the Telxius Acquisition and the CoreSite Acquisition, and (c) an increase in the income tax provision.',
'In March 2006, AIG borrowed a total of $1.3 billion on an unsecured basis pursuant to loan agreements with third-party banks, of which $700 million remained outstanding on Decem- 70 AIG 2006 Form 10-K American International Group, Inc. and Subsidiaries ber 31, 2006; $500 million was repaid in February 2007, and the balance matures in March 2007.',
'Total modifications $ 1,017 $ 649 $ 2,655 $ 775 $ 5,120 $ 592',
]
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.7576, -0.0695, -0.0497]])
Evaluation
Metrics
Information Retrieval
- Dataset:
finance-eval - Evaluated with
InformationRetrievalEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7557 |
| cosine_accuracy@3 | 0.9043 |
| cosine_accuracy@5 | 0.937 |
| cosine_accuracy@10 | 0.9619 |
| cosine_precision@1 | 0.7557 |
| cosine_precision@3 | 0.3014 |
| cosine_precision@5 | 0.1874 |
| cosine_precision@10 | 0.0962 |
| cosine_recall@1 | 0.7557 |
| cosine_recall@3 | 0.9043 |
| cosine_recall@5 | 0.937 |
| cosine_recall@10 | 0.9619 |
| cosine_ndcg@10 | 0.866 |
| cosine_mrr@10 | 0.8344 |
| cosine_map@100 | 0.8362 |
Training Details
Training Dataset
fin_modern_bert-pairs-sec-synthetic-v1
- Dataset: fin_modern_bert-pairs-sec-synthetic-v1
- Size: 44,709 training samples
- Columns:
queryandpositive - Approximate statistics based on the first 100 samples:
query positive type string string modality text text details - min: 16 tokens
- mean: 27.5 tokens
- max: 44 tokens
- min: 10 tokens
- mean: 60.88 tokens
- max: 128 tokens
- Samples:
query positive What was the total share-based compensation expense included in net income attributable to Biogen Inc. for the year ended December 31, 2015?Share-based compensation expense included in net income attributable to Biogen Inc. $ 140.5 $ 170.2 $ 172.8 (For the Years Ended December 31, 2015 2014 2013)What specific tax implications does the company face regarding its investment portfolio if the portfolio interest exemption on U.S. corporate debt is repealed?The drafts would repeal the portfolio interest exemption on U.S. corporate debt, which could significantly increase tax liabilities on our investment portfolio or cause us to increase investment in non-U.S. corporate debt.What specific organizational changes did the company undertake during fiscal 2013 to support its business initiatives?Specifically, during fiscal 2013 we undertook organizational changes in order to address major business initiatives, including our desire to accelerate our move to the cloud, transform our customers' experience, increase industry focus to meet customer demands, and develop more effective marketing. These reorganizational efforts included changes to the structure and alignment of our product development and marketing teams and re-organization of our sales teams by industry. - Loss:
MultipleNegativesRankingLosswith 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 }
Evaluation Dataset
fin_modern_bert-pairs-sec-synthetic-v1
- Dataset: fin_modern_bert-pairs-sec-synthetic-v1
- Size: 9,580 evaluation samples
- Columns:
queryandpositive - Approximate statistics based on the first 100 samples:
query positive type string string modality text text details - min: 16 tokens
- mean: 27.52 tokens
- max: 45 tokens
- min: 8 tokens
- mean: 63.29 tokens
- max: 128 tokens
- Samples:
query positive What are the potential consequences if the Federal Reserve determines that any of the company's Banks are not 'well-capitalized' or 'well-managed'?If the Federal Reserve finds that any of our Banks is not “well-capitalized” or “well-managed,” we would be required to enter into an agreement with the Federal Reserve to comply with all applicable capital and management requirements, which may contain additional limitations or conditions relating to our activities.What is the concentration of revenue from single customers within the electronic measurement business as of the end of fiscal 2007?As of the end of fiscal 2007, no single customer represented greater than 10 percent of the net revenue of the business.What are the specific requirements for Arch Insurance Europe to maintain its solvency margin in the U.K.?The FSA requires that Arch Insurance Europe maintain a margin of solvency calculation based on the classes of business for which it is authorized and within its premium income projections applied to its worldwide general business. - Loss:
MultipleNegativesRankingLosswith 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
per_device_train_batch_size: 64num_train_epochs: 1warmup_steps: 0.1fp16: Trueper_device_eval_batch_size: 64dataloader_num_workers: 2batch_sampler: no_duplicates
All Hyperparameters
Click to expandper_device_train_batch_size: 64num_train_epochs: 1max_steps: -1learning_rate: 5e-05lr_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: Falsefp16: Truebf16_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: Trueinclude_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: 64prediction_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: 42data_seed: Noneuse_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: 2dataloader_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: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}warmup_ratio: None
Training Logs
| Epoch | Step | Training Loss | Validation Loss | finance-eval_cosine_ndcg@10 |
|---|---|---|---|---|
| -1 | -1 | - | - | 0.2789 |
| 0.1431 | 100 | 0.4771 | 0.1072 | 0.7990 |
| 0.2861 | 200 | 0.1062 | 0.0731 | 0.8299 |
| 0.4292 | 300 | 0.0877 | 0.0570 | 0.8443 |
| 0.5722 | 400 | 0.0674 | 0.0488 | 0.8506 |
| 0.7153 | 500 | 0.0598 | 0.0436 | 0.8599 |
| 0.8584 | 600 | 0.0487 | 0.0404 | 0.8635 |
| 1.0 | 699 | - | 0.0384 | 0.8660 |
| -1 | -1 | - | - | 0.8660 |
Training Time
- Training: 2.0 minutes
Framework Versions
- Python: 3.13.16
- Sentence Transformers: 5.7.0
- Transformers: 5.21.0
- PyTorch: 2.11.0+cu130
- Accelerate: 1.15.0
- Datasets: 4.8.5
- Tokenizers: 0.23.3
Additional Resources
- Training and Finetuning Embedding Models with Sentence Transformers: the end-to-end guide for training or finetuning Sentence Transformer models.
- Introduction to Matryoshka Embedding Models: variable-size embeddings that can be truncated with minimal quality loss.
- Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval: post-training compression of embedding vectors.
- Multimodal Embedding & Reranker Models with Sentence Transformers: use text, image, audio, and video models through the same API.
- Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers: train multimodal embedding models, with a Visual Document Retrieval walkthrough.
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},
}