Evaluating LLM Inference Cost: A Practical Guide to Model Selection
Comparing per-million-token prices between model generations often leads to wrong conclusions. This guide explains why unit price alone is misleading, how to build a comparable measurement system based on effective token cost, effective throughput, and quality thresholds, how to convert speed differences into cost differences, and which optimization techniques reduce cost before you negotiate price. It also outlines a four-step decision workflow and common pitfalls to avoid.
1. The Core Problem: Why Unit Price Comparisons Mislead
When evaluating the pricing of a new generation of LLM APIs, the most common approach is to divide the per-million-token price of the new flagship model by that of the previous generation, conclude that it is “more than twice as expensive,” and then judge that cost-effectiveness has declined. This reasoning does not hold up in engineering practice, for three reasons.
First, the denominator of unit price is the token, but what the business actually consumes is the “effective tokens required to complete a task.” If the new model returns the correct structure in a single pass on the same task and requires less rework, the total token consumption end to end may actually drop.
Second, unit price ignores time cost. Generation speed (output tokens per second) directly determines how long users wait and how much concurrency the system can support. Under the same concurrency pressure, a model with higher throughput can serve the same request volume with fewer instances and shorter queue times.
Third, unit price ignores the cost of failure. Invalid formatting, retries, and manual review are all hidden expenses, and they are usually far larger than the price difference itself.
So the right object of evaluation is not “how much per million tokens,” but “how much money and how many milliseconds per successfully completed task.”
2. Building a Comparable Measurement System
Break the evaluation metrics into three layers and narrow them down layer by layer.
1. Cost Layer: Cost per Effective Token
Defined as follows:
cost per effective token = total cost / number of effective tokensnumber of effective tokens = input tokens + output tokens - wasted tokens from failures/rework
“ Wasted tokens” here include structured output rejected by a validator, repeatedly generated fragments, and historical content passed in again due to redundant context.
2. Efficiency Layer: Effective Throughput and End-to-End Latency
Three easily confused quantities need to be distinguished:
- Time to first token: determines how responsive the interaction feels;
- Output rate: determines the experience of long-form generation;
- Effective throughput: the number of tokens successfully produced and adopted by the business per unit of time.
Effective throughput can be approximated as:
effective throughput ≈ output rate × first-pass rate × concurrency utilization
The first-pass rate (the proportion of outputs that are structurally valid, usable in content, and need no retry) is often where the gap between old and new models is largest, and it is also the item most easily missed in price comparisons.
3. Quality Layer: The Task Quality Threshold
Instead of asking generally “which model is smarter,” find the quality threshold the business can accept. The approach is to sample real traffic to build a small evaluation set, label items as “usable/unusable,” plot the curve of quality against model tier, and find the tier that just crosses the threshold. Anything beyond that inflection point is paying for marginal returns and should be treated with caution.
3. Converting Speed Differences into Cost Differences
Assume the unit prices of two generations differ by some multiple, but the new generation has a significantly higher output rate. A simplified capacity model can illustrate the impact:
required concurrency ≈ peak request rate × average generation timeaverage generation time ≈ output tokens / output rate
When output rate increases, average generation time drops proportionally, and required concurrency drops accordingly. Under deployment models billed per instance, per quota, or per reserved throughput, these savings directly offset part of the unit price increase. In addition, shorter queue times reduce the timeout retry rate, further cutting wasted tokens.
What needs emphasis is that the specific multiple varies with the load profile: short requests and low-concurrency scenarios are insensitive to speed, while long-form, high-concurrency, interactive scenarios are highly sensitive to it. Conclusions must therefore rest on your own load test data, not on general claims.
4. Optimization Checklist: Shrink the Denominator First, Then Talk About Unit Price
Before complaining about unit price, there is usually a lot of room left to compress.
- Context slimming: inject only the necessary fragments, remove repeated system instructions and lengthy history; input tokens often have considerable room to shrink.
- Prefix cache reuse: put stable system prompts, tool descriptions, and reference documents at the request prefix, and use server-side caching to cut repeated computation.
- Structured output constraints: constrain output with an explicit schema to reduce parsing failures and retries.
- Streaming responses: deliver the first segment early to improve perceived latency, and make it easier to terminate low-quality generation early.
- Tiered routing: split requests by difficulty, sending simple tasks to a lightweight tier and complex tasks to the flagship tier.
- Batching and asynchrony: submit offline tasks in merged batches, trading throughput for unit price.
- Result caching: build a semantic cache for high-frequency repeated questions; a cache hit means zero model cost.
Illustrative routing logic:
def route(task):if task.max_output_tokens < 200 and task.difficulty == "low":return "light_tier"if task.requires_structured_output and task.difficulty == "high":return "flagship_tier"return "standard_tier"
5. Decision Workflow and Common Pitfalls
A four-step approach is recommended: sample real traffic to build an evaluation set; measure first-pass rate and output rate on the candidate tiers; plug those into your own concurrency model to convert to total cost; then run a canary release with monitoring and alerting, and keep rechecking cost per effective token.
Common pitfalls include: making decisions on unit price alone; substituting public leaderboards for your own evaluation; ignoring redundancy on the input side; treating first-pass rate as a constant; and having no cost dashboard, so optimization results cannot be quantified.
6. Conclusion
“Is it expensive” is a question missing its denominator. Once the metrics become cost per effective token, effective throughput, and the quality threshold, the price multiple is just one input variable rather than a conclusion. If you need general cloud capabilities such as elastic compute, logging, monitoring and alerting, and object storage to support the load testing and dashboard system described above, you can combine the relevant product categories from Baidu AI Cloud as needed, and complete model selection with data rather than impressions.
