Why LLM Inference Costs Keep Dropping: The Economics of KV Cache

    This article explains why large language model inference prices can fall to a fraction of their original level, focusing on the engineering room behind unit-cost reduction rather than pricing narratives. It covers why autoregressive generation needs KV Cache, how to estimate the GPU memory it consumes, the four prerequisites for near-full cache hit rates, and how hit rate becomes the first-order variable in input billing. It also offers practical steps for improving prefix reuse and evaluating real inference costs.

    1. The Phenomenon: Inference Pricing Enters the “One-Quarter Era”

    A pattern has recently emerged in the industry: shortly after launch, a major model service announced a permanent price cut to one quarter of the original price, and users found their actual bills far lower than expected. Stripped of brand narrative, this shows only one thing: there is substantial engineering room to compress the unit cost of inference, and the pricing simply passes part of that room back to users.

    The questions worth asking are not “who cut prices,” but three technical ones:

    1. Why can cache hit rates approach their limit, making repeated input nearly free?
    2. What engineering level does this represent, and where are the boundaries?
    3. As a consumer of these services, how can you tell whether you can benefit from this?

    2. The Basic Mechanism: Why Autoregressive Generation Needs Caching

    Text generation is an autoregressive process: it produces one token at a time, then appends it to the sequence to continue. Without caching, step n must recompute the key and value vectors needed for attention across all historical tokens, even though those results were already computed at step n-1 and are identical.

    Take “today’s weather” as an example:

    1. step1: input [today weather] -> output is
    2. step2: input [today weather is] -> output good (K/V of the first 3 tokens recomputed)
    3. step3: input [today weather is good] -> output ... (K/V of the first 4 tokens recomputed)

    The KV Cache approach works like this: once a token’s K and V are computed, they are written to GPU memory and read directly by later steps. Only the newest token needs a full Q, K, V computation; the new Q is then used with all cached K to compute attention scores and to weight the cached V. Per-step computation drops from “processing the entire sequence” to “processing one token,” which is the root of higher inference throughput.

    3. Quantifying It: How Much GPU Memory Does KV Cache Consume

    The estimation formula is:

    1. KV = 2 × layers × heads × head_dim × sequence_length × bytes_per_value

    With 32 layers, 32 heads, 128 dimensions per head, and FP16 (2 bytes):

    1. per token per layer: 2 × 32 × 128 × 2 = 16384 B = 16 KB
    2. total cache: 16 KB × 32 layers × 4096 tokens ≈ 2 GB
    3. batch=10: ≈ 20 GB

    The conclusion is direct: in long-context, high-concurrency scenarios, the cache can consume more GPU memory than the weights and become the real bottleneck. In practice, this is mitigated with paged cache management, quantization-based compression, prefix sharing, and offloading cold cache to host memory or object storage.

    4. Four Prerequisites for a High Hit Rate

    Approaching a full hit rate is not a single trick but a system capability:

    • Prefix stability: system prompts, tool definitions, and few-shot examples do not change randomly and remain byte-for-byte identical;
    • Cache granularity and reuse strategy: content-addressed chunked prefix reuse rather than whole-request matching;
    • Scheduling affinity: the same session is routed, as far as possible, to an instance that already holds its cache, which requires coordination between the routing layer and the instance pool;
    • Observability: hit rate, eviction rate, and offload latency need logs, monitoring, and alerting; otherwise you cannot locate where the benefit is leaking.

    5. The Billing Model: Hit Rate Is the First-Order Cost Variable

    Simplified, input-side cost ≈ full price for uncached tokens + discounted price for cached tokens. Raising the hit rate from 30% to 90% can cut input cost several times over, which explains the feeling that it is “rounded down to free.” But note three boundaries: output tokens usually do not receive a cache discount; cache has a lifetime and expires if the gap is too long; the longer the context, the greater the benefit of a hit, while short requests barely notice it.

    6. Practical Recommendations

    1. Fix and version your system prompt, and move volatile content into the user message;
    2. Parse long documents once and reuse them many times instead of feeding them in repeatedly;
    3. Use retrieval and summarization to compress context and reduce ineffective prefixes;
    4. Build your own metrics dashboard to track cache hit rate and per-request cost by business line;
    5. If you use general-purpose cloud capabilities, you can run inference services on a container platform, store long text in object storage, and use logging and monitoring services for cost accounting; for the model service’s own caching strategy, refer to the official documentation and do not assume specific parameters.

    7. Conclusion

    The price cut is the result; the caching and scheduling system is the cause. Once you understand the GPU memory economics of KV Cache, you can save money on both the architecture and procurement sides: raise prefix reuse in your architecture, and evaluate cost by real hit rate rather than list price in procurement.