Sparse Attention's O(N) Advantage: Speed & Memory Gains

Sparse attention dramatically reduces the O(N²) computational and memory costs of full attention to near O(N), enabling up to 10x prefill speedups over dense FlashAttention-2 and 30-35% peak memory reduction for 100K+ token contexts on devices like a 24 GB GPU.

The top 3

  1. Top 3 Sparse Attention Architectures: Longformer, BigBird, and Reformer pioneered linear or near-linear complexity (O(N) or O(N log N)) by employing techniques like sliding windows, global tokens, random attention, and Locality-Sensitive Hashing to scale LLMs.
  2. O(N) Advantage: Memory & Context Scaling: Sparse attention significantly reduces memory and computational complexity from quadratic (O(N²)) to linear (O(N)), enabling an 8x leap in context length for models like BigBird (from 512 to 4,096 tokens) and facilitating up to 100M tokens with Memory Sparse Attention (MSA).
  3. Top Sparse Attention Models: Longformer, Reformer, and BigBird are key sparse attention architectures, reducing quadratic computational and memory costs for processing longer sequences.

Sources

Open the full topic