English

$\pi$-Attention: Periodic Sparse Transformers for Efficient Long-Context Modeling

Computation and Language 2026-03-31 v2 Artificial Intelligence

Abstract

Transformers have revolutionized natural language processing, but their quadratic complexity with respect to sequence length remains a fundamental bottleneck for long-range modeling. While sparse attention mechanisms like RingAttention reduce computational costs by restricting attention to local neighborhoods, they suffer from limited receptive fields and lack of adaptability. We present \PiAttention, a periodic sparse Transformer that factorizes attention into ring-local neighborhoods, deterministic π\pi-stride skips, and an adaptive fusion gate. The periodic structure provides predictable coverage of distant tokens, while the sparse footprint keeps the per-layer complexity linear in context length. We prove that \PiAttention achieves O(kL+πlogL)\mathcal{O}(kL + \pi \log L) receptive field growth compared to O(kL)\mathcal{O}(kL) for RingAttention, where kk is the local window size, π\pi is the skip period, and LL is the sequence length. Extensive experiments on language modeling, retrieval, and vision-language tasks demonstrate that \PiAttention matches or surpasses dense attention quality with 8.3\% lower perplexity than RingAttention while using 50\% fewer GPUs for the same context length. Our detailed ablations and visualizations reveal the importance of periodic skips, adaptive fusion, and head-level sparsity coordination for efficient long-context modeling.

Keywords

Cite

@article{arxiv.2511.10696,
  title  = {$\pi$-Attention: Periodic Sparse Transformers for Efficient Long-Context Modeling},
  author = {Dong Liu and Yanxuan Yu},
  journal= {arXiv preprint arXiv:2511.10696},
  year   = {2026}
}
R2 v1 2026-07-01T07:36:30.434Z