Why Attention Patterns Exist: A Unifying Temporal Perspective Analysis

Qingyue Yang, Jie Wang, Xing Li, Yinqi Bai, Xialiang Tong +4 more
1/29/2026
cs.CL

Official code: MIRALab-USTC/LLM-TAPPA (7 stars, MIT, last commit 2026-02-04).

Abstract

Attention patterns play a crucial role in both training and inference of large language models (LLMs). Prior works have identified individual patterns such as retrieval heads, sink heads, and diagonal traces, yet these observations remain fragmented and lack a unifying explanation. To bridge this gap, we introduce \textbf{Temporal Attention Pattern Predictability Analysis (TAPPA), a unifying framework that explains diverse attention patterns by analyzing their underlying mathematical formulations} from a temporally continuous perspective. TAPPA both deepens the understanding of attention behavior and guides inference acceleration approaches. Specifically, TAPPA characterizes attention patterns as predictable patterns with clear regularities and unpredictable patterns that appear effectively random. Our analysis further reveals that this distinction can be explained by the degree of query self-similarity along the temporal dimension. Focusing on the predictable patterns, we further provide a detailed mathematical analysis of three representative cases through the joint effect of queries, keys, and Rotary Positional Embeddings (RoPE). We validate TAPPA by applying its insights to KV cache compression and LLM pruning tasks. Across these tasks, a simple metric motivated by TAPPA consistently improves performance over baseline methods. The code is available at https://github.com/MIRALab-USTC/LLM-TAPPA.

View on arXivView PDF

Code Implementations(1)

MIT

The code for "Why Attention Patterns Exist: A Unifying Temporal Perspective Analysis", Qingyue Yang, Jie Wang, Xing Li, Yinqi Bai, Xialiang Tong, Huiling Zhen, Jianye HAO, Mingxuan Yuan, Bin Li.

71Shell, PythonJan 28, 20268 months agoMIT

Similar Papers

Cite this paper

@article{yang2026attention,
  title  = {Why Attention Patterns Exist: A Unifying Temporal Perspective Analysis},
  author = {Qingyue Yang and Jie Wang and Xing Li and Yinqi Bai and Xialiang Tong and Huiling Zhen and Jianye Hao and Mingxuan Yuan and Bin Li},
  year   = {2026},
  eprint = {2601.21709},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2601.21709v1}
}

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/2601.21709.svg)](https://codeofpaper.com/paper/2601.21709)

Discussion