KV Cache
In One Sentence
Storing previously computed Key and Value attention tensors in GPU memory so autoregressive decoding doesn't recompute the entire prompt every token.
ELI5 (Intuition)
Keeping your scratchpad open while writing an essay so you don't have to re-read the entire book from page 1 before writing every single new word.
ELI18 (Technical)
During token-by-token generation, past keys \(K_{1:t}\) and values \(V_{1:t}\) are invariant under causal attention. Caching them cuts per-token decode compute from \(O(T^2)\) to \(O(T)\), making inference memory-bandwidth bound rather than compute bound.
In Practice
Prompt caching in modern LLM APIs reuses the KV cache across requests with shared system prompts or repo contexts, slashing time-to-first-token (TTFT) and cutting input token costs by 50–90%.