Downloads · 30 days
51
3% of all-time downloads
kietnt0603/nrk-legal-large
nrk-legal-large is a sentence similarity model from kietnt0603. 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.
This is a sentence-transformers model fine-tuned for Vietnamese Legal retrieval, optimized for use in RAG (Retrieval-Augmented Generation) pipelines. It maps Vietnamese legal queries and documents to a 1024-dimensiona…
Downloads · 30 days
51
3% of all-time downloads
All-time downloads
1.7K
Public
Parameters
560M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 99%
From the Hugging Face model README
This is a sentence-transformers model fine-tuned for Vietnamese Legal retrieval, optimized for use in RAG (Retrieval-Augmented Generation) pipelines. It maps Vietnamese legal queries and documents to a 1024-dimensional dense vector space, enabling semantic search over Vietnamese legal corpora.
The model was trained with MatryoshkaLoss combined with MultipleNegativesRankingLoss, allowing embeddings to be truncated to smaller dimensions (e.g., 1024, 768, 512, 256, 128) with minimal performance degradation.
| Attribute | Value |
|---|---|
| Base Model | intfloat/multilingual-e5-large |
| Embedding Dimension | 1024 |
| Max Sequence Length | 512 |
| Similarity Function | Cosine Similarity |
| Training Loss | MatryoshkaLoss + MultipleNegativesRankingLoss |
| Matryoshka Dimensions | [1024, 768, 512, 256, 128] |
| Language | Vietnamese |
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("kietnt0603/nrk-legal-large")
queries = [
"Mức phạt khi điều khiển xe ô tô không có giấy phép lái xe",
"Quy định về thời gian nghỉ phép hàng năm của người lao động",
]
documents = [
"Điều 21. Xử phạt người điều khiển xe ô tô vi phạm quy định...",
"Điều 113. Nghỉ hằng năm. Người lao động làm việc đủ 12 tháng...",
]
query_embeddings = model.encode(queries)
doc_embeddings = model.encode(documents)
similarities = model.similarity(query_embeddings, doc_embeddings)
print(similarities)
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("kietnt0603/nrk-legal-large")
model.truncate_dim = 256 # Use 256-dim instead of full 1024-dim
query_embedding = model.encode("Quy định về thuế thu nhập cá nhân")
doc_embeddings = model.encode(documents)
# Faster search with minimal quality loss
Evaluated on another-symato/VMTEB-Zalo-legel-retrieval-wseg benchmark (test split: 640 queries, 61,425 legal documents).
| Dimension | Accuracy@1 | Accuracy@10 | NDCG@3 | NDCG@5 | NDCG@10 | MRR@3 | MRR@5 | MRR@10 | MAP@100 |
|---|---|---|---|---|---|---|---|---|---|
| 1024 | 0.8078 | 0.9922 | 0.8982 | 0.9074 | 0.9115 | 0.8773 | 0.8826 | 0.8843 | 0.8847 |
| 768 | 0.8047 | 0.9922 | 0.8962 | 0.9052 | 0.9094 | 0.8747 | 0.8797 | 0.8816 | 0.8819 |
| 512 | 0.7906 | 0.9906 | 0.8914 | 0.9005 | 0.9042 | 0.8682 | 0.8733 | 0.8749 | 0.8755 |
| 256 | 0.7812 | 0.9906 | 0.8840 | 0.8959 | 0.9000 | 0.8609 | 0.8677 | 0.8694 | 0.8699 |
| 128 | 0.7797 | 0.9875 | 0.8838 | 0.8935 | 0.8971 | 0.8596 | 0.8650 | 0.8666 | 0.8672 |
| hybrid | 0.6641 | 0.9422 | 0.7646 | 0.7853 | 0.8053 | 0.7414 | 0.7529 | 0.7613 | 0.7647 |
| Model | Type | NDCG@3 | NDCG@5 | NDCG@10 | MRR@3 | MRR@5 | MRR@10 |
|---|---|---|---|---|---|---|---|
| nrk-legal-large | dense | 0.898156 | 0.907371 | 0.911489 | 0.877344 | 0.882578 | 0.884320 |
| nrk-legal-base | dense | 0.868133 | 0.878763 | 0.882884 | 0.840885 | 0.846979 | 0.848726 |
| AITeamVN/Vietnamese_Embedding | dense | 0.821426 | 0.836150 | 0.848246 | 0.798958 | 0.807083 | 0.812062 |
| nrk-legal-base | hybrid | 0.762795 | 0.785115 | 0.805529 | 0.741667 | 0.753932 | 0.762475 |
| nrk-legal-large | hybrid | 0.764636 | 0.785280 | 0.805268 | 0.741406 | 0.752891 | 0.761298 |
| nrk-legal-small | dense | 0.737869 | 0.764900 | 0.781334 | 0.709896 | 0.724896 | 0.731839 |
| nrk-legal-small | hybrid | 0.730744 | 0.750316 | 0.769867 | 0.705990 | 0.717005 | 0.725277 |
| bkai-foundation-models/vietnamese-bi-encoder | dense | 0.732400 | 0.750763 | 0.766062 | 0.708333 | 0.718724 | 0.725125 |
| AITeamVN/Vietnamese_Embedding | hybrid | 0.706210 | 0.726386 | 0.747192 | 0.681771 | 0.693099 | 0.701738 |
| google/embeddinggemma-300m | dense | 0.691310 | 0.717132 | 0.733838 | 0.661198 | 0.675573 | 0.682778 |
| bkai-foundation-models/vietnamese-bi-encoder | hybrid | 0.677787 | 0.705491 | 0.730162 | 0.651562 | 0.666953 | 0.677379 |
| huyydangg/DEk21_hcmute_embedding | hybrid | 0.679665 | 0.699168 | 0.724153 | 0.649219 | 0.660156 | 0.670600 |
| BAAI/bge-m3 | dense | 0.672449 | 0.698202 | 0.722927 | 0.646094 | 0.660391 | 0.670585 |
| huyydangg/DEk21_hcmute_embedding | dense | 0.667296 | 0.694999 | 0.713940 | 0.638021 | 0.653411 | 0.661366 |
| BAAI/bge-m3 | hybrid | 0.650034 | 0.679015 | 0.700087 | 0.621354 | 0.637448 | 0.646053 |
| google/embeddinggemma-300m | hybrid | 0.641626 | 0.669535 | 0.689832 | 0.609896 | 0.625521 | 0.633941 |
| hiieu/halong_embedding | hybrid | 0.611511 | 0.643377 | 0.667847 | 0.585677 | 0.603177 | 0.613400 |
| intfloat/multilingual-e5-base | hybrid | 0.572895 | 0.602480 | 0.634951 | 0.543490 | 0.559896 | 0.573371 |
| hiieu/halong_embedding | dense | 0.565380 | 0.594156 | 0.619427 | 0.540885 | 0.556745 | 0.567188 |
| intfloat/multilingual-e5-base | dense | 0.528159 | 0.555258 | 0.585950 | 0.498958 | 0.514036 | 0.526622 |
| VoVanPhuc/sup-SimCSE-VietNamese-phobert-base | hybrid | 0.515176 | 0.546712 | 0.578495 | 0.486458 | 0.503958 | 0.517342 |
| bm25 | dense | 0.513687 | 0.548999 | 0.573213 | 0.485938 | 0.505859 | 0.515820 |
| VoVanPhuc/sup-SimCSE-VietNamese-phobert-base | dense | 0.405764 | 0.431859 | 0.465527 | 0.381771 | 0.396458 | 0.410246 |
@misc{nrk-legal-large,
title={kietnt0603/nrk-legal-large: A Vietnamese Legal Text Embedding Model},
author={Nguyen Tuan Kiet},
year={2025},
publisher={Hugging Face},
}