Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 15
How to use ChenyuEcho/corruption_emaillevel_LoRA_newtrainmethod with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("ChenyuEcho/corruption_emaillevel_LoRA_newtrainmethod")
sentences = [
"Find the detailed cost breakdowns for Raw Materials and Logistics, including supplier invoices, shipping contracts, and related internal correspondence from Q2 and Q3, prepared by Maria Santos for review by end of day Thursday.",
"Subject: Resultados de control de calidad – Lote QT-2024-0893\nDate: 2025-12-19T15:12:00\nFrom: Ana Lucia Vega\nParticipants: Javier Moreno\n\nBody:\nHola Javier,\n\nTe comparto los resultados del control de calidad del lote QT-2024-0893, que revisé conforme a lo indicado por Carlos. Los análisis de laboratorio muestran que el contenido de alcohol es de 40.2%, el pH está en 7.1 y las notas de cata confirman un perfil limpio, equilibrado y sin defectos. Todos los parámetros se encuentran dentro de los rangos normales establecidos. Rick ya autorizó el procesamiento final. Si necesitas detalles adicionales o hay algo específico que deba revisar, por favor avísame.\n\nQuedo atenta a tus comentarios.\n\nSaludos,\nAna Lucia\n\n--\nAna Lucia Vega\nAccounts Payable\nASI Mexico",
"Subject: Chemical Spill Incident – Immediate Actions and Next Steps\nDate: 2026-01-05T16:48:00\nFrom: Diego Ramirez\nParticipants: Roberto Garza\n\nBody:\nHi Roberto,\n\nWanted to give you a heads up about the minor chemical spill that occurred yesterday afternoon near the maintenance storage area. We contained the spill within 30 minutes using absorbent pads and neutralizing agents. All contaminated PPE and materials were isolated per the protocol. Ricardo has already coordinated sampling and begun the required reporting. We're making improvements to the storage procedures and retraining the crew to prevent recurrence.\n\nI know the EHS permit is critical and we're on top of the paperwork so there won't be any impact on operations. Let me know if you want more details or need me to loop you in on the next steps with Rick.\n\nThanks,\nDiego\n\n--\nDiego Ramirez\nMaintenance Supervisor\nDestilería Agave Spirits",
"Subject: Re: Request for Detailed Documentation: Product Cost Analysis\nDate: 2025-11-25T09:20:00\nFrom: Maria Santos\nParticipants: David Chen\n\nBody:\nHi David,\n\nThank you for your feedback and for clarifying the level of detail required regarding the cost variances. I will assemble the detailed breakdowns for 'Raw Materials' and 'Logistics' line items, including the supplier invoices, shipping contracts, and relevant internal correspondence. My team is working to pull these from both our Q2 and Q3 files to ensure we capture all significant changes. I anticipate having the full documentation ready for your review by end of day Thursday, but will let you know immediately if further clarification is needed on specific entries. Please let me know if you have urgent priorities or would like to discuss interim findings.\n\nBest regards,\nMaria"
]
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 = [
"Confirm Massey-Ferguson harvester availability for Block 3A harvest scheduled for June 18.",
]
documents = [
'Subject: Agave Harvest Scheduling and Resource Coordination\nDate: 2026-01-05T10:03:00\nFrom: Javier Moreno\nParticipants: Sofia Hernandez\n\nBody:\nHi Sofia,\n\nI wanted to touch base regarding the upcoming agave harvest scheduling for the El Molino and San Pedro fields. Based on current field conditions and the lab’s recent Brix readings (average 26.5), I propose we start with Block 3A on June 18, aiming for 120 tons over three days. Please ensure the Massey-Ferguson harvester is available, and that the standard sanitation protocol for incoming loads is enforced. As always, maintaining optimal ripeness and minimizing core bruising are essential for product quality. Could you confirm equipment availability and crew scheduling?\n\nThanks for your attention to these details. Let me know if you have any concerns or require adjustments.\n\nBest,\nJavier\n\n--\nJavier Moreno\nQuality Control Manager\nDestilería Agave Spirits',
'Subject: Agave Supplier Delivery Schedule – Harvest Operations Planning\nDate: 2025-08-18T18:12:00\nFrom: Patricia Reeves\nParticipants: Thomas Bradford; Sarah Mitchell\n\nBody:\nDear Team,\n\nI wanted to provide an update regarding our agave sourcing and the delivery schedule for the upcoming harvest season. We have coordinated with our primary suppliers to ensure that initial deliveries will commence the week of July 10th, with subsequent shipments following a bi-weekly cadence. We are closely monitoring crop yields and weather conditions to proactively address any potential delays. Please review the attached delivery timeline and confirm receipt so we can coordinate logistics accordingly. Your timely collaboration will be crucial for maintaining smooth harvest operations and meeting production targets.\n\nBest regards,\nPatricia Reeves\n\n--\nPatricia Reeves\nExecutive Assistant to the CEO\nAgave Spirits International',
'Subject: Celebrating Our Team Excellence Award Recipient—¡Felicidades, Elena!\nDate: 2025-12-11T19:24:00\nFrom: Carlos Delgado\nParticipants: Agave Spirits Mexico Team\n\nBody:\nDear Team,\n\nI am delighted to announce that this quarter’s Team Excellence Award goes to our very own Elena Fuentes. Elena has shown unparalleled dedication in supporting our operations, always ensuring that even the smallest details are handled with cariño. Her ability to coordinate complex schedules and build confianza with our partners reflects the essence of how we do business here: en México, las relaciones importan, and Elena embodies this every day. Her work reminds us that true excellence comes from caring for each other, not just tasks.\n\nPlease join me in congratulating Elena. We will be honoring her achievement with just a small dinner—nada ostentoso, just a way to come together as equipo and celebrate the relationships that drive our success.\n\nUn abrazo fuerte a todos,\nCarlos\n\n--\nCarlos Delgado\nCountry Manager, Mexico Operations\nAgave Spirits International\nTequila, Jalisco',
]
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.6602, 0.2324, 0.0050]], dtype=torch.bfloat16)
val_full_corpusInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.8878 |
| cosine_accuracy@3 | 0.9561 |
| cosine_accuracy@5 | 0.9805 |
| cosine_accuracy@10 | 0.9902 |
| cosine_precision@1 | 0.8878 |
| cosine_precision@3 | 0.3187 |
| cosine_precision@5 | 0.1961 |
| cosine_precision@10 | 0.099 |
| cosine_recall@1 | 0.8878 |
| cosine_recall@3 | 0.9561 |
| cosine_recall@5 | 0.9805 |
| cosine_recall@10 | 0.9902 |
| cosine_ndcg@10 | 0.9419 |
| cosine_mrr@10 | 0.9259 |
| cosine_map@100 | 0.9265 |
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
Find records of quality test results for batch QT-2024-0891 showing alcohol content 39.8%, pH 3.6, and approval by Carlos. |
Subject: Batch QT-2024-0891 Quality Test Results |
What is the decision on replacing the battery for forklift unit 4: replace now or wait? |
Subject: Forklift Fleet Routine Maintenance Completed – Service Report |
Is there documentation of permit delays impacting production, including any contingency plan to shut down if the permit is not obtained? |
Subject: Downtime Analysis – Tequila Distillery Production Update |
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.9334 |
| 2.0 | 102 | 0.9344 |
| 3.0 | 153 | 0.9419 |
@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}
}