Skip to content

Jev Models & Reimplementations

Model routers: choosing a decision model per request

A router is a decision model with a different job. How to cascade rules, small models, and humans without turning the agent into a chain of calls.
Published
Category
Jev Models & Reimplementations
Resources cited
8
Reading time
5 min
Tags#models#routing#agents#cost

A router is a decision model with a different job: instead of answering the user, it answers “which path should this request take?” That makes it one of the most practical places to put a fast model, and one of the easiest to overbuild.

The useful pattern is a cascade, not a single classifier. Cheap deterministic checks first, then a small decision model, then a larger model or a human only when the earlier tiers cannot decide. The Hybrid Intent Router is a clean example: regex and tries, then TF-IDF with CatBoost, then System One models (Laya, Jev, CLM), then a generative LLM fallback. Every exit leaves a replayable decision record.

What a router actually decides

The intent-routing pattern asks two questions in one request: a Choice for the intent and a Score for complexity. Intent confidence below 0.5 routes to a human. order_status goes to deterministic code. Complaints escalate when complexity exceeds level 1 or its confidence falls below 0.5.

That is the right shape for most routers. One question selects the branch; a second question measures how hard the branch is. The confidence-gated routing pattern adds the per-action threshold: a balance check can act at 0.6, a transfer needs 0.85 plus confirmation.

The important design choice is that the router's output is a pair (answer and confidence), not a single label. Routing on the label alone lets a confidently misrouted request slip past review.

The cheap tiers come first

A decision model is fast, but a regex is faster. The Hybrid Intent Router puts regex and tries before any model, then a TF-IDF/CatBoost tier, then System One models, then an LLM. That ordering is not an accident: each tier is more expensive and more capable than the last, and the router only pays for the next tier when the current one cannot decide.

The S1 LLM Auto-Router shows how much a small model can do in one pass. It answers seven router questions (category, difficulty, stakes, and four flags) in a single ONNX pass. It is built on a pruned mmBERT-small, distilled from a fine-tuned teacher, with per-head calibration temperatures. The card reports about 14 ms p50 on four pinned EPYC cores and 26 ms on four Xeon cores, with 0.898 category accuracy and 0.819 all-seven-exact on 2,175 held-out synthetic requests across 22 languages.

Those numbers are self-reported, and the gold labels are a plurality vote of up to five LLMs, with an independent blind set of only 100 requests. Treat them as a strong starting point, not a settled benchmark. The design lesson is still sound: a small, purpose-built router can answer several routing questions in one pass for far less than a frontier call.

A router is not a model selector

There is a subtle difference between routing a request and selecting a model. A model selector chooses among providers by cost, latency, or capability. A router chooses a workflow branch: deterministic code, a specialist model, a larger model, or a human.

The Pi TypeSafe Router is a coding-agent extension that classifies each request and routes it to one of three configured models. It supports TypeSafe, Cloudflare, Vercel, and OpenRouter backends, includes doctor checks and shadow mode, and starts off until enabled. That is a model selector with a decision-model front end.

The System Switch paper is the research version of the same idea. It studies a fast actor that hands control to a reasoning model only when a gate opens. On 900 held-out questions, deferring the least confident 30% of decisions gained +0.13 with one option order, and +0.08 with shuffled options. The closed-loop result was negative (no variant reached the exit), which is a useful warning: a good offline deferral rule does not guarantee a good closed-loop policy.

Calibrate the gate, not just the router

A router's threshold is a policy. If the router says “route to the small model” at 0.7 confidence, the cost of a wrong route is a bad answer from the small model, and the cost of a missed route is an unnecessary large-model call. Those costs are asymmetric, and the threshold should reflect them.

The confidence notes are explicit that confidence is not accuracy. A router can be well calibrated on average and still be wrong on the slice that matters. Measure the routing agreement (how often the router's chosen branch matches the branch a human would choose) separately from the downstream answer quality.

The System Switch result adds a second measure: AUROC for predicting when the fast model will be wrong. Accuracy, calibration, and sensitivity are distinct. Two routers with the same accuracy can differ widely in how well they rank their own errors, and the ranking is what a deferral gate depends on.

Start with three branches

A first router does not need seven labels and four flags. Start with three branches: deterministic code, a decision model, and a human. Add a fourth only when you have a measured case for it.

The intent-routing pattern is a good template. Pick the intents that cover most of the traffic, add a none or other option for the tail, and route on confidence. The candidate coverage article covers the option-set design; the dependent questions article covers when a second request is better than a bigger router.

A short checklist

  • Put deterministic checks before the model.
  • Ask for intent and complexity in one request.
  • Route on the answer and the confidence together.
  • Set thresholds per branch, by the cost of a wrong route.
  • Measure routing agreement separately from downstream quality.
  • Report AUROC for error ranking, not only accuracy.
  • Start with three branches and add more only with evidence.
  • Leave a replayable decision record at every exit.

The router is the part of the agent that decides where to spend the next token. Get the cascade right, and the expensive model becomes the exception rather than the default.

From the Jev directory

The resources behind this article.

A CPU-first decision model from Decision Models that answers the seven questions an LLM auto-router needs (category, difficulty, stakes, four flags) in one ONNX pass; MIT weights plus a Jev-compatible hosted API.
Jev Models & Reimplementations#community#open-models#local
Community
0GitHub stars
A Pi coding-agent extension that uses Jev to classify each request and route it to one of three configured models. Supports TypeSafe, Cloudflare AI Gateway, Vercel AI Gateway and OpenRouter backends, with doctor checks, shadow mode and an off-by-default setup.
Jev Tools & CLIs#community#coding-agents#routing
An explainable intent router that cascades regex, TF-IDF with CatBoost, System One decision models (Laya, Jev, CLM) and a generative LLM fallback, answering from the cheapest engine able to decide and leaving a replayable decision record. Runs fully local.
Jev Tools & CLIs#community#github#python
Classify intent with a Choice and complexity with a Score, then send each branch to deterministic code, a specialist model, or a person, with a 0.5 intent-confidence floor.
Jev Practices & PatternsDocs#official#patterns#routing
Official
Use the answer to decide what to do and confidence to decide whether to act: the voice-banking example routes below 0.6 to a human and needs 0.85 or more to auto-approve a transfer.
Jev Practices & PatternsDocs#official#patterns#confidence
Official
Studies a fast learned actor in closed-loop Doom that hands control to a reasoning vision-language model only when a gate opens. On 900 held-out questions, deferring the least confident 30% of decisions gains +0.13 with doomLaya's option order, but no closed-loop variant reaches the exit.
Jev Practices & PatternsArticle#community#research#arxiv
33.3kGitHub stars
Open multilingual System 1 decision models with published checkpoints for choice, score and noul questions, plus a router that dispatches each request to the right checkpoint in one forward pass.
Jev Repos & SDKs#community#python#open-models
A paired, self-audited evaluation of an open-weight (Laya) and a hosted (Jev) System-1 decision model on 11 agent decision points: 7,283 base cases plus 6,640 robustness variants. Jev is significantly more accurate on 9 of 11 decision points, by 10.8 to 46.0 points.
Jev Benchmarks & EvaluationsArticle#community#research#arxiv
Back to all articles

Related Jev articles

The hosted price is a number; the self-hosted price is a system. How to compare hardware, utilization, operations, and evaluation honestly.
Jev Models & Reimplementations#models#cost#self-hosted
Read article
A decision node inside a state graph: how to add typed routing to LangChain and LangGraph without hiding the policy in a prompt.
Jev Integrations & Adapters#integrations#langchain#agents
Read article

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai