Deep systems understanding · Study map 42 of 85
FlashAttention: avoid writing the giant scratchpad
Suggested preparation: Attention: each token asks what matters hereGPU hardware: workers, shelves, and delivery lanes
Picture it
Think of standard attention as drawing a massive, sprawling grid on a chalkboard to compare every word in a book to every other word. You waste enormous time walking back and forth to fill in the squares. FlashAttention, instead, operates like a clever sliding window, evaluating small chunks on a fast, handheld notepad and updating a running tally. By never materializing the giant grid on the slow chalkboard, it shaves off massive amounts of wasted travel time.
What to understand
- IO-aware tiling, online softmax, and recomputation
- Exact dense attention versus sparse/approximate attention
Follow the references
1 · Paper
Dao et al. · FlashAttention ↗Follow the memory-hierarchy diagram and tiled algorithm. Focus on which arrays are never stored in HBM.
2 · Tutorials
Triton · GPU programming tutorials ↗Inspect the fused-attention tutorial after the paper’s dataflow is clear.
Keep the distinction. Exact here means the same mathematical attention, allowing floating-point differences. FlashAttention and PagedAttention solve different problems.
Make it concrete
Benchmark attention over increasing sequence lengths with a reference and supported fused backend. Compare peak memory, runtime, and numerical error.
You understand it when…
Why can FlashAttention use much less memory while dense attention still has quadratic arithmetic?
This is a study map. Follow the reference for the full explanation; use the question to test your mental model. Browse the reference shelf.