Why LLM Inference Costs Drop to a Quarter: KV Cache and Hit Rate Explained
This article explains why the per-token inference cost of large language models can keep falling, using a recent permanent price cut to one quarter of the original price as the starting point. It covers the autoregressive generation process, how KV Cache removes repeated computation, a formula and example for estimating KV Cache memory usage, and why cache hit rate is the key variable behind cost differences. It also offers practical tips on prompt structure, context length, observability, and cloud infrastructure for long-context and multi-turn workloads.
1. Behind the Price Drop: The Technical Logic of Falling Inference Prices
A major model service recently made a permanent price cut to one quarter of the original price, sparking widespread discussion. Much of the attention has focused on the cut itself. From an engineering perspective, however, price is only the outcome. The more interesting questions are why the inference cost per token can keep declining, and what role cache hit rate plays in that trend.
Any model service’s pricing is shaped by multiple factors, including compute supply, inference framework efficiency, and request structure, so it cannot be attributed to a single technology. That said, for typical workloads such as long context and multi-turn conversations, eliminating repeated computation through cache reuse is indeed one important source of improvement in the cost structure. When the cache hit rate approaches 100%, the actual computation the server performs for each new token is far lower than in a naive implementation that recomputes everything. Those savings ultimately show up in billing.
2. The Basic Mechanism: Autoregressive Generation and KV Cache
2.1 Why Caching Is Needed
Large language models generate text autoregressively: each step produces one token, appends it to the end of the sequence, and then generates the next. Given the input “today weather”:
Step 1: input [today, weather] -> output isStep 2: input [today, weather, is] -> output goodStep 3: input [today, weather, is, good] -> output ...
In the attention mechanism, every token produces three vectors: query (Q), key (K), and value (V). The problem is that the K and V of the first three tokens in Step 2 were already computed in Step 1 and are identical, yet they are computed again. The longer the sequence, the worse this waste becomes, and the overall complexity degrades from “processing only the new token” to “repeatedly processing the full sequence.”
2.2 The Caching Strategy
KV Cache works as follows: after each token is computed, its K and V are written to GPU memory. During subsequent inference, the K and V of historical tokens are read directly, and only the newest token needs full Q, K, and V computation. The new Q is then used to score attention against all cached K, and multiplied by the cached V to produce the output. This reduces the computation per step from the full sequence to a single token, noticeably improving both throughput and latency for long-text inference.
3. Capacity Estimation: How Much GPU Memory Does KV Cache Use
Caching is not free. It consumes GPU memory and grows linearly with sequence length. The general estimation formula is:
KV Cache = 2 × num_layers × num_heads × head_dim × seq_len × bytes_per_value
For 32 layers, 32 heads, a head dimension of 128, a sequence length of 4096, and FP16 (2 bytes):
Per token per layer: 2 × 32 × 128 × 2 = 16384 bytes = 16 KBTotal: 16 KB × 32 layers × 4096 tokens ≈ 2 GBWith a concurrent batch size of 10, roughly 20 GB
As shown, in long-context or high-concurrency scenarios, cache usage can even exceed the model parameters themselves and become a memory bottleneck. In practice, engineers typically combine paged cache management, prefix sharing, and quantization-based compression to reduce that footprint.
4. Hit Rate: The Key Variable Behind Cost Differences
Whether caching actually saves money depends on the hit rate. A high hit rate means many requests share the same prefix, such as a system prompt, a long document, or multi-turn history, allowing the server to skip repeated prefill. A low hit rate means the cache only adds memory pressure without delivering benefits.
When evaluating hit rate, focus on three things. First, prefix consistency: whether the system prompt and fixed context remain stable. Second, session reuse: whether multi-turn conversations keep hitting the same history. Third, whether the cache eviction policy is sound, so hot prefixes are not evicted too early. A hit rate close to 100% typically appears in “fixed long prefix plus multi-turn appends” workloads, which is also the typical scenario where long-context service costs fall sharply.
5. Practical Recommendations
- Structure your prompts: put stable, unchanging content first and variable content last to improve prefix reuse.
- Control context length: keep only necessary history to reduce cache usage and prefill overhead.
- Prioritize observability: use logging services and monitoring alerts to track time to first token, throughput, and cache behavior, and locate bottlenecks.
- Choose cloud capabilities sensibly: run inference services on a container platform, store long documents in object storage, use a message queue to smooth traffic spikes, and rely on elastic scaling to handle traffic fluctuations.
6. Conclusion
The drop to one quarter of the price is not the achievement of a single technology, but the combined result of inference framework optimization, cache reuse, and compute scheduling. For developers, understanding the KV Cache and hit rate mechanisms is more valuable than focusing on a single price cut: it determines whether you can genuinely reduce costs in long-context scenarios.
