Ankit Patel
WritingPapersLabsAboutContact
Paper Reviews··Updated 2026-08·2 min read·72 views

PagedAttention in vLLM: Slower Kernels, Higher Throughput

vLLM & PagedAttention · Kwon et al., SOSP 2023

Memory reserved as one slab per request sits mostly empty, while the same memory handed out in small blocks stays nearly all in use

I love systems papers where a kernel runs 20% to 26% slower and the serving engine still delivers two to four times the throughput at comparable latency.

Both measurements come straight from Kwon et al.'s PagedAttention evaluations. They measure different layers of the server, which is why they belong on the same page.

During autoregressive generation, a Transformer keeps key and value tensors for earlier tokens so it does not recompute them. That KV cache grows token by token. Pre-allocating a contiguous slab for a request's maximum possible output locks up GPU memory long before those tokens exist.

On an eight-block KV budget with two active requests currently holding one block each, contiguous reservation and on-demand block allocation leave very different room for new arrivals:

Policy Two requests using one block each Free blocks for other traffic
Reserve four contiguous blocks per request Two used, six held idle for future growth Zero
Allocate one block as needed Two used Six

Allocating block by block frees idle memory so more requests run together, though the scheduler must step in if every active sequence expands at once.

PagedAttention maps logical token positions through a block table into fixed-size physical KV blocks scattered across memory. Parallel samples sharing a prompt point to the same physical blocks and copy on write only where tokens diverge.

In Kwon et al.'s mechanism, per-sequence block tables decouple logical token blocks from physical GPU blocks and track sharing via reference counts:

# Kwon et al. block table: logical [0, 1, 2] -> physical GPU blocks
block_table = {"seq_a": [17, 4, 29], "seq_b": [17, 4, 29]}
ref_count = {17: 2, 4: 2, 29: 2}

if ref_count[block_table["seq_b"][2]] > 1:  # Copy-on-write on divergence
    ref_count[29] -= 1
    block_table["seq_b"][2] = 31  # Fresh physical block for diverging tokens
    ref_count[31] = 1

That indirection costs cycles. Block-table lookups and variable sequence lengths account for the 20% to 26% attention-kernel overhead reported in Section 7. Eliminating cache fragmentation, however, lets the server batch far more concurrent sequences so system throughput swamps the slower kernel.

Microbenchmarks make local regressions obvious. Much like FlashAttention accepts extra arithmetic recomputation to avoid HBM traffic during prefill and training, PagedAttention accepts extra kernel indexing so decoding fits far larger batches in GPU memory. Put kernel latency alone on a dashboard and someone will optimize away the exact lookup that unlocked server capacity.

When concurrent sequences grow past free physical blocks, vLLM's scheduler preempts requests and recovers via CPU swapping or recomputation. Preemption stalls an in-flight stream rather than crashing with an out-of-memory error, so interactive services must track inter-token gaps alongside time to first token.

The right review artifact pairs that 20% to 26% kernel penalty with the end-to-end throughput-latency curve across matched sequence lengths and concurrency. When have you accepted a slower inner loop because it changed capacity across the whole fleet?

Sources:

Continue in Paper Reviews