Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 15
How to use ChenyuEcho/corruption_emaillevel_DPO with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("ChenyuEcho/corruption_emaillevel_DPO")
sentences = [
"Requests for information on anonymous whistleblower or concern reporting procedures",
"Subject: Re: Employee Morale and Recent Informal Concerns\nDate: 2026-01-20T16:53:00\nFrom: Thomas Tom Bradford\nParticipants: Carmen Ortiz\n\nBody:\nHi Carmen,\n\nThank you for proactively raising these important issues and for sharing the candid feedback from our staff in Tequila. I completely agree that transparent communication is essential, and I appreciate your suggestion to hold an all-hands meeting soon. It’s clear that addressing concerns around perceived favoritism and keeping everyone informed about our decision-making process is crucial for maintaining morale and trust within the team.\n\nLet’s coordinate on scheduling this meeting before the end of the month, and I’d welcome your insights on the agenda and on the draft communication you mentioned. Please go ahead and share your draft with the group. I’ll also connect with Sarah and Patricia so we can align on messaging and logistics.\n\nThanks again for your initiative, and please keep us posted on any further feedback you hear in the meantime.\n\nBest regards,\nTom",
"Subject: Urgent: Additional Documentation Required for Payment Processing\nDate: 2025-12-30T20:00:00\nFrom: James Cooper\nParticipants: Victoria Hayes\n\nBody:\nHi Victoria,\n\nI hope this message finds you well. We are in the process of preparing our claim submission to Chubb, but I've encountered a discrepancy with the beneficiary details for the recent wire transfer. The beneficiary account listed in the payment instructions does not match our internal records. To proceed, we will need additional documentation clarifying the intended recipient and supporting the legitimacy of the transaction. This is essential for both audit and compliance purposes.\n\nPlease let me know if you can provide the necessary documents or if there's a specific contact at Chubb who can assist with further verification. I want to ensure there are no delays in our claim due to incomplete or mismatched payment information.\n\nLooking forward to your prompt response.\n\nBest regards,\nJames Cooper\nTreasury Manager\n\n--\nJames Cooper\nTreasury Manager\nAgave Spirits International",
"Subject: Concern About Recent Events and Reporting Process\nDate: 2025-08-14T13:01:00\nFrom: Arturo Sandoval\nParticipants: Carmen Ortiz\n\nBody:\nHi Carmen,\n\nI hope you don’t mind me reaching out. I wanted to share that lately, I’ve been feeling uncomfortable with what’s happening around the plant. Rick asked me to prepare the water samples last week, and while I was working late, I noticed some unusual visitors in the admin area. I’ve also seen some things that worry me, especially around the dinners with the mayor. People in town talk about the mayor’s relationship with certain groups, and there are rumors about his connections. I’m worried about the company’s reputation if any of this is true. Can you let me know how I could report concerns anonymously? I want to do the right thing but I’m not sure how to proceed.\n\nThank you for your guidance.\n\nBest,\nArturo\n\n--\nArturo Sandoval\nEnvironmental Technician\nDestilería Agave Spirits",
"Subject: Coordinated Project Status Update and Next Steps\nDate: 2025-11-21T15:20:00\nFrom: Patricia Reeves\nParticipants: Sarah Mitchell; Luis Fernando Chavez; Hector Vargas\n\nBody:\nHello Team,\n\nI wanted to share an update on the ongoing Agave Expansion Project and highlight the need for closer coordination among our departments. We have made good progress on permitting and environmental assessments, but upcoming deadlines require tighter collaboration between Legal, Urban Development, and Environmental teams. Please review the attached timeline and confirm your department’s primary contact for weekly sync meetings. This coordination will ensure we address any regulatory, compliance, and technical issues in a timely manner.\n\nLet’s work together to keep momentum and avoid bottlenecks. If you have any concerns or require additional support, don’t hesitate to reach out.\n\nBest regards,\nPatricia Reeves\nExecutive Assistant to CEO\n\n--\nPatricia Reeves\nExecutive Assistant to the CEO\nAgave Spirits International"
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [5, 5]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 = [
"Which employees discussed circumventing compliance protocols to secure government approvals?",
]
documents = [
'Subject: PRIVILEGED AND CONFIDENTIAL - ATTORNEY-CLIENT COMMUNICATION - Mexico Operations Concern\nDate: 2025-09-17T08:05:00\nFrom: Jennifer Walsh\nParticipants: Sarah Mitchell\n\nBody:\nHi Sarah,\n\nFor the record, I am forwarding a summary of a serious anonymous complaint received via our ethics hotline regarding our Mexico operations. The report alleges that the EHS Manager (Ricardo Mendez) hosted multiple dinners with a local government official, provided gifts, and facilitated payments through fake invoices. There are further red flags: the Country Manager (Carlos Delgado) is alleged to have been aware, and there are mentions of organized crime involvement. These allegations, if substantiated, raise significant FCPA exposure.\n\nI strongly recommend we immediately engage outside counsel with FCPA expertise to lead an independent investigation. We must document everything, preserve all potentially relevant documents and communications, and strictly limit knowledge of this matter to essential personnel only. Please confirm next steps and advise on initial outreach to external counsel. Are there any additional protocols you want implemented at this stage?\n\nBest regards,\nJennifer\n\n--\nJennifer Walsh\nVice President, Global Compliance & Ethics\nAgave Spirits International\nCONFIDENTIAL - Attorney Work Product',
"Subject: Re: Request for Special Pricing Exception – Key Distributor Opportunity (Q4 Impact)\nDate: 2025-09-15T16:23:00\nFrom: Thomas Bradford\nParticipants: Kevin O'Brien\n\nBody:\nHi Kevin,\n\nThank you for flagging this opportunity and providing context regarding the potential impact on our Q4 numbers. I agree that winning this distributor could be a game-changer, but we need to ensure any pricing exception aligns with our compliance framework and avoids unintended precedents. Sarah, could you please review the specifics from a legal/compliance standpoint and advise on any restrictions or additional documentation required? Assuming there are no major obstacles, I'm supportive of proceeding with a tailored discount to secure the account.\n\nLet’s coordinate a quick call Monday to finalize.\n\nBest,\nTom",
'Subject: Re: Urgent: Water Permit Renewal Delay Threatening Production Levels\nDate: 2025-08-25T15:02:00\nFrom: Carlos Delgado\nParticipants: Roberto Garza\n\nBody:\nHola Roberto,\n\nThank you for raising your concerns. I completely understand the pressure this delay puts on the plant, but I want to reassure you that Rick has the situation well in hand. We’ve been investing a lot in our relationship with the local authorities—In Mexico, relationships matter, ya sabes. The mayor has been very receptive to our efforts, and we’ve had several productive meetings (and just a small dinner or two) with municipal leadership. This is how business is done here; these things take relationship building, and I’m confident we’ll have good news soon. Por favor, don’t worry—déjalo en nuestras manos. I’ll keep you posted as soon as I hear anything definitive.\n\nUn abrazo,\nCarlos',
]
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.3281, -0.1060, 0.0874]], dtype=torch.bfloat16)
val_full_corpusInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.2708 |
| cosine_accuracy@3 | 0.5046 |
| cosine_accuracy@5 | 0.5815 |
| cosine_accuracy@10 | 0.6769 |
| cosine_precision@1 | 0.2708 |
| cosine_precision@3 | 0.1682 |
| cosine_precision@5 | 0.1163 |
| cosine_precision@10 | 0.0677 |
| cosine_recall@1 | 0.2708 |
| cosine_recall@3 | 0.5046 |
| cosine_recall@5 | 0.5815 |
| cosine_recall@10 | 0.6769 |
| cosine_ndcg@10 | 0.4684 |
| cosine_mrr@10 | 0.4022 |
| cosine_map@100 | 0.4139 |
sentence_0, sentence_1, sentence_2, sentence_3, and sentence_4| sentence_0 | sentence_1 | sentence_2 | sentence_3 | sentence_4 | |
|---|---|---|---|---|---|
| type | string | string | string | string | string |
| details |
|
|
|
|
|
| sentence_0 | sentence_1 | sentence_2 | sentence_3 | sentence_4 |
|---|---|---|---|---|
Internal communications regarding upcoming tequila industry regulations |
Subject: Upcoming Regulatory Comment Period: Tequila Industry Associations |
Subject: Request for Approval: Maintenance Budget Variance – Q2 |
Subject: Request for Travel Budget Exception: Supplier Audit in Guadalajara |
Subject: Campaña en redes sociales: control del mensaje y estrategia proactiva |
How did managers justify onboarding shell or lightly documented consulting firms? |
Subject: Re: New Vendor Setup - Consultoria Verde de Jalisco (Urgent) |
Subject: PRIVILEGED AND CONFIDENTIAL - ATTORNEY-CLIENT COMMUNICATION - Mexico Operations Concern |
Subject: Campaña en redes sociales: control del mensaje y estrategia proactiva |
Subject: Upcoming Regulatory Comment Period: Tequila Industry Associations |
What internal controls are in place for reviewing beneficiary account changes before processing payments? |
Subject: Re: Urgent: Discrepancy in Beneficiary Account Information for Broker Payment |
Subject: Trade Association Political Activity Disclosure and Government Engagement Compliance |
Subject: RE: Request for Departmental Budget Inputs – FY2025 Planning |
Subject: Revisión de posicionamiento de marca y objetivos de Q4 |
main.DPOLossper_device_train_batch_size: 6per_device_eval_batch_size: 6multi_dataset_batch_sampler: round_robindo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 6per_device_eval_batch_size: 6gradient_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 | 258 | 0.4684 |
@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",
}