LLM Price Cuts Explained: How KV Caching Shapes Inference Costs
When a large language model provider cuts prices, headline discounts rarely translate directly into lower bills. This article explains how KV caching, prefix reuse, and billing mechanics actually determine inference costs—covering what "cache hit rates" really mean, why caching is a memory bottleneck, how to build a realistic cost model, and how developers can structure prompts and load tests to reduce the true cost per effective task.
1. Evaluate Price Changes and Technical Changes Separately
When a model service announces that prices have dropped to a quarter of the previous level, developers usually want to know two things: will their bills shrink accordingly, and will service quality remain stable?
Neither question can be answered by looking at a pricing table alone.
A price cut may apply to all input tokens, or only to tokens served from cache; it may cover output, or only certain call patterns. Different discount scopes mean the same headline number can produce very different real-world savings.
Likewise, a price cut does not prove that inference efficiency has improved fourfold. Commercial pricing, hardware utilization, request scheduling, cache reuse, and supply-demand strategy all influence the final price. Without confirmed technical documentation, you cannot infer the underlying implementation from price alone.
A more useful evaluation framework has three layers:
- Billing layer: Which billing items were reduced, and under what conditions.
- System layer: How caching, batching, and resource scheduling affect service cost.
- Business layer: Under quality and latency constraints, how much does one effective task cost?
Among these, caching is often the most misunderstood—and the most worth analyzing in depth.
2. What Problem Does KV Caching Solve?
2.1 Text Generation Involves Massive Reusable Computation
Autoregressive language models generate tokens sequentially. A token is the basic unit of text the model processes—it doesn’t necessarily correspond to a single character or a complete word.
For example, after receiving an input, the model generates the first token, then predicts the next token based on the original input plus what it has already generated.
In models using causal attention, earlier positions cannot attend to future content. So as long as the model parameters, input, and positional handling stay consistent, appending a new token does not change the keys and values already computed for earlier positions.
If the entire history were recomputed for every new token, this would create enormous redundant work.
2.2 The Cache Stores Attention Keys and Values
The attention mechanism typically involves three types of vectors:
- Query (Q): what the current position needs to retrieve;
- Key (K): used to compute how well each position matches the query;
- Value (V): the information to be aggregated into the final result.
The KV cache stores the K and V vectors of historical tokens across all layers. When generating the next token, the model only computes representations for the new position and reads the existing cache to complete attention.
One common misconception needs correcting: having a KV cache does not mean each step involves a fixed amount of computation independent of history length.
Under standard full attention, the new token’s queries still match against historical keys, and the historical values are still aggregated with weights. As context grows, cache reads and attention computation costs still increase.
The cache eliminates repeated computation at historical positions—it does not eliminate all the costs of long contexts.
2.3 Prefill and Incremental Decoding Are Two Different Phases
A typical request has two phases:
Prefill phase: The model processes the input prompt, builds the KV cache for the input portion, and produces the computations needed for the first output token. Longer inputs generally mean more work in this phase.
Incremental decoding phase: The model generates subsequent tokens one by one on top of the existing cache, extending it continuously.
So a task with a long input and short output consumes resources very differently from one with a short input and long output. Counting total tokens alone hides this difference.
3. Within-Generation Caching and Cross-Request Caching Are Not the Same Thing
Understanding this distinction is key to interpreting claims of “high cache hit rates.”
3.1 Caching Within a Single Generation
During one generation, the keys and values of historical tokens are reused across decoding steps. This is a standard inference optimization.
But it is not the same as a billing-level “cached input hit,” and you cannot infer from it that the service discounts all historical input.
3.2 Cross-Request Prefix Reuse
If multiple requests start with exactly the same content, the server may reuse the precomputed state of that shared prefix, provided cache validity and access-permission requirements are met.
For example, repeated document Q&A calls might use this structure:
“Fixed task rules + fixed reference material + the current question”
The first two parts stay constant, forming a reusable prefix. If each request puts a different user question first, the identical fixed content afterward may not qualify for the same prefix reuse.
This kind of reuse depends on more than “semantic similarity.” It usually requires:
- Identical token sequences after tokenization;
- Compatible model and configuration that affect computation;
- Consistent prefix position and context conditions;
- The cache still existing;
- The current request being authorized to access that cache.
Two semantically similar passages cannot simply be treated as the same KV cache.
3.3 Resubmitting Conversation History Doesn’t Guarantee Reuse
Some call patterns resubmit the entire conversation history with each request. This creates conditions for prefix reuse, but whether a hit actually occurs still depends on whether the server supports it, how requests are routed, and whether the cache has been evicted.
The fact that the client sends repeated content does not prove the server skipped recomputation.
4. How to Interpret “Nearly 100% Hit Rate”
Cache hit rates must be reported with their measurement basis, or they easily mislead.
Common bases include:
- Request hit rate: the share of requests that reused at least some cached content;
- Input token hit rate: the share of all input tokens billed as cache hits;
- Compute reuse ratio: how much computation was actually avoided;
- Cache lookup success rate: how many cache lookups found their target.
These metrics are not equivalent. A request that hits only a very short shared opening may still count as a “hit request,” while saving little input cost.
For example, a request containing 9,900 tokens of fixed prefix and 100 variable tokens would show an input-token hit rate of 99% if the entire prefix is reused.
That result mainly indicates a highly repetitive workload—it does not prove any business can achieve the same level. First requests, cache expiration, instance restarts, model switches, and task switches can all lower the overall hit rate.
A rigorous assessment should also report the measurement window, cold-start share, request distribution, and cache TTL.
5. Why KV Caching Becomes a GPU Memory Bottleneck
For standard, uncompressed KV caches, you can use this approximation:
Cache size ≈ 2 × layers × KV heads × head dimension × cached tokens × bytes per element
The factor of 2 accounts for storing both K and V.
Suppose a model has the following configuration:
- 32 layers;
- 32 KV heads;
- 128 per-head dimension;
- 4,096-token context length;
- 2 bytes per cached element.
Then the cache per token, across all layers, is:
2 × 32 × 32 × 128 × 2 = 524,288 bytes
That’s about 512 KiB per token. 4,096 tokens require roughly 2 GiB of cache. If ten independent sequences each reach that length with no prefix sharing or compression, total cache usage is about 20 GiB.
Note that you must use the number of KV heads, not always the number of query heads. Some attention architectures let multiple query heads share KV heads, significantly reducing cache size.
Also, this formula doesn’t cover all model architectures. Models with compressed representations or specialized attention designs need their own cache layout calculations.
Real deployments must also reserve space for model weights, temporary workspaces, runtime overhead, and memory fragmentation—you cannot devote all of a device’s memory to the cache.
6. High Hit Rates Are Not Near-Zero Cost
Cache reuse can indeed reduce repeated prefill computation, but caching itself has costs.
First, caches need storage. Popular prefixes compete with large numbers of low-frequency prefixes for limited device memory or other storage.
Second, caches need to be read. Generating new tokens may still require accessing large amounts of historical keys and values; long-context decoding is often memory-bandwidth bound.
Third, caches need scheduling. If a request lands on an instance without the relevant cache, it may need recomputation or loading from elsewhere. Whether loading is worthwhile depends on transfer overhead versus recomputation cost.
Fourth, caches need management. Lookup, indexing, eviction, permission isolation, and lifecycle maintenance are not free.
The engineering value of caching, therefore, is not “eliminating cost,” but replacing higher repeated-computation costs with lower storage and access costs.
7. Calculating Real Savings with a Cost Model
You can build a simplified per-request billing model:
Total cost = uncached input × uncached input price
- cached input × cached input price
- output × output price
Let input volume be I, input token hit rate h, uncached input price Pu, cached input price Pc, output volume O, and output price Po:
C = I × [(1 − h) × Pu + h × Pc] + O × Po
All prices and token counts must use consistent units.
Illustrative example: suppose the cached input price is one quarter of the uncached input price, and the input hit rate is 80%. The average input price is then:
0.2 × Pu + 0.8 × 0.25 × Pu = 0.4 × Pu
That is, compared to billing all input at the uncached price, input costs drop by 60%, not 75%. If output costs are a large share of the bill, the overall reduction shrinks further.
Similarly, if only the cached-input price is cut again, you must recompute with the actual prices before and after the change—you cannot apply one billing item’s discount directly to the total bill.
8. How Developers Can Improve Reusability
8.1 Put Stable Content First
A good structure is:
Fixed rules → fixed format constraints → stable reference material → dynamic information → current question
But prompt order must first serve task correctness and safety boundaries—don’t sacrifice necessary instruction priority for a higher hit rate.
8.2 Remove Meaningless Prefix Variation
Unnecessary timestamps, random identifiers, whitespace differences, and unstable field ordering can all break prefix consistency.
For structured content, use deterministic serialization rules. But don’t delete business-critical information for the sake of caching, and never mix untrusted input into high-privilege instructions.
8.3 Don’t Keep Irrelevant Context Just to Get Hits
Pinning large amounts of irrelevant material to the front of every request may raise the hit ratio, but it also increases cache reads, context usage, and attention interference.
What you should optimize is the total cost of completing the task, not the hit rate alone. Deleting irrelevant content is often more effective than repeatedly caching it.
8.4 Be Cautious About Long-Term Caches for Low-Frequency Content
Caching works best for large, frequently repeated, rarely changing content. For material that will almost never be accessed again, storage and management costs may never pay off.
9. Load Tests Should Cover Cold Cache, Warm Cache, and Quality Changes
Set up at least three test groups:
Cold-cache test: Measure cost and time-to-first-token on first calls, after cache expiration, or when content changes completely.
Warm-cache test: Repeatedly use a stable prefix to verify that hits actually occur and that prefill time drops.
Mixed-load test: Construct requests reflecting real-world variation across users, documents, time intervals, and output lengths—avoid testing only idealized repetitive tasks.
Recorded metrics should include input and output token counts, cached input volume, time to first token, full response time, failure rate, retry count, and task quality.
For enterprise applications, the more meaningful metric is usually:
Cost per effective task = total spend including failures and retries ÷ number of tasks meeting acceptance criteria
Cheap-but-retry-prone services, or quality drops that force manual revisions, can wipe out the savings from a lower unit price.
10. Cache Optimization Must Also Respect Data Boundaries
Cross-request reuse must not cross tenant and permission boundaries. Private documents, internal rules, personal information, and credentials require clear access controls and lifecycle management.
Cache identifiers should not directly expose sensitive raw text. Audit logs should help locate hit and miss issues without expanding the retention scope of sensitive data.
For data that has been deleted, invalidated, or revoked, define explicitly when its cache expires—avoiding situations where the business data is no longer accessible but the cache remains usable.
Conclusion: Evaluate Effective Cost, Not Price or Hit Rate Alone
Model price cuts deserve attention, but sound judgment should rest on clearly defined billing scopes, real workloads, and verifiable quality metrics.
KV caching eliminates repeated computation within a single generation; prefix reuse further eliminates repeated prefill across requests. The two are related but should not be conflated. A high hit rate shows that a particular workload has high reuse potential—it does not mean every business can replicate it, nor that long-context inference is free.
For developers, the safest path is: clarify the billing terms first, then measure real requests, and finally optimize by combining prompt structure, caching strategy, and task quality. Only when unit cost per effective task keeps falling while quality and latency targets are met does a price cut truly translate into business value.
