Noql: A Tiny and Efficient Persian Text Embedding Model

Noql is a Persian sentence embedding model with only 12M parameters. It is trained with Matryoshka representation learning, so its 768-dimensional embeddings can be truncated to 512, 256, 128 or 64 dimensions with little loss in quality.

Parameters 11.9M
Architecture ALBERT-base, mean pooling, L2-normalized
Embedding size 768 (Matryoshka: 512 / 256 / 128 / 64)
Max sequence length 512 tokens
Similarity cosine

Training

Noql was trained on the Shiraz dataset in two stages:

  1. Positive pairs: query–document pairs with in-batch negatives.
  2. Hard negatives: half positive pairs, half pairs with mined hard negatives.

Each stage used 2M random samples.

Usage

pip install -U sentence-transformers
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("shekar-ai/Noql")

sentences = [
    "پایتخت ایران تهران است.",
    "تهران بزرگ‌ترین شهر ایران است.",
    "امروز هوا بارانی است.",
]
embeddings = model.encode(sentences)
print(model.similarity(embeddings, embeddings))
# tensor([[1.0000, 0.8143, 0.3462],
#         [0.8143, 1.0000, 0.2109],
#         [0.3462, 0.2109, 1.0000]])

Retrieval

query = "بهترین زمان برای سفر به شیراز چه موقع است؟"
documents = [
    "بهار به دلیل هوای معتدل و شکوفه‌های نارنج بهترین فصل سفر به شیراز است.",
    "قیمت طلا در بازار امروز کاهش یافت.",
    "حافظیه و سعدیه از جاذبه‌های معروف شیراز هستند.",
]
scores = model.similarity(model.encode(query), model.encode(documents))
print(scores)
# tensor([[0.8091, 0.0271, 0.5199]])

Smaller embeddings

model = SentenceTransformer("shekar-ai/Noql", truncate_dim=256)
embeddings = model.encode(documents)  # shape: (3, 256)

Evaluation

Results on FaMTEB (MTEB(fas, v2), all 52 tasks) at each embedding size.

Metric 768 512 256 128 64
Mean (task) 58.21 57.97 57.54 56.96 55.61
Mean (type) 61.63 61.46 61.12 60.72 59.66
% of 768 score 100% 99.6% 98.8% 97.9% 95.5%
Storage per vector (fp32) 3,072 B 2,048 B 1,024 B 512 B 256 B
Task type Tasks 768 512 256 128 64
Retrieval 17 47.20 47.19 46.80 46.07 43.87
Reranking 2 64.16 64.22 63.77 63.61 63.09
Pair Classification 7 79.94 79.98 80.03 80.04 79.97
Classification 16 58.98 58.44 57.56 56.67 55.29
Clustering 5 60.48 59.47 60.08 59.76 60.06
STS 2 71.37 71.40 71.32 71.25 71.19
Bitext Mining 3 49.24 49.52 48.31 47.65 44.15
Downloads last month
20
Safetensors
Model size
11.9M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for shekar-ai/Noql

Finetuned
(5)
this model

Dataset used to train shekar-ai/Noql

Space using shekar-ai/Noql 1