Downloads · 30 days
444
3% of all-time downloads
CODE4LIFEOFFICIAL/huydang-dek21-embedding-v2
huydang-dek21-embedding-v2 is a sentence similarity model from CODE4LIFEOFFICIAL. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as apache-2.0.
DEk21hcmuteembeddingv2 is a Vietnamese sentence embedding model fine-tuned for semantic retrieval.
Downloads · 30 days
444
3% of all-time downloads
All-time downloads
16.1K
Public
Parameters
135M
540 MB on disk
Likes
6
Public
Click a slice to open those files.
.safetensors540 MB · 100%
From the Hugging Face model README
DEk21_hcmute_embedding_v2 is a Vietnamese sentence embedding model fine-tuned for semantic retrieval.
This model is the v2 successor of huyydangg/DEk21_hcmute_embedding. It keeps the Vietnamese retrieval focus while improving production usability through cached contrastive learning and Matryoshka embedding truncation.
bkai-foundation-models/vietnamese-bi-encoderMatryoshkaLoss(CachedMultipleNegativesRankingLoss)768, 512, 256The model was trained on an in-house Vietnamese question-context retrieval dataset with approximately 90,000 rows.
The model was fine-tuned with Sentence Transformers from bkai-foundation-models/vietnamese-bi-encoder using a retrieval-focused contrastive objective.
The training objective combines:
Compared with huyydangg/DEk21_hcmute_embedding, this version is tuned with a more retrieval-focused, memory-efficient, and production-friendly training setup.
The Matryoshka setup allows downstream systems to use shorter vectors such as 512 or 256 dimensions, reducing storage and speeding up vector search while keeping useful semantic information.
pip install -U sentence-transformers pyvi
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim
from pyvi import ViTokenizer
model = SentenceTransformer("huyydangg/DEk21_hcmute_embedding_v2")
query = "Điều kiện để kết hôn hợp pháp là gì?"
documents = [
"Điều 18 Luật Hôn nhân và gia đình 2014 quy định về độ tuổi kết hôn của nam và nữ.",
"Điều kiện doanh nghiệp được hoạt động tư vấn giám sát.",
"Quy định về trợ cấp với cán bộ xã già yếu nghỉ việc.",
]
segmented_query = ViTokenizer.tokenize(query)
segmented_documents = [ViTokenizer.tokenize(document) for document in documents]
query_embedding = model.encode(segmented_query, convert_to_tensor=True)
document_embeddings = model.encode(segmented_documents, convert_to_tensor=True)
scores = cos_sim(query_embedding, document_embeddings)[0]
ranked_results = sorted(zip(documents, scores.tolist()), key=lambda item: item[1], reverse=True)
for document, score in ranked_results:
print(f"{score:.4f} - {document}")
Because the model was trained with Matryoshka dimensions, retrieval systems can evaluate or deploy shorter vectors such as 512 or 256 dimensions when embedding truncation is supported.
This model is intended for:
The models were evaluated on the same Vietnamese question-context retrieval benchmark using cosine similarity.
The comparison includes:
| Metric | DEk21_v2 | DEk21_v1 | BKAI Base |
|---|---|---|---|
| Accuracy@1 | 0.231 | 0.239 | 0.167 |
| Accuracy@3 | 0.367 | 0.342 | 0.269 |
| Accuracy@5 | 0.437 | 0.380 | 0.312 |
| Accuracy@10 | 0.519 | 0.436 | 0.374 |
| Accuracy@20 | 0.589 | 0.502 | 0.441 |
| Accuracy@25 | 0.612 | 0.521 | 0.467 |
| MAP@10 | 0.317 | 0.299 | 0.230 |
| MAP@100 | 0.326 | 0.307 | 0.239 |
| MRR@10 | 0.317 | 0.299 | 0.230 |
| MRR@25 | 0.323 | 0.304 | 0.236 |
| nDCG@10 | 0.365 | 0.332 | 0.264 |
| nDCG@25 | 0.388 | 0.353 | 0.287 |
| Dimension | Accuracy@10 | MAP@10 | nDCG@10 |
|---|---|---|---|
| 768 | 0.519 | 0.317 | 0.365 |
| 512 | 0.514 | 0.317 | 0.364 |
| 256 | 0.497 | 0.306 | 0.352 |
| 128 | 0.460 | 0.283 | 0.325 |
| 64 | 0.395 | 0.230 | 0.269 |
| Metric | v2 vs v1 | v2 vs BKAI |
|---|---|---|
| Accuracy@10 | +19.0% | +38.8% |
| Accuracy@20 | +17.3% | +33.6% |
| Accuracy@25 | +17.5% | +31.0% |
| MAP@10 | +6.1% | +38.0% |
| MAP@100 | +6.1% | +36.7% |
| MRR@10 | +6.1% | +38.0% |
| nDCG@10 | +10.2% | +38.4% |
| nDCG@25 | +10.1% | +35.4% |
You can cite this model as below:
@misc{DEk21_hcmute_embedding_v2,
title={DEk21_hcmute_embedding_v2: Vietnamese Text Embedding for Retrieval},
author={QUANG HUY},
year={2026},
publisher={Hugging Face},
}
@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{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@misc{gao2021scaling,
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
year={2021},
eprint={2101.06983},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@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}
}