OCR: our new closed-loop routing algorithm

Static routers plateau at 88-93% accuracy. We built a closed-loop algorithm that learns from every response and adapts when models get better or worse.

Published 2026-04-04, updated 2026-09-24, by Dor Amir on the Nadir blog.

Filed under Nadir & Alternatives.

Evidence correction, 24 September 2026: an earlier version of this post's summary said OCR "cuts costs 43% with zero quality loss," and its results table reported a 43.3% saving against an all-Opus baseline. Both came from one internal pilot run on 50 prompts. Its quality figure, 50 of 50 responses valid, was a validity check rather than a comparison with Opus's answers, and a second pilot round saved noticeably less. The figure was never a production result, so we have withdrawn it. The pilot is described below for what it does show.

The problem with static routing

Every LLM router today works the same way: train a classifier, deploy it, and hope the world doesn't change. The best static routers reach 88-93% accuracy on standard benchmarks. That sounds good until you realize it means 7-12% of your requests are either wasting money (routed to an expensive model unnecessarily) or sacrificing quality (routed to a cheap model that can't handle the task).

We call this ceiling the Static Routing Ceiling (SRC), and we show in our paper that it's structural, not a tuning problem. It comes from two sources:

No amount of classifier tuning fixes this. The router needs to learn from what actually happens.

What OCR does

Outcome-Conditioned Routing (OCR) wraps any static classifier with a feedback loop. After every request, it observes the response (was it valid? what did it cost? how long did it take?) and updates its understanding of each model's capabilities.

The key insight is that these feedback signals decompose into two channels with very different properties:

Channel 1, quality failures (fast, binary). When a model returns an empty, malformed, or truncated response, that's an unambiguous signal it was overloaded. These are rare (1-5% of requests) but highly informative. OCR applies a fast downward correction to the model's capacity estimate.

Channel 2, cost efficiency (slow, continuous). The difference between expected and actual cost is available for every successful request, but it's noisy. OCR applies a slow bidirectional update, gradually tuning the cost-quality boundary over thousands of requests.

The 10:1 learning rate ratio between these channels isn't arbitrary. It's derived from matching the expected update magnitude per unit time, given that quality failures are rare but unambiguous while cost signals are common but noisy.

The asymmetric recovery problem

Here's something we discovered in simulation that, to our knowledge, hasn't been reported before: dual-channel updates have an asymmetric recovery problem.

When a model gets worse, Channel 1 catches it fast (within ~800 requests). But when a model gets better, say after a provider silently upgrades it, neither channel recovers:

In our Monte Carlo simulations, OCR without calibration never converged from underestimated initial capacities, even after 10,000 requests. The estimates got stuck.

Cross-tier calibration probes

We solve this with cross-tier calibration probes: periodic shadow requests that test whether a cheaper model can handle traffic currently routed to an expensive one.

When OCR routes a request to tier j, it occasionally also sends the same request to tier j-1 (the next cheaper tier). The user always gets the response from tier j. But if the cheaper tier succeeds, OCR boosts its capacity estimate upward.

The probe frequency adapts: starting at every 50 requests during uncertain periods and relaxing to every 200 once estimates stabilize. Total overhead: 2.16% additional API calls.

The results from simulation are striking:

ScenarioWithout calibrationWith calibrationImprovement
Sonnet capacity error (perturbed-low)0.600 (stuck)0.0867x better
Haiku capacity error (perturbed-low)0.2880.1482x better
Model improvement detectionNot detectedDetected at t=9,300From blind to aware

A small live pilot

We ran OCR end to end against live Claude models on an in-house set of 50 prompts, spread across 8 simulated customer-support deployments (e-commerce, SaaS, developer tools, healthcare, fintech, edtech, logistics, HR). We labelled each prompt simple, medium, or complex ourselves, and OCR chose Haiku, Sonnet, or Opus for it:

Our labelPromptsHaikuSonnetOpus
Simple252320
Medium151104
Complex100010

The two simple prompts that went to Sonnet cost more than they needed to but put nothing at risk. The one medium prompt that went down to Haiku is the error that matters, because a prompt sent below the tier it needs is where quality gets lost.

All 50 responses came back non-empty, well-formed, and complete, which is the signal Channel 1 watches. That is a validity check, not a quality grade. The pilot never compared an answer with what Opus would have written, so it cannot show that quality held.

Treat this as an internal research pilot, one run on 50 prompts, not a production result, a customer forecast, or a billing baseline. It is too small to support a savings figure, so we do not quote one. Nadir publishes no universal production savings or quality percentage until it is measured on outcome-labelled customer traffic.

How it fits into Nadir

OCR is the next evolution of Nadir's routing engine. The current binary classifier is a static router. It's fast and accurate, but it doesn't learn. OCR wraps around it:

The static classifier doesn't go away. It provides the initial complexity estimate. OCR refines the routing decision by maintaining live capacity estimates for each model, updated from every response.

What's next

We're integrating OCR into Nadir's hosted platform and source-available self-hosted router. Key areas we're still working on:

Read the full paper: OCR: Closed-Loop LLM Routing via Matched-Timescale Implicit Feedback and Cross-Tier Calibration Probes (Dor Amir).

More on nadir & alternatives

What Nadir is

Nadir is an LLM router. Nadir sizes every prompt and routes it to the cheapest model that still clears your quality bar. A small decision model reads each prompt against your model menu and picks the lowest-cost model it expects to handle it. When the decision model is uncertain or unavailable, the request goes to the strongest model on the menu. The routing step makes no call to your model provider.

Nadir runs two ways. The decision API returns a model, reasoning-effort, cache, context, and policy recommendation without calling a model provider, beside the gateway you already run. That is how a shadow-mode evaluation works, and its projected savings stay advisory. The OpenAI compatible managed proxy executes the route, and migration is a two-line change: point the base URL at api.getnadir.com and set model to auto. On that path an optional verifier can score a complete non-streaming answer and escalate to a stronger model when it misses the configured bar. Streaming bypasses post-generation verification. BYOK is supported on every tier.

For coding agents, Nadir Auto is a terminal launcher for Claude Code or Codex that asks Nadir for the main-session model before each turn, with your configured model as the fallback and cost ceiling. Delegation integrations for Claude Code, Codex, or Cursor instead recommend a model tier for subagent work, and the agent decides; the Claude plugin can also move a main-thread turn to Haiku when Nadir's cache check prices it cheaper, unless its switch_main_model option is off. Either way inference runs on your own provider account, so Nadir holds no provider keys on that path.

What the numbers are, and what they are not

Nadir publishes each evaluation with its scope. On checkable code, run-check-escalate solved 392 of 395 common HumanEval and MBPP problems (99.2%), graded by running the canonical tests; that applies only to tasks with runnable deterministic tests. Nadir-Tumbler posts an arena_score of 72.3 on RouterArena's public scorer, 5th of 23 routers, which measures the routing decision on RouterArena's own model pool. A reference-assisted RouterBench evaluation over 11,420 held-out triples produced a 60% lower projected cost than always-Opus with about 98% retained quality and a 1.7% catastrophic-route rate. That experiment gave the verifier the expensive-model reference answer, which production does not have, so it is a research ceiling and not the deployed path.

None of these is a production guarantee, a universal savings rate, or a forecast for any particular workload. Customer savings are reported from measured execution against a declared baseline, and customer quality only from outcome-labelled traffic. Projected savings and realized savings are separate artifacts and are never blended.

Design-partner program

Three rungs, picked by risk appetite. Rung 0 Shadow runs advisory decision calls alongside live traffic and returns a projected receipt, with nothing in the request path changed. Rung 1 Hosted is the two-line swap on a production slice and returns a realized receipt. Rung 2 On-prem is a supervised six-week proof of concept inside the partner's VPC, where no prompt, response, or usage reaches Nadir. The commitments are the same at every rung. Apply for a rung directly: Rung 0 Shadow, Rung 1 Hosted, or Rung 2 On-prem. Not sure which fits? Start at getnadir.com/contact/?reason=design-partner.

Licensing

NadirClaw is the self-hosted core, source-available under the PolyForm Noncommercial License. Source-available is the correct label; NadirClaw is not open source. Nadir Route's hosted plan has no base fee and charges a variable fee only on measured savings from requests Nadir executed.

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.