Learn AI Math

FlashAttention

What is FlashAttention?

In one sentence: FlashAttention is a clever way to compute attention on GPUs that is much faster and uses much less memory, while giving the same results.

Normal attention writes huge temporary tables to slow GPU memory. FlashAttention breaks the work into small tiles that fit in the GPU's fast on-chip memory, so it moves far less data around. The math is the same; it is just organized smarter.

What does FlashAttention look like?

Switching to FlashAttention can make training a model with long context several times faster.

Why does FlashAttention matter?

It made long context windows practical and is used in almost every modern training and inference system.

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.