Model reference · open weights
Diba-Embed is an open-weight embedding model from Dibachain. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | Dibachain |
|---|---|
| Type | Embedding models |
| Task | Embeddings |
| Parameters (lead) | 596M |
| Context | 32k tokens |
| Runs with | sentence-transformers |
| Released | 2026-09-15 |
| Popularity | 566 downloads / month |
| Licence | Open weights |
About
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) و ویژهی کاربردهای فارسیزبان و ایرانی، جایی که
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys diba-embed for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (diba-embed below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/embeddings \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"diba-embed","input":"text to embed"}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.