Skip to main content

← Back to AI Papers

Efficiency

FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness

Problem: self-attention time and memory grow quadratically with sequence length, and the bottleneck is memory traffic rather than arithmetic; can exact attention be computed without writing the N×N matrix back to HBM.
Where the evidence sits: the abstract gives three end-to-end speed-ups plus a 7.6× speed-up on the attention computation itself; the limits are in Section 5, Limitations and Future Directions.
What the authors say about limits: three — each new attention implementation needs a new CUDA kernel written in a much lower-level language than PyTorch, which is significant engineering effort; implementations may not transfer across GPU architectures; and their IO-aware version is optimal within constants on a single GPU, whereas the attention computation itself may be parallelisable across multiple GPUs.
What it does not claim: the paper does not present an approximation — the result is exact — but it also does not solve multi-GPU partitioning, and it does not equate end-to-end speed-up with kernel speed-up (the 15% / 3× / 2.4× figures and the 7.6× kernel figure are different measurements and must not be mixed).

Key specs

证据位置 / evidence
摘要(三档端到端);Section 5 Limitations
BERT-large 端到端 / e2e
15%(序列 512)
GPT-2 端到端 / e2e
3×(序列 1K)
注意力算子 / kernel
7.6×;显存随序列长度线性
复现状态 / reproduction
未复现

What the source says

Transformers are slow and memory-hungry on long sequences, since the time and memory complexity of self-attention are quadratic in sequence length.
1 https://ar5iv.labs.arxiv.org/html/2205.14135
Our current approach to building IO-aware implementations of attention requires writing a new CUDA kernel for each new attention implementation.
2 https://ar5iv.labs.arxiv.org/html/2205.14135
15% end-to-end wall-clock speedup on BERT-large (seq. length 512) compared to the MLPerf 1.1 training speed record, 3× speedup on GPT-2 (seq. length 1K), and 2.4× speedup on long-range arena (seq. length 1K-4K).
3 https://ar5iv.labs.arxiv.org/html/2205.14135

Source and licence

Source checked
2026-11-07
Licence / kind
arxiv-preprint
Licence evidence
https://arxiv.org/abs/2205.14135
Category
Efficiency

How to read the numbers

Before citing a score, separate what it measures, how it is scored, what it compares against and whether contamination is controlled. If unsure, go back to the experiment setup in the paper. See benchmark cards · See dataset cards

More in this category

Next step

Open the official page →

← Back to AI Papers