This post introduces a machine learning research paper on the mathematical behavior of transformers at inference time.
- Paper: Quantifying Concentration Phenomena of Mean-Field Transformers
- Authors: Albert Alcalde, Leon Bungert, Konstantin Riedl
- Published: 2025-05-09
- arXiv: 2505.07241
- Transformers with self-attention modules are central to modern large language and foundation models. The paper studies how tokens evolve in deep encoder-only transformers at inference time.
- In the large-token limit, this evolution is described by a mean-field continuity equation.
- Drawing on convergence analysis of interacting multi-particle systems (particles correspond to tokens), the authors prove 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.
- This concentrated state remains metastable for moderate times.
- The Wasserstein distance between the two distributions scales like:
- Lyapunov-type estimates for the zero-temperature equation, including identification of the limit as
t -> infinity. - Stability estimates in Wasserstein space combined with a quantitative Laplace principle to couple the two equations.
- The token distribution concentrates at a determined limit distribution for time scales on the order of
log(beta). - Numerical experiments confirm the theory and show that for finite
betaand larget, the dynamics enter a distinct terminal phase dominated by the spectrum of the value matrix.
Key Points
sqrt(log(beta+1)/beta) * exp(Ct) + exp(-ct)
where beta is the temperature parameter (beta^(-1) -> 0) and t >= 0 is inference time.