AIAny
Icon for item

Block Sparse Attention with Log-Linear Complexity

Reduces self-attention complexity to O(N log N) by using a coarse-to-fine (pyramid) Top-K block selection with LogSumExp scoring, implemented with hardware-aware Triton kernels for fused routing and scoring—aimed at long-context LMs and retrieval tasks.

Introduction

Most Transformer scaling work focuses on lowering the quadratic cost of attention; this paper's core insight is that you can find relevant key blocks with a logarithmic-depth, coarse-to-fine selection instead of scoring every query-block pair. That shift turns block-sparse attention’s remaining bottleneck (block selection) into an O(N log N) procedure while still preserving the important blocks for exact computation.

Key Findings
  • Pyramid Top-K selection: builds an O(log N) hierarchy of pooled keys and progressively narrows candidates from coarse to fine, so each query only scores a bounded set per level—this yields O(N log N) selection complexity rather than O(N^2).
  • LogSumExp scoring on bounded candidate sets: uses stable LogSumExp aggregation at each level to rank blocks without materializing the full QK score matrix, enabling efficient hardware fusion.
  • Hardware-aware implementation: custom Triton kernels fuse hierarchical routing and LogSumExp scoring for both training and inference, reducing memory traffic and avoiding full score matrix materialization.
  • Empirical behavior: matches baseline performance on commonsense reasoning benchmarks and improves retrieval-oriented tasks, showing the selection scheme preserves retrieval-relevant context.
Who it's for & trade-offs

Great fit if you need to extend Transformer contexts to very long sequences where naive attention is infeasible, or if retrieval-style relevance matters and you want a training-free sparse attention that keeps exact computation on critical blocks. Look elsewhere if your sequences are short (where quadratic attention is acceptable), if you need a strictly linear-time attention with simpler kernels, or if you cannot invest engineering effort to integrate custom Triton/CUDA kernels. Practical trade-offs include non-negligible constant factors from hierarchical pooling and kernel complexity, implementation and tuning effort for thresholds/level sizes, and potential task-dependent sensitivity of the Top-K strategy (very high sparsity can still harm dense-context tasks).

Where it fits

This approach occupies the middle ground between full attention (exact but quadratic) and simpler sparse or approximate schemes: it keeps exact values for selected blocks while routing selection to a coarse-to-fine search to avoid full pairwise scoring. Compared with single-pass block selection methods, the pyramid selection reduces scoring overhead at the cost of added pooling levels and routing logic—making it attractive when sequence length N is large enough that O(N log N) wins in practice.

Information

  • Websitearxiv.org
  • AuthorsBohao Tang, Zhen Qin, Yuqi Pan, Zheng Li, Pengfei Liu
  • Published date2026/09/25

More Items

Evaluates whether language and generative models can handle the full game-development pipeline, from white-box construction and asset creation to playtesting and refinement. Across 60 tasks and four engines, strong standalone assets often fail to translate into playable integrated games.

Improves 4D video question answering by expressing object motion in the reference coordinate system required by each question. Experiments find that question-aligned relative trajectories work better than supplying world-coordinate trajectories.

Keeps a live audio-video conversation going while handing longer tasks to a backend, then brings completed results back into the dialogue. Its reported evaluations combine low-latency turn-taking with background task delegation.