Analysis of mean-field models arising from self-attention dynamics in transformer architectures with layer normalization
Open Access
- 5 June 2025
- journal article
- Published by The Royal Society in Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences
- Vol. 383 (2298) , 20240233
Abstract
The aim of this article is to provide a mathematical analysis of transformer architectures using a self-attention mechanism with layer normalization. In particular, observed patterns in such architectures resembling either clusters or uniform distributions pose a number of challenging mathematical questions. We focus on a special case that admits a gradient flow formulation in the spaces of probability measures on the unit sphere under a special metric, which allows us to give at least partial answers in a rigorous way. The arising mathematical problems resemble those recently studied in aggregation equations but with additional challenges emerging from restricting the dynamics to the sphere and the particular form of the interaction energy. We provide a rigorous framework for studying the gradient flow, which also suggests a possible metric geometry to study the general case (i.e. one that is not described by a gradient flow). We further analyse the stationary points of the induced self-attention dynamics. The latter are related to stationary points of the interaction energy in the Wasserstein geometry, and we further discuss energy minimizers and maximizers in different parameter settings. This article is part of the theme issue ‘Partial differential equations in data science’.Keywords
All Related Versions
Funding Information
- Deutscher Akademischer Austauschdienst
- Deutsche Forschungsgemeinschaft
- Bundesministerium für Forschung, Technologie und Raumfahrt
- Engineering and Physical Sciences Research Council
This publication has 28 references indexed in Scilit:
- Covariance-Modulated Optimal Transport and Gradient FlowsArchive for Rational Mechanics and Analysis, 2024
- Accurate structure prediction of biomolecular interactions with AlphaFold 3Nature, 2024
- Highly accurate protein structure prediction with AlphaFoldNature, 2021
- Array programming with NumPyNature, 2020
- SciPy 1.0: fundamental algorithms for scientific computing in PythonNature Methods, 2020
- Identity Mappings in Deep Residual Networks2016
- On global minimizers of repulsive–attractive power-law interaction energiesPhilosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 2014
- A new class of transport distances between measuresCalculus of Variations and Partial Differential Equations, 2008
- A computational fluid mechanics solution to the Monge-Kantorovich mass transfer problemNumerische Mathematik, 2000
- Exponentiated Gradient versus Gradient Descent for Linear PredictorsInformation and Computation, 1997