Why do LLMs attend to the first token?

Federico Barbero, Álvaro Arroyo, Xiangming Gu, Christos Perivolaropoulos, Michael Bronstein +2 more
4/3/2025
cs.CL
transformer-attention

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

Large Language Models (LLMs) tend to attend heavily to the first token in the sequence -- creating a so-called attention sink. Many works have studied this phenomenon in detail, proposing various ways to either leverage or alleviate it.

Show full abstract

Attention sinks have been connected to quantisation difficulties, security issues, and streaming attention. Yet, while many works have provided conditions in which they occur or not, a critical question remains shallowly answered: Why do LLMs learn such patterns and how are they being used? In this work, we argue theoretically and empirically that this mechanism provides a method for LLMs to avoid over-mixing, connecting this to existing lines of work that study mathematically how information propagates in Transformers. We conduct experiments to validate our theoretical intuitions and show how choices such as context length, depth, and data packing influence the sink behaviour. We hope that this study provides a new practical perspective on why attention sinks are useful in LLMs, leading to a better understanding of the attention patterns that form during training.

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. 1 weaker match is hidden by default — 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{barbero2025llms,
  title  = {Why do LLMs attend to the first token?},
  author = {Federico Barbero and Álvaro Arroyo and Xiangming Gu and Christos Perivolaropoulos and Michael Bronstein and Petar Veličković and Razvan Pascanu},
  year   = {2025},
  eprint = {2504.02732},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.02732v4}
}

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

Discussion