LLM Model Selection for Software Development: A Tiered Approach
Learn how to route software development tasks between frontier and efficient LLMs based on failure cost, measured quality, latency, and total cost per accepted result. This article outlines task classification, internal evaluations, escalation rules, and a rollout process that balances model spending with engineering quality.
A common mistake when introducing large language models into a development team is to use the “strongest model” for everything. Writing comments, changing local logic, summarizing meetings, tracing defects across services, and turning multiple documents into presentation-ready conclusions have very different requirements for reasoning depth, context length, and error tolerance.
Routing every request to an expensive model makes spending grow with call volume, yet most routine changes do not become noticeably better. Routing everything to a cheaper model can lead to repeated rework on multistep debugging, long-document comparisons, and conflicting evidence. The savings on inference then disappear into engineering time.
A more reliable approach is to treat models as routable capability tiers rather than a single vendor’s product hierarchy. In this article, frontier models and efficient models refer to two categories of general-purpose LLMs with different capability and price ranges, not specific product families.
The key question is not which model has the highest advertised score. It is whether the quality improvement on your own task distribution justifies the cost multiplier.
1. Classify Tasks by Failure Cost, Not Job Role
The same engineer alternates between low-risk and high-risk work throughout the day. Start by asking what happens if a task is done incorrectly.
Efficient models are a good fit for tasks with low failure costs, short workflows, and clear acceptance criteria. Examples include:
- Updating names and boundary conditions based on existing review comments.
- Drafting tests for a function.
- Turning meeting notes into action items.
- Producing an initial API description from a template.
These tasks have relatively contained context, and errors are usually easy for a reviewer to spot.
Frontier models are more appropriate as the default for work with high failure costs or consistency requirements across multiple sources. Examples include:
- Locating a regression across services and proposing a reproducible fix.
- Comparing specifications to identify contradictory requirements.
- Turning research reports and data tables into an external presentation while keeping figures consistent.
- Handling state-machine behavior under rare business rules.
These tasks involve many intermediate steps. Using the wrong evidence at one step can invalidate the entire conclusion.
Do not classify borderline tasks by intuition alone. Reviewing a pull request may sound routine, but changes involving permissions, money, or data consistency raise the cost of failure. Escalate those requests rather than permanently assigning a model tier based on the task name.
2. Use Four Criteria to Assess Whether a Higher Price Is Justified
Public benchmarks provide useful signals, but they are not sufficient grounds for purchasing decisions. Evaluate at least four dimensions before deployment.
Quality improvement
On the same internal task set, measure the frontier model’s advantage in pass rate, first-attempt success rate, and human rework.
If the quality gap is small while the price differs by several times, route requests to the efficient model by default and escalate failed cases.
Cost structure
Do not look only at output-token prices. A call’s cost includes uncached input, cached input, and output tokens. Repeated attempts add further cost.
Large repositories and long specifications can make input tokens a substantial part of the bill. Where prefix caching or session reuse is supported, the marginal cost of repeated context can fall significantly.
An efficient model may have lower token prices but generate longer answers or require more retries. Its actual cost may therefore be higher than expected.
Latency and interaction patterns
Pair programming and inline completion require fast feedback. Offline design-document generation and overnight batch processing can tolerate slower, deeper reasoning.
Putting a slow model into a high-frequency interactive workflow can cause engineers to stop using it, undermining the routing strategy.
Context handling and tool use
Cross-service debugging often requires logs, configuration, traces, and test results. Strong single-turn benchmark scores cannot compensate for a model that has too little usable context or cannot reliably use retrieval and execution tools in sequence.
In such cases, improve the workflow first. Have software retrieve relevant excerpts, then let the model reason over a bounded context instead of sending the entire repository unchanged.
3. Define Routing Rules for Development Work
Development requests can be divided into four practical categories, each with a default tier and escalation conditions.
Local edits and style alignment
Use an efficient model by default. Provide the relevant file excerpts, constraints, and acceptance examples rather than the entire repository.
Escalate when two consecutive patches fail the existing tests.
Review and incremental refactoring
Use an efficient model by default, but require it to identify risks before proposing a patch.
Escalate changes involving security boundaries, concurrency, or data migration. A human remains responsible for the merge decision; the model’s output is only a candidate.
Cross-module defect diagnosis
Use a frontier model by default, or a two-stage workflow in which an efficient model proposes hypotheses and a frontier model evaluates them.
First, use retrieval software to narrow the scope to relevant modules. Then require the model to provide a minimal reproduction, a suspected root cause, and a rollback plan.
If the evidence is insufficient, the model must explicitly identify what is unknown. It must not invent stack traces.
Documents, spreadsheets, and presentation materials
Choose the tier based on whether the output is external-facing and whether its figures must be traceable.
Use an efficient model for internal meeting summaries. Use a frontier model for external materials, comparisons across sources, and reports that require consistent figures and claims.
Require references to exact source passages or spreadsheet cell locations so that reviewers can verify the output.
Illustrative routing logic can be simple. What matters is that the rules are explainable and can be replayed:
def choose_model(task):if task.failure_cost == "high" or task.hops >= 3:return "frontier"if task.kind in {"review", "local_edit", "meeting_notes"}:return "efficient"if task.retries >= 2:return "frontier"return "efficient"
These tier names are policy labels. In production, map them to model endpoints that you have integrated and evaluated.
Log each routing decision, input size, cache-hit status, and whether a human rewrote the output. These records make later cost analysis possible.
4. Make Internal Evaluations Reflect Merge Criteria
External test sets rarely match the distribution of work in your repository. Build a manageable internal evaluation set—for example, several dozen to a little over a hundred cases—covering real pull requests, production defects, and documentation tasks.
Refresh the set weekly to reduce the risk of models or prompts becoming overfitted to old cases.
For coding tasks, “it compiles” is not an adequate acceptance standard. More useful criteria include:
- The patch changes only the necessary scope.
- Existing tests pass.
- New tests detect the original defect.
- There is no obvious unrelated refactoring.
- A maintainer would accept the patch with only minor changes.
Use scripts to run tests and human sampling to assess maintainability. Track first-attempt success rate as well as the average number of lines a human must modify.
For routine administrative tasks, measure compliance with constraints: budget, timing, location, and prohibited choices. Check whether the model presents numbers absent from the source material as facts.
For decision-support tasks, require a verifiable comparison table rather than advice that cannot be traced to evidence.
Both model tiers must have the same tool permissions, context-trimming rules, and stopping conditions during evaluation. Giving one model maximum reasoning effort while limiting the other’s steps produces a comparison that cannot reliably guide purchasing.
If the efficient model performs close to the frontier model on your task set at a fraction of the per-task cost, make it the default. Reserve the frontier model for escalation and sampled quality checks.
That ratio must come from your own repeated evaluations, not from external marketing claims.
5. Calculate Cost per Accepted Result
Comparing prices per million tokens can be misleading. A more useful metric is the average money and time required to produce an acceptable result.
Estimate the cost of a successful result as follows:
p_in,p_cache, andp_out: prices for uncached input, cached input, and output tokens.t_in,t_cache, andt_out: corresponding token counts.n: average number of attempts.h: human rework time in hours.c: hourly labor cost.
Cost per successful result ≈n × (t_in × p_in + t_cache × p_cache + t_out × p_out) + h × c
Token counts and token prices must use matching units.
When a weaker model increases both n and h, lower token prices can translate into higher total costs. Conversely, a frontier model that produces shorter outputs and succeeds on the first attempt more often may cost less on complex tasks than a nominally cheaper model.
Price reductions, cache-hit rates, and output lengths therefore belong in the same cost comparison. No single metric tells the whole story.
For batch workloads, also examine which calls consume the available plan allowance. Keeping frequent, low-value calls on the cheaper tier leaves more capacity for high-value work.
This is what doing more with the same budget actually means: fewer wasteful calls, not a sudden increase in model intelligence.
6. Add Escalation, Downgrading, and Quality Controls
Use an efficient tier by default and escalate under defined conditions, rather than starting every request on the frontier tier and downgrading after failure. The latter spends most of the budget on tasks the cheaper model could already handle.
Escalation signals can include:
- Failed tests.
- An explicit user request for a second review.
- Conflicting source materials.
- The model reporting insufficient evidence.
- Output that triggers security or compliance rules.
Signals for moving a task to the efficient tier include:
- The task is identified as template-based.
- Context has been reduced to a single file.
- The efficient model has maintained the required first-attempt success rate on similar tasks over the past week.
Preserve clear human–model boundaries at both tiers. Models can draft patches and comparison tables, but an accountable person must confirm merges, external publication, and decisions involving personal safety or money.
At minimum, logs should record:
- Routing reason.
- Model tier.
- Token usage.
- Number of tool calls.
- Whether a human rewrote the output.
Teams already using general-purpose capabilities such as model gateways, logging, and monitoring alerts on Baidu AI Cloud can collect these fields centrally and analyze cost per successful result by application, task type, and tier, rather than looking only at total call volume. This refers to usage observability and routing governance, not a commitment to custom delivery or a statement about availability in every region.
Prompts should also differ by tier. Efficient models benefit from explicit constraints: which files to change, what must remain untouched, and what counts as completion.
Frontier models need task decomposition and an evidence inventory. Without them, a model may reason deeply in irrelevant directions, increasing both output tokens and latency.
Neither tier should be forced to produce a definitive conclusion. When evidence is missing, stopping and listing the gaps is usually cheaper than inventing a convincing-looking patch.
7. Roll Out the Strategy in Stages
- Label two weeks of real work. Measure the share of each task category before choosing a flagship model.
- Evaluate a sample from each category. Use double-blind evaluation, or at least cross-review, to calculate first-attempt success rates and cost per successful result.
- Move suitable categories to the efficient tier. Start with high-volume categories where the quality gap is small, while retaining one-click escalation.
- Replay routing rules monthly. Use new failure cases and remove escalation conditions that no longer provide value.
Model tiers are part of production cost management. Allocate them according to task failure cost and measured quality improvement.
Reserve the stronger tier for complex, multihop work and external-facing outputs that require consistent evidence and figures. Use the more economical tier for routine reviews, local edits, and structured summaries, with tests, source references, and human approval protecting quality.
This avoids paying several times more for marginal benchmark gains while also preventing false economies that create repeated rework on genuinely difficult tasks.
