All essays

A model has to earn its route: swapping models with tests built from real failures

Sending each task to the best model is the right idea, and a common source of quiet regressions. Here is how we gate model swaps: one case set per route, built from production failures, and a challenger only takes a route after it beats the current model on that set.

Most production AI products stopped being "one model" a while ago. A single product might send code edits to one model, short summaries to a cheaper one, image briefs to an image model, and the occasional hard planning question to the most expensive reasoning tier it can reach. Picking the best model for each task is the right instinct. It is also where a lot of quiet regressions come from.

A new model ships every few weeks. It tops a leaderboard, the release notes look great, and someone swaps it in. Two weeks later a client mentions that the summaries started dropping dates, or that the agent now wraps every JSON reply in a code fence the parser rejects. Nobody connects it to the swap, because nothing threw an error.

The fix we use is simple to describe. Every route has its own test set. The test set is built from real failures. A model only takes a route after it beats the current one on that set. Here is how that works in practice.

A route is a task type, not a model

Start by naming the routes. A route is a kind of work your product sends to a model, with a clear idea of what a good answer looks like. Examples from our own builds:

  • Code edits. Change a file so the tests pass and nothing unrelated moves.
  • Summaries. Compress a long thread into a few lines and keep every date, name and amount.
  • Extraction. Pull fields out of a document into a fixed schema.
  • Planning. Break a request into steps an agent can carry out.
  • Image briefs. Turn a description into a prompt an image model actually follows.

Each route fails in its own way, so each needs its own checks. A summary that reads well but drops an invoice amount is a failure. A code edit that passes the tests but rewrites an unrelated file is a failure. A general benchmark score sees neither.

Routes, each with its own case setA request enters a router on the left. The router sends it to one of four routes: code edits, summaries, extraction, and planning. Each route has three parts: its own case set built from real inputs, the current model that holds the route, and a challenger model that is being tested against the same cases. A dashed line from production failures feeds new cases back into every case set.FIG. 01 · ONE SET PER ROUTEROUTINGRequestRouterwhich task?Code editscase set · current model · challengerSummariescase set · current model · challengerExtractioncase set · current model · challengerPlanningcase set · current model · challengerProduction failuresevery failure becomes a case on its route
Fig. 01. The router decides which kind of work a request is. Each kind of work keeps its own cases, its current model, and room for a challenger.

Build the case set from what actually broke

The best test cases are the ones production already wrote for you. Every time a run goes wrong, we save three things: the exact input, the steps the agent took (tool calls and intermediate outputs), and the answer it should have given. That case goes into the route's set the same week, while everyone still remembers what went wrong.

A few rules keep the set useful:

  • Real inputs only, with private details removed. Invented cases test what you imagined users do. Saved cases test what they actually did.
  • Every case has a check a script can run. A field that must be present, a test that must pass, a request that must be refused, a format the parser accepts. If a case can only be judged by reading it, write down exactly what the reader looks for, and keep those cases few.
  • Keep the passing cases too. A set made only of old failures tells you whether a new model fixes past mistakes. It says nothing about whether it breaks what already worked. Mix both.
  • Start small. Fifteen to twenty cases per route catches the obvious regressions. The set grows on its own as new failures arrive.

After a couple of months the set reflects your users, your documents and your edge cases. That is worth more than any public benchmark, because it measures the job you actually do. It is the same idea we use when we audit an agent's instructions: freeze real cases first, then change one thing and measure.

Grade the path, not only the answer

For agent routes, the final answer can be right for the wrong reasons. A challenger might reach the correct file edit after reading forty files and calling search a dozen times, where the current model needed four reads. Or it might land the right answer by skipping a confirmation step it was supposed to take.

So on agent routes we record the whole run and check it, not just the last message. Did it call the tools it should have? Did it ask for approval where approval was required? How many steps and tokens did it spend? A challenger that matches quality but takes three times the steps is not an upgrade. It is the same answer, slower and more expensive.

The swap gate

When a new model looks promising, it runs as a challenger on the route's full case set, with the same instructions, the same tools and the same budgets as the current model. Then we compare, in this order.

The model swap gateA challenger model passes through four checks in order. First, quality: it must pass every case the current model passes, and any case that flips from pass to fail is read by a person. Second, format: its output must still parse. Third, the path: tool calls, approvals, and step count. Fourth, cost and latency per case. If any check fails, the challenger is rejected or kept only as a fallback. If all pass, it is promoted by a one-line config change, and the previous model stays wired as a fallback.FIG. 02 · EARN THE ROUTESWAP GATEChallengersame set, tools1. Qualityno pass flips2. Formatstill parses3. Pathtools, approvals4. Costtokens, timePromoteone config line, old model as fallbackReject or keep as fallbackany check failsa leaderboard win gets a model into the gate, not through it
Fig. 02. Quality comes first, and a single case flipping from pass to fail gets read by a person before anything else. Cost only matters once quality holds.
  1. Quality. Does the challenger pass every case the current model passes? Any case that flips from pass to fail gets read by a person before anything else happens. Sometimes the old answer was the wrong one and the check needs fixing. More often the flip is real.
  2. Format. Does the output still parse? Small changes in formatting break more integrations than bad reasoning does.
  3. Path. On agent routes, did it use the right tools, take the required approvals, and stay within the step budget?
  4. Cost and latency. Tokens per case, time to first token, total time per case.

Then one of three decisions: promote it, reject it, or keep it wired as a fallback for when the current model is slow or unavailable.

A model can win one route and lose another. That is normal, and it is the whole point of having routes. The cheaper model that handles extraction perfectly can be the right call there and the wrong one for planning.

Log the difference per tier

Many products also route by difficulty: a fast, cheap tier for easy requests and a top tier for hard ones. The question is always whether the top tier is earning its price. So for each route and each tier we keep two numbers from the case set: how many cases pass, and what each case costs. When the cheap tier passes the same cases as the expensive one, the expensive tier comes off that route. When the cheap tier fails cases users care about, it stays off, however tempting the bill looks.

The same log tells you when the routing itself is wrong. If requests the router marked as easy keep showing up in the failure log, the router is misjudging difficulty. That is a fix in the router, not a reason to buy a bigger model.

Keep every swap reversible

Promotion is a config change, not a rewrite. Each route names its model in exactly one place, and the previous model stays wired as a fallback for a few weeks. If something slips past the case set, rolling back is one line. Then the new failure goes into the set, so the next challenger has to handle it too.

What this buys you

None of this is exotic. It is a folder of cases per route, a script that runs them against two models, and a habit of saving failures the week they happen. What it buys is speed. When a better model arrives, you know within an afternoon whether it is better for your work, on which routes, and at what cost, and you can adopt it without crossing your fingers.

That is how we think about model choice at Sunrise. The best model for a task is the one that passes that task's tests, not the one at the top of this week's chart.