Instructions to use mukaddamzaid/Muslim-1-2B-MLX-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mukaddamzaid/Muslim-1-2B-MLX-8bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mukaddamzaid/Muslim-1-2B-MLX-8bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use mukaddamzaid/Muslim-1-2B-MLX-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mukaddamzaid/Muslim-1-2B-MLX-8bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mukaddamzaid/Muslim-1-2B-MLX-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mukaddamzaid/Muslim-1-2B-MLX-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mukaddamzaid/Muslim-1-2B-MLX-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mukaddamzaid/Muslim-1-2B-MLX-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mukaddamzaid/Muslim-1-2B-MLX-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use mukaddamzaid/Muslim-1-2B-MLX-8bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mukaddamzaid/Muslim-1-2B-MLX-8bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mukaddamzaid/Muslim-1-2B-MLX-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mukaddamzaid/Muslim-1-2B-MLX-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mukaddamzaid/Muslim-1-2B-MLX-8bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mukaddamzaid/Muslim-1-2B-MLX-8bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
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_ayahand shows the exact Uthmani text with its reference - Explain an ayah: calls
get_tafsirand 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, thenget_dua, and shows the Arabic, transliteration, meaning and dua number - Explain a Hajj or Umrah rite: calls
get_guide_stepand shows the ministry’s text with its page - Prayer times, Qibla, Hijri date: calls
prayer_times,qiblaorhijri_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:255or “Al-Baqarah 255” from your message and corrects the model’s tool arguments - Guide guard: blocks
get_guide_stepwhen 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:
- Continued pretraining on Arabic, Urdu and English text, including tafsir and Wikipedia
- 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
- -
8-bit