Tiered Routing and Reasoning Effort Control for LLM Chat Services

    Chat services handle a wide range of requests, from simple factual lookups to complex multi-step reasoning tasks. This article presents a practical architecture for matching each request to the right model tier and reasoning effort, covering feature-based routing, a unified effort control, factuality evaluation, answer formatting, resource-type-based quota design, and gray rollout with monitoring. It includes working code examples for routing, effort profiles, factuality metrics, and rate limiting.

    Tiered Routing and Reasoning Effort Control for LLM Chat Services

    1. The Problem: A Wide Spectrum of Requests

    Chat services handle requests across a broad spectrum. On one end are quick tasks completed in seconds: factual lookups, unit conversions, and short rewrites. On the other are multi-turn reasoning tasks such as trip planning, literature research, long-form writing, and decision support involving risk trade-offs. These two categories have very different requirements for latency, reasoning depth, and output length.

    If every request goes to the strongest model at maximum reasoning effort, per-request cost and latency rise, and even simple questions get verbose answers. If everything runs on a lightweight model, the completeness and accuracy of complex tasks suffer. The engineering goal is to give each request resources that match its complexity, rather than choosing between “all high-spec” and “all low-spec.”

    2. Tiered Routing Architecture

    Tiered routing typically involves three steps: request feature extraction, routing decisions, and fallback on failure.

    1. Feature extraction: Collect input length, conversation turn count, presence of code or tables, whether external tool calls are needed, and any intent explicitly stated by the user.
    2. Routing decision: Rules first, with a lightweight classifier as a fallback. Rules can cover well-defined cases such as codebase questions or medical, financial, and legal consultations; the classifier handles ambiguous inputs.
    3. Fallback: When a model times out, returns an empty result, or reports confidence below a threshold, the system automatically escalates to a higher tier or switches to a backup path.

    Here is illustrative code. Function names and thresholds are examples only and should be calibrated with labeled data:

    1. HIGH_RISK_DOMAINS = {"medical", "finance", "legal"}
    2. def classify_request(req):
    3. score = 0.0
    4. score += min(len(req.text) / 500, 2.0) # input length
    5. score += 1.5 if req.has_code else 0.0 # code tasks usually need more reasoning
    6. score += 2.0 if req.domain in HIGH_RISK_DOMAINS else 0.0
    7. score += 1.0 if req.turns > 5 else 0.0 # multi-turn context
    8. return score
    9. def pick_tier(score):
    10. if score < 1.0:
    11. return "fast"
    12. if score < 3.0:
    13. return "balanced"
    14. return "deep"

    Thresholds should not be set by gut feeling. Compute cost, latency, and user satisfaction for each tier on a human-labeled sample set, then determine the cutoff points.

    3. A Unified Reasoning Budget: One Control Instead of Many Options

    When users face two decisions at once—picking a model and picking a reasoning effort level—they often cannot tell the difference. A better approach is for the system to provide a default combination, with the user adjusting a single tier control. The backend maps each tier to a set of parameters, including the reasoning budget (token cap or number of thinking steps), maximum output length, and whether tool calling is enabled.

    1. # Values are illustrative only; tune based on measured results
    2. EFFORT_PROFILES = {
    3. 1: {"reasoning_budget": 0, "max_output": 512, "tools": False},
    4. 2: {"reasoning_budget": 2048, "max_output": 1024, "tools": True},
    5. 3: {"reasoning_budget": 8192, "max_output": 4096, "tools": True},
    6. }
    7. def build_request_config(tier, user_slider=None):
    8. level = user_slider if user_slider is not None else tier
    9. return EFFORT_PROFILES[level]

    Three design points to keep in mind:

    • The default tier comes from the routing result; once a user manually adjusts it, the preference can be saved.
    • Everyday questions stay on the fast tier; planning, research, writing, coding, and decision tasks get higher tiers.
    • Log every tier change so you can later analyze whether users frequently override the system’s judgment.

    4. Factuality Evaluation

    Factual accuracy should be measured through repeatable evaluations, not subjective impressions. A reliable process includes the following steps.

    1. Build an evaluation set: Stratified sampling by domain (finance, medical, legal, general, etc.). Each item includes a reference answer and verifiable sources.
    2. Define scoring criteria: Decide in advance what counts as a factual error—for example, incorrect numbers, wrong citations of laws or regulations, or conclusions that contradict their supporting evidence.
    3. Dual annotation with arbitration: Measure inter-annotator agreement, and have a third person adjudicate disputed samples.
    4. Version comparison: Compare new and old versions on the same evaluation set, reporting both absolute values and relative changes, along with sample size, to avoid misjudgment from small samples.
    1. def error_rate(results):
    2. """Share of answers containing at least one factual error"""
    3. wrong = sum(1 for r in results if r.has_factual_error)
    4. return wrong / len(results)
    5. def relative_reduction(old_rate, new_rate):
    6. """Relative reduction, computed against the old version"""
    7. return (old_rate - new_rate) / old_rate

    Evaluation results for high-risk domains should be reported separately, not blended into overall numbers for general domains. Aggregate metrics can hide weak points in medical, legal, and similar scenarios.

    5. Answer Formatting: Level of Detail and Structure

    Answer format directly affects how much effort readers spend understanding it. A few principles apply to most conversational scenarios.

    • Answer the user’s actual question first, then add necessary supporting evidence. For example, in a weather-and-cycling query, first determine whether wind or rain is the more important variable for riding, then give corresponding advice—instead of listing every weather detail.
    • Adjust detail to question complexity. Quick Q&A needs only one to three sentences; planning tasks deserve a step-by-step structure.
    • Format serves content. Use headings, lists, and tables only when they improve information organization; avoid piling on formatting for visual completeness.
    • When the user’s premise is wrong, point out the problem explicitly. Blind agreement undermines answer credibility. This capability should be reflected in prompts or training data and validated through evaluation.

    6. Quota Design: Metering by Resource Type

    Quota design needs to distinguish between different resources. Text chat, image generation, file uploads, and concurrent requests vary widely in cost, and a single aggregate counter cannot reflect real load. The sensible approach is to set separate limits per resource and keep stricter controls on high-cost ones.

    Here is a token-bucket rate limiting example:

    1. import time
    2. class TokenBucket:
    3. def __init__(self, capacity, refill_per_sec):
    4. self.capacity = capacity
    5. self.tokens = capacity
    6. self.refill_per_sec = refill_per_sec
    7. self.last = time.monotonic()
    8. def allow(self, cost=1.0):
    9. now = time.monotonic()
    10. elapsed = now - self.last
    11. self.tokens = min(self.capacity, self.tokens + elapsed * self.refill_per_sec)
    12. self.last = now
    13. if self.tokens >= cost:
    14. self.tokens -= cost
    15. return True
    16. return False
    17. # Create an independent bucket per resource type
    18. buckets = {
    19. "text_chat": TokenBucket(capacity=100, refill_per_sec=1.0),
    20. "image_gen": TokenBucket(capacity=5, refill_per_sec=0.01),
    21. "file_upload": TokenBucket(capacity=10, refill_per_sec=0.05),
    22. }

    When adjusting quotas, keep in mind:

    • Before relaxing a low-cost path, estimate the cost curve and confirm incremental requests fit within capacity.
    • Roll out quota changes gradually (gray release) before full deployment.
    • When communicating externally, describe only verifiable rules and avoid promising numbers that have not been measured.

    7. Gray Rollout and Continuous Monitoring

    Roll out in three steps: start with a small gray release while watching key metrics; increase traffic gradually once things are stable; keep a one-click rollback switch and record every configuration change.

    Recommended metrics to monitor:

    • Experience: first-token latency, full response time, user re-ask rate and rephrase rate.
    • Cost: compute cost per request, request distribution across tiers.
    • Quality: sampled factual error rate, broken down by domain.
    • Stability: timeout rate and fallback trigger rate per tier.

    Alerts should target abnormal changes, such as a sudden spike in failure rate or unit cost for a given tier. For data handling, logs must be sanitized, evaluation data de-identified, and collection kept to the minimum necessary.

    8. Implementation Checklist

    1. Map out request types and build a labeled sample set.
    2. Start with rule-based routing, logging routing decisions and user feedback.
    3. Design two to three reasoning tiers and calibrate parameters on the evaluation set.
    4. Establish a domain-specific factuality evaluation pipeline that supports version comparisons.
    5. Design a quota model by resource type, with separate metering and rate limiting.
    6. Roll out gradually, monitor metrics continuously, and iterate on thresholds and tier configurations based on the data.