Home Tools Glossary KV Cache
Concept

KV Cache

Key-Value Cache

/kay-vee kash/

A memory optimization technique that stores previously computed key and value vectors during autoregressive generation to avoid redundant calculations.

In plain English
Instead of recalculating the meaning of the entire conversation from scratch every time an AI types a new word, the KV cache saves previous calculations in a notepad so generation runs instantly.
Real-world example
Accelerating chat completion token generation speeds in production LLM inference servers.
Technical definition
The Key-Value (KV) Cache stores intermediate key and value tensor activations generated during self-attention forward passes across preceding context tokens. During autoregressive token generation, caching these matrices prevents redundant matrix multiplications for historical sequence elements. Managing KV cache memory footprint is critical for high-concurrency LLM serving engines.