Dual-Model Tiered Routing: A Practical Guide to LLM Inference Cost Governance

    Most production traffic is simple extraction, rewrite, classification, or formatting; only a minority of requests need deep reasoning. This guide explains how to treat dual-model (or multi-model) routing as a measurable, fallback-capable, auditable architecture: complexity signals, a two-stage router, a three-part token cost model, cascade-plus-fallback orchestration, a private eval set, and observability for cost control.

    Why dual-model routing became an engineering constraint

    Recent model releases show a clear pattern: capability ceilings keep rising, while per-token prices have not risen in lockstep—some high-capability tiers have even gotten cheaper. Production request mix is highly skewed. Most calls are low-complexity (extract, rewrite, classify, format). Only a small share truly needs deep reasoning.

    Sending everything to the top tier inflates cost via a long tail of expensive calls. Sending everything to a cheap tier collapses quality on the critical minority. Routing by task complexity is no longer a tweak; it is an architectural constraint. Dual-model (or multi-model) layering is not “keep two models.” It is a scheduling system you can measure, fall back from, and audit.

    Routing criteria: define “high complexity” with observable signals

    The most common failure is ad-hoc criteria. Split signals into three observable classes:

    • Task semantics: multi-step reasoning, cross-document comparison, code-level edits, structured legal or financial clause interpretation.
    • Resource constraints: context length, expected output length, latency budget (interactive paths usually need controlled time-to-first-token).
    • Risk: cost of being wrong. High-stakes finance and compliance should always use the high tier plus extra validation.

    You do not need a full semantic classifier on day one. Start with rules first, model as fallback:

    1. def route(req):
    2. # Stage 1: deterministic rules — zero cost, explainable
    3. if req.risk_level == "high" or req.context_tokens > 60_000:
    4. return "deep" # high-capability tier
    5. if req.task_type in {"extract", "format", "classify"}:
    6. return "fast" # low-cost tier
    7. # Stage 2: lightweight classifier; pay only on uncertain samples
    8. score = light_classifier.score(req)
    9. return "deep" if score > 0.65 else "fast"

    Rules should cover 70%+ of traffic. Otherwise classifier cost erodes the savings from tiering.

    Cost model: price the three token buckets before you optimize

    Typical inference billing splits into input tokens, cache-hit input tokens, and output tokens. Unit prices can differ by an order of magnitude: output is usually most expensive, cache cheapest. Ignoring that structure sends optimization in the wrong direction.

    Let a tier’s prices be p_in, p_cache, and p_out (per million tokens). Per-request cost:

    1. def cost(p_in, p_cache, p_out, in_tok, cached_tok, out_tok):
    2. return (in_tok - cached_tok) / 1e6 * p_in \
    3. + cached_tok / 1e6 * p_cache \
    4. + out_tok / 1e6 * p_out

    Three operational conclusions:

    1. Cut output before input. Output is often several times the input price. Cap max output length and require compact structured responses for the most direct savings.
    2. Cache is the highest-leverage lever. Keep system prompts, tool definitions, and long document prefixes in a stable position, byte-identical. Timestamps or random IDs in the prefix invalidate the whole cache.
    3. Compare quality only after per-task cost. At the same eval score, multi-fold cost differences change unit economics. Report quality and cost together.

    Orchestration: cascade and fallback

    Single-shot routing is brittle. Prefer cascade + fallback:

    • Run the cheap tier first, then lightweight checks (schema, numeric consistency, rule asserts, a second self-score).
    • On failed validation or low confidence, upgrade to the high-capability tier.
    • If the high tier times out or is unavailable, fall back to the cheap result and mark degradation so availability wins.
    1. def cascade(req):
    2. r = fast_model.run(req)
    3. if validate(r) and r.confidence >= 0.8:
    4. return r, "fast"
    5. r2 = deep_model.run(req)
    6. return (r2, "deep") if validate(r2) else (r, "degraded")

    Expected cascade cost ≈ cheap unit price + upgrade rate × (high-tier price − cheap price). Lowering upgrade rate moves the bill more than prompt tweaks.

    Evaluation: private sets, not public leaderboards

    Public leaderboards (agent exams, science/math reasoning) are only a selection hint. Distributions differ from your product, scores drift across versions, and cost accounting is inconsistent. Build a private set of 200–500 real samples with gold answers and acceptable ranges. On every model or prompt change, run regression and report a four-tuple: accuracy, P95 latency, per-task cost, degradation rate.

    Capability is not uniform. A new tier may jump on science, 3D design, or math while coding or legal work barely moves—or regresses. “Newer is always better” is false. Trust regression, and keep one-click rollback to the previous version.

    Observability and cost governance

    What you do not log, you cannot govern. Record each call as structured logs: tier, three token buckets, cache hit, latency, validation outcome, degradation flag. Aggregate by product line, scenario, and tenant. Alert on three classes: per-task cost period-over-period spikes, sudden cache-hit drops, upgrade-rate jumps. Pair with quotas and budget caps so abnormal traffic cannot explode spend.

    On a typical cloud stack you can close the loop with model serving, object storage (eval sets and prompt versions), a message queue (async peak-shaving), containers (router and validators), and logs/metrics—without binding to a proprietary API.

    Rollout path and common pitfalls

    Four steps: (1) measure only—break current cost down by scenario; (2) rule-based routing for deterministic traffic; (3) caching and output constraints; (4) cascade plus private eval regression.

    Common pitfalls: unstable prefixes killing cache; classifier overhead eating savings; optimizing input while ignoring output; no degradation path so peaks go down; shipping a new model without regression. Avoid those and a layered architecture often cuts overall inference cost by about an order of magnitude at roughly the same quality. That is what “prices came down” means in engineering: not waiting for a discount, but changing the cost structure.