Ask what should change when the equation is manipulated, then let the visualization test that expectation.
Foundation Lab
FlashAttention: IO-Aware Attention
Enabled training with 100K+ context windows—without this, long context is impractical
\text{Memory: } O(N) \text{ vs } O(N^2)Selected Foundation Object
Keep the equation fixed; move through the evidence.
GPU memory hierarchy matters: SRAM (fast, small) vs HBM (slow, large)
\text{Memory: } O(N) \text{ vs } O(N^2)Use the runnable panel, the key equation, and canonical papers as separate forms of evidence for the same object.
The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.
This atlas page keeps the working demo; the domain notebook carries the fuller Intuition -> Math -> Code -> Demo sequence.
Why It Matters for Modern Models
- Enabled training with 100K+ context windows—without this, long context is impractical
- Foundational for modern LLMs: used in LLaMA, GPT-4, Claude, etc.
- Shows that algorithmic innovation can beat hardware by understanding memory hierarchy
What Tutorials Skip
What is still poorly explained in textbooks and papers:
- GPU memory hierarchy matters: SRAM (fast, small) vs HBM (slow, large)
- Materializing N×N attention wastes memory bandwidth—the bottleneck, not FLOPs
- Online softmax: you can compute softmax in one pass by tracking running max and sum
Interactive Visualization
Core Math (Optional Deep Dive)
If you want intuition first, start with the key equation and the visualization. Come back here for the full walkthrough.
Standard attention materializes intermediate matrices:
FlashAttention fuses operations, keeping data in SRAM:
- Tile Q, K, V into blocks that fit in SRAM
- Compute local softmax, accumulate with online softmax trick
- Never materialize full attention matrix
Memory: instead of
Speed: 2-4× faster than standard attention