--- 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 `` 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`](https://huggingface.co/oddadmix/50M-2048-Emhotob), a Llama-architecture base pre-trained from scratch on ~20B Arabic tokens (12 layers, hidden 512, 2048 context). > **بالعربية:** نموذج عربي صغير (~52 مليون معامل) يكتب خطوات تفكيره داخل وسم `` ثم يعطي > الإجابة النهائية. الديمو بيفصل الاتنين وانت بتتفرج على النموذج وهو بيكتب. ## Everything is open — Apache 2.0 | | | |---|---| | 🧠 **Model** | [`oddadmix/Nawah-Math-Reasoning`](https://huggingface.co/oddadmix/Nawah-Math-Reasoning) | | 🛠️ **Training code** | [`code/`](https://huggingface.co/oddadmix/Nawah-Math-Reasoning/tree/main/code) — data generation, translation, SFT, eval, GRPO | | 📚 **Synthetic corpus** | [`oddadmix/arabic-math-reasoning-synth`](https://huggingface.co/datasets/oddadmix/arabic-math-reasoning-synth) — 120,462 arithmetically verified rows | | 📚 **Translated corpus** | [`oddadmix/gsm8k-reasoning-ar`](https://huggingface.co/datasets/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.) |