Nawah-Router-Demo / README.md
oddadmix's picture
Upload README.md with huggingface_hub
0aaaec8 verified
|
Raw
History Blame Contribute Delete
4.09 kB
---
title: Nawah Router
emoji: 🧭
colorFrom: green
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
models:
- oddadmix/Nawah-Router-BERT-6M-v2
- oddadmix/Nawah-Router-v3
- oddadmix/Nawah-Router-BERT-6M-bilingual-pretrained
- oddadmix/Nawah-BERT-6M-v2
- oddadmix/Nawah-BERT-6M-bilingual
datasets:
- oddadmix/arabic-prompt-routing
- oddadmix/prompt-routing-en
tags:
- arabic
- english
- zero-shot-classification
- prompt-routing
short_description: توجيه عربي وإنجليزي صفري للفئات الحرة
---
# Nawah-Router — Arabic + English zero-shot prompt routing
Write a text and **any categories, in plain Arabic or English**; the model scores all of them in
a single forward pass. Categories are free text typed at runtime — the model has no fixed
taxonomy, so this is zero-shot classification over a label set it has never seen. Language is
detected automatically from the text.
Edit any category inline, add or remove lanes, and the routing updates as you type.
Counterpart to [LFM2.5-Encoder-350M-Prompt-Router](https://huggingface.co/LiquidAI/LFM2.5-Encoder-350-Prompt-Router).
## Three backbones, one head — switch from the picker
| | [`Nawah-Router-BERT-6M-v2`](https://huggingface.co/oddadmix/Nawah-Router-BERT-6M-v2) | [`Nawah-Router-v3`](https://huggingface.co/oddadmix/Nawah-Router-v3) | [`Nawah-Router-BERT-6M-bilingual-pretrained`](https://huggingface.co/oddadmix/Nawah-Router-BERT-6M-bilingual-pretrained) |
|---|---:|---:|---:|
| parameters | **5,977,985** | 52,049,409 | 5,977,985 |
| backbone | BERT encoder | Llama decoder | BERT encoder |
| languages | Arabic only | Arabic only | **Arabic + English** |
| base model | [`Nawah-BERT-6M-v2`](https://huggingface.co/oddadmix/Nawah-BERT-6M-v2) | `50M-2048-Emhotob` | [`Nawah-BERT-6M-bilingual`](https://huggingface.co/oddadmix/Nawah-BERT-6M-bilingual) |
The two Arabic-only backbones, scored in one session by the same `eval_router_only.py`
(Router-v3 reproduced its published card exactly):
| eval set | **6M encoder** | 52M decoder | random |
|---|---:|---:|---:|
| unseen category sets | **0.9327** | 0.9308 | 0.2137 |
| unseen domains | **0.7009** | 0.6975 | 0.2521 |
| deliberately adjacent categories | **0.9101** | 0.9017 | 0.2109 |
| unseen axes (dimensions absent from training) | 0.6000 | **0.6127** | 0.2358 |
The 6M wins three of four at **1/8.7 the size**. It loses on unseen axes — the column the 52M's
card calls its strongest claim — and three of the four margins are under one point, which is
inside what a single run can tell you.
The bilingual 6M — same architecture, pretrained from scratch on 5B Arabic + 5B English tokens
with a shared 32K tokenizer, then given a router head trained on both languages together — closes
most of the English gap an Arabic-only backbone has on this task, at a small Arabic cost on the
hardest split:
| eval set | **bilingual 6M — English** | **bilingual 6M — Arabic** | Arabic-only 6M (Arabic) |
|---|---:|---:|---:|
| unseen category sets | 0.9246 | 0.9305 | 0.9327 |
| unseen domains | 0.6946 | 0.6911 | 0.7009 |
| unseen axes | 0.6594 | 0.5697 | 0.6000 |
| deliberately adjacent categories | 0.9066 | 0.9101 | 0.9101 |
Full 3-way comparison, including the finding that an English-only router head on the Arabic-only
backbone learns nothing at all, in the [model card](https://huggingface.co/oddadmix/Nawah-Router-BERT-6M-bilingual-pretrained).
Confidence is not calibrated: clear cases saturate near 100%. Use the ranking, not the number.
Data: [`oddadmix/arabic-prompt-routing`](https://huggingface.co/datasets/oddadmix/arabic-prompt-routing)
(207,097 training rows, 58,008 distinct category sets, 12 routing axes) and its English
counterpart [`oddadmix/prompt-routing-en`](https://huggingface.co/datasets/oddadmix/prompt-routing-en)
(173,223 training rows) — both natively generated per language, not translations of each other,
with the full generation and verification pipeline.
CPU-only, one forward pass regardless of how many categories you give it.
© KAND CA 2026 — PROJECT NAWAH