Skip to content
AVERITH
← All insights
ArchitectureNote / 0617 min read

Model routing is a policy system

Routing is not model selection alone. It is an auditable decision over workload, quality, cost, latency and availability.

By Mridul Srivastava

Technical review by Chandan Mohanty

Routing usually starts as a string. A feature calls one model, named in a configuration file. Then a cheaper model is added for simple requests, a larger one for long documents, a second provider for outages, a regional deployment for a European customer, and a self-hosted model for data that cannot leave the network. Each addition is a reasonable branch in an if statement. A year later, nobody can say with confidence which model a given request will reach, or why.

That uncertainty is more serious than it looks, because every branch encodes a decision someone would normally expect to be governed. Which customers’ data may be sent to which provider, in which region, under which retention terms. How much quality the business is willing to give up for cost. Which users get the faster path. What happens to all of the above when the primary provider is down.

Those are policy decisions. Routing is not choosing the best model; it is deciding, for each request, which model is permitted, adequate, affordable, fast enough and available, and being able to show afterward how that decision was made. Treating it as a policy system, with explicit inputs, constraints, objectives and records, is what makes a multi-model architecture safe to operate.

Routing as a policy decision

REQUESTCLASSIFYWORKLOAD · DATA CLASSTIER · LATENCY CLASSCONSTRAINTS6 CANDIDATES →3 ELIGIBLERANKQUALITY FLOOR,THEN COST + LATENCYHEALTHBREAKERS · QUOTASFAILOVER IN ELIGIBLE SETDISPATCHPRIMARY +ORDERED FALLBACKDECISION RECORDPOLICY VERSION · CLASSIFICATION · EXCLUSIONS + REASONS · SCORES · HEALTH SNAPSHOT · CHOICEHARD CONSTRAINTS FILTER. OBJECTIVES RANK. AVAILABILITY NEVER RELAXES A CONSTRAINT.EVERY ROUTE CAN BE EXPLAINED AFTER THE FACT.
Figure 1 — Routing as a policy pipeline. Classification establishes what the request is; hard constraints decide what is permitted; objectives rank what is permitted; health decides what is available. Each stage contributes to a decision record.

01 / Policy

Why routing is policy, not selection

Model selection is an engineering question asked occasionally: which model performs best on this task? Routing is a decision made on every request, under constraints that come from outside engineering. Legal and security teams set data-handling rules. Contracts restrict providers for specific customers. Finance sets budgets. Product sets latency expectations. Operations owns availability.

When these constraints live in scattered conditionals, three things go wrong. They conflict silently, for example when an availability fallback routes restricted data to a non-compliant region. They cannot be reviewed by the people who own them, because they are expressed in application code. And they cannot be audited, because nothing records which rule produced which decision.

The common strategies differ mainly in how explicit they make these decisions:

StrategyStrengthWeaknessFits
Static model per featureSimple and predictableOverpays for easy requests; one provider is a single point of failurePrototypes and very low volume
Rule-based branchingEncodes known cases quicklyRules sprawl, overlap and are rarely tested or auditedA small, stable set of workloads
CascadeCheap model first, escalate on failureAdds sequential latency; only as good as its quality checkBatch or latency-tolerant work
Learned routerPredicts per request which model sufficesNeeds labeled data, drifts with traffic, hard to explainHigh-volume, homogeneous traffic
Policy engineExplicit constraints and objectives; testable and auditableRequires evaluation data and ownershipMulti-tenant, regulated or multi-provider systems

These are not mutually exclusive. Cascades and learned routers are useful components inside a policy engine, where they rank or escalate among candidates that the policy has already declared eligible. What they should not do is replace the policy, because neither can express a constraint such as “this tenant’s data never leaves the EU”.

02 / Inputs

Routing starts with knowing what the request is

A routing decision is only as good as its description of the request. The useful attributes fall into a few groups:

  • Workload: the task type, such as contract review, ticket triage or summarization, which determines the quality bar and the relevant evaluation data.
  • Shape: estimated input length, expected output length, modality, and whether tools or structured output are required.
  • Data class: the sensitivity of the content, such as public, internal, confidential or regulated personal data.
  • Tenant: the customer, its contract terms, its tier and its remaining budget.
  • Latency class: interactive requests with a user waiting, versus background or batch work that can tolerate delay.

Some of these are known with certainty from the calling context. Others, especially workload and data class, may be inferred by a classifier, often a small model. That classifier is part of the policy and must be treated as such: evaluated against labeled examples, versioned, and given a defined behavior when it is uncertain. A low-confidence classification of data sensitivity should resolve to the more restrictive class, never the cheaper one.

03 / Constraints

Filter by hard constraints, then optimize

The single most important structural rule is to separate constraints from objectives. Constraints determine which models are eligible. Objectives rank the eligible ones. A constraint is never traded against an objective: no cost saving justifies sending restricted data to a provider that retains it.

  • Data handling: region, retention, use of data for training, and certifications required for the data class.
  • Contract: provider allowlists or denylists agreed with specific customers.
  • Capability: context window, tool use, structured output, modality and language support.
  • Quality floor: the minimum evaluated score for this workload, below which a model is ineligible regardless of price.

Expressing the policy as versioned data, rather than code paths, makes it reviewable by the people who own each rule and testable as a unit:

Illustrative routing policy

policy: routing v31

workloads:
  contract_review:
    quality_floor: { eval: contract_review_v5, min_score: 0.86 }
    latency_class: interactive              # p95 ≤ 8 s
  ticket_triage:
    quality_floor: { eval: triage_v9, min_score: 0.92 }
    latency_class: interactive
  nightly_summaries:
    quality_floor: { eval: summaries_v3, min_score: 0.80 }
    latency_class: batch

constraints:                                # hard: never traded for cost
  - when: request.data_class == "restricted"
    require: { region: eu, retention: zero, training_use: none }
  - when: tenant.contract.allowed_providers
    require: { provider_in: tenant.contract.allowed_providers }
  - require: { context_window_gte: request.estimated_tokens }
  - when: request.needs_tools
    require: { supports: [tool_use, structured_output] }

objective:                                  # among eligible candidates
  rank_by: [meets_quality_floor, expected_cost, p95_latency]
  exploration: { share: 0.02, workloads: [ticket_triage] }

availability:
  failover: within_eligible_set_only
  on_no_eligible_healthy: queue_or_degrade  # never relax constraints

The structure carries the intent. Hard constraints are listed separately and phrased as requirements. Quality is defined per workload and tied to a named evaluation dataset. The objective applies only to models that survive the constraints. And the availability section states explicitly that failure handling may not relax any of them.

04 / Quality

Quality is per workload, and it has to be measured

There is no single quality ranking of models. A model that excels at code generation may be mediocre at extracting clauses from contracts; a small model may match a large one on classification while falling well short on multi-step reasoning. A routing policy needs quality evidence per workload, drawn from the same kind of evaluation surface used to approve releases.

Research on routing makes the opportunity concrete. FrugalGPT showed that cascading across models of different cost can preserve quality at much lower cost on the evaluated tasks.1 Hybrid LLM and RouteLLM trained routers that predict, per query, whether a smaller model is likely to be good enough, and reported substantial savings with limited quality loss on their benchmarks.23 The transferable lesson is that a large share of requests often do not need the most capable model, and that identifying them is a measurable prediction problem.

The caution is that those results are measured on specific benchmarks and traffic distributions. A router trained on someone else’s queries is a hypothesis about yours. Quality floors in the policy should reference your own evaluation sets, be re-checked whenever a model version changes, and be expressed as minimums rather than preferences.

05 / Economics

Cost and latency are objectives with budgets

Once eligibility is settled, cost and latency are legitimate objectives. Expected cost per request can be estimated before dispatch from known input tokens, an estimate of output tokens for the workload, and current prices. Latency is better treated per class: interactive requests have tight targets for time to first token and total duration, while batch work can wait for cheaper capacity.

  • Optimize cost per completed outcome rather than per call. A cheaper model that fails more often may cost more once retries and escalations are counted.
  • Cascades save money by adding sequential latency. They suit batch work better than interactive paths with tight deadlines.
  • Hedging a request across two providers improves tail latency at the price of paying for both. Reserve it for the requests where latency matters most.
  • Enforce per-tenant and per-workload budgets in the router, where spending decisions are made, rather than discovering overruns on the invoice.

06 / Availability

Availability must never relax a constraint

Providers fail in more ways than going down. They return elevated error rates, throttle with rate limits, degrade latency, or change model behavior. The router needs a live view of provider health, typically maintained with circuit breakers that stop sending traffic to a failing dependency, probe it periodically, and restore traffic once it recovers.4

The policy question is where traffic goes when the preferred model is unavailable. The answer must be: to the next eligible model, and nowhere else. An outage must not be allowed to turn into a compliance incident because a fallback quietly routed regulated data to an unapproved provider. If no eligible model is healthy, the policy should declare what happens instead, such as queueing batch work, returning a clear degraded response, or failing the request, rather than relaxing constraints under pressure.

  • Fallback models must meet the workload’s quality floor, or responses produced by them must be marked as degraded.
  • Check that fallback capacity exists. A sudden failover can exhaust the secondary provider’s rate limits within minutes.
  • Look for correlated failure. Two providers that depend on the same cloud region or upstream model are not independent fallbacks.

07 / Audit

Every route needs a decision record

An auditable decision is one that can be explained after the fact without guessing. For routing, that means recording not just which model was chosen, but which models were considered, which were excluded and why, what the health state was, and which version of the policy made the call.

Illustrative routing decision record

{
  "request_id": "req_8f2c",
  "policy_version": "routing v31",
  "workload": "contract_review",
  "classifier": { "label": "contract_review", "confidence": 0.94 },
  "data_class": "restricted",
  "candidates": 6,
  "excluded": [
    { "model": "provider-b/large",  "reason": "region_not_eu" },
    { "model": "provider-c/fast",   "reason": "below_quality_floor 0.79 < 0.86" },
    { "model": "provider-a/small",  "reason": "below_quality_floor 0.81 < 0.86" }
  ],
  "eligible": [
    "provider-a/large@2026-07",
    "provider-d/large-eu@2026-05",
    "self-hosted/large@v4"
  ],
  "health": { "provider-a/large@2026-07": "circuit_open" },
  "selected": "provider-d/large-eu@2026-05",
  "fallback_order": ["self-hosted/large@v4"],
  "reason": "primary circuit open; next eligible by expected cost"
}

Records in this form answer questions that otherwise consume days of investigation. Why did this customer’s document go to that provider? Why did costs rise last Tuesday? How often did the primary’s circuit open, and what quality did users receive while it was open? Did any request with restricted data ever reach a non-EU model?

08 / Lifecycle

Policy changes are releases

A routing policy changes more often than most code: new models appear, prices change, providers deprecate versions, customers negotiate new terms. Each change can shift quality, cost and compliance for a large share of traffic, so it deserves the same discipline as a software release.

  • Keep the policy in version control, with owners for each constraint and review by those owners.
  • Write tests for invariants: restricted data never routes outside approved regions; tenants with allowlists never reach other providers; every workload has at least one eligible healthy model.
  • Before rolling out a new policy, replay it against recorded decision inputs to see how many requests would route differently, and to where.
  • Roll out gradually and keep the previous version available for immediate rollback.
  • Pin model versions. Aliases that silently move to a new model change behavior without any change to your policy, and invalidate the quality evidence behind it.

09 / Feedback

Routing data is biased by routing itself

A router learns from outcomes, and the outcomes it observes are shaped by its own decisions. If the policy sends only easy requests to the small model, the small model’s observed success rate will look excellent, and a naive update will send it harder requests it cannot handle. The data says nothing about how the small model would have done on the traffic it never saw.

This is a selection-bias problem with two standard remedies. Evaluate every candidate offline on a representative sample of the full traffic distribution, not only on the traffic it was routed. And reserve a small, randomized share of eligible traffic for exploration, so that online estimates for each route are not determined entirely by past routing decisions. The exploration share is a cost worth budgeting for, and it is only acceptable within the eligible set and above the quality floor.

Per-route operational metrics then close the loop: completion rate, cost per completed outcome, latency by class, fallback rate and degraded-response rate. Policy updates should be driven by these measures, reviewed like any other release, and recorded with the evidence that justified them.

10 / Practice

A minimal routing policy

Most organizations do not need a sophisticated router. They need an explicit one:

  • Describe each request by workload, shape, data class, tenant and latency class, with conservative defaults when a classifier is uncertain.
  • Express hard constraints separately from objectives, and never trade one for the other.
  • Define quality floors per workload from your own evaluation data, and re-check them on every model version change.
  • Rank eligible models by cost per completed outcome and latency, within declared budgets.
  • Fail over only within the eligible set, and declare what happens when nothing eligible is healthy.
  • Record every decision with the policy version, exclusions and reasons, health state and choice.
  • Version, test, replay and roll out policy changes like code, and correct for selection bias with offline evaluation and bounded exploration.

A router decides who handles each request, under which rules and at what price. That is policy, whether or not it is written down. Writing it down, testing it and recording its decisions is what turns a collection of model calls into a system an organization can stand behind.

References

  1. 1. Chen, L., Zaharia, M. and Zou, J. (2023). FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance. arXiv:2305.05176
  2. 2. Ding, D. et al. (2024). Hybrid LLM: Cost-Efficient and Quality-Aware Query Routing. ICLR. arXiv:2404.14618
  3. 3. Ong, I. et al. (2024). RouteLLM: Learning to Route LLMs with Preference Data. arXiv:2406.18665
  4. 4. Nygard, M. T. (2018). Release It! Design and Deploy Production-Ready Software (2nd ed.). Pragmatic Bookshelf.

Authors and reviewers

Author

Mridul Srivastava

Automation Engineer, Leucine AI

At Leucine AI, I own the end-to-end automation strategy, architecting the framework from scratch and automating mission-critical workflows across the platform. I leverage AI tooling extensively to keep test suites fast, self-healing, and low-maintenance pairing Cursor with Playwright MCP for prompt-driven authoring, and using Claude Code to translate user stories and production tickets into executable test cases. Previously at NAVI Engineering, I strengthened functional, regression, and API automation through distributed testing, Playwright suites, and CI/CD integrations.

Technical reviewer

Chandan Mohanty

Senior Software Engineer, Wipro

Works on large-scale data platforms at Wipro. Contributed the evaluation design in this note.