Strategic Recomputation: Trading FLOPs for Memory Bandwidth

Instead of storing large intermediate attention matrices (like the full softmax matrix) in HBM, FlashAttention recomputes them on-the-fly, particularly during the backward pass. This leverages abundant compute for significant memory bandwidth savings, reducing memory usage from quadratic to linear.

Sources

Open the full topic