Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper
•
1908.10084
•
Published
•
9
This is a sentence-transformers model finetuned from intfloat/multilingual-e5-large-instruct on the d4-embeddings-multiple_negative dataset. 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': 512, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, '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("Lauther/d4-embeddings-v1.0")
# Run inference
sentences = [
'ECOMP-GUARAREMA - BY-PASS',
'What is a flow computer?\nA flow computer is a device used in measurement engineering. It collects analog and digital data from flow meters and other sensors.\n\nKey features of a flow computer:\n- It has a unique name, firmware version, and manufacturer information.\n- It is designed to record and process data such as temperature, pressure, and fluid volume (for gases or oils).',
'What is a Fluid?\nA Fluid is the substance measured within a measurement system. It can be a gas or liquid, such as hydrocarbons, water, or other industrial fluids. Proper classification of fluids is essential for ensuring measurement accuracy, regulatory compliance, and operational efficiency. By identifying fluids correctly, the system applies the appropriate measurement techniques, processing methods, and reporting standards.',
]
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]
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
differential pressure |
What is an Uncertainty Curve Point? |
FQI-4300.44-101 |
What is a Measurement Type? |
FQI-4300-44116 |
What is a Meter Stream? |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
anchor and positive| anchor | positive | |
|---|---|---|
| type | string | string |
| details |
|
|
| anchor | positive |
|---|---|
FQI-4150.6122A1 |
What is an Uncertainty Curve Point? |
FQI-4150.63122C |
What is uncertainty? |
Pressão Absoluta |
What is uncertainty? |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 100per_device_eval_batch_size: 100learning_rate: 2e-05weight_decay: 0.01max_grad_norm: 0.5num_train_epochs: 10lr_scheduler_type: cosinewarmup_ratio: 0.1fp16: Truedataloader_num_workers: 4overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 100per_device_eval_batch_size: 100per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.01adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 0.5num_train_epochs: 10max_steps: -1lr_scheduler_type: cosinelr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_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: Truefp16_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: 4dataloader_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: Nonehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.1351 | 5 | 4.6063 | - |
| 0.2703 | 10 | 4.5611 | - |
| 0.4054 | 15 | 4.5136 | - |
| 0.5405 | 20 | 4.4686 | - |
| 0.6757 | 25 | 4.3974 | - |
| 0.8108 | 30 | 4.3636 | - |
| 0.9459 | 35 | 4.3199 | - |
| 1.0811 | 40 | 4.1099 | - |
| 1.2162 | 45 | 4.32 | - |
| 1.3514 | 50 | 4.2257 | - |
| 1.4865 | 55 | 4.2873 | - |
| 1.6216 | 60 | 4.2686 | - |
| 1.7568 | 65 | 4.2479 | - |
| 1.8919 | 70 | 4.2432 | - |
| 2.0270 | 75 | 4.0026 | - |
| 2.1622 | 80 | 4.187 | - |
| 2.2973 | 85 | 4.2103 | - |
| 2.4324 | 90 | 4.2152 | - |
| 2.5676 | 95 | 4.2713 | - |
| 2.7027 | 100 | 4.2239 | - |
| 2.8378 | 105 | 4.1924 | - |
| 2.9730 | 110 | 4.1704 | - |
| 3.1081 | 115 | 4.0059 | - |
| 3.2432 | 120 | 4.1686 | - |
| 3.3784 | 125 | 4.1632 | - |
| 3.5135 | 130 | 4.2151 | - |
| 3.6486 | 135 | 4.2386 | - |
| 3.7838 | 140 | 4.234 | - |
| 3.9189 | 145 | 4.1404 | - |
| 4.0541 | 150 | 3.9627 | 4.2148 |
| 4.1892 | 155 | 4.1705 | - |
| 4.3243 | 160 | 4.1642 | - |
| 4.4595 | 165 | 4.2132 | - |
| 4.5946 | 170 | 4.2082 | - |
| 4.7297 | 175 | 4.2228 | - |
| 4.8649 | 180 | 4.1663 | - |
| 5.0 | 185 | 3.9486 | - |
| 5.1351 | 190 | 4.1747 | - |
| 5.2703 | 195 | 4.1028 | - |
| 5.4054 | 200 | 4.1586 | - |
| 5.5405 | 205 | 4.1668 | - |
| 5.6757 | 210 | 4.2009 | - |
| 5.8108 | 215 | 4.1822 | - |
| 5.9459 | 220 | 4.1669 | - |
| 6.0811 | 225 | 3.9627 | - |
| 6.2162 | 230 | 4.1673 | - |
| 6.3514 | 235 | 4.1455 | - |
| 6.4865 | 240 | 4.0968 | - |
| 6.6216 | 245 | 4.1569 | - |
| 6.7568 | 250 | 4.1978 | - |
| 6.8919 | 255 | 4.1343 | - |
| 7.0270 | 260 | 3.9438 | - |
| 7.1622 | 265 | 4.1094 | - |
| 7.2973 | 270 | 4.1836 | - |
| 7.4324 | 275 | 4.1104 | - |
| 7.5676 | 280 | 4.138 | - |
| 7.7027 | 285 | 4.1784 | - |
| 7.8378 | 290 | 4.1437 | - |
| 7.9730 | 295 | 4.141 | - |
| 8.1081 | 300 | 3.8248 | 4.3043 |
| 8.2432 | 305 | 4.1369 | - |
| 8.3784 | 310 | 4.128 | - |
| 8.5135 | 315 | 4.1231 | - |
| 8.6486 | 320 | 4.1153 | - |
| 8.7838 | 325 | 4.1667 | - |
| 8.9189 | 330 | 4.1659 | - |
| 9.0541 | 335 | 3.8298 | - |
| 9.1892 | 340 | 4.182 | - |
| 9.3243 | 345 | 4.1639 | - |
| 9.4595 | 350 | 4.1651 | - |
| 9.5946 | 355 | 4.0624 | - |
| 9.7297 | 360 | 4.1012 | - |
| 9.8649 | 365 | 4.0938 | - |
| 10.0 | 370 | 3.857 | - |
@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
intfloat/multilingual-e5-large-instruct