betaFeedback

WorksMathematics

From Low-Dimensional Chaos to High-Dimensional Dynamics in Self-Attention Systems

Abstract

Continuous-time particle models of self-attention are often studied under symmetry assumptions that yield a gradient structure and constrain the dynamics to convergence toward equilibria. We investigate the behavior of these systems beyond the gradient setting, considering autonomous projected self-attention models with constant query, key, and value matrices and particles constrained to an ellipse. For three particles, the equations define a vector field on the three-dimensional torus. We derive explicit synchronized periodic solutions and compute their Floquet multipliers, establishing the existence of non-gradient dynamics. Numerical explorations using bifurcation diagrams, Poincare sections, periodic-orbit continuation, a nd Lyapunov exponents reveal attracting periodic orbits, invariant-torus-like behavior, and strong evidence of chaos. We then construct higher-dimensional systems by coupling these low-dimensional building blocks through masked and multi-head attention mechanisms. We discuss the persistence of normally hyperbolic invariant manifolds under weak coupling and investigate how the coupling architecture influences the resulting dynamics. Numerical experiments reveal the emergence of additional expanding directions, including a 60-particle system in which 26 of the 40 computed Lyapunov exponents exceed 0.01. These results demonstrate the richness of the dynamical behavior possible in simplified self-attention systems and motivate further investigation of the invariant structures organizing their high-dimensional dynamics.

Introduction

The 2017 paper Attention Is All You Need by Vaswani et al. [1] introduced a novel network architecture called a transformer and spurred rapid advances in text-based generative artificial intelligence (AI). In the years since, transformers have become ubiquitous in Large Language Models (LLMs) including OpenAI’s ChatGPT, Anthropic’s Claude, and Meta’s Llama [2, 3, 4] to name only a few. Indeed, GPT stands for Generative Pre-trained Transformer [5].

Very roughly speaking, the attention mechanism (formalized in Equation (1) below) treats a language token as a particle on a compact manifold and a text prompt as a cloud of such particles. The transformer is a layered network which reorganizes the point cloud, so that an appropriate average of the output state provides the most likely next token. As the cloud of particles passes through the network, each particle nudges — and is nudged — by the others. The strength of the adjustment is determined by the current state of the whole cloud. Projection onto the constraint manifold prevents unbounded growth of particle trajectories.

A concise mathematical description of this operation replaces network depth, in an appropriate limit, by continuous time. This results in a system of differential equations on the constraint manifold (see Equation (2) below), where field interactions between particles encode prompt context. That is, the same language token follows a different path, and shapes the trajectories of its neighbors differently, depending on the relative positions of the particles.

The particle-system viewpoint of attention has roots in the work of Lu et al. [6] and in the measure-theoretic treatments of Vuckovic et al. [7] and also Sander et al. [8]. For more discussion from a decidedly mathematical physics perspective, we refer to the work of Geshkovski, Letrouit, Polyanskiy, and Rigollet [9, 10], whose approach we follow below, and to Polyanskiy, Rigollet, and Yao [11] for the case of the circle.

To formalize the discussion, let d≥2d \ge2 be the dimension of the token embedding space, and W∈Rd×dW \in\mathbb{R}^{d \times d} be a symmetric, positive-definite matrix. Define the ellipsoid

EW={x∈Rd:xTWx=1}.\mathcal{E}_W = \{x \in\mathbb{R}^d : x^{\mathsf{T}} W x = 1\}.

and the projection operator ΠxW:Rd→TxEW\Pi_x^W : \mathbb{R}^d \to T_x\mathcal{E}_W by

ΠxWv=v−x(xTWv).\Pi_x^W v = v - x(x^{\mathsf{T}} W v).

Let NN denote the width of the context window, that is, the number of language tokens in the prompt (i.e. the number of particles in the system). We write x1,…,xN∈EWx_1, \ldots, x_N \in\mathcal{E}_W to denote the individual tokens, and X=(x1,…,xN)∈EWNX = (x_1, \ldots, x_N) \in\mathcal{E}_W^N to represent the entire prompt. That is, XX represents a state of the self-attention transformer.

Let Q,K:[0,T]→Rm×dQ, K : [0,T] \to\mathbb{R}^{m \times d} and V:[0,T]→Rd×dV : [0,T] \to\mathbb{R}^{d \times d} be smooth, matrix-valued functions. These are referred to as the query, key, and value matrices, respectively. (See Remark 1 below for the meaning of these terms in machine learning applications). For β≥0\beta\ge0, define the attention coefficients, or attention weights, by

αij(t,X)=exp⁡(β⟨Q(t)xi,K(t)xj⟩)∑k=1Nexp⁡(β⟨Q(t)xi,K(t)xk⟩),1≤i,j≤N.(1)\alpha_{ij}(t,X) = \frac{\exp\left(\beta\langle Q(t)x_i,K(t)x_j\rangle\right)}{\sum_{k=1}^{N}\exp\left(\beta\langle Q(t)x_i,K(t)x_k\rangle\right)}, \qquad1 \le i,j \le N. \tag*{(1)}

The denominator is referred to as the normalization of the attention weight, and the parameter 1/β1/\beta is referred to as the temperature of the system. The equations of motion for the continuous-time, single-head, self-attention particle system are given by the following projected vector field

x˙i(t)=Πxi(t)W(∑j=1Nαij(t,X(t))V(t)xj(t)),1≤i≤N.(2)\dot{x}_i(t) = \Pi_{x_i(t)}^W\left(\sum_{j=1}^{N}\alpha_{ij}(t,X(t))V(t)x_j(t)\right), \qquad1 \le i \le N. \tag*{(2)}

These provide the equations of motion for the particle system on the ellipsoid. The output of the transformer is an appropriate average of the state of the system after some specified time T>0T > 0.

Remark 1 (Interpretation of the attention mechanism). These choices, and the accompanying terminology, are more thoroughly justified and contextualized in [9, 10]. The interested reader is referred also to [6, 12, 13, 14] and the references therein. Nevertheless, we formulate a few brief clarifying remarks.

The query, key, and value matrices have distinct roles in the attention mechanism of Vaswani et al. [1]. The query Q(t)xiQ(t)x_i represents the information sought by particle ii, while the key K(t)xjK(t)x_j represents the information made available by particle jj. Their inner product measures the compatibility of these quantities, determining the relative strength of the particle interaction. The value V(t)xjV(t)x_j represents the information transmitted by particle jj to particle ii. Thus, the attention mechanism is a weighted average of the token values, with weights determined by query-key compatibility.

The softmax normalization is common in statistical mechanics and information theory. For fixed ii, writing sij=⟨Q(t)xi,K(t)xj⟩s_{ij} = \langle Q(t)x_i,K(t)x_j\rangle, the attention weights form a Gibbs probability distribution,

αij=eβsij∑keβsik.\alpha_{ij} = \frac{e^{\beta s_{ij}}}{\sum_k e^{\beta s_{ik}}}.

For β>0\beta> 0 (that is, temperature less than infinity), the Gibbs distribution uniquely maximizes

∑jpjsij+β−1H(p),\sum_j p_j s_{ij} + \beta^{-1} H(p),

over the probability simplex, where H(p)=−∑jpjlog⁡pjH(p) = -\sum_j p_j \log p_j is Shannon entropy. (This functional is the negative free energy, with energies −sij-s_{ij} and temperature 1/β1/\beta.) Thus, β\beta controls competition between selecting strongly compatible particles and distributing attention more uniformly. As β→0\beta\to0, the weights approach 1/N1/N, while as β→∞\beta\to\infty, attention concentrates on the particles with maximal compatibility. The weights are positive and sum to one, and they depend smoothly on the particle configuration, since the exponential is smooth and the denominator is positive.

Remark 2 (Model fidelity). The system given by Equation (2) is an idealization of the architecture introduced in [1], and of those used in practical applications. The constraint to the ellipsoid plays the role of layer normalization, but practical transformers differ from the model in at least three ways. First, they use multiple attention heads, each with its own query, key, and value matrices; in continuous time this corresponds to a sum of single-head terms. Second, attention layers are often combined with feedforward layers, adding a velocity field which acts on each particle separately. In an appropriate continuous-depth limit, such layers lead to neural-ODE networks [15]. Third, attention is often masked, so that each particle interacts with only a subset of the others. Causal masking in autoregressive language models, where each token attends only to the tokens preceding it, is one example [16, 14]; masks encoding graph or type structure, as in graph and heterogeneous attention architectures [17, 18], are another.

This said, the system of Equation (2) is nevertheless a building block for more realistic systems like the multi-head attention actually employed in [1]. In the present work (see Section 4) we use masked multi-head attention to assemble more realistic systems out of the building blocks considered in § 2.

An important qualitative result informing our understanding of the emergence of consensus, clustering, and metastability in self-attention systems is that, under appropriate symmetry restrictions on the query, key, and value matrices, these systems have gradient structure. Such structure severely constrains the dynamics: in an analytic gradient system on a compact manifold, every orbit converges, in both forward and backward time, to an equilibrium (not necessarily the same one). The theorem below follows, by a linear change of variables, from the spherical gradient-flow construction of Geshkovski, Letrouit, Polyanskii, and Rigolet [10 Section 1.2.4].

Theorem 3 (Gradient structure of symmetric self-attention). Suppose that β>0\beta> 0 and that QQ, KK, and VV are constant, with

P:=QTK=WV,P=PT.P := Q^{\mathsf T}K = WV,\qquad P = P^{\mathsf T}.

Define

Zi(X)=∑j=1Nexp⁡(βxiTPxj),Hβ(X)=12β∑i,j=1Nexp⁡(βxiTPxj).Z_i(X) = \sum_{j=1}^{N} \exp(\beta x_i^{\mathsf T}P x_j),\qquad\mathcal{H}_{\beta}(X) = \frac{1}{2\beta}\sum_{i,j=1}^{N} \exp(\beta x_i^{\mathsf T}P x_j).

and equip EWN\mathcal{E}^{N}_{W} with the Riemannian metric

gX(ξ,η)=∑i=1NZi(X) ξiTWηi.g_X(\xi,\eta) = \sum_{i=1}^{N} Z_i(X)\,\xi_i^{\mathsf T}W\eta_i.

Then (2) is the gradient-ascent flow of Hβ\mathcal{H}_{\beta} with respect to gg. Along every solution,

ddtHβ(X(t))=∑i=1NZi(X(t)) x˙i(t)TWx˙i(t)≥0.\frac{d}{dt}\mathcal{H}_{\beta}(X(t)) = \sum_{i=1}^{N} Z_i(X(t))\,\dot{x}_i(t)^{\mathsf T}W\dot{x}_i(t) \ge0.

with equality if and only if X(t)X(t) is an equilibrium. In particular, there are no nonconstant periodic solutions, and every trajectory converges to an equilibrium in forward and backward time.

The last assertion follows from analyticity, compactness, and the Łojasiewicz gradient inequality. The theorem and its generalizations illuminate important aspects of clustering and the long-time organization of token configurations. For related results and complementary viewpoints, we refer to [9, 19, 10, 12, 14, 20].

While Theorem 3 provides a powerful description of the qualitative dynamics, the algebraic hypotheses are in fact quite restrictive. Typical applications to machine learning impose no such constraints on the query, key, and value matrices during training [1], and since QTK=WVQ^{\mathsf{T}}K = WV and the symmetry of QTKQ^{\mathsf{T}}K are nongeneric in the set of real matrices, these conditions should be expected to fail in general. We refer to Tomihari and Karakida [21] for another perspective on self-attention in the absence of an energy function.

The goal of the present work is to explore how far transformer dynamics can depart from this gradient picture. To this end, we consider the elementary case of three particles on an ellipse in R2\mathbb{R}^{2}, with constant but otherwise unrestricted attention matrices. The right-hand side of Equation (2) defines a vector field on R6\mathbb{R}^{6} that is tangent to the embedded torus EW3\mathcal{E}_{W}^{3}. In angular coordinates, that is, on the universal cover R3\mathbb{R}^{3}, it becomes a system of three unprojected ordinary differential equations, 2π2\pi-periodic in each angle variable, and the dynamics of three-dimensional vector fields are much easier to visualize.

We begin our study by giving conditions under which this three-dimensional example system possesses nonconstant periodic orbits. For such parameters the system admits no strict Lyapunov function on the torus and, in particular, is not the gradient flow of any single-valued energy with respect to any Riemannian metric. Consequently, such parameters necessarily violate the hypotheses of Theorem 3.

Next, we present numerical explorations of the three-particle system using classical tools from computational dynamics such as Poincaré sections, Lyapunov exponents, periodic-orbit continuation, and bifurcation diagrams. The computations reveal periodic windows, changes of stability of periodic orbits, and provide compelling numerical evidence for the existence of chaotic attractors.

Finally, we show how elementary low-dimensional attention systems can be assembled into higher-dimensional models using masked multi-head attention. That is, we construct examples where, at zero coupling, we have a product of independently evolving systems whose dynamics we choose. Increasing the coupling parameter introduces interactions between the constituent subsystems, allowing us to build large networks with complex, non-gradient dynamics. We study these networks using standard ideas from perturbation theory, as well as numerical experiments. These constructions are motivated by established attention architectures involving restricted and type-dependent interactions [17, 18, 14]. See § 4.5 for more detailed discussion.

A model related to the one derived in § 2 was recently studied by Li et al. [22], who consider particles constrained to the circle with a linear attention kernel in place of the exponential softmax. They show that the resulting dynamics admit a generalized Kuramoto formulation with second-harmonic coupling, and use classical methods for coupled oscillators to investigate clustering, periodic oscillations, and bifurcations, primarily in the mean-field limit. Here we retain the softmax attention mechanism, work with finitely many particles, and construct specific examples with complicated, non-gradient dynamics.

Code and data availability: The MATLAB implementations used in this paper, together with archived numerical data and scripts for reproducing the figures and tables, are publicly available through the accompanying project webpage [23].

A three particle model on the torus

Throughout this section, we consider three particles x1,x2,x3∈R2x_1,x_2,x_3 \in\mathbb{R}^{2} and constant query, key, and value matrices. The particles are constrained to the surface of an ellipse defined as follows. Let W∈R2×2W \in\mathbb{R}^{2 \times2} be symmetric and positive definite, and write

EW={x∈R2:xTWx=1},S=W−1/2.\mathcal{E}_{W} = \{x \in\mathbb{R}^{2} : x^{\mathsf{T}}Wx = 1\}, \qquad S = W^{-1/2}.

The map u↦Suu \mapsto Su takes the unit circle diffeomorphically onto EW\mathcal{E}_W. We introduce

u(θ)=(cos⁡θsin⁡θ),v(θ)=u′(θ)=(−sin⁡θcos⁡θ).u(\theta)=\begin{pmatrix}\cos\theta\\ \sin\theta\end{pmatrix}, \qquad v(\theta)=u'(\theta)=\begin{pmatrix}-\sin\theta\\ \cos\theta\end{pmatrix}.

and parametrize the particle positions by

xi=Su(θi),θi∈R/2πZ,i=1,2,3.x_i=Su(\theta_i), \qquad\theta_i\in\mathbb{R}/2\pi\mathbb{Z}, \qquad i=1,2,3.

In particular, x˙i=Sv(θi)θ˙i\dot{x}_i=Sv(\theta_i)\dot{\theta}_i, where the dot denotes differentiation with respect to time. We identify the configuration space EW3\mathcal{E}_W^3 with the three-dimensional torus T3=(R/2πZ)3\mathbb{T}^3=(\mathbb{R}/2\pi\mathbb{Z})^3.

The matrices QQ, KK, and VV enter the angular equations through the effective 2×22\times2 matrices

A=W1/2VW−1/2,B=W−1/2QTKW−1/2.(3)A=W^{1/2}VW^{-1/2}, \qquad B=W^{-1/2}Q^{\mathsf{T}}KW^{-1/2}. \tag*{(3)}

For convenience, put ui=u(θi)u_i=u(\theta_i) and vi=v(θi)v_i=v(\theta_i). The attention coefficients become

αij(θ)=exp⁡(βuiTBuj)∑k=13exp⁡(βuiTBuk),1≤i,j≤3.(4)\alpha_{ij}(\theta)=\frac{\exp(\beta u_i^{\mathsf{T}}Bu_j)}{\sum_{k=1}^{3}\exp(\beta u_i^{\mathsf{T}}Bu_k)}, \qquad1\leq i,j\leq3. \tag*{(4)}

To obtain the angular equations, observe that SviSv_i has unit length in the WW-metric, since (Svi)TW(Svi)=1(Sv_i)^{\mathsf{T}}W(Sv_i)=1. Moreover, for w∈R2w\in\mathbb{R}^2, the tangent projection ΠxiWw=w−xi(xiTWw)\Pi^W_{x_i}w=w-x_i(x_i^{\mathsf{T}}Ww) satisfies

(Svi)TWΠxiWw=(Svi)TWw=viTW1/2w.(Sv_i)^{\mathsf{T}}W\Pi^W_{x_i}w=(Sv_i)^{\mathsf{T}}Ww=v_i^{\mathsf{T}}W^{1/2}w.

Taking the WW-inner product of (2) with SviSv_i, and using (3), gives the autonomous system

θ˙i=Fi(θ):=viTA∑j=13αij(θ)uj=∑j=13eβuiTBujviTAuj∑k=13eβuiTBuk,i=1,2,3.(5)\dot{\theta}_i=F_i(\theta):=v_i^{\mathsf{T}}A\sum_{j=1}^{3}\alpha_{ij}(\theta)u_j=\frac{\sum_{j=1}^{3}e^{\beta u_i^{\mathsf{T}}Bu_j}v_i^{\mathsf{T}}Au_j}{\sum_{k=1}^{3}e^{\beta u_i^{\mathsf{T}}Bu_k}}, \qquad i=1,2,3. \tag*{(5)}

For later numerical work, it is useful to write the right-hand side completely in terms of trigonometric functions and the entries of AA and BB. Let

A=(a11a12a21a22),B=(b11b12b21b22),ci=cos⁡θi,si=sin⁡θi.A=\begin{pmatrix}a_{11}&a_{12}\\a_{21}&a_{22}\end{pmatrix}, \qquad B=\begin{pmatrix}b_{11}&b_{12}\\b_{21}&b_{22}\end{pmatrix}, \qquad c_i=\cos\theta_i,\quad s_i=\sin\theta_i.

Then

uiTBuj=b11cicj+b12cisj+b21sicj+b22sisj,u_i^{\mathsf{T}}Bu_j=b_{11}c_ic_j+b_{12}c_is_j+b_{21}s_ic_j+b_{22}s_is_j,

whereas

viTAuj=(a21ci−a11si)cj+(a22ci−a12si)sj.v_i^{\mathsf{T}}Au_j=(a_{21}c_i-a_{11}s_i)c_j+(a_{22}c_i-a_{12}s_i)s_j.

Substitution in (5) yields the explicit three-dimensional vector field

θ˙i=∑j=13exp⁡(β[b11cicj+b12cisj+b21sicj+b22sisj])[(a21ci−a11si)cj+(a22ci−a12si)sj]∑j=13exp⁡(β[b11cicj+b12cisj+b21sicj+b22sisj]),i=1,2,3.(6)\dot{\theta}_i= \frac{\sum_{j=1}^{3}\exp\left(\beta\left[b_{11}c_ic_j+b_{12}c_is_j+b_{21}s_ic_j+b_{22}s_is_j\right]\right)\left[(a_{21}c_i-a_{11}s_i)c_j+(a_{22}c_i-a_{12}s_i)s_j\right]} {\sum_{j=1}^{3}\exp\left(\beta\left[b_{11}c_ic_j+b_{12}c_is_j+b_{21}s_ic_j+b_{22}s_is_j\right]\right)}, \qquad i=1,2,3. \tag*{(6)}

Thus θ˙=F(θ)\dot{\theta}=F(\theta) defines a real-analytic vector field on T3\mathbb{T}^3. Its lift to R3\mathbb{R}^3 is 2π2\pi-periodic in each coordinate, and the denominators in (6) are everywhere strictly positive. In particular, the flow exists for all time on the compact phase space T3\mathbb{T}^3.

The effective matrices AA and BB can be prescribed independently. Indeed, for arbitrary real 2×22 \times2 matrices AA and BB, one can choose the query/key dimension m=2m=2 and take

V=W−1/2AW1/2,Q=I2,K=W1/2BW1/2.V=W^{-1/2}AW^{1/2},\qquad Q=I_2,\qquad K=W^{1/2}BW^{1/2}.

Consequently, when the attention matrices are unrestricted, the ellipse can be removed by a linear change of coordinates without restricting the class of angular vector fields (5). Note also that the gradient hypotheses QTK=WVQ^{\mathsf T}K=WV and (QTK)T=QTK(Q^{\mathsf T}K)^{\mathsf T}=Q^{\mathsf T}K from Theorem 3 reduce in these coordinates to A=B=BTA=B=B^{\mathsf T}.

Because all three particles use the same attention matrices, the vector field is equivariant under permutations of the particles. In particular, the pair-coincidence subtori {θi=θj(mod2π)}\{\theta_i=\theta_j\pmod{2\pi}\} and the fully synchronized circle

Δ={(φ,φ,φ):φ∈T}\Delta=\{(\varphi,\varphi,\varphi):\varphi\in\mathbb{T}\}

are invariant. On Δ\Delta, all attention weights are equal to 1/31/3, and the equations reduce to

φ˙=v(φ)TAu(φ)=a21cos⁡2φ−a12sin⁡2φ+(a22−a11)sin⁡φcos⁡φ,(7)\dot{\varphi}=v(\varphi)^{\mathsf T}Au(\varphi)=a_{21}\cos^2\varphi-a_{12}\sin^2\varphi+(a_{22}-a_{11})\sin\varphi\cos\varphi, \tag*{(7)}

which is independent of BB and β\beta. The synchronized dynamics provides an explicit family of nongradient examples, as the following proposition shows.

Proposition 4 (Existence and stability of a synchronized periodic orbit). Consider the three-particle system on the unit circle, written in angular coordinates as

θ˙i=∑j=13αij(θ)v(θi)TAu(θj),1≤i≤3,\dot{\theta}_i=\sum_{j=1}^{3}\alpha_{ij}(\theta)v(\theta_i)^{\mathsf T}Au(\theta_j),\qquad1\leq i\leq3,

where

u(θ)=(cos⁡θsin⁡θ),v(θ)=u′(θ),u(\theta)=\begin{pmatrix}\cos\theta\\ \sin\theta\end{pmatrix},\qquad v(\theta)=u'(\theta),

and

αij(θ)=exp⁡(βu(θi)TBu(θj))∑k=13exp⁡(βu(θi)TBu(θk)).\alpha_{ij}(\theta)=\frac{\exp\left(\beta u(\theta_i)^{\mathsf T}Bu(\theta_j)\right)}{\sum_{k=1}^{3}\exp\left(\beta u(\theta_i)^{\mathsf T}Bu(\theta_k)\right)}.

Suppose that A,B∈R2×2A,B\in\mathbb{R}^{2\times2} are constant, β≥0\beta\geq0, and that AA has complex conjugate eigenvalues a±iκa\pm i\kappa, where

a=12tr⁡(A),κ=det⁡(A)−14tr⁡(A)2>0.a=\frac{1}{2}\operatorname{tr}(A),\qquad\kappa=\sqrt{\det(A)-\frac{1}{4}\operatorname{tr}(A)^2}>0.

Then the synchronized diagonal

D={(φ,φ,φ):φ∈T}\mathcal{D}=\{(\varphi,\varphi,\varphi):\varphi\in\mathbb{T}\}

is a periodic orbit with period

T=2πκ.T=\frac{2\pi}{\kappa}.

Its monodromy matrix is

M=1311T+σ(I3−1311T),σ=e−aT,M=\frac{1}{3}\boldsymbol{1}\boldsymbol{1}^{\mathsf T}+\sigma\left(I_3-\frac{1}{3}\boldsymbol{1}\boldsymbol{1}^{\mathsf T}\right),\qquad\sigma=e^{-aT},

where 1=(1,1,1)T\boldsymbol{1}=(1,1,1)^{\mathsf T}. Equivalently,

M=13(1+2σ1−σ1−σ1−σ1+2σ1−σ1−σ1−σ1+2σ).M=\frac{1}{3}\begin{pmatrix} 1+2\sigma& 1-\sigma& 1-\sigma\\ 1-\sigma& 1+2\sigma& 1-\sigma\\ 1-\sigma& 1-\sigma& 1+2\sigma \end{pmatrix}.

In particular, the Floquet multipliers are

1,σ,σ.1,\qquad\sigma,\qquad\sigma.

Moreover, for any φ0∈T\varphi_0 \in\mathbb{T}, the Poincaré return map on the section Σ={θ1=φ0}\Sigma= \{\theta_1 = \varphi_0\} has a fixed point corresponding to the synchronized orbit. In local coordinates centered at this fixed point, its derivative is

DP(0,0)=σI2.DP(0,0)=\sigma I_2.

Consequently, the synchronized periodic orbit is hyperbolic and orbitally attracting if tr⁡(A)>0\operatorname{tr}(A)>0, and hyperbolic and orbitally repelling if tr⁡(A)<0\operatorname{tr}(A)<0. If tr⁡(A)=0\operatorname{tr}(A)=0, the orbit is nonhyperbolic. These conclusions are independent of BB and β\beta.

Proof. At synchrony, θ1=θ2=θ3=φ\theta_1=\theta_2=\theta_3=\varphi, all attention weights are equal to 1/31/3. Hence the synchronized diagonal is invariant, and the dynamics restricted to it are governed by

φ˙=g(φ),g(φ)=v(φ)TAu(φ).\dot{\varphi}=g(\varphi),\qquad g(\varphi)=v(\varphi)^{T}Au(\varphi).

Since AA has no real eigenvalues, g(φ)g(\varphi) cannot vanish. Indeed, g(φ)=0g(\varphi)=0 would imply that Au(φ)Au(\varphi) is parallel to u(φ)u(\varphi), giving a real eigenvector of AA. Thus the synchronous motion is periodic.

To compute its period, observe that the equation for u(φ(t))u(\varphi(t)) can be written as

ddtu=(I2−uuT)Au.\frac{d}{dt}u=(I_2-uu^{T})Au.

Consequently,

u(φ(t))=eAtu(φ0)∥eAtu(φ0)∥.u(\varphi(t))=\frac{e^{At}u(\varphi_0)}{\lVert e^{At}u(\varphi_0)\rVert}.

Writing A=aI2+CA=aI_2+C, where C2=−κ2I2C^2=-\kappa^2I_2, we obtain

eAt=eat(cos⁡(κt)I2+sin⁡(κt)κC).e^{At}=e^{at}\left(\cos(\kappa t)I_2+\frac{\sin(\kappa t)}{\kappa}C\right).

Since AA has no real eigenvectors, the first positive time at which eAtu(φ0)e^{At}u(\varphi_0) is a positive multiple of u(φ0)u(\varphi_0) is T=2π/κT=2\pi/\kappa. This is the period of the synchronized orbit.

We next compute the variational equation along the synchronized solution. Define

d(φ)=u(φ)TAu(φ),c(φ)=v(φ)TAv(φ).d(\varphi)=u(\varphi)^{T}Au(\varphi),\qquad c(\varphi)=v(\varphi)^{T}Av(\varphi).

At synchrony, the derivative of the attention weights does not contribute to the linearization. Indeed, the attention weights satisfy ∑jαij=1\sum_j\alpha_{ij}=1, and all the vectors being averaged coincide. Therefore the corresponding first-order terms cancel.

Using u′=vu'=v and v′=−uv'=-u, direct differentiation gives

∂Fi∂θk=−d(φ)δik+13c(φ),\frac{\partial F_i}{\partial\theta_k}=-d(\varphi)\delta_{ik}+\frac{1}{3}c(\varphi),

where FiF_i denotes the right-hand side of the iith angular equation and δik\delta_{ik} is the Kronecker delta. Thus the variational equation is

ξ˙=L(φ(t))ξ,L(φ)=−d(φ)I3+13c(φ)11T.\dot{\xi}=L(\varphi(t))\xi,\qquad L(\varphi)=-d(\varphi)I_3+\frac{1}{3}c(\varphi)11^{T}.

Introduce the complementary projections

P∥=1311T,P⊥=I3−P∥.P_{\parallel}=\frac{1}{3}11^{T},\qquad P_{\perp}=I_3-P_{\parallel}.

Since

g′(φ)=−d(φ)+c(φ),g'(\varphi)=-d(\varphi)+c(\varphi),

the Jacobian is

L(φ)=g′(φ)P∥−d(φ)P⊥.L(\varphi)=g'(\varphi)P_{\parallel}-d(\varphi)P_{\perp}.

The projections are constant and commute. Consequently, the fundamental matrix of the variational equation, normalized by Φ(0)=I3\Phi(0)=I_3, is

Φ(t)=exp⁡(∫0tg′(φ(s)) ds)P∥+exp⁡(−∫0td(φ(s)) ds)P⊥.\Phi(t)=\exp\left(\int_0^t g'(\varphi(s))\,ds\right)P_{\parallel}+\exp\left(-\int_0^t d(\varphi(s))\,ds\right)P_{\perp}.

Consider these integrals over one period. Since φ˙=g(φ)\dot{\varphi}=g(\varphi) and gg never vanishes,

ddtlog⁡∣g(φ(t))∣=g′(φ(t)).\frac{d}{dt}\log\lvert g(\varphi(t))\rvert=g'(\varphi(t)).

The periodicity of gg therefore gives

∫0Tg′(φ(t)) dt=0.\int_0^T g'(\varphi(t))\,dt=0.

On the other hand, because u(φ)u(\varphi) and v(φ)v(\varphi) form an orthonormal basis of R2\mathbb{R}^2,

d(φ)+c(φ)=tr⁡(A)=2a.d(\varphi)+c(\varphi)=\operatorname{tr}(A)=2a.

Combining this identity with g′=c−dg'=c-d gives

d(φ)=a−12g′(φ).d(\varphi)=a-\frac{1}{2}g'(\varphi).

It follows that

∫0Td(φ(t)) dt=aT.\int_0^T d(\varphi(t))\,dt=aT.

Hence the monodromy matrix is

M=Φ(T)=P∥+e−aTP⊥,M=\Phi(T)=P_{\parallel}+e^{-aT}P_{\perp},

which is precisely the stated formula. The vector 1\mathbf{1} is an eigenvector with eigenvalue 11, while every vector in the two-dimensional subspace

ξ1+ξ2+ξ3=0\xi_1+\xi_2+\xi_3=0

is an eigenvector with eigenvalue σ=e−aT\sigma=e^{-aT}. This proves the formula for the Floquet multipliers.

It remains to compute the derivative of the Poincaré return map. Fix φ0\varphi_0 and consider the transverse section

Σ={θ1=φ0(mod2π)},\Sigma=\{\theta_1=\varphi_0\pmod{2\pi}\},

with local coordinates

(x,y)⟼(φ0,φ0+x,φ0+y).(x,y)\longmapsto(\varphi_0,\varphi_0+x,\varphi_0+y).

Let Ψt\Psi^t denote the flow of the full three-particle system. Since g(φ0)≠0g(\varphi_0)\ne0, the first return time τ(x,y)\tau(x,y) near the synchronized orbit is well-defined and smooth, with τ(0,0)=T\tau(0,0)=T. Define

P(x,y)=π2,3Ψτ(x,y)(φ0,φ0+x,φ0+y)−(φ0,φ0)(mod2π),P(x,y)=\pi_{2,3}\Psi^{\tau(x,y)}(\varphi_0,\varphi_0+x,\varphi_0+y)-(\varphi_0,\varphi_0)\pmod{2\pi},

where π2,3\pi_{2,3} denotes projection onto the second and third angular coordinates. Clearly P(0,0)=(0,0)P(0,0)=(0,0).

At the synchronized crossing, the vector field is g(φ0)1g(\varphi_0)\mathbf{1}. Differentiating the return condition θ1(τ(x,y))=φ0(mod2π)\theta_1(\tau(x,y))=\varphi_0\pmod{2\pi} gives the standard correction for variations of the return time. Therefore

DP(0,0)=π2,3(I3−1e1T)M(001001).DP(0,0)=\pi_{2,3}(I_3-\mathbf{1}e_1^{T})M \begin{pmatrix} 0 & 0\\ 1 & 0\\ 0 & 1 \end{pmatrix}.

where e1=(1,0,0)Te_1=(1,0,0)^T. Substituting M=P∥+σP⊥M=P_{\parallel}+\sigma P_{\perp}, and observing that (I3−1e1T)P∥=0(I_3-1e_1^T)P_{\parallel}=0, we obtain

DP(0,0)=(σ00σ).DP(0,0)=\begin{pmatrix}\sigma&0\\0&\sigma\end{pmatrix}.

The eigenvalues of the return map are therefore both equal to e−aTe^{-aT}. The claimed stability conclusions follow. □\square

Numerical explorations of the three-dimensional model

We now investigate the dynamics of the three-particle system (5) numerically. Throughout this section, we represent the phase space T3\mathbb{T}^3 by the identification cube [0,2π]3[0,2\pi]^3, with opposite faces identified. We consider two choices of the effective matrices and use the inverse-temperature parameter β≥0\beta\geq0 as a bifurcation parameter. Define the matrices

A1=(0.20−2.302.300.20),A2=(−0.05−2.302.30−0.05),B=(−1.200.40−0.80−2.40).(8)A_1=\begin{pmatrix}0.20&-2.30\\2.30&0.20\end{pmatrix},\qquad A_2=\begin{pmatrix}-0.05&-2.30\\2.30&-0.05\end{pmatrix}, \qquad B=\begin{pmatrix}-1.20&0.40\\-0.80&-2.40\end{pmatrix}. \tag*{(8)}

The first choice has A=A1A=A_1 and the second has A=A2A=A_2; both use the same matrix BB. For A=A1A=A_1, the synchronized periodic orbit of Proposition 4 is attracting for every β≥0\beta\geq0 (see § 3.1). Parameter scans initialized near this orbit reveal no additional dynamics.

For A=A2A=A_2, the synchronized periodic orbit is transversely repelling for every β≥0\beta\geq0, and a standard bifurcation diagram reveals richer behavior. The diagram suggests torus-like dynamics, periodic windows, and numerical evidence of chaos. We consider these results in § 3.2.

For the same choice A=A2A=A_2, we also follow an attracting, nonsynchronized periodic orbit, apparently born in a saddle-node bifurcation near β=0.40916\beta=0.40916. This periodic orbit has complex-conjugate transverse Floquet multipliers, and continuation indicates a candidate Neimark–Sacker bifurcation near β=0.58556\beta=0.58556. We discuss this second scan in § 3.3.

Our goal is not to provide a comprehensive bifurcation analysis of this system. Rather, we exhibit several representative dynamical phenomena, illustrating a wide variety of possible behaviors for only three interacting particles. The three-particle computations use adaptive integration of the angular equations, event detection for Poincaré crossings, and integration of the variational equations. Periodic solutions are refined by shooting, and their orbital stability is computed via Floquet multipliers. Lyapunov exponents are estimated by repeated QR orthogonalization. The coupled-system Lyapunov computations in § 5 instead use fixed-step fourth-order Runge–Kutta integration. For general discussions of these numerical techniques, see [24, 25, 26].

Unless otherwise stated, our Poincaré section is

Σ={θ∈T3:θ1=0(mod2π)},\Sigma=\{\theta\in\mathbb{T}^3:\theta_1=0\pmod{2\pi}\},

with coordinates (θ2,θ3)(\theta_2,\theta_3). This section is chosen for convenience, rather than because it has any distinguished geometric status. The bifurcation diagrams record the coordinate θ3\theta_3 at section encounters, and the Poincaré maps distinguish crossings with θ˙1<0\dot{\theta}_1<0 from those with θ˙1>0\dot{\theta}_1>0. As we shall see, these two crossing directions can correspond to different portions of the same geometric intersection curve when an invariant torus is not everywhere transverse to the flow through Σ\Sigma.

An explicit attracting synchronized periodic orbit

As a first illustration, take A=A1A=A_1 and BB as in Equation (8). The synchronized circle Δ={θ1=θ2=θ3}\Delta=\{\theta_1=\theta_2=\theta_3\} is invariant. By Proposition 4, it contains the explicit periodic orbit $\theta_1(t)=\theta_2(t)=\theta_3(t)=\varphi_0+2.30t`. (mod 2π2\pi), with period T=2π/2.30T=2\pi/2.30 and double nontrivial Floquet multiplier exp⁡(−0.20T)≈0.57905\exp(-0.20T)\approx0.57905. In particular, the synchronized periodic orbit is attracting. In fact, the synchronized circle itself is this periodic orbit, and both its period and multipliers are independent of β\beta and BB. Thus it is present and normally attracting for every β≥0\beta\geq0, with A=A1A=A_1 fixed.

Figure 1 illustrates the resulting periodic motion and the approach of selected trajectories to the synchrony circle. The numerical experiments also remind us that local orbital stability does not determine the global basin of attraction.

Attracting synchronized periodic orbit at $\beta=0$ and selected forward trajectories

Figure 1. (a) The attracting synchronized periodic orbit at β=0\beta= 0. (b) The same orbit together with selected forward trajectories, some of which approach it. An explicitly known attracting periodic orbit in the synchronized circle (left) and the behavior of selected initial conditions (right). The simulations use A=A1A=A_1 and the matrix BB defined in Equation (8). The curves are drawn in the identification cube; trajectories are broken where they cross an identified face.

The main parameter scan: invariant tori and chaos

For the remaining experiments, we fix A=A2A=A_2 and the same matrix BB from (8), varying β≥0\beta\geq0. The matrices A1A_1 and A2A_2 have the same rotational part, while their scalar parts are 0.20I20.20I_2 and −0.05I2-0.05I_2, respectively. The synchronized periodic orbit remains present for A=A2A=A_2, but it is transversely repelling, since its two nontrivial Floquet multipliers are exp⁡(0.05 2π/2.30)≈1.14636>1\exp(0.05\,2\pi/2.30)\approx1.14636>1.

Our first parameter scan begins at β=0\beta=0 with the angular initial condition

θ(0)=(1.8647340967, 3.8249352834, 4.0754264806),\theta(0)=(1.8647340967,\ 3.8249352834,\ 4.0754264806),

and increases β\beta using the terminal state from one parameter value to initialize the next. After discarding a transient, section encounters are plotted against β\beta. This procedure is well suited to locating attracting regimes and sudden changes in the observed asymptotic dynamics, but can also switch between coexisting attractors or retain long transients.

The diagram in Figure 2 suggests a rich progression of periodic, quasiperiodic, and more complicated recurrent behavior. To examine individual regimes, we compute the finite-time Lyapunov spectrum, a Poincaré section, and a phase-space portrait at fixed values of β\beta. The three panels in the following figures show these diagnostics in that order. A smooth closed curve in the section, together with two Lyapunov exponents approaching zero, is consistent with an invariant two-torus. By contrast, a persistently positive largest Lyapunov exponent is numerical evidence of sensitive dependence on initial conditions.

Bifurcation diagram for the main forward-integration scan with the matrices $A_2$ and $B$ from (8)

Figure 2. Bifurcation diagram for the main forward-integration scan with the matrices A2A_2 and BB from (8). Points record the θ3\theta_3 coordinate at intersections with the section θ1=0\theta_1 = 0 (mod 2π2\pi) after a transient has been discarded. The diagram is an empirical representation of the attractors selected by this parameter sweep, rather than a continuation diagram of every periodic solution.

The two colors in the Poincaré plots merit an explanation. The blue points correspond to trajectories crossing Σ\Sigma with F1(θ)=θ˙1<0F_1(\theta)=\dot{\theta}_1<0 and the yellow/orange points to crossings with F1(θ)>0F_1(\theta)>0. When an

Finite-time Lyapunov exponents, Poincaré intersection, and orbit in the identification cube

Figure 4. Numerical evidence of chaotic dynamics along the main scan of the A2A_2 system at β=1.25\beta= 1.25. The positive largest Lyapunov exponent and the structure of the section distinguish this regime from the smooth torus illustrated in Figure 3.

Finite-time Lyapunov exponents

(a) Finite-time Lyapunov exponents.

Poincaré intersection

(b) Poincaré intersection.

Orbit in the identification cube

(c) Orbit in the identification cube.

Figure 3. Dynamics of the main scan at β=0.1\beta= 0.1. The numerical diagnostics are consistent with an attracting invariant two-torus. In the middle panel, blue marks crossings with θ˙1<0\dot{\theta}_1 < 0, while yellow/orange marks crossings with θ˙1>0\dot{\theta}_1 > 0. The flow need not be everywhere transverse to the chosen section.

invariant two-torus intersects Σ\Sigma along a closed curve, the vector field need not point to the same side of Σ\Sigma along the entire curve. At transitions between these two sets of intersection points, continuity forces F1=0F_1 = 0, so the vector field is tangent to the chosen section. In particular, the complete geometric intersection curve need not be a global transverse Poincaré section for the flow. This geometric effect explains why plotting only one crossing direction can reveal just an arc of the closed intersection curve, even when the phase-space portrait clearly suggests a smooth torus.

At β=1.25\beta= 1.25, the same matrices give a substantially different picture. Numerical integrations from different initial conditions yield similar Lyapunov spectra, with one positive exponent, one exponent close to zero, and one negative exponent (approximately 0.11, 0, and −0.31-0.31). Along with the nontrivial structure of the Poincaré section, this provides evidence for chaotic dynamics, although it does not constitute a proof of the existence of a chaotic attractor.

A second parameter scan: a fold of periodic orbits and complex Floquet multipliers

A second set of experiments uses the same matrices A=A2A = A_2 and BB from (8), but is initialized near a nonsynchronized attracting periodic orbit at β=0.55\beta= 0.55. A convenient section point on this periodic orbit is

θ(0)≈(0, 3.4617585711, 3.5395509760),T≈13.79255247.\theta(0) \approx(0,\,3.4617585711,\,3.5395509760), \qquad T \approx13.79255247.

Its two nontrivial Floquet multipliers are approximately

μ1,2=−0.290456±0.326888 i,\mu_{1,2} = -0.290456 \pm0.326888\,\mathrm{i},

and hence have modulus smaller than one. Thus the orbit is attracting, with a contracting two-dimensional normal bundle on which the return dynamics has a rotational component. This provides a qualitatively different example from the synchronized orbit, whose nontrivial multipliers are real.

Numerical shooting and continuation suggest that this periodic orbit belongs to a family created in a saddle-node bifurcation of periodic orbits at

βfold≈0.40916194.\beta_{\mathrm{fold}} \approx0.40916194.

At the candidate fold, one nontrivial Floquet multiplier is close to +1+1, while the other is approximately 0.20636. Immediately above the fold, the calculations find both a transversely attracting periodic orbit and a saddle periodic orbit. In particular, the nonsynchronized family need not extend as a regular branch all the way to β=0\beta= 0. Numerical continuation of this periodic-orbit family also indicates a crossing of a complex-conjugate pair of multipliers through the unit circle near βNS≈0.58555751\beta_{\mathrm{NS}} \approx0.58555751, consistent with

The nonsynchronized attracting periodic orbit at $\beta = 0.55$

(a) The nonsynchronized attracting periodic orbit at β=0.55\beta= 0.55.

The same orbit with selected trajectories illustrating its basin of attraction

(b) The same orbit with selected trajectories illustrating its basin of attraction.

Figure 5. An attracting nonsynchronized periodic orbit with complex-conjugate transverse Floquet multipliers for the A2A_2 system. Several plotted trajectories do not approach this orbit on the displayed time scale, suggesting that its basin of attraction is not the whole phase space; the plots alone do not determine the basin boundary.

::::

a Neimark–Sacker bifurcation. Establishing the bifurcation type and the local organization of invariant tori requires additional work.

The second bifurcation scan starts at the β=0.55\beta= 0.55 periodic-orbit seed and varies β\beta in both directions. As in the main scan, the points shown are obtained from forward integration, so their appearance depends on which invariant set is reached from the chosen initial conditions. The superimposed information from shooting continuation, when displayed, must be interpreted separately from the attracting-set samples.

The second scan illustrates a further subtlety of the dynamics: nearby parameter values may support different recurrent sets. For example, continuation indicates that the nonsynchronized periodic orbit is still attracting at β=0.58\beta= 0.58, while a separate forward-integration experiment produces a torus-like portrait at β=0.59\beta= 0.59. These observations are consistent with a change in stability near the candidate Neimark–Sacker value, but do not by themselves establish the bifurcation mechanism or coexistence of attractors at a fixed parameter value.

At β=0.725\beta= 0.725, the second scan exhibits a markedly more complicated recurrent regime. The finite-time Lyapunov computation for the trajectory illustrated in Figure 8 indicates a positive largest exponent. Together with the structure of the Poincaré section and the phase-space portrait, this provides numerical evidence for chaotic dynamics. This example is especially interesting when viewed alongside the attracting periodic orbit at β=0.55\beta= 0.55 and the torus-like dynamics at β=0.59\beta= 0.59. The computations suggest that a single family of attention models can exhibit several distinct kinds of recurrent behavior, although they do not constitute a rigorous proof of a chaotic invariant set.

Taken together, these computations illustrate that even the three-particle projected-attention model can exhibit a variety of recurrent phenomena. The apparent fold of nonsynchronized periodic orbits, the emergence of complex Floquet multipliers, and the possible interactions among periodic orbits, invariant tori, and chaotic invariant sets provide concrete targets for more systematic numerical continuation and, ultimately, computer-assisted validation.

Higher-dimensional transformers as coupled systems {#sec:4}

The three-particle system studied in § 2 will now serve as a component for assembling larger systems with interesting dynamics. Consider M≥2M \ge2 groups of three particles, with index sets G1,…,GMG_1,\ldots,G_M

Numerical evidence of chaotic dynamics in the second parameter scan

Figure 8. (a) Finite-time Lyapunov exponents. (b) Poincaré intersection. (c) Orbit in the identification cube. Numerical evidence of chaotic dynamics in the second parameter scan at β=0.725\beta= 0.725. The finite-time Lyapunov spectrum (left), Poincaré section (middle), and phase-space portrait (right) provide complementary diagnostics of the chaotic regime.

Bifurcation diagram from the second, complex-orbit-seeded parameter scan

Figure 6. Bifurcation diagram from the second, complex-orbit-seeded parameter scan, using the same matrices as in Figure 2. Forward-orbit Poincaré points reveal the asymptotic dynamics selected near the nonsynchronized periodic family. Any continued periodic-orbit branch shown in the plot is distinct from the point cloud generated by time integration.

Finite-time Lyapunov exponents

(a) Finite-time Lyapunov exponents.

Poincaré intersection

(b) Poincaré intersection.

Orbit in the identification cube

(c) Orbit in the identification cube.

Figure 7. A torus-like recurrent set observed in the second scan at β=0.59\beta= 0.59. The numerical portrait does not by itself establish the existence of an invariant torus or its bifurcation mechanism.

partitioning {1,…,3M}\{1,\ldots,3M\}. Suppose initially that all particles lie on the same ellipse EWE_W and that, within each group, they evolve according to the autonomous three-particle system derived in § 2. Writing X(m)=(xi)i∈GmX^{(m)}=(x_i)_{i\in G_m}, the uncoupled equations are

X˙(m)=F3(X(m)),m=1,…,M.(9)\dot{X}^{(m)}=F_3(X^{(m)}),\qquad m=1,\ldots,M. \tag*{(9)}

The phase space is EW3M≅T3M\mathcal{E}_W^{3M}\cong\mathbb{T}^{3M}, and the flow of (9) is the direct product of the constituent three-particle flows. In particular, recurrent invariant sets of the individual models become invariant sets of the larger system by taking products.

We now introduce a coupling parameter ε≥0\varepsilon\geq0 and a family of projected attention vector fields of the form

X˙=Fε(X),F0(X)=(F3(X(1)),…,F3(X(M))),(10)\dot{X}=F^\varepsilon(X),\qquad F^0(X)=\left(F_3(X^{(1)}),\ldots,F_3(X^{(M)})\right), \tag*{(10)}

with Fε→F0F^\varepsilon\to F^0 in CrC^r for each fixed MM and finite rr, as ε→0\varepsilon\to0. In the next subsections we discuss several ways to assemble a self-attention network of this form, using different techniques to retain subsystem information.

Note that we must build subsystem information into the network if we want to treat self-attention transformers as coupled oscillators. This is because ordinary, unmasked attention, as in Equation (2), is equivariant under permutations of the 3M3M particles. A nontrivial direct product of independent three-particle systems, by contrast, distinguishes the prescribed subgroups, and permutations that mix particles from different groups actually change the dynamics. We will see that masks and fixed group labels provide the structural information we need.

There are numerous precedents for structured interactions in machine learning. Graph attention networks restrict interactions by specifying a prescribed graph [17]; heterogeneous graph transformers permit node- and edge-type-dependent interactions [18]; and head-specific masks, as discussed below, are studied in [27]. We now describe three realizations, all of which recover Equation (9) in the uncoupled limit. Two use masks, and one uses group labels. For positive coupling, the first two realizations define exactly the same coupled vector field, while the third uses a different normalization architecture.

Multiplicative attention masks. We use a common convention for attention masks throughout this section. Given a collection of scores sij(X)s_{ij}(X), a nonnegative mask m=(mij)m=(m_{ij}) defines the modified attention coefficients

αij(X;m)=mijesij(X)∑k=1Nmikesik(X).\alpha_{ij}(X;m)=\frac{m_{ij}e^{s_{ij}(X)}}{\sum_{k=1}^{N}m_{ik}e^{s_{ik}(X)}}.

We assume that each row of mm contains at least one positive entry, so that the denominator is nonzero. A hard mask has entries in {0,1}\{0,1\}, while more general nonnegative masks allow selected interactions to be weakened or strengthened.

Consider N=3MN=3M particles in R2\mathbb{R}^{2}, partitioned into M≥2M \ge2 disjoint groups, each containing three particles. Write

{1,…,3M}=G1⊔⋯⊔GM.\{1,\ldots,3M\}=G_1\sqcup\cdots\sqcup G_M.

We introduce the complementary hard masks

bijint={1,i,j∈Gm for some m,0,otherwise,bijext=1−bijint.b_{ij}^{\mathrm{int}} = \begin{cases} 1, & i,j \in G_m \text{ for some } m,\\ 0, & \text{otherwise}, \end{cases} \qquad b_{ij}^{\mathrm{ext}}=1-b_{ij}^{\mathrm{int}}.

Thus bintb^{\mathrm{int}} permits only interactions between particles in the same group, while bextb^{\mathrm{ext}} permits only interactions between particles belonging to distinct groups.

We consider two ways of using these masks to construct weakly coupled attention systems. In the first, the internal and external masks are combined before applying a single softmax normalization over all particles. In the second, the two masks are applied to separate attention heads, each with its own normalization, and the resulting outputs are combined afterward.

These constructions agree in the uncoupled limit but differ for positive coupling. In particular, in the single-head construction the relative contribution of external interactions depends on the number of particles outside each group. In the two-head construction, the external head produces a separately normalized weighted average, whose magnitude remains bounded independently of the number of groups. This distinction becomes important when considering systems with many particles.

Block-masked single-head attention

We first consider a single-head attention system in which the constituent subsystems are identical. To this end, fix common matrices QQ, KK, VV and an inverse temperature β≥0\beta\ge0, and write

sij(X)=β⟨Qxi,Kxj⟩.s_{ij}(X)=\beta\langle Qx_i,Kx_j\rangle.

Using the complementary hard masks bintb^{\mathrm{int}} and bextb^{\mathrm{ext}} defined above, introduce the parameter-dependent mask

mij(ε)=bijint+εbijext,0≤ε≤1.m_{ij}(\varepsilon)=b_{ij}^{\mathrm{int}}+\varepsilon b_{ij}^{\mathrm{ext}}, \qquad0\le\varepsilon\le1.

Thus interactions within each group have weight one, while interactions between distinct groups have weight ε\varepsilon. The corresponding masked attention coefficients are

αijε(X)=mij(ε)esij(X)∑k=13Mmik(ε)esik(X).(11)\alpha_{ij}^{\varepsilon}(X)= \frac{m_{ij}(\varepsilon)e^{s_{ij}(X)}} {\sum_{k=1}^{3M}m_{ik}(\varepsilon)e^{s_{ik}(X)}}. \tag*{(11)}

and the resulting projected equations are

x˙i=ΠxiW(∑j=13Mαijε(X)Vxj).(12)\dot{x}_i=\Pi_{x_i}^{W}\left(\sum_{j=1}^{3M}\alpha_{ij}^{\varepsilon}(X)Vx_j\right). \tag*{(12)}

Observe that this construction uses a single softmax normalization over all particles, rather than separate normalizations for within-group and between-group interactions.

At ε=0\varepsilon=0, the mask is precisely bintb^{\mathrm{int}}, so all interactions between distinct groups vanish and each attention row is normalized over its own group. Consequently, (12) reduces exactly to the uncoupled product system (9). At ε=1\varepsilon=1, all entries of the mask are equal to one, and the model becomes ordinary unmasked single-head attention involving all 3M3M particles. For 0<ε<10 < \varepsilon< 1, cross-group interactions are suppressed but remain nonzero.

The dependence on ε\varepsilon is smooth, including at ε=0\varepsilon= 0. Indeed, for i∈Gmi \in G_m, define

Ziin=∑j∈Gmesij,Ziout=∑j∉Gmesij.Z_i^{\mathrm{in}} = \sum_{j\in G_m} e^{s_{ij}}, \qquad Z_i^{\mathrm{out}} = \sum_{j\notin G_m} e^{s_{ij}}.

and

Yiin=∑j∈GmesijVxj,Yiout=∑j∉GmesijVxj.Y_i^{\mathrm{in}} = \sum_{j\in G_m} e^{s_{ij}}Vx_j, \qquad Y_i^{\mathrm{out}} = \sum_{j\notin G_m} e^{s_{ij}}Vx_j.

The iith component of the vector field can then be written as

Fiε(X)=ΠxiWYiin+εYioutZiin+εZiout=Fi0(X)+εΠxiW(YioutZiin−ZioutYiin(Ziin)2)+O(ε2).(13)\begin{aligned} F_i^\varepsilon(X) = \Pi_{x_i}^{W}\frac{Y_i^{\mathrm{in}}+\varepsilon Y_i^{\mathrm{out}}}{Z_i^{\mathrm{in}}+\varepsilon Z_i^{\mathrm{out}}} \\ &= F_i^0(X) + \varepsilon\Pi_{x_i}^{W}\left(\frac{Y_i^{\mathrm{out}}}{Z_i^{\mathrm{in}}} - \frac{Z_i^{\mathrm{out}}Y_i^{\mathrm{in}}}{(Z_i^{\mathrm{in}})^2}\right) + O(\varepsilon^2). \tag*{(13)} \end{aligned}

Since ZiinZ_i^{\mathrm{in}} is strictly positive, and the configuration space is compact, the remainder is uniform, together with any fixed number of derivatives in XX. Thus, for each fixed number of groups and each finite rr,

∥Fε−F0∥Cr=O(ε).\left\|F^\varepsilon-F^0\right\|_{C^r}=O(\varepsilon).

In particular, the block-masked system is a smooth perturbation of the uncoupled product system, so that standard persistence results for hyperbolic invariant sets and normally hyperbolic invariant manifolds are applicable whenever their respective hypotheses are satisfied.

For systems with many groups, the effective strength of cross-group attention depends not only on ε\varepsilon but also on the number of particles outside each group. In particular, if the attention scores are uniformly bounded independently of MM, then Ziout/ZiinZ_i^{\mathrm{out}}/Z_i^{\mathrm{in}} is of order M−1M-1, since the external sum has 3(M−1)3(M-1) terms and the internal sum has three. Thus the effective relative contribution of cross-group attention is controlled by εZiout/Ziin\varepsilon Z_i^{\mathrm{out}}/Z_i^{\mathrm{in}}. Consequently, a fixed small value of ε\varepsilon need not represent equally weak coupling as the number of groups increases. A natural choice is to take ε=O(M−1)\varepsilon=O(M^{-1}), with a sufficiently small proportionality constant, or to restrict cross-group attention to a sparse network. This scaling consideration also applies to the equivalent group-label construction below, but not to the separately normalized two-head construction of Section 4.3.

The next subsection gives an equivalent implementation using fixed group labels. Section 4.3 then introduces the alternative two-head construction.

Group labels and attention biases

The preceding mask can also be implemented using ordinary softmax attention applied to augmented particle representations. That is, one assigns to each group GmG_m, 1≤m≤M1\leq m\leq M a fixed label em∈RMe_m\in\mathbb{R}^M, the mmth coordinate vector. When we append a label to each particle, we obtain x^i=(xi,em)\widehat{x}_i=(x_i,e_m) for i∈Gmi\in G_m. Define augmented query and key maps with bilinear compatibility score defined by

s^ij=β⟨Qxi,Kxj⟩+γ⟨eg(i),eg(j)⟩=sij+γ1{g(i)=g(j)}.(14)\widehat{s}_{ij}=\beta\langle Qx_i,Kx_j\rangle+\gamma\langle e_{g(i)},e_{g(j)}\rangle=s_{ij}+\gamma\mathbf{1}_{\{g(i)=g(j)\}}. \tag*{(14)}

where g(i)g(i) denotes the group containing particle ii. Such a score is obtained by a block-diagonal choice of Q^TK^\widehat{Q}^{\mathsf T}\widehat{K} on the augmented space. The values remain VxjVx_j, and the labels are fixed rather than evolving coordinates. Factoring eγe^\gamma from each softmax denominator shows that the resulting attention coefficients coincide exactly with (11), with

ε=e−γ.(15)\varepsilon=e^{-\gamma}. \tag*{(15)}

Hence, arbitrarily weak positive coupling is implemented using finite query and key matrices, without an attention mask. Exact decoupling corresponds to the limit γ→+∞\gamma\to+\infty; it cannot be attained by a finite value of this particular bias parameter.

This formulation makes the group identity part of the token representation and is closely related to type-dependent attention and additive structural biases: score modifications supported by practical attention software [28]. It is not a construction using only unaugmented positions on the ellipse: the additional fixed labels distinguish the subsystems.

Two-head masked attention as a coupled system

The second normalization architecture, perhaps the most useful for the purposes of the present work, uses two masked attention heads. The notion of multi-head attention originates in [1], and we recall the definition for two heads before specializing to a masked partition of particles into interacting groups.

Two-head self-attention. Let X=(x1,…,xN)X=(x_1,\ldots,x_N) denote a configuration of NN particles in a manifold M⊂Rd\mathcal{M}\subset\mathbb{R}^d. In a two-head self-attention mechanism, each head h∈{1,2}h\in\{1,2\} has its own query, key, and value matrices QhQ_h, KhK_h, and VhV_h, together with an inverse temperature parameter βh≥0\beta_h\ge0.

The attention weights associated with head hh are

ρij(h)(X)=exp⁡(βh⟨Qhxi,Khxj⟩)∑k=1Nexp⁡(βh⟨Qhxi,Khxk⟩),1≤i,j≤N.\rho_{ij}^{(h)}(X)=\frac{\exp\left(\beta_h\langle Q_hx_i,K_hx_j\rangle\right)}{\sum_{k=1}^{N}\exp\left(\beta_h\langle Q_hx_i,K_hx_k\rangle\right)},\qquad1\le i,j\le N.

Each head produces an attention-weighted average

zi(h)(X)=∑j=1Nρij(h)(X)Vhxj.z_i^{(h)}(X)=\sum_{j=1}^{N}\rho_{ij}^{(h)}(X)V_hx_j.

The two head outputs are combined through output matrices O1O_1 and O2O_2, giving

Ai(X)=O1zi(1)(X)+O2zi(2)(X).A_i(X)=O_1z_i^{(1)}(X)+O_2z_i^{(2)}(X).

This is equivalent to concatenating the two head outputs and applying a single linear output map. The corresponding continuous-time projected attention system is

x˙i=ΠxiWAi(X),1≤i≤N.\dot{x}_i=\Pi_{x_i}^{W}A_i(X),\qquad1\le i\le N.

where ΠxiW\Pi_{x_i}^{W} denotes the tangent projection associated with the chosen particle manifold.

Masked two-head attention. We now introduce a mask restricting which particles contribute to each attention head. Using the multiplicative-mask convention introduced at the beginning of this section, we say that for each h∈{1,2}h\in\{1,2\}, m(h)m^{(h)} is a nonnegative mask matrix, with at least one positive entry in every row. The masked attention weights are defined by

ρij(h)(X;m(h))=mij(h)exp⁡(βh⟨Qhxi,Khxj⟩)∑k=1Nmik(h)exp⁡(βh⟨Qhxi,Khxk⟩).\rho_{ij}^{(h)}(X;m^{(h)})=\frac{m_{ij}^{(h)}\exp\left(\beta_h\langle Q_hx_i,K_hx_j\rangle\right)}{\sum_{k=1}^{N}m_{ik}^{(h)}\exp\left(\beta_h\langle Q_hx_i,K_hx_k\rangle\right)}.

In particular, a hard mask has entries in {0,1}\{0,1\}, with an entry mij(h)=0m_{ij}^{(h)}=0 excluding particle jj completely from the attention of particle ii in head hh.

Equivalently, if Sh(i)S_h(i) denotes the set of particles visible to particle ii in head hh, then for a hard mask

ρij(h)(X;m(h))={eβh⟨Qhxi,Khxj⟩∑k∈Sh(i)eβh⟨Qhxi,Khxk⟩,j∈Sh(i),0,j∉Sh(i).\rho_{ij}^{(h)}(X;m^{(h)})= \begin{cases} \dfrac{e^{\beta_h\langle Q_hx_i,K_hx_j\rangle}}{\sum_{k\in S_h(i)}e^{\beta_h\langle Q_hx_i,K_hx_k\rangle}}, & j\in S_h(i),\\ 0, & j\notin S_h(i). \end{cases}

Note that the attention weights are normalized separately within each head, so that

∑j=1Nρij(h)(X;m(h))=1,h∈{1,2}.\sum_{j=1}^{N} \rho_{ij}^{(h)}(X;m^{(h)})=1,\qquad h\in\{1,2\}.

Thus each head computes a weighted average over its permitted particles, and the two averages are combined only afterward.

Complementary group masks. Suppose that the particle indices are partitioned into M≥2M\ge2 nonempty, disjoint groups,

{1,…,N}=G1⊔⋯⊔GM.\{1,\ldots,N\}=G_1\sqcup\cdots\sqcup G_M.

In our numerical experiments, each group contains three particles, so that N=3MN=3M.

We introduce two attention heads, referred to as the internal and external heads. The internal head permits interactions only between particles belonging to the same group, while the external head permits interactions only between particles belonging to different groups.

More precisely, we use the complementary hard masks bintb^{\mathrm{int}} and bextb^{\mathrm{ext}} defined at the beginning of this section, setting

m(1)=bint,m(2)=bext.m^{(1)}=b^{\mathrm{int}},\qquad m^{(2)}=b^{\mathrm{ext}}.

Thus every pair of particles is visible to exactly one of the two heads. In particular, self-interactions belong to the internal head.

Let i∈Gmi\in G_m. Applying the internal mask to the first attention head gives

ρijint(X)=eβint⟨Qintxi,Kintxj⟩∑k∈Gmeβint⟨Qintxi,Kintxk⟩,j∈Gm,\rho_{ij}^{\mathrm{int}}(X)=\frac{e^{\beta_{\mathrm{int}}\langle Q_{\mathrm{int}}x_i,K_{\mathrm{int}}x_j\rangle}}{\sum_{k\in G_m}e^{\beta_{\mathrm{int}}\langle Q_{\mathrm{int}}x_i,K_{\mathrm{int}}x_k\rangle}},\qquad j\in G_m,

and ρijint=0\rho_{ij}^{\mathrm{int}}=0 for j∉Gmj\notin G_m.

Similarly, the external mask gives

ρijext(X)=eβext⟨Qextxi,Kextxj⟩∑k∉Gmeβext⟨Qextxi,Kextxk⟩,j∉Gm,\rho_{ij}^{\mathrm{ext}}(X)=\frac{e^{\beta_{\mathrm{ext}}\langle Q_{\mathrm{ext}}x_i,K_{\mathrm{ext}}x_j\rangle}}{\sum_{k\notin G_m}e^{\beta_{\mathrm{ext}}\langle Q_{\mathrm{ext}}x_i,K_{\mathrm{ext}}x_k\rangle}},\qquad j\notin G_m,

and ρijext=0\rho_{ij}^{\mathrm{ext}}=0 for j∈Gmj\in G_m.

The outputs of the two heads are therefore

ziint(X)=∑j∈Gmρijint(X)Vintxj,ziext(X)=∑j∉Gmρijext(X)Vextxj.z_i^{\mathrm{int}}(X)=\sum_{j\in G_m}\rho_{ij}^{\mathrm{int}}(X)V_{\mathrm{int}}x_j,\qquad z_i^{\mathrm{ext}}(X)=\sum_{j\notin G_m}\rho_{ij}^{\mathrm{ext}}(X)V_{\mathrm{ext}}x_j.

We now choose the output matrices to be

Oint=Id,Oext=εId,O_{\mathrm{int}}=I_d,\qquad O_{\mathrm{ext}}=\varepsilon I_d,

where ε≥0\varepsilon\ge0 controls the strength of the inter-group coupling. Substituting these choices into the two-head projected attention system gives

x˙i=ΠxiW(∑j∈Gmρijint(X)Vintxj+ε∑j∉Gmρijext(X)Vextxj),i∈Gm.(16)\dot{x}_i=\Pi_{x_i}^{W}\left(\sum_{j\in G_m}\rho_{ij}^{\mathrm{int}}(X)V_{\mathrm{int}}x_j+\varepsilon\sum_{j\notin G_m}\rho_{ij}^{\mathrm{ext}}(X)V_{\mathrm{ext}}x_j\right),\qquad i\in G_m. \tag*{(16)}

This is precisely the weakly coupled particle system considered below.

Writing X(m)=(xi)i∈GmX^{(m)}=(x_i)_{i\in G_m}, and using the linearity of the tangent projection in its vector argument, we may express the system as

X˙(m)=F(m)(X(m))+εHm(X),1≤m≤M,\dot{X}^{(m)}=F^{(m)}(X^{(m)})+\varepsilon H_m(X),\qquad1\le m\le M,

where F(m)F^{(m)} is the internal attention vector field on the mmth group and HmH_m collects the external interactions.

In particular, when ε=0\varepsilon=0, the external head makes no contribution and the system reduces exactly to a product of uncoupled subsystems,

X˙(m)=F(m)(X(m)),1≤m≤M.\dot{X}^{(m)}=F^{(m)}(X^{(m)}),\qquad1\le m\le M.

Since the attention weights of the two heads are normalized independently, neither F(m)F^{(m)} nor HmH_m depends on ε\varepsilon. Consequently, the full vector field depends affinely on the coupling parameter, and

∥Fε−F0∥Cr=O(ε)\left\|F^\varepsilon-F^0\right\|_{C^r}=O(\varepsilon)

for each fixed number of groups and each finite rr.

For the constructions considered here, all groups have identical internal attention parameters, and the external attention parameters are also independent of the interacting groups. Hence the uncoupled subsystems are identical, although their states and trajectories need not be. These uniformity assumptions are convenient for studying the effect of coupling but are not intrinsic to the masked attention construction.

Unlike the block-masked single-head construction of § 4.1, the present system uses separate softmax normalizations for the internal and external heads. In particular, the coupling parameter scales the output of the external head without altering the internal attention weights. Thus the two constructions have the same uncoupled limit, but define different coupled systems for ε>0\varepsilon>0.

Remark 5 (Heterogeneous coupled subsystems). The assumption that all groups have identical internal attention parameters, and that all inter-group interactions are governed by the same coupling parameters, is made for simplicity. More generally, one could allow the matrices Qint(m)Q_{\mathrm{int}}^{(m)}, Kint(m)K_{\mathrm{int}}^{(m)}, and Vint(m)V_{\mathrm{int}}^{(m)}, as well as the inverse temperature βint(m)\beta_{\mathrm{int}}^{(m)}, to depend on the group index mm. Similarly, the external attention parameters could depend pairwise on the interacting groups. This generalization permits the coupling of subsystems exhibiting qualitatively different dynamics, including periodic, quasiperiodic, and chaotic behavior.

Perturbative persistence

All three implementations give smooth perturbations of a direct-product flow for each fixed number of groups. Consequently, the classical theory of normally hyperbolic invariant manifolds provides a natural framework for understanding the persistence of certain dynamical structures under weak coupling. This theory applies not only to hyperbolic periodic orbits, but also to normally hyperbolic invariant tori and, more generally, to compact normally hyperbolic invariant manifolds of arbitrary dimension. Such manifolds may be attracting, repelling, or of saddle type. We record the following consequence.

Proposition 6. Suppose that the mmth three-particle subsystem admits a compact, smooth, normally hyperbolic invariant manifold Nm\mathcal{N}_m, for 1≤m≤M1\le m\le M. Assume moreover that the normal contraction and expansion rates of the individual manifolds dominate the tangential growth rates of all factors, so that the product

N0=N1×⋯×NM\mathcal{N}_0=\mathcal{N}_1\times\cdots\times\mathcal{N}_M

is a normally hyperbolic invariant manifold for the uncoupled system (9). Then, under any of the above coupling implementations, for all sufficiently small ε≥0\varepsilon\ge0, there exists a nearby normally hyperbolic invariant manifold Nε\mathcal{N}_\varepsilon, diffeomorphic to N0\mathcal{N}_0. The dimensions of its stable and unstable normal bundles are preserved under the perturbation. In particular, if N0\mathcal{N}_0 is normally attracting, then so is Nε\mathcal{N}_\varepsilon.

Proof. At ε=0\varepsilon= 0, the derivative of the product flow is block diagonal, and the invariant splitting along N0\mathcal{N}_0 is obtained by taking the direct sums of the corresponding stable, tangent, and unstable bundles of the individual factors. The assumed domination of normal rates over tangential rates ensures that this splitting is normally hyperbolic. Since the coupling constructions converge to the product vector field in C1C^1 as ε→0\varepsilon\to0, the conclusion follows from the persistence theorem for normally hyperbolic invariant manifolds [29, 30].

An important special case occurs when each Nm\mathcal{N}_m is a hyperbolic periodic orbit. In this case the tangent dynamics have zero exponential growth rates, while all transverse directions are exponentially contracting or expanding. The product is therefore a normally hyperbolic invariant MM-torus, and the proposition guarantees its persistence under weak coupling. Similar conclusions hold for products of normally hyperbolic invariant tori, provided the required spectral gaps are satisfied. The dynamics on the perturbed manifold need not be conjugate to the original dynamics. For example, weak coupling between periodic oscillators may produce phase locking rather than quasiperiodic motion. The proposition does not specify a numerical threshold for ε\varepsilon; in particular, it does not by itself justify persistence at ε=0.1\varepsilon= 0.1, as explored in § 5.

The theory of persistence extends beyond smooth invariant manifolds. Classical structural stability results for compact, locally maximal uniformly hyperbolic invariant sets imply that such sets persist under sufficiently small perturbations, with their dynamics preserved up to topological conjugacy (or orbit equivalence for flows) [31, 32]. Note that these results do not establish the persistence of the chaotic dynamics observed in this paper. Numerical evidence of positive Lyapunov exponents does not establish uniform hyperbolicity, and a product of hyperbolic invariant sets for independent flows generally has additional neutral directions associated with the independent time translations of the factors. Such products need not themselves be uniformly hyperbolic.

We view these observations as motivation for further work rather than as limitations of the dynamical systems approach. The persistence theory suggests that a wide variety of recurrent invariant sets may survive the introduction of weak attention coupling, but determining which structures actually arise in transformer models remains an open problem. Of particular interest is the possibility that metastable clustering may be organized by the stable manifolds of saddle-type invariant sets more complicated than equilibria, including periodic orbits, invariant tori, and chaotic invariant sets. Their slow stable and unstable directions, together with the geometry of their invariant bundles, may provide a framework for understanding long transient behavior even in the absence of gradient structure.

The examples developed here suggest that the dynamical possibilities of transformer particle systems are considerably richer than those described by convergence to consensus alone. A systematic investigation of hyperbolicity, normal hyperbolicity, bifurcations, and the persistence of invariant structures under coupling is therefore a promising direction for future research.

Structured attention in practical architectures and software

The structured interactions considered above are motivated in part by mechanisms already used in practical transformer architectures. For example, Mistral AI’s Mistral 7B language model uses sliding-window attention to restrict the preceding tokens attended to by each layer [33, 34], while Google’s Gemma 2 alternates local and global attention layers [35]. The Swin Transformer uses local and shifted windows in computer vision, including object detection and image segmentation [36]. These windowed architectures illustrate the use of restricted interactions, although their masks do not directly implement the weakly coupled blocks studied here.

Tencent’s CCFormer provides a particularly relevant industrial example: its recommendation architecture combines different classes of information through feature-field-separated cross-attention with relation-specific attention pathways and output fusion. Its authors report deployment in production video-recommendation and advertising-ranking systems [37]. The architectural principle of separately normalized interactions is close to that of our two-head construction, though the detailed models are different. For comparison, Alibaba’s deployed HetMatch system uses type-dependent interactions for sponsored-search keyword matching, but it is a heterogeneous graph neural network rather than a Transformer attention model [38].

The use of group labels and attention-score biases also has precedents in practical architectures. BERT employs segment embeddings [39], and relative-position and linear attention biases are used in other transformer models [40, 41]. These mechanisms are not identical to the group-label implementation above, but show that group-identifying embeddings and modified attention scores are familiar architectural ingredients. On the software side, PyTorch’s FlexAttention provides programmable attention-score modifications and block masks, including head-dependent masks [28]. NVIDIA’s cuDNN attention library also supports structured masking and additive score biases [42]. Together these examples illustrate that the structural ingredients used in our coupling constructions are compatible with established attention architectures and widely used software, although none should be interpreted as an implementation of the particular dynamical systems studied here.

Dynamics of some many particle systems

Coupling between two three-particle systems

Next, we ask whether the chaotic dynamics found in the three-particle model can survive when two such systems are coupled. This is the simplest nontrivial test of the constructions introduced in Section 4. Consider six particles, and partition them into two groups G1={1,2,3}G_1 = \{1,2,3\} and G2={4,5,6}G_2 = \{4,5,6\} with all particles constrained to the ellipse determined by W=diag⁡(2,1)W = \operatorname{diag}(2,1). The phase space is EW6≅T6\mathcal{E}_W^6 \cong\mathbb{T}^6.

In each subgroup we choose effective matrices

A=(−0.05−2.302.30−0.05),B=(−1.200.40−0.80−2.40),β=1.25.A = \begin{pmatrix} -0.05 & -2.30 \\ 2.30 & -0.05 \end{pmatrix}, \qquad B = \begin{pmatrix} -1.20 & 0.40 \\ -0.80 & -2.40 \end{pmatrix}, \qquad\beta= 1.25.

For these parameters, the uncoupled three-particle system exhibits numerical evidence of a chaotic attractor, with Lyapunov spectrum approximately (0.11,0,−0.31)(0.11, 0, -0.31). At ε=0\varepsilon= 0 the six-dimensional system is the direct product of two copies of this flow. In particular, its Lyapunov spectrum contains two positive exponents and, up to numerical error, two zero exponents. Our initial configurations for the coupled experiments are obtained by taking distinct points along the previously computed chaotic three-particle trajectory in each group. We compare the dynamics of the coupled six-dimensional system with the three implementations (corresponding to two distinct coupled vector fields) considered in Section 4.

For block-masked attention, the cross-group entries of the softmax numerator are multiplied by ε\varepsilon, while the within-group entries retain weight one; the entire row is then normalized as in (11). In the fixed-group-label construction, the scores receive the bias γ1{g(i)=g(j)}\gamma1_{\{g(i)=g(j)\}}. The relation γ=−log⁡ε\gamma= -\log\varepsilon makes the resulting vector field exactly identical to the block-masked field for every ε>0\varepsilon> 0. Hence these two constructions give the same numerical experiment, although they represent different architectural implementations.

Finally, the two-head construction of Equation (16) combines a separately normalized internal head with ε\varepsilon times a separately normalized cross-group head. For this first comparison, the two heads use the same matrices AA, BB and inverse temperature β\beta; thus the only new parameter is the coupling strength ε\varepsilon.

We consider ε=10−3\varepsilon= 10^{-3} and ε=10−1\varepsilon= 10^{-1}. The angular equations and their analytic variational equations are integrated using a fourth-order Runge–Kutta method with time step h=0.02h = 0.02. We discard an initial interval of length 1500 and then estimate all six Lyapunov exponents over a further interval of length 12,000, using QR orthogonalization at unit time intervals. As a numerical consistency check, the sum of the estimated exponents agrees with the time average of the divergence to approximately 10−810^{-8} in the long integrations. Figure 9 shows the convergence of the finite-time exponents for the six combinations of implementation and coupling parameter.

Finite-time Lyapunov exponents for two coupled three-particle systems

Figure 9. Finite-time Lyapunov exponents for two coupled three-particle systems on T6\mathbb{T}^{6} at β=1.25\beta= 1.25. Columns correspond to ε=0.001\varepsilon= 0.001 (left) and ε=0.1\varepsilon= 0.1 (right); rows correspond to block-masked attention (top), fixed group labels (middle), and separately normalized internal and cross-group attention heads (bottom). The top two rows coincide exactly because the group-label bias γ=−log⁡ε\gamma= -\log\varepsilon produces the same vector field as block-masked attention. For ε=0.001\varepsilon= 0.001, the block-masked system retains two positive exponents, while the separate-head run displayed here has leading exponents near zero. At ε=0.1\varepsilon= 0.1, the block-masked system has a spectrum consistent with an attracting periodic orbit, whereas the separate-head system has two positive exponents. Exponents are computed after discarding a transient of length 1500 and are accumulated over 12000 time units.

For weak coupling, ε=10−3\varepsilon= 10^{-3}, the block-masked system retains two positive Lyapunov exponents, with (λ1,λ2)≈(0.1125,0.1062)(\lambda_1,\lambda_2) \approx(0.1125, 0.1062). In contrast, the separate-head system has leading exponents approximately (0.0015,−0.0013)(0.0015,-0.0013), providing no convincing numerical evidence of chaotic dynamics in this experiment. Thus, the two coupling architectures produce qualitatively different behavior even at this small parameter value. At the larger coupling strength ε=0.1\varepsilon= 0.1, the behavior of the two models differs substantially, but in the other direction. For the block-masked system (equivalently, the group-label system), we find λ1≈0.00031\lambda_1 \approx0.00031 and λ2≈−0.02614\lambda_2 \approx-0.02614, with the remaining exponents also negative. This spectrum is consistent with convergence to an attracting periodic orbit rather than a chaotic attractor. Indeed, a subsequent numerical return calculation gives a candidate period T≈64.27594T \approx64.27594, with return error of order 10−610^{-6}. By contrast, the separate-head system has a finite-time spectrum with two positive exponents, approximately (0.1176,0.0256)(0.1176,0.0256) followed by an exponent near zero and three negative exponents. This provides numerical evidence for hyperchaotic dynamics in the six-dimensional flow. The contrast is visible in Figure 9.

These experiments suggest that the observed chaotic dynamics depend sensitively on the architecture used to couple the subsystems, and not only on the presence of weak cross-group interactions. Nevertheless, ε\varepsilon does not measure the same perturbation of the vector field in the two models: the block-masked head renormalizes internal and external weights together, whereas the cross-group head is normalized separately and then added with coefficient ε\varepsilon. Thus the comparison at equal ε\varepsilon is a comparison of two specific architectural parameterizations, not of perturbations with equal norm. Preliminary experiments at intermediate coupling values also suggest that the observed dynamics can depend on the initial condition, so possible coexistence of attracting sets deserves further study. In what follows, the positive exponents observed for the separate-head construction at ε=0.1\varepsilon= 0.1 motivate experiments with larger networks of coupled three-particle systems.

Coupling in nine-particle systems

We next consider a heterogeneous network in which a chaotic three-particle system is coupled to two three-particle systems possessing attracting periodic orbits. The resulting flow has nine angular variables, with particle groups G1={1,2,3}G_1 = \{1, 2, 3\}, G2={4,5,6}G_2 = \{4, 5, 6\}, and G3={7,8,9}G_3 = \{7, 8, 9\}. All three subsystems use the same effective matrices

A=(−0.05−2.302.30−0.05),B=(−1.200.40−0.80−2.40),A = \begin{pmatrix} -0.05 & -2.30 \\ 2.30 & -0.05 \end{pmatrix}, \qquad B = \begin{pmatrix} -1.20 & 0.40 \\ -0.80 & -2.40 \end{pmatrix},

but have distinct inverse-temperature parameters,

(β1,β2,β3)=(1.25,0.55,0.55).(\beta_1, \beta_2, \beta_3) = (1.25, 0.55, 0.55).

In isolation, the first subsystem exhibits a chaotic attracting set, whereas each of the other two possesses the attracting nonsynchronized periodic orbit discussed above. The uncoupled product therefore has one positive Lyapunov exponent, associated with the chaotic component; the remaining two subsystems are regular. This setup allows us to ask whether coupling simply preserves the original chaotic direction or creates additional expanding directions in the full network.

We compare block-masked attention with separately normalized internal and cross-group attention heads, as defined in Section 4, fixing ε=0.1\varepsilon= 0.1. The parameters AA, BB, and βg\beta_g used to evaluate each attention row are those of its receiving group. For each architecture, we calculate the Lyapunov spectrum from two distinct initial configurations. The angular equations and their analytic variational equations are integrated with fourth-order Runge–Kutta at step size h=0.02h = 0.02. After discarding a transient of length 1500, the exponents are accumulated for 9000 time units using periodic QR orthogonalization. Finite-difference checks of the analytic Jacobian give relative errors below 10−910^{-9}. The results are summarized in Table 1.

Coupling architectureInitial conditionλ1\lambda_1λ2\lambda_2#{λj>0.01}\#\{\lambda_j > 0.01\}
Block-masked10.00004−0.09094-0.090940
Block-masked2−0.00010-0.00010−0.09076-0.090760
Separate heads10.143840.093953
Separate heads20.145440.096383

Table 1. Nine-particle system consisting of one chaotic and two attracting-periodic three-particle subsystems, coupled at ε=0.1\varepsilon= 0.1. The table reports the two largest finite-time Lyapunov exponents and the number of exponents greater than 0.01, for two distinct initial configurations in each architecture. The integration uses h=0.02h = 0.02, a discarded transient of length 1500, and 9000 time units of Lyapunov accumulation.

The contrast between the two architectures is pronounced. With block-masked coupling, the largest exponent approaches zero, while the second is approximately −0.091-0.091 for both initial conditions. This is consistent with convergence to regular attracting dynamics, and provides no numerical evidence of a surviving positive exponent. By contrast, with separately normalized heads, the largest two exponents stabilize near 0.14 and 0.095. Moreover, the computation resolves three exponents exceeding 0.01 in both runs; in particular, the third exponent exceeds this threshold. Thus an uncoupled system with only one chaotic constituent produces, after coupling, a nine-dimensional flow with expanding directions. The emergence of additional positive exponents is particularly noteworthy because the two receiving subsystems have attracting periodic dynamics when isolated.

We emphasize that positive Lyapunov exponents characterize expansion in the coupled system; they do not, by themselves, identify which constituent particles are responsible for the expanding directions. Nevertheless, this experiment illustrates the central point of the coupled-system study: knowledge of the dynamics of low-dimensional building blocks provides a useful starting point, while the coupling architecture can qualitatively reorganize their collective behavior. The reported exponents are numerical estimates rather than validated claims about an attractor.

A 60-particle example

We now investigate whether the chaotic dynamics observed in the three-particle system persist in higher-dimensional systems, and how interactions between chaotic subsystems influence the number of positive Lyapunov exponents.

We consider a system of N=60N = 60 particles, organized into M=20M = 20 groups of three particles each. Within each group, the dynamics are determined by the same constant coefficient matrices and inverse temperature β=1.25\beta= 1.25 used in the three-particle chaotic example discussed above. The groups are coupled through a multi-head attention mechanism consisting of two separately normalized contributions: an internal attention head, involving particles within the same group, and an external attention head, involving particles in the other groups. The external contribution is multiplied by a coupling parameter ε\varepsilon.

When ε=0\varepsilon= 0, the system reduces to a direct product of twenty independent three-particle systems. Since each particle is constrained to an ellipse, the resulting phase space is 60-dimensional. In the coupled experiments we set ε=0.1\varepsilon= 0.1.

The equations and their variational equations were integrated numerically using a fourth-order Runge–Kutta method with step size h=0.0125h = 0.0125. An initial transient of length Ttr=2000T_{\mathrm{tr}} = 2000 was discarded, after which the largest k=40k = 40 Lyapunov exponents were approximated over an additional integration interval of length T=16000T = 16000. We repeated the experiment for two independently generated initial conditions. As a consistency check, the analytic Jacobian was compared with finite-difference approximations, giving relative errors between 6.3×10−106.3 \times10^{-10} and 7.6×10−107.6 \times10^{-10} in the coupled experiments.

Table 2 summarizes the results. In both experiments, the largest Lyapunov exponent is approximately 0.13, while the second largest is approximately 0.12. More significantly, both experiments produce 26 Lyapunov exponents exceeding 0.01. The estimates of the leading exponents remain relatively stable during the final portion of the integration, and the number of exponents above this threshold is unchanged throughout most of the computation.

SystemNNε\varepsilonkkλ1\lambda_1λ2\lambda_2n+n_+
Coupled, seed 0600.1400.1315015030.123138926
Coupled, seed 1600.1400.12976270.122125026
Uncoupled, single group3030.1118411−0.0000194-0.00001941

Table 2. Numerically computed Lyapunov exponents for the 60-particle coupled system and the isolated three-particle baseline. Here NN is the number of particles, kk is the number of computed Lyapunov exponents, and n+n_+ denotes the number of computed exponents greater than 0.01. All computations use a transient of length 2000 and a Lyapunov averaging interval of length 16000.

For comparison, we also compute the Lyapunov exponents of an isolated three-particle subsystem. This calculation gives a largest exponent of approximately 0.112, a second exponent close to zero, and one exponent exceeding 0.01. Consequently, the corresponding uncoupled product of twenty such subsystems would have twenty exponents exceeding 0.01, counting multiplicity, at the level of these numerical estimates.

The comparison is particularly interesting because the coupled system has six more numerically estimated Lyapunov exponents exceeding 0.01 than the corresponding uncoupled product. Thus, the coupling not only preserves numerical evidence of chaotic behavior but appears to introduce additional expanding directions. In particular, these experiments provide numerical evidence of high-dimensional chaotic dynamics arising through interactions between low-dimensional chaotic subsystems. This comparison does not establish a general scaling law as the number of groups increases.

We emphasize that only the largest 40 of the 60 Lyapunov exponents were computed. Since these are the largest exponents and only 26 exceed 0.01, the omitted exponents cannot exceed this threshold. Thus truncation does not affect the reported count of exponents above 0.01; the number of strictly positive exponents could be larger because some may lie between zero and 0.01. The estimates are finite-time numerical quantities. Nevertheless, the agreement between the two independent experiments provides strong numerical evidence that the coupled system supports many expanding directions. These Lyapunov exponents describe the full tangent dynamics and do not, by themselves, determine whether the trajectory lies near an invariant synchronization subspace arising from the permutation symmetry among identical groups.

Conclusions

The interpretation of transformers as interacting particle systems opens the door to studying their behavior using the geometric and analytic tools of dynamical systems theory. In particular, the gradient structures identified in certain simplified attention models provide invaluable insight into the emergence of clustering and metastability. When a gradient structure is available, the associated energy landscape constrains the possible dynamics and provides a natural framework for understanding long transients near saddle equilibria and their stable manifolds. This point of view has already led to important advances in the mathematical theory of transformers.

However, gradient structure is not a prerequisite for clustering or metastability. More generally, trajectories may approach the stable manifolds of saddle-type invariant sets, remain in their neighborhoods for extended periods, and eventually depart along weakly unstable directions. Such behavior does not require an underlying energy function or a gradient-like flow. Moreover, the invariant sets organizing these dynamics need not be equilibria. Periodic orbits, invariant tori, and more complicated saddle-type invariant sets may also play a role.

The analytic results in this paper show that, when the assumptions of Theorem 3 are violated, the self-attention system can exhibit non-trivial recurrent dynamics. The numerical experiments show that even relatively simple autonomous transformer models, with particles constrained to ellipses and constant coefficient matrices, can already exhibit rich dynamics. In particular, we observe numerical evidence of chaos in low-dimensional examples, and the persistence and proliferation of expanding directions in larger coupled systems. Our 60-particle experiments provide evidence of high-dimensional chaos, with 26 numerically computed Lyapunov exponents exceeding 0.01. These observations suggest that complicated recurrent behavior is not confined to low-dimensional examples, and it may even become increasingly prevalent as the number of interacting particles grows.

We speculate that complicated dynamics may be a feature rather than a bug. After all, a central purpose of the attention mechanism is to produce context-dependent representations of information. It is conceivable that the stretching and folding associated with chaotic dynamics aid in this task. Whether such dynamics actually play a useful role in trained transformer architectures is an intriguing question which the present work does not address.

Many fundamental mathematical questions remain open. We conjecture that metastable clustering in more general attention systems may be organized by the stable manifolds of saddle-type invariant sets, including periodic orbits, invariant tori, and possibly chaotic invariant sets. Identifying such structures and developing methods for computing their stable and unstable manifolds, slow invariant submanifolds, and associated invariant bundles for self-attention systems are natural directions for future research. Understanding how these structures depend on the attention parameters, and how they interact through bifurcations, may provide a more general geometric theory of clustering and metastability beyond the gradient setting.

Our higher-dimensional experiments also suggest the possibility of a systematic relationship between the number of particles and the complexity of the dynamics. In particular, we conjecture that suitable coupling constructions can produce families of systems for which the number of positive Lyapunov exponents grows with the number of coupled subsystems. Establishing such results, and understanding the persistence of chaotic invariant sets under coupling, would provide a natural extension of the present numerical investigations.

Finally, it is important to ask how much of this dynamical structure survives in more realistic transformer architectures. How does the inclusion of time varying effects in the query, key, and value matrices change the geometric picture? Can analogous invariant sets and their stable and unstable manifolds be identified in trained models? Can their geometry help explain the organization and evolution of token representations, and ultimately contribute to the interpretability of these systems?

We regard the present work as an initial exploration of these questions. The mathematical theory of transformers is still in its early stages, but perhaps the relationship between attention and invariant dynamics itself deserves more attention.

Acknowledgments

The author is deeply indebted to Yu Xiang of Florida Atlantic University for introducing him to the particle system interpretation of LLM transformers studied in the present work, and for hours of indispensable conversation. This paper would not exist without these discussions. Conversations with Juan Miranda and Kyle Loh are also gratefully acknowledged. The author was partially supported by the National Science Foundation grant DMS - 2307987.

Declaration of generative AI and AI-assisted technologies

Generative artificial intelligence tools, primarily ChatGPT (OpenAI), were used during every phase of the development of this work, including the generation, revision, and debugging of numerical code, assistance with mathematical calculations and technical discussions, and the drafting, editing, and organization of portions of the final manuscript. Claude was also used for independent copy-edit review.

The use of AI was interactive and author-directed, involving many short chat mode exchanges in which specific mathematical, computational, or expository tasks were posed, the resulting outputs were examined, and subsequent redirections and revisions were requested. The research was not delegated to autonomous AI agents.

In particular, substantial pieces of numerical software were developed with AI assistance. The author tested and executed the resulting programs, performed the numerical experiments, examined the computed output, produced and interpreted the figures and other reported results. AI-generated text was similarly reviewed, edited, and incorporated by the author.

The author was responsible for the scientific questions, the development and selection of the mathematical models, the design and evaluation of the numerical experiments, and the interpretation of the results. All mathematical claims, numerical findings, and conclusions presented in the final manuscript are the responsibility of the human author, who takes full responsibility for the accuracy, originality, and integrity of the published work.

References

  1. [1]Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30, 2017.arxiv.org/abs/1706.03762
  2. [2]OpenAI. GPT-4 technical report. arXiv preprint arXiv:2303.08774, 2023.arxiv.org/abs/2303.08774
  3. [3]Jack Lindsey, Wes Gurnee, Emmanuel Ameisen, Brian Chen, Adam Pearce, Nicholas L. Turner, Craig Citro, David Abrahams, Shan Carter, Basil Hosmer, Jonathan Marcus, Michael Sklar, Adly Templeton, Trenton Bricken, Callum McDougall, Hoagy Cunningham, Thomas Henighan, Adam Jermyn, Andy Jones, Andrew Persic, Zhenyi Qi, T. Ben Thompson, Sam Zimmerman, Kelley Rivoire, Thomas Conerly, Chris Olah, and Joshua Batson. On the biology of a large language model. Transformer Circuits Thread, March 2025. https://transformer-circuits.pub/2025/attribution-graphs/biology.html.
  4. [4]Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. LLaMA: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.arxiv.org/abs/2302.13971
  5. [5]Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877–1901, 2020.arxiv.org/abs/2005.14165
  6. [6]Yiping Lu, Zhuohan Li, Di He, Zhiqing Sun, Bin Dong, Tao Qin, Liwei Wang, and Tie-Yan Liu. Understanding and improving Transformer from a multi-particle dynamic system point of view. arXiv preprint arXiv:1906.02762, 2019.arxiv.org/abs/1906.02762
  7. [7]James Vuckovic, Aristide Baratin, and Remi Tachet des Combes. A mathematical theory of attention. arXiv preprint arXiv:2007.02876, 2020.arxiv.org/abs/2007.02876
  8. [8]Michael E. Sander, Pierre Ablin, Mathieu Blondel, and Gabriel Peyré. Sinkformers: Transformers with doubly stochastic attention. In Proceedings of the 25th International Conference on Artificial Intelligence and Statistics, volume 151 of Proceedings of Machine Learning Research, pages 3515–3530. PMLR, 2022.arxiv.org/abs/2110.11773
  9. [9]Borjan Geshkovski, Cyril Letrouit, Yury Polyanskiy, and Philippe Rigollet. The emergence of clusters in self-attention dynamics. In Advances in Neural Information Processing Systems, volume 36, 2023.DOI
  10. [10]Borjan Geshkovski, Cyril Letrouit, Yury Polyanskiy, and Philippe Rigollet. A mathematical perspective on transformers. Bulletin of the American Mathematical Society, 62(3):427–479, 2025.arxiv.org/abs/2312.10794
  11. [11]Yury Polyanskiy, Philippe Rigollet, and Andrew Yao. Synchronization of mean-field models on the circle. arXiv preprint arXiv:2507.22857, 2025.arxiv.org/abs/2507.22857
  12. [12]Álvaro Rodríguez Abella, João Pedro Silvestre, and Paulo Tabuada. The asymptotic behavior of attention in transformers, 2024. Revised 2025; arXiv:2412.02682.arxiv.org/abs/2412.02682
  13. [13]Martin Burger, Samira Kabri, Yury Korolev, Tim Roith, and Lukas Weigand. Analysis of mean-field models arising from self-attention dynamics in transformer architectures with layer normalization. Philosophical Transactions of the Royal Society A, 383(2298):20240233, 2025.arxiv.org/abs/2501.03096
  14. [14]Valérie Castin, Pierre Ablin, José Antonio Carrillo, and Gabriel Peyré. A unified perspective on the dynamics of deep transformers. Foundations of Computational Mathematics, 2026. Accepted for publication (in press); arXiv:2501.18322.arxiv.org/abs/2501.18322
  15. [15]Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David K. Duvenaud. Neural ordinary differential equations. In Advances in Neural Information Processing Systems, volume 31, 2018.arxiv.org/abs/1806.07366
  16. [16]Nikita Karagodin, Yury Polyansky, and Philippe Rigolet. Clustering in causal attention masking. In Advances in Neural Information Processing Systems, volume 37, 2024. arXiv:2411.04990.arxiv.org/abs/2411.04990
  17. [17]Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations, 2018.arxiv.org/abs/1710.10903
  18. [18]Ziniu Hu, Yuxiao Dong, Kuansan Wang, and Yizhou Sun. Heterogeneous graph transformer. In Proceedings of The Web Conference 2020, pages 2704–2710, 2020.arxiv.org/abs/2003.01332
  19. [19]Borjan Geshkovski, Hugo Koubbi, Yury Polyansky, and Philippe Rigollet. Dynamic metastability in the self-attention model, 2024. arXiv:2410.06833.arxiv.org/abs/2410.06833
  20. [20]Christian Kuehn and Jaeyoung Yoon. Spectral selection in symmetric self-attention dynamics. arXiv preprint arXiv:2604.26085, 2026.arxiv.org/abs/2604.26085
  21. [21]Akiyoshi Tomihari and Ryo Karakida. Recurrent self-attention dynamics: An energy-agnostic perspective from jacobians. In Advances in Neural Information Processing Systems, 2025. arXiv:2505.19458.arxiv.org/abs/2505.19458
  22. [22]Sixu Li, Thomas Jacob Maranzatto, Jan Peszek, Trevor Teolis, Semih Akkoc, Konstantin Riedl, Semnur Ulukus, and Nicolás Garcia Trillos. On the diverse dynamical behaviors arising in deep linear transformers. arXiv preprint arXiv:2607.18584, 2026.arxiv.org/abs/2607.18584
  23. [23]J. D. Mireles James. From Low-Dimensional Chaos to High-Dimensional Dynamics in Self-Attention Systems: Project website. GitHub Pages, 2026. Available at: https://j-mireles-james.github.io/self-attention-dynamics/.arxiv.org/abs/2611.29951
  24. [24]Eusebius J. Doedel. Lecture notes on numerical analysis of nonlinear equations. In Bernd Krauskopf, Hinke M. Osinga, and Jorge Galán-Vioque, editors, Numerical Continuation Methods for Dynamical Systems: Path Following and Boundary Value Problems, pages 1–49. Springer, 2007.DOI
  25. [25]Yuri A. Kuznetsov. Elements of Applied Bifurcation Theory. Springer, 3 edition, 2004.
  26. [26]Giancarlo Benettin, Luigi Galgani, Antonio Giorgilli, and Jean-Marie Strelcyn. Lyapunov characteristic exponents for smooth dynamical systems and for hamiltonian systems: A method for computing all of them. part 2: Numerical application. Meccanica, 15(1):21–30, 1980.
  27. [27]Dongsheng Wang, Casper Hansen, Lucas Chaves Lima, Christian Hansen, Maria Maistro, Jakob Grue Simonsen, and Christina Lioma. Multi-head self-attention with role-guided masks. In Advances in Information Retrieval: 43rd European Conference on IR Research (ECIR 2021), Part II, volume 12657 of Lecture Notes in Computer Science, pages 432–439. Springer, 2021.arxiv.org/abs/2012.12366
  28. [28]PyTorch Team. FlexAttention: The flexibility of PyTorch with the performance of FlashAttention. PyTorch Blog, August 7, 2024. https://pytorch.org/blog/flexattention/.
  29. [29]Neil Fenichel. Persistence and smoothness of invariant manifolds for flows. Indiana University Mathematics Journal, 21(3):193–226, 1972.DOI
  30. [30]Morris W. Hirsch, Charles C. Pugh, and Michael Shub. Invariant Manifolds, volume 583 of Lecture Notes in Mathematics. Springer, Berlin, 1977.
  31. [31]Michael Shub. Global Stability of Dynamical Systems. Springer-Verlag, New York, 1987.DOI
  32. [32]Anatole Katok and Boris Hasselblatt. Introduction to the Modern Theory of Dynamical Systems, volume 54 of Encyclopaedia of Mathematics and its Applications. Cambridge University Press, 1995.
  33. [33]Albert Q. Jiang, Alexandre Sablavrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, and William El Sayed. Mistral 7B, 2023. arXiv:2310.06825.arxiv.org/abs/2310.06825
  34. [34]Mistral AI. Mistral 7B. Mistral AI company announcement, September 27, 2023. https://mistral.ai/news/announcing-mistral-7b/.
  35. [35]Ju yeong Ji and Ravin Kumar. Gemma explained: What’s new in Gemma 2. Google Developers Blog, August 22, 2024. https://developers.googleblog.com/gemma-explained-new-in-gemma-2/.
  36. [36]Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin Transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 10012–10022, 2021.arxiv.org/abs/2103.14030
  37. [37]Yunlong Wang, Huizhe Zhang, Haonan Hu, Yudong Li, Bing Wen, Jianchao Tu, Chengxiang Zhuo, and Zang Li. CCFormer: Efficient cross-field interaction and hierarchical sequence compression for industrial recommendation at Tencent, 2026. arXiv:2607.28070.arxiv.org/abs/2607.28070
  38. [38]Zongtao Liu, Bin Ma, Quan Liu, Jian Xu, and Bo Zheng. Heterogeneous graph neural networks for large-scale bid keyword matching. In Proceedings of the 30th ACM International Conference on Information and Knowledge Management (CIKM 2021), pages 3976–3985. ACM, 2021.DOI
  39. [39]Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT 2019, Volume 1 (Long and Short Papers), pages 4171–4186. Association for Computational Linguistics, 2019.arxiv.org/abs/1810.04805
  40. [40]Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. In Proceedings of NAACL-HLT 2018, Volume 2 (Short Papers), pages 464–468. Association for Computational Linguistics, 2018.arxiv.org/abs/1803.02155
  41. [41]Ofir Press, Noah Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. In International Conference on Learning Representations, 2022.arxiv.org/abs/2108.12409
  42. [42]NVIDIA. Attention — NVIDIA cuDNN. NVIDIA, 2026. Accessed November 20, 2026; https://docs.nvidia.com/cudnn/latest/operations/Attention/.

Paper details

vlnc:W_fad4dn9q
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

ChatGPT (OpenAI), Claude

View statement
Looking for related papers…
Contents