SentenceTransformer based on AITeamVN/Vietnamese_Embedding
This is a sentence-transformers model finetuned from AITeamVN/Vietnamese_Embedding on the zalo-legal-triplets 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.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: AITeamVN/Vietnamese_Embedding
- Maximum Sequence Length: 8192 tokens
- Output Dimensionality: 1024 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': True, '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': False, 'include_prompt': True})
(2): Normalize()
)
Usage
Direct Usage (Sentence Transformers)
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("batmangiaicuuthegioi/bi-encoders-embeddings")
# Run inference
sentences = [
'Quy định về trao đổi dữ liệu thi hành án hình sự được quy định như thế nào?',
'Điều 12. Trao đổi dữ liệu giữa cơ sở dữ liệu về thi hành án hình sự và các cơ sở dữ liệu khác liên quan. khoản 1. việc trao đổi dữ liệu giữa cơ sở dữ liệu về thi hành án hình sự và các cơ sở dữ liệu khác liên quan phải thực hiện theo quy định của pháp luật và quy định của bộ công an, bộ quốc phòng. ',
'Điều 13. Quy định về bàn giao giữa các kíp trực. sau mỗi đợt kiểm tra, các kíp tuần tra, canh gác đê phải ghi chép đầy đủ tình hình diễn biến và hư hỏng đê điều vào sổ nhật ký tuần tra, canh gác theo mẫu quy định và bàn giao đầy đủ cho kíp sau. người thay mặt kíp giao và nhận phải ký và ghi rõ họ tên, ngày giờ vào sổ. sau mỗi ngày đội trưởng và cán bộ chuyên trách quản lý đê điều ký xác nhận tình hình trong ngày để theo dõi và làm cơ sở cho việc chi trả thù lao theo quy định.',
]
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]
Evaluation
Metrics
Triplet
- Dataset:
zalo_legal
- Evaluated with
TripletEvaluator
Metric | Value |
---|---|
cosine_accuracy | 1.0 |
Triplet
- Dataset:
zalo_legal
- Evaluated with
TripletEvaluator
Metric | Value |
---|---|
cosine_accuracy | 1.0 |
Training Details
Training Dataset
zalo-legal-triplets
- Dataset: zalo-legal-triplets at 15e0566
- Size: 37,059 training samples
- Columns:
anchor
,positive
, andnegative
- Approximate statistics based on the first 1000 samples:
anchor positive negative type string string string details - min: 7 tokens
- mean: 22.08 tokens
- max: 47 tokens
- min: 13 tokens
- mean: 82.98 tokens
- max: 344 tokens
- min: 25 tokens
- mean: 76.65 tokens
- max: 220 tokens
- Samples:
anchor positive negative Mức phạt đối với hành vi điều khiển xe máy dẫn, dắt theo súc vật ?
Điều 63. Xử phạt nhân viên đường sắt trực tiếp phục vụ chạy tàu (trừ lái tàu và phụ lái tàu) vi phạm quy định về nồng độ cồn hoặc sử dụng các chất kích thích khác mà pháp luật cấm sử dụng. điểm c) khi làm nhiệm vụ mà trong cơ thể có chất kích thích khác mà pháp luật cấm sử dụng.
Điều 4. Nhiệm vụ của lực lượng tuần tra, canh gác đê. khoản 5. đeo phù hiệu khi làm nhiệm vụ.
Theo quy định pháp luật, dẫn xuất của các loài động vật, thực vật là gì?
Điều 3. Giải thích từ ngữ. khoản 26. mẫu vật săn bắt là mẫu vật có được từ các hoạt động săn bắt hợp pháp.
Điều 17. Trách nhiệm của Sở Nông nghiệp và Phát triển nông thôn. khoản 3. khi có báo động lũ từ cấp i trở lên, sở nông nghiệp và phát triển nông thôn phải chỉ đạo, tổ chức kiểm tra, đôn đốc công tác tuần tra, canh gác ở các tuyến đê.
Mục tiêu của giáo dục nghề nghiệp từ tháng 7/2020 được quy định như thế nào?
Điều 36. Mục tiêu của giáo dục nghề nghiệp. giáo dục nghề nghiệp nhằm đào tạo nhân lực trực tiếp cho sản xuất, kinh doanh và dịch vụ, có năng lực hành nghề tương ứng với trình độ đào tạo; có đạo đức, sức khỏe; có trách nhiệm nghề nghiệp; có khả năng sáng tạo, thích ứng với môi trường hội nhập quốc tế; bảo đảm nâng cao năng suất, chất lượng lao động; tạo điều kiện cho người học sau khi hoàn thành khóa học có khả năng tìm việc làm, tự tạo việc làm hoặc học trình độ cao hơn.
Điều 3. Tiêu chuẩn của các thành viên thuộc lực lượng tuần tra, canh gác đê. khoản 2. có tinh thần trách nhiệm, chịu đựng gian khổ, khắc phục khó khăn, quen sông nước và biết bơi, có kiến thức, kinh nghiệm hộ đê, phòng, chống lụt, bão.
- Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Evaluation Dataset
zalo-legal-triplets
- Dataset: zalo-legal-triplets at 15e0566
- Size: 37,059 evaluation samples
- Columns:
anchor
,positive
, andnegative
- Approximate statistics based on the first 1000 samples:
anchor positive negative type string string string details - min: 7 tokens
- mean: 21.7 tokens
- max: 47 tokens
- min: 17 tokens
- mean: 79.22 tokens
- max: 327 tokens
- min: 25 tokens
- mean: 74.1 tokens
- max: 220 tokens
- Samples:
anchor positive negative Nghiên cứu y sinh học liên quan đến con người là gì?
Điều 31. Thẩm định nghiên cứu theo quy trình rút gọn. khoản 4. ngoại trừ trường hợp họp khẩn cấp, tất cả tài liệu đề nghị xem xét phải được gửi tới thành viên hội đồng đạo đức được phân công nhận xét trước ít nhất 05 ngày làm việc so với ngày yêu cầu gửi lại phiếu nhận xét, đánh giá nghiên cứu.
Điều 10. Nội dung tuần tra canh gác cống qua đê. khoản 2. người tuần tra, canh gác phải kiểm tra kỹ phần tiếp giáp giữa thân cống, tường cánh gà của cống với đê; cánh cống, bộ phận đóng mở cánh cống, cửa cống, thân cống và khu vực thượng, hạ lưu cống để phát hiện kịp thời những sự cố xảy ra.
Hồ sơ cấp lại Giấy chứng nhận đủ điều kiện hoạt động dịch vụ giám định công nghệ bao gồm những giấy tờ gì?
Điều 38. Hồ sơ cấp Giấy chứng nhận đủ điều kiện hoạt động dịch vụ giám định công nghệ. điểm e) mẫu chứng thư giám định của tổ chức.
Điều 6. Trang bị dụng cụ, sổ sách. khoản 7. việc giao nhận các dụng cụ và sổ sách trên đây phải được lập biên bản để quản lý, theo dõi.
Chạy quá tốc độ bao nhiêu km thì xe ô tô sẽ bị giam bằng?
Điều 55. Xử phạt các hành vi vi phạm quy định quản lý, bảo trì kết cấu hạ tầng đường sắt. điểm b) thực hiện hành vi quy định tại điểm c khoản 3 điều này buộc phải tổ chức sửa chữa, bổ sung, gia cố, thay thế các hư hỏng kết cấu hạ tầng đường sắt để bảo đảm chất lượng theo công lệnh tốc độ, công lệnh tải trọng đã công bố.
Điều 9. Nội dung tuần tra, canh gác đê. điểm d) mỗi kíp tuần tra phải kiểm tra vượt quá phạm vi phụ trách về hai phía, mỗi phía 50m. đối với những khu vực đã từng xảy ra sự cố hư hỏng, phải kiểm tra quan sát rộng hơn để phát hiện sự cố.
- Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 4per_device_eval_batch_size
: 2num_train_epochs
: 1warmup_ratio
: 0.1fp16
: True
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 4per_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
: 5e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 1max_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
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | Validation Loss | zalo_legal_cosine_accuracy |
---|---|---|---|---|
0.3084 | 2000 | 0.2978 | 0.0778 | 0.9996 |
0.6167 | 4000 | 0.1735 | 0.0522 | 1.0 |
0.9251 | 6000 | 0.1148 | 0.0330 | 1.0 |
1.0 | 6486 | - | - | 1.0 |
Framework Versions
- Python: 3.10.12
- Sentence Transformers: 3.3.1
- Transformers: 4.47.0
- PyTorch: 2.5.1+cu121
- Accelerate: 1.2.1
- Datasets: 3.3.1
- Tokenizers: 0.21.0
Citation
BibTeX
Sentence Transformers
@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",
}
MultipleNegativesRankingLoss
@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}
}
- Downloads last month
- 3
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for batmangiaicuuthegioi/bi-encoders-embeddings
Dataset used to train batmangiaicuuthegioi/bi-encoders-embeddings
Evaluation results
- Cosine Accuracy on zalo legalself-reported1.000
- Cosine Accuracy on zalo legalself-reported1.000