179 questions
No questions match those filters.
What problem does PagedAttention actually solve, and wh...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansAt serving time you don’t know in advance how many tokens a request will generate, which puts a naive KV-cache allocator in a bad spot: reserve a contiguous block sized to the maximum possible sequence length and you waste most of it on requests that finish early — commonly 20-40% of KV capacity lost to fragmentation — or grow the allocation dynamically and pay for an expensive copy every time a sequence outgrows its current buffer.
PagedAttention borrows the fix operating systems use for the identical problem: virtual memory paging. The KV cache is divided into fixed-size blocks holding a handful of tokens’ worth of key/value state across all layers and heads; a per-sequence block table maps logical positions to whichever physical blocks happen to be free, with no contiguity requirement. A sequence grows by grabbing the next free block from a shared pool and returns all its blocks the instant it finishes, so fragmentation essentially disappears and freed capacity is immediately usable by other requests.
The same block-table indirection also enables copy-on-write prefix sharing — requests with an identical system prompt or few-shot prefix can point at the same physical blocks instead of duplicating them — which is what lets serving frameworks built on this idea run meaningfully more concurrent sequences per GPU than naive contiguous allocation, directly raising the throughput ceiling rather than just cutting latency.