Model Tiering for Coding Agents: A Practical Guide to Reasoning Effort Tuning
Using one default model for every coding-agent task tends to be either overkill for simple fixes or underpowered for complex migrations. This article presents a four-dimension framework for classifying tasks, a recommended tier table, and a default baseline of a mid-high model with medium reasoning effort. It also explains how to tune reasoning effort before switching models, includes a routing example with automatic fallback and validation, and shows how to benchmark routing rules against historical tasks. The goal is to match model capability and reasoning budget to engineering risk instead of choosing by habit.
Why a Single Default Model Is Not Enough
Many AI coding agents let teams set one default model and route every task to it. Configuration is simple, but it creates two problems.
Overkill. For a small bug fix with clear reproduction steps, or adding a function against an existing API document, using the top-tier model usually only increases cost. It does not materially improve output quality.
Underpowered. For a cross-module migration or a performance optimization involving concurrency and data consistency, a lightweight model may miss hidden dependencies and leave the change incomplete. The rework cost can be higher than the model cost you tried to save.
So model selection should be treated as an engineering decision, not a setting you pick once and forget.
Four Dimensions to Evaluate Before Tiering
Before assigning a tier, answer four questions for each task:
- Complexity: How long is the reasoning chain? How many modules are involved?
- Determinism: Are requirements and acceptance criteria clear?
- Error cost: How much time or loss would a mistake cause?
- Runtime mode: Does the task need to run unattended for a long time?
Also include a cost budget for each task.
Complexity is not the same as the length of the requirements document. A migration with a clear specification can still contain many implicit dependencies. Judge by how many implicit dependencies exist and how they interact.
Task Tier Reference
| Task type | Typical examples | Recommended tier | Reasoning effort | Rationale |
|---|---|---|---|---|
| Classification, routing, information extraction | Ticket classification, intent recognition, field extraction from logs | Light | Low | Clear rules, high call volume, short outputs |
| Well-scoped routine development | Fix a bug with reproduction steps; implement a small feature from a clear spec | Medium | Medium | Balanced cost and capability |
| Tasks requiring broad judgment | Cross-module migration, performance optimization, refactors with multiple constraints | Mid-high | Medium, raise when needed | Many hidden dependencies; missing a change is expensive |
| High-risk or high-difficulty tasks | Hard algorithm work, financial modeling, scientific computing, long unattended jobs | Flagship | High | Error cost is high; stronger reasoning and self-checking are needed |
Two additional rules apply:
- If error cost is high, move the task up at least one tier even when the spec is clear.
- For unattended tasks, do not use a tier below medium unless complexity is very low.
Default Baseline and Reasoning Effort Tuning
Without historical data, start with a mid-high model plus medium reasoning effort as the initial baseline. This gives a relatively stable position between capability and cost, avoids obvious failures on difficult tasks, and gives the team a common baseline for comparing task performance.
Deviate from the baseline only when a task is clearly simple or clearly difficult. Moving down saves cost; moving up requires concrete evidence. After you collect historical data, recalibrate the starting point using pass rate, rework rate, and cost. If most tasks in your team are simple, a lower starting tier may be more appropriate.
Reasoning effort is the amount of computation a model spends thinking before generating an answer. Some platforms expose it as low, medium, or high, and may call it reasoning effort or thinking budget. Tier names and effort levels vary by platform. A “high” setting on one platform may mean something different and cost differently from a “high” setting on another. So before writing configuration, read the official documentation and test with your own tasks.
Tuning order:
- Keep the model fixed and set reasoning effort to the appropriate level.
- If repeated attempts still do not meet the bar, switch to a higher-tier model.
- If the task is obviously too simple, move down a tier.
Within the same model, raising reasoning effort is often cheaper than switching to a larger model and may already be enough. That is common, but not guaranteed, so verify it on your own tasks.
Routing Code with Fallback
Below is a rewriteable routing example. Replace model identifiers and tier mappings with your actual platform configuration. run_fn calls the platform API, and validate_fn validates output with tests or schema checks.
from dataclasses import dataclass# Tier-to-model and reasoning-effort mapping. Fill in values from your platform docs.TIER_CONFIG = {"light": {"model": "your-light-model", "effort": "low"},"medium": {"model": "your-medium-model", "effort": "medium"},"mid_high": {"model": "your-midhigh-model", "effort": "medium"},"flagship": {"model": "your-flagship-model", "effort": "high"},}TIER_ORDER = ["light", "medium", "mid_high", "flagship"]EFFORT_LEVELS = ["low", "medium", "high"]@dataclassclass TaskProfile:category: str # e.g. "routing", "bugfix", "migration", "research"complexity: int # 1 to 5, assigned by human or ruleserror_cost: int # 1 to 5, cost of getting it wrongunattended: bool # whether the task runs unattended for a long timebudget_tokens: int # token budget for one taskdef choose_tier(task: TaskProfile) -> str:if task.category == "routing":return "light"if task.complexity >= 5 or task.error_cost >= 5:return "flagship"if task.unattended and task.complexity >= 4:return "flagship"if task.complexity <= 2 and task.error_cost <= 2 and not task.unattended:return "medium"return "mid_high"def raise_effort(effort: str) -> str:i = EFFORT_LEVELS.index(effort)return EFFORT_LEVELS[min(i + 1, len(EFFORT_LEVELS) - 1)]def run_task(task, run_fn, validate_fn, cost_log: list):"""run_fn(model, effort, task) -> {"output", "tokens", "latency_s"}validate_fn(output) -> bool"""tier_idx = TIER_ORDER.index(choose_tier(task))spent = 0while tier_idx < len(TIER_ORDER):tier = TIER_ORDER[tier_idx]effort = TIER_CONFIG[tier]["effort"]for _ in range(2): # Try the same tier twice; raise effort on the second try.result = run_fn(TIER_CONFIG[tier]["model"], effort, task)spent += result["tokens"]passed = validate_fn(result["output"])cost_log.append({"tier": tier,"effort": effort,"tokens": result["tokens"],"latency_s": result["latency_s"],"passed": passed,})if passed:return result["output"]if spent >= task.budget_tokens:raise RuntimeError("Single-task budget exceeded; escalate to a human")effort = raise_effort(effort)tier_idx += 1 # The current tier failed; move up to the next tier.raise RuntimeError("All tiers failed validation; escalate to a human")
validate_fn should perform real checks, such as running unit tests, type checks, or schema validation. Do not rely on the model simply saying it is done. Persist cost_log; later benchmark comparisons need it.
Benchmark with Historical Tasks
Routing rules and tier assignments should be validated with data. Selection based only on intuition is error-prone.
- Build a historical task set. Sample completed tasks from the last three months by category. Use at least 20 tasks per category, and include both successful and reworked cases. Remove sensitive data first.
- Fix initial conditions. Use the same code version, prompt, tool permissions, and acceptance tests for every task.
- Repeat measurement. Run each task with the same configuration at least 3 times. A single run is noisy and should not decide model selection.
- Record metrics:
- Pass rate: percentage of runs that pass acceptance tests without manual changes.
- Rework rate: percentage of runs that need manual changes before merge.
- Total cost per task: input/output token cost, retry token cost, and human rework minutes converted to cost.
- P95 latency: 95% of runs complete within this time.
- Compare and decide. Compare candidate configurations against the baseline on the same task set. Set thresholds yourself. For example, if pass rate drops no more than 2 percentage points and total cost drops materially, you can downgrade. If pass rate improves by more than 5 percentage points and the cost increase is acceptable, you can upgrade.
Common Mistakes to Avoid
- Switch to a bigger model without first tuning reasoning effort. Tune effort first; switch models only after repeated attempts still fail.
- Judge difficulty by the length of the requirements document. Look at implicit dependencies, module count, and error cost.
- Decide based on a single run. Repeat measurements and compare on the same batch of tasks.
