FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision

Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, P. Ramani, Tri Dao

arXiv:2407.08608 · 2026-07-27 공개 · arXiv · PDF

transformer low-precision fp8 block-quantization attention-optimization tma warp-specialization flashattention-3

Abstract

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.

한국어 요약

한 줄 요약

FlashAttention-3는 Hopper GPU에서 1.5~2.0× 가속과 75% 활용률 달성한 최적화된 어텐션 알고리즘.

핵심 기여도

핵심 아이디어

기존 FlashAttention-2는 H100 GPU에서 35%의 낮은 활용률을 보였으며, 이는 비동기성과 저정밀도 기능을 활용하지 못한 결과였다. FlashAttention-3은 **Tensor Cores와 TMA의 비동기성**을 활용해 **와프 특화**(warp-specialization)를 도입함으로써, **블록 단위 GEMM 연산**(WGMMA)과 **softmax 연산**을 병렬화한다. 이는 메모리 읽기/쓰기 지연을 숨기는 데 기여한다. 또한, **FP8 저정밀도 연산**을 활용한 GEMM 최적화를 통해 성능을 극대화하면서도 **블록 양자화**(block quantization)와 **비일관 처리**(incoherent processing)를 통해 정확도를 유지한다.

기술적 접근법

주요 결과

의의 및 한계

FlashAttention-3는 Hopper GPU의 **Tensor Cores와 TMA의 비동기성**, **FP8 저정밀도 연산**을 효과적으로 활용하여 기존 어텐션 연산의 성능 한계를 극복했다. 특히, **FP8 기반 연산에서 정확도를 유지하면서도 높은 성능**을 보이는 점이 학술적·실용적 가치를 높인다. 그러나 **FP8의 정확도는 헤드 차원과 마스킹 유무에 따라 변동**하며, **FP16보다 낮은 성능을 보이는 경우도 존재**한다. 또한, 알고리즘은 Hopper 아키텍처에 최적화되어 있어 다른 GPU 아키텍처에서는 동일한 성능을 보장할 수 없다는 한계가 있다.

실용적 활용

FlashAttention-3는 **대규모 언어 모델**(LLM)과 **장문 처리**(long-context)를 요구하는 애플리케이션에서 GPU 연산 효율성을 크게 향상시킬 수 있다. 특히, **FP8 기반 연산**은 **저전력 고성능 컴퓨팅**(HPC) 및 **엣지 기기**에서 유용할 것으로 기대된다. 또한, **NVIDIA cuDNN과 경쟁하는 성능**을 보이며, **고성능 딥러닝 라이브러리 개발**에도 활용 가능하다.