Model reference · open weights
Diba-Embed is an open-weight embedding model from Dibachain. Diba-Embed (BF16) weighs 1.2 GB; the smallest configuration that runs it is RTX 3060 12 GB.
For self-hosting, compare this build's requirements below with the GPU you plan to rent.
Summary of the Dibachain/Diba-Embed model card, 2026-10-01
What it is
| Released by | Dibachain |
|---|---|
| Released | 2026-09-15 |
| Parameters | 596M |
| VRAM | 1.2 GB for the weights |
What it runs on
| Card | Runs | Memory |
|---|---|---|
| RTX 3060 12 GB | fits | 11.6 GB |
| RTX 4060 Ti 16 GB | fits | 15.4 GB |
| RTX 3090 24 GB | fits | 23.4 GB |
| RTX 4090 24 GB | fits | 23.4 GB |
| RTX 5090 32 GB | fits | 31.0 GB |
| L40S 48 GB | fits | 44.0 GB |
| A100 80 GB | fits | 78.2 GB |
| H100 80 GB | fits | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | fits | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | fits | 107 GB |
| H200 141 GB | fits | 138 GB |
| B200 180 GB | fits | 176 GB |
From the model card
A Persian-first text embedding model by Dibachain مدل نمایش برداری متن، فارسیمحور، ساختهی دیباچین
Website · 🤖 Agent · Chat demo (GPU) · Chat demo (CPU) · Diba-Base
Diba-Embed is the first text-embedding model from Dibachain and the first embedding model in the Diba family — a Persian-first model that turns Persian and English text into dense vectors, placing similar meanings close together. Built by Dibachain (dibachain.ir) and tuned and packaged for Iranian, Persian-language use cases where most open models fall short.
Use it to build semantic search, retrieval‑augmented generation (RAG), FAQ matching, clustering, deduplication, and reranking — in Persian, in English, and across the two.
| Parameters | ~0.6B |
| Embedding size | 1024 (Matryoshka: truncatable down to 32) |
| Max input length | 32,768 tokens |
| Languages | Multilingual, optimized for Persian + English |
| Weights | ~1.2 GB · runs on CPU |
| Similarity | cosine |
| License | Apache 2.0 |
Measured on 400 Persian question/answer pairs drawn from Diba's own grounded data (Iran history, contemporary topics, and Dibachain company Q/A). Each question must retrieve its correct passage out of the full pool. Greedy, on CPU, no task‑specific training:
| Metric | Score |
|---|---|
| Recall@1 | 82% |
| Recall@3 | 95% |
| MRR | 0.89 |
In 95% of cases the correct passage is among the top three results — enough to drive reliable Persian RAG and search.
Diba-Embed ships with the Diba model definition, so pass
trust_remote_code=Truewhen loading.
sentence-transformers (recommended):
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("Dibachain/Diba-Embed", trust_remote_code=True)
# queries use the built-in "query" prompt; documents are embedded as-is
queries = ["پایتخت ایران کجاست؟"]
documents = [
"تهران پایتخت و بزرگترین شهر ایران است.",
"اصفهان یکی از شهرهای تاریخی ایران است.",
]
q = model.encode(queries, prompt_name="query", normalize_embeddings=True)
d = model.encode(documents, normalize_embeddings=True)
scores = q @ d.T
print(scores) # highest score points to the matching document
transformers (last-token pooling, for full control):
import torch, torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer
tok = AutoTokenizer.from_pretrained("Dibachain/Diba-Embed", padding_side="left")
model = AutoModel.from_pretrained("Dibachain/Diba-Embed", trust_remote_code=True).eval()
def embed(texts, is_query=False):
if is_query:
texts = [f"Instruct: Given a query, retrieve passages that answer it\nQuery: {t}" for t in texts]
enc = tok(texts, padding=True, truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
h = model(**enc).last_hidden_state
lengths = enc["attention_mask"].sum(1) - 1
v = h[torch.arange(h.size(0)), lengths] # last non-pad token
return F.normalize(v, dim=1)
sim = embed(["پایتخت ایران؟"], is_query=True) @ embed(["تهران پایتخت ایران است."]).T
print(sim)
Tip: always add the query instruction to search queries; embed documents without it. Normalize vectors and rank by cosine (dot product of normalized vectors).
Diba-Embed ships ready-to-run llama.cpp files (GGUF format; the .bin files load directly with -m) for CPU inference with llama.cpp — no Python required.
| File | Size | Best for |
|---|---|---|
diba-embed-q8_0.bin | ~0.6 GB | recommended — near‑full quality |
diba-embed-q4_k_m.bin | ~0.4 GB | smallest, fastest |
diba-embed-f16.bin | ~1.2 GB | full precision |
# start an OpenAI-compatible embeddings server on CPU
llama-server -m diba-embed-q8_0.bin --embedding --pooling last -c 2048 --port 8080
# then request embeddings
curl http://localhost:8080/v1/embeddings -H "Content-Type: application/json" -d '{"input": ["تهران پایتخت ایران است", "capital of Iran"]}'
Direct download: https://huggingface.co/Dibachain/Diba-Embed/resolve/main/diba-embed-q8_0.bin
Diba-Embed is built for search and retrieval, not for generation — it produces vectors, not text. Quality is strongest on general and formal Persian and on the domains in the benchmark above; very specialized or noisy text may need domain adaptation. It reflects biases present in its training data. For generation and chat, use Diba-Base.
دیبا-امبد نخستین مدل بردارسازی متن (Text Embedding) شرکت دیباچین و اولین مدل امبدینگ خانوادهی دیبا است — مدلی فارسیمحور که متن فارسی و انگلیسی را به بردارهای عددی تبدیل میکند تا متنهای هممعنا در فضای برداری به هم نزدیک شوند. ساختهی شرکت دیباچین (dibachain.ir) و ویژهی کاربردهای فارسیزبان و ایرانی، جایی که
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.