Rattil Ayah Embed

Sentence embedder for Quran ayahs. Rattil uses it to pick confusable wrong answers for its challenges (ayahs and words that are close in meaning). It is a fine-tune of Omartificial-Intelligence-Space/Arabic-Triplet-Matryoshka-V2 (Apache-2.0, 135M parameters), which beat seven larger and Quran-tuned models on QurSim.

Results

QurSim verse pairs linked by Ibn Kathir's tafsir. 20% of verses are held out by a hash of the verse number: no training pair touches them. 459 held-out queries rank their strongly related partners among all 4,114 verses.

Recall@10, 768-d MRR, 768-d Recall@10, 256-d MRR, 256-d
Arabic-Triplet-Matryoshka-V2 (base) 0.308 0.252 0.286 0.236
rattil-ayah-embed 0.374 0.319 0.371 0.301

The Rattil index stores the first 256 dimensions as int8.

Training

1,645 QurSim strongly related pairs, MatryoshkaLoss (768/512/256/128/64) over MultipleNegativesRankingLoss, 3 epochs, batch 32, lr 2e-5, seed 13. The details are in rattil_training.json; the script is src/learning/train_ayah_embedder.py in the app repo.

Use

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("Mathani-Ayat/rattil-ayah-embed", truncate_dim=256)
vectors = model.encode(["قل هو الله احد", "الله الصمد"], normalize_embeddings=True)

In the Rattil app, python src/deployment/pull_hf_assets.py --models ayah-embed puts it in runs/rattil_ayah_embed, and python src/learning/build_text_embeddings.py builds the index from it.

Limits

  • QurSim uses Hafs spelling and numbering, and reflects one tafsir's links.
  • The QurSim data license is not established. Keep private and research-only.
Downloads last month
14
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Mathani-Ayat/rattil-ayah-embed