LLM Selection: Optimize for Cost per Successful Task
Choose large language models based on reproducible, multi-stage evaluations rather than headline capabilities or token prices alone. This article explains how to measure strict pass rates, calculate cost per successful task, compare failure patterns, and route workloads across models and reasoning settings to balance reliability, latency, and spending.
Why the “Strongest Model” Is Often the Wrong Choice
When a new flagship model arrives, teams often review the capability claims in its release notes and switch their default routing all at once. The problem is that coding, retrieval-augmented generation (RAG), and multi-turn agent tasks often fail late in the workflow—not in the first response.
A model may produce a seemingly complete solution but fail on interface constraints, regression checks, or consistency across a long context. In those cases, nominal capability differences matter less than the tokens, latency, and manual rework required to complete a task successfully.
A more reliable selection process is to fix the evaluation tasks and acceptance criteria first, compare strict pass rates second, and then divide total cost by successful completions. Release dates and context-window sizes describe capability boundaries; they cannot replace these measurements.
Design Multi-Stage Evaluations First
Single-turn questions can easily overestimate model performance. Multi-stage tasks are more useful for engineering decisions: clarify requirements, break down the solution, implement it, run self-tests, and revise it using failure feedback. Each stage should have automatically verifiable checkpoints.
A strict pass means passing every checkpoint—not producing an answer that looks mostly correct.
Follow these principles when designing evaluations:
- Use tasks from real repositories or sanitized internal tickets, rather than selecting only algorithm problems that models handle well.
- Make checkpoints scriptable: compilation, unit tests, static analysis, interface contracts, and critical business assertions.
- Keep input materials, tool permissions, and maximum turns fixed for each task. Avoid ad hoc human prompting during a run.
- Record the stage at which each failure occurs. If most failures happen during the final revision, the bottleneck is likely long-horizon consistency rather than basic knowledge.
The evaluation set does not need to match the scale of a public leaderboard, but it must cover the team’s main workloads: short code completions, cross-file changes, answers based on long documents, and agent workflows with tool calls.
A model that leads in only one task category is a poor choice as the sole default.
Compare Distributions, Not Just Averages
When frontier models have strict pass rates within a narrow range, rankings become sensitive to random variation and prompting. A difference of a few passed checkpoints often provides insufficient statistical support for replacing a model across the board.
Look at three distributions:
- Task types. If one model is slightly better on short tasks while another is more reliable with long contexts and multi-file changes, route workloads accordingly rather than switching everything.
- Failure modes. Does the model invent interfaces, ignore constraints, or unnecessarily rewrite previously passing work after intensive reasoning? The last pattern shows that thinking longer does not always produce a better result.
- Variance. A model whose pass count fluctuates substantially across repeated runs with the same configuration is a poor fit for unattended batch processing.
Reasoning effort is a separate control. Increasing the reasoning budget usually raises latency and output-token usage. It may help with difficult tasks, but it can also introduce unnecessary changes on simple ones, causing previously passing checkpoints to fail.
Evaluate each reasoning setting separately on the same task set. Do not assume that a higher setting is automatically more effective.
The Billing Profile Matters More Than the Listed Price
Flagship models typically charge separately for input and output tokens. Some also have pricing tiers for faster responses, long contexts, or batch processing.
Do not compare models using only their advertised price per million tokens. Reconstruct the bill from actual requests:
- System prompts, tool definitions, and conversation history all count as input. Agent loops can send the same context repeatedly.
- If reasoning tokens count as output or are billed separately, costs at higher reasoning settings can rise nonlinearly.
- Failed requests still incur charges. A drop in pass rate can increase cost per successful task substantially, potentially doubling it when accompanied by higher spending.
- Pricing periods, cache hits, and batch discounts can change the optimal route. Reassess costs by billing period rather than relying on launch-day prices.
Let C be the total cost of running a configuration on a fixed task set, and S the number of strict passes. Its cost per successful task is C/S.
Ranking configurations by this metric usually reflects financial outcomes better than ranking them by pass rate or listed price alone. If increasing reasoning effort raises C substantially while S stays flat or falls, that setting should not be the default.
An illustrative calculation is:
Cost per successful task =(input tokens × input unit price+ output tokens × output unit price+ other charges)/ number of strict passes
Token counts and charges should cover all evaluated attempts, including failures. Use the prices in your contract and the current price schedule; do not copy figures from evaluation articles directly into a budget.
Providers do not necessarily bill the same items. Before comparing them, establish a consistent definition of which tokens and charges belong in the numerator.
Route by Workload Instead of Keeping One Default Model
A practical routing policy can divide tasks into three tiers based on risk and context requirements:
- Low risk, short context: Code completion, format conversion, and drafting. Prioritize low latency and low unit prices, and cap output length.
- Medium risk, repository or document access required: Use the model with a stable pass rate and the lowest cost per successful task as the default, with a limit on agent turns.
- High risk, long materials or multiple tools: Allow higher reasoning effort or a larger context window, but enforce a budget cap and human spot checks. On failure, fall back to a more reliable configuration rather than retrying indefinitely.
Put routing rules in configuration rather than hiding them in prompts. For example, use task labels to select the model, maximum tokens, temperature, and whether tools are allowed.
Change only one variable at a time in controlled comparisons. Otherwise, you cannot determine whether the model, prompt, or reasoning setting caused the difference.
Size context windows around real input materials rather than advertised maximums. Very large contexts can mean more expensive input and a greater risk of losing constraints buried in the middle.
A workflow that retrieves relevant material, summarizes it, and then answers is often cheaper and more reliable than placing every file into a single request.
Implementation Checklist
- Freeze an internal task set and automated scoring scripts. Distinguish strict passes from partial passes.
- Run the same task set for each candidate model and reasoning setting. Record token usage, latency, and failure stage.
- Calculate cost per successful task, with breakdowns by task type rather than only an aggregate score.
- Turn the winning configurations into routing policies. Set usage-share limits and budget alerts for expensive settings.
- Rerun key subsets whenever prices, model versions, or system prompts change. Routing may need adjustment even when pass rates remain unchanged but the billing profile shifts.
At a minimum, monitor request volume, input and output tokens, failure rate, P95 latency, and costs broken down by application.
Cost anomalies often appear first as longer agent loops or repeated transmission of oversized conversation histories—not as changes in unit prices.
Conclusion
Model selection is not about finding one model that leads on every marketing claim. It is about using reproducible, multi-stage evaluations to identify a combination of configurations with acceptable strict pass rates, the lowest cost per successful task, and tolerable failure modes.
Reasoning effort, context size, and routing decisions all affect cost. Teams still using the previous generation’s default model and reasoning settings should treat remeasurement and workload routing as routine capacity planning—not as a vote for a brand.
