Unlike standard softmax attention (O(n²)), GDN-2 uses a gated delta rule recurrence computed via chunked parallel scan. This gives:
Per-iteration LoRA (rank 16) differentiates each pass within a loop.
Linear attention maintains constant speed regardless of sequence length.
1import torch
2from transformers import AutoTokenizer
3
4# Load
5tokenizer = AutoTokenizer.from_pretrained("google/gemma-4-E2B-it")
6# Load model (see repo for full pipeline code)
7model = load_deepx_model("deepx_v09.pt")
8
9# Encode
10text = "Mức phạt khi vượt đèn đỏ là bao nhiêu?"
11inputs = tokenizer(text, return_tensors="pt", max_length=2048, truncation=True)
12with torch.no_grad():
13 embedding = model(inputs["input_ids"], attention_mask=inputs["attention_mask"], normalize=True)
14# embedding.shape = (1, 1536)
15
16# Matryoshka: use first N dims
17embedding_256d = embedding[:, :256] # 90% quality, 6x less storage
1@misc{deepx2026,
2 title={DeepX: Vietnamese Embedding Model with Gated DeltaNet-2 Linear Attention},
3 author={DXTech Asia},
4 year={2026},
5 url={https://huggingface.co/dxtech-asia/deepx-embedding-v09}
6}
Apache 2.0 (code) / Model weights follow Gemma license terms.