Flash Attention's Memory I/O Optimization

Flash Attention significantly reduces quadratic memory costs by re-architecting how attention is computed, using tiling and recomputation to keep intermediate results in fast on-chip memory (SRAM), rather than slow high-bandwidth memory (HBM). This approach makes long-context modeling practical, scaling memory usage to linear in sequence length for fixed head dimensions, and can achieve up to 70% of the theoretical maximum FLOPS on A100 GPUs.

Sources

Open the full topic