The Asymptotic Behavior of Attention in Transformers

Álvaro Rodríguez Abella, João Pedro Silvestre, Paulo Tabuada
12/3/2024
cs.AIcs.LGeess.SY

No official code found. Best implementation: cyphylab/GPT-Consensus (4 stars, MIT, last commit 2025-05-28).

Abstract

The transformer architecture has become the foundation of modern Large Language Models (LLMs), yet its theoretical properties are still not well understood. As with classic neural networks, a common approach to improve these models is to increase their size and depth. However, such strategies may be suboptimal, as several works have shown that adding more layers yields increasingly diminishing returns. More importantly, prior studies have shown that increasing depth may lead to model collapse, i.e., all the tokens converge to a single cluster, undermining the ability of LLMs to generate diverse outputs. Building on differential equation models for the transformer dynamics, we prove that all the tokens in a transformer asymptotically converge to a cluster as depth increases. At the technical level we leverage tools from control theory, including consensus dynamics on manifolds and input-to-state stability (ISS). We then extend our analysis to autoregressive models, exploiting their structure to further generalize the theoretical guarantees.

View on arXivView PDF

Code Implementations(1)

MIT

This a repository for the paper The Asymptotic Behavior of Attention in Transformers

40PythonJan 5, 20251 years agoMIT

Similar Papers

Cite this paper

@article{abella2024asymptotic,
  title  = {The Asymptotic Behavior of Attention in Transformers},
  author = {Álvaro Rodríguez Abella and João Pedro Silvestre and Paulo Tabuada},
  year   = {2024},
  eprint = {2412.02682},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2412.02682v2}
}

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

Discussion