What is the difference between exact efficient attention like FlashAttention and approximate attention like sparse or linear attention?
Last updated
Exact methods like FlashAttention compute the same output (up to rounding) as a drop-in replacement. FLOPs stay O(N²d) and gains come from less memory traffic.
Approximate methods change the function: sparse attention (Longformer, BigBird) scores only selected pairs, and linear or low-rank attention (Performer, Linformer) reaches O(N), at some cost in quality and recall.
Approximate methods usually need training with the approximation and are often not faster at moderate N due to irregular memory access. The ideas can combine, e.g. sliding-window inside FlashAttention kernels.