Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 17
How to use Kouskousi/gte-large-en-v1.5_SEC_docs_ft_with_5_epochs with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Kouskousi/gte-large-en-v1.5_SEC_docs_ft_with_5_epochs", trust_remote_code=True)
sentences = [
"What was the percentage change in net investment income from 2021 to 2022?",
"Index\nAmeriprise Financial, Inc.\nConsolidated Results of Operations\nYear Ended December 31, 2022 Compared to Year Ended December 31, 2021\nThe following table presents our consolidated results of operations:\n \nYears Ended December 31,\nChange\n2022\n2021\n(in millions)\nRevenues\nManagement and financial advice fees\n$\n9,033 \n$\n9,275 \n$\n(242)\n(3)\n%\nDistribution fees\n1,939 \n1,828 \n111 \n6 \nNet investment income\n1,474 \n1,683 \n(209)\n(12)\nPremiums, policy and contract charges\n1,397 \n221 \n1,176 \nNM\nOther revenues\n491 \n382 \n109 \n29 \nTotal revenues\n14,334 \n13,389 \n945 \n7 \nBanking and deposit interest expense\n76 \n12 \n64 \nNM\nTotal net revenues\n14,258 \n13,377 \n881 \n7 \nExpenses\n \n \n \n \nDistribution expenses\n4,935 \n5,028 \n(93)\n(2)\nInterest credited to fixed accounts\n665 \n600 \n65 \n11 \nBenefits, claims, losses and settlement expenses\n242 \n(156)\n398 \nNM\nRemeasurement (gains) losses of future policy benefit reserves\n1 \n(52)\n53 \nNM\nChange in fair value of market risk benefits\n311 \n(113)\n424 \nNM\nAmortization of deferred acquisition costs\n252 \n259 \n(7)\n(3)\nInterest and debt expense\n198 \n191 \n7 \n4 \nGeneral and administrative expense\n3,723 \n3,435 \n288 \n8 \nTotal expenses\n10,327 \n9,192 \n1,135 \n12 \nPretax income\n3,931 \n4,185 \n(254)\n(6)\nIncome tax provision\n782 \n768 \n14 \n2 \nNet income\n$\n3,149 \n$\n3,417 \n$\n(268)\n(8)\n%\nNM Not Meaningful - variance equal to or greater than 100%.\nOverall\nPretax income decreased $254 million, or 6%, for 2022 compared to the prior year. The following impacts were significant drivers of the year-over-year change in pretax\nincome:\n•\nThe prior year impact of the block transfer reinsurance transaction resulted in $524 million of pretax income for 2021 primarily reflecting the net realized gains on\ninvestments sold to the reinsurer.\n•\nA negative impact from lower average equity markets compared to the prior year. Our average WEI, which is a proxy for equity movements on AUM, decreased\n7% in 2022 compared to the prior year. The average S&P 500 index was 4% lower for 2022 compared to the prior year.\n•\nThe favorable impact of unlocking was $133 million for 2022 compared to an unfavorable impact of $113 million for the prior year.\n•\nA favorable impact from the increase in short-term interest rates compared to the prior year.\n•\nThe market impact on non-traditional long-duration products (including variable and fixed deferred annuity contracts and UL insurance contracts), net of hedges\nand the reinsurance accrual was a benefit of $483 million for 2022 compared to a benefit of $464 million for the prior year.\n50",
"Intersegment revenues for this segment reflect fees paid by our Asset Management segment for marketing support and other services provided in\nconnection with the availability of VIT Funds. Intersegment expenses for this segment include distribution expenses for services provided by our Advice & Wealth\nManagement segment, as well as expenses for investment management services provided by our Asset Management segment. All intersegment activity is eliminated\nin our consolidated results.\nProtection\nWe provide life and disability income insurance products to address the protection and risk management needs of our retail clients. New \nRiverSource\n insurance\nproducts are exclusively offered through our advisor network. Our advisors also offer insurance products of unaffiliated carriers. The primary sources of revenues for\nour protection business are premiums, fees and charges we receive to assume insurance-related risk. We earn net investment income on owned assets supporting\ninsurance reserves and on capital supporting the business. We also receive fees based on the level of the RiverSource Life companies’ separate account assets\nsupporting variable universal life investment options. The protection products earn intersegment revenues from fees paid by our Asset Management segment for\nmarketing support and other services provided in connection with the availability of VIT Funds under the variable universal life contracts. Intersegment expenses for\nthe protection products include distribution expenses for services provided by our Advice & Wealth Management segment, as well as expenses for investment\nmanagement services provided by our Asset Management segment. All intersegment activity is eliminated in our consolidated results.\n®\n6",
"Index\nAmeriprise Financial, Inc.\nSlide 5 - Regulatory Oversight Chart.jpg\nAdvice & Wealth Management Regulation\nCertain of our subsidiaries are registered with the SEC as broker-dealers under the Securities Exchange Act of 1934 (“Exchange Act”) and with certain states, the\nDistrict of Columbia and other U.S. territories. Our broker-dealer subsidiaries are also members of self-regulatory organizations, including Financial Industry\nRegulatory Authority (“FINRA”), and are subject to the regulations of these organizations. The SEC and FINRA have stringent rules with respect to the net capital\nrequirements (which includes rules around customer protection) and the marketing and trading activities of broker-dealers. Our broker-dealer subsidiaries, as well as\nour financial advisors and other personnel, must obtain all required state and FINRA licenses and registrations to engage in the securities business and take certain\nsteps to maintain such registrations in good standing. SEC regulations also impose notice requirements and capital\n11"
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from Alibaba-NLP/gte-large-en-v1.5. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NewModel
(1): Pooling({'word_embedding_dimension': 1024, '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})
)
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 = [
"What critical accounting estimate is highlighted regarding the valuation of investments in Ameriprise Financial, Inc.'s financial statements?",
'Index\nAmeriprise Financial, Inc.\nThe following table reconciles net income to adjusted operating earnings and the five-point average of quarter-end equity to adjusted operating equity:\n \nYears Ended December 31,\n2023\n2022\n(in millions)\nNet income\n$\n2,556 \n$\n3,149 \nLess: Adjustments \n(555)\n264 \nAdjusted operating earnings\n$\n3,111 \n$\n2,885 \nTotal Ameriprise Financial, Inc. shareholders’ equity\n$\n4,116 \n$\n4,170 \nLess: AOCI, net of tax\n(2,297)\n(1,769)\nTotal Ameriprise Financial, Inc. shareholders’ equity, excluding AOCI\n6,413 \n5,939 \nLess: Equity impacts attributable to CIEs\n(4)\n— \nAdjusted operating equity\n$\n6,417 \n$\n5,939 \nReturn on equity, excluding AOCI\n39.9 \n%\n53.0 \n%\nAdjusted operating return on equity, excluding AOCI\n48.5 \n%\n48.6 \n%\nAdjustments reflect the sum of after-tax net realized investment gains/losses, net of the reinsurance accrual; the market impact on non-traditional long-duration products (including\nvariable and fixed deferred annuity contracts and UL insurance contracts), net of hedges and the reinsurance accrual; mean reversion related impacts; block transfer reinsurance\ntransaction impacts; the market impact of hedges to offset interest rate and currency changes on unrealized gains or losses for certain investments; gain or loss on disposal of a\nbusiness that is not considered discontinued operations; integration and restructuring charges; income (loss) from discontinued operations; and net income (loss) from consolidated\ninvestment entities. After-tax is calculated using the statutory tax rate of 21%.\nAdjusted operating return on equity, excluding AOCI is calculated using adjusted operating earnings in the numerator and Ameriprise Financial shareholders’ equity, excluding AOCI\nand the impact of consolidating investment entities using a five-point average of quarter-end equity in the denominator. After-tax is calculated using the statutory rate of 21%.\nThe following table reconciles GAAP total equity to Available Capital for Capital Adequacy:\nDecember 31, 2023\nDecember 31, 2022\n(in millions)\nAmeriprise Financial, Inc. GAAP total equity\n$\n4,729 \n$\n3,803 \nLess: AOCI\n(1,766)\n(2,546)\nAmeriprise Financial, Inc. GAAP total equity, excluding AOCI\n6,495 \n6,349 \nLess: RiverSource Life Insurance Company GAAP equity, excluding AOCI\n1,851 \n2,057 \nAdd: RiverSource Life Insurance Company statutory total adjusted capital\n3,093 \n3,103 \nLess: Goodwill and intangibles\n2,622 \n2,485 \nAdd: Other adjustments\n303 \n299 \n Available Capital for Capital Adequacy\n$\n5,418 \n$\n5,209 \nCritical Accounting Estimates\nThe accounting and reporting policies that we use affect our Consolidated Financial Statements. Certain of our accounting and reporting policies are critical to an\nunderstanding of our consolidated results of operations and financial condition and, in some cases, the application of these policies can be significantly affected by\nthe estimates, judgments and assumptions made by management during the preparation of our Consolidated Financial Statements. The accounting and reporting\npolicies and estimates we have identified as fundamental to a full understanding of our consolidated results of operations and financial condition are described\nbelow. See Note 2 to our Consolidated Financial Statements for further information about our accounting policies.\nValuation of Investments\nThe most significant component of our investments is our Available-for-Sale securities, which we carry at fair value within our Consolidated Balance Sheets. See\nNote 16 to our Consolidated Financial Statements for discussion of the fair value of our Available-for-Sale securities. Financial markets are subject to significant\nmovements in valuation and liquidity, which can impact our ability to liquidate and the selling price that can be realized for our securities and increases the use of\njudgment in determining the estimated fair value of certain investments. We are unable to predict impacts and determine sensitivities in reported amounts reflecting\nsuch market movements on our aggregate Available-for-Sale portfolio. Changes to these assumptions do not occur in isolation and it is impracticable to predict such\nimpacts at the individual security unit of measure which are predominately Level 2 fair value and based on observable inputs.\n(1)\n (2)\n(1) \n(2) \n34',
'Additionally, users can sign up to receive automatic\nnotifications when new materials are posted. The information found on the website is not incorporated by reference into this report or in any other report or\ndocument we furnish or file with the SEC.\nItem 1A. \nRisk Factors\nOur operations and financial results are subject to various risks and uncertainties, including those described below, that could have a material adverse effect on our\nbusiness, financial condition or results of operations and could cause the trading price of our common stock to decline. We believe that the following information\nidentifies the material factors affecting our company based on the information we currently know. However, the risks and uncertainties our company faces are not\nlimited to those described below. Additional risks and uncertainties not presently known to us or that we currently believe to be immaterial may also adversely affect\nour business.\nMarket Risks\nOur results of operations and financial condition may be adversely affected by market fluctuations and by economic, political and other factors.\nOur results of operations and financial condition may be materially affected by market fluctuations and by economic and other factors. Such factors, which can be\nglobal, regional, national or local in nature, include: (i) the level and volatility of the markets, including equity prices, interest rates, commodity prices, currency values\nand other market indices and drivers; \n(ii) geopolitical strain, terrorism and armed conflicts, (iii) political dynamics or elections and social, economic and market\nconditions; (iv) the availability and cost of capital; (v) global health emergencies (such as the coronavirus disease 2019 (“COVID-19”) pandemic); (vi) technological\nchanges and\n16',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
InformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.6062 |
| cosine_accuracy@3 | 0.8508 |
| cosine_accuracy@5 | 0.9226 |
| cosine_accuracy@10 | 0.9712 |
| cosine_precision@1 | 0.6062 |
| cosine_precision@3 | 0.2836 |
| cosine_precision@5 | 0.1845 |
| cosine_precision@10 | 0.0971 |
| cosine_recall@1 | 0.6062 |
| cosine_recall@3 | 0.8508 |
| cosine_recall@5 | 0.9226 |
| cosine_recall@10 | 0.9712 |
| cosine_ndcg@10 | 0.7958 |
| cosine_mrr@10 | 0.7386 |
| cosine_map@100 | 0.7403 |
| dot_accuracy@1 | 0.6062 |
| dot_accuracy@3 | 0.8503 |
| dot_accuracy@5 | 0.9226 |
| dot_accuracy@10 | 0.9712 |
| dot_precision@1 | 0.6062 |
| dot_precision@3 | 0.2834 |
| dot_precision@5 | 0.1845 |
| dot_precision@10 | 0.0971 |
| dot_recall@1 | 0.6062 |
| dot_recall@3 | 0.8503 |
| dot_recall@5 | 0.9226 |
| dot_recall@10 | 0.9712 |
| dot_ndcg@10 | 0.7953 |
| dot_mrr@10 | 0.7379 |
| dot_map@100 | 0.7396 |
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
What is the fiscal year end date for Ameriprise Financial, Inc. as stated in the document? |
UNITED STATES |
What is the Commission File Number for Ameriprise Financial, Inc.? |
UNITED STATES |
What is the trading symbol for Ameriprise Financial, Inc. on the New York Stock Exchange? |
UNITED STATES |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 10per_device_eval_batch_size: 10num_train_epochs: 5multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 10per_device_eval_batch_size: 10per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 5max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Falsehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseeval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters: auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Nonedispatch_batches: Nonesplit_batches: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falsebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | cosine_map@100 |
|---|---|---|
| 0.0532 | 50 | 0.7017 |
| 0.1064 | 100 | 0.7136 |
| 0.1596 | 150 | 0.7155 |
| 0.2128 | 200 | 0.7228 |
| 0.2660 | 250 | 0.7403 |
@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",
}
@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}
}
Base model
Alibaba-NLP/gte-large-en-v1.5