CoolFace
Modelpublic

oddadmix/Nawah-Router-v3

sourceHugging Faceapache-2.0updated 26d agoView on Hugging Face
0likes82downloads
Model Card

Nawah-Router-v3 — موجّه عربي صفري

52M parameters. Give it a text and any categories in plain Arabic; it scores all of them in one forward pass. Categories are chosen at inference — no fixed taxonomy.

بالعربية: نموذج عربي يوجّه أي نص إلى فئة من فئات تكتبها أنت بلغة طبيعية، في مسار واحد.

Results

Trained on `oddadmix/arabic-prompt-routing` (233,720 rows, 12 routing axes).

evalv3v2 (51K corpus)random
unseen category sets0.93050.91990.2137
unseen domains0.69760.66650.2521
unseen axes0.6130(n/a)0.2358
deliberately adjacent categories0.90080.91490.2109

unseen_axis is the strongest claim here: tools and retrieval appear nowhere in training, and the model still routes along them at 0.61 against a 0.24 baseline.

Usage

python
from transformers import AutoTokenizer
from routing_model import RouterModel, route      # ships in this repo

M = "oddadmix/Nawah-Router-v3"
tok = AutoTokenizer.from_pretrained(M)
model = RouterModel.from_pretrained(M)

route(model, tok, "كم صار سعر صرف الدولار اليوم؟",
      ["بحث في الويب", "حاسبة", "تقويم ومواعيد", "لا يحتاج أداة"])

Choosing a checkpoint

No single configuration wins everything, and the trade-off is real:

epochsunseen lanesunseen domainsunseen axes
10.93270.69680.5950
2 (this)0.93050.69760.6130
30.91810.64960.6376

Longer training helps the hardest transfer (unseen axes) and costs the everyday cases. 2 epochs is shipped as the balance. Higher learning rates are simply worse — 6e-4 and 1e-3 both degrade.

How the head works

Text and categories share one sequence, text first. Each category's span is mean-pooled into its own vector and a shared scorer turns each into one logit; the softmax runs over the categories supplied. Because the scorer is shared it reads category content, not slot index — which is what makes the label set free text.

A fixed-slot head (num_labels = max_lanes) scored exactly 1/n at every lane count: its weights were positional, and the corpus randomises category order, so there was nothing to learn.

Limitations

Unseen domains (0.70) and unseen axes (0.61) trail unseen category sets (0.93) — it generalises best inside verticals and dimensions it has seen. Confidence is not calibrated: clear cases saturate near 1.0, so use the ranking, not the number. Arabic, 1–3 line messages.

3 epochs at LR 3e-4 cosine, batch 32, bf16, max_length 320.

oddadmix/Nawah-Router-v3 · CoolFace