Home > Chip + Interface IP Glossary > KV Cache
KV cache (key-value cache) is a memory optimization used during inference in Transformer-based AI models, particularly large language models (LLMs). It stores the key (K) and value (V) tensors calculated by attention layers for previously processed tokens. When the model generates subsequent tokens, it reuses these tensors instead of recomputing them, reducing redundant computation and accelerating autoregressive generation.
For AI hardware, KV cache is important because its footprint grows with factors including sequence length, model architecture, batch size or request concurrency, and numerical precision. As a result, KV cache can become a significant consumer of accelerator memory and an important consideration for HBM capacity and bandwidth.
Transformer attention generates query (Q), key (K), and value (V) representations. During autoregressive inference, previously calculated keys and values remain useful as each new token is generated.
The process typically works like this:
This exchanges increased memory consumption for lower computational overhead during token-by-token decoding.
KV cache depends on both software and hardware. At the software level, inference engines can use techniques such as paged KV-cache management, cache reuse, quantization, and KV cache offload to improve memory utilization.
At the hardware level, technologies such as HBM, memory controllers, GPUs and AI accelerators, DDR DRAM, PCI Express, and CXL can form parts of the broader memory hierarchy supporting inference. HBM is particularly relevant for accelerator-local KV cache because it provides the high memory bandwidth required by data-intensive AI workloads.
KV cache is also distinct from a conventional processor cache. CPU and GPU hardware caches automatically retain frequently accessed data, whereas an LLM KV cache is explicitly managed as part of Transformer inference and contains previously computed attention keys and values.
Rambus does not provide the KV-cache algorithm itself, but its memory and interface technologies address the infrastructure underneath AI inference. HBM memory controller IP can connect AI accelerators and other high-performance SoCs to HBM, while DDR5 memory interface chips support server memory systems that can form another tier in the AI memory hierarchy. High-speed PCIe and CXL technologies are also relevant where AI architectures move data among accelerators, processors, and expanded memory resources.