S2-Attention: hardware-aware Triton kernels make sparse attention actually fast

burkov · x · 2026-09-11

Dense attention's quadratic cost bottlenecks LLM training and inference. Sparse attention cuts theoretical FLOPs but rarely delivers wall-clock speedups due to missing hardware-level memory optimizations, and often loses accuracy on long-context tasks; inference-time token eviction also fragments memory in serving frameworks like PagedAttention.

The paper introduces Sparsely-Sharded Attention (S2-Attention), a hardware-aware Triton kernel library achieving real acceleration without accuracy loss. Its Merge-Q technique dynamically merges query blocks sharing key-value data into single computation tiles, cutting redundant loads and turning sparsity into actual speedups.

Original post →

More from Infra

Infra channel →