Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper
• 1908.10084 • Published
• 12
This is a sentence-transformers model finetuned from denaya/indoSBERT-large. It maps sentences & paragraphs to a 256-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': 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): Dense({'in_features': 1024, 'out_features': 256, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
)
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("yahyaabd/allstats-search-large-bpstable-v1")
# Run inference
sentences = [
'Bagaimana kaitan antara pendidikan dan kegiatan mingguan penduduk usia 15+ pada tahun 2022?',
'Penduduk Berumur 15 Tahun Ke Atas Menurut Pendidikan Tertinggi yang Ditamatkan dan Jenis Kegiatan Selama Seminggu yang Lalu, 2008-2024 ',
'Persentase Perkembangan Distribusi Pengeluaran ',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 256]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
evalInformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.9121 |
| cosine_accuracy@3 | 0.9902 |
| cosine_accuracy@5 | 0.9935 |
| cosine_accuracy@10 | 0.9967 |
| cosine_precision@1 | 0.9121 |
| cosine_precision@3 | 0.3572 |
| cosine_precision@5 | 0.2378 |
| cosine_precision@10 | 0.1375 |
| cosine_recall@1 | 0.7097 |
| cosine_recall@3 | 0.7867 |
| cosine_recall@5 | 0.8052 |
| cosine_recall@10 | 0.8221 |
| cosine_ndcg@10 | 0.8348 |
| cosine_mrr@10 | 0.9497 |
| cosine_map@100 | 0.7729 |
quora_duplicates_devBinaryClassificationEvaluator| Metric | Value |
|---|---|
| cosine_accuracy | 0.9915 |
| cosine_accuracy_threshold | 0.3195 |
| cosine_f1 | 0.9851 |
| cosine_f1_threshold | 0.3036 |
| cosine_precision | 0.9889 |
| cosine_recall | 0.9814 |
| cosine_ap | 0.9957 |
| cosine_mcc | 0.9791 |
sentence_0, sentence_1, and label| sentence_0 | sentence_1 | label | |
|---|---|---|---|
| type | string | string | int |
| details |
|
|
|
| sentence_0 | sentence_1 | label |
|---|---|---|
Average monthly net wage/salary of employees by age group and type of work (Rupiah), 2018 |
Rata-rata Upah/Gaji Bersih Sebulan Buruh/Karyawan/Pegawai Menurut Kelompok Umur dan Jenis Pekerjaan (Rupiah), 2018 |
1 |
Cek average real wage buruh industri pengolahan (level bawah) sekitar tahun 2009 |
Rata-rata Upah Riil Per Bulan Buruh Industri Pengolahan di Bawah Mandor, 2005-2014 (1996=100) |
1 |
Dimana saya bisa lihat rekapitulasi dokumen RPB kabupaten/kota? |
Rekap Dokumen RPB Kabupaten/Kota |
1 |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 30fp16: Truemulti_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_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: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 30max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_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: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss | eval_cosine_ndcg@10 | quora_duplicates_dev_cosine_ap |
|---|---|---|---|---|
| 0.2222 | 20 | - | 0.7769 | - |
| 0.4444 | 40 | - | 0.8167 | - |
| 0.6667 | 60 | - | 0.8221 | - |
| 0.8889 | 80 | - | 0.8282 | - |
| 1.0 | 90 | - | 0.8256 | - |
| 1.1111 | 100 | - | 0.8278 | - |
| 1.3333 | 120 | - | 0.8388 | - |
| 1.5556 | 140 | - | 0.8347 | - |
| 1.7778 | 160 | - | 0.8351 | - |
| 2.0 | 180 | - | 0.8407 | - |
| 2.2222 | 200 | - | 0.8302 | - |
| 2.4444 | 220 | - | 0.8261 | - |
| 2.6667 | 240 | - | 0.8217 | - |
| 2.8889 | 260 | - | 0.8161 | - |
| 3.0 | 270 | - | 0.8143 | - |
| 3.1111 | 280 | - | 0.8133 | - |
| 3.3333 | 300 | - | 0.8259 | - |
| 3.5556 | 320 | - | 0.8342 | - |
| 3.7778 | 340 | - | 0.8267 | - |
| 4.0 | 360 | - | 0.8190 | - |
| 4.2222 | 380 | - | 0.8193 | - |
| 4.4444 | 400 | - | 0.8281 | - |
| 4.6667 | 420 | - | 0.8283 | - |
| 4.8889 | 440 | - | 0.8197 | - |
| 5.0 | 450 | - | 0.8211 | - |
| 5.1111 | 460 | - | 0.8118 | - |
| 5.3333 | 480 | - | 0.8298 | - |
| 5.5556 | 500 | 0.0412 | 0.8283 | - |
| 5.7778 | 520 | - | 0.8264 | - |
| 6.0 | 540 | - | 0.8271 | - |
| 6.2222 | 560 | - | 0.8243 | - |
| 6.4444 | 580 | - | 0.8256 | - |
| 6.6667 | 600 | - | 0.8356 | - |
| 6.8889 | 620 | - | 0.8332 | - |
| 7.0 | 630 | - | 0.8250 | - |
| 7.1111 | 640 | - | 0.8179 | - |
| 7.3333 | 660 | - | 0.8356 | - |
| 7.5556 | 680 | - | 0.8400 | - |
| 7.7778 | 700 | - | 0.8349 | - |
| 8.0 | 720 | - | 0.8281 | - |
| 8.2222 | 740 | - | 0.8330 | - |
| 8.4444 | 760 | - | 0.8338 | - |
| 8.6667 | 780 | - | 0.8338 | - |
| 8.8889 | 800 | - | 0.8344 | - |
| 9.0 | 810 | - | 0.8319 | - |
| 9.1111 | 820 | - | 0.8328 | - |
| 9.3333 | 840 | - | 0.8325 | - |
| 9.5556 | 860 | - | 0.8375 | - |
| 9.7778 | 880 | - | 0.8306 | - |
| 10.0 | 900 | - | 0.8263 | - |
| 10.2222 | 920 | - | 0.8280 | - |
| 10.4444 | 940 | - | 0.8272 | - |
| 10.6667 | 960 | - | 0.8280 | - |
| 10.8889 | 980 | - | 0.8313 | - |
| 11.0 | 990 | - | 0.8307 | - |
| 11.1111 | 1000 | 0.0198 | 0.8324 | - |
| 11.3333 | 1020 | - | 0.8303 | - |
| 11.5556 | 1040 | - | 0.8262 | - |
| 11.7778 | 1060 | - | 0.8294 | - |
| 12.0 | 1080 | - | 0.8309 | - |
| 12.2222 | 1100 | - | 0.8274 | - |
| 12.4444 | 1120 | - | 0.8312 | - |
| 12.6667 | 1140 | - | 0.8371 | - |
| 12.8889 | 1160 | - | 0.8408 | - |
| 13.0 | 1170 | - | 0.8374 | - |
| 13.1111 | 1180 | - | 0.8344 | - |
| 13.3333 | 1200 | - | 0.8341 | - |
| 13.5556 | 1220 | - | 0.8333 | - |
| 13.7778 | 1240 | - | 0.8388 | - |
| 14.0 | 1260 | - | 0.8414 | - |
| 14.2222 | 1280 | - | 0.8344 | - |
| 14.4444 | 1300 | - | 0.8328 | - |
| 14.6667 | 1320 | - | 0.8340 | - |
| 14.8889 | 1340 | - | 0.8317 | - |
| 15.0 | 1350 | - | 0.8260 | - |
| 15.1111 | 1360 | - | 0.8252 | - |
| 15.3333 | 1380 | - | 0.8244 | - |
| 15.5556 | 1400 | - | 0.8269 | - |
| 15.7778 | 1420 | - | 0.8275 | - |
| 16.0 | 1440 | - | 0.8281 | - |
| 16.2222 | 1460 | - | 0.8294 | - |
| 16.4444 | 1480 | - | 0.8299 | - |
| 16.6667 | 1500 | 0.0136 | 0.8318 | - |
| 16.8889 | 1520 | - | 0.8320 | - |
| 17.0 | 1530 | - | 0.8332 | - |
| 17.1111 | 1540 | - | 0.8337 | - |
| 17.3333 | 1560 | - | 0.8299 | - |
| 17.5556 | 1580 | - | 0.8283 | - |
| 17.7778 | 1600 | - | 0.8309 | - |
| 18.0 | 1620 | - | 0.8329 | - |
| 18.2222 | 1640 | - | 0.8317 | - |
| 18.4444 | 1660 | - | 0.8313 | - |
| 18.6667 | 1680 | - | 0.8317 | - |
| 18.8889 | 1700 | - | 0.8356 | - |
| 19.0 | 1710 | - | 0.8345 | - |
| 19.1111 | 1720 | - | 0.8358 | - |
| 19.3333 | 1740 | - | 0.8334 | - |
| 19.5556 | 1760 | - | 0.8335 | - |
| 19.7778 | 1780 | - | 0.8318 | - |
| 20.0 | 1800 | - | 0.8326 | - |
| 20.2222 | 1820 | - | 0.8318 | - |
| 20.4444 | 1840 | - | 0.8335 | - |
| 20.6667 | 1860 | - | 0.8333 | - |
| 20.8889 | 1880 | - | 0.8335 | - |
| 21.0 | 1890 | - | 0.8341 | - |
| 21.1111 | 1900 | - | 0.8341 | - |
| 21.3333 | 1920 | - | 0.8355 | - |
| 21.5556 | 1940 | - | 0.8360 | - |
| 21.7778 | 1960 | - | 0.8343 | - |
| 22.0 | 1980 | - | 0.8351 | - |
| 22.2222 | 2000 | 0.015 | 0.8342 | - |
| 22.4444 | 2020 | - | 0.8342 | - |
| 22.6667 | 2040 | - | 0.8339 | - |
| 22.8889 | 2060 | - | 0.8342 | - |
| 23.0 | 2070 | - | 0.8345 | - |
| 23.1111 | 2080 | - | 0.8354 | - |
| 23.3333 | 2100 | - | 0.8366 | - |
| 23.5556 | 2120 | - | 0.8379 | - |
| 23.7778 | 2140 | - | 0.8386 | - |
| 24.0 | 2160 | - | 0.8367 | - |
| 24.2222 | 2180 | - | 0.8357 | - |
| 24.4444 | 2200 | - | 0.8372 | - |
| 24.6667 | 2220 | - | 0.8377 | - |
| 24.8889 | 2240 | - | 0.8373 | - |
| 25.0 | 2250 | - | 0.8367 | - |
| 25.1111 | 2260 | - | 0.8366 | - |
| 25.3333 | 2280 | - | 0.8369 | - |
| 25.5556 | 2300 | - | 0.8373 | - |
| 25.7778 | 2320 | - | 0.8366 | - |
| 26.0 | 2340 | - | 0.8354 | - |
| 26.2222 | 2360 | - | 0.8347 | - |
| 26.4444 | 2380 | - | 0.8344 | - |
| 26.6667 | 2400 | - | 0.8341 | - |
| 26.8889 | 2420 | - | 0.8343 | - |
| 27.0 | 2430 | - | 0.8344 | - |
| 27.1111 | 2440 | - | 0.8345 | - |
| 27.3333 | 2460 | - | 0.8344 | - |
| 27.5556 | 2480 | - | 0.8347 | - |
| 27.7778 | 2500 | 0.0136 | 0.8342 | - |
| 28.0 | 2520 | - | 0.8347 | - |
| 28.2222 | 2540 | - | 0.8346 | - |
| 28.4444 | 2560 | - | 0.8346 | - |
| 28.6667 | 2580 | - | 0.8347 | - |
| 28.8889 | 2600 | - | 0.8348 | - |
| 29.0 | 2610 | - | 0.8348 | - |
| 29.1111 | 2620 | - | 0.8348 | - |
| 29.3333 | 2640 | - | 0.8348 | - |
| 29.5556 | 2660 | - | 0.8348 | - |
| 29.7778 | 2680 | - | 0.8348 | - |
| 30.0 | 2700 | - | 0.8348 | - |
| -1 | -1 | - | - | 0.9957 |
@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
denaya/indoSBERT-large