Accelerating Prefilling for Long-Context LLMs via Sparse Pattern Sharing

Dan Peng, Zhihui Fu, Zewen Ye, Zhuoran Song, Jun Wang
5/26/2025
cs.LGcs.AIcs.CL
transformer-attention

No confident code implementation found for this paper.

Abstract

Sparse attention methods exploit the inherent sparsity in attention to speed up the prefilling phase of long-context inference, mitigating the quadratic complexity of full attention computation. While existing sparse attention methods rely on predefined patterns or inaccurate estimations to approximate attention behavior, they often fail to fully capture the true dynamics of attention, resulting in reduced efficiency and compromised accuracy.

Show full abstract

Instead, we propose a highly accurate sparse attention mechanism that shares similar yet precise attention patterns across heads, enabling a more realistic capture of the dynamic behavior of attention. Our approach is grounded in two key observations: (1) attention patterns demonstrate strong inter-head similarity, and (2) this similarity remains remarkably consistent across diverse inputs. By strategically sharing computed accurate patterns across attention heads, our method effectively captures actual patterns while requiring full attention computation for only a small subset of heads. Comprehensive evaluations demonstrate that our approach achieves superior or comparable speedup relative to state-of-the-art methods while delivering the best overall accuracy.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{peng2025accelerating,
  title  = {Accelerating Prefilling for Long-Context LLMs via Sparse Pattern Sharing},
  author = {Dan Peng and Zhihui Fu and Zewen Ye and Zhuoran Song and Jun Wang},
  year   = {2025},
  eprint = {2505.19578},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.19578v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.19578.svg)](https://codeofpaper.com/paper/2505.19578)

Discussion