FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision
Summary
FlashAttention-3 redesigns FA2 for Hopper: warp-specialized TMA/WGMMA producer-consumer, pingpong scheduling so softmax hides under GEMM, and FP8 with in-kernel V transpose, block quantization, and Hadamard incoherent processing. H100 FP16 is 1.5-2.0× FA2 (up to 740 TFLOPs/s, 75% util) and 1.5-1.75× backward; FP8 reaches ~1.2 PFLOPs/s with 2.6× lower RMSE vs per-tensor FP8 on outlier-injected QKV. Competitive with or faster than cuDNN FA2 at seq≥1k. Code https://github.com/Dao-AILab/flash-attention.
- Venue
- arXiv / Colfax International / Meta / NVIDIA
- License
- CC BY 4.0
- License family
- Permissive
- Purpose
- Speed up exact attention on Hopper with warp-specialized asynchrony and FP8
- Scale
- H100 80GB SXM5; seq 512–16k at 16k tokens, hidden 2048, headdim 64/128/256; FP16/FP8 fwd/bwd vs FA2, Triton FA2, cuDNN, PyTorch. Ablation {batch,seq,nheads,hdim}={4,8448,16,128}: 661 vs 570 TFLOPs/s without warp-spec+pipelining.
- Time period
- 2024-07-11 (arXiv 2407.08608 v1); last revised 2024-07-12 (v2). HF paper publishedAt 2024-07-11.
- Added
- Oct 1, 2026
- Research status
- done
From the source
- Published
- Jul 11, 2024
- Last revised
- Jul 12, 2024
- arXiv categories
- cs.LG, cs.AI
- Citations
- 719 (75 influential)
- References
- 61
- Published in
- Neural Information Processing Systems
Abstract (from arXiv)
Attention, as a core layer of the ubiquitous Transformer architecture, is the bottleneck for large language models and long-context applications. FlashAttention elaborated an approach to speed up attention on GPUs through minimizing memory reads/writes. However, it has yet to take advantage of new capabilities present in recent hardware, with FlashAttention-2 achieving only 35% utilization on the H100 GPU. We develop three main techniques to speed up attention on Hopper GPUs: exploiting asynchrony of the Tensor Cores and TMA to (1) overlap overall computation and data movement via warp-specialization and (2) interleave block-wise matmul and softmax operations, and (3) block quantization and incoherent processing that leverages hardware support for FP8 low-precision. We demonstrate that our method, FlashAttention-3, achieves speedup on H100 GPUs by 1.5-2.0$\times$ with FP16 reaching up to 740 TFLOPs/s (75% utilization), and with FP8 reaching close to 1.2 PFLOPs/s. We validate that FP8 FlashAttention-3 achieves 2.6$\times$ lower numerical error than a baseline FP8 attention.
Tags
Topics
attention kernels, Hopper GPUs, FP8
Research notes
- Primary: arxiv abs (cs.LG; also cs.AI). License CC BY 4.0 on HTML at check. Equal contrib Shah/Bikshandi (Colfax); Zhang Meta; Thakkar/Ramani NVIDIA; Dao tri@tridao.me. Code https://github.com/Dao-AILab/flash-attention (24,706 stars at check; BSD-3-Clause). HF paper page 2 upvotes; unofficial linked models ethanker/nanomind-step-002000 and AshenNav/twill-swp-ws not copied into hf_* fields. Discord posted abs. Kernel library, not a new corpus, so no datasets_local row.
Cited by, within this collection
- Parallax: Parameterized Local Linear Attention for Language Modeling
- DualKV: Shared-Prompt Flash Attention for Efficient RL Training with Large Rollouts and Long Contexts
- SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference Acceleration
- How Much Is One Recurrence Worth? Iso-Depth Scaling Laws for Looped Language Models
- Differential Transformer
- Pretraining Large Language Models with NVFP4
Similar entries
- Other Flash-MSA: Accelerating Million-Token Training With Sparse Attention Kernels
- Code xattn
- Paper High-Dimensional Learning Dynamics of Attention-Indexed Models
- Paper MoBA: Mixture of Block Attention for Long-Context LLMs
- Paper The Spike, the Sparse and the Sink: Anatomy of Massive Activations and Attention Sinks
- Paper Emergent One-Third Scaling Law as Attention Tries to Concentrate