Skip to content
fstandhartingerPublic

About

Weiche: a small local (ONNX/WebGPU) decision model for LLM auto-routing. ModernBERT-large + typed routing heads.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weiche: a small local decision model for LLM auto-routing

Model: benchmarkheaven/weiche-395m (Apache-2.0) · used by auto-model-router as classifier: {backend: local-route-head}

Weiche is ModernBERT-large (395M) with typed routing heads. It reads one user turn and returns, in a single forward pass:

  • the task category;
  • difficulty and stakes;
  • whether the turn needs tools, vision or long context, or is a follow-up;
  • the probability that a small, a mid and a strong model tier would succeed.

It runs locally through ONNX (CPU, or WebGPU in the browser). On the same busy CPU it is about 38× faster than the router's current local classifier. On held-out routing data it matches or beats the hosted Jev API path.

Classifier Category acc. (held-out, n=1134) Macro-F1 Category acc. on the router's own 70 held-out tasks needs_tools acc. Difficulty rank corr.
Weiche-395M (this model) 88.5 % 0.872 94.9 % (59 tasks) 98.4 % 0.739
Weiche-0.6B arm (Qwen3-0.6B, not released) 88.5 % 0.873 98.3 % (59 tasks) 99.2 % 0.736
hosted Jev 1.13 (API) 85.8 % 0.843 79.7 % (59 tasks) 96.0 % 0.753
Laya 421M (router local backend) 9.3 % 0.112 33.9 % (59 tasks) 80.5 % 0.297

RouterBench held-out (n=1500; tiers Mistral-7B / Mixtral-8x7B / GPT-4-1106)

Decision path Avg. gap recovered (APGR) Quality at 10 % of strong-tier cost at 25 % Cost share to recover 80 % of the gap 95 % of the gap
Router heuristic (no classifier) 0.494 47.2 % 47.2 % 100.0 % 100.0 %
Laya 421M (router local backend) + fitted calibration 0.812 48.9 % 53.8 % 38.9 % 79.5 %
hosted Jev 1.13 (API) + fitted calibration 0.850 50.3 % 59.6 % 28.2 % 86.2 %
Weiche-395M traits + fitted calibration 0.834 48.7 % 58.2 % 41.0 % 88.1 %
Weiche-395M success heads 0.862 51.4 % 59.0 % 31.4 % 65.2 %
Weiche-0.6B arm success heads 0.864 51.8 % 59.0 % 30.4 % 68.7 %

Always-small quality 28.4 %, always-mid 47.2 %, always-strong 68.6 %. An oracle that knows every outcome matches always-strong quality at 17.1 % of its cost and tops out at 77.2 %.

Measured router-style tasks finished after the data freeze (n=1103; tiers Mistral-Nemo-12B / Gemma-4-31B / DeepSeek-V3.2)

Decision path Avg. gap recovered (APGR) Quality at 10 % of strong-tier cost at 25 % Cost share to recover 80 % of the gap 95 % of the gap
Router heuristic (no classifier) 0.459 42.5 % 42.5 % 60.8 % 60.8 %
Laya 421M (router local backend) + fitted calibration 0.747 48.2 % 64.1 % 47.5 % 56.2 %
hosted Jev 1.13 (API) + fitted calibration 0.734 48.9 % 56.4 % 50.5 % 56.9 %
Weiche-395M traits + fitted calibration 0.772 52.4 % 62.4 % 44.0 % 54.4 %
Weiche-395M success heads 0.803 52.9 % 72.4 % 44.5 % 52.7 %
Weiche-0.6B arm success heads 0.805 54.0 % 71.4 % 41.9 % 52.7 %

Always-small quality 42.5 %, always-mid 95.0 %, always-strong 94.0 %. An oracle that knows every outcome matches always-strong quality at 38.3 % of its cost and tops out at 98.6 %.

CPU latency per decision, 4 threads, same busy host p50 p95
Weiche-395M ONNX int4 288 ms 393 ms
Weiche-395M ONNX int8 (lossy) 243 ms 382 ms
Weiche-395M ONNX fp16 386 ms 545 ms
Laya 421M (PyTorch, 7 questions) 11061 ms 12308 ms

See the model card for usage and limits.

What is in this repo

Path What
scripts/build_outcome_sources.py normalises RouterBench, EmbedLLM, RouteLLM and Arena-55k into one row format (prompts + numeric outcome labels only)
scripts/traits_lane.py, author_prompt.md, label_prompt.md synthetic router turns and two-family blind trait labelling (author + critic from another model family; category must agree)
scripts/measured_lane.py procedurally generated tasks with gold answers computed by code, run on three real model tiers (outcome, tokens, cost, latency)
scripts/assemble.py licence filter, split by question hash, router-state (cache / latency / value) oracle route labels
scripts/pod/ model + heads (routerhead.py), training, prediction, ONNX export (fp16 / int8 / int4) and quantisation check
scripts/evaluate.py, tables.py held-out evaluation against the router's heuristic, Laya and hosted Jev paths
results/ the evaluation JSON behind every number above
webgpu-smoke/ onnxruntime-web WebGPU check (int4 graph, outputs match CPU within 1e-4)
data/ our own data, CC-BY-4.0: 3,794 synthetic router turns with two-family agreed labels, and 2,965 measured tasks with per-tier outcomes, costs and latencies
DATA-LICENCES.md every source and its licence

The public datasets are not redistributed here. build_outcome_sources.py rebuilds them from their original locations.

No TypeSafe/Jev output was used for training. Hosted Jev appears only as an evaluation baseline, run after training had finished.

Licence

Code: Apache-2.0. Our data: CC-BY-4.0. Public datasets keep their own licences.

About

Weiche: a small local (ONNX/WebGPU) decision model for LLM auto-routing. ModernBERT-large + typed routing heads.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages