PagedAttention: interactive visualizer

click Step forward to see how vLLM allocates KV cache blocks as tokens are generated. Compare it to old-style contiguous allocation on the right.

Step 0: Initial state
Waiting to start...
requests

Block tables

KV Cache pool (9 blocks × 4 slots each)

empty slot
request A
request B
request C
just filled/allocated
step 0 of ?

What just happened

Click Step forward to begin. Each click advances one generation step. Read this box after every step. It explains why physical blocks were allocated the way they were.

memory used vs waste

PagedAttention
0/0
  waste
0
Contiguous (old)
0/0
  waste
0
Contiguous baseline: assume each request pre-reserves a full max_len = 16 tokens block of contiguous memory (4 physical blocks × 4 slots each), regardless of how many tokens it actually holds.

Physical → logical map

(no requests yet)

What the paper calls this

Terminology cheat-sheet updates as you step through the scenarios.