Home Knowledge Base FlashAttention

FlashAttention is a memory-efficient, IO-aware exact attention algorithm that reduces GPU memory usage from O(N²) to O(N) and speeds up attention computation by 2-4x — enabling training of long-context LLMs without approximation.

The Standard Attention Problem

FlashAttention Key Insight

Performance Gains

MetricStandard AttnFlashAttentionFlashAttention-2
MemoryO(N²)O(N)O(N)
Speedup vs baseline1x2-4x4-8x
Max sequence (A100)~8K~64K~128K

FlashAttention-2 Improvements

FlashAttention-3 (2024)

Adoption: PyTorch 2.0+ includes torch.nn.functional.scaled_dot_product_attention with FlashAttention built in.

FlashAttention is the critical engineering breakthrough that made 100K+ context LLMs practical — it enabled GPT-4's 128K context and Gemini's 1M context windows.

flash attentionmemory efficient attentionio aware attentionflash attention v2

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.