Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper
•
1908.10084
•
Published
•
9
This is a sentence-transformers model finetuned from intfloat/multilingual-e5-base. It maps sentences & paragraphs to a 768-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': 768, '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("meandyou200175/e5_large_finetune_word")
# Run inference
sentences = [
'shop có bếp điện công suất dưới 1500W không',
'Bếp từ Sunhouse SHD6017, Công suất: 1400W, Mặt kính chịu lực, 8 chế độ nấu, Giá: 899,000',
'Bếp từ Sunhouse SHD6017, Công suất: 2171W, Mặt kính chịu lực, 8 chế độ nấu, Giá: 899,000',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
InformationRetrievalEvaluator| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.5286 |
| cosine_accuracy@2 | 0.7286 |
| cosine_accuracy@5 | 0.9571 |
| cosine_accuracy@10 | 0.9857 |
| cosine_accuracy@100 | 1.0 |
| cosine_precision@1 | 0.5286 |
| cosine_precision@2 | 0.3643 |
| cosine_precision@5 | 0.1914 |
| cosine_precision@10 | 0.0986 |
| cosine_precision@100 | 0.01 |
| cosine_recall@1 | 0.5286 |
| cosine_recall@2 | 0.7286 |
| cosine_recall@5 | 0.9571 |
| cosine_recall@10 | 0.9857 |
| cosine_recall@100 | 1.0 |
| cosine_ndcg@10 | 0.7704 |
| cosine_mrr@1 | 0.5286 |
| cosine_mrr@2 | 0.6286 |
| cosine_mrr@5 | 0.6952 |
| cosine_mrr@10 | 0.6992 |
| cosine_mrr@100 | 0.7001 |
| cosine_map@100 | 0.7001 |
query, positive, negative_1, negative_2, negative_3, negative_4, negative_5, negative_6, negative_7, negative_8, negative_9, negative_10, negative_11, negative_12, negative_13, negative_14, and negative_15| query | positive | negative_1 | negative_2 | negative_3 | negative_4 | negative_5 | negative_6 | negative_7 | negative_8 | negative_9 | negative_10 | negative_11 | negative_12 | negative_13 | negative_14 | negative_15 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| type | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string |
| details |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| query | positive | negative_1 | negative_2 | negative_3 | negative_4 | negative_5 | negative_6 | negative_7 | negative_8 | negative_9 | negative_10 | negative_11 | negative_12 | negative_13 | negative_14 | negative_15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
shop có son môi tông màu trong khoảng đỏ tươi đến đỏ gạch không |
Son lì MAC Retro Matte Ruby Woo, Màu: đỏ gạch, Chất son lì lâu trôi, Không chứa paraben, Khối lượng tịnh: 3g, Xuất xứ: Mỹ, Giá: 650.000 |
Máy giặt Electrolux EWF80743, dung tích 7kg, 800 vòng/phút, Giá: 5.250.000 |
Camera Xiaomi Mi 2K, góc quay 130°, hỗ trợ đàm thoại 2 chiều, Giá: 2.250.000 |
Vòng tay thông minh Amazfit GTR 3 Pro, Màn AMOLED 1.65 inch, Pin 12 ngày, Chống nước 5ATM, Giá: 5,490,000 |
Máy sấy Electrolux EDH708, 7kg, công suất 1800W, Giá: 7.200.000 |
Máy hút bụi Electrolux Z123, công suất 1800W, lọc HEPA, Giá: 2.800.000 |
Nồi áp suất điện Sunhouse SH1540, dung tích 9L, công suất 1200W, Giá 1250000 |
Máy giặt Samsung WW90T555DAX, dung tích 9kg, 1200 vòng/phút, cửa ngang, Giá 8000000 |
Webcam Logitech C920, Full HD 1080P, micro kép, Giá 1350000 |
Ghế massage Daikiosan DK-180, công suất 120W, nhiều chế độ, Giá: 3.950.000 |
Bếp từ Sunhouse SHD6156, công suất 2600W, hẹn giờ 3h, Giá 1050000 |
Xe đạp gấp Dahon Mariner D7, bánh 20 inch, 7 tốc độ, Giá: 4.250.000 |
Bình nước nóng Ariston AN15, dung tích 15L, điện áp 220V, Giá: 1.250.000 |
Quạt bàn Sunhouse SHF401, công suất 60W, 3 tốc độ, Giá: 370.000 |
Bình nước nóng Ariston AN30, dung tích 30L, điện áp 220V, Giá 1850000 |
Đồng hồ Amazfit GTS 4 Mini, pin 1200 phút (~20h), GPS, Giá: 3.900.000 |
có công tắc thông minh giá dưới 500k không |
Công tắc Xiaomi Smart WiFi, chịu tải 16A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 738A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 525A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 558A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 661A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 703A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 591A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 715A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 670A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 691A, kết nối 2.4GHz, Giá: 420.000 |
Công tắc Xiaomi Smart WiFi, chịu tải 624A, kết nối 2.4GHz, Giá: 420.000 |
Tủ lạnh LG 300 lít, 2 ngăn đông-mát, Inverter tiết kiệm điện, Giá: 11.200.000 |
Lò nướng Sunhouse SHD4230, dung tích 35L, công suất 1500W, Giá: 950.000 |
Máy lọc không khí Sharp FP-J60E, công suất 55W, diện tích 45 mét vuông, Giá 2150000 |
Nồi áp suất Sunhouse SH1535, dung tích 7L, công suất 1200W, Giá: 1.050.000 |
Máy lọc nước Karofi 8 lõi, bình 8L, Giá: 6.200.000 |
cho tôi bếp từ giá từ 5 đến 6 triệu |
Bếp từ Bosch PPI82560MS, tổng công suất 1800W, mặt kính chịu lực, Giá: 5.200.000 |
Bếp từ Bosch PPI82560MS, tổng công suất 1800W, mặt kính chịu lực, Giá: 1040000.000 |
Máy sấy Electrolux EDV7052, dung tích 7kg, công suất 1600W, Giá: 5.250.000 |
Smart Tivi Sony Bravia 43X75K, 43 inch, 4K HDR, Giá: 9.700.000 |
Tủ đông Sanaky 350 lít, 2 ngăn 2 chế độ, Công suất: 150W, Gas R600a tiết kiệm điện, Bánh xe di chuyển tiện lợi, Giá: 7.200.000 |
Máy lọc không khí Xiaomi Mi Air Purifier 4, công suất 50W, lọc bụi PM2.5, Giá: 3.200.000 |
Vali Trip P803, size 24 inch, chất liệu ABS, khóa TSA, Giá: 1.750.000 |
Máy xay cà phê Hario Skerton Plus, dung tích 250g, tay quay, Giá 520000 |
Máy sấy tóc Braun HD385, công suất 1800W, 2 tốc độ, Giá: 420.000 |
Tai nghe Sony WH-1000XM4, chống ồn ANC, pin 30h, Giá: 4.900.000 |
Bàn phím cơ AKKO 3108, LED RGB, switch Blue, Giá: 1.350.000 |
Máy lọc nước Kangaroo KG109, công suất 15L/h, 9 lõi lọc, Giá: 7.250.000 |
Máy lọc không khí Coway AP-1009CH, Phạm vi 33m2, Bộ lọc HEPA, Giá: 4.100.000 |
Công tắc Tuya Smart WiFi, chịu tải 16A, kết nối 2.4GHz, Giá: 420.000 |
Nồi áp suất Sunhouse SH1535, dung tích 7L, công suất 1200W, Giá: 1.050.000 |
Bếp từ Bosch 2 vùng nấu, tổng công suất 2980W, mặt kính chịu lực, Giá: 5.500.000 |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
query, positive, negative_1, negative_2, negative_3, negative_4, negative_5, negative_6, negative_7, negative_8, negative_9, negative_10, negative_11, negative_12, negative_13, negative_14, and negative_15| query | positive | negative_1 | negative_2 | negative_3 | negative_4 | negative_5 | negative_6 | negative_7 | negative_8 | negative_9 | negative_10 | negative_11 | negative_12 | negative_13 | negative_14 | negative_15 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| type | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string |
| details |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| query | positive | negative_1 | negative_2 | negative_3 | negative_4 | negative_5 | negative_6 | negative_7 | negative_8 | negative_9 | negative_10 | negative_11 | negative_12 | negative_13 | negative_14 | negative_15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
có áo sơ mi nữ giá nhỏ hơn 500k không |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 100% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 653% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 655% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 684% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 576% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 695% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 594% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 632% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 530% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 536% silk, Size: S/M/L, Giá: 399.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 535% silk, Size: S/M/L, Giá: 399.000 |
Máy rửa bát Bosch SMS46NI05E, 12 bộ, 6 chương trình rửa, Tiết kiệm nước, Giá: 16.500.000 |
Laptop Asus ZenBook, Intel Core i7-1255U, RAM 16GB, SSD 1TB, Giá: 28.500.000 |
Robot hút bụi + lọc không khí Dreame L10S Ultra, lực hút 4005Pa, pin 150 phút, Giá: 18.520.000 |
Giày chạy bộ Adidas Duramo SL, Đế EVA, Upper Mesh thoáng khí, Size 40-44, Giá: 1.650.000 |
Nồi cơm điện Sharp 1.8L, công suất 700W, Giá 650000 |
Bàn ủi <1200W |
Bàn ủi khô Tefal FV1020, công suất 1000W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1509W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1480W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1360W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1489W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1753W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1670W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1547W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1646W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1454W, Giá: 380.000 |
Bàn ủi khô Tefal FV1020, công suất 1631W, Giá: 380.000 |
Áo sơ mi lụa Mango, Kiểu dáng: basic, Màu: trắng, Chất liệu: 100% silk, Size: S/M/L, Giá: 399.000 |
Xe đẩy Aprica Nano Smart, Trọng lượng: 6.8kg, Khung nhôm, Gấp gọn 1 tay, 3 tư thế ngả, Bảo hành: 12 tháng, Giá: 6.200.000 |
Bàn gỗ công nghiệp MDF dài 140cm, rộng 70cm, có ngăn kéo, Giá: 2.500.000 |
Máy sấy Electrolux EDH802, công suất 2000W, sức chứa 8kg, Giá: 12.500.000 |
Điều hòa Panasonic 12000 BTU (~3.52kW), 1 chiều, Inverter tiết kiệm điện, Giá: 11.500.000 |
tôi cần tai nghe chống ồn chủ động pin trên 22 giờ |
Tai nghe Sony WH-1000XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-190XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-160XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-180XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-140XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-200XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-150XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-130XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Tai nghe Sony WH-120XM5, pin 1320 phút (~22h), chống ồn ANC, Giá: 8.300.000 |
Máy tính bảng Samsung Galaxy Tab S9+, Màn hình 12.4 inch AMOLED, RAM 12GB, Bộ nhớ 256GB, Giá: 21.900.000 |
Đồng hồ thông minh Amazfit Bip U Pro, Pin 14 ngày, Màn 1.43 inch, GPS, Chống nước 5ATM, Giá: 1,490,000 |
Bàn là Sunhouse SHI1305, công suất 1400W, đế chống dính ceramic, Giá 380000 |
Máy lọc nước Karofi 12000ml, công suất 95W, 8 lõi lọc, Giá: 7.000.000 |
Webcam Logitech C270, Full HD 720P, micro tích hợp, Giá 650000 |
Máy giặt LG FV1409S3W, dung tích 9kg, 1000 vòng/phút, Giá: 6.950.000 |
Màn hình Gigabyte G24F, 24 inch, 144Hz, 1ms, Giá: 5.700.000 |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
eval_strategy: stepsper_device_train_batch_size: 2per_device_eval_batch_size: 2learning_rate: 2e-05num_train_epochs: 5warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicatesoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 2per_device_eval_batch_size: 2per_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: 5max_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: 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 | Validation Loss | cosine_ndcg@10 |
|---|---|---|---|---|
| -1 | -1 | - | - | 0.6937 |
| 0.1595 | 100 | 2.3128 | - | - |
| 0.3190 | 200 | 1.5229 | - | - |
| 0.4785 | 300 | 1.1498 | - | - |
| 0.6380 | 400 | 1.1066 | - | - |
| 0.7974 | 500 | 0.9526 | - | - |
| 0.9569 | 600 | 1.0513 | - | - |
| 1.1164 | 700 | 0.8165 | - | - |
| 1.2759 | 800 | 0.7312 | - | - |
| 1.4354 | 900 | 0.9387 | - | - |
| 1.5949 | 1000 | 0.7608 | 0.9302 | 0.7515 |
| 1.7544 | 1100 | 0.6123 | - | - |
| 1.9139 | 1200 | 0.725 | - | - |
| 2.0734 | 1300 | 0.5746 | - | - |
| 2.2329 | 1400 | 0.5821 | - | - |
| 2.3923 | 1500 | 0.5943 | - | - |
| 2.5518 | 1600 | 0.4776 | - | - |
| 2.7113 | 1700 | 0.487 | - | - |
| 2.8708 | 1800 | 0.5512 | - | - |
| 3.0303 | 1900 | 0.3788 | - | - |
| 3.1898 | 2000 | 0.3386 | 0.8075 | 0.7595 |
| 3.3493 | 2100 | 0.3997 | - | - |
| 3.5088 | 2200 | 0.404 | - | - |
| 3.6683 | 2300 | 0.404 | - | - |
| 3.8278 | 2400 | 0.3097 | - | - |
| 3.9872 | 2500 | 0.4796 | - | - |
| 4.1467 | 2600 | 0.2501 | - | - |
| 4.3062 | 2700 | 0.2341 | - | - |
| 4.4657 | 2800 | 0.3501 | - | - |
| 4.6252 | 2900 | 0.2528 | - | - |
| 4.7847 | 3000 | 0.31 | 0.6901 | 0.7704 |
| 4.9442 | 3100 | 0.3391 | - | - |
@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-base