LLM Cost per Task: A Practical Guide to Evaluating Model Economics
This guide explains why falling per-token prices often fail to reduce real bills, and how to evaluate large language models using cost per successful task instead of unit price. It covers a practical cost formula, why smaller activated parameter counts can still be more expensive, how to build a reproducible business-specific evaluation set, token efficiency diagnostics, routing strategies, and workload-specific selection practices, with cost per task, first-pass success rate, and P95 latency as the core metrics.
1. The Starting Problem: Unit Prices Drop, but Bills Do Not
During a period of rapid model capability iteration, many teams are drawn to the “price per million tokens” when selecting a model. Yet when the bill arrives, the cost reduction is far smaller than expected. The original article describes a common pattern: two models score similarly on public aggregate capability leaderboards, differ significantly in parameter size, and have very different unit prices. But once the cost is converted to “completing one real task,” the gap narrows considerably.
The core reason is that the bill is determined by unit price multiplied by usage, and usage is not a constant. It is affected by reasoning length, output length, retry count, context growth, and the number of tool-calling rounds. When a lower-priced model consumes more reasoning tokens, its unit-price advantage is partly offset by its usage disadvantage.
From an engineering perspective, the more reasonable unit of evaluation is therefore not the token, but the cost per successful task.
2. Write Down the Cost Formula First: From Unit Price to Task Cost
A practical approximation looks like this:
Cost per task ≈(input tokens + reasoning tokens + output tokens) × corresponding unit price+ extra tokens from failed retries+ extra input from context assembly and retrieved snippets+ repeated context from tool calls / multi-turn interactions
Three points deserve special attention:
- Reasoning tokens are usually billed on the output side, and their length varies widely;
- Multi-turn interactions and tool calls cause the same context to be counted repeatedly as input;
- Failed retries are a hidden cost and may account for a substantial share of total cost on complex tasks.
The comparison in the original article can be abstracted as follows: Model A (smaller activated size) has a lower unit price but higher token usage per task; Model B (larger activated size) has a higher unit price but lower token usage. In the end, their cost per task differs by only about 20%, rather than the several-fold difference in unit price. This conclusion applies to any evaluation of “replacing a higher-priced model with a lower-priced one.”
3. Why “Fewer Activated Parameters” Can Still Cost More
Mixture-of-experts architectures typically have large total parameters but small activated parameters. A small activated parameter count means lower computation per forward pass and, in theory, less compute. But it does not necessarily mean lower end-to-end cost, for three reasons:
- When capability density is insufficient, the model needs a longer reasoning chain to converge on the correct answer;
- Output is more verbose and format adherence is less stable, causing parsing failures and retries;
- The model is more sensitive to prompts and needs more examples and constraints, further increasing input tokens.
In other words, parameter efficiency, token efficiency, and task success rate together determine cost. Looking at only one of them easily leads to the wrong conclusion.
4. Build a Reproducible Evaluation: Do Not Rely Only on Public Leaderboards
Public aggregate capability indices are suitable for initial screening, not for budget decisions. Teams are advised to build a small but business-relevant evaluation set that covers at least:
- Typical task distribution: extraction, rewriting, classification, code generation, structured output, long-document summarization;
- Difficulty tiers: a certain proportion each of easy, medium, and hard tasks;
- Constraints: output format, maximum length, latency limits;
- Metrics: success rate, first-pass success rate, average token usage, P95 latency, cost per task.
An illustrative evaluation record structure:
{"task_id": "ext-0421","model": "model_a","success": true,"attempts": 2,"input_tokens": 6200,"reasoning_tokens": 38000,"output_tokens": 3000,"latency_ms_p95": 41000,"cost_usd": 0.68}
With structured records, you can build a cost-quality curve instead of switching models based on intuition.
5. Token Efficiency Diagnostics: Find Where the Extra Tokens Go
It is recommended to break tokens into four categories and track them separately: system prompts and tool definitions, retrieval and context, reasoning, and final output. Common optimization points include:
- Compress system prompts and tool schemas, and remove repeated explanations;
- Deduplicate and rerank retrieved snippets, keeping only highly relevant passages;
- Use constrained decoding or strict modes for structured output to reduce correction retries;
- Set a reasoning budget and length limit for tasks to avoid unbounded reasoning;
- Route “hard tasks” and “easy tasks” to models of different sizes.
A simple routing pseudocode:
def route(task):if task.difficulty == "easy" and task.max_len < 512:return small_modelif task.requires_structured_output:return model_with_strong_formatreturn large_model
The value of routing is to send most traffic through a low-cost channel and reserve the high-capability channel for a small number of difficult requests, thereby lowering average cost while keeping success rate nearly unchanged.
6. Scenario-Based Strategies: How to Choose for Different Workloads
- High-concurrency short tasks (classification, tagging, extraction): prioritize small models plus strict output constraints; cost is most sensitive to token unit price;
- Complex reasoning and code tasks: prioritize success rate and first-pass success rate; retry cost often exceeds the unit-price difference;
- Long-document processing: focus on the input side with chunking, summary compression, and cache reuse;
- Multi-turn agents: focus on controlling context growth and tool return length, with history compression when necessary.
7. Make Cost Governance an Engineering Capability
When deploying in the cloud, you can combine general-purpose capabilities: use object storage to keep evaluation sets and call logs, use a message queue for peak shaving and asynchronous retries, use a container platform to host the model gateway and routing service, and use logging and monitoring with alerts to observe token usage, success rate, and P95 latency, along with budget alerts and quotas. Baidu AI Cloud has mature practices in these general-purpose capabilities and can serve as an architecture reference.
Final recommendation: use cost per task, first-pass success rate, and P95 latency as the three hard metrics for model selection, and review them monthly. Unit price is only the entry ticket; token efficiency and stability determine the long-term bill.
