FlashAttention speeds up attention and cuts memory without changing the maths. What is its core idea?
- It prunes low-scoring keys so fewer dot products are computed
- It replaces softmax with a linear kernel to avoid the quadratic term
- It stores the attention matrix in lower precision to halve memory
- It tiles the computation and never materializes the n×n matrix in HBM
Why
FlashAttention is IO-aware: it computes attention block-by-block in fast SRAM using an online-softmax, so the n×n matrix is never written to slow HBM — cutting memory from O(n²) to O(n) with exact results. It does not prune keys, linearize softmax, or rely on low precision for its savings.