Attention Kernels
16 questionsDONEUNLOCKEDLOCKED
FlashAttention & Attention Kernel Interview Questions
Online softmax and its proof, FlashAttention 1 to 3 and what each generation changed, split-KV decoding, paged attention kernels, MLA absorption, sliding windows, and why IO, not FLOPs, is the cost model.
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 Attention Kernels
The ideas these answers lean on. Foundation concepts are free to read; the advanced ones are Premium.
Foundational
The Online Softmax RecurrenceOnline softmax keeps a running max, a running normalizer and an unnormalized output, and rescales them when the max grows. The merge rule is exact and associative, which is what lets FlashAttention tile over keys and Flash-Decoding split one long context across thread blocks.Advanced
FlashAttention 1 to 4: What Each Generation ChangedEvery FlashAttention generation computes the same exact attention and attacks a different bottleneck: HBM traffic in FA1, poor work partitioning in FA2, Hopper's asynchronous tensor cores in FA3, and Blackwell's slow exponential units in FA4. Knowing which bottleneck each one removed tells you which kernel a given GPU should run.🔒 Premium
Advanced
Split-KV Decoding (Flash-Decoding)In decode there is one query row per sequence, so a FlashAttention kernel parallelized over batch and heads launches too few thread blocks to pull full HBM bandwidth. Split-KV divides each sequence's keys across blocks and merges the partial results exactly with their log-sum-exp, which decides whether long-context decode reaches bandwidth.🔒 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