KV Cache & GPU Memory
16 questionsDONEUNLOCKEDLOCKED
KV Cache Interview Questions
The KV algebra across MHA, GQA, MQA and MLA, block tables and fragmentation, hash and radix prefix reuse, eviction, FP8 KV, CPU and NVMe offload, and the gpu_memory_utilization budget that decides how many sequences actually fit.
Worked answers on inference mechanisms, with calculations, implementation details, and follow-up questions.
You have 5 free answers unlocked here.Sign in free for 5 more · 6 are premium.
01–07Foundationsthe physics and terms an interviewer will not stop to define0/7 done
08–13Core loopsthe standard questions of this round, worked end to end0/6 done
14–16Field scenariosproduction incidents and capacity problems with the inputs left incomplete0/3 done
The concepts behind KV Cache & GPU Memory
The ideas these answers lean on. Foundation concepts are free to read; the advanced ones are Premium.
Foundational
The KV Cache: Bytes per Token and the Memory BudgetThe KV cache stores every past token's keys and values so decode never recomputes them. Its size per token is fixed by the attention design, and the memory left after weights and the engine's reserve decides how many sequences fit, which is the number that sets batch size, concurrency and when preemption starts.Advanced
Paged KV Memory and Block TablesPaged KV memory splits the cache into fixed-size blocks and gives each sequence a block table that maps logical positions to physical blocks, as virtual memory does with pages. It bounds waste to one partial block per sequence, which decides how many sequences fit and makes prefix sharing and copy-on-write possible.🔒 Premium
Advanced
Prefix Caching and Chained Block HashesAutomatic prefix caching keeps the KV blocks of finished requests and reuses them when a new prompt starts with the same tokens. Each full block is keyed by a hash chained from its parent block, which makes a hit mean the whole prefix matched; that decides TTFT for shared system prompts and how much cache multi-turn traffic needs.🔒 Premium
Unlock all 16 answers · ₹2,000 / $25
Every worked answer and derivation in all 12 topics, every concept page, and the full practice-test bank.
6 months · One payment · No auto-renewal