Small Models for Execution, Large Models for Decisions: A Tiered Cost-Reduction Practice for Enterprise AI Agents

    AI agent systems often suffer from high inference costs and latency when large models handle every execution step. This article explores a tiered architecture where large models focus on planning and complex reasoning, while small models execute mechanical tasks like information extraction and format conversion. It covers task classification, domain constraint strategies, routing and fallback design, quality assurance through evaluation, cost calculation, and common risks. By implementing this approach, enterprises can significantly reduce operational costs without compromising output quality.

    I. Background: Structural Issues in Call Volumes

    Agent systems typically consist of a planning module and multiple execution steps. Planning and complex reasoning require strong inference capabilities, but most calls in the execution pipeline do not. Take document processing as an example: a single task might involve dozens of field extractions, paragraph classifications, format conversions, and simple retrievals. If every step is handed to the most powerful model, both inference costs and latency will grow linearly with the number of calls.

    The key question is not “whether small models can match large models in general capabilities.” In terms of general capabilities, the gap between smaller parameter models and large closed-source models usually remains significant. What needs to be answered is: on a well-bounded sub-task, can a small model consistently meet business requirements?

    II. Task Classification: Define Boundaries Before Selecting Models

    The first step in tiered routing is task classification. Common dimensions for division include reasoning depth, output verifiability, input stability, and the cost of failure.

    Task Type Typical Example Recommended Handler Main Rationale
    Planning & Decomposition Determine execution steps, select tools Large Model Requires global understanding and reasoning
    Complex Judgment Resolve conflicting information, open-ended attribution Large Model High generalization requirement, high error cost
    Information Extraction Extract fields from fixed-structure text Small Model Output can be validated via schema
    Classification & Filtering Tag categorization, relevance filtering Small Model Limited categories, evaluable via samples
    Format Conversion Convert structured data, fill templates Small Model Clear rules, comparable results
    Simple Retrieval Query by keyword or field Small Model Fixed retrieval conditions

    When classifying, note that task types within the same business scenario may change with the input. For instance, a classification task might require escalation when encountering boundary samples. Therefore, classification rules should be hard-coded into the system design rather than relying on manual judgment.

    III. Domain Narrowing: Constraints Determine Small Model Viability

    The key variable for small model viability is the size of the task space. The narrower the task space, the easier it is to control the output through engineering means. Common methods include:

    1. Define Input Scope: Limit document types, languages, and field sets; filter out out-of-scope inputs.
    2. Fix Output Structure: Require the model to output JSON or other parseable formats, and perform schema validation on the program side.
    3. Provide Domain Examples: Add a few representative samples in the prompt to cover common variants and error-prone cases.
    4. Maintain Glossary: Write definitions of business-specific terminology into the context to reduce ambiguity.

    The purpose of these constraints is to convert open-ended problems into closed ones. A small model’s performance on closed problems depends on sample quality and constraint design, not solely on the model itself.

    IV. Architecture Design: Tiered Routing and Failure Escalation

    A typical tiered architecture consists of four parts:

    • Orchestration Layer: Handled by a large model or rule engine, responsible for decomposing tasks and deciding which handler processes each sub-task.
    • Routing Layer: Selects the execution path based on task type, historical accuracy, and cost budget.
    • Execution Layer: Small models process sub-tasks using fixed templates.
    • Validation Layer: Checks if the output conforms to the schema and decides whether to accept the result based on confidence signals.

    Below is illustrative code for routing and escalation logic, where the client and validation functions are placeholder implementations:

    1. from dataclasses import dataclass
    2. @dataclass
    3. class Task:
    4. kind: str # e.g., extraction, classification, reasoning
    5. payload: str # Task input
    6. # Task types allowed to be handled by small models, needs maintenance based on evaluation results
    7. SMALL_TASK_KINDS = {"extraction", "classification", "format_convert", "simple_search"}
    8. def route(task: Task) -> str:
    9. return "small" if task.kind in SMALL_TASK_KINDS else "large"
    10. def run_task(task, small_worker, large_worker, validator):
    11. if route(task) == "small":
    12. result = small_worker(task.payload)
    13. if validator(result):
    14. return result
    15. # Escalate to large model upon validation failure to prevent errors from flowing downstream
    16. return large_worker(task.payload)

    This design has two key points. First, an escalation mechanism is mandatory; failures from small models must not be passed directly downstream. Second, the routing table should be data-driven. A task type is only allowed into the small model path if it consistently meets benchmarks in evaluations, and it must be re-tested periodically.

    V. Quality Assurance: Evaluate with Real Samples

    Evaluation is the basis for bringing a tiered architecture online. It is recommended to build an evaluation system following these steps:

    1. Build Evaluation Sets: Sample from real business traffic, bucket by task type, and cover both common and long-tail samples.
    2. Define Metrics: Include field accuracy, structural validity rate, consistency with manual annotation, and escalation ratio.
    3. Set Admission Thresholds: Only task types that meet the thresholds are allowed to be handled by small models.
    4. Continuous Monitoring: Log validation failure rates and manual sampling results online; retract task types promptly if metrics decline.

    Evaluation conclusions only apply to the scope covered by the evaluation set. A different batch of data or a different document source may render the conclusions invalid, so evaluation sets must be updated regularly.

    VI. Cost Estimation: Use Formulas Instead of Guesswork

    The benefits of tiered routing can be estimated using a simple formula. Assume the total call volume is N, the proportion handled by small models is p, the cost per large model call is C_large, and the cost per small model call is C_small. The formula is:

    Total Cost = N × [(1 − p) × C_large + p × C_small] + Escalation Cost

    The escalation cost includes the overhead of re-invoking the large model after validation failure. As long as p is sufficiently large, C_small is significantly lower than C_large, and the escalation ratio is low, the total cost will decrease noticeably.

    Two points require attention here. First, p is a statistical result of real traffic and cannot be assumed based on experience. Second, if the validation failure rate is high, the escalation cost will offset some of the savings, or even cause the total cost to rise. Therefore, both savings and escalation costs should be accounted for during estimation.

    VII. Common Risks and Mitigation

    • Distribution Shift: The accuracy of small models drops after input sources change. Mitigation: Continuous sampling and accuracy alerts.
    • Error Accumulation: In multi-step processes, minor errors in early steps affect subsequent steps. Mitigation: Add validation at key nodes or perform a holistic check on the final result.
    • Version Changes: Output formats and behaviors may change after model version updates. Mitigation: Pin model versions and run full regression tests before upgrading.
    • Data Security: When sensitive data is involved, deployment methods and data flows must be evaluated to comply with relevant regulations.

    VIII. Implementation Recommendations

    1. First, analyze the call logs of existing agents to count call volumes and average costs for various task types.
    2. Select high-volume task types with verifiable outputs as the first batch of pilots.
    3. Build evaluation sets for the pilot tasks and determine admission thresholds.
    4. Deploy tiered routing and retain a switch to instantly roll back to the large model.
    5. After running for a period, adjust the routing table based on the escalation ratio and online metrics.

    The core of tiered routing is not to replace large models with small models, but to assign the right tasks to the right models, using validation and escalation mechanisms to guarantee the quality baseline.