mlprep
Hard15 min·2 rounds·Memory & KV Cache

Explain PagedAttention and how vLLM eliminates KV cache memory fragmentation

Written by the mlprep team · Updated

Interviewer Mode
Interviewer

What problem does PagedAttention solve in LLM serving? Walk me through how KV cache memory was wasted before vLLM, how virtual-memory paging fixes it, and what new optimizations paging unlocks.

Ready to compare your reasoning?
Interviewer

What is the trade-off in choosing the block size (e.g., 16 vs. 64 vs. 256 tokens), and does non-contiguous memory access hurt GPU attention kernel speed?

Ready to compare your reasoning?

The key takeaway unlocks after you reveal an expert answer.

Follow-up Questions to Test Yourself

Interviewers often pivot here once you cover the core concept.

  • How do FlashAttention and PagedAttention complement each other inside a modern serving engine?
  • In beam search with width 4, how much KV memory does copy-on-write paging save compared to naive duplication?
  • What happens to scheduling latency if block size is too small under 100k-token contexts?

How confident do you feel explaining this?

Track your understanding or flag it to revisit before your next loop.

Related Questions