AI Glossary Term
What does “KV Cache” mean?
Stored key and value tensors from previous tokens that let transformers generate new tokens without recomputing past attention.
How KV Cache works
Example
When a chatbot writes a long reply, it does not recompute attention inputs for every earlier token at each step. It keeps those stored values and only adds those for the newest token.
Why it matters
The cache makes generation much faster, but it uses memory that grows with the conversation length. This is a major factor in serving cost for long contexts.
Common questions
What are keys and values?
Vectors each token produces in attention layers that later tokens use to decide what to focus on.
Why does it limit long contexts?
Cache size grows with the number of tokens, so memory becomes a bottleneck.
How is the cost reduced?
Through quantizing the cache, sharing keys and values across attention heads, and limiting attention windows.