Instructions to use oddadmix/Nawah-Math-Reasoning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use oddadmix/Nawah-Math-Reasoning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="oddadmix/Nawah-Math-Reasoning") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("oddadmix/Nawah-Math-Reasoning") model = AutoModelForCausalLM.from_pretrained("oddadmix/Nawah-Math-Reasoning", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use oddadmix/Nawah-Math-Reasoning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "oddadmix/Nawah-Math-Reasoning" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oddadmix/Nawah-Math-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/oddadmix/Nawah-Math-Reasoning
- SGLang
How to use oddadmix/Nawah-Math-Reasoning with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "oddadmix/Nawah-Math-Reasoning" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oddadmix/Nawah-Math-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "oddadmix/Nawah-Math-Reasoning" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oddadmix/Nawah-Math-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use oddadmix/Nawah-Math-Reasoning with Docker Model Runner:
docker model run hf.co/oddadmix/Nawah-Math-Reasoning
title: Nawah Math Reasoning
emoji: 🧠
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 6.26.0
python_version: '3.12'
app_file: app.py
pinned: false
models:
- oddadmix/Nawah-Math-Reasoning
datasets:
- oddadmix/arabic-math-reasoning-synth
- oddadmix/gsm8k-reasoning-ar
short_description: نموذج استدلال رياضي عربي (52M) يفكّر خطوة بخطوة قبل الإجابة
Nawah-Math-Reasoning — Demo
A 51.8M-parameter Arabic math reasoning model. It writes its derivation inside
<think>…</think> and then gives the final answer; the demo splits the two live as it streams —
the reasoning trace in one panel, the answer in the other.
Fine-tuned from oddadmix/50M-2048-Emhotob,
a Llama-architecture base pre-trained from scratch on ~20B Arabic tokens (12 layers, hidden 512,
2048 context).
بالعربية: نموذج عربي صغير (~52 مليون معامل) يكتب خطوات تفكيره داخل وسم
<think>ثم يعطي الإجابة النهائية. الديمو بيفصل الاتنين وانت بتتفرج على النموذج وهو بيكتب.
Everything is open — Apache 2.0
| 🧠 Model | oddadmix/Nawah-Math-Reasoning |
| 🛠️ Training code | code/ — data generation, translation, SFT, eval, GRPO |
| 📚 Synthetic corpus | oddadmix/arabic-math-reasoning-synth — 120,462 arithmetically verified rows |
| 📚 Translated corpus | oddadmix/gsm8k-reasoning-ar — 142,969 rows |
Results
Number agreement, greedy decoding, on held-out splits. Every version of the model was scored on identical rows, so the numbers are comparable across the whole development ladder.
| eval set | n | score |
|---|---|---|
| GSM8K-ar | 600 | 79.0% |
| Arabic_Reasoning | 400 | 73.0% |
| synthetic math | 1000 | 40.4% |
| synthetic relational | 400 | 52.2% |
The last row is what this release adds: problems where the difficulty is the relation between
quantities (ضعف, نصف, أكثر بـ…) rather than the arithmetic. The previous version scored
34.0% there — the relation appeared in barely 1.3% of the training corpus, so 20,139 rows were
generated specifically to fill the gap.
Limitations
A 52M proof of concept. It reliably produces the shape of Arabic step-by-step reasoning, but arithmetic errors are the dominant failure mode — the derivation is usually structurally right, one computation is wrong, and the model then stays faithful to its own bad number. The 40.4% and 52.2% above are the honest ceiling on multi-step problems. Single-turn only; open-ended and non-mathematical questions are out of distribution.
نموذج تجريبي: بيعرف يمشي خطوة خطوة بالعربي، بس بيغلط في الحساب كتير.
Runs on ZeroGPU. The model is small enough for CPU too — switch the Space to cpu-basic and
it still works, just slower.
Configuration
| Variable | Purpose |
|---|---|
MODEL_ID |
Model repo to load (default oddadmix/Nawah-Math-Reasoning) |
MODEL_HF_TOKEN |
Only needed if MODEL_ID points at a private repo. (HF_TOKEN is reserved by Spaces and does not reach the container.) |