DEk21_hcmute_embedding is a Vietnamese text embedding focused on RAG and production efficiency:
📚
Trained Dataset
:
The model was trained on an in-house dataset consisting of approximately
100,000 examples
of legal questions and their related contexts.
⚙️ Efficiency:
Trained with a
Matryoshka loss
, allowing embeddings to be truncated with minimal performance loss. This ensures that smaller embeddings are faster to compare, making the model efficient for real-world production use.
from sentence_transformers import SentenceTransformer
import torch
from pyvi import ViTokenizer
# Download from the 🤗 Hub
model = SentenceTransformer("huyydangg/DEk21_hcmute_embedding")
# Define query (câu hỏi pháp luật) và docs (điều luật)
query = "Điều kiện để kết hôn hợp pháp là gì?"
docs = [
"Điều 8 Bộ luật Dân sự 2015 quy định về quyền và nghĩa vụ của công dân trong quan hệ gia đình.",
"Đ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 14 Bộ luật Dân sự 2015 quy định về quyền và nghĩa vụ của cá nhân khi tham gia hợp đồng.",
"Điều 27 Luật Hôn nhân và gia đình 2014 quy định về các trường hợp không được kết hôn.",
"Điều 51 Luật Hôn nhân và gia đình 2014 quy định về việc kết hôn giữa công dân Việt Nam và người nước ngoài."
]
# Tách từ cho query
segmented_query = ViTokenizer.tokenize(query)
# Tách từ cho từng dòng văn bản
segmented_docs = [ViTokenizer.tokenize(doc) for doc in docs]
# Encode query and documents
query_embedding = model.encode([segmented_query])
doc_embeddings = model.encode(segmented_docs)
similarities = torch.nn.functional.cosine_similarity(
torch.tensor(query_embedding), torch.tensor(doc_embeddings)
).flatten()
# Sort documents by cosine similarity
sorted_indices = torch.argsort(similarities, descending=True)
sorted_docs = [docs[idx] for idx in sorted_indices]
sorted_scores = [similarities[idx].item() for idx in sorted_indices]
# Print sorted documents with their cosine scoresfor doc, score inzip(sorted_docs, sorted_scores):
print(f"Document: {doc} - Cosine Similarity: {score:.4f}")
@misc{DEk21_hcmute_embedding,
title={DEk21_hcmute_embedding: A Vietnamese Text Embedding},
author={QUANG HUY},
year={2025},
publisher={Huggingface},
}
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",
}
MatryoshkaLoss
@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}
}
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}
}
Runs of iambestfeed vietnamese-embedding-model on huggingface.co
30
Total runs
0
24-hour runs
-3
3-day runs
2
7-day runs
10
30-day runs
More Information About vietnamese-embedding-model huggingface.co Model
More vietnamese-embedding-model license Visit here:
vietnamese-embedding-model huggingface.co is an AI model on huggingface.co that provides vietnamese-embedding-model's model effect (), which can be used instantly with this iambestfeed vietnamese-embedding-model model. huggingface.co supports a free trial of the vietnamese-embedding-model model, and also provides paid use of the vietnamese-embedding-model. Support call vietnamese-embedding-model model through api, including Node.js, Python, http.
vietnamese-embedding-model huggingface.co is an online trial and call api platform, which integrates vietnamese-embedding-model's modeling effects, including api services, and provides a free online trial of vietnamese-embedding-model, you can try vietnamese-embedding-model online for free by clicking the link below.
iambestfeed vietnamese-embedding-model online free url in huggingface.co:
vietnamese-embedding-model is an open source model from GitHub that offers a free installation service, and any user can find vietnamese-embedding-model on GitHub to install. At the same time, huggingface.co provides the effect of vietnamese-embedding-model install, users can directly use vietnamese-embedding-model installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
vietnamese-embedding-model install url in huggingface.co: