Don't Pick Models by Leaderboard Alone: Tiered Routing and Cost Control
A practical guide to choosing LLMs for production workloads. It covers why aggregate benchmark scores can mislead, how to model the full cost of a request, a four-tier routing design (L0 to L3), compliance steps for low-cost data-training tiers, and how to evaluate and roll out changes safely.
1. Why Leaderboard Scores Should Not Drive Model Selection
An aggregate intelligence index is a weighted summary of several benchmarks. It shows how well a model performs on average, but not how well it performs on your tasks. Two models that differ by a few index points can rank in the opposite order on a specific subtask.
Using the index directly for replacement decisions carries four main risks:
- Task distribution mismatch. General benchmarks often cover task types that differ widely from your production traffic. Structured extraction, long-document question answering, code completion, and multi-turn tool calling each have their own capability profiles.
- Error accumulation in long tasks. Benchmark items are mostly single-turn and short. An agent workflow may run dozens of steps in a row. Per-step reliability compounds, so a small difference in single-step reliability grows over a long chain (see Section 6).
- Score gaps are often not significant. A gap of a few points often falls within the confidence interval of the evaluation. Top models also sit close to saturation, so a higher score adds limited business value.
- Non-capability factors. Context window size, maximum output length, concurrency quotas, rate limiting, data-use terms, and fallback behavior during outages often affect production results more than a few points of index difference.
The index is therefore better suited to ruling out clearly unsuitable candidates. The final ranking should come from your own evaluation set, scored against your real tasks and real constraints.
2. Break Down the Bill
Looking only at the price per million tokens easily leads to wrong cost estimates. The actual bill for a request depends on at least six variables:
- Input and output prices differ. Output tokens usually cost more. In agent workflows, output makes up a large share of tokens, so output length has a strong effect on the bill.
- Cached input pricing. Repeated system prompts, tool definitions, and long document prefixes can be billed at a lower rate when they hit the cache. For these workloads, the cache price is often the deciding factor.
- Batch and asynchronous discounts. Offline jobs can often use discounted pricing tiers.
- Context-length pricing tiers. Some providers raise the per-token price above a certain context length.
- Data-terms tiers. Some low-price tiers allow the provider to use input data for model training. Before you use such a tier, it must pass a compliance review (see Section 5).
- Retries and failed traffic. Failed and retried requests cost money but produce no useful result. Count them.
You can estimate the order of magnitude with the following formulas:
Cost per call ≈ input tokens × input price × (1 - cache hit rate × cache discount)+ output tokens × output priceExpected cost per request ≈ cost per call × (1 + retry rate)
Measure the retry rate from production logs as the number of retried requests divided by the total number of requests. Use a period of at least one week of traffic. Take the cache discount from the provider’s current price list. Estimate the cache hit rate from prefix-hit statistics in your gateway logs.
Here is an example. Assume an input price of $2 per million tokens, an output price of $8 per million tokens, and a 90% cache discount. A request has 2,000 input tokens, 60% of which hit the cache, produces 500 output tokens, and has a 5% retry rate.
- Effective input tokens: 2,000 × (1 - 0.6 × 0.9) = 920
- Input cost: 920 × 2 / 1,000,000 = $0.00184
- Output cost: 500 × 8 / 1,000,000 = $0.004
- Cost per call: $0.00584
- Expected cost per request: 0.00584 × 1.05 ≈ $0.00613
All prices in this example are hypothetical and do not reflect any provider’s actual pricing. For real estimates, replace them with the current price list of your target provider and your own traffic data.
When you plug real traffic into this formula, a counterintuitive result often appears. Sending an expensive model to only the hardest 10% of requests can cost less overall than sending everything to a cheaper model and paying for manual rework. Whether this holds for your workload needs to be verified with your own data.
3. Choosing Models: The L0 to L3 Tiered Framework
Split the model pool into four tiers. Each tier handles one type of job, and each has clear switching conditions.
| Tier | Role | Typical tasks | Switching condition | Starting traffic target |
|---|---|---|---|---|
| L0 Rule layer | Interception and validation at zero token cost | Intent classification, format checks, sensitive word filtering | A rule match returns immediately; otherwise the request goes to L1 | Serves as a front-end filter |
| L1 Lightweight layer | High-concurrency, low-complexity processing | Rewriting, tagging, field extraction | Ends when the output passes validation and meets the confidence threshold | About 60% to 80% |
| L2 Core layer | Default tier, covering most Q&A and tool calls | Business Q&A, single-step tool calls | Escalates when L1 fails validation or confidence is moderate | Adjust based on measured results |
| L3 Flagship layer | Complex reasoning and long-chain agents | Multi-step planning, low-tolerance tasks | Entered when multi-step tool calls are needed or when L1 and L2 confidence is too low | Keep to a small share if possible |
Traffic targets are only starting points. Use the results of gradual rollouts as the final reference.
Routing should not rely on hardcoded keywords. It should use observable complexity signals, such as input length, whether multi-step tool calls are needed, the model’s self-reported confidence, and whether the L1 output passes structural validation. The following is illustrative pseudocode:
# Illustrative pseudocode: tiered routing, confidence-based escalation, and budget gate.# Model IDs, timeouts, retry counts, and thresholds are read from a config file, not hardcoded.def route(req, budget):if req.extracted_intent is not None: # L0 rule layer matchedreturn req.extracted_intentif budget.remaining() <= 0: # Budget gate to prevent runaway costsreturn fallback(req)l1 = call(MODEL_L1, req, cache_prefix=req.system_prompt)if l1.valid and l1.confidence >= THRESH_L1 and not req.needs_tools:return l1 # Most traffic ends hereif req.needs_tools or l1.confidence < THRESH_L3:return call(MODEL_L3, req) # Send long chains to the flagship tierreturn call(MODEL_L2, req) # Middle-ground requests go to the core tier
Do not set confidence thresholds by intuition. On a golden set, plot two curves: threshold against escalation rate, and threshold against final success rate. Pick a threshold that meets your success target while keeping the escalation rate acceptable.
Beyond routing, add two cascade rules. First, configure a backup model within each tier. If the primary model times out or gets rate-limited, switch to the backup automatically. Second, add a quality fallback. If an L1 or L2 output fails structural validation, escalate to a higher tier right away instead of retrying on the same tier. Repeated retries add failed traffic and do not necessarily improve quality.
4. Five Levers of Cost Engineering
The common levers below are ranked by return on investment.
- Prefix caching. Place system prompts, tool definitions, and long documents at the start of each request, and keep the prefix bytes identical so the cache hit rate stays high. Timestamps or random IDs in the prompt will break cache hits.
- Context governance. Rerank and deduplicate retrieved passages, and compress conversation history with summaries. The reduction in input tokens varies by application, so measure it during a gradual rollout.
- Output length constraints. Explicitly define the output structure and word or token limits. Output tokens usually cost more, so shorter outputs reduce the bill directly.
- Batch and asynchronous processing. Run offline jobs on asynchronous batch tiers, separate them from online traffic, and keep them from consuming online quota.
- Distilling or fine-tuning small models. Distill frequent, stable L2 subtasks into a small model you control. This investment takes longer to pay back, so it suits workloads with steady traffic.
5. Compliance Steps for Data-Terms Tiers
Low-price tiers that let the provider train on your input data can cut costs significantly. They also create data leakage and compliance risks. Before using such a tier, the team should complete the following steps.
- Disable by default. Until the compliance review passes, keep the tier disabled in the routing table so no request can be routed to it.
- Classify data. Sort data into four categories: public, internal, sensitive, and regulated. Only public data, or data that has been de-identified, may enter the tier.
- De-identify data. Detect and replace fields such as phone numbers, national ID numbers, and customer names at the gateway layer. Cover the de-identification rules with unit tests.
- Confirm training scope. Check the provider’s terms line by line for the scope of training use, whether human review is included, and whether opting out is possible.
- Record retention periods. Document the provider’s data retention period and deletion process in your data processing records for audits.
- Enforce a hard check in code. Add a check to the routing function. If data is classified as sensitive or regulated, reject the low-price training tier directly. Do not rely on callers to comply.
- Review regularly. Repeat the review whenever the provider changes its terms.
6. End-to-End Success Rate on Long Tasks
Small differences in single-step reliability grow over a long chain. If each step is independent, the end-to-end success rate of an n-step task is about p^n, where p is the single-step success rate.
- Single-step reliability of 99%, 50-step chain: 0.99^50 ≈ 0.61
- Single-step reliability of 95%, 50-step chain: 0.95^50 ≈ 0.08
The single-step difference is only 4 percentage points, yet the end-to-end success rate over 50 steps differs by almost 8 times. This explains why flagship models often cost more: they raise the success ceiling for long chains. In practice, steps are not fully independent, but this estimate shows the direction of error accumulation.
For this reason, evaluate the whole chain as one unit. Do not score only the accuracy of individual steps.
7. Pre-Launch Evaluation and Rollout Checklist
- Golden set. Build 200 to 500 samples. Sample by task type and input length to match real traffic, and make sure each bucket has enough samples. Label expected outputs and key fields.
- Labeling consistency. Have two annotators independently label about 30% of the samples, then calculate the agreement coefficient. If the coefficient is below 0.7, revise the labeling guidelines before continuing.
- Evaluation metrics. Track end-to-end task success rate, structural validity rate, P95 latency, cost per task, and the share of requests escalated to L3. Looking only at accuracy misses cost and latency problems.
- Evaluation frequency. Rerun the golden set whenever you change the model or the prompt. Run a regression test monthly otherwise. If the production failure rate rises noticeably above baseline, trigger a regression test immediately.
- Gradual rollout. Start with 5% of traffic and observe it for at least one week. After metrics stay stable, increase to 25%, then to full traffic. If costs spike or error rates rise, roll back immediately.
- Observability. Keep logs of token counts and latency for the full request chain. Set alerts on cost spikes and failure rates. Archive evaluation samples and results together for post-incident review.
- Degradation plan. Set rate-limit thresholds, use a message queue to smooth traffic peaks, and let the container platform scale elastically with load. When the model is unavailable, return a prepared static fallback answer and tell the user clearly that it is a fallback.
8. Choosing Models, Reducing Costs, and Common Mistakes
How should you choose a model? First, use the aggregate index to rule out clearly unsuitable candidates. Then score the remaining candidates on your golden set. Finally, compare them across success rate, latency, cost, and data terms.
How can you reduce costs? Start with prefix caching and output length constraints. These usually require the least effort and show results quickly. Consider tiered routing and small-model distillation afterward.
What are the common mistakes?
- Choosing the main model based on leaderboard rankings without testing it on your own tasks.
- Calculating only the unit price and ignoring retries, failed traffic, and long-context pricing tiers.
- Enabling a training data tier to save money without completing data classification and compliance review.
