Asymptotic Analysis of Discrete-Time Self-Attention Dynamics in Transformers
Claudio Altafini
Abstract
In machine learning, a self-attention dynamics describes the attention mechanism of transformers, and is obtained treating the layer index of a transformer as time index. Even though naturally discrete-time, this dynamical system is most often studied in continuous-time. Scope of this paper is to provide a thorough investigation of the discrete-time version of the self-attention dynamics: a complete classification of its equilibria is given, and their stability properties are studied, in both the single-head and the multihead case. We show that in both cases the main attractor of the dynamics is a consensus equilibrium aligned with the principal eigenvector of the value matrix (in the single-head case, a corresponding matrix of weights in the multihead case), even though other locally asymptotically stable bipartite equilibria can be show to exist at least in the single-head situation. The behavior is confirmed by looking at the learned weight matrices of a real transformer.
Create a lesson
Related papers
Adjoint-Based Stochastic Analysis for Fatigue of Aeroelastic and Frictional Systems
Justin H. Porter
Dimension theory of group actions by circle diffeomorphisms I: Stationary measures
Weikun He, Yuxiang Jiao, Disheng Xu
Hausdorff Dimension and Flexibility for Attractors of Non-Uniformly Hyperbolic Flows
Elias Rego, Paulo Varandas
Finiteness of planar central configurations of five bodies for all positive masses
Tejasvi Singh Tomar
Khintchine dichotomy for images of self-similar measures and almost random walks
Liyang Shao
A Lipschitz refinement of the Bebutov-Kakutani dynamical embedding theorem for connected Lie group actions
Yonatan Gutman, Qiang Huo, Kangbo Ouyang