The idea

Standard attention repeatedly reads and writes large intermediate values between levels of GPU memory. FlashAttention rearranges exact attention into tiles so more work stays in faster on-chip memory. The paper calls this an I/O-aware algorithm.

That distinction is important: the main contribution is not an approximation that discards attention scores. It is a different way to schedule the same calculation. Less memory traffic can make longer sequences and faster training feasible on available hardware.

Read it with the code

The Dao-AILab repository includes production implementations that have evolved beyond the first paper. Read the original algorithm for the memory argument, then use the repository to see how kernels and hardware support changed over time.

GO DEEPER

Read the original.

Every story starts with a source. Check the methods and claims for yourself.

Read the paper Β· arXiv:2205.14135 β†—Dao-AILab implementation β†—
Useful to you? Pass it on.

A good idea gets better when you talk about it.

Pass an idea along.