Multi-Model Intelligent Routing: An 85% Token Reduction Practice for Homogeneous Tasks

    This article explores how to optimize costs in multi-model LLM environments without compromising quality. When multiple models meet the acceptance criteria for a specific task, intelligent routing becomes the primary lever for cost reduction. We detail a practical four-layer architecture—comprising unified access, task understanding, quality assessment, and intelligent routing—and explain the core scheduling logic through pseudocode. Additionally, we discuss complementary cost-reduction strategies such as caching, task grading, and budget governance, providing a step-by-step guide to building an engineering system that minimizes token consumption while maintaining verifiable output quality.

    In multi-model development environments, teams often start by focusing on basic integration and API calls, only to realize that the real challenges lie in cost, stability, and quality consistency. In our initial practice, multiple candidate models all met the acceptance criteria for a spreadsheet generation task, proving that capability was not the bottleneck. However, the billing differences across different call paths were significant. Abstracting this phenomenon yields a universal technical proposition: when multiple candidate models meet the quality threshold for a specific task, how can a system significantly reduce token consumption through unified access, task recognition, and intelligent routing while ensuring verifiable results? This article outlines a deployable architecture and governance methodology to address this proposition.

    1. The Core Issue: Cost Becomes the Main Variable After Quality is Met

    During the early stages of multi-model integration, a common approach is to stick to a single “strongest” or “most familiar” model. This strategy is simple to implement but carries three hidden risks: First, high-cost calls are indiscriminately applied to all tasks, meaning low-complexity requests incur high token consumption. Second, different tasks have vastly different requirements for output format, reasoning depth, and context length, making a fixed path difficult to adapt dynamically. Third, as business volume scales, retries, timeouts, and duplicate generations further amplify consumption.

    Therefore, the prerequisite for cost reduction is not sacrificing quality, but rather establishing quantifiable acceptance criteria. For spreadsheet generation tasks, verification might include field completeness, header consistency, data type correctness, formula or summary logic accuracy, and format parsability. Only when candidate models can pass these checks should you move to the cost optimization phase. If quality is subpar, prioritize adjusting prompts, cleaning inputs, or splitting tasks rather than merely comparing prices.

    2. Overall Architecture: Unified Access + Quality Assessment + Intelligent Routing

    It is recommended to split the system into four layers:

    1. Unified Access Layer: Shields the differences in calling various candidate models, standardizing authentication, timeout, retry, rate limiting, logging, and metering. It provides a consistent task submission interface externally, preventing business code from being directly coupled to a specific model.
    2. Task Understanding Layer: Extracts task features such as task type, input length, output structure complexity, multi-turn reasoning needs, time limits, and historical failure rates. Features don’t need to be overly complex initially; they can start with rules and statistical characteristics.
    3. Quality Assessment Layer: Maintains offline evaluation sets and online sampling mechanisms, tracking quality scores, stability, and average latency for each candidate model on each task type. Quality scores should be based on acceptance rules, not subjective preferences.
    4. Intelligent Routing Layer: Combines quality thresholds, remaining budget, token cost, historical success rate, and current load to calculate a comprehensive score for candidate models. It selects the optimal path and supports failure fallback and budget circuit breaking.

    If deployed on Baidu AI Cloud, you can leverage general container platforms, object storage, logging services, and monitoring alerts to host the access services, evaluation data, and observability system. However, the routing strategy, quality thresholds, and cost accounting logic should remain self-developed and controllable to avoid tying core decisions to a single implementation.

    3. Core of Auto Scheduling: Set Thresholds First, Calculate Scores Second

    Auto scheduling is not about “picking a random cheap model” but rather “selecting the model with the lowest comprehensive cost and manageable risk from the set of quality-compliant models.” This can be expressed with the following pseudocode:

    1. function route(task):
    2. candidates = filter(models, m => m.quality[task.type] >= task.minQuality)
    3. if candidates is empty:
    4. return fallbackHighQualityPath(task)
    5. for m in candidates:
    6. costScore = normalize(m.costPerCall, task.inputTokens)
    7. riskScore = m.failureRate * task.retryCostWeight
    8. latencyScore = m.p95Latency / task.deadline
    9. score = w1 * costScore + w2 * riskScore + w3 * latencyScore
    10. if m.isCached(task.fingerprint):
    11. score = score * cacheDiscount
    12. return argmin(score)

    This pseudocode reflects three principles: the quality threshold is a hard constraint; models that do not meet the standard cannot enter the candidate pool just to save money. Cost, risk, and latency are soft constraints, and their weights can be adjusted according to business phases. Cache hits can significantly reduce actual call costs. For tasks like spreadsheet generation, where the input structure is stable and template reuse is high, caching and result reuse are often more effective than simply switching models.

    4. Combination of Cost Reduction Methods: Routing is Only the First Layer

    Relying solely on routing is usually insufficient. It is recommended to combine the following methods:

    • Result Caching and Fingerprint Reuse: Generate a fingerprint after normalizing the input, directly reusing results for identical or highly similar tasks. Note that the cache key should include task type, template version, and key parameters to avoid incorrect reuse.
    • Task Grading: Categorize requests into simple, standard, and complex levels. Simple tasks take the low-cost path, while complex tasks take the high-quality path. Grading rules can initially be implemented via a rules engine, gradually introducing statistical models later.
    • Batching and Merging: Merge requests for non-real-time tasks to reduce repeated context and call counts. For real-time tasks, prioritize timeout and retry control.
    • Failure Fallback and Retry Budget: Failed retries should not indefinitely inflate costs. Set a retry limit per task and a budget circuit breaker. When the budget approaches the threshold, automatically switch to a low-cost path or transition to asynchronous processing.
    • Output Constraints: Reduce invalid generations at the source through structured output constraints, field validation, and templated prompts, thereby lowering the retry rate.
    • Observability and Metering: Record token consumption by task type, candidate model, retry count, and cache hit rate to generate cost attribution reports. You cannot optimize what you do not measure.

    In our original controlled sample, multiple candidate models met the requirements, and auto scheduling reduced token consumption by approximately 85% compared to using a fixed high-cost path. This figure should be understood as the result under specific tasks, evaluation sets, and routing strategies, and should not be unconditionally extrapolated to all scenarios. However, it highlights an important fact: once quality standards are met, the scheduling strategy’s impact on cost can far exceed the differences in model capabilities.

    5. Evaluation and Governance: Avoid “Saving Tokens, Losing Quality”

    During implementation, establish a dual-track evaluation system: offline evaluation sets covering typical and edge cases, and online sampling to monitor actual output quality. Key metrics include QA pass rate, manual review consistency rate, average retry count, cache hit rate, token consumption per task, and P95 latency. Governance should focus on quality fluctuations caused by model version drift, prompt changes, and template upgrades. Any routing strategy adjustment should first be validated with a small traffic volume before gradually scaling up.

    Additionally, avoid over-optimization that leads to hidden cost transfers, such as increasing manual reviews, adding failed retries, or extending delivery times just to save money. The correct objective function should be “minimizing total cost under quality and time constraints,” rather than simply minimizing the token consumption of a single call.

    6. Suggested Implementation Steps

    1. Select a high-frequency, verifiable task, such as structured spreadsheet generation or field extraction, and establish acceptance rules.
    2. Integrate multiple candidate models but isolate differences through a unified access layer, standardizing the metering criteria.
    3. Run offline evaluation sets to establish baselines for quality, latency, and token consumption for each candidate model.
    4. Set quality thresholds, start with rule-based routing, and then introduce scoring functions and caching.
    5. Conduct a canary release of the auto scheduling to observe the QA pass rate and cost per task.
    6. Establish budget circuit breakers, failure fallbacks, and cost attribution reports, continuously iterating on weights.

    Overall, cost reduction in a multi-model environment is not simply about replacing one model with another. It is about combining “quality verification, task understanding, intelligent routing, cache reuse, and budget governance” into a cohesive engineering system. Only by first proving that multiple candidate models meet the standard for the target task, and then using auto scheduling to assign requests to the most appropriate path, can you compress token consumption to a reasonable range while ensuring verifiable results.