This paper (arXiv:2505.07241) by Albert Alcalde, Leon Bungert, and Konstantin Riedl (May 2025) analyzes the evolution of tokens in deep encoder-only Transformers at inference time.
Problem setting
Transformers with self-attention modules are central to modern large language and foundation models. In the large-token limit, token evolution at inference is described by a mean-field continuity equation, analogous to interacting multi-particle systems where particles correspond to tokens.
Main result
- The token distribution rapidly concentrates onto the push-forward of the initial distribution under a projection map induced by the key, query, and value matrices.
- It then remains metastable for moderate times.
- The Wasserstein distance between the token distribution and its limit scales like
- Lyapunov-type estimates for the zero-temperature equation
- Identification of the long-time limit as
t -> infinity - Stability estimates in Wasserstein space combined with a quantitative Laplace principle to couple the two equations
sqrt(log(beta+1)/beta) * exp(Ct) + exp(-ct)
where beta is the temperature parameter and t >= 0 is inference time.
Consequently, for time scales of order log(beta), the token distribution concentrates on a determined limiting distribution.
Proof techniques
Numerical findings
Numerical experiments confirm the theoretical results and show an additional regime: for finite beta and large t, the dynamics enter a different terminal phase dominated by the spectrum of the value matrix, complementing the theory.
*Source: zhichai.net forum post, auto-collected 2026-05-13.*