Serving
PagedAttention
Store the KV cache in fixed-size blocks, like virtual memory pages.
What it is and why it exists
Pre-allocating contiguous KV memory per sequence for its maximum length wastes most of it. PagedAttention allocates small blocks on demand and maps them through a block table, so memory waste drops to near zero and blocks can be shared between sequences with a common prefix.
Quick prototype
—
In production, at scale
On by default in vLLM; tune gpu_memory_utilization and block size; monitor KV-cache usage and preemptions.
Vendors and tools
| vLLM | Introduced PagedAttention |
|---|
How it fails
- Preemption storms when KV cache fills under bursty load
What the interviewer asks next
What problem does PagedAttention solve?
Fragmentation and over-reservation of KV-cache memory, which capped how many sequences fit on a GPU.