Learning When Not to Attend Globally

Xuan Luo, Kailai Zhang, Xifeng Yan
12/27/2025
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

When reading books, humans focus primarily on the current page, flipping back to recap prior context only when necessary. Similarly, we demonstrate that Large Language Models (LLMs) can learn to dynamically determine when to attend to global context.

Show full abstract

We propose All-or-Here Attention (AHA), which utilizes a binary router per attention head to dynamically toggle between full attention and local sliding window attention for each token. Our results indicate that with a window size of 256 tokens, up to 93\% of the original full attention operations can be replaced by sliding window attention without performance loss. Furthermore, by evaluating AHA across various window sizes, we identify a long-tail distribution in context dependency, where the necessity for full attention decays rapidly as the local window expands. By decoupling local processing from global access, AHA reveals that full attention is largely redundant, and that efficient inference requires only on-demand access to the global context.

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{luo2025learning,
  title  = {Learning When Not to Attend Globally},
  author = {Xuan Luo and Kailai Zhang and Xifeng Yan},
  year   = {2025},
  eprint = {2512.22562},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2512.22562v1}
}

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

Discussion