Muslim-1 2B

Muslim-1 2B is Gemma 4 E2B fine-tuned for an offline Islamic study app on iPhone, answering in English, Urdu, roman Urdu and Arabic. Instead of quoting scripture from memory, it calls tools that read the Quran, a short tafsir, Hisn al-Muslim and the Saudi Ministry of Hajj and Umrah guides from a database on the device, and answers from what the tool returned. This repository holds the MLX weights (3.5 GB). The layers are 8-bit and the per-layer embedding table is 4-bit, so the model fits in memory on a 6 GB iPhone.

What the model does

The model handles these requests:

  • Recite an ayah: calls get_ayah and shows the exact Uthmani text with its reference
  • Explain an ayah: calls get_tafsir and answers from the translation and tafsir it fetched
  • Find an ayah from a fragment: calls find_ayah
  • Give a dua for an occasion: calls find_duas, then get_dua, and shows the Arabic, transliteration, meaning and dua number
  • Explain a Hajj or Umrah rite: calls get_guide_step and shows the ministry’s text with its page
  • Prayer times, Qibla, Hijri date: calls prayer_times, qibla or hijri_date
  • Rulings: refers you to a qualified scholar of your madhhab
  • Takfir, sectarian or political verdicts: refuses

When the dua book has nothing for an occasion, the model says so. It does not compose a dua.

What you need to run it

The weights answer well only with the nine tools and the database they read, which live in the app. The app also wraps the model in three checks written in code:

  • Reference parser: reads 2:255 or “Al-Baqarah 255” from your message and corrects the model’s tool arguments
  • Guide guard: blocks get_guide_step when the conversation has no Hajj or Umrah vocabulary
  • Verifier: restores tool text the model copied with mistakes, removes Arabic it wrote without fetching, and fixes wrong citations

Thinking mode must stay off. Render the chat template with enable_thinking=false.

Evaluation

All numbers are for the model with the three code checks active. The benchmark has 588 held-out questions in English, Urdu, roman Urdu and Arabic, and none of them shares a five-word sequence with the training templates.

Benchmark metric Score
Tool selection 97.4%
Tool arguments 96.5%
Recited ayah shown exactly 98.9%
Explanation shows the right ayah 96.2%
Defers a ruling 100%
Refuses takfir and political verdicts 93.9%
Says it doesn’t know when it has no source 93.9%
Calls a tool when none is needed 2.9%
Multi-turn tool use 96.0%
Intent router 93.5%

A second test has 54 held-out questions about duas and the guides:

Held-out knowledge metric Score
Right dua shown 90%
Says “not found” for an occasion the book lacks 100%
Guide answer uses the ministry’s text 100%
Guide answer uses the most relevant section 88%
Leaves the new tools alone on unrelated questions 100%

Known problems

  • Guide section choice: the model picks a neighbouring section in about one guide question in eight. The text shown is always the ministry’s, but it may not be the most relevant part.
  • Talbiyah wording: asked for the full talbiyah, the model opens the guide’s talbiyah section, which quotes only its first words, instead of the dua book.
  • Refusal wording: some takfir and voting questions get the “ask a scholar” reply instead of the refusal. The model still declines.
  • Definitions treated as lookups: “What is the qibla?” can return your live Qibla bearing instead of a definition.
  • Prompt length: the tool definitions take 2,054 tokens. On an M-series Mac the first token arrives after 1.5s, so cache the processed system prompt across turns.
  • Guide language: the ministry text is stored in English only. Urdu and Arabic users get a lead-in line in their language, then the English text.
  • Dua translations: Hisn al-Muslim is stored with English meanings only. Arabic users see the Arabic alone.
  • Quantization: 4-bit layers erase the fine-tune, so the layers stay 8-bit. Only the per-layer embedding table is 4-bit, which cost one of 25 guide questions in the knowledge eval.

No scholar has reviewed the model, the stored texts or the training data. Treat it as a study aid.

Sources

The database and the training data come from these sources:

  • Quran text: Tanzil, in the Uthmani and Simple scripts
  • Translations: Maududi, Junagarhi and Ahmed Ali (Urdu), Sahih International (English)
  • Tafsir: Al-Muyassar and Al-Mukhtasar, from tafsir-mcp-data (CC BY 4.0)
  • Duas: Hisn al-Muslim by Sa’id bin Ali bin Wahf al-Qahtani, 267 duas in 132 chapters, from the hisnmuslim.com API
  • Hajj and Umrah: the Ministry of Hajj and Umrah’s Hajj Awareness Guide and Umrah & Visit Guide, 45 sections transcribed word for word

Training

Training has two steps on Gemma 4 E2B:

  1. Continued pretraining on Arabic, Urdu and English text, including tafsir and Wikipedia
  2. Low-rank adaptation (LoRA) fine-tuning at rank 32, one epoch, learning rate 1e-5, on 55,777 rows rendered with the full tool definitions the app sends: tool conversations built from the database, deferrals, refusals, honest “I don’t know” replies, and 5,000 documents replayed from step 1

The replay preserves the model’s general Urdu, Arabic and English.

Load the weights

This snippet loads the weights with mlx-lm. It does not give you the tools.

from mlx_lm import load

model, tokenizer = load("mukaddamzaid/Muslim-1-2B-MLX-8bit")

License

The weights are a derivative of Gemma 4. Your use is subject to the Gemma Terms of Use.

Downloads last month
-
Safetensors
Model size
5B params
Tensor type
U32
·
BF16
·
MLX
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for mukaddamzaid/Muslim-1-2B-MLX-8bit

Quantized
(346)
this model