DEFINITION
The KV (key-value) cache is memory a transformer model uses during inference to store the attention keys and values of every token it has already processed. Reusing them means the model does not recompute the whole conversation each time it generates a new token. The cache grows with context length and with the number of conversations served at once, and it can take more GPU memory than the model weights themselves.
Planning hardware for AI on your own premises? Work out the GPU memory a model needs in our VRAM calculator, or let us size it with you.
Get a free sizing checkWhy the KV Cache Matters
- Speed: Avoids recomputing earlier tokens, which keeps generation fast.
- Memory planning: Is often the largest variable memory cost when serving many users.
- Concurrency: The VRAM left for the KV cache sets how many users a GPU can serve at once.
- Optimization: Grouped-query attention, paged attention and KV cache quantization all shrink it.
Use Cases
- Sizing GPU servers for a target number of concurrent users.
- Serving long-context chat and document Q&A.
- Prefix caching, which reuses a shared system prompt across requests.
- Tuning inference engines such as vLLM.
See it running on your own hardware
Vanik Edge OS runs AI models, agents and apps inside your building, so your data stays there.
