Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 12
This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2 on the json dataset. It maps sentences & paragraphs to a 384-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': 256, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 384, '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("GbrlOl/finetune-embedding-all-MiniLM-L6-v2-geotechnical-test-v3")
# Run inference
sentences = [
'¿Cuál es la población total de la comuna de Catemu según el Censo 2017?',
'Plan de Cierre PAG Planta Catemu \nCompañía Explotadora de Minas (CEMIN) \n \n \n Rev. 0 | 20-04-18 25 | 158 \n3.5 Medio humano \n \nLa localidad más próxima a a la planta corresponde a la localidad del mismo nombre. Catemu , comuna \nperteneciente a la provincia de San Felipe de Aconcagua, de la Región de Valparaíso . La planta se encuentra \nubicada a 85 km al norte de Santiago y 95 km del puerto de Valparaíso. \n \nSegún información del Instituto Nacional de Estadísticas (I NE) para el Ce nso 2017, la población total de la \ncomuna Catemu es de 13.998 habitantes, correspondiendo a los totales de 6.982 hombres y 7.016 mujeres. \nEl número total de viviendas es 5.171 y densidad de población de 38,8 (Hab/km 2). \n \nLa actividad económica que predomina en la comuna de Catemu corresponde al sector de A gricultura, caza, \nganadería y silvicultura (correspondiendo a un total del 32,7%). Respecto a l a actividad minera , esta \nrepresenta solo el 2,8% de la mano de obra comunal. \n \nEl ingreso autónomo promedio del hogar es, en el caso de la comuna de Catemu, inferior al promedio \nregional ($618.371 para la región de Valparaíso), alcanzando los $415.146. Los niveles de pobreza son, según \nla encuesta CASEN del año 2009, son relativamente bajos, para la comuna de Catemu es de 8,17%, inferior al \npromedio regional (15,04%). Los niveles de desocupación se encuentran bajo el promedio regional (12% en \nla Región de Valparaíso) llegando a 9,5%.',
'[7]. VST Ingenieros Ltda. (2006). Informe Analisis de Estabilidad. \nDocumento N° 1005-IB-GE-IT-03, Preparado para Minera Las Cenizas \nS.A., Proyecto Ingeniería Básica Depó sito en Pasta, Planta Cabildo, \nSantiago. \n[8]. SYS Ingenieros Consultores Ltda. (2008). Estudio de Peligro Sísmico, \nEspectros de Respuesta y Generación de Registros Artificiales, para el \nDepósito en Pasta, Planta Cabildo, V Región. Documento N° SS-08011-\n01e, Preparado para Minera Las Cenizas S.A., Proyecto Ingeniería Básica \nDepósito en Pasta, Planta Cabildo, Santiago.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
sts_devEmbeddingSimilarityEvaluator| Metric | Value |
|---|---|
| pearson_cosine | 0.5832 |
| spearman_cosine | 0.5906 |
| pearson_euclidean | 0.5757 |
| spearman_euclidean | 0.5906 |
| pearson_manhattan | 0.5771 |
| spearman_manhattan | 0.5929 |
| pearson_dot | 0.5832 |
| spearman_dot | 0.5906 |
| pearson_max | 0.5832 |
| spearman_max | 0.5929 |
quora_duplicates_devBinaryClassificationEvaluator| Metric | Value |
|---|---|
| cosine_accuracy | 0.7702 |
| cosine_accuracy_threshold | 0.5348 |
| cosine_f1 | 0.7889 |
| cosine_f1_threshold | 0.4667 |
| cosine_precision | 0.7224 |
| cosine_recall | 0.8689 |
| cosine_ap | 0.8889 |
| euclidean_accuracy | 0.5554 |
| euclidean_accuracy_threshold | -0.536 |
| euclidean_f1 | 0.7142 |
| euclidean_f1_threshold | -0.536 |
| euclidean_precision | 0.556 |
| euclidean_recall | 0.9982 |
| euclidean_ap | 0.3835 |
| manhattan_accuracy | 0.5554 |
| manhattan_accuracy_threshold | -8.378 |
| manhattan_f1 | 0.7142 |
| manhattan_f1_threshold | -8.378 |
| manhattan_precision | 0.556 |
| manhattan_recall | 0.9982 |
| manhattan_ap | 0.3836 |
| dot_accuracy | 0.7702 |
| dot_accuracy_threshold | 0.5348 |
| dot_f1 | 0.7889 |
| dot_f1_threshold | 0.4667 |
| dot_precision | 0.7224 |
| dot_recall | 0.8689 |
| dot_ap | 0.8889 |
| max_accuracy | 0.7702 |
| max_accuracy_threshold | 0.5348 |
| max_f1 | 0.7889 |
| max_f1_threshold | 0.4667 |
| max_precision | 0.7224 |
| max_recall | 0.9982 |
| max_ap | 0.8889 |
query, sentence, and label| query | sentence | label | |
|---|---|---|---|
| type | string | string | int |
| details |
|
|
|
| query | sentence | label |
|---|---|---|
¿Cuál es la aceleración máxima obtenida para el sismo máximo probable según las fórmulas de atenuación de Ruiz y Saragoni (2005)? |
Las aceleraciones máximas obtenidas para cada uno de los sismos de diseño considerados, se |
1 |
¿Qué tipo de información estratégica no se identifica como de utilidad pública para la faena minera El Toqui? |
PLAN DE CIERRE TEMPORAL – FAENA MINERA EL TOQUI |
1 |
¿Qué condiciones se deben verificar al momento del cierre del tranque de relaves según el compromiso RES 1219-2013? |
6 |
1 |
CoSENTLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "pairwise_cos_sim"
}
per_device_train_batch_size: 16per_device_eval_batch_size: 16learning_rate: 2e-05num_train_epochs: 100warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_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.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 100max_steps: -1lr_scheduler_type: linearlr_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: 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: 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: no_duplicatesmulti_dataset_batch_sampler: proportional| Epoch | Step | Training Loss | sts_dev_spearman_max | quora_duplicates_dev_max_ap |
|---|---|---|---|---|
| 0 | 0 | - | 0.5929 | 0.8889 |
| 0.7937 | 100 | 5.4081 | - | - |
| 1.5794 | 200 | 4.5952 | - | - |
| 2.3651 | 300 | 3.8915 | - | - |
| 3.1508 | 400 | 3.397 | - | - |
| 3.9444 | 500 | 3.0268 | - | - |
| 4.7302 | 600 | 2.4922 | - | - |
| 5.5159 | 700 | 2.0998 | - | - |
| 6.3016 | 800 | 1.7355 | - | - |
| 7.0873 | 900 | 1.4673 | - | - |
| 7.8810 | 1000 | 1.3359 | - | - |
| 8.6667 | 1100 | 0.8865 | - | - |
| 9.4524 | 1200 | 0.9228 | - | - |
| 10.2381 | 1300 | 0.5653 | - | - |
| 11.0238 | 1400 | 0.6117 | - | - |
| 11.8175 | 1500 | 0.4088 | - | - |
| 12.6032 | 1600 | 0.4279 | - | - |
| 13.3889 | 1700 | 0.4085 | - | - |
| 14.1746 | 1800 | 0.2934 | - | - |
| 14.9683 | 1900 | 0.288 | - | - |
| 15.7540 | 2000 | 0.2059 | - | - |
| 16.5397 | 2100 | 0.2632 | - | - |
| 17.3254 | 2200 | 0.2341 | - | - |
| 18.1111 | 2300 | 0.2264 | - | - |
| 18.9048 | 2400 | 0.2186 | - | - |
| 19.6905 | 2500 | 0.1205 | - | - |
| 20.4762 | 2600 | 0.192 | - | - |
| 21.2619 | 2700 | 0.1249 | - | - |
| 22.0476 | 2800 | 0.132 | - | - |
| 22.8413 | 2900 | 0.1026 | - | - |
| 23.6270 | 3000 | 0.1111 | - | - |
| 24.4127 | 3100 | 0.117 | - | - |
| 25.1984 | 3200 | 0.0843 | - | - |
| 25.9921 | 3300 | 0.1367 | - | - |
| 26.7778 | 3400 | 0.1702 | - | - |
| 27.5635 | 3500 | 0.1249 | - | - |
| 28.3492 | 3600 | 0.0918 | - | - |
| 29.1349 | 3700 | 0.0203 | - | - |
| 29.9286 | 3800 | 0.0965 | - | - |
| 30.7143 | 3900 | 0.0638 | - | - |
| 31.5 | 4000 | 0.0965 | - | - |
| 32.2857 | 4100 | 0.0948 | - | - |
| 33.0714 | 4200 | 0.0115 | - | - |
| 33.8651 | 4300 | 0.0336 | - | - |
| 34.6508 | 4400 | 0.0784 | - | - |
| 35.4365 | 4500 | 0.0265 | - | - |
| 36.2222 | 4600 | 0.0127 | - | - |
| 37.0079 | 4700 | 0.02 | - | - |
| 37.8016 | 4800 | 0.0905 | - | - |
| 38.5873 | 4900 | 0.0184 | - | - |
| 39.3730 | 5000 | 0.0222 | - | - |
| 40.1587 | 5100 | 0.0341 | - | - |
| 40.9524 | 5200 | 0.0373 | - | - |
| 41.7381 | 5300 | 0.0154 | - | - |
| 42.5238 | 5400 | 0.0518 | - | - |
| 43.3095 | 5500 | 0.0225 | - | - |
| 44.0952 | 5600 | 0.0355 | - | - |
| 44.8889 | 5700 | 0.0088 | - | - |
| 45.6746 | 5800 | 0.0143 | - | - |
| 46.4603 | 5900 | 0.0274 | - | - |
| 47.2460 | 6000 | 0.0104 | - | - |
| 48.0317 | 6100 | 0.0142 | - | - |
| 48.8254 | 6200 | 0.0032 | - | - |
| 49.6111 | 6300 | 0.0139 | - | - |
| 50.3968 | 6400 | 0.0328 | - | - |
| 51.1825 | 6500 | 0.0011 | - | - |
| 51.9762 | 6600 | 0.0051 | - | - |
| 52.7619 | 6700 | 0.0016 | - | - |
| 53.5476 | 6800 | 0.0032 | - | - |
| 54.3333 | 6900 | 0.0018 | - | - |
| 55.1190 | 7000 | 0.004 | - | - |
| 55.9127 | 7100 | 0.0023 | - | - |
| 56.6984 | 7200 | 0.0011 | - | - |
| 57.4841 | 7300 | 0.0009 | - | - |
| 58.2698 | 7400 | 0.0042 | - | - |
| 59.0556 | 7500 | 0.0018 | - | - |
| 59.8492 | 7600 | 0.001 | - | - |
| 60.6349 | 7700 | 0.0004 | - | - |
| 61.4206 | 7800 | 0.0074 | - | - |
| 62.2063 | 7900 | 0.003 | - | - |
| 63.0 | 8000 | 0.0007 | - | - |
| 63.7857 | 8100 | 0.0013 | - | - |
| 64.5714 | 8200 | 0.002 | - | - |
| 65.3571 | 8300 | 0.0007 | - | - |
| 66.1429 | 8400 | 0.0004 | - | - |
| 66.9365 | 8500 | 0.0006 | - | - |
| 67.7222 | 8600 | 0.0007 | - | - |
| 68.5079 | 8700 | 0.0051 | - | - |
| 69.2937 | 8800 | 0.0001 | - | - |
| 70.0794 | 8900 | 0.0006 | - | - |
| 70.8730 | 9000 | 0.0001 | - | - |
| 71.6587 | 9100 | 0.0002 | - | - |
| 72.4444 | 9200 | 0.0001 | - | - |
| 73.2302 | 9300 | 0.0003 | - | - |
| 74.0159 | 9400 | 0.0002 | - | - |
| 74.8095 | 9500 | 0.0002 | - | - |
| 75.5952 | 9600 | 0.0006 | - | - |
| 76.3810 | 9700 | 0.0 | - | - |
| 77.1667 | 9800 | 0.0001 | - | - |
| 77.9603 | 9900 | 0.0002 | - | - |
| 78.7460 | 10000 | 0.0 | - | - |
| 79.5317 | 10100 | 0.0001 | - | - |
| 80.3175 | 10200 | 0.0002 | - | - |
| 81.1032 | 10300 | 0.0 | - | - |
| 81.8968 | 10400 | 0.0001 | - | - |
| 82.6825 | 10500 | 0.0001 | - | - |
| 83.4683 | 10600 | 0.0 | - | - |
| 84.2540 | 10700 | 0.0001 | - | - |
| 85.0397 | 10800 | 0.0 | - | - |
| 85.8333 | 10900 | 0.0001 | - | - |
| 86.6190 | 11000 | 0.0001 | - | - |
| 87.4048 | 11100 | 0.0001 | - | - |
| 88.1905 | 11200 | 0.0 | - | - |
| 88.9841 | 11300 | 0.0001 | - | - |
| 89.7698 | 11400 | 0.0001 | - | - |
| 90.5556 | 11500 | 0.0001 | - | - |
| 91.3413 | 11600 | 0.0001 | - | - |
| 92.1270 | 11700 | 0.0 | - | - |
| 92.9206 | 11800 | 0.0 | - | - |
| 93.7063 | 11900 | 0.0 | - | - |
| 94.4921 | 12000 | 0.0 | - | - |
| 95.2778 | 12100 | 0.0001 | - | - |
| 96.0635 | 12200 | 0.0 | - | - |
| 96.8571 | 12300 | 0.0 | - | - |
| 97.6429 | 12400 | 0.0 | - | - |
| 98.4286 | 12500 | 0.0 | - | - |
| 99.2143 | 12600 | 0.0 | - | - |
@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",
}
@online{kexuefm-8847,
title={CoSENT: A more efficient sentence vector scheme than Sentence-BERT},
author={Su Jianlin},
year={2022},
month={Jan},
url={https://kexue.fm/archives/8847},
}
Base model
sentence-transformers/all-MiniLM-L6-v2