Downloads · 30 days
315
9% of all-time downloads
dxtech-asia/deepx-embedding-v1
deepx-embedding-v1 is a sentence similarity model from dxtech-asia. 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.
Vietnamese Legal Document Retrieval — State-of-the-Art
Downloads · 30 days
315
9% of all-time downloads
All-time downloads
3.4K
Public
Repo size
1.6 GB
Likes
27
Public
Click a slice to open those files.
.pt1.5 GB · 98%
From the Hugging Face model README
Vietnamese Legal Document Retrieval — State-of-the-Art
DeepX Embedding v1.0 is a 772M parameter embedding model optimized for Vietnamese legal document retrieval. It combines Gated DeltaNet-2 linear attention (O(n)) with Hyperloop weight sharing to achieve strong retrieval quality while maintaining constant throughput regardless of sequence length.
nDCG@10 = 0.8162 on Zalo Legal Text Retrieval — surpassing previous SOTA (0.7813) by +4.5%.
| Model | Params | nDCG@10 |
|---|---|---|
| intfloat/multilingual-e5-large | 560M | 0.6660 |
| mainguyen9/vietlegal-e5 | 560M | 0.7310 |
| mainguyen9/vietlegal-harrier-0.6b (prev SOTA) | 600M | 0.7813 |
| DeepX Embedding v1.0 | 772M | 0.8162 |
| Dimension | nDCG@10 | Quality vs Full |
|---|---|---|
| 256 | 0.78 | ~96% |
| 512 | 0.79 | ~97% |
| 768 | 0.80 | ~98% |
| 1024 | 0.81 | ~99% |
| 1536 (full) | 0.8162 | 100% |
Input text
→ Custom Tokenizer (186,046 vocab)
→ Frozen Token Embedding (186046 × 1536)
→ Begin Block: 4 unique NarrowA layers
→ Phase1 Loop ×2: [WideA + NarrowA×4] per iteration = 10 passes
→ Phase2 Loop ×4: [NarrowB×4 + WideB] per iteration = 20 passes
→ End Block: 1 unique WideB layer
→ RMSNorm → Attention Pooling → 1536-d vector
Total: 35 compute passes. Per-loop LoRA + RoDE (Rotary Depth Embedding) differentiate each iteration.
| Component | Parameters |
|---|---|
| Token Embedding (frozen) | 286M |
| Backbone (trainable) | 486M |
| Total | 772M |
Pure linear attention with O(n) complexity. Each layer maintains a running state updated via learned decay, erase, and write gates:
state_t = decay_t * state_{t-1}
state_t -= erase_t * (erase_t @ state_t - write_t * v_t)
output_t = q_t @ state_t
No KV cache, no quadratic slowdown. Uses FLA (flash-linear-attention) Triton kernels for efficient chunk-parallel training.
| Setting | Value |
|---|---|
| GPUs | 2× RTX 5070 Ti 16GB (pipeline parallel) |
| Precision | BF16 |
| Optimizer | AdamW 8-bit |
| Sequence length | 8192 max |
| Loss | InfoNCE (τ=0.07) + Matryoshka (256, 512, 768, 1024, 1536) |
| Total training | ~600 GPU-hours |
Training pipeline: conservative training → long-sequence expose (4K-8K) → hard negative mining → domain boost.
import torch
from transformers import AutoTokenizer
from modeling.pipeline import DeepXPipeline
from config import DeepXConfig
# Load
tokenizer = AutoTokenizer.from_pretrained("dxtech-asia/deepx-embedding-v1")
config = DeepXConfig()
pipeline = DeepXPipeline.from_pretrained(config, "deepx_v1.0.pt")
pipeline.eval().cuda()
# Encode
text = "Mức phạt khi vượt đèn đỏ là bao nhiêu?"
inputs = tokenizer(text, return_tensors="pt", max_length=8192, truncation=True)
id_remap = torch.load("id_remap.pt")
input_ids = id_remap[inputs["input_ids"]]
with torch.no_grad():
embedding = pipeline.encode(input_ids.cuda(), inputs["attention_mask"].cuda())
# Shape: (1, 1536), L2-normalized
| Sequence Length | Latency (single doc) |
|---|---|
| 512 tokens | ~0.1s |
| 2048 tokens | ~0.2s |
| 8192 tokens | ~0.8s |
On RTX 5070 Ti, FP16 inference.
@misc{deepx2026embedding,
title={DeepX Embedding v1.0: Vietnamese Legal Retrieval with Gated DeltaNet-2 Linear Attention},
author={DX Tech Asia},
year={2026},
url={https://huggingface.co/dxtech-asia/deepx-embedding-v1}
}
Apache 2.0