Run this model with HF Jobs

Run orucexe/ulduz-embed on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/orucexe/ulduz-embed. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/orucexe/ulduz-embed on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Ulduz-Embed

Ulduz-Embed is a 214M-parameter multilingual embedding model with an 8,192-token context window, built with an Azerbaijani-first tokenizer (orucexe/ulduz-tokenizer-128k) for retrieval across Azerbaijani, English, Turkish, Russian, STEM, math, and code.

Property Value
Architecture GteModel (12 layers, 12 heads, 768d, RoPE 8,192)
Parameters 214M (428 MB in bfloat16)
Tokenizer orucexe/ulduz-tokenizer-128k (131,072 vocab)
Pooling / Prefix CLS + L2 normalize · no prefix required
Matryoshka 128, 256, 512, 768
Formats safetensors (bfloat16), onnx/model.onnx (fp16)
Native Support trust_remote_code=False
License Apache-2.0

Benchmarks

Evaluated on 7 official retrieval benchmarks (NDCG@10, full corpora):

# Model Params / Context Belebele-AZ AZ-MIRAGE (8K) Belebele-EN MTEB LongEmbed (4K) SciFact BRIGHT CoSQA Avg
1 Ulduz-Embed 214M / 8K 0.8748 0.5687 0.9598 0.6093 0.6665 0.1797 0.5727 0.6331
2 Alibaba-NLP/gte-multilingual-base 305M / 8K 0.8541 0.4857 0.9464 0.6410 0.7292 0.1838 0.5778 0.6311
3 BAAI/bge-m3 568M / 8K 0.9030 0.6211 0.9562 0.6078 0.6442 0.0894 0.4926 0.6163
4 intfloat/multilingual-e5-large 560M / 512 0.8701 0.5087 0.9654 0.4417 0.7037 0.2277 0.5698 0.6124
5 LocalDoc/LocRet-small 118M / 512 0.8685 0.4485 0.9303 0.3951 0.6167 0.1286 0.4654 0.5504
6 LocalDoc/az-en-MiniLM-L6-v2 30M / 512 0.8184 0.3828 0.8844 0.2081 0.4186 0.0363 0.1489 0.4139
7 LocalDoc/TEmA-small 141M / 512 0.7248 0.3772 0.8138 0.2422 0.3725 0.0336 0.1901 0.3935
8 vrashad/az-legal-retrieval-xlm 278M / 512 0.6866 0.3443 0.7593 0.2412 0.3929 0.0363 0.1734 0.3763
9 sayqin/azerbaijani-sentence-embedding-v1 135M / 512 0.7414 0.5087 0.5775 0.1981 0.1839 0.0110 0.0282 0.3213

Additional notes:

  • Turkish & Russian: Belebele-TR = 0.8597, Belebele-RU = 0.8835, MTEB MLDR-RU (4K, 10K docs) = 0.4605 (55.0% R@10).
  • AZ-MIRAGE Deep (>512 tokens, 3,753 queries): 0.5201 NDCG@10 (vs. gte-multilingual-base 0.4264, multilingual-e5-large 0.4082, LocRet-small 0.3149).
  • AZ-STS (7 official Azerbaijani STS tasks): 0.7392 average Pearson correlation.

Training

  • Base & Tokenizer: Initialized from Alibaba-NLP/gte-multilingual-base (305M, 250K vocab) and adapted to orucexe/ulduz-tokenizer-128k (131K vocab), reducing parameters to 214M.
  • Stages:
    1. Embedding Alignment (~800K pairs): Aligned the new 131K vocabulary embeddings to the base representation space.
    2. Retrieval & Distillation (~1.18M pairs + 4K/8K curriculum): Contrastive InfoNCE (with false-negative masking), cross-encoder distillation (Listwise KL + Margin-MSE, GradCache), and Matryoshka loss (128–768d) across AZ, EN, TR, RU, STEM/LaTeX, and code.
    3. Hard-Negative Refinement & SLERP: Self-mined Azerbaijani hard negatives followed by SLERP checkpoint merging.
  • Data Filtering: Document-level deduplication and leakage filtering against evaluation benchmarks.
  • Hardware: 1x NVIDIA A100 (80 GB), bfloat16, ~15 hours total.

Usage

sentence-transformers

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("orucexe/ulduz-embed")

sentences = [
    "Azərbaycanın paytaxtı haradır?",
    "Bakı Azərbaycan Respublikasının paytaxtı və ən böyük şəhəridir.",
]
embeddings = model.encode(sentences, normalize_embeddings=True)
print(embeddings @ embeddings.T)

For smaller Matryoshka dimensions (128, 256, 512):

model = SentenceTransformer("orucexe/ulduz-embed", truncate_dim=256)

transformers

import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer

model_id = "orucexe/ulduz-embed"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModel.from_pretrained(model_id, torch_dtype=torch.bfloat16).eval()

def embed(texts: list[str], dim: int | None = None, max_length: int = 8192) -> torch.Tensor:
    inputs = tokenizer(texts, padding=True, truncation=True, max_length=max_length, return_tensors="pt")
    with torch.no_grad():
        vecs = model(**inputs).last_hidden_state[:, 0].float()  # CLS pooling
    if dim is not None:
        vecs = vecs[:, :dim]
    return F.normalize(vecs, p=2, dim=-1)

q_emb = embed(["Azərbaycanın paytaxtı haradır?"])
d_emb = embed([
    "Bakı Azərbaycan Respublikasının paytaxtı və ən böyük şəhəridir.",
    "Python proqramlaşdırma dili geniş istifadə olunur.",
])
print((q_emb @ d_emb.T).squeeze(0).tolist())

ONNX Runtime

onnx/model.onnx (fp16, 428 MB) matches PyTorch outputs (1.0000 cosine similarity):

import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from tokenizers import Tokenizer

tok = Tokenizer.from_file(hf_hub_download("orucexe/ulduz-embed", "tokenizer.json"))
sess = ort.InferenceSession(
    hf_hub_download("orucexe/ulduz-embed", "onnx/model.onnx"),
    providers=["CPUExecutionProvider"],
)

enc = tok.encode("Azərbaycanın paytaxtı haradır?")
out = sess.run(None, {
    "input_ids": np.array([enc.ids], dtype=np.int64),
    "attention_mask": np.array([enc.attention_mask], dtype=np.int64),
})[0]

vec = out[:, 0, :]
vec = vec / np.linalg.norm(vec, axis=-1, keepdims=True)

License

Apache-2.0

Downloads last month
-
Safetensors
Model size
0.2B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for orucexe/ulduz-embed

Quantized
(18)
this model