FDEInterviews logo

kv cache

FDE interview questions tagged kv cache, across every topic.

12 questions · 0 unlocked for you

Concepts behind "kv cache"

The curriculum that explains the ideas these questions test.

Core
🧠 Foundations of LLMs & GenAISign in
KV CacheDuring autoregressive decoding a model would recompute attention over every prior token at each step; the KV cache stores each token's key and value vectors so each new token only attends, never recomputes, making per-token generation far cheaper. The cache grows with sequence length times batch size and becomes the memory bottleneck in serving, which is what motivates PagedAttention. FDE loops probe it because it explains why long contexts are costly to serve and why throughput, not the model, is often the constraint.
Advanced
🖥️ ML Infrastructure & Serving🔒 Premium
PagedAttentionAllocating each sequence's KV cache as one contiguous block forces you to reserve space for the maximum possible length, which fragments GPU memory and wastes most of it. PagedAttention borrows OS-style paging: it stores the KV cache in fixed-size non-contiguous blocks tracked by a per-sequence block table, so memory is packed, grown on demand, and shareable across sequences. It is the core memory trick that lets vLLM pack far more concurrent sequences into the same VRAM.
Advanced
🖥️ ML Infrastructure & Serving🔒 Premium
Noisy Neighbors and KV Fair ShareOn a shared model server the contended resource is KV cache, and it is consumed in proportion to context length. A limiter that counts requests therefore measures the wrong thing: one hundred-thousand-token request holds the cache of fifty short ones, so equal request counts hand one tenant most of the machine.