[KongchangAI]
ConceptKV cache offload

KV Cache

KV Cache (Key-Value Cache) is an optimization mechanism used during Transformer model inference to store the key and value vectors corresponding to each token in the attention computation. During autoregressive generation, the model reuses cached key-value pairs from previous tokens rather than recomputing them at each new generation step, significantly reducing redundant computation and improving inference efficiency. The mechanism trades increased GPU memory usage for faster inference speed and is a core optimization technique in large language model deployment.

Core Facts

Timeline (last 90 days)

Nov 22

Multi-tenant inference platforms need to implement isolation at multiple levels, including request queue isolation, KV Cache cleanup in GPU memory, access control for logging systems, and correctness of batching logic.

Unverified50%
Nov 21

DeepSeek stores the KV cache in a shared SSD pool of more than 100 PB, with the cache retained for 72 hours, and the hit price is only one-fiftieth of the miss price.

Unverified50%
Nov 20

Common AI inference optimization techniques include model quantization, operator fusion and graph optimization, KV cache management, continuous batching and speculative decoding.

Unverified50%
Nov 20

Quantization does not mean single-card deployment is possible: 4-bit quantization can roughly only compress the size to a quarter of the original, and a model of hundreds of GB still has tens of GB or more after quantization; plus the KV Cache and activation overhead during inference, it may still not fit on a single card.

Unverified50%
Nov 19

MoE-Context lets all blocks share a single key-value cache; hidden blocks mask the participation of their key/value via attention masks, so they can be recalled in subsequent steps without re-encoding.

Unverified50%
Nov 18

Common methods for controlling the cost of KV Cache transfer across pools include tiered transfer, KV Cache compression/quantization, and placing prefill and decode within the same high-speed interconnect domain.

Unverified50%
Nov 18

Disaggregated decode does not solve the communication overhead of model parallelism and pipeline parallelism; KV Cache transfer across nodes will become a new bandwidth bottleneck under ultra-long contexts, and for small and medium-scale deployments the operational complexity may exceed the benefits.

Unverified50%
Nov 17

If the sparsity pattern cannot reduce the amount of KV data actually read, the speedup in the decode phase will be very limited.

Unverified50%
Nov 17

The decode phase generates autoregressively token by token, processing only one new token per step but needing to read the entire historical KV Cache; it is memory-bandwidth-intensive, and the bottleneck is data movement.

Unverified50%
Nov 14

Transformer KV Cache memory grows linearly with context length, and a 1-million-token context brings significant memory challenges.

Unverified50%

40 more timeline events

All Facts (20)

Verified

The KV cache is a core data structure in Transformer autoregressive inference, and its size is approximately 2 × number of layers × number of attention heads × head dimension × sequence length × precision bytes.

90%
Verified

KV Cache avoids redundant computation by caching already-computed Key and Value matrices, and advanced techniques such as PagedAttention further optimize cache memory management efficiency.

90%
Verified

KV Cache reduces the computational complexity of self-attention from O(N²) to O(N) by caching already-computed Key-Value pairs in GPU memory, but memory usage grows linearly with sequence length.

90%
Verified

Time to First Token (TTFT) refers to the time interval between a user submitting a request and the model outputting the first token, and is primarily constrained by the time cost of the prefill phase in which the model processes the input prompt.

90%
Verified

The KV cache VRAM usage of ultra-long context windows grows linearly with context length, causing inference latency and costs to rise significantly.

90%
Verified

KV Cache persistently stores already-computed key-value pairs so that subsequent requests sharing the same prompt prefix can directly reuse them, skipping redundant matrix operations.

90%
Verified

The KV Cache of a 70B-parameter model with 128K context support can require hundreds of gigabytes of VRAM at full load, exceeding the 80GB VRAM capacity of a single H100.

90%
Verified

KV Cache size is approximately equal to 2 × number of layers × number of attention heads × head dimension × sequence length × precision bytes.

90%
Verified

KV Cache caches previously computed key-value matrices in memory, reducing the complexity of autoregressive generation from quadratic growth with sequence length to linear.

90%
Verified

The VRAM usage of KV Cache grows linearly with sequence length; for a 70-billion-parameter model using GQA, the KV Cache usage can reach tens of GB when processing 100,000 tokens.

90%
Verified

The VRAM occupied by KV Cache grows linearly with sequence length.

90%
Verified

When large language models process long contexts, the computational complexity of the attention mechanism grows proportionally to the square of the sequence length.

90%
Verified

Taking LLaMA-3 70B (80 layers, 64 heads, 128 dimensions per head) as an example, the KV Cache for a single token occupies approximately 2.6 MB (FP16 precision), and the total KV Cache for a 32K context reaches approximately 83 GB.

90%
Verified

PagedAttention is the core technology of the vLLM framework, which draws on the idea of operating system virtual memory management to store KV Cache in pages.

90%
Verified

For a model with 70B parameters, the KV Cache for an 8K context may occupy several additional gigabytes of VRAM

90%
Verified

KV Cache reduces inference complexity from O(n²) to O(n) by caching the already-computed Key/Value matrices.

90%
Verified

PagedAttention divides the KV cache into fixed-size pages allocated on demand, and can improve VRAM utilization by 2–4×.

85%
Verified

Taking LLaMA-2 70B as an example, when processing a 4096-token context with a batch size of 32, the KV Cache can consume over 80 GB of memory.

85%
Verified

PagedAttention improves KV Cache memory utilization from below 40% to close to 100%.

85%
Verified

Prompt caching saves the KV state of reusable prefixes (the tokens at the beginning of a prompt that remain unchanged); if the next request starts with an identical prefix, the provider reuses the saved computation and only processes the new portion.

80%

Source Articles