The Mean-Field Dynamics of Transformers

Philippe Rigollet
12/1/2025
cs.LGmath-phmath.DS

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

Abstract

We develop a mathematical framework that interprets Transformer attention as an interacting particle system and studies its continuum (mean-field) limits. By idealizing attention on the sphere, we connect Transformer dynamics to Wasserstein gradient flows, synchronization models (Kuramoto), and mean-shift clustering. Central to our results is a global clustering phenomenon whereby tokens cluster asymptotically after long metastable states where they are arranged into multiple clusters. We further analyze a tractable equiangular reduction to obtain exact clustering rates, show how commonly used normalization schemes alter contraction speeds, and identify a phase transition for long-context attention. The results highlight both the mechanisms that drive representation collapse and the regimes that preserve expressive, multi-cluster structure in deep attention architectures.

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{rigollet2025meanfield,
  title  = {The Mean-Field Dynamics of Transformers},
  author = {Philippe Rigollet},
  year   = {2025},
  eprint = {2512.01868},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2512.01868v3}
}

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

Discussion