Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 15
How to use ChenyuEcho/corruption_emaillevel_newtrainmethod with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("ChenyuEcho/corruption_emaillevel_newtrainmethod")
sentences = [
"Search for evidence of regulators requesting clarification on barrel aging logs for NOM-006-SCFI-2012 certification for batches 3124-A and 3125-B.",
"Subject: Exciting News: New Distribution Agreement Expands Our North American Reach\nDate: 2025-08-06T16:41:00\nFrom: Thomas Tom Bradford\nParticipants: Sarah Mitchell; Kevin O'Brien; Patricia Reeves\n\nBody:\nDear Executive Team,\n\nI am pleased to announce that Agave Spirits International has finalized a new distribution agreement with Pacific Spirits Group, targeting the U.S. West Coast and Canadian markets. This partnership is expected to increase our premium product presence by at least 35% over the next fiscal year, with flagship brands such as Tequila Oro and Sierra Azul leading the portfolio. This strategic move positions us for accelerated growth and strengthens our competitive advantage in crucial markets.\n\nI will share further details during our leadership call next week. In the meantime, please begin preparing your teams to support the anticipated rollout in Q3. Your collaboration is vital to ensuring a successful launch.\n\nThank you for your continued commitment and leadership.\n\nBest regards,\nTom",
"Subject: Re: Inventory Discrepancy at Tequila Distillery – Proposal to Resolve\nDate: 2025-11-21T10:30:00\nFrom: Roberto Garza\nParticipants: Carlos Delgado\n\nBody:\nHola Carlos,\n\nThank you for flagging this and for approaching it thoughtfully. I completely agree that a recount with Pedro’s team is the right step—showing transparency is key. Mañana at 10am works for me. Before we meet, could you or Pedro please pull the detailed transfer logs from the last quarter? Having those on hand will help clarify if this is a timing or recording issue. As you said, it’s likely just a minor oversight, but it's best we review all angles.\n\nLooking forward to resolving this together with cafecito—appreciate the care you both put into these matters.\n\nSaludos,\nRoberto",
"Subject: Quality Certification Requirements for Recent Batches – Clarification Needed\nDate: 2025-12-01T06:07:00\nFrom: Carlos Delgado\nParticipants: Roberto Garza\n\nBody:\nHola Roberto,\n\nHope you're having a good afternoon. I wanted to touch base regarding the NOM-006-SCFI-2012 certification process for our most recent lots (especially Batch 3124-A and 3125-B). While the initial chromatographic analyses were within threshold, there were minor variances in the ester content and methanol limits. Nothing fuera de lo común, pero los reguladores have requested clarification on our barrel aging logs for these particular batches. You know, in Mexico, relationships matter, and sometimes a simple phone call or una pequeña cena can resolve these technicalities. This is how business is done here, and I’m confident our local practices meet the spirit and letter of the regulations.\n\nLet’s ensure the technical team keeps detailed test result documentation (including los controles de temperatura y humedad en la bodega). If you need my support defending our methodology, I’m happy to take the lead—nuestro equipo es lo más importante. Please advise if you need me to coordinate with external auditors or if a site visit would be beneficial.\n\nUn abrazo,\nCarlos\n\n--\nCarlos Delgado\nCountry Manager, Mexico Operations\nAgave Spirits International\nTequila, Jalisco"
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from Qwen/Qwen3-Embedding-0.6B. 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': 32768, 'do_lower_case': False, 'architecture': 'Qwen3Model'})
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, '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': True, 'include_prompt': True})
(2): Normalize()
)
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 = [
"Impresiones Jalisco anti-corruption questionnaire completed and signed",
]
documents = [
'Subject: Submission of Completed Due Diligence Package: Impresiones Jalisco Vendor Onboarding\nDate: 2025-08-16T12:30:00\nFrom: Miguel Torres\nParticipants: Jennifer Walsh\n\nBody:\nHi Jennifer,\n\nI’m pleased to submit the completed third-party due diligence package for Impresiones Jalisco, our prospective label printer vendor. We’ve finalized all items on the vendor onboarding checklist, including a thorough background check (result: clean), full beneficial ownership verification (all documentation attached), verified business references, as well as a completed and signed anti-corruption questionnaire. Additionally, their valid tax registration (RFC) is on file.\n\nImpresiones Jalisco was selected through our competitive bidding process, with three bidders considered and evaluated for pricing, quality, and reliability. I believe this robust process supports our selection. Please find the full package attached for your compliance review. Once you approve, I’ll proceed with finalizing the contract so we can move forward with our labeling project timeline.\n\nLet me know if you need anything further or require additional documentation.\n\nThanks,\nMiguel\n\n--\nMiguel Torres\nProcurement Manager\nASI Mexico',
"Subject: Quality Test Results for Lot MX-2024-156\nDate: 2025-09-11T17:36:00\nFrom: Ana Lucia Vega\nParticipants: Javier Moreno\n\nBody:\nHi Javier,\n\nI'm sending over the routine quality test results for lot MX-2024-156 as requested. The alcohol content measured at 38.5%, which is within our standard parameters. pH levels were recorded at 4.1, also within acceptable range. Taste panel notes mentioned the flavor profile was clean, with no off-notes or irregularities. Carlos approved the data and Rick said to process it as normal.\n\nLet me know if you need anything else or have questions.\n\nBest,\nAna Lucia\n\n--\nAna Lucia Vega\nAccounts Payable\nASI Mexico",
"Subject: Fwd: Request for Supporting Documentation – Journal Entry Approval Required\nDate: 2025-11-17T09:45:00\nFrom: David Chen\nParticipants: Maria Santos\n\nBody:\nHi Maria,\n\nI've reviewed the recent journal entries submitted for month-end and noticed that several expense items lack detailed descriptions and corresponding documentation. From a financial perspective, I need to stress the importance of transparency and traceability. The data shows that ambiguous expense lines can lead to compliance risks during audit. Please provide receipts or explanatory memos for all entries over $5,000. Once the supporting docs are received, I will proceed with approval.\n\nThanks,\nDavid\n\n--\nDavid Chen\nChief Financial Officer\nAgave Spirits International",
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 1024] [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.4883, 0.1104, 0.0481]], dtype=torch.bfloat16)
val_full_corpusInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.9029 |
| cosine_accuracy@3 | 0.9854 |
| cosine_accuracy@5 | 0.9903 |
| cosine_accuracy@10 | 0.9951 |
| cosine_precision@1 | 0.9029 |
| cosine_precision@3 | 0.3285 |
| cosine_precision@5 | 0.1981 |
| cosine_precision@10 | 0.0995 |
| cosine_recall@1 | 0.9029 |
| cosine_recall@3 | 0.9854 |
| cosine_recall@5 | 0.9903 |
| cosine_recall@10 | 0.9951 |
| cosine_ndcg@10 | 0.9547 |
| cosine_mrr@10 | 0.941 |
| cosine_map@100 | 0.9411 |
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
Search for impairment assessment documents for Tequila production assets as of May 31, 2024 (Ref: IMP-240531-2) and any reconciliations to the Q2 Finance Statement dated June 3, 2024 showing a MXN 1.2M discrepancy in carrying value, including supporting calculations and any post-finalization adjustments. |
Subject: Impairment Assessment: Noted Discrepancies in Asset Valuation |
Identify Q2 expense journal entries flagged as unclear, particularly those categorized as 'miscellaneous services' or 'external consulting', and locate the associated receipts and service contracts. |
Subject: Re: Approval Required: Journal Entry Review and Documentation |
Identify records confirming pre-clearance and FARA registration for ASI's government liaison activities in Mexico and the United States. |
Subject: Análisis sobre el registro FARA y obligaciones de cumplimiento en actividades gubernamentales México-EE.UU. |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim",
"gather_across_devices": false
}
per_device_train_batch_size: 16per_device_eval_batch_size: 16multi_dataset_batch_sampler: round_robindo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16gradient_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: 3max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: Nonewarmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Trueenable_jit_checkpoint: Falsesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseuse_cpu: Falseseed: 42data_seed: Nonebf16: Falsefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: -1ddp_backend: Nonedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonedisable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Nonegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Truepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_for_metrics: []eval_do_concat_batches: Trueauto_find_batch_size: Falsefull_determinism: Falseddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueuse_cache: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | val_full_corpus_cosine_ndcg@10 |
|---|---|---|
| 1.0 | 51 | 0.9547 |
@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}
}