Skip to main content

KV Cache

KV Cache

  • Hardware & deployment
  • Stage 4 · Under the Hood
  • refs checked 2026-11-09
What problem it solves

Stops the model recomputing the whole passage on every token it generates — this is what makes generation speed usable.

What it is
Caching the attention intermediates already computed, so only new tokens need incremental work. The cost is that it occupies VRAM continuously — which directly caps how long a context you can afford.
Prefill computes and caches K/V per layer; each decode step computes only the new token’s K/V instead of the whole prefix.
Prefill computes and caches K/V per layer; each decode step computes only the new token’s K/V instead of the whole prefix.
Why it matters

It is the most common cause of OOM when deploying locally. Raise the context size and you hit this first.

Sources
  • Automatic Prefix Caching – vLLM design docs ↗
  • Hybrid KV Cache Manager – vLLM design docs ↗
  • Practitioner deep-dive: serving deep dive guide (AI Models site) ↗
Use this term in a task

Don’t stop at the definition: use the task handbook for the order and checks, or filter three tool candidates for the job at hand.

Task handbooks → · Filter three candidates →