Tiered LLM Routing by Task Difficulty: Engineering Practices
In office collaboration and AI assistant products, user requests vary widely. Routing every request to the same model tier either wastes expensive capacity on simple tasks or produces unstable quality on complex ones. This article describes an engineering approach to tiered LLM scheduling: define model tiers with different capability and cost profiles, profile requests using measurable dimensions such as reasoning depth, context length, output length, latency sensitivity, and verifiability, and route each request to a matching tier. It covers a typical routing architecture, a rule-based selection example, trade-offs between fast and high-quality tiers, cost and quality metrics, fault tolerance with retry and fallback, observability, and an implementation checklist.
Why Tiered Scheduling Is Needed
In office collaboration and AI assistant products, user requests differ widely. Some requests only rewrite a sentence, while others require reading dozens of pages and performing multi-step reasoning. If every request is sent to the same model tier, two problems emerge. First, simple tasks use expensive, high-latency tiers, increasing per-call cost and wait time. Second, complex tasks assigned to lightweight tiers produce inconsistent answer quality, forcing users to ask follow-up questions repeatedly.
Tiered scheduling treats model capability as a set of tiers, each with different trade-offs in reasoning depth, context capacity, response speed, and per-call cost. After receiving a request, the system profiles the task and selects a matching tier. This controls cost while ensuring complex tasks receive enough reasoning resources.
Task Grading: Start from Request Features
Grading depends on quantifying task characteristics. Common dimensions include:
- Reasoning depth: whether the task needs a single step or multi-step planning, conditional branching, and cross-validation. It can be roughly labeled on a 1-to-5 scale.
- Context length: the number of characters or tokens in the input. Longer inputs require larger context windows.
- Output length: whether the target is one sentence, a summary, or a full report. Longer outputs take more generation time.
- Latency sensitivity: whether the user is waiting for real-time feedback, such as input completion or conversational continuation, or can accept asynchronous background processing.
- Result verifiability: whether results can be automatically checked by rules or programs. For highly verifiable tasks, a lower tier draft can be accepted and then validated by rules.
In practice, start with a small manually labeled sample set to establish a baseline and observe the distribution of these dimensions, then set thresholds. Thresholds should not be fixed once and forgotten; they should be adjusted as business data changes.
Routing Architecture
A typical scheduling system can be split into four stages:
- Ingress layer: receives requests, validates parameters, performs sanitization, and records request IDs for tracing.
- Feature analysis layer: computes a task profile from request content and outputs fields such as reasoning depth and context length.
- Routing decision layer: maps tasks to tiers using a rule table or a lightweight classification model.
- Execution layer: calls the model service for the selected tier and handles timeout control and result return.
Below is a simplified routing example. Tier names and thresholds are for illustration only; actual values should be determined through load testing in your own business context.
from dataclasses import dataclass@dataclassclass TaskProfile:reasoning_depth: int # Reasoning depth: 1 to 5context_tokens: int # Input context length in tokenslatency_budget_ms: int # Maximum acceptable wait time in milliseconds# Example thresholds; adjust based on actual load-test dataTIER_LIMITS = {"fast": {"max_reasoning": 2, "max_context": 8_000},"standard": {"max_reasoning": 3, "max_context": 32_000},"pro": {"max_reasoning": 5, "max_context": 128_000},}def select_tier(profile: TaskProfile) -> str:fast = TIER_LIMITS["fast"]standard = TIER_LIMITS["standard"]if (profile.reasoning_depth <= fast["max_reasoning"]and profile.context_tokens <= fast["max_context"]and profile.latency_budget_ms < 3000):return "fast"if (profile.reasoning_depth <= standard["max_reasoning"]and profile.context_tokens <= standard["max_context"]):return "standard"return "pro"
The key advantage of rule-based routing is explainability. When rules are clear, operators can directly see why a request was assigned to a tier and troubleshoot faster. When rules cannot cover long-tail cases, a classification model can be introduced, but rules should remain as a fallback.
Trade-offs Between Fast and High-Quality Tiers
Fast tiers usually provide lower time-to-first-token and higher throughput, making them suitable for conversational completion, short text rewriting, format conversion, and similar tasks. High-quality tiers are more stable for complex reasoning, long document understanding, and code generation, but they are slower and more expensive.
Three principles can guide the trade-off. First, define the maximum user-perceptible wait time before deciding which scenarios are allowed to use high-quality tiers. Second, for high-frequency scenarios that are called repeatedly, prioritize evaluating whether a fast tier can complete the task to reduce overall cost. Third, for scenarios with significant downstream impact, such as contract clause summaries or statistical conclusions, spend more resources to ensure quality.
Quantifying Cost and Quality
After tiered scheduling is live, monitor outcomes instead of relying on subjective impressions. Recommended metrics include:
- Time-to-first-token and total latency: collect P50, P95, and P99 values per tier.
- Per-call cost: compute based on tier pricing and average token usage.
- Task completion rate: measure the proportion of results accepted, modified, or resubmitted by users.
- Downgrade rate: measure the proportion of requests that fall back to lower tiers due to timeout or errors.
A useful evaluation formula is:
Effective cost per accepted task = total cost ÷ number of accepted tasks
This metric reflects both cost and quality. A tier may have low per-call cost, but if its acceptance rate is very low, its effective cost per accepted task may not be lower.
Fault Tolerance, Retry, and Degradation
Model services can time out, be rate-limited, or become temporarily unavailable. The scheduling system needs explicit fault tolerance policies:
- Timeout control: set a cap for each call. Release resources immediately after timeout to prevent request accumulation.
- Exponential backoff retry: double the retry interval after each attempt to avoid amplifying traffic during failures.
- Degraded fallback: when a high-quality tier is unavailable, fall back to the next tier and indicate possible quality differences in the result.
- Circuit breaking: when the failure rate of a tier exceeds a threshold, stop sending requests to it temporarily, then gradually restore traffic.
The following example shows a call path with fallback and retry.
import timedef call_with_fallback(prompt, call_model,order=("pro", "standard", "fast"),retries_per_tier=2):"""Call model tiers in order; fall back to the next tier on failure."""last_error = Nonefor tier in order:for attempt in range(retries_per_tier):try:return call_model(tier, prompt)except TimeoutError as exc:last_error = exctime.sleep(0.5 * (2 ** attempt))raise RuntimeError("All tiers failed") from last_error
The fallback order should be set according to business priority. If quality is prioritized, start with high tiers and degrade. If availability is prioritized, start from the standard tier during peak hours.
Observability and Continuous Optimization
Every routing decision should leave a trace. Logs should include request ID, task profile, selected tier, actual latency, whether a fallback occurred, and final result status. These fields support problem investigation and later threshold adjustment.
Optimization can be done with small traffic comparisons. For example, route a subset of similar requests with new rules, compare acceptance rate and latency against the original rules, and switch all traffic only after improvement is confirmed. Change one variable at a time so the effect can be attributed clearly.
Implementation Checklist
- Label task profiles using real request samples and determine initial thresholds.
- Set timeout and retry counts for each tier.
- Define fallback order and include degradation status in results.
- Log enough fields to analyze cost and quality by tier.
- Have a gray release and rollback plan so threshold changes can be quickly undone.
Tiered scheduling by task difficulty essentially allocates limited compute resources where they are needed most. Clear rules, traceable metrics, and prepared fault handling allow multi-model capabilities to serve office collaboration scenarios reliably.
