Tiered Model Selection by Task: Engineering Practices for Office AI Workloads

    In daily office work, a single user may issue AI requests with very different characteristics in one day: summarizing long documents, polishing announcements, or quickly checking a definition. This article explains how to classify office tasks into tiers—long-document processing, writing and rewriting, and lightweight high-frequency tasks—and route each tier to an appropriate model. It covers a tiered routing architecture with a classifier, a configurable routing table, and fallback handling, includes a reference Python implementation, and discusses evaluation, cost control, security, and common pitfalls when rolling out the system in production.

    1. Background: Office Tasks Have Diverging Requirements

    In everyday office work, the same person may issue AI requests with very different characteristics within a single day. In the morning, they might need to read through dozens of pages of product documentation and extract conclusions; in the afternoon, polish a public announcement; in the evening, simply verify the definition of a term. These three task types place different demands on the model: the first depends on context capacity and information synthesis, the second on accurate Chinese-language expression and style control, and the third on response speed and per-call cost.

    If every request goes to the same model, the outcome is usually one of two failures: paying excessive cost and latency for simple tasks, or repeatedly reworking complex tasks because the model lacks the capacity or capability. Tiered routing addresses this by dispatching requests to suitable models based on task characteristics, so that quality, speed, and cost are each properly served.

    2. Characteristics of Three Typical Task Types

    2.1 Long-Document Processing

    When input material exceeds the model’s context window, the common approach is chunked processing. Chunking has inherent problems: cross-chunk references tend to break, conclusions from different chunks may contradict each other, and the merge stage requires extra deduplication and aggregation logic.

    There are two main paths for handling long documents. The first is to feed the entire text directly into a long-context model. This is simple to implement and suits tasks requiring global understanding, such as comparing the positions of multiple reports. The second is to use retrieval to select relevant passages first, then have the model generate an answer. This suits Q&A-style tasks and is cheaper, but it depends on retrieval quality—when relevant passages are missed, the model has no way to recover them.

    In practice, the two can be combined: retrieve first to narrow the scope, then read key documents in full.

    2.2 Writing and Rewriting

    Drafting, editing, and summarizing meeting notes are high-frequency office scenarios. The evaluation criteria for these tasks are mainly three: whether facts match the source, whether wording fits the target audience, and whether the structure is clear. Note that fluent expression does not mean accurate content. A model may insert numbers or conclusions that were not in the original, so fact-checking cannot be skipped.

    For these tasks, the prompt should specify three things explicitly: the boundary of the input material (what may be rewritten and what must be preserved verbatim), the output format (heading levels, length range, tone), and prohibitions (no new data may be added).

    2.3 Lightweight, High-Frequency Tasks

    Rewriting a sentence, outlining a document, or explaining a term—these requests consume little per call, but their volume makes the aggregate cost significant. They are also sensitive to time-to-first-token; users notice lag when waiting more than a second or two.

    For these tasks, common optimizations are to use smaller models and to cache results for identical or similar questions. Requests check the cache first: on a hit, return directly; on a miss, call the model and write the result to the cache.

    3. Tiered Routing Architecture

    3.1 Overall Structure

    A typical tiered routing system has four components:

    1. Request intake layer: receives all requests uniformly and records metadata such as input length and task type.
    2. Classifier: determines which tier a task belongs to, using rules or a lightweight model.
    3. Routing table: maps task tiers to specific model endpoints.
    4. Fallback and monitoring: handles timeouts, rate limits, and retries, and records latency and cost per tier.

    3.2 Classification Strategy

    Start with simple rules. Useful signals include an estimated input token count, whether multiple files are attached, whether a real-time response is required, and task keywords. Rules are transparent, their results are explainable, and debugging is easier. When rules fail to cover more and more cases, consider using a small model for classification—but classification itself adds latency and cost, so evaluate that overhead before introducing it.

    3.3 Routing Table and Fallback

    The routing table should live in configuration, not hard-coded, so that changing model selection requires no changes to business logic.

    Fallback strategy matters just as much. When the primary model times out or is rate-limited, fall back to a backup model of similar capability, and record the actually used model in the response for later auditing.

    4. Example Implementation

    The following example shows the basic skeleton of classification and routing. Model endpoint names are placeholders; replace them with your service’s configuration at deployment time.

    1. from dataclasses import dataclass
    2. @dataclass
    3. class Task:
    4. text: str
    5. est_tokens: int
    6. latency_sensitive: bool = False
    7. # Routing table: tier -> models ordered by priority
    8. ROUTES = {
    9. "long": ["model-long-context", "model-standard"],
    10. "standard": ["model-standard", "model-long-context"],
    11. "light": ["model-light", "model-standard"],
    12. }
    13. def classify(task: Task) -> str:
    14. if task.est_tokens > 32_000:
    15. return "long"
    16. if task.latency_sensitive or task.est_tokens < 500:
    17. return "light"
    18. return "standard"
    19. def run_with_fallback(task: Task, call_model) -> str:
    20. level = classify(task)
    21. last_error = None
    22. for model in ROUTES[level]:
    23. try:
    24. return call_model(model, task.text)
    25. except (TimeoutError, ConnectionError) as exc:
    26. last_error = exc
    27. raise RuntimeError(f"all models failed for level={level}") from last_error

    Several design decisions are worth noting. First, the routing table is separated from the classification logic, so model configuration can change without touching classification code. Second, fallback triggers only on timeouts and connection errors. Errors caused by the input itself, such as parameter validation failures, are raised directly to avoid pointless retries. Third, call_model is injected as a parameter, so tests can substitute a mock instead of calling real models. est_tokens can be roughly estimated from character counts using an empirical ratio; switch to the model’s actual tokenizer when higher precision is needed.

    5. Evaluation and Cost Control

    Whether a tiered scheme works depends on thorough evaluation. Build a separate evaluation set for each task type:

    • Long-document set: questions requiring cross-document reasoning, to test the completeness of information synthesis.
    • Writing set: reference answers annotated by business staff, to test factual consistency and style compliance.
    • Lightweight set: time-to-first-token and per-call cost, to test responsiveness.

    Core metrics include task pass rate, time-to-first-token, cost per task, and fallback trigger rate. A persistently high fallback rate usually indicates insufficient primary model capacity or an overly aggressive timeout threshold.

    Cost estimation should be based on real call logs, not theoretical calculations from list prices. Logs should record the tier, model, input/output lengths, and latency for every call. Only then can you answer questions like which tier spends the most, or which request types can be moved down to a cheaper model.

    6. Security and Compliance

    Office materials often contain customer information, financial data, and unreleased plans. Tiered routing sends data to multiple model endpoints, so the following rules should be explicit:

    1. Detect and mask sensitive information before sending—for example, phone numbers, ID numbers, and bank account numbers.
    2. Restrict available models by data classification level; highly sensitive material may only go to approved endpoints.
    3. Do not log raw text; log only metadata and masked summaries.
    4. Inject credentials via environment variables or a secrets management service, never in code or configuration files.

    When deploying to the cloud, the routing service can run on a container platform, request logs can go to a logging service, and alert rules can connect to a monitoring and alerting system. These are standard infrastructure categories; choose specific products based on your team’s existing stack.

    7. Rollout Advice and Common Pitfalls

    Roll out in three steps. First, get the pipeline running with rule-based classification and two tiers, and start accumulating call logs. Second, tune thresholds and the routing table based on those logs, then add tiers gradually. Third, establish a regular evaluation process—run the evaluation sets before every model version change.

    There are three common pitfalls. One: setting the most capable model as the default, causing costs to spiral. Two: judging only the quality of individual outputs while ignoring end-to-end latency. Three: piling up classification rules without documentation, until no one can explain why a given request was routed to a given model.

    8. Conclusion

    Selecting models by task tier is essentially turning “how much capability should solve how hard a problem” into a configurable, evaluable, and auditable engineering process. Keep classification rules simple, keep the routing table separate from code, and maintain solid fallback mechanisms and call logs. With these three in place, quality, speed, and cost in office scenarios can all be served at once.