LLM Inference Cost and Throughput Benchmarking: A Practical Analysis
This article breaks down why a low per-token price does not always translate into a low bill, and presents a vendor-neutral framework for evaluating large language model inference services. It covers cost normalization to a comparable cost per million tokens, a cost decomposition formula, the variables required for fair cross-tier comparisons, and the throughput and latency degradation observed under peak load. It also outlines observability metrics and engineering strategies such as tiered routing, cache-friendly prompt design, output budgets, peak/off-peak scheduling, and fallback channels. Readers will learn how to build a cost model, load-test scripts, and degradation policies for stable, predictable production behavior.
1. Background: Why a “Cheap Unit Price” Often Isn’t a Cheap Bill
When deciding whether an LLM inference service is worth adopting long term, the most common mistake developers make is looking only at the listed price. The real bill is determined by four variables together: the pricing structure for input versus output, discounts from cache hits, dynamic pricing across peak and off-peak hours, and the input-to-output ratio of the workload itself. A model with a very low listed price can end up costing more per million tokens in practice if its cache hit rate is low, its output share is high, and it happens to run during peak hours.
For that reason, this article discusses no specific product. Instead, it abstracts a general cost evaluation framework and illustrates the methodology with a typical high-intensity measurement scenario: from the weekend through Monday morning, roughly 180 million tokens consumed, with a bill of about 31 CNY.
2. Cost Normalization: Turning the Bill into a Comparable Cost per Million Tokens
The measurement did not produce a clear statistical basis for the cache hit rate, so only a conservative estimate is possible:
Total spend 31 CNY / 180 million tokens total = 0.31 CNY / 10 million tokens=> roughly 0.17 CNY / million tokensExtrapolated to a 1 billion token baseline => roughly 170 CNY
The value of this conversion is that it establishes a common baseline. Only after converting different services and different billing conventions into a “blended cost per million tokens” and a “1 billion token monthly baseline” can meaningful side-by-side comparisons be made.
Going further, cost can be written as an explainable decomposition:
C_total = T_in * P_in * (1 - h) * d + T_out * P_outwhere h is the cache hit rate, d is the cache discount factor, and T_in/T_out are input/output token counts
This formula reveals three levers: raise the cache hit rate, compress output length, and schedule batch workloads into off-peak hours. In the measured sample, output accounted for only about 0.59% and the cache hit rate was about 93.7% — a classic “input-heavy, output-light” workload (long-document understanding, code repository retrieval, batch extraction). Such workloads are extremely sensitive to the caching mechanism: once the cache is invalidated, cost can jump several times over instantly.
3. How to Compare Tiers Correctly: Same Basis, Same Time Window, Same Workload
When comparing models across tiers, three variables must be locked down: the same time window (off-peak vs. peak), the same workload structure (input/output ratio, cache hit rate), and the same statistical basis (whether reasoning-chain tokens are included). Otherwise, conclusions like “A off-peak is cheaper than B at peak” are meaningless. In practice, the higher and lower tiers of the same model family may differ by only a few times off-peak, while the gap widens further at peak — to the point where the low tier off-peak roughly matches the high tier off-peak, but the high tier doubles at peak.
4. Throughput and Latency: The Experience Cost That’s Easier to Overlook Than Price
Measurements showed generation speed fluctuating around 50–55 tokens/s during low-load periods, which is acceptable. During the weekday morning peak, however, reasoning-chain output dropped to 4–9 tokens/s and main-text output dropped to 12–25 tokens/s — a degradation of more than 80%.
The key risk here is not that it is slow, but that it is unobservable: when the reasoning chain nearly stalls, the caller cannot distinguish “the model is reasoning deeply,” “the service is queued,” and “the connection has dropped.” Engineering practice therefore requires filling in observability:
import time, statisticssamples = []t0 = time.time(); n = 0for chunk in client.stream(...):n += 1samples.append((time.time() - t0, n))# Compute time-to-first-token (TTFT), steady-state TPS, and separate rates for reasoning chain / main textttft = samples[0][0]tps = (n - 1) / (samples[-1][0] - ttft)
At minimum, four metrics should be collected: time to first token (TTFT), reasoning-chain rate, main-text rate, and streaming idle interval. Set threshold-based alerts — for example, treat an idle interval exceeding 10 seconds as anomalous and trigger a retry.
5. Engineering Strategies for Cost and Latency
- Tiered routing: send simple tasks to lower-tier models and complex reasoning to higher tiers, using rules or a small model as a front-end classifier.
- Cache-friendly design: place stable system prompts and long document prefixes first and variable content last, to improve prefix cache reuse.
- Output budget constraints: explicitly cap maximum output length and reasoning budget, so long-tail tasks don’t pull up the average cost.
- Peak/off-peak scheduling: run batch offline jobs at night, and prepare a degradation path for online interactive tasks.
- Dual-channel fallback: switch automatically to a backup channel when the primary exceeds thresholds, and keep exponential backoff retries.
Request -> complexity classification -> lower tier (cache first)-> higher tier (deep reasoning)Streaming monitor: TTFT/TPS/idle interval -> threshold exceeded -> retry/switch/degrade
6. Conclusion
Evaluating an LLM inference service should follow three principles: normalized unit price, same-basis comparison, and full-chain observability. A blended cost of about 0.17 CNY per million tokens shows that lower-tier models offer clear cost efficiency for input-heavy, output-light workloads, but the peak-hour throughput degradation is a reminder that true cost includes the hidden overhead of latency and failed retries. Only by putting the cost model, load-test scripts, and degradation strategy into practice together can you achieve stable, predictable performance in production.
