Zenaique

Identify PagedAttention and the project it ships with

Flashcard·Easy·4.0 · 0·~30s·Asked atBytedanceGoldman SachsSarvam·Relevant atCloudflareGroqNVIDIAVllm
Attempt it
TL;DR

PagedAttention is vLLM's block-based KV-cache allocator that borrows OS virtual-memory paging, eliminating the fragmentation waste of contiguous max-length reservations.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine renting a parking garage where every car gets a private aisle sized for the biggest truck the garage might ever see. Hatchbacks waste most of their aisle. Now picture the garage manager dividing every aisle into uniform stalls and giving each car only the stalls it actually needs, picked from anywhere in the building. A central clipboard remembers which stalls belong to which car. The garage fits far more cars, and nobody hoards space they will never use. PagedAttention is that clipboard for the KV cache: fixed-size blocks anywhere in HBM, looked up through a per-sequence table.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

PagedAttention is the single most influential serving-side innovation of the post-ChatGPT era. It is not an attention math variant. It is a memory allocator that borrows operating-system virtual-memory paging and applies it to the KV cache, the place in LLM serving where bandwidth and capacity bills concentrate. Without PagedAttention, continuous batching does not work well. Without continuous batching, modern throughput numbers do not exist.

The context to understand why is the situation in 2022. Pre-vLLM serving stacks allocated the KV cache as one contiguous block per sequence, sized for the model's maximum context length. Real traffic has wildly variable sequence lengths: a chat acknowledgment might be 20 tokens while a summary is 800. Reserving 8k tokens of cache for a 20-token reply wastes 99.75 percent of that reservation. Across many concurrent sequences, fragmentation routinely cost 60 to 80 percent of HBM.

This deep dive walks through the problem, the paging analogy, the block-table mechanics, the downstream optimizations PagedAttention unlocked, and the 2026 deployment landscape it created.

The fragmentation problem PagedAttention solves

Without paging, every concurrent sequence reserves a contiguous KV cache slab sized for the model's maximum context. The allocator has no choice: it cannot know in advance how long the sequence will become, and it cannot grow a contiguous reservation later without copying.

For a model supporting 8k tokens with 32 KV heads, head dim 128, and FP16, the per-sequence reservation is on the order of hundreds of megabytes per layer times dozens of layers, often gigabytes per sequence. An 80 GB H100 fills up after a handful of sequences even though each sequence might only use a small fraction of its reservation.

The original vLLM paper measured fragmentation rates of 60 to 80 percent on real workloads. That meant the GPU appeared full, but most of HBM was holding placeholders for tokens that would never arrive. New requests had to wait in a queue while gigabytes of HBM sat unused inside other sequences' over-allocated reservations.

This is a textbook external fragmentation problem: free memory exists but is not contiguous. Operating systems solved the same problem decades ago with virtual memory paging. PagedAttention applies the same fix.

How OS paging maps onto KV cache
What PagedAttention unlocked downstream
PagedAttention in the 2026 serving landscape
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • vLLM, the project that introduced PagedAttention, is the default open-source serving engine in 2026 for Llama 3.1, Mistral Large 3, and DeepSeek V4 deployments.
  • Hugging Face TGI adopted block-based KV allocation directly inspired by PagedAttention.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow does PagedAttention enable prompt prefix caching?
A

If two sequences share a system prompt, the block table for each can point to the same physical blocks for the shared prefix. Reference counting keeps the blocks alive as long as any sequence references them. When either sequence diverges, copy-on-write allocates new blocks only for the divergent suffix.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Calling PagedAttention a new attention math. It is a KV-cache allocator. The math is unchanged; only how K and V are laid out in HBM differs.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • What PagedAttention is and which project introduced it

  • Which classical systems concept it borrows from

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
What is the KV cache in transformer inference?
Flashcard·Easy