LLM Inference Cost Evaluation: Why Unit Price Is Only Part of the Equation
This article explains why comparing LLM inference services by unit-price multiples can be misleading, and how to evaluate the real cost of effective output. It breaks total cost into unit price, billed token volume, call volume, and task success rate, then examines three measurable dimensions: pricing structure by input/output tokens, throughput and latency, and first-attempt success rate. It also outlines a benchmarking approach using real business samples, six common engineering techniques for reducing cost (semantic caching, prefix caching, batching, model tier routing, output constraints, and observability), and a decision checklist for model selection.
1. Background: Why a Unit-Price Multiple Does Not Equal “More Expensive”
When evaluating a new generation of LLM inference services, the most common comparison is a simple multiple of the per-call price: the new flagship tier costs several times more per unit than the previous flagship tier, so the conclusion is that it has become more expensive. This comparison is arithmetically correct but engineering-incomplete.
The reason is that unit price is only one factor in the cost formula. A real bill is determined by four variables:
Total cost ≈ unit price × billed tokens × number of calls × (1 / first-attempt success rate)
The last three factors change with model capability, output speed, and context management. When a new-generation model has a higher first-attempt success rate, fewer retries, and requires less context per task, total spending on the same business goal can still decrease even if the unit price rises. The right question is therefore not “is the unit price expensive?” but “is the cost per unit of effective output expensive?”
2. Breaking “Expensive” Into Three Measurable Dimensions
2.1 Unit Call Price: List Price Alone Can Mislead
List prices usually distinguish input from output tokens, and the output-side price is generally higher than the input-side price. This means the same price multiple has very different real effects under different workloads. Input-heavy scenarios such as long-document summarization and codebase understanding are insensitive to the output price, while output-heavy scenarios such as long-form generation, structured data extraction, and multi-turn writing are dominated almost entirely by the output price. Evaluation must weight the input/output ratio of your own workload rather than adopting the vendor’s generic list price.
2.2 Throughput and Latency: Speed Is Itself a Cost
Output speed (tokens generated per second) and time to first token directly determine three things: how long a single request occupies a concurrency slot, how many concurrent instances are needed to meet an SLA, and the proportion of timeout retries.
An often-overlooked chain of effects works like this: higher output speed → shorter request lifetime → more requests served at the same concurrency → fewer resources needed to meet the same peak QPS. So when comparing two model generations, the correct comparison is not “new flagship vs. old flagship” but “new flagship standard tier vs. old flagship high-speed tier.” Once speed is aligned and price is compared, the conclusion is often the opposite of intuition.
2.3 Task Success Rate: Retries Are a Hidden Cost Amplifier
If model A has a lower unit price but a noticeably lower first-attempt success rate, failed retries, manual review, and downstream compensation all add cost. Let the first-attempt success rate be p; the expected number of calls to complete one effective task is 1/p, and cost is amplified by 1/p. When p rises from 0.85 to 0.95, effective cost drops by about 10.5%, which is usually enough to offset a unit-price multiple.
3. Build Your Own Benchmark: Do Not Rely on Marketing Claims
During selection, run a small-scale benchmark with real business samples covering at least the following metrics:
- Time to first token, P50/P95;
- Output speed (tokens/s), P50/P95;
- End-to-end duration, P95;
- First-attempt success rate and structured-output validity rate;
- Cost per effective task = total spend / number of tasks passing validation.
Illustrative benchmark skeleton (pseudocode; refer to the actual platform documentation for interface details):
def benchmark(model, samples, repeat=3):records = []for s in samples:for _ in range(repeat):t0 = now()resp = call_model(model, s.prompt) # Unified call wrappercost = resp.usage.input_tokens * price_in \+ resp.usage.output_tokens * price_outrecords.append({"ttft": resp.first_token_at - t0,"tps": resp.usage.output_tokens / (resp.end_at - resp.first_token_at),"ok": validate(resp.text, s.schema),"cost": cost,})return summarize(records) # Output percentiles and success rate for each metric
The key is a “unified call wrapper” and a “unified validation standard”; otherwise the comparison between two model generations is polluted by implementation differences.
4. Six General Engineering Techniques to Reduce Cost
- Semantic caching: Build a vector index and result cache for high-frequency repeated or highly similar requests; a cache hit means zero inference cost. Suitable for scenarios with high long-tail repetition, such as customer-service Q&A and document retrieval Q&A.
- Prefix caching and context reuse: Place stable system instructions and knowledge snippets at the front of the prompt so the inference side can reuse already-computed context, reducing input-side overhead and latency.
- Batching and asynchronous processing: Route offline tasks (log classification, batch extraction, nightly report generation) through a low-priority batch channel, which usually offers better unit cost.
- Model tier routing: Use a lightweight model for simple requests and escalate to the flagship tier only when confidence is low or a rule is triggered, balancing cost and quality.
- Output constraints: Compress wasted tokens through structured output, maximum length limits, and externalized chain of thought; output tokens are often the most expensive part.
- Observability loop: Connect logging services, monitoring alerts, and a cost dashboard, and tag by business line, scenario, and model tier for attribution, so the real cost hotspots can be identified.
The routing logic for tier routing can be simplified as:
def route(req):if req.complexity_score < 0.3 or cache_hit(req):return light_modelif req.risk_level == "high":return flagship_modelreturn standard_model
5. Decision Checklist and Conclusion
Before making a selection decision, answer five questions: What is the input/output token ratio of the workload? What does the SLA require for time to first token and end-to-end duration? What are the current first-attempt success rate and retry rate? Is there cacheable high-repetition traffic? Can the proportion of offline traffic be moved to batch processing?
The conclusion is that a unit-price multiple is an entry ticket, not a verdict. Once speed, success rate, and billing structure are all put into the cost formula, “expensive” and “cheap” often reverse. For most teams, the more reliable path is to first build a reproducible benchmark and a cost-attribution dashboard, then control overall spending with hybrid deployment, tier routing, and caching strategies. This approach does not depend on any specific vendor’s pricing and can be reused as technology choices change. If managed model services, container platforms, object storage, and monitoring alerts are needed as foundational capabilities to support these practices, Baidu AI Cloud provides support at the general product-category level; refer to the official documentation for specific specifications and billing.
