[KongchangAI]
ConceptKV Cache

KV Cache

KV Cache (Key-Value Cache) is an optimization mechanism used in large language model inference to store the key and value tensors computed during the attention calculation process. By reusing previously computed results, it avoids redundant computation over already-processed tokens, significantly reducing computational overhead during autoregressive generation and improving inference efficiency. KV Cache is widely applied in the deployment and acceleration of Transformer-based models.

Core Facts

Timeline (last 90 days)

Dec 3

在KV缓存低比特量化中,值(value)缓存上的量化惩罚普遍较小,而键(key)缓存的敏感度差异巨大。

Unverified50%
Dec 3

现代混合架构模型除了KV缓存外,还维护循环状态和滑动窗口状态,这要求压缩策略必须同时考虑模型架构、工作负载特性和重建成本。

Unverified50%
Dec 2

The paper "Characterizing Latent Reasoning Dynamics in LLMs" formalizes token reasoning as state transitions over KV cache prefixes and uses a KV-cache VAE to compress the high-dimensional space.

Unverified50%
Dec 2

Current mainstream LLM efficiency optimization methods (shrinking the KV cache, limiting the receptive field, replacing attention operators) mainly reduce the attention cost per token but do not reduce the number of tokens flowing through the network, so the computation of the FFN and per-token projections still grows with the full sequence length.

Unverified50%
Dec 1

The KV cache is a core mechanism in autoregressive inference; as the context window expands, its memory footprint grows linearly, making it one of the main bottlenecks of long-context inference.

Unverified50%
Nov 30

A new MIT paper studies directly transferring KV caches across model families, where the receiver reuses the KV cache sent by the sender without re-reading the text, yielding a 40% accuracy improvement and 4x speedup, verified on multiple benchmarks.

Unverified50%
Nov 29

GLM 5.4 has the second loop reuse the KV cache from the first pass, keeping an independent copy only for a 128-token sliding window, compressing the cache overhead of the extra loop from O(context length) to O(128).

Unverified50%
Nov 28

Automatic KV cache management does not mean it requires no attention at all; memory usage still needs to be monitored under extreme loads or unusual sequence length distributions.

Unverified50%
Nov 28

The vLLM team publicly stated that the goal of this feature is to reduce KV cache tuning time and devote more time to model serving.

Unverified50%
Nov 28

KV cache automation can bring three benefits: simplified deployment, improved resource utilization, and reduced operational burden.

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 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

Quantized KV caches (such as storing KV vectors in FP8 or INT4) can compress the cache size to 1/2 or even 1/4 of the original.

90%
Verified

The KV Cache mechanism can cache repeated prefix content, and the more concise the system prompt, the higher the cache hit rate.

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

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

The size of the KV cache grows linearly with context length; the KV cache for Qwen 2.5 32B at a 64K context may consume several additional gigabytes of memory.

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

The VRAM usage and inference latency of MoE architectures are calculated based on the number of activated parameters, not the total parameter count.

90%
Verified

vLLM uses PagedAttention for KV Cache management

85%
Verified

Compared to the previous-generation V4 Flash, V4.1 Flash reduces the demand for high-bandwidth memory (HBM) to one-quarter and the demand for SSD persistent storage to one-eighth.

80%
Verified

In the KV Cache mechanism, reusing cached KV values is a cache hit, while context changes that invalidate the cache and require recomputation are a cache miss.

80%
Verified

KV Cache is the persistent storage of intermediate states in the Transformer attention mechanism, recording the key and value vectors for each attention head's processed tokens across all layers, thereby skipping redundant forward propagation computations.

80%
Verified

The KV Cache (key-value cache) mechanism accelerates inference by caching the Key and Value vectors generated by the self-attention layer to avoid redundant computation, but the longer the context, the more vectors must reside in VRAM, causing memory pressure to grow in a near-linear fashion.

80%
Verified

vLLM's PagedAttention draws on the operating system concept of virtual memory paging to manage KV caches, reducing GPU memory fragmentation overhead from approximately 30% to near 0.

80%
Verified

KV Cache是Transformer架构的核心推理优化机制,其显存占用量会随序列长度和并发批次线性增长

80%
Verified

PagedAttention技术借鉴操作系统虚拟内存的分页思想,将KV Cache切分为固定大小的物理块动态分配

80%
Verified

The KV cache mechanism saves the Key and Value matrices of historical tokens and reuses them in subsequent generation, thereby amortizing the per-unit cost of the input stage.

75%

Source Articles