Skip to content

FlashAttention

The efficiency lineage · 2022

Not an approximation - a rearrangement. It made long context affordable enough that the memory wall became the binding constraint.

PaperFlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessDao, Fu, Ermon, Rudra, Ré · Stanford · 2022arXiv:2205.14135 →

A sequel, FlashAttention-2 (2023, arXiv:2307.08691), roughly doubled this again with better GPU work-partitioning - same idea, no new algorithm, just less time wasted on the chip.

What it fixedExact attention computed without ever materialising the N x N matrix - IO-aware tiling.
What it still costsCompute is still quadratic and the KV cache still grows; it moves the wall, it does not remove it.

Same bill, cheaper trip - the grid never touches slow memory, tile by tile.

Episode 1, beat 6 - FlashAttention · 60s, from the film series.

Worth having first: The memory wall

Unlocks: The machine underneath

Episode 4 · The Machine Underneath