Why LLM Inference Costs Can Drop by an Order of Magnitude
This article explains why large language model inference prices can fall by an order of magnitude, focusing on resource utilization rather than marketing. It examines the redundancy in autoregressive generation, how KV Cache removes repeated computation, a formula for estimating its memory footprint, and the three main sources of high cache hit rates. It also offers practical guidance on prompt ordering, monitoring, capacity planning, and elastic scaling.
1. Behind the Price Drop: Better Resource Utilization, Not Marketing
When LLM inference services announce price cuts such as “down to one quarter of the previous price,” the change is often attributed to market strategy. From an engineering perspective, however, prices can only keep falling if the real resources consumed per request are decreasing. When the cache hit rate for a large volume of requests approaches saturation, the compute and GPU memory reads the server actually spends on each request are significantly amortized. Only then does the cost curve show a step change.
It is important to distinguish a permanent price reduction from a limited-time discount. The former means the provider’s medium- to long-term view of unit cost has changed; the latter is just short-term promotion. So the right way to discuss this phenomenon is to look inside the inference engine and see how it eliminates repeated computation.
2. Redundancy in Autoregressive Generation: Where the Problem Comes From
Text generation is an autoregressive process: each step produces one token, which is appended to the sequence for the next step. Given the input “the weather today”:
step1: [the weather today] -> predict "is"step2: [the weather today is] -> predict "nice"step3: [the weather today is nice] -> predict ...
In the attention mechanism, every token produces three sets of vectors: Q (query), K (key), and V (value). The problem is that step2 needs the K and V of the first three tokens, which were already computed in step1 with exactly the same results. The longer the sequence, the more wasteful this repeated computation becomes, and the overall complexity degrades from “compute only the new token” to “recompute the whole sequence at every step.”
3. How KV Cache Works and How to Quantify Its Memory Usage
KV Cache takes a straightforward approach: after each token is computed, its K and V are written to GPU memory. The next step computes only the Q, K, and V of the new token, scores attention between the new Q and all cached K, and then applies the weights to the cached V.
Its memory usage can be estimated with a general formula:
KV = 2 × num_layers × num_heads × head_dim × sequence_length × bytes_per_value
With 32 layers, 32 heads, a head dimension of 128, and FP16, a single token in a single layer takes 2 × 32 × 128 × 2 = 16KB. At a sequence length of 4096, that is about 2GB; with a batch size of 10, about 20GB. This shows that in long-context and high-concurrency scenarios, the cache itself may consume more GPU memory than the model weights and become the real bottleneck.
4. Three Sources of High Hit Rates
- Prefix reuse: system prompts, long documents, and code repository context often stay the same across requests, so a cache hit avoids recomputation.
- Paged cache management: splitting the cache into fixed-size blocks allocated on demand reduces fragmentation and wasted usage, allowing more historical context to be retained.
- Scheduling affinity: routing requests that share a prefix to the same instance prevents the cache from being repeatedly flushed.
5. Practical Recommendations
- Put stable content first and variable content last to maximize the shared prefix length.
- Use monitoring and logging services to track hit rate, time to first token, and GPU memory levels, not just unit price.
- In capacity planning, account for cache memory and weight memory separately, and leave headroom for bursts of long text.
- Use elastic scaling and request prioritization on container platforms and message queues to turn cost savings into real resource curves.
In short, the underlying logic of cheaper inference is turning “recompute” into “look up and read.” Understanding KV Cache means understanding the key variable in the cost structure of today’s LLM services.
