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

Trains long-horizon web researchers by combining agentic mid-training, synthetic trajectories, and reinforcement learning. A 30.5B-parameter model activates 3.3B parameters per token and learns to plan, search, and synthesize evidence.

Explains how base-model behavior and GRPO normalization distort claims about reasoning gains. Introduces Dr. GRPO to reduce length bias, with a 7B training recipe reaching 43.3% on AIME 2024.

Improves language-model problem solving by generating candidate answers, retaining verified successes, and fine-tuning on them. Repeats this loop with an expectation-maximization interpretation instead of collecting more human-written solutions.