Two-Model Tiered Routing: Balancing Workflow Cost and Quality
Tiered model routing helps teams balance quality and cost by assigning routine workflow steps to an efficient model and escalating difficult steps to a higher-capability model. This article explains how to decompose workflows, account for token and human review costs, build representative evaluations, define escalation and fallback rules, and measure whether routing delivers meaningful improvements.
When model services offer distinct capability tiers, a common mistake is to focus on leaderboard rankings and replace the model across an entire workflow. In practice, a single business task may involve requirements clarification, code changes, test generation, fault diagnosis, document-based question answering, evidence reconstruction, and tool orchestration. Each step has different requirements for reasoning depth, context length, latency, and cost.
A more reliable approach is to break the task into steps, define quality and cost targets for each one, and use routing to assign routine work to an efficient, balanced model while escalating persistent bottlenecks to a higher-capability model. This avoids unnecessary use of expensive capabilities and can reduce the rework and human review costs caused by failed attempts.
1. Decompose the Workflow Before Choosing Models
Model selection should start with “What capabilities does this step require?” rather than “Which model is stronger?”
Break each workflow into observable steps and define an output contract for each step. For example:
- Fixing a known bug: Locate the relevant files, understand call relationships, generate a patch, pass tests, and meet the maintainer’s merge criteria.
- Answering verifiable questions from older documentation: Retrieve relevant information, provide citations, avoid hallucinations, and identify supporting evidence.
- Completing a multistep task with tools: Develop a plan, invoke tools, validate intermediate results, and handle failures and retries.
Record at least four measures for each step: whether the critical result is correct, how many rounds of human revision are needed, the total model-call cost, and whether end-to-end latency is acceptable.
Decomposition turns model rankings into a question of task fit. Higher-capability models are generally suited to complex programming, research analysis, long-running specialized work, cross-service fault diagnosis, and reconstructing an evidence trail from multiple sources. Balanced models are generally suited to everyday programming, multistep execution, and routine question answering where efficiency matters.
These tiers are complementary rather than interchangeable. Let the balanced model handle routine work, then escalate steps that repeatedly fail instead of replacing the entire workflow upfront.
2. Account Separately for Input, Cached Input, and Output Costs
Budget estimates should not rely solely on the price of an individual call. A useful cost model accounts separately for input tokens, cached input tokens, output tokens, retries, and human review.
When the same material is processed repeatedly, cache hits can substantially change the cost structure. When every task introduces new material, input costs may represent a larger share. The following pseudocode illustrates a cost ledger:
cost = input_tokens * price_input+ cached_input_tokens * price_cached_input+ output_tokens * price_output+ retry_count * average_retry_cost+ human_review_rounds * human_hour_cost
Populate pricing variables from the service’s actual rates rather than treating a particular quote as a permanent constant. Keep the accounting units consistent: token categories should not overlap, and review rounds must be converted to reviewer time when applying an hourly rate.
Human effort is especially important. A cheaper model that requires more rounds of manual revision may have a higher total cost. Conversely, a higher-capability model used only for a few difficult steps may be more economical.
3. Understand What Benchmarks Can—and Cannot—Tell You
In evaluations involving changes to real code repositories, the gap between higher-capability and balanced models at their highest settings may be smaller than expected, while completion costs may differ substantially. This suggests that everyday code changes do not necessarily require the highest-capability model throughout.
However, such evaluations typically cover a specific outcome, such as whether a change meets a maintainer’s merge criteria. Results may be very different for difficult cross-service failures or tasks that reconstruct an evidence trail from many documents. Leaderboards are therefore useful for initial screening, but they cannot replace an internal task set.
Build three types of comparison tasks:
- Fix a known bug. Measure patch correctness, test pass rate, and rounds of human revision.
- Answer verifiable questions using an older document. Measure citation accuracy and evidence completeness.
- Run a multistep task that requires tools. Measure planning quality, tool-call success rate, and failure recovery.
For each category, maintain a fixed set of samples, consistent scoring criteria, and a consistent budget-accounting method. Control for evaluation contamination and version drift so that comparisons remain meaningful.
4. Use a Balanced Default with Capability-Based Escalation
A practical routing strategy is to use the balanced model by default and escalate when necessary. Escalation triggers can include repeated failure at the same step, failing tests, conflicting context, hard-to-trace cross-service dependencies, strict evidence requirements, or demanding maintenance standards.
The following pseudocode shows a simplified routing policy:
def choose_model(task, attempt):if task.requires_cross_service_diagnosis:return "high_capability"if task.requires_evidence_chain:return "high_capability"if attempt.failures >= 2:return "high_capability"if task.complexity == "high" and task.expected_human_review > 0:return "high_capability"return "efficient"
Routing also needs fallback handling. Outputs from the higher-capability model must still undergo tests, static checks, permission validation, and sampled human review. If a balanced model’s output fails a quality threshold, the workflow should automatically escalate or hand the task to a human.
Cache policies should follow the task lifecycle. Stable documents, fixed specifications, and repeated question-answering tasks are good candidates for caching. Frequently changing repositories and temporary materials need expiration or invalidation policies to prevent stale context from affecting results.
5. Track Outcomes and Design Controlled Experiments
Track at least the following metrics:
- Critical-result correctness
- Test pass rate
- Rounds of human revision
- Total cost per task
- Cache hit rate
- Escalation rate
- Improvement after escalation
- End-to-end latency
- Failure retry count
Start with a small-scale comparison using the same task set across three paths:
- Balanced model only
- Balanced model with escalation at bottlenecks
- Higher-capability model only
Compare both quality and cost. Expand routing only when the gains in correctness or reductions in human revision justify the additional model-call costs.
In general-purpose cloud environments, including Baidu AI Cloud where the relevant services are available, teams can use object storage for evaluation samples and sanitized logs, logging services to record call traces, and monitoring and alerting to track escalation rates, cache hit rates, and per-task costs. Together, these provide an observable feedback loop.
Governance also needs to cover data permissions, log sanitization, output review, model version changes, and regression-set updates. A one-time evaluation should not become a permanent routing policy without continued validation.
Conclusion
Once model capabilities are tiered, the engineering goal is not to find a single model that does everything. It is to build a workflow that can be decomposed, costed, observed, and recovered when it fails.
Use a balanced model for routine steps, reserve the higher-capability model for bottlenecks, and continually verify the benefits with an internal task set. This makes the real trade-offs between cost and quality easier to understand than replacing the model across an entire workflow at once.
