Start by defining the KV cache and its role in autoregressive decoding, then contrast prefill and decode phases to highlight computational differences. Discuss memory tradeoffs and production optimizations like paged attention and quantization, tying each to real-world impact.
Pro tip: Emphasize that the KV cache shifts the bottleneck from compute to memory bandwidth, so optimizations often focus on memory efficiency rather than raw FLOPs.
Explain that the KV cache stores key and value tensors from previous tokens to avoid recomputation during autoregressive generation.
Describe how caching reduces the complexity of generating each new token from O(n^2) to O(n) by reusing past computations.
Contrast the prefill phase (parallel processing of the prompt, compute-bound) with the decode phase (sequential token generation, memory-bound).
Analyze how cache size scales with sequence length, batch size, and model dimensions, and the resulting GPU memory constraints.
Describe at least two optimizations like PagedAttention, quantization, or multi-query attention, and their benefits in deployment.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.