oddadmix/Nawah-Router-BERT-6M-v2

🤗 Hugging Face 来源zero-shot-classificationapache-2.06M 参数24 MBsafetensors✓ 2 个校验和今天更新
一条命令提交

在你的模型文件夹旁边运行它。它会制作种子、将文件与 Hugging Face 比对,然后提交。你只需开始做种,并粘贴你账户中的密钥。它只读取你的文件,绝不修改。如果愿意,可以先阅读脚本。

curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo oddadmix/Nawah-Router-BERT-6M-v2 ./model-folder
需要做种者 →

Nawah-Router-BERT-6M-v2 — موجّه عربي صفري

Give it a text and any categories in plain Arabic; it scores all of them in one forward pass. No fixed taxonomy. 5,977,985 parameters against Nawah-Router-v3's 52,049,409 — 8.7× smaller.

Results — it beats the 52M on three of four

All three models scored in one session by the shipped eval_router_only.py; Router-v3 reproduced its published card (0.9305 / 0.6976 / 0.6130 / 0.9008).

eval Router-v3 (Llama, 52M) BERT-6M v1 this model, v2 random
unseen category sets 0.9308 0.9137 0.9327 0.2137
unseen domains 0.6975 0.6696 0.7009 0.2521
unseen axes 0.6127 0.6024 0.6000 0.2358
deliberately adjacent categories 0.9017 0.8924 0.9101 0.2109

A 6M encoder outperforms the 52M decoder on unseen category sets (+0.2), unseen domains (+0.3) and adjacent categories (+0.8), at 1/8.7 the size.

It loses on unseen axes — 0.6000 against 0.6127 — and that is the column the original card calls its strongest claim: tools and retrieval appear nowhere in training. Note also that v2 is worse than v1 there (0.6024), the only metric across all three tasks where more pretraining hurt. Three of the four margins are under one point, which is within what a single run can tell you.

Why no pooling change was needed

RouterModel pools each category's token span via bmm(cat_pool, hidden) rather than a fixed position, so it is architecture-agnostic and a BERT backbone drops in unchanged. The sibling Nawah-Guard-BERT-6M-v2 needed a mean-pooling patch; this did not.

Usage

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

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

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

Trained on oddadmix/arabic-prompt-routing (207,097 rows, 12 axes) with the dataset's own train_router_head.py at its defaults — decoder-tuned.

© KAND CA 2026 — PROJECT NAWAH