Introduction
The core algorithm inside a large language model is a so-called attention-based transformer [24 ] . This architecture, introduced in 2017, has rapidly become the standard in many machine learning problems, also beyond natural language processing. A transformer is composed of multiple layers having identical structure, acting on “tokens”, that is, vectorial representations of the elementary units in which a set of data can be decomposed (words for language processing, patches of pixels for image processing, etc.). Inside a layer are two main subblocks: one is the attention mechanism and the other a feedforward neural network (FFN). The attention mechanism quantifies how much importance each token is giving to the other tokens, which justify why it is normally referred to as “self-attention” (the tokens’ attention is a function of the tokens themselves). It is implemented as a softmax function of an inner product involving the tokens multiplied by two learned weight matrices called query and key. The attention coefficients provide the weights of a convex combination of the tokens, which is in turn multiplied by a third matrix of weights called the value matrix. In a so-called multihead transformer, the attention mechanism inside a layer is “multiplexed” in such a way that different parts of a token can use different attention weights. The results at the various heads are then “concatenated” using a fourth matrix of weights called the output matrix. The FFN subblock of a layer is instead normally composed of a 2-layer “perceptron”, that is, a static map containing two learned weight matrices and bias terms with an activation function. Other ingredients of a transformer layer are residual connections, in which to the token value exiting one of the two subblocks above is added the value of the token before the subblock, and normalization operations, which we simplify here as L 2 L_2 L 2 normalizations of the token vectors, in place of the original “layernorm” operation (an affine, elementwise operation).
A popular approach to build mathematical models of transformers is to interpret the layer index as time axis, and to describe the changes that the tokens (the “state variables”) are subject to when passing through these layers as a dynamical system [10 , 20 , 16 , 12 , 13 ] . Even though a natural setting for such model is discrete-time and difference equations, most analyses carried out so far have opted for a continuous-time setting with ordinary differential equations [2 , 3 , 12 , 13 ] , in which the finite number of layers is replaced by a continuum of layers. The main reason is that most properties that one can investigate with a dynamical system are asymptotic properties, like for instance the existence and stability of the equilibria, which anyway requires the time axis (ie., the number of layers) to go to ∞ \infty ∞ . Another reason is that continuous-time dynamics are more amenable to be investigated using e.g. mean-field methods, quite popular in this context [4 , 5 , 11 ] .
Apart from continuous-time vs discrete-time, in the literature the setting of choice for a mathematical analysis of self-attention dynamics entails several simplifications: the initial embedding and positional encoding are disregarded; a single head is normally considered instead of a multihead; all layers are assumed to have the same weights (weight-sharing or “universal” transformers [7 ] , which leads to a time-invariant dynamical system); the attention matrix is full (each token attend to all other tokens); the layernorm is replaced by an L 2 L_2 L 2 norm (which renders the tokens of unit length, that is, makes them evolve on the unit sphere); the weight matrices are restricted to special structure (sometimes equal to the identity [13 ] , other times symmetric [3 ] ); the FFN part is ignored.
For such simplified continuous-time model, it has been shown in [12 ] that the tokens tend to cluster into identical vectors. In particular, [1 , 2 ] rephrased this feature as a consensus-like property, a familiar framework in the multiagent system literature [19 ] . Experimentally, this phenomenon is well-known under the names of oversmoothing, rank collapse, or token-uniformity [8 , 9 , 18 , 17 , 21 , 22 , 26 ] . Further analysis carried out in [3 ] provides a complete classification of the possible equilibria, and an analysis of their stability and convergence properties, showing that the eigenvectors of the value matrix play a prominent role: most token trajectories align in fact with the eigenvector associated to the principal
C. Altafini is with the Division of Automatic Control, Dept. of Electrical Engineering, Linköping University, SE-58183, Linköping, Sweden. email: claudio.altafini@liu.se. Work supported in part by the Swedish Research Council (grant n. 2024-04772) and by the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation. eigenvalue of the value matrix, at least in the cases in which the value matrix is symmetric and with a positive strictly dominant eigenvalue.
While it is mentioned in several papers that the discrete-time model of a self-attention dynamics behaves like its continuous-time counterpart, an explicit, thorough stability analysis of the discrete-time case is still missing (an exception is [1 ] where discrete-time consensus is proven in some special cases). Such an analysis is the main contribution of this paper. What we obtain is that indeed the behavior of the discrete-time self-attention model reflects that of its continuous-time counterpart for what concerns the classification of the equilibria and their stability properties. Consensus (when all token vectors become identical), bipartite consensus (when some tokens converge to a point on the unit sphere and the others converge to the antipodal point), polygonal equilibria, and clustering (non-antipodal) equilibria are the four classes of possible equilibria. The first two classes can occur only at the eigenvectors of the value matrix, and in particular consensus can be asymptotically stable only when it is aligned with the principal eigenvector of the value matrix, while all other consensus points can be shown to be unstable. Bipartite consensus equilibria can be (sometimes) locally asymptotically stable, and coexist with the “main” consensus attractor, leading to a multistable system as in the continuous-time case [3 ] . Proving these asymptotic properties requires to compute explicitly the Jacobian of the system and its eigenvalues/eigenvectors, which is significantly more challenging than in the continuous-time case. These explicit calculations, which constitute the main technical content of the paper, yield several nontrivial results, most notably the fact that convergence to consensus is always associated to the principal (most positive) eigenvalue of the value matrix, rather than to the eigenvalue of largest absolute value (i.e., equal to the spectral radius).
As a further extension w.r.t. the existing literature, we can provide a stability analysis also for the multihead case. In particular, we can still show asymptotic stability of the consensus equilibrium at the principal eigenvector of a matrix which is the multihead equivalent of the value matrix (we call this the “layer matrix”, and it is the product of a sum of suitably zero-padded value matrices at the various heads with the output matrix), meaning that the dynamical behavior of the multihead system is similar to that of the single head case.
An advantage of considering a discrete-time self-attention dynamics is that the learned weight matrices of a real transformer can be used to test the model. While in most transformers these weight matrices change from layer to layer (leading to a time-varying dynamics), the special class of universal transformers [7 ] has the property of sharing weights across layers (leading to the time-invariant dynamics investigated in this paper). A simple example of such universal architecture is ALBERT (“A Lite BERT”) [14 ] . We show in the paper that under (some of) the simplifying assumptions mentioned above (L 2 L_2 L 2 regularization, no FFN), indeed the discrete-time self-attention dynamics obtained by choosing the ALBERT weight matrices converges to a consensus point aligned with the principal eigenvector of our layer matrix. This confirms that the theoretical analysis is sound, and can provide useful predictions also on the finite-time horizon given by the number of layers of a real transformer.
We consider a simplified model of a transformer consisting of T T T layers, each characterized by a single head and by shared weight matrices (universal transformer), and in which we disregard the FFN part. A residual connection is included in the model, while as normalization we use L 2 L_2 L 2 normalization, which amounts to considering unit vectors, i.e., vectors that evolve on the unit sphere. To uniform ourselves with the standard dynamical systems notation, we treat tokens (i.e. state vectors) as columns vectors, see also [1 ] , [13 ] . Consider n n n tokens represented as unit length column vectors x i ∈ S d − 1 ⊂ R d x_i \in S^{d-1} \subset\mathbb{R}^d x i ∈ S d − 1 ⊂ R d , i = 1 , … , n i = 1,\ldots,n i = 1 , … , n . Denote F Q , F K ∈ R m × d F_Q,F_K \in\mathbb{R}^{m \times d} F Q , F K ∈ R m × d the query and key matrices (for simplicity and without loss of generality we hereafter assume m = d m=d m = d ) and F V ∈ R d × d F_V \in\mathbb{R}^{d \times d} F V ∈ R d × d the value matrix. Because of our column-token representation, these matrices correspond to the transposes of the weight matrices normally considered in the machine learning literature [24 ] , [15 ] , [6 ] , [23 ] (more on this in § 5 -A). Since we are dealing with a single head, a fourth matrix (denoted output matrix) is not required, and is therefore for now omitted.
The following discrete-time difference equation encodes the single-head self-attention dynamics we consider, including a residual connection and an L 2 L_2 L 2 layer normalization:
x i + = x i + η F V ∑ j = 1 n A i j ( x ) x j ∥ x i + η F V ∑ j = 1 n A i j ( x ) x j ∥ , i = 1 , … , n (1) x_i^+ = \frac{x_i + \eta F_V \sum_{j=1}^{n} A_{ij}(x)x_j}{\left\lVert x_i + \eta F_V \sum_{j=1}^{n} A_{ij}(x)x_j \right\rVert}, \qquad i=1,\ldots,n \tag*{(1)} x i + = x i + η F V ∑ j = 1 n A ij ( x ) x j x i + η F V ∑ j = 1 n A ij ( x ) x j , i = 1 , … , n (1)
where A i j ( x ) = e ( F Q x i ) T ( F K x j ) ∑ ℓ = 1 n e ( F Q x i ) T ( F K x ℓ ) A_{ij}(x) = \frac{e^{(F_Qx_i)^\mathsf{T}(F_Kx_j)}}{\sum_{\ell=1}^{n} e^{(F_Qx_i)^\mathsf{T}(F_Kx_\ell)}} A ij ( x ) = ∑ ℓ = 1 n e ( F Q x i ) T ( F K x ℓ ) e ( F Q x i ) T ( F K x j ) is the attention that the token x i x_i x i gives to the token x j x_j x j , computed through a softmax function (x x x is the stack of x 1 , … , x n x_1,\ldots,x_n x 1 , … , x n vectors) and where we have added an extra parameter η > 0 \eta> 0 η > 0 (“step size”), which balances the importance of the self-attention part against the residual connection [18 ] . The (row stochastic) attention matrix A ( x ) A(x) A ( x ) is assumed full, i.e., each token attends to every other token. In (1) we are implicitly interpreting the tokens as layer-indexed state variables: x i = x i ( t ) x_i = x_i(t) x i = x i ( t ) and x i + = x i ( t + 1 ) x_i^+ = x_i(t+1) x i + = x i ( t + 1 ) , for some layer index t = 1 , … , T t = 1,\ldots,T t = 1 , … , T . We let ∥ ⋅ ∥ \lVert\cdot\rVert ∥ ⋅ ∥ denote the Euclidean vector norm and the operator norm for matrices. For the i i i -th token, define the tangent projector on S d − 1 S^{d-1} S d − 1 at x i x_i x i by Π x i : = I − x i x i T \Pi_{x_i} := I - x_ix_i^\mathsf{T} Π x i := I − x i x i T , which satisfies Π x i x i = 0 \Pi_{x_i}x_i = 0 Π x i x i = 0 and Π x i T = Π x i \Pi_{x_i}^\mathsf{T} = \Pi_{x_i} Π x i T = Π x i . We are interested in investigating the asymptotic behavior of (1) when the number of layers T T T goes to ∞ \infty ∞ , and in particular in computing the equilibria of (1) and studying their stability properties. For that, it is convenient to investigate first a simpler system, which, for analogy with the continuous-time case, we call the multiagent discrete-time Oja system [3 ] . This system has the same structure as (1) but lacks the attention matrix.
Multiagent discrete-time Oja system
When we consider uniform attention [18 ] , i.e., we take A ( x ) = 1 n 11 T A(x) = \frac{1}{n}\mathbf{1}\mathbf{1}^\mathsf{T} A ( x ) = n 1 1 1 T , then instead of (1) we obtain the simpler system
x i + = x i + η n F V ∑ j = 1 n x j ∥ x i + η n F V ∑ j = 1 n x j ∥ . (2) x_i^+ = \frac{x_i + \frac{\eta}{n}F_V \sum_{j=1}^{n} x_j}{\left\lVert x_i + \frac{\eta}{n}F_V \sum_{j=1}^{n} x_j \right\rVert}. \tag*{(2)} x i + = x i + n η F V ∑ j = 1 n x j x i + n η F V ∑ j = 1 n x j . (2)
Let y = F V m ( x ) = 1 n F V ∑ j = 1 n x j ∈ R d y = F_V m(x) = \frac{1}{n}F_V\sum_{j=1}^{n}x_j \in\mathbb{R}^{d} y = F V m ( x ) = n 1 F V ∑ j = 1 n x j ∈ R d be the total influence of all agents on agent i i i (which is the same for all agents). Splitting (2) into parts before/after the normalization we can also write:
x ~ i = x i + η y and x i + = x ~ i ∥ x ~ i ∥ . (3) \widetilde{x}_i=x_i+\eta y \qquad\text{and}\qquad x_i^+=\frac{\widetilde{x}_i}{\lVert\widetilde{x}_i\rVert}. \tag*{(3)} x i = x i + η y and x i + = ∥ x i ∥ x i . (3)
We make the following assumption which holds throughout the rest of this and next section.
Assumption 1 The value matrix F V ∈ R d × d F_V\in\mathbb{R}^{d\times d} F V ∈ R d × d is nonsingular and symmetric, of eigenvalues λ 1 > λ 2 ≥ … ≥ λ d \lambda_1>\lambda_2\geq\ldots\geq\lambda_d λ 1 > λ 2 ≥ … ≥ λ d with λ 1 > 0 \lambda_1>0 λ 1 > 0 simple and positive.
Let v 1 , … , v d v_1,\ldots,v_d v 1 , … , v d be the associated eigenvectors, normalized s.t. ∥ v k ∥ = 1 \lVert v_k\rVert=1 ∥ v k ∥ = 1 .
Equilibria
Let us first give our definition of consensus and bipartite consensus equilibria, which we request to be collinear with the eigenvectors of F V F_V F V (the reason will become clear later on when we study the full model (1)). The points x 1 , … , x n ∈ S d − 1 x_1,\ldots,x_n\in\mathbb{S}^{d-1} x 1 , … , x n ∈ S d − 1 are said to be in a consensus equilibrium if x i = x j = v k ∀ i , j = 1 , … , n x_i=x_j=v_k\ \forall i,j=1,\ldots,n x i = x j = v k ∀ i , j = 1 , … , n (or x i = x j = − v k ∀ i , j = 1 , … , n x_i=x_j=-v_k\ \forall i,j=1,\ldots,n x i = x j = − v k ∀ i , j = 1 , … , n ) and for some k = 1 , … , d k=1,\ldots,d k = 1 , … , d . They are said to be in a bipartite consensus equilibrium if x i = v k x_i=v_k x i = v k for i ∈ V 1 ⊂ V i\in\mathcal{V}_1\subset\mathcal{V} i ∈ V 1 ⊂ V and x i = − v k x_i=-v_k x i = − v k for i ∈ V ∖ V 1 i\in\mathcal{V}\setminus\mathcal{V}_1 i ∈ V ∖ V 1 , for some k = 1 , … , d k=1,\ldots,d k = 1 , … , d .
Lemma 1 Let x = [ ( x 1 ) T … ( x n ) T ] T x=[(x_1)^T\ \ldots\ (x_n)^T]^T x = [( x 1 ) T … ( x n ) T ] T be an equilibrium point of the system (2). Then x x x belongs to one of the following classes:
consensus: x i = v k ∀ i x_i=v_k\ \forall i x i = v k ∀ i , and k = 1 , … , d k=1,\ldots,d k = 1 , … , d ;
bipartite consensus: x i = ± v k ∀ i x_i=\pm v_k\ \forall i x i = ± v k ∀ i and k = 1 , … , d k=1,\ldots,d k = 1 , … , d ;
polygonal equilibria: { x i ∈ S d − 1 s.t. F V ∑ j = 1 n x j = 0 } \{x_i\in\mathbb{S}^{d-1}\text{ s.t. }F_V\sum_{j=1}^{n}x_j=0\} { x i ∈ S d − 1 s.t. F V ∑ j = 1 n x j = 0 } .
Proof. An equilibrium point x i x_i x i satisfies x i + = x i x_i^+=x_i x i + = x i for all i i i , hence, from (3), x i = x ~ i ∥ x ~ i ∥ x_i=\frac{\widetilde{x}_i}{\lVert\widetilde{x}_i\rVert} x i = ∥ x i ∥ x i , which implies that x ~ i \widetilde{x}_i x i and x i x_i x i must be collinear, i.e., x ~ i = φ x i \widetilde{x}_i=\varphi x_i x i = φ x i for some φ ∈ R \varphi\in\mathbb{R} φ ∈ R . If y = 1 n F V ∑ j = 1 n x j y=\frac{1}{n}F_V\sum_{j=1}^{n}x_j y = n 1 F V ∑ j = 1 n x j , then from (3), x ~ i = x i + η y \widetilde{x}_i=x_i+\eta y x i = x i + η y holds iff also y y y and x i x_i x i are collinear or y = 0 y=0 y = 0 . This condition can be written equivalently using projections as
Π x i y = ( I − x i x i T ) y = 0. \Pi_{x_i}y=(I-x_ix_i^T)y=0. Π x i y = ( I − x i x i T ) y = 0.
There are 3 cases in which this can happen:
consensus: y = φ i x i y=\varphi_i x_i y = φ i x i , for some scalar φ i > 0 \varphi_i>0 φ i > 0 ;
bipartite consensus: y = − φ i x i y=-\varphi_i x_i y = − φ i x i , for some scalar φ i > 0 \varphi_i>0 φ i > 0 ;
polygonal equilibria: y = 0 y=0 y = 0 .
In fact, in the first two cases, Π x i x i = ± φ i ( x i − x i x i T x i ) = 0 \Pi_{x_i}x_i=\pm\varphi_i(x_i-x_ix_i^Tx_i)=0 Π x i x i = ± φ i ( x i − x i x i T x i ) = 0 , since x i T x i = 1 x_i^Tx_i=1 x i T x i = 1 . The third case follows trivially. To show that consensus must be an eigenvector of F V F_V F V , observe that at this equilibrium point we have y = F V x i y=F_Vx_i y = F V x i , since x i = x j x_i=x_j x i = x j . Combining with y = φ i x i y=\varphi_i x_i y = φ i x i , we have F V x i = φ i x i F_Vx_i=\varphi_i x_i F V x i = φ i x i , i.e., x i x_i x i is an eigenvector of F V F_V F V and φ i \varphi_i φ i one of its eigenvalues. The argument for bipartite consensus is identical.
Stability
The stability properties of the multiagent Oja system (2) are summarized in the following theorem.
Theorem 1 For the system (2), under Assumption 1, if η < min ( 2 λ 1 + λ d , 1 2 max { ∣ λ 1 ∣ , ∣ λ d ∣ } ) \eta<\min\left(\frac{2}{\lambda_1+\lambda_d},\frac{1}{2\max\{|\lambda_1|,|\lambda_d|\}}\right) η < min ( λ 1 + λ d 2 , 2 m a x { ∣ λ 1 ∣ , ∣ λ d ∣ } 1 ) , the principal consensus equilibrium x i = v 1 ∀ i x_i=v_1\ \forall i x i = v 1 ∀ i is asymptotically stable, while all other consensus equilibria, all bipartite consensus equilibria (including those aligned with v 1 v_1 v 1 ), and all polygonal equilibria are unstable. The trajectories of all tokens x i ( t ) x_i(t) x i ( t ) converge to v 1 v_1 v 1 (or to − v 1 -v_1 − v 1 ) for almost all initial conditions x i ( 0 ) x_i(0) x i ( 0 ) .
The theorem is proven through a series of lemmas. Let δ i h \delta_{ih} δ ih be a delta function (δ i h = 1 \delta_{ih}=1 δ ih = 1 if i = h i=h i = h and δ i h = 0 \delta_{ih}=0 δ ih = 0 otherwise). Let the right-hand side of (2) be f i ( x ) = x i + η n F V ∑ j = 1 n x j ∥ x i + η n F V ∑ j = 1 n x j ∥ f_i(x)=\frac{x_i+\frac{\eta}{n}F_V\sum_{j=1}^{n}x_j}{\left\lVert x_i+\frac{\eta}{n}F_V\sum_{j=1}^{n}x_j\right\rVert} f i ( x ) = ∥ x i + n η F V ∑ j = 1 n x j ∥ x i + n η F V ∑ j = 1 n x j , and denote f ( x ) = [ f 1 ( x ) T … f n ( x ) T ] T f(x)=[f_1(x)^T\ \ldots\ f_n(x)^T]^T f ( x ) = [ f 1 ( x ) T … f n ( x ) T ] T the ( n d ) (nd) ( n d ) -dimensional vector field associated to the stacked state vector x = [ x 1 T … x n T ] T x=[x_1^T\ \ldots\ x_n^T]^T x = [ x 1 T … x n T ] T . The Jacobian J ( x ) = ∂ f ( x ) ∂ x = [ ∂ f i ( x ) ∂ x h ] J(x)=\frac{\partial f(x)}{\partial x}=\left[\frac{\partial f_i(x)}{\partial x_h}\right] J ( x ) = ∂ x ∂ f ( x ) = [ ∂ x h ∂ f i ( x ) ] is composed of a diagonal part and a part that repeats itself on all ( i , h ) (i,h) ( i , h ) blocks.
Lemma 2 The Jacobian J ( x ) J(x) J ( x ) of the system (2) has the following blocks:
∂ f i ( x ) ∂ x h = η n F V ∥ x i + η n F V ∑ j x j ∥ − η n ( x i T F V + η n ( ∑ j x j T F V T ( I − x i x i T ) F V ) ) ∥ x i + η n F V ∑ j x j ∥ 2 ( x i + η n F V ∑ j x j ) \frac{\partial f_i(x)}{\partial x_h}
=
\frac{\frac{\eta}{n}F_V}{\left\lVert x_i+\frac{\eta}{n}F_V\sum_jx_j\right\rVert}
-
\frac{\frac{\eta}{n}\left(x_i^TF_V+\frac{\eta}{n}\left(\sum_jx_j^TF_V^T(I-x_ix_i^T)F_V\right)\right)}
{\left\lVert x_i+\frac{\eta}{n}F_V\sum_jx_j\right\rVert^2}
\left(x_i+\frac{\eta}{n}F_V\sum_jx_j\right) ∂ x h ∂ f i ( x ) = x i + n η F V ∑ j x j n η F V − x i + n η F V ∑ j x j 2 n η ( x i T F V + n η ( ∑ j x j T F V T ( I − x i x i T ) F V ) ) ( x i + n η F V j ∑ x j ) + ( I ∥ x i + η n F V ∑ j x j ∥ − η n ( ∑ j x j T F V T ( I − 1 n x i ∑ ℓ x ℓ T F V ) ) ∥ x i + η n F V ∑ j x j ∥ 2 ) δ i h . (4) \qquad+
\left(
\frac{I}{\left\lVert x_i+\frac{\eta}{n}F_V\sum_jx_j\right\rVert}
-
\frac{\frac{\eta}{n}\left(\sum_jx_j^TF_V^T\left(I-\frac{1}{n}x_i\sum_\ell x_\ell^TF_V\right)\right)}
{\left\lVert x_i+\frac{\eta}{n}F_V\sum_jx_j\right\rVert^2}
\right)\delta_{ih}. \tag*{(4)} + x i + n η F V ∑ j x j I − x i + n η F V ∑ j x j 2 n η ( ∑ j x j T F V T ( I − n 1 x i ∑ ℓ x ℓ T F V ) ) δ ih . (4)
Proof. Let us first express the series expansion of the normed term:
∥ x i + η n F V ∑ j x j ∥ = ( ( x i + η y ) T ( x i + η y ) ) 1 2 = ( 1 + 2 η x i T y + η 2 ∥ y ∥ 2 ) 1 2 \begin{aligned}
\left\lVert x_i+\frac{\eta}{n}F_V\sum_jx_j\right\rVert
=
\left((x_i+\eta y)^T(x_i+\eta y)\right)^{\frac{1}{2}} \\
&=
\left(1+2\eta x_i^Ty+\eta^2\lVert y\rVert^2\right)^{\frac{1}{2}}
\end{aligned} x i + n η F V j ∑ x j = ( ( x i + η y ) T ( x i + η y ) ) 2 1 = ( 1 + 2 η x i T y + η 2 ∥ y ∥ 2 ) 2 1
≈ 1 + 1 2 ( 2 η x i T y + η 2 ∥ y ∥ 2 ) − 1 2 η 2 ( x i T y ) 2 + O ( η 3 ) = 1 + η n x i T F V ∑ j x j \begin{aligned}
\approx1+\frac{1}{2}\left(2\eta x_i^Ty+\eta^2\lVert y\rVert^2\right)-\frac{1}{2}\eta^2(x_i^Ty)^2+O(\eta^3) \\
&=1+\frac{\eta}{n}x_i^TF_V\sum_jx_j
\end{aligned} ≈ 1 + 2 1 ( 2 η x i T y + η 2 ∥ y ∥ 2 ) − 2 1 η 2 ( x i T y ) 2 + O ( η 3 ) = 1 + n η x i T F V j ∑ x j
+ η 2 2 n 2 ( ∑ j x j T F V T F V ∑ j x j − ( x i T F V ∑ j x j ) 2 ) + O ( η 3 ) \quad+\frac{\eta^2}{2n^2}\left(\sum_jx_j^TF_V^TF_V\sum_jx_j-\left(x_i^TF_V\sum_jx_j\right)^2\right)+O(\eta^3) + 2 n 2 η 2 j ∑ x j T F V T F V j ∑ x j − ( x i T F V j ∑ x j ) 2 + O ( η 3 )
where we have used the binomial series expansion ( 1 + ξ ) 1 2 ≈ 1 + ξ 2 − ξ 2 8 + O ( ξ 3 ) (1+\xi)^{\frac{1}{2}}\approx1+\frac{\xi}{2}-\frac{\xi^2}{8}+O(\xi^3) ( 1 + ξ ) 2 1 ≈ 1 + 2 ξ − 8 ξ 2 + O ( ξ 3 ) , disregarding terms of order higher than 2 in η \eta η . Differentiating this term
∂ ∥ x i + η n F V ∑ j x j ∥ ∂ x h = η n x i T F V + η 2 n 2 ∑ j x j T F V T ( I − x i x i T ) F V + ( η n ∑ j x j T F V T − η 2 n 2 ∑ j x j T F V T x i ∑ ℓ x ℓ T F V ) δ i h \frac{\partial\left\lVert x_i+\frac{\eta}{n}F_V\sum_j x_j\right\rVert}{\partial x_h}
=
\frac{\eta}{n}x_i^T F_V+\frac{\eta^2}{n^2}\sum_j x_j^T F_V^T\left(I-x_i x_i^T\right)F_V
+\left(\frac{\eta}{n}\sum_j x_j^T F_V^T-\frac{\eta^2}{n^2}\sum_j x_j^T F_V^T x_i\sum_\ell x_\ell^T F_V\right)\delta_{ih} ∂ x h ∂ x i + n η F V ∑ j x j = n η x i T F V + n 2 η 2 j ∑ x j T F V T ( I − x i x i T ) F V + ( n η j ∑ x j T F V T − n 2 η 2 j ∑ x j T F V T x i ℓ ∑ x ℓ T F V ) δ ih
Inserting this expression into
∂ f i ( x ) ∂ x h = ( I δ i h + η n F V ) ∥ x i + η n F V ∑ j x j ∥ ∥ x i + η n F V ∑ j x j ∥ 2 − ( x i + η n F V ∑ j x j ) ∂ ∥ x i + η n F V ∑ j x j ∥ ∂ x h ∥ x i + η n F V ∑ j x j ∥ 2 \frac{\partial f_i(x)}{\partial x_h}
=
\frac{\left(I\delta_{ih}+\frac{\eta}{n}F_V\right)\left\lVert x_i+\frac{\eta}{n}F_V\sum_j x_j\right\rVert}{\left\lVert x_i+\frac{\eta}{n}F_V\sum_j x_j\right\rVert^2}
-
\frac{\left(x_i+\frac{\eta}{n}F_V\sum_j x_j\right)\frac{\partial\left\lVert x_i+\frac{\eta}{n}F_V\sum_j x_j\right\rVert}{\partial x_h}}{\left\lVert x_i+\frac{\eta}{n}F_V\sum_j x_j\right\rVert^2} ∂ x h ∂ f i ( x ) = x i + n η F V ∑ j x j 2 ( I δ ih + n η F V ) x i + n η F V ∑ j x j − x i + n η F V ∑ j x j 2 ( x i + n η F V ∑ j x j ) ∂ x h ∂ ∥ x i + n η F V ∑ j x j ∥
the result follows.
Lemma 3 For the system (2), under Assumption 1, at a consensus equilibrium x i = v k ∀ i x_i=v_k\ \forall i x i = v k ∀ i the Jacobian J ( x ) J(x) J ( x ) has the following 3 classes of eigenvalues:
if 1 + η λ k > 0 1+\eta\lambda_k>0 1 + η λ k > 0 , 1 − η λ k + η 2 λ k 2 1 + η λ k \frac{1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k} 1 + η λ k 1 − η λ k + η 2 λ k 2 of multiplicity n n n , while if 1 + η λ k < 0 1+\eta\lambda_k<0 1 + η λ k < 0 , − 1 − 3 η λ k + η 2 λ k 2 1 + η λ k \frac{-1-3\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k} 1 + η λ k − 1 − 3 η λ k + η 2 λ k 2 of multiplicity 1 and − 1 − η λ k + η 2 λ k 2 1 + η λ k \frac{-1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k} 1 + η λ k − 1 − η λ k + η 2 λ k 2 of multiplicity n − 1 n-1 n − 1 .
1 + η λ h ∣ 1 + η λ k ∣ \frac{1+\eta\lambda_h}{\lvert1+\eta\lambda_k\rvert} ∣ 1 + η λ k ∣ 1 + η λ h of multiplicity 1, h = 1 , … , k − 1 , k + 1 , … , d h=1,\ldots,k-1,k+1,\ldots,d h = 1 , … , k − 1 , k + 1 , … , d .
1 ∣ 1 + η λ k ∣ \frac{1}{\lvert1+\eta\lambda_k\rvert} ∣ 1 + η λ k ∣ 1 of multiplicity n d − d − n + 1 nd-d-n+1 n d − d − n + 1 .
Proof. When computing the Jacobian (4) at the consensus x i = v k ∀ i x_i=v_k\ \forall i x i = v k ∀ i , we get
J ( v k ) = ∂ f ( x ) ∂ x ∣ x i = v k = 11 T ⊗ ( sgn ( 1 + η λ k ) η n F V − η n λ k v k v k T 1 + η λ k ) + I ⊗ ( sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T 1 + η λ k ) . (5) J(v_k)=\left.\frac{\partial f(x)}{\partial x}\right|_{x_i=v_k}
=\mathbf{1}\mathbf{1}^T\otimes\left(\frac{\operatorname{sgn}(1+\eta\lambda_k)\frac{\eta}{n}F_V-\frac{\eta}{n}\lambda_kv_kv_k^T}{1+\eta\lambda_k}\right)
+I\otimes\left(\frac{\operatorname{sgn}(1+\eta\lambda_k)I-\eta\lambda_k(1-\eta\lambda_k)v_kv_k^T}{1+\eta\lambda_k}\right). \tag*{(5)} J ( v k ) = ∂ x ∂ f ( x ) x i = v k = 1 1 T ⊗ ( 1 + η λ k sgn ( 1 + η λ k ) n η F V − n η λ k v k v k T ) + I ⊗ ( 1 + η λ k sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T ) . (5)
where we have used v k T ( I − v k v k T ) = 0 v_k^T(I-v_kv_k^T)=0 v k T ( I − v k v k T ) = 0 . The first term represents a factor present in all entries of J ( v k ) J(v_k) J ( v k ) , while the second one is present only on the diagonal. For J ( v k ) J(v_k) J ( v k ) there are 3 classes of eigenvectors:
The eigenvectors of the first class depend on the sign of 1 + η λ k 1+\eta\lambda_k 1 + η λ k . If 1 + η λ k > 0 1+\eta\lambda_k>0 1 + η λ k > 0 , then choose p = [ 0 … 0 v k 0 … 0 ] p=[0\ldots0\ v_k\ 0\ldots0] p = [ 0 … 0 v k 0 … 0 ] and compute the two components of J ( v k ) J(v_k) J ( v k ) :
{ sgn ( 1 + η λ k ) η n F V − η n λ k v k v k T 1 + η λ k v k = η n ( 1 − 1 ) 1 + η λ k v k = 0 sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T 1 + η λ k v k = 1 − η λ k ( 1 − η λ k ) 1 + η λ k v k \left\{
\begin{aligned}
\frac{\operatorname{sgn}(1+\eta\lambda_k)\frac{\eta}{n}F_V-\frac{\eta}{n}\lambda_kv_kv_k^T}{1+\eta\lambda_k}v_k&=\frac{\eta}{n}\frac{(1-1)}{1+\eta\lambda_k}v_k=0\\
\frac{\operatorname{sgn}(1+\eta\lambda_k)I-\eta\lambda_k(1-\eta\lambda_k)v_kv_k^T}{1+\eta\lambda_k}v_k&=\frac{1-\eta\lambda_k(1-\eta\lambda_k)}{1+\eta\lambda_k}v_k
\end{aligned}
\right. ⎩ ⎨ ⎧ 1 + η λ k sgn ( 1 + η λ k ) n η F V − n η λ k v k v k T v k 1 + η λ k sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T v k = n η 1 + η λ k ( 1 − 1 ) v k = 0 = 1 + η λ k 1 − η λ k ( 1 − η λ k ) v k
meaning that
J ( v k ) p = 1 − η λ k + η 2 λ k 2 1 + η λ k p J(v_k)p=\frac{1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k}p J ( v k ) p = 1 + η λ k 1 − η λ k + η 2 λ k 2 p
i.e., 1 − η λ k + η 2 λ k 2 1 + η λ k \frac{1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k} 1 + η λ k 1 − η λ k + η 2 λ k 2 is an eigenvalue of J ( v k ) J(v_k) J ( v k ) of multiplicity n n n (as there are n n n possible slots for v k v_k v k in p p p ). If instead 1 + η λ k < 0 1+\eta\lambda_k<0 1 + η λ k < 0 , then choose the following n n n eigenvectors
p = { p 1 = [ v k v k … v k ] p ℓ = [ ϕ 1 ℓ v k ϕ 2 ℓ v k … ϕ n ℓ v k ] s.t. ∑ i ϕ i ℓ = 0 , ℓ = 2 , … , n p=\left\{
\begin{aligned}
p_1&=[v_k\ v_k\ \ldots\ v_k]\\
p_\ell&=[\phi_1^\ell v_k\ \phi_2^\ell v_k\ \ldots\ \phi_n^\ell v_k]\quad\text{s.t.}\ \sum_i\phi_i^\ell=0,\quad\ell=2,\ldots,n
\end{aligned}
\right. p = ⎩ ⎨ ⎧ p 1 p ℓ = [ v k v k … v k ] = [ ϕ 1 ℓ v k ϕ 2 ℓ v k … ϕ n ℓ v k ] s.t. i ∑ ϕ i ℓ = 0 , ℓ = 2 , … , n
In correspondence of p 1 p_1 p 1 , one gets
{ sgn ( 1 + η λ k ) η n F V − η n λ k v k v k T 1 + η λ k v k = η n − 2 λ k 1 + η λ k v k sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T 1 + η λ k v k = − 1 − η λ k + η 2 λ k 2 1 + η λ k v k \left\{
\begin{aligned}
\frac{\operatorname{sgn}(1+\eta\lambda_k)\frac{\eta}{n}F_V-\frac{\eta}{n}\lambda_kv_kv_k^T}{1+\eta\lambda_k}v_k&=\frac{\eta}{n}\frac{-2\lambda_k}{1+\eta\lambda_k}v_k\\
\frac{\operatorname{sgn}(1+\eta\lambda_k)I-\eta\lambda_k(1-\eta\lambda_k)v_kv_k^T}{1+\eta\lambda_k}v_k&=\frac{-1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k}v_k
\end{aligned}
\right. ⎩ ⎨ ⎧ 1 + η λ k sgn ( 1 + η λ k ) n η F V − n η λ k v k v k T v k 1 + η λ k sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T v k = n η 1 + η λ k − 2 λ k v k = 1 + η λ k − 1 − η λ k + η 2 λ k 2 v k
hence
J ( v k ) p 1 = η − 2 λ k 1 + η λ k p 1 + − 1 − η λ k + η 2 λ k 2 1 + η λ k p 1 = − 1 − 3 η λ k + η 2 λ k 2 1 + η λ k p 1 J(v_k)p_1=\eta\frac{-2\lambda_k}{1+\eta\lambda_k}p_1+\frac{-1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k}p_1
=\frac{-1-3\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k}p_1 J ( v k ) p 1 = η 1 + η λ k − 2 λ k p 1 + 1 + η λ k − 1 − η λ k + η 2 λ k 2 p 1 = 1 + η λ k − 1 − 3 η λ k + η 2 λ k 2 p 1
while in correspondence of p ℓ p_\ell p ℓ one gets
J ( v k ) p ℓ = [ ∑ i ϕ i ℓ ( η n − 2 λ k 1 + η λ k ) v k + − 1 − η λ k + η 2 λ k 2 1 + η λ k ϕ 1 ℓ v k : ⋯ : ∑ i ϕ i ℓ ( η n − 2 λ k 1 + η λ k ) v k + − 1 − η λ k + η 2 λ k 2 1 + η λ k ϕ n ℓ v k ] = − 1 − η λ k + η 2 λ k 2 1 + η λ k p ℓ J(v_k)p_\ell=
\left[
\sum_i\phi_i^\ell\left(\frac{\eta}{n}\frac{-2\lambda_k}{1+\eta\lambda_k}\right)v_k+
\frac{-1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k}\phi_1^\ell v_k
\ :\ \cdots\ :
\ \sum_i\phi_i^\ell\left(\frac{\eta}{n}\frac{-2\lambda_k}{1+\eta\lambda_k}\right)v_k+
\frac{-1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k}\phi_n^\ell v_k
\right]
=\frac{-1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k}p_\ell J ( v k ) p ℓ = [ i ∑ ϕ i ℓ ( n η 1 + η λ k − 2 λ k ) v k + 1 + η λ k − 1 − η λ k + η 2 λ k 2 ϕ 1 ℓ v k : ⋯ : i ∑ ϕ i ℓ ( n η 1 + η λ k − 2 λ k ) v k + 1 + η λ k − 1 − η λ k + η 2 λ k 2 ϕ n ℓ v k ] = 1 + η λ k − 1 − η λ k + η 2 λ k 2 p ℓ
i.e., − 1 − η λ k + η 2 λ k 2 1 + η λ k \frac{-1-\eta\lambda_k+\eta^2\lambda_k^2}{1+\eta\lambda_k} 1 + η λ k − 1 − η λ k + η 2 λ k 2 is an eigenvalue of multiplicity n − 1 n-1 n − 1 .
For the second class of eigenvectors choosing q h = [ v h … v h ] q_h=[v_h\ldots v_h] q h = [ v h … v h ] for h ≠ k h\ne k h = k , leads to
{ sgn ( 1 + η λ k ) η n F V − η n λ k v k v k T 1 + η λ k v h = η n λ h ∣ 1 + η λ k ∣ v h sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T 1 + η λ k v h = 1 ∣ 1 + η λ k ∣ v h \left\{
\begin{aligned}
\frac{\operatorname{sgn}(1+\eta\lambda_k)\frac{\eta}{n}F_V-\frac{\eta}{n}\lambda_kv_kv_k^T}{1+\eta\lambda_k}v_h&=\frac{\eta}{n}\frac{\lambda_h}{\lvert1+\eta\lambda_k\rvert}v_h\\
\frac{\operatorname{sgn}(1+\eta\lambda_k)I-\eta\lambda_k(1-\eta\lambda_k)v_kv_k^T}{1+\eta\lambda_k}v_h&=\frac{1}{\lvert1+\eta\lambda_k\rvert}v_h
\end{aligned}
\right. ⎩ ⎨ ⎧ 1 + η λ k sgn ( 1 + η λ k ) n η F V − n η λ k v k v k T v h 1 + η λ k sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T v h = n η ∣ 1 + η λ k ∣ λ h v h = ∣ 1 + η λ k ∣ 1 v h
and hence to
J ( v k ) q h = 1 + η λ h ∣ 1 + η λ k ∣ q h J(v_k)q_h=\frac{1+\eta\lambda_h}{\lvert1+\eta\lambda_k\rvert}q_h J ( v k ) q h = ∣ 1 + η λ k ∣ 1 + η λ h q h
i.e., 1 + η λ h ∣ 1 + η λ k ∣ \frac{1+\eta\lambda_h}{\lvert1+\eta\lambda_k\rvert} ∣ 1 + η λ k ∣ 1 + η λ h is an eigenvalue of J ( v k ) J(v_k) J ( v k ) . There are d − 1 d-1 d − 1 such eigenvalues.
The remaining n d − d − n + 1 nd-d-n+1 n d − d − n + 1 eigenvectors are assumed by considering vectors r = [ ( z 1 ) T ( z 2 ) T … ( z n ) T ] T r=[(z^1)^T\ (z^2)^T\ \ldots\ (z^n)^T]^T r = [( z 1 ) T ( z 2 ) T … ( z n ) T ] T s.t. v k T z i = 0 v_k^Tz^i=0 v k T z i = 0 for all i = 1 , … , n i=1,\ldots,n i = 1 , … , n and all h = 1 , … , k − 1 , k + 1 , … , d h=1,\ldots,k-1,k+1,\ldots,d h = 1 , … , k − 1 , k + 1 , … , d and q h T r = 0 q_h^Tr=0 q h T r = 0 . Since the number of such constraints is d − 1 + n d-1+n d − 1 + n , there exist n d − n − d + 1 nd-n-d+1 n d − n − d + 1 such vectors r r r , and they can always be chosen so that ∑ i = 1 n z i = 0 \sum_{i=1}^n z^i=0 ∑ i = 1 n z i = 0 . Computing,
{ sgn ( 1 + η λ k ) η n F V − η n λ k v k v k T 1 + η λ k z i = η n F V ∣ 1 + η λ k ∣ z i sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T 1 + η λ k z i = 1 ∣ 1 + η λ k ∣ z i \left\{
\begin{aligned}
\frac{\operatorname{sgn}(1+\eta\lambda_k)\frac{\eta}{n}F_V-\frac{\eta}{n}\lambda_kv_kv_k^T}{1+\eta\lambda_k}z^i&=\frac{\eta}{n}\frac{F_V}{\lvert1+\eta\lambda_k\rvert}z^i\\
\frac{\operatorname{sgn}(1+\eta\lambda_k)I-\eta\lambda_k(1-\eta\lambda_k)v_kv_k^T}{1+\eta\lambda_k}z^i&=\frac{1}{\lvert1+\eta\lambda_k\rvert}z^i
\end{aligned}
\right. ⎩ ⎨ ⎧ 1 + η λ k sgn ( 1 + η λ k ) n η F V − n η λ k v k v k T z i 1 + η λ k sgn ( 1 + η λ k ) I − η λ k ( 1 − η λ k ) v k v k T z i = n η ∣ 1 + η λ k ∣ F V z i = ∣ 1 + η λ k ∣ 1 z i
hence
J ( v k ) r = 1 ∣ 1 + η λ k ∣ [ η n F V ∑ i z i + z 1 ⋮ η n F V ∑ i z i + z n ] = 1 ∣ 1 + η λ k ∣ r J(v_k)r=\frac{1}{\lvert1+\eta\lambda_k\rvert}
\begin{bmatrix}
\frac{\eta}{n}F_V\sum_i z_i+z_1\\
\vdots\\
\frac{\eta}{n}F_V\sum_i z_i+z_n
\end{bmatrix}
=\frac{1}{\lvert1+\eta\lambda_k\rvert}r J ( v k ) r = ∣ 1 + η λ k ∣ 1 n η F V ∑ i z i + z 1 ⋮ n η F V ∑ i z i + z n = ∣ 1 + η λ k ∣ 1 r
Lemma 4. For the system (2) , under Assumption 1, and, if − λ d > λ 1 -\lambda_d > \lambda_1 − λ d > λ 1 , for η < 2 ∣ λ 1 + λ d ∣ \eta< \frac{2}{\lvert\lambda_1+\lambda_d\rvert} η < ∣ λ 1 + λ d ∣ 2 , then the principal consensus equilibrium point, x i = v 1 ∀ i x_i=v_1\ \forall i x i = v 1 ∀ i , is asymptotically stable. For k = 2 , … , d k=2,\ldots,d k = 2 , … , d , the consensus equilibria x i = v k ∀ i x_i=v_k\ \forall i x i = v k ∀ i are all unstable.
Proof. Consider the principal consensus equilibrium point v 1 v_1 v 1 and the eigenvalues of J ( v 1 ) J(v_1) J ( v 1 ) computed in Lemma 3. Notice from Remark 2 that only the second and third class of eigenvalues matter for the stability. Under Assumption 1, 1 + η λ 1 > 1 1+\eta\lambda_1>1 1 + η λ 1 > 1 , hence the 3rd class of eigenvalues is inside the unit disk. When ∣ λ d ∣ < λ 1 \lvert\lambda_d\rvert<\lambda_1 ∣ λ d ∣ < λ 1 , then also the second class is inside the disk for all h = 2 , … , d h=2,\ldots,d h = 2 , … , d , regardless of the sign of λ h \lambda_h λ h , while when − λ d > λ 1 -\lambda_d>\lambda_1 − λ d > λ 1 we need to have 1 + η λ d 1 + η λ 1 > − 1 \frac{1+\eta\lambda_d}{1+\eta\lambda_1}>-1 1 + η λ 1 1 + η λ d > − 1 , i.e., η < − 2 λ 1 + λ d = 2 ∣ λ 1 + λ d ∣ \eta<\frac{-2}{\lambda_1+\lambda_d}=\frac{2}{\lvert\lambda_1+\lambda_d\rvert} η < λ 1 + λ d − 2 = ∣ λ 1 + λ d ∣ 2 .
When k > 1 k>1 k > 1 (consensus at non-principal eigenvectors), then one of the eigenvalues of J ( v k ) J(v_k) J ( v k ) is 1 + η λ 1 ∣ 1 + η λ k ∣ \frac{1+\eta\lambda_1}{\lvert1+\eta\lambda_k\rvert} ∣ 1 + η λ k ∣ 1 + η λ 1 which is always > 1 >1 > 1 . This is obvious when λ k ≥ 0 \lambda_k\ge0 λ k ≥ 0 , as λ k < λ 1 \lambda_k<\lambda_1 λ k < λ 1 . What needs to be checked is the case of λ k \lambda_k λ k negative with − λ k ≫ λ 1 -\lambda_k\gg\lambda_1 − λ k ≫ λ 1 . For this case we consider the two situations
If 1 + η λ k > 0 1+\eta\lambda_k>0 1 + η λ k > 0 , then we have 1 + η λ 1 1 + η λ k > 1 \frac{1+\eta\lambda_1}{1+\eta\lambda_k}>1 1 + η λ k 1 + η λ 1 > 1 because this is equivalent to 1 + η λ 1 > 1 + η λ k 1+\eta\lambda_1>1+\eta\lambda_k 1 + η λ 1 > 1 + η λ k .
If 1 + η λ k < 0 1+\eta\lambda_k<0 1 + η λ k < 0 , then we must show that it is − 1 + η λ 1 1 + η λ k > 1 -\frac{1+\eta\lambda_1}{1+\eta\lambda_k}>1 − 1 + η λ k 1 + η λ 1 > 1 , i.e., that 1 + η λ 1 > − 1 − η λ k 1+\eta\lambda_1>-1-\eta\lambda_k 1 + η λ 1 > − 1 − η λ k , or η ( λ 1 + λ k ) > − 2 \eta(\lambda_1+\lambda_k)>-2 η ( λ 1 + λ k ) > − 2 . As λ 1 + λ k < 0 \lambda_1+\lambda_k<0 λ 1 + λ k < 0 , the expression holds if it holds for the largest possible value of η \eta η . Taking η = 2 ∣ λ 1 + λ d ∣ \eta=\frac{2}{\lvert\lambda_1+\lambda_d\rvert} η = ∣ λ 1 + λ d ∣ 2 , we obtain the following inequality − 2 ( λ 1 + λ k ) λ 1 + λ d > − 2 -\frac{2(\lambda_1+\lambda_k)}{\lambda_1+\lambda_d}>-2 − λ 1 + λ d 2 ( λ 1 + λ k ) > − 2 , or, equivalently, λ 1 + λ k > λ 1 + λ d \lambda_1+\lambda_k>\lambda_1+\lambda_d λ 1 + λ k > λ 1 + λ d which is always true.
In both situations J ( v k ) J(v_k) J ( v k ) has an eigenvalue outside the unit disk.
At a bipartite consensus point x i = ± v k x_i=\pm v_k x i = ± v k , split the n n n tokens into two sets V 1 V_1 V 1 and V 2 V_2 V 2 , V 1 ∪ V 2 = { 1 , … , n } V_1\cup V_2=\{1,\ldots,n\} V 1 ∪ V 2 = { 1 , … , n } , according to whether x i = v k x_i=v_k x i = v k or x i = − v k x_i=-v_k x i = − v k at equilibrium. Assume that n 1 = ∣ V 1 ∣ n_1=\lvert V_1\rvert n 1 = ∣ V 1 ∣ tokens are equal to v k v_k v k and n 2 = ∣ V 2 ∣ n_2=\lvert V_2\rvert n 2 = ∣ V 2 ∣ equal to − v k -v_k − v k , with n 1 + n 2 = n n_1+n_2=n n 1 + n 2 = n . Let ν = n 1 − n 2 n \nu=\frac{n_1-n_2}{n} ν = n n 1 − n 2 , where we consider w.l.o.g. n 1 ≥ n 2 n_1\ge n_2 n 1 ≥ n 2 (hence ν ≥ 0 \nu\ge0 ν ≥ 0 ).
Lemma 5. For the system (2) , under Assumption 1, the bipartite consensus equilibria, x i = ± v k ∀ i x_i=\pm v_k\ \forall i x i = ± v k ∀ i are all unstable ∀ k = 1 , … , d \forall k=1,\ldots,d ∀ k = 1 , … , d and ∀ η > 0 \forall\eta>0 ∀ η > 0 .
Proof. At a bipartite consensus equilibrium there exists at least one index i ∈ V 1 i\in V_1 i ∈ V 1 . Consider the perturbation x i = v k + w i x_i=v_k+w_i x i = v k + w i with v k T w i = 0 ∀ i v_k^T w_i=0\ \forall i v k T w i = 0 ∀ i . For this perturbation, the unnormalized next iterate is
x ~ i = v k + w i + η n F V ∑ j ( v k + w j ) = ( 1 + η ν λ k ) v k + w i + η n F V ∑ j w j \begin{aligned}
\widetilde{x}_i=v_k+w_i+\frac{\eta}{n}F_V\sum_j(v_k+w_j) \\
&=\left(1+\eta\nu\lambda_k\right)v_k+w_i+\frac{\eta}{n}F_V\sum_j w_j
\end{aligned} x i = v k + w i + n η F V j ∑ ( v k + w j ) = ( 1 + η ν λ k ) v k + w i + n η F V j ∑ w j
and its norm
∥ x ~ i ∥ = ( α 2 ( 1 + ∥ u i ∥ 2 α 2 ) ) 1 2 \lVert\widetilde{x}_i\rVert=\left(\alpha^2\left(1+\frac{\lVert u_i\rVert^2}{\alpha^2}\right)\right)^{\frac{1}{2}} ∥ x i ∥ = ( α 2 ( 1 + α 2 ∥ u i ∥ 2 ) ) 2 1
where α : = 1 + η ν λ k \alpha:=1+\eta\nu\lambda_k α := 1 + η ν λ k , u i : = w i + η n F V ∑ j w j u_i:=w_i+\frac{\eta}{n}F_V\sum_j w_j u i := w i + n η F V ∑ j w j , and we have used v k T v k = 1 v_k^Tv_k=1 v k T v k = 1 and v k T w i = 0 v_k^Tw_i=0 v k T w i = 0 . Hence, using the binomial series expansion ( ( 1 + ξ ) 1 2 ≈ 1 − ξ 2 + h.o.t. ) \left((1+\xi)^{\frac{1}{2}}\approx1-\frac{\xi}{2}+\text{h.o.t.}\right) ( ( 1 + ξ ) 2 1 ≈ 1 − 2 ξ + h.o.t. ) ,
x i + = x ~ i ∥ x ~ i ∥ = α v k + u i α ( 1 + ∥ u i ∥ 2 α 2 ) 1 2 ≈ v k + u i α + h.o.t. = v k + w i + η n F V ∑ j w j 1 + η ν λ k + h.o.t. ≈ v k + ( 1 − η ν λ k ) ( w i + η n F V ∑ j w j ) \begin{aligned}
x_i^+=\frac{\widetilde{x}_i}{\lVert\widetilde{x}_i\rVert}=\frac{\alpha v_k+u_i}{\alpha\left(1+\frac{\lVert u_i\rVert^2}{\alpha^2}\right)^{\frac{1}{2}}}\approx v_k+\frac{u_i}{\alpha}+\text{h.o.t.} \\
&=v_k+\frac{w_i+\frac{\eta}{n}F_V\sum_j w_j}{1+\eta\nu\lambda_k}+\text{h.o.t.} \\
&\approx v_k+(1-\eta\nu\lambda_k)\left(w_i+\frac{\eta}{n}F_V\sum_j w_j\right)
\end{aligned} x i + = ∥ x i ∥ x i = α ( 1 + α 2 ∥ u i ∥ 2 ) 2 1 α v k + u i ≈ v k + α u i + h.o.t. = v k + 1 + η ν λ k w i + n η F V ∑ j w j + h.o.t. ≈ v k + ( 1 − η ν λ k ) ( w i + n η F V j ∑ w j )
where we have used the expansion 1 1 + η ν λ k ≈ 1 − η ν λ k \frac{1}{1+\eta\nu\lambda_k}\approx1-\eta\nu\lambda_k 1 + η ν λ k 1 ≈ 1 − η ν λ k . The linearized equation is then
w i + = ( 1 − η ν λ k ) w i + η n F V ∑ j w j . w_i^+=(1-\eta\nu\lambda_k)w_i+\frac{\eta}{n}F_V\sum_j w_j. w i + = ( 1 − η ν λ k ) w i + n η F V j ∑ w j .
Expanding all w i w_i w i in the orthonormal basis v 1 , … , v d v_1,\ldots,v_d v 1 , … , v d , and denoting w i = ∑ ℓ ξ i ℓ v ℓ w_i=\sum_\ell\xi_i^\ell v_\ell w i = ∑ ℓ ξ i ℓ v ℓ ,
w i + = ∑ ℓ ( ξ i ℓ ) + v ℓ = ( 1 − η ν λ k ) ∑ ℓ ξ i ℓ v ℓ + η n ∑ j , ℓ ξ j ℓ λ ℓ v ℓ . w_i^+=\sum_\ell(\xi_i^\ell)^+v_\ell=(1-\eta\nu\lambda_k)\sum_\ell\xi_i^\ell v_\ell+\frac{\eta}{n}\sum_{j,\ell}\xi_j^\ell\lambda_\ell v_\ell. w i + = ℓ ∑ ( ξ i ℓ ) + v ℓ = ( 1 − η ν λ k ) ℓ ∑ ξ i ℓ v ℓ + n η j , ℓ ∑ ξ j ℓ λ ℓ v ℓ .
Projecting along v 1 v_1 v 1 ,
( ξ i 1 ) + = ( 1 − η ν λ k ) ξ i 1 + η n λ 1 ∑ j ξ j 1 . (\xi_i^1)^+=(1-\eta\nu\lambda_k)\xi_i^1+\frac{\eta}{n}\lambda_1\sum_j\xi_j^1. ( ξ i 1 ) + = ( 1 − η ν λ k ) ξ i 1 + n η λ 1 j ∑ ξ j 1 .
If ξ 1 : = [ ξ 1 1 … ξ n 1 ] T \xi_1:=[\xi_1^1\ldots\xi_n^1]^T ξ 1 := [ ξ 1 1 … ξ n 1 ] T , then these n n n difference equations can be written in vector form as
ξ 1 + = ( 1 − η ν λ k ) ξ 1 + η n λ 1 11 T ξ 1 . \xi_1^+=(1-\eta\nu\lambda_k)\xi_1+\frac{\eta}{n}\lambda_1\mathbf{1}\mathbf{1}^T\xi_1. ξ 1 + = ( 1 − η ν λ k ) ξ 1 + n η λ 1 1 1 T ξ 1 .
We need to compute the eigenvalues of the n × n n\times n n × n matrix M ( k , 1 ) = ( 1 − η ν λ k ) I + η n λ 1 11 T M(k,1)=(1-\eta\nu\lambda_k)I+\frac{\eta}{n}\lambda_1\mathbf{1}\mathbf{1}^T M ( k , 1 ) = ( 1 − η ν λ k ) I + n η λ 1 1 1 T . One such eigenvalues is associated to the consensus vector 1 ∈ R d \mathbf{1}\in\mathbb{R}^d 1 ∈ R d :
M ( k , 1 ) 1 = ( 1 − η ν λ k ) 1 + η λ 1 1 = ( 1 − η ν λ k + η λ 1 ) 1. M(k,1)\mathbf{1}=(1-\eta\nu\lambda_k)\mathbf{1}+\eta\lambda_1\mathbf{1}=(1-\eta\nu\lambda_k+\eta\lambda_1)\mathbf{1}. M ( k , 1 ) 1 = ( 1 − η ν λ k ) 1 + η λ 1 1 = ( 1 − η ν λ k + η λ 1 ) 1 .
If k ≠ 1 k\ne1 k = 1 then either λ k > 0 \lambda_k>0 λ k > 0 and λ k < λ 1 \lambda_k<\lambda_1 λ k < λ 1 , or λ k < 0 \lambda_k<0 λ k < 0 . Since ν < 1 \nu<1 ν < 1 , in both cases 1 − η ν λ k + η λ 1 > 1 1-\eta\nu\lambda_k+\eta\lambda_1>1 1 − η ν λ k + η λ 1 > 1 and the bipartite equilibrium point is unstable. If k = 1 k=1 k = 1 , then 1 + η ( 1 − ν ) λ 1 > 1 1+\eta(1-\nu)\lambda_1>1 1 + η ( 1 − ν ) λ 1 > 1 , i.e., also in this case we have found an eigenvalue outside the unit disk, and hence the equilibrium point is unstable. ■
Lemma 6. For the system (2) , under Assumption 1, all polygonal equilibria are unstable.
Proof. At a polygonal equilibrium point x = s = [ s 1 … s n ] x=s=[s_1\ \ldots\ s_n] x = s = [ s 1 … s n ] , consider the perturbation x i = s i + w i x_i=s_i+w_i x i = s i + w i with s i T w i = 0 ∀ i s_i^T w_i=0\ \forall i s i T w i = 0 ∀ i . For this perturbation, the unnormalized next iterate is
x ~ i = s i + w i + η n F V ∑ j ( s j + w j ) = s i + η n F V ∑ j s j + w i + η n F V ∑ j w j = s i + w i + η n F V ∑ j w j . \begin{aligned}
\widetilde{x}_i=s_i+w_i+\frac{\eta}{n}F_V\sum_j(s_j+w_j) \\
&=s_i+\frac{\eta}{n}F_V\sum_j s_j+w_i+\frac{\eta}{n}F_V\sum_j w_j
=s_i+w_i+\frac{\eta}{n}F_V\sum_j w_j.
\end{aligned} x i = s i + w i + n η F V j ∑ ( s j + w j ) = s i + n η F V j ∑ s j + w i + n η F V j ∑ w j = s i + w i + n η F V j ∑ w j .
and its norm
∥ x ~ i ∥ = ( 1 + ∥ u i ∥ 2 + 2 η n s i T F V ∑ j w j ) 1 2 \lVert\widetilde{x}_i\rVert=\left(1+\lVert u_i\rVert^2+2\frac{\eta}{n}s_i^T F_V\sum_j w_j\right)^{\frac12} ∥ x i ∥ = ( 1 + ∥ u i ∥ 2 + 2 n η s i T F V j ∑ w j ) 2 1
where u i : = w i + η n F V ∑ j w j u_i:=w_i+\frac{\eta}{n}F_V\sum_j w_j u i := w i + n η F V ∑ j w j , and we have used s i T w i = 0 s_i^T w_i=0 s i T w i = 0 . Hence, using the binomial series expansion ( 1 + ξ ) − 1 2 ≈ 1 − ξ 2 + h . o . t . (1+\xi)^{-\frac12}\approx1-\frac{\xi}{2}+\mathit{h.o.t.} ( 1 + ξ ) − 2 1 ≈ 1 − 2 ξ + h.o.t. ,
x i + = x ~ i ∥ x ~ i ∥ = s i + u i ( 1 + ∥ u i ∥ 2 + 2 η n s i T F V ∑ j w j ) 1 2 ≈ ( s i + u i ) ( 1 − ∥ u i ∥ 2 2 − η n s i T F V ∑ j w j ) + h . o . t . = s i + w i − η n s i T F V ∑ j w j s i + h . o . t . = s i + w i + η n ( I − s i s i T ) F V ∑ j w j + h . o . t . \begin{aligned}
x_i^+=\frac{\widetilde{x}_i}{\lVert\widetilde{x}_i\rVert}
=\frac{s_i+u_i}{\left(1+\lVert u_i\rVert^2+2\frac{\eta}{n}s_i^T F_V\sum_j w_j\right)^{\frac12}} \\
&\approx(s_i+u_i)\left(1-\frac{\lVert u_i\rVert^2}{2}-\frac{\eta}{n}s_i^T F_V\sum_j w_j\right)+\mathit{h.o.t.} \\
&=s_i+w_i-\frac{\eta}{n}s_i^T F_V\sum_j w_j s_i+\mathit{h.o.t.} \\
&=s_i+w_i+\frac{\eta}{n}(I-s_i s_i^T)F_V\sum_j w_j+\mathit{h.o.t.}
\end{aligned} x i + = ∥ x i ∥ x i = ( 1 + ∥ u i ∥ 2 + 2 n η s i T F V ∑ j w j ) 2 1 s i + u i ≈ ( s i + u i ) ( 1 − 2 ∥ u i ∥ 2 − n η s i T F V j ∑ w j ) + h.o.t. = s i + w i − n η s i T F V j ∑ w j s i + h.o.t. = s i + w i + n η ( I − s i s i T ) F V j ∑ w j + h.o.t.
The linearized equation is then
w i + = w i + η n ( I − s i s i T ) F V ∑ j w j . w_i^+=w_i+\frac{\eta}{n}(I-s_i s_i^T)F_V\sum_j w_j. w i + = w i + n η ( I − s i s i T ) F V j ∑ w j .
Expanding all w i w_i w i and s i s_i s i in the orthonormal basis v 1 , … , v d v_1,\ldots,v_d v 1 , … , v d , and denoting w i = ∑ ℓ ξ ℓ i v ℓ w_i=\sum_\ell\xi_\ell^i v_\ell w i = ∑ ℓ ξ ℓ i v ℓ and s i = ∑ ℓ ζ ℓ i v ℓ s_i=\sum_\ell\zeta_\ell^i v_\ell s i = ∑ ℓ ζ ℓ i v ℓ ,
w i + = ∑ ℓ ( ξ ℓ i ) + v ℓ = ∑ ℓ ξ ℓ i v ℓ + η n ( I − ∑ h ζ h i v h ∑ ℓ ζ ℓ i v ℓ T ) ∑ j , ℓ ξ ℓ j v ℓ = ∑ ℓ ξ ℓ i v ℓ + η n ( I − ∑ h ζ h i v h ∑ ℓ ζ ℓ i ∑ j ξ ℓ j ) . \begin{aligned}
w_i^+=\sum_\ell(\xi_\ell^i)^+v_\ell\\
&=\sum_\ell\xi_\ell^i v_\ell+\frac{\eta}{n}\left(I-\sum_h\zeta_h^i v_h\sum_\ell\zeta_\ell^i v_\ell^T\right)\sum_{j,\ell}\xi_\ell^jv_\ell\\
&=\sum_\ell\xi_\ell^i v_\ell+\frac{\eta}{n}\left(I-\sum_h\zeta_h^i v_h\sum_\ell\zeta_\ell^i\sum_j\xi_\ell^j\right).
\end{aligned} w i + = ℓ ∑ ( ξ ℓ i ) + v ℓ = ℓ ∑ ξ ℓ i v ℓ + n η ( I − h ∑ ζ h i v h ℓ ∑ ζ ℓ i v ℓ T ) j , ℓ ∑ ξ ℓ j v ℓ = ℓ ∑ ξ ℓ i v ℓ + n η ( I − h ∑ ζ h i v h ℓ ∑ ζ ℓ i j ∑ ξ ℓ j ) .
Recall that F V F_V F V has always at least one positive eigenvalue λ 1 > 0 \lambda_1>0 λ 1 > 0 . We can always choose w w w s.t. each w j w_j w j has a nonzero component in the direction of the associated eigenvector v 1 v_1 v 1 : ξ 1 j ≠ 0 \xi_1^j\ne0 ξ 1 j = 0 . Projecting along v 1 v_1 v 1
( ξ 1 i ) + = ξ 1 i + η n ( 1 − ξ 1 i ∑ ℓ ζ ℓ i ∑ j ζ ℓ j ) . (\xi_1^i)^+=\xi_1^i+\frac{\eta}{n}\left(1-\xi_1^i\sum_\ell\zeta_\ell^i\sum_j\zeta_\ell^j\right). ( ξ 1 i ) + = ξ 1 i + n η ( 1 − ξ 1 i ℓ ∑ ζ ℓ i j ∑ ζ ℓ j ) .
If the perturbation is such that w i w_i w i has only a component along v 1 v_1 v 1 , ξ 1 i ≠ 0 \xi_1^i\ne0 ξ 1 i = 0 , ξ ℓ i = 0 ∀ ℓ ≠ i \xi_\ell^i=0\ \forall\ell\ne i ξ ℓ i = 0 ∀ ℓ = i , then
( ξ 1 i ) + = ξ 1 i + η n ( 1 − ( ξ 1 i ) 2 ) λ 1 ∑ j ξ 1 j . (\xi_1^i)^+=\xi_1^i+\frac{\eta}{n}(1-(\xi_1^i)^2)\lambda_1\sum_j\xi_1^j. ( ξ 1 i ) + = ξ 1 i + n η ( 1 − ( ξ 1 i ) 2 ) λ 1 j ∑ ξ 1 j .
If ξ 1 : = [ ξ 1 1 … ξ 1 n ] T \xi_1:=[\xi_1^1\ \ldots\ \xi_1^n]^T ξ 1 := [ ξ 1 1 … ξ 1 n ] T and ζ 1 = [ ζ 1 1 … ζ 1 n ] T \zeta_1=[\zeta_1^1\ \ldots\ \zeta_1^n]^T ζ 1 = [ ζ 1 1 … ζ 1 n ] T , then in vector form
ξ 1 + = ξ 1 + η n λ 1 ( I − Z 1 2 ) 11 T ξ 1 = ( I + η n λ 1 ( I − Z 1 2 ) 11 T ) ξ 1 . \begin{aligned}
\xi_1^+=\xi_1+\frac{\eta}{n}\lambda_1(I-Z_1^2)\mathbf{1}\mathbf{1}^T\xi_1 \\
&=\left(I+\frac{\eta}{n}\lambda_1(I-Z_1^2)\mathbf{1}\mathbf{1}^T\right)\xi_1.
\end{aligned} ξ 1 + = ξ 1 + n η λ 1 ( I − Z 1 2 ) 1 1 T ξ 1 = ( I + n η λ 1 ( I − Z 1 2 ) 1 1 T ) ξ 1 .
where Z 1 = diag ( ζ 1 ) Z_1=\operatorname{diag}(\zeta_1) Z 1 = diag ( ζ 1 ) . Since s s s is not an eigenvector of F V F_V F V , it is ∣ ζ 1 i ∣ < 1 \lvert\zeta_1^i\rvert<1 ∣ ζ 1 i ∣ < 1 . From λ 1 > 0 \lambda_1>0 λ 1 > 0 , it is then ρ ( I + η λ 1 ( I − Z 1 2 ) 11 T ) > 1 \rho(I+\eta\lambda_1(I-Z_1^2)\mathbf{1}\mathbf{1}^T)>1 ρ ( I + η λ 1 ( I − Z 1 2 ) 1 1 T ) > 1 , meaning that when ξ 1 = ϵ 1 \xi_1=\epsilon\mathbf{1} ξ 1 = ϵ 1 for some scalar coefficient ϵ \epsilon ϵ the system diverges, hence the polygonal equilibrium point s s s is unstable. ■
Remark 3 In both Lemma 5 and Lemma 6 the perturbation w i w_i w i used in the proof is “intrinsic”, i.e., it belongs to the tangent space T v k S d − 1 T_{v_k}S^{d-1} T v k S d − 1 resp. T s i S d − 1 T_{s_i}S^{d-1} T s i S d − 1 at the equilibrium point.
For the multiagent Oja system (2) it is also possible to show that the trajectories are generically converging to an equilibrium point.
Lemma 7 The function W ( x ) = − 1 2 n 2 ( ∑ j = 1 n x j T F V ∑ j = 1 n x j ) W(x)=-\frac{1}{2n^2}\left(\sum_{j=1}^n x_j^T F_V\sum_{j=1}^n x_j\right) W ( x ) = − 2 n 2 1 ( ∑ j = 1 n x j T F V ∑ j = 1 n x j ) is a Lyapunov function for (2). When η ≤ 1 2 ∥ F V ∥ \eta\le\frac{1}{2\lVert F_V\rVert} η ≤ 2 ∥ F V ∥ 1 it guarantees that (2) converges to one of the equilibria determined in Lemma 1.
Proof. Since the state space is compact, all functions arising in the expansion of the Lyapunov function W ( x ) W(x) W ( x ) (and hence also of its increment) are uniformly bounded. For the second order truncation of the increment W ( x + ) − W ( x ) W(x^+)-W(x) W ( x + ) − W ( x ) , it is possible to compute an explicit bound on η \eta η for which the increment is guaranteed to be nonincreasing. From (3), using the binomial series expansion ( 1 + ξ ) − 1 2 ≈ 1 − ξ 2 + 3 8 ξ 2 + O ( ξ 3 ) (1+\xi)^{-\frac12}\approx1-\frac{\xi}{2}+\frac{3}{8}\xi^2+O(\xi^3) ( 1 + ξ ) − 2 1 ≈ 1 − 2 ξ + 8 3 ξ 2 + O ( ξ 3 )
x i + = x ~ i ∥ x ~ i ∥ = ( x i + η y ) ( 1 − η x i T y + η 2 2 ( 3 ( x i T y ) 2 − ∥ y ∥ 2 ) + O ( η 3 ) ) = x i + η g i + η 2 ( 3 2 r i 2 x i − 1 2 ∥ y ∥ 2 r i − r i y ) + O ( η 3 ) \begin{aligned}
x_i^+=\frac{\widetilde{x}_i}{\lVert\widetilde{x}_i\rVert} \\
&=(x_i+\eta y)\left(1-\eta x_i^T y+\frac{\eta^2}{2}\left(3(x_i^T y)^2-\lVert y\rVert^2\right)+O(\eta^3)\right) \\
&=x_i+\eta g_i+\eta^2\left(\frac{3}{2}r_i^2x_i-\frac{1}{2}\lVert y\rVert^2r_i-r_i y\right)+O(\eta^3)
\end{aligned} x i + = ∥ x i ∥ x i = ( x i + η y ) ( 1 − η x i T y + 2 η 2 ( 3 ( x i T y ) 2 − ∥ y ∥ 2 ) + O ( η 3 ) ) = x i + η g i + η 2 ( 2 3 r i 2 x i − 2 1 ∥ y ∥ 2 r i − r i y ) + O ( η 3 )
where we have indicated r i : = x i T y r_i:=x_i^T y r i := x i T y and g i = g ( x i ) : = ( I − g_i=g(x_i):=(I- g i = g ( x i ) := ( I − x i x i T ) y x_i x_i^T)y x i x i T ) y . The increment of W W W up to second order in η \eta η is then
W ( x + ) − W ( x ) = − 1 2 n 2 ( ∑ j = 1 n ( x j + ) T F V ∑ j = 1 n x j + − ∑ j = 1 n x j T F V ∑ j = 1 n x j ) = − η 2 2 n 2 ( 2 n y T ∑ j ( 3 2 r i 2 x i − 1 2 ∥ y ∥ 2 x i − r i y ) + ∑ j g j T F V ∑ j g j ) − η n ∑ j g j T y + O ( η 3 ) = − η 2 n ( ∑ j ( 3 2 r j 2 y T x j − 1 2 ∥ y ∥ 2 y T x j − r j y T y ) + 1 2 n ∑ j g j T F V ∑ j g j ) − η n ∑ j ∥ g j ∥ 2 + O ( η 3 ) = − η 2 n ( 3 2 ∑ j r j ( r j 2 − ∥ y ∥ 2 ) + 1 2 n ∑ j g j T F V ∑ j g j ) − η n ∑ j ∥ g j ∥ 2 + O ( η 3 ) = η 2 n ( 3 2 ∑ j r j ∥ g j ∥ 2 − 1 2 n ∑ j g j T F V ∑ j g j ) − η n ∑ j ∥ g j ∥ 2 + O ( η 3 ) . \begin{aligned}
W(x^+) - W(x)
&= -\frac{1}{2n^2}\left(\sum_{j=1}^{n}(x_j^+)^T F_V\sum_{j=1}^{n}x_j^+ - \sum_{j=1}^{n}x_j^T F_V\sum_{j=1}^{n}x_j\right)\\
&= -\frac{\eta^2}{2n^2}\left(2n y^T\sum_j\left(\frac{3}{2}r_i^2x_i-\frac{1}{2}\lVert y\rVert^2x_i-r_i y\right)+\sum_j g_j^T F_V\sum_j g_j\right)-\frac{\eta}{n}\sum_j g_j^T y+O(\eta^3)\\
&= -\frac{\eta^2}{n}\left(\sum_j\left(\frac{3}{2}r_j^2y^T x_j-\frac{1}{2}\lVert y\rVert^2y^T x_j-r_jy^T y\right)+\frac{1}{2n}\sum_j g_j^T F_V\sum_j g_j\right)-\frac{\eta}{n}\sum_j\lVert g_j\rVert^2+O(\eta^3)\\
&= -\frac{\eta^2}{n}\left(\frac{3}{2}\sum_j r_j(r_j^2-\lVert y\rVert^2)+\frac{1}{2n}\sum_j g_j^T F_V\sum_j g_j\right)-\frac{\eta}{n}\sum_j\lVert g_j\rVert^2+O(\eta^3)\\
&= \frac{\eta^2}{n}\left(\frac{3}{2}\sum_j r_j\lVert g_j\rVert^2-\frac{1}{2n}\sum_j g_j^T F_V\sum_j g_j\right)-\frac{\eta}{n}\sum_j\lVert g_j\rVert^2+O(\eta^3).
\end{aligned} W ( x + ) − W ( x ) = − 2 n 2 1 ( j = 1 ∑ n ( x j + ) T F V j = 1 ∑ n x j + − j = 1 ∑ n x j T F V j = 1 ∑ n x j ) = − 2 n 2 η 2 ( 2 n y T j ∑ ( 2 3 r i 2 x i − 2 1 ∥ y ∥ 2 x i − r i y ) + j ∑ g j T F V j ∑ g j ) − n η j ∑ g j T y + O ( η 3 ) = − n η 2 ( j ∑ ( 2 3 r j 2 y T x j − 2 1 ∥ y ∥ 2 y T x j − r j y T y ) + 2 n 1 j ∑ g j T F V j ∑ g j ) − n η j ∑ ∥ g j ∥ 2 + O ( η 3 ) = − n η 2 ( 2 3 j ∑ r j ( r j 2 − ∥ y ∥ 2 ) + 2 n 1 j ∑ g j T F V j ∑ g j ) − n η j ∑ ∥ g j ∥ 2 + O ( η 3 ) = n η 2 ( 2 3 j ∑ r j ∥ g j ∥ 2 − 2 n 1 j ∑ g j T F V j ∑ g j ) − n η j ∑ ∥ g j ∥ 2 + O ( η 3 ) .
where we have used idempotency of the projection ( I − x i x i T ) (I-x_i x_i^T) ( I − x i x i T ) to get
g i T y = y T ( I − x i x i T ) y = y T ( I − x i x i T ) ( I − x i x i T ) y = ∥ g i ∥ 2 ∥ y ∥ 2 − r i 2 = y T y − y T x i x i T y = y T ( I − x i x i T ) y = y T ( I − x i x i T ) ( I − x i x i T ) y = g i T g i = ∥ g i ∥ 2 . \begin{aligned}
g_i^T y&=y^T(I-x_i x_i^T)y\\
&=y^T(I-x_i x_i^T)(I-x_i x_i^T)y=\lVert g_i\rVert^2\\
\lVert y\rVert^2-r_i^2&=y^T y-y^T x_i x_i^T y=y^T(I-x_i x_i^T)y\\
&=y^T(I-x_i x_i^T)(I-x_i x_i^T)y=g_i^Tg_i=\lVert g_i\rVert^2.
\end{aligned} g i T y ∥ y ∥ 2 − r i 2 = y T ( I − x i x i T ) y = y T ( I − x i x i T ) ( I − x i x i T ) y = ∥ g i ∥ 2 = y T y − y T x i x i T y = y T ( I − x i x i T ) y = y T ( I − x i x i T ) ( I − x i x i T ) y = g i T g i = ∥ g i ∥ 2 .
Since ∥ ∑ j g j ∥ 2 ≤ n ∑ j ∥ g j ∥ 2 \left\lVert\sum_j g_j\right\rVert^2\le n\sum_j\lVert g_j\rVert^2 ∑ j g j 2 ≤ n ∑ j ∥ g j ∥ 2 , it is
− n ∥ F V ∥ ∑ j ∥ g j ∥ 2 ≤ ∑ j g j T F V ∑ j g j ≤ n ∥ F V ∥ ∑ j ∥ g j ∥ 2 . -n\lVert F_V\rVert\sum_j\lVert g_j\rVert^2\le\sum_j g_j^T F_V\sum_j g_j\le n\lVert F_V\rVert\sum_j\lVert g_j\rVert^2. − n ∥ F V ∥ j ∑ ∥ g j ∥ 2 ≤ j ∑ g j T F V j ∑ g j ≤ n ∥ F V ∥ j ∑ ∥ g j ∥ 2 .
Furthermore
− ∥ F V ∥ ≤ − ∥ y ∥ ≤ r i ≤ ∥ y ∥ ≤ ∥ F V ∥ . -\lVert F_V\rVert\le-\lVert y\rVert\le r_i\le\lVert y\rVert\le\lVert F_V\rVert. − ∥ F V ∥ ≤ − ∥ y ∥ ≤ r i ≤ ∥ y ∥ ≤ ∥ F V ∥ .
These lead to the inequality
W ( x + ) − W ( x ) ≤ − η n ∑ j ∥ g j ∥ 2 + η 2 n ( 3 2 ∥ F V ∥ ∑ j ∥ g j ∥ 2 + 1 2 ∥ F V ∥ ∑ j ∥ g j ∥ 2 ) W(x^+)-W(x)\le-\frac{\eta}{n}\sum_j\lVert g_j\rVert^2+\frac{\eta^2}{n}\left(\frac{3}{2}\lVert F_V\rVert\sum_j\lVert g_j\rVert^2+\frac{1}{2}\lVert F_V\rVert\sum_j\lVert g_j\rVert^2\right) W ( x + ) − W ( x ) ≤ − n η j ∑ ∥ g j ∥ 2 + n η 2 ( 2 3 ∥ F V ∥ j ∑ ∥ g j ∥ 2 + 2 1 ∥ F V ∥ j ∑ ∥ g j ∥ 2 )
or
W ( x + ) − W ( x ) ≤ η n ( − 1 + 2 η ∥ F V ∥ ) ∑ j ∥ g j ∥ 2 . W(x^+)-W(x)\le\frac{\eta}{n}(-1+2\eta\lVert F_V\rVert)\sum_j\lVert g_j\rVert^2. W ( x + ) − W ( x ) ≤ n η ( − 1 + 2 η ∥ F V ∥) j ∑ ∥ g j ∥ 2 .
Hence when η ≤ 1 2 ∥ F V ∥ \eta\le\frac{1}{2\lVert F_V\rVert} η ≤ 2 ∥ F V ∥ 1 we have W ( x + ) − W ( x ) ≤ 0 W(x^+)-W(x)\le0 W ( x + ) − W ( x ) ≤ 0 . Since the sequence W ( x ( k ) ) W(x(k)) W ( x ( k )) (where k k k is the time index) is nonincreasing and bounded below, it must converge. Moreover, summability of the increments implies ∑ k = 0 ∞ ∑ i = 1 n ∥ g ( x i ( k ) ) ∥ 2 < ∞ \sum_{k=0}^{\infty}\sum_{i=1}^{n}\lVert g(x_i(k))\rVert^2<\infty ∑ k = 0 ∞ ∑ i = 1 n ∥ g ( x i ( k )) ∥ 2 < ∞ , hence ∥ g ( x i ( k ) ) ∥ → 0 \lVert g(x_i(k))\rVert\to0 ∥ g ( x i ( k ))∥ → 0 for each i i i . At an equilibrium point x x x it must then be g ( x i ) = ( I − x i x i T ) y = 0 g(x_i)=(I-x_i x_i^T)y=0 g ( x i ) = ( I − x i x i T ) y = 0 for all i i i , i.e., y y y must be collinear with x i x_i x i . Recalling Lemma 1, this implies that x x x must be a consensus or a bipartite consensus equilibrium point. ■
Proof of Theorem 1 The proof of the theorem is simply the composition of the results of Lemmas 3, 4, 5, 6 and 7. Lemmas 4, 5, 6 say that only the consensus point v 1 v_1 v 1 corresponding to the principal eigenvalue of F V F_V F V is locally asymptotically stable, while all other equilibria are unstable. Since all trajectories of (2) have a limit point, generically such limit point must be v 1 v_1 v 1 . ■
Remark 4 The condition η < min ( 2 ∣ λ 1 + λ d ∣ , 1 2 max { λ 1 , ∣ λ d ∣ } ) \eta<\min\left(\frac{2}{\lvert\lambda_1+\lambda_d\rvert},\frac{1}{2\max\{\lambda_1,\lvert\lambda_d\rvert\}}\right) η < min ( ∣ λ 1 + λ d ∣ 2 , 2 m a x { λ 1 , ∣ λ d ∣} 1 ) is sufficient but not necessary. Recall from Lemma 4 that the condition η < 2 ∣ λ 1 + λ d ∣ \eta<\frac{2}{\lvert\lambda_1+\lambda_d\rvert} η < ∣ λ 1 + λ d ∣ 2 is needed only when ∣ λ d ∣ > λ 1 \lvert\lambda_d\rvert>\lambda_1 ∣ λ d ∣ > λ 1 .
Single-head self-attention dynamics
Let us now consider the self-attention system (1), which includes the attention matrix A ( x ) A(x) A ( x ) . For this model, an “individual” weighted average with state dependent weights given by the attention coefficients, m i = m i ( x ) = ∑ j = 1 n A i j ( x ) x j m_i=m_i(x)=\sum_{j=1}^{n}A_{ij}(x)x_j m i = m i ( x ) = ∑ j = 1 n A ij ( x ) x j replaces the simple average used in the multiagent Oja model. Consequently, the total action of all agents on agent i i i varies from agent to agent: y i = y i ( x ) = F V ∑ j = 1 n A i j ( x ) x j y_i=y_i(x)=F_V\sum_{j=1}^{n}A_{ij}(x)x_j y i = y i ( x ) = F V ∑ j = 1 n A ij ( x ) x j .
Equilibria
In addition to the three classes of equilibria already obtained for the multiagent Oja flow, in the self-attention dynamics we have an extra class, due to the fact that y i y_i y i now differs from agent to agent.
Lemma 8 The system (1) has the following classes of equilibria
consensus: x i = v k x_i=v_k x i = v k ∀ i \forall i ∀ i , and k = 1 , … , d k=1,\ldots,d k = 1 , … , d ;
bipartite consensus: x i = ± v k x_i=\pm v_k x i = ± v k ∀ i \forall i ∀ i and k = 1 , … , d k=1,\ldots,d k = 1 , … , d ;
polygonal equilibria: { x i ∈ S d − 1 s.t. F V ∑ j = 1 n A i j ( x ) x j = 0 } \{x_i\in\mathbb{S}^{d-1}\ \text{s.t.}\ F_V\sum_{j=1}^{n}A_{ij}(x)x_j=0\} { x i ∈ S d − 1 s.t. F V ∑ j = 1 n A ij ( x ) x j = 0 } , i = 1 , … , n i=1,\ldots,n i = 1 , … , n ;
clustering equilibria: { x i ∈ S d − 1 s.t. φ i x i = F V ∑ j = 1 n A i j ( x ) x j } \{x_i\in\mathbb{S}^{d-1}\ \text{s.t.}\ \varphi_i x_i=F_V\sum_{j=1}^{n}A_{ij}(x)x_j\} { x i ∈ S d − 1 s.t. φ i x i = F V ∑ j = 1 n A ij ( x ) x j } for some scalars φ i \varphi_i φ i , i = 1 , … , n i=1,\ldots,n i = 1 , … , n , k = 1 , … , d k=1,\ldots,d k = 1 , … , d .
Proof. Once we replace y y y with y i = ∑ j = 1 n A i j ( x ) F V x j y_i=\sum_{j=1}^{n}A_{ij}(x)F_Vx_j y i = ∑ j = 1 n A ij ( x ) F V x j , the proof of the first three cases is identical to that of Lemma 1. The clustering equilibria correspond to y i ∈ ker ( I − x i x i T ) y_i\in\ker(I-x_i x_i^T) y i ∈ ker ( I − x i x i T ) , or, equivalently, y i y_i y i aligned with x i x_i x i , i = 1 , … , n i=1,\ldots,n i = 1 , … , n , but not necessarily aligned with an eigenvector v k v_k v k , i.e., y i = φ i x i y_i=\varphi_i x_i y i = φ i x i for some scalar φ i \varphi_i φ i , but possibly y i ∦ v k ∀ k y_i\not\parallel v_k\ \forall k y i ∥ v k ∀ k . ■
Remark 5 Clustering equilibria own their name to the fact that typically multiple agents are found at the same value. In particular we say that x 1 , … , x n x_1,\ldots,x_n x 1 , … , x n are at an m m m -clustering equilibrium point if x i ∈ { w 1 , … , w m } x_i \in\{w_1,\ldots,w_m\} x i ∈ { w 1 , … , w m } with 1 ≤ m ≤ n 1 \leq m \leq n 1 ≤ m ≤ n , i.e., if x 1 , … , x n x_1,\ldots,x_n x 1 , … , x n cluster at the m m m vectors w 1 , … , w m w_1,\ldots,w_m w 1 , … , w m . Notice that some w i w_i w i can be eigenvectors of F V F_V F V .
Remark 6 A clustering equilibrium can be a consensus, i.e, x i = x j x_i=x_j x i = x j for all i , j i,j i , j , but with x i x_i x i which is not aligned with any eigenvector of F V F_V F V , i.e., x i ∦ v k ∀ k x_i \nparallel v_k\ \forall\ k x i ∦ v k ∀ k . We refer to these as 1-clustering, while the “consensus” characterization is reserved for the case x i ∥ v k x_i\parallel v_k x i ∥ v k for some k k k . A 2-clustering instead typically is s.t. x i ∈ { w 1 , w 2 } ∀ i x_i\in\{w_1,w_2\}\ \forall\ i x i ∈ { w 1 , w 2 } ∀ i , with w 1 ≠ − w 2 w_1\ne-w_2 w 1 = − w 2 .
Proposition 1 The system (1) has a clustering equilibrium x ∈ ( S d − 1 ) n x\in(\mathbb{S}^{d-1})^n x ∈ ( S d − 1 ) n iff ∃ \exists ∃ scalars θ 1 , … , θ n \theta_1,\ldots,\theta_n θ 1 , … , θ n s.t. the matrix I n ⊗ I d − ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) I_n\otimes I_d-(\Theta\otimes I_d)(A(x)\otimes I_d)(I_n\otimes F_V) I n ⊗ I d − ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) is singular, where Θ = diag ( θ 1 , … , θ n ) \Theta=\operatorname{diag}(\theta_1,\ldots,\theta_n) Θ = diag ( θ 1 , … , θ n ) .
Proof. In vector form, the clustering equilibrium condition x i = θ i F V ∑ j = 1 n A i j ( x ) x j x_i=\theta_iF_V\sum_{j=1}^n A_{ij}(x)x_j x i = θ i F V ∑ j = 1 n A ij ( x ) x j becomes x = ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) x x=(\Theta\otimes I_d)(A(x)\otimes I_d)(I_n\otimes F_V)x x = ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) x , where x T = [ x 1 T ⋯ x n T ] x^T=[x_1^T\ \cdots\ x_n^T] x T = [ x 1 T ⋯ x n T ] . Rewriting it as ( I n ⊗ I d − ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) ) x = 0 (I_n\otimes I_d-(\Theta\otimes I_d)(A(x)\otimes I_d)(I_n\otimes F_V))x=0 ( I n ⊗ I d − ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V )) x = 0 , the algebraic equation has nontrivial solutions if and only if the matrix I n ⊗ I d − ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) I_n\otimes I_d-(\Theta\otimes I_d)(A(x)\otimes I_d)(I_n\otimes F_V) I n ⊗ I d − ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) is singular.
Remark 7 From the proof of Proposition 1, it is x = ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) x x=(\Theta\otimes I_d)(A(x)\otimes I_d)(I_n\otimes F_V)x x = ( Θ ⊗ I d ) ( A ( x ) ⊗ I d ) ( I n ⊗ F V ) x , where x T = [ x 1 T ⋯ x n T ] x^T=[x_1^T\ \cdots\ x_n^T] x T = [ x 1 T ⋯ x n T ] . It follows that if x 1 , … , x n x_1,\ldots,x_n x 1 , … , x n form an m m m -clustering equilibrium point, then also the antipodal point − x 1 , … , − x n -x_1,\ldots,-x_n − x 1 , … , − x n is an m m m -clustering equilibrium point because A ( x ) = A ( − x ) A(x)=A(-x) A ( x ) = A ( − x ) . If in a clustering equilibrium only some (but not all) x i x_i x i flip sign, then the new state is typically no longer an equilibrium point.
While the attention matrix A ( x ) A(x) A ( x ) is a function of the state even at the equilibrium point (with the exception of a consensus state), its rank is however fixed for various classes of equilibria.
Lemma 9 For a consensus state x i = v k ∀ i x_i=v_k\ \forall\ i x i = v k ∀ i we have A i j ( x ) = 1 n A_{ij}(x)=\frac{1}{n} A ij ( x ) = n 1 , i.e., the attention matrix A ( x ) A(x) A ( x ) is the rank-1 uniform matrix A ( x ) = 1 n 11 T A(x)=\frac{1}{n}\mathbf{1}\mathbf{1}^T A ( x ) = n 1 1 1 T . For a bipartite consensus state x i = ± v k ∀ i x_i=\pm v_k\ \forall\ i x i = ± v k ∀ i , the attention matrix A ( x ) A(x) A ( x ) has rank 2. For an m m m -clustering equilibrium x x x the rank of A ( x ) A(x) A ( x ) is m m m .
Proof. At a consensus equilibrium x i = v k x_i=v_k x i = v k for all i i i , and A i j ( x ) A_{ij}(x) A ij ( x ) is composed of all equal terms
A i j ( x ) = e v k T F Q T F K v k ∑ ℓ = 1 n e v k T F Q T F K v k = 1 n . A_{ij}(x)=\frac{e^{v_k^T F_Q^T F_K v_k}}{\sum_{\ell=1}^n e^{v_k^T F_Q^T F_K v_k}}=\frac{1}{n}. A ij ( x ) = ∑ ℓ = 1 n e v k T F Q T F K v k e v k T F Q T F K v k = n 1 .
At a bipartite consensus point x i = ± v k x_i=\pm v_k x i = ± v k , split the n n n tokens into two sets V 1 \mathcal{V}_1 V 1 and V 2 \mathcal{V}_2 V 2 , V 1 ∪ V 2 = { 1 , … , n } \mathcal{V}_1\cup\mathcal{V}_2=\{1,\ldots,n\} V 1 ∪ V 2 = { 1 , … , n } , according to whether x i = v k x_i=v_k x i = v k or x i = − v k x_i=-v_k x i = − v k at equilibrium. Assume that n 1 = ∣ V 1 ∣ n_1=|\mathcal{V}_1| n 1 = ∣ V 1 ∣ tokens are equal to v k v_k v k and n 2 = ∣ V 2 ∣ n_2=|\mathcal{V}_2| n 2 = ∣ V 2 ∣ equal to − v k -v_k − v k , with n 1 + n 2 = n n_1+n_2=n n 1 + n 2 = n . Four different entries appear in A i j ( x ) A_{ij}(x) A ij ( x ) , two due to the denominator (depending on whether x i = v k x_i=v_k x i = v k or x i = − v k x_i=-v_k x i = − v k ), and two due to the numerator (depending on whether x i x_i x i and x j x_j x j have the same sign). More specifically, denoting α 1 k = e v k T F Q T F K v k \alpha_1^k=e^{v_k^T F_Q^T F_Kv_k} α 1 k = e v k T F Q T F K v k and α 2 k = e − v k T F Q T F K v k \alpha_2^k=e^{-v_k^T F_Q^T F_Kv_k} α 2 k = e − v k T F Q T F K v k , then the entries of the attention matrix are
A i j ( x ) = { α 1 k n 1 α 1 k + n 2 α 2 k if i ∈ V 1 , j ∈ V 1 α 2 k n 1 α 1 k + n 2 α 2 k if i ∈ V 1 , j ∈ V 2 α 2 k n 1 α 2 k + n 2 α 1 k if i ∈ V 2 , j ∈ V 1 α 1 k n 1 α 2 k + n 2 α 1 k if i ∈ V 2 , j ∈ V 2 . A_{ij}(x)=
\begin{cases}
\frac{\alpha_1^k}{n_1\alpha_1^k+n_2\alpha_2^k} & \text{if }i\in\mathcal{V}_1,j\in\mathcal{V}_1\\
\frac{\alpha_2^k}{n_1\alpha_1^k+n_2\alpha_2^k} & \text{if }i\in\mathcal{V}_1,j\in\mathcal{V}_2\\
\frac{\alpha_2^k}{n_1\alpha_2^k+n_2\alpha_1^k} & \text{if }i\in\mathcal{V}_2,j\in\mathcal{V}_1\\
\frac{\alpha_1^k}{n_1\alpha_2^k+n_2\alpha_1^k} & \text{if }i\in\mathcal{V}_2,j\in\mathcal{V}_2.
\end{cases} A ij ( x ) = ⎩ ⎨ ⎧ n 1 α 1 k + n 2 α 2 k α 1 k n 1 α 1 k + n 2 α 2 k α 2 k n 1 α 2 k + n 2 α 1 k α 2 k n 1 α 2 k + n 2 α 1 k α 1 k if i ∈ V 1 , j ∈ V 1 if i ∈ V 1 , j ∈ V 2 if i ∈ V 2 , j ∈ V 1 if i ∈ V 2 , j ∈ V 2 .
Letting β 1 k = n 1 α 1 k + n 2 α 2 k \beta_1^k=n_1\alpha_1^k+n_2\alpha_2^k β 1 k = n 1 α 1 k + n 2 α 2 k , and β 2 k = n 1 α 2 k + n 2 α 1 k \beta_2^k=n_1\alpha_2^k+n_2\alpha_1^k β 2 k = n 1 α 2 k + n 2 α 1 k and assuming w.l.o.g. that the first n 1 n_1 n 1 agents are in V 1 \mathcal{V}_1 V 1 and the last n 2 n_2 n 2 in V 2 \mathcal{V}_2 V 2 , the attention matrix is
A ( x ) = [ 1 β 1 k ( α 1 k ⋯ α 1 k α 2 k ⋯ α 2 k ) ⋮ ⋮ ⋮ 1 β 1 k ( α 1 k ⋯ α 1 k α 2 k ⋯ α 2 k ) 1 β 2 k ( α 2 k ⋯ α 2 k α 1 k ⋯ α 1 k ) ⋮ ⋮ ⋮ 1 β 2 k ( α 2 k ⋯ α 2 k α 1 k ⋯ α 1 k ) ] . (6) A(x)=
\begin{bmatrix}
\frac{1}{\beta_1^k}(\alpha_1^k\ \cdots\ \alpha_1^k\ \alpha_2^k\ \cdots\ \alpha_2^k)\\
\vdots\qquad\qquad\vdots\qquad\qquad\vdots\\
\frac{1}{\beta_1^k}(\alpha_1^k\ \cdots\ \alpha_1^k\ \alpha_2^k\ \cdots\ \alpha_2^k)\\
\frac{1}{\beta_2^k}(\alpha_2^k\ \cdots\ \alpha_2^k\ \alpha_1^k\ \cdots\ \alpha_1^k)\\
\vdots\qquad\qquad\vdots\qquad\qquad\vdots\\
\frac{1}{\beta_2^k}(\alpha_2^k\ \cdots\ \alpha_2^k\ \alpha_1^k\ \cdots\ \alpha_1^k)
\end{bmatrix}. \tag*{(6)} A ( x ) = β 1 k 1 ( α 1 k ⋯ α 1 k α 2 k ⋯ α 2 k ) ⋮ ⋮ ⋮ β 1 k 1 ( α 1 k ⋯ α 1 k α 2 k ⋯ α 2 k ) β 2 k 1 ( α 2 k ⋯ α 2 k α 1 k ⋯ α 1 k ) ⋮ ⋮ ⋮ β 2 k 1 ( α 2 k ⋯ α 2 k α 1 k ⋯ α 1 k ) . (6)
from which it is obvious that the rank must be 2.
As for an m m m -clustering equilibrium point with vectors w 1 , … , w m w_1,\ldots,w_m w 1 , … , w m , following a similar procedure it is easy to realize that since w i ≠ w j w_i\ne w_j w i = w j and F Q T F K F_Q^TF_K F Q T F K is not symmetric, there are m 2 m^2 m 2 different entries in the numerators of A i j A_{ij} A ij , and only m m m in the denominators. Rearranging the entries as in (6), each row of A A A has exactly m m m different terms, and a block counting argument leads to rank ( A ) = m \operatorname{rank}(A)=m rank ( A ) = m . ▪
Stability analysis
As in the proof of Lemma 9, let α 1 k = e v k T F Q T F K v k \alpha_1^k=e^{v_k^TF_Q^TF_Kv_k} α 1 k = e v k T F Q T F K v k , α 2 k = e − v k T F Q T F K v k \alpha_2^k=e^{-v_k^TF_Q^TF_Kv_k} α 2 k = e − v k T F Q T F K v k and β 1 k = n 1 α 1 k + n 2 α 2 k \beta_1^k=n_1\alpha_1^k+n_2\alpha_2^k β 1 k = n 1 α 1 k + n 2 α 2 k , β 2 k = n 1 α 2 k + n 2 α 1 k \beta_2^k=n_1\alpha_2^k+n_2\alpha_1^k β 2 k = n 1 α 2 k + n 2 α 1 k . Denote also γ 1 k = n 1 α 1 k − n 2 α 2 k β 1 k \gamma_1^k=\frac{n_1\alpha_1^k-n_2\alpha_2^k}{\beta_1^k} γ 1 k = β 1 k n 1 α 1 k − n 2 α 2 k and γ 2 k = n 2 α 1 k − n 1 α 2 k β 2 k \gamma_2^k=\frac{n_2\alpha_1^k-n_1\alpha_2^k}{\beta_2^k} γ 2 k = β 2 k n 2 α 1 k − n 1 α 2 k .
Theorem 2 For the self-attention dynamics (1), under Assumption 1, and, if − λ d > λ 1 -\lambda_d>\lambda_1 − λ d > λ 1 , for η < min { 1 ∣ λ 1 + λ d ∣ , 1 ∣ λ d ∣ } \eta<\min\left\{\frac{1}{|\lambda_1+\lambda_d|},\frac{1}{|\lambda_d|}\right\} η < min { ∣ λ 1 + λ d ∣ 1 , ∣ λ d ∣ 1 } the consensus equilibrium x i = v 1 ∀ i x_i=v_1\ \forall i x i = v 1 ∀ i is a principal eigenvector v 1 v_1 v 1 of F V F_V F V is always locally asymptotically stable, while the other consensus equilibria v k v_k v k , k = 2 , … , d k=2,\ldots,d k = 2 , … , d , are all unstable. A bipartite consensus equilibrium x i = ± v k ∀ i x_i=\pm v_k\ \forall i x i = ± v k ∀ i is asymptotically stable if η < min ( 1 λ 1 , 1 ∣ λ d ∣ ) \eta<\min\left(\frac{1}{\lambda_1},\frac{1}{|\lambda_d|}\right) η < min ( λ 1 1 , ∣ λ d ∣ 1 ) and the following inequalities are all satisfied
∣ 1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k ∣ 1 + η λ k γ 1 k < 1 \frac{|1-(1-\eta\lambda_k\gamma_1^k)\eta\lambda_k\gamma_1^k|}{1+\eta\lambda_k\gamma_1^k}<1 1 + η λ k γ 1 k ∣1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k ∣ < 1 , i = 1 , 2 i=1,2 i = 1 , 2 ;
a j k d j k − b j k c j k < 1 a_j^kd_j^k-b_j^kc_j^k<1 a j k d j k − b j k c j k < 1 and a j k + d j k < 1 + a j k d j k − b j k c j k a_j^k+d_j^k<1+a_j^kd_j^k-b_j^kc_j^k a j k + d j k < 1 + a j k d j k − b j k c j k , ∀ j = 1 , … , k − 1 , k + 1 , … , d \forall j=1,\ldots,k-1,k+1,\ldots,d ∀ j = 1 , … , k − 1 , k + 1 , … , d , where
a j k = 1 + η n 1 α 1 k β 1 k λ j 1 + η λ k γ 1 k , b j k = η n 2 α 2 k β 1 k λ j 1 + η λ k γ 1 k , a_j^k=\frac{1+\eta n_1\frac{\alpha_1^k}{\beta_1^k}\lambda_j}{1+\eta\lambda_k\gamma_1^k},\quad
b_j^k=\frac{\eta n_2\frac{\alpha_2^k}{\beta_1^k}\lambda_j}{1+\eta\lambda_k\gamma_1^k}, a j k = 1 + η λ k γ 1 k 1 + η n 1 β 1 k α 1 k λ j , b j k = 1 + η λ k γ 1 k η n 2 β 1 k α 2 k λ j , c j k = η n 1 α 2 k β 2 k λ j 1 + η λ k γ 2 k , d j k = 1 + η n 2 α 1 k β 2 k λ j 1 + η λ k γ 2 k ; (7) c_j^k=\frac{\eta n_1\frac{\alpha_2^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_2^k},\quad
d_j^k=\frac{1+\eta n_2\frac{\alpha_1^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_2^k}; \tag*{(7)} c j k = 1 + η λ k γ 2 k η n 1 β 2 k α 2 k λ j , d j k = 1 + η λ k γ 2 k 1 + η n 2 β 2 k α 1 k λ j ; (7) 1 1 + η λ k γ i k < 1 \frac{1}{1+\eta\lambda_k\gamma_i^k}<1 1 + η λ k γ i k 1 < 1 , i = 1 , 2 i=1,2 i = 1 , 2 .
All polygonal equilibria are unstable.
The proof, based on Lyapunov indirect method, is broken down into various lemmas. As in Section III, let f i ( x ) f_i(x) f i ( x ) be the right-hand side of (1) and f ( x ) f(x) f ( x ) its vectorization. Let also χ ( x ) : = ∥ x i + η F V ∑ j A i j ( x ) x j ∥ \chi(x) := \lVert x_i+\eta F_V\sum_j A_{ij}(x)x_j\rVert χ ( x ) := ∥ x i + η F V ∑ j A ij ( x ) x j ∥ . The (extrinsic, see Remark 2) Jacobian of f ( x ) f(x) f ( x ) is as follows.
Lemma 10 The Jacobian of (1), J ( x ) = ∂ f ( x ) ∂ x = [ ∂ f i ( x ) ∂ x h ] J(x)=\frac{\partial f(x)}{\partial x}=\left[\frac{\partial f_i(x)}{\partial x_h}\right] J ( x ) = ∂ x ∂ f ( x ) = [ ∂ x h ∂ f i ( x ) ] , has the following blocks:
∂ f i ( x ) ∂ x h = I δ i h + η F V ( ∑ j x j ∂ A i j ( x ) ∂ x h + A i h ( x ) I ) χ ( x ) − ( x i + η F V ∑ j A i j ( x ) x j ) ∂ ∂ x h χ ( x ) χ ( x ) 2 (8) \frac{\partial f_i(x)}{\partial x_h}=
\frac{I\delta_{ih}+\eta F_V\left(\sum_jx_j\frac{\partial A_{ij}(x)}{\partial x_h}+A_{ih}(x)I\right)}{\chi(x)}
-\frac{\left(x_i+\eta F_V\sum_jA_{ij}(x)x_j\right)\frac{\partial}{\partial x_h}\chi(x)}{\chi(x)^2} \tag*{(8)} ∂ x h ∂ f i ( x ) = χ ( x ) I δ ih + η F V ( ∑ j x j ∂ x h ∂ A ij ( x ) + A ih ( x ) I ) − χ ( x ) 2 ( x i + η F V ∑ j A ij ( x ) x j ) ∂ x h ∂ χ ( x ) (8) where
∂ A i j ( x ) ∂ x h = ( − x i T F Q T F F A i h ( x ) + x i T F Q T F F δ j h + ( x j T F K T F Q − ∑ ℓ x ℓ T F K T F Q A i ℓ ( x ) ) δ i h ) A i j ( x ) (9) \frac{\partial A_{ij}(x)}{\partial x_h}
=
\left(-x_i^TF_Q^TF_FA_{ih}(x)+x_i^TF_Q^TF_F\delta_{jh}
+\left(x_j^TF_K^TF_Q-\sum_\ell x_\ell^TF_K^TF_QA_{i\ell}(x)\right)\delta_{ih}\right)A_{ij}(x) \tag*{(9)} ∂ x h ∂ A ij ( x ) = ( − x i T F Q T F F A ih ( x ) + x i T F Q T F F δ j h + ( x j T F K T F Q − ℓ ∑ x ℓ T F K T F Q A i ℓ ( x ) ) δ ih ) A ij ( x ) (9) and
∂ χ ( x ) ∂ x h = ( ∑ j x j ∂ A i j ( x ) ∂ x h + A i h ( x ) I ) ⋅ ( η x i T F V + η 2 ∑ j x j T A i j ( x ) F V T ( I − x i x i T ) F V ) + ( ( η − η 2 x i T F V ∑ j A i j ( x ) x j ) ∑ j A i j ( x ) x j T F V T ) δ i h (10) \begin{aligned}
\frac{\partial\chi(x)}{\partial x_h}
={}&\left(\sum_jx_j\frac{\partial A_{ij}(x)}{\partial x_h}+A_{ih}(x)I\right)\\
&\cdot\left(\eta x_i^TF_V+\eta^2\sum_jx_j^TA_{ij}(x)F_V^T(I-x_ix_i^T)F_V\right)\\
&+\left(\left(\eta-\eta^2x_i^TF_V\sum_jA_{ij}(x)x_j\right)\sum_jA_{ij}(x)x_j^TF_V^T\right)\delta_{ih} \tag*{(10)}
\end{aligned} ∂ x h ∂ χ ( x ) = ( j ∑ x j ∂ x h ∂ A ij ( x ) + A ih ( x ) I ) ⋅ ( η x i T F V + η 2 j ∑ x j T A ij ( x ) F V T ( I − x i x i T ) F V ) + ( ( η − η 2 x i T F V j ∑ A ij ( x ) x j ) j ∑ A ij ( x ) x j T F V T ) δ ih (10)
Proof. The partial derivatives of A i j ( x ) A_{ij}(x) A ij ( x ) are
∂ A i j ( x ) ∂ x h = ∂ ∂ x h e ⟨ F Q x i , F K x j ⟩ ∑ ℓ = 1 n e ⟨ F Q x i , F K x ℓ ⟩ = − x i T F Q T F K A i j ( x ) A i h ( x ) + x i T F Q T F K A i j ( x ) δ j h + x j T F K T F Q A i j ( x ) δ i h − ∑ ℓ x ℓ T F K T F Q A i ℓ ( x ) A i j ( x ) δ i h \begin{aligned}
\frac{\partial A_{ij}(x)}{\partial x_h}
&=\frac{\partial}{\partial x_h}
\frac{e^{\langle F_Qx_i,F_Kx_j\rangle}}{\sum_{\ell=1}^{n}e^{\langle F_Qx_i,F_Kx_\ell\rangle}}\\
&=-x_i^TF_Q^TF_KA_{ij}(x)A_{ih}(x)\\
&\quad+x_i^TF_Q^TF_KA_{ij}(x)\delta_{jh}\\
&\quad+x_j^TF_K^TF_QA_{ij}(x)\delta_{ih}\\
&\quad-\sum_\ell x_\ell^TF_K^TF_QA_{i\ell}(x)A_{ij}(x)\delta_{ih}
\end{aligned} ∂ x h ∂ A ij ( x ) = ∂ x h ∂ ∑ ℓ = 1 n e ⟨ F Q x i , F K x ℓ ⟩ e ⟨ F Q x i , F K x j ⟩ = − x i T F Q T F K A ij ( x ) A ih ( x ) + x i T F Q T F K A ij ( x ) δ j h + x j T F K T F Q A ij ( x ) δ ih − ℓ ∑ x ℓ T F K T F Q A i ℓ ( x ) A ij ( x ) δ ih
or (9) after regrouping. Similarly to the proof of Lemma 2, the series expansion of the normed term is
χ ( x ) = ( ( x i + η y i ) T ( x i + η y i ) ) 1 2 ≈ 1 + 1 2 ( 2 η x i T y i + η 2 ∥ y i ∥ 2 ) − 1 2 η 2 ( x i T y i ) 2 + O ( η 3 ) = 1 + η x i T F V ∑ j A i j ( x ) x j + η 2 2 ( ∑ j A i j ( x ) x j T F V T F V ⋅ ∑ j A i j ( x ) x j − ( x i T F V ∑ j A i j ( x ) x j ) 2 ) + O ( η 3 ) \begin{aligned}
\chi(x)
&=\left((x_i+\eta y_i)^T(x_i+\eta y_i)\right)^{\frac12}\\
&\approx1+\frac12\left(2\eta x_i^Ty_i+\eta^2\lVert y_i\rVert^2\right)-\frac12\eta^2(x_i^Ty_i)^2+O(\eta^3)\\
&=1+\eta x_i^TF_V\sum_jA_{ij}(x)x_j+\frac{\eta^2}{2}
\left(\sum_jA_{ij}(x)x_j^TF_V^TF_V\right.\\
&\qquad\left.\cdot\sum_jA_{ij}(x)x_j-(x_i^TF_V\sum_jA_{ij}(x)x_j)^2\right)+O(\eta^3)
\end{aligned} χ ( x ) = ( ( x i + η y i ) T ( x i + η y i ) ) 2 1 ≈ 1 + 2 1 ( 2 η x i T y i + η 2 ∥ y i ∥ 2 ) − 2 1 η 2 ( x i T y i ) 2 + O ( η 3 ) = 1 + η x i T F V j ∑ A ij ( x ) x j + 2 η 2 ( j ∑ A ij ( x ) x j T F V T F V ⋅ j ∑ A ij ( x ) x j − ( x i T F V j ∑ A ij ( x ) x j ) 2 ) + O ( η 3 )
Differentiating it
∂ χ ( x ) ∂ x h = η x i T F V ( ∑ j x j ∂ A i j ( x ) ∂ x h + A i h ( x ) I ) + η 2 ( ∑ j x j T A i j ( x ) F V T F V ( ∑ j x j ∂ A i j ( x ) ∂ x h + A i h ( x ) I ) − ( x i T F V ∑ j A i j ( x ) x j ) x i T F V ⋅ ( ∑ j x j ∂ A i j ( x ) ∂ x h + A i h ( x ) I ) ) + ( η ∑ j x j T A i j ( x ) F V T − η 2 ( x i T F V ∑ j A i j ( x ) x j ) ∑ j x j T A i j ( x ) F V T ) δ i h \begin{aligned}
\frac{\partial\chi(x)}{\partial x_h}
={}&\eta x_i^TF_V\left(\sum_jx_j\frac{\partial A_{ij}(x)}{\partial x_h}+A_{ih}(x)I\right)\\
&+\eta^2\left(\sum_jx_j^TA_{ij}(x)F_V^TF_V\left(\sum_jx_j\frac{\partial A_{ij}(x)}{\partial x_h}+A_{ih}(x)I\right)\right.\\
&\qquad-\left(x_i^TF_V\sum_jA_{ij}(x)x_j\right)x_i^TF_V\\
&\qquad\left.\cdot\left(\sum_jx_j\frac{\partial A_{ij}(x)}{\partial x_h}+A_{ih}(x)I\right)\right)\\
&+\left(\eta\sum_jx_j^TA_{ij}(x)F_V^T\right.\\
&\qquad\left.-\eta^2\left(x_i^TF_V\sum_jA_{ij}(x)x_j\right)\sum_jx_j^TA_{ij}(x)F_V^T\right)\delta_{ih}
\end{aligned} ∂ x h ∂ χ ( x ) = η x i T F V ( j ∑ x j ∂ x h ∂ A ij ( x ) + A ih ( x ) I ) + η 2 ( j ∑ x j T A ij ( x ) F V T F V ( j ∑ x j ∂ x h ∂ A ij ( x ) + A ih ( x ) I ) − ( x i T F V j ∑ A ij ( x ) x j ) x i T F V ⋅ ( j ∑ x j ∂ x h ∂ A ij ( x ) + A ih ( x ) I ) ) + ( η j ∑ x j T A ij ( x ) F V T − η 2 ( x i T F V j ∑ A ij ( x ) x j ) j ∑ x j T A ij ( x ) F V T ) δ ih
or (10) after regrouping. One gets the result inserting these quantities into (8). ■
The following lemma states that the behavior of the self-attention model (1) at a consensus point is locally identical to that of the multiagent Oja model (2).
Lemma 11 At a consensus point v k v_k v k , the eigenvalues of the Jacobian matrix J ( v k ) J(v_k) J ( v k ) are those indicated in Lemma 3. In particular, under Assumption 1, and, if − λ d > λ 1 -\lambda_d>\lambda_1 − λ d > λ 1 , for η < 2 ∣ λ 1 + λ d ∣ \eta<\frac{2}{\lvert\lambda_1+\lambda_d\rvert} η < ∣ λ 1 + λ d ∣ 2 , the consensus point x i = v 1 ∀ i x_i=v_1\ \forall i x i = v 1 ∀ i is locally asymptotically stable for (1), while the remaining consensus equilibria x i = v k ∀ i x_i=v_k\ \forall i x i = v k ∀ i , with k = 2 , … , d k=2,\ldots,d k = 2 , … , d , are all unstable.
Proof. From Lemma 9, in a consensus equilibrium the attention matrix is the uniform matrix A ( v k ) = 1 n 11 T A(v_k)=\frac{1}{n}\mathbf{1}\mathbf{1}^T A ( v k ) = n 1 1 1 T . It follows that the Jacobian at x i = v k x_i=v_k x i = v k , J ( v k ) J(v_k) J ( v k ) , is still given by (5), and hence, from Lemma 4, that v 1 v_1 v 1 is locally asymptotically stable while v k v_k v k , k = 2 , … , d k=2,\ldots,d k = 2 , … , d , are all unstable. ■
We consider now a bipartite consensus equilibrium and assume w.l.o.g. that the first n 1 n_1 n 1 agents are in v 1 v_1 v 1 and the last n 2 n_2 n 2 in v 2 v_2 v 2 .
Lemma 12 At a bipartite consensus point ± v k \pm v_k ± v k , the Jacobian J ( ± v k ) J(\pm v_k) J ( ± v k ) is given by
J ( ± v k ) = [ J o 11 ⋯ J o 11 J o 12 ⋯ J o 12 ⋮ ⋮ ⋮ ⋮ J o 11 ⋯ J o 11 J o 12 ⋯ J o 12 J o 21 ⋯ J o 21 J o 22 ⋯ J o 22 ⋮ ⋮ ⋮ ⋮ J o 21 ⋯ J o 21 J o 22 ⋯ J o 22 ] + [ J d 1 ⋱ J d 1 J d 2 ⋱ J d 2 ] , J(\pm v_k)=
\begin{bmatrix}
J_o^{11} & \cdots& J_o^{11} & J_o^{12} & \cdots& J_o^{12}\\
\vdots& & \vdots& \vdots& & \vdots\\
J_o^{11} & \cdots& J_o^{11} & J_o^{12} & \cdots& J_o^{12}\\
J_o^{21} & \cdots& J_o^{21} & J_o^{22} & \cdots& J_o^{22}\\
\vdots& & \vdots& \vdots& & \vdots\\
J_o^{21} & \cdots& J_o^{21} & J_o^{22} & \cdots& J_o^{22}
\end{bmatrix}
+
\begin{bmatrix}
J_d^1 & & &\\
& \ddots& &\\
& & J_d^1 &\\
& & & J_d^2\\
& & & \ddots\\
& & & & & J_d^2
\end{bmatrix}, J ( ± v k ) = J o 11 ⋮ J o 11 J o 21 ⋮ J o 21 ⋯ ⋯ ⋯ ⋯ J o 11 ⋮ J o 11 J o 21 ⋮ J o 21 J o 12 ⋮ J o 12 J o 22 ⋮ J o 22 ⋯ ⋯ ⋯ ⋯ J o 12 ⋮ J o 12 J o 22 ⋮ J o 22 + J d 1 ⋱ J d 1 J d 2 ⋱ J d 2 ,
where
J o 11 = η α 1 k β 1 k 1 + η λ k γ 1 k ( σ 1 F V − λ k v k v k T ) − ( 1 − σ 1 ) ( 1 − γ 1 k ) λ k v k v k T F Q T F K J o 12 = η α 2 k β 1 k 1 + η λ k γ 1 k ( σ 1 F V − λ k v k v k T ) + ( 1 − σ 1 ) ( 1 + γ 1 k ) λ k v k v k T F Q T F K J o 21 = η α 1 k β 2 k 1 + η λ k γ 2 k ( σ 2 F V − λ k v k v k T ) + ( 1 − σ 2 ) ( 1 + γ 2 k ) λ k v k v k T F Q T F K J o 22 = η α 2 k β 2 k 1 + η λ k γ 2 k ( σ 2 F V − λ k v k v k T ) − ( 1 − σ 2 ) ( 1 − γ 2 k ) λ k v k v k T F Q T F K J d 1 = σ 1 I − ( 1 − σ 1 ) η ( 1 − ( γ 1 k ) 2 ) λ k v k v k T F Q T F K 1 + η λ k γ 1 k − ( 1 − η λ k γ 1 k ) η λ k γ 1 k v k v k T 1 + η λ k γ 1 k J d 2 = σ 2 I − ( 1 − σ 2 ) η ( 1 − ( γ 2 k ) 2 ) λ k v k v k T F Q T F K 1 + η λ k γ 2 k − ( 1 − η λ k γ 2 k ) η λ k γ 2 k v k v k T 1 + η λ k γ 2 k . (11) \begin{aligned}
J_o^{11} &= \frac{\eta\frac{\alpha_1^k}{\beta_1^k}}{1+\eta\lambda_k\gamma_1^k}\left(\sigma_1F_V-\lambda_kv_kv_k^T\right)\\
&\quad-(1-\sigma_1)(1-\gamma_1^k)\lambda_kv_kv_k^TF_Q^TF_K\\
J_o^{12} &= \frac{\eta\frac{\alpha_2^k}{\beta_1^k}}{1+\eta\lambda_k\gamma_1^k}\left(\sigma_1F_V-\lambda_kv_kv_k^T\right)\\
&\quad+(1-\sigma_1)(1+\gamma_1^k)\lambda_kv_kv_k^TF_Q^TF_K\\
J_o^{21} &= \frac{\eta\frac{\alpha_1^k}{\beta_2^k}}{1+\eta\lambda_k\gamma_2^k}\left(\sigma_2F_V-\lambda_kv_kv_k^T\right)\\
&\quad+(1-\sigma_2)(1+\gamma_2^k)\lambda_kv_kv_k^TF_Q^TF_K\\
J_o^{22} &= \frac{\eta\frac{\alpha_2^k}{\beta_2^k}}{1+\eta\lambda_k\gamma_2^k}\left(\sigma_2F_V-\lambda_kv_kv_k^T\right)\\
&\quad-(1-\sigma_2)(1-\gamma_2^k)\lambda_kv_kv_k^TF_Q^TF_K\\
J_d^1 &= \frac{\sigma_1I-(1-\sigma_1)\eta(1-(\gamma_1^k)^2)\lambda_kv_kv_k^TF_Q^TF_K}{1+\eta\lambda_k\gamma_1^k}\\
&\quad-\frac{(1-\eta\lambda_k\gamma_1^k)\eta\lambda_k\gamma_1^kv_kv_k^T}{1+\eta\lambda_k\gamma_1^k}\\
J_d^2 &= \frac{\sigma_2I-(1-\sigma_2)\eta(1-(\gamma_2^k)^2)\lambda_kv_kv_k^TF_Q^TF_K}{1+\eta\lambda_k\gamma_2^k}\\
&\quad-\frac{(1-\eta\lambda_k\gamma_2^k)\eta\lambda_k\gamma_2^kv_kv_k^T}{1+\eta\lambda_k\gamma_2^k}. \tag*{(11)}
\end{aligned} J o 11 J o 12 J o 21 J o 22 J d 1 J d 2 = 1 + η λ k γ 1 k η β 1 k α 1 k ( σ 1 F V − λ k v k v k T ) − ( 1 − σ 1 ) ( 1 − γ 1 k ) λ k v k v k T F Q T F K = 1 + η λ k γ 1 k η β 1 k α 2 k ( σ 1 F V − λ k v k v k T ) + ( 1 − σ 1 ) ( 1 + γ 1 k ) λ k v k v k T F Q T F K = 1 + η λ k γ 2 k η β 2 k α 1 k ( σ 2 F V − λ k v k v k T ) + ( 1 − σ 2 ) ( 1 + γ 2 k ) λ k v k v k T F Q T F K = 1 + η λ k γ 2 k η β 2 k α 2 k ( σ 2 F V − λ k v k v k T ) − ( 1 − σ 2 ) ( 1 − γ 2 k ) λ k v k v k T F Q T F K = 1 + η λ k γ 1 k σ 1 I − ( 1 − σ 1 ) η ( 1 − ( γ 1 k ) 2 ) λ k v k v k T F Q T F K − 1 + η λ k γ 1 k ( 1 − η λ k γ 1 k ) η λ k γ 1 k v k v k T = 1 + η λ k γ 2 k σ 2 I − ( 1 − σ 2 ) η ( 1 − ( γ 2 k ) 2 ) λ k v k v k T F Q T F K − 1 + η λ k γ 2 k ( 1 − η λ k γ 2 k ) η λ k γ 2 k v k v k T . (11)
with σ 1 = sgn ( 1 + η λ k γ 1 k ) \sigma_1=\operatorname{sgn}(1+\eta\lambda_k\gamma_1^k) σ 1 = sgn ( 1 + η λ k γ 1 k ) and σ 2 = sgn ( 1 + η λ k γ 2 k ) \sigma_2=\operatorname{sgn}(1+\eta\lambda_k\gamma_2^k) σ 2 = sgn ( 1 + η λ k γ 2 k ) .
Proof. Some tedious but elementary calculations yield:
F V ∑ j A i j ( x ) x j ∣ x i , j = ± v k = { γ 1 k λ k v k if i ∈ V 1 − γ 2 k λ k v k if i ∈ V 2 F_V\left.\sum_j A_{ij}(x)x_j\right|_{x_{i,j}=\pm v_k}
=
\begin{cases}
\gamma_1^k\lambda_kv_k & \text{if }i\in\mathcal{V}_1\\
-\gamma_2^k\lambda_kv_k & \text{if }i\in\mathcal{V}_2
\end{cases} F V j ∑ A ij ( x ) x j x i , j = ± v k = { γ 1 k λ k v k − γ 2 k λ k v k if i ∈ V 1 if i ∈ V 2
x i T F V ∑ j A i j ( x ) x j ∣ x i , j = ± v k = { v k T F V γ 1 k v k = λ k γ 1 k if i ∈ V 1 − v k T F V ( − γ 2 k ) v k = λ k γ 2 k if i ∈ V 2 \left.x_i^TF_V\sum_j A_{ij}(x)x_j\right|_{x_{i,j}=\pm v_k}
=
\begin{cases}
v_k^TF_V\gamma_1^kv_k=\lambda_k\gamma_1^k & \text{if }i\in\mathcal{V}_1\\
-v_k^TF_V(-\gamma_2^k)v_k=\lambda_k\gamma_2^k & \text{if }i\in\mathcal{V}_2
\end{cases} x i T F V j ∑ A ij ( x ) x j x i , j = ± v k = { v k T F V γ 1 k v k = λ k γ 1 k − v k T F V ( − γ 2 k ) v k = λ k γ 2 k if i ∈ V 1 if i ∈ V 2
Since v k T ( I − v k v k T ) = 0 v_k^T(I-v_kv_k^T)=0 v k T ( I − v k v k T ) = 0 , it is
∑ j x j T A i j ( x ) F V T ( I − x i x i T ) F V ∣ x i , j = ± v k = 0. \left.\sum_jx_j^TA_{ij}(x)F_V^T(I-x_ix_i^T)F_V\right|_{x_{i,j}=\pm v_k}=0. j ∑ x j T A ij ( x ) F V T ( I − x i x i T ) F V x i , j = ± v k = 0.
For the derivatives of the attention matrix, we have
∂ A i j ( x ) ∂ x h = { ( − α 1 k β 1 k + δ j h ) α 1 k β 1 k v k T F Q T F K + ( 1 − ( γ 1 k ) 2 ) α 1 k β 1 k v k T F K T F Q δ i h if i ∈ V 1 , h ∈ V 1 , j ∈ V 1 − α 1 k α 2 k β 1 k β 1 k v k T F Q T F K − ( 1 + γ 1 k ) α 2 k β 1 k ( v k T F K T F Q ) δ i h if i ∈ V 1 , h ∈ V 1 , j ∈ V 2 − α 2 k α 1 k β 1 k β 2 k v k T F Q T F K if i ∈ V 1 , h ∈ V 2 , j ∈ V 1 ( − α 2 k β 1 k + δ j h ) α 2 k β 1 k v k T F Q T F K if i ∈ V 1 , h ∈ V 2 , j ∈ V 2 ( α 1 k β 2 k − δ j h ) α 1 k β 2 k v k T F Q T F K if i ∈ V 2 , h ∈ V 1 , j ∈ V 1 α 1 k α 2 k β 2 k β 1 k v k T F Q T F K if i ∈ V 2 , h ∈ V 1 , j ∈ V 2 α 2 k α 1 k β 2 k β 2 k v k T F Q T F K + ( 1 + γ 2 k ) α 2 k β 2 k v k T F K T F Q δ i h if i ∈ V 2 , h ∈ V 2 , j ∈ V 1 ( α 1 k β 2 k − δ j h ) α 1 k β 2 k v k T F Q T F K − ( 1 − γ 2 k ) α 1 k β 2 k v k T F K T F Q δ i h if i ∈ V 2 , h ∈ V 2 , j ∈ V 2 \frac{\partial A_{ij}(x)}{\partial x_h}
=
\begin{cases}
\left(-\frac{\alpha_1^k}{\beta_1^k}+\delta_{jh}\right)\frac{\alpha_1^k}{\beta_1^k}v_k^TF_Q^TF_K+(1-(\gamma_1^k)^2)\frac{\alpha_1^k}{\beta_1^k}v_k^TF_K^TF_Q\,\delta_{ih} & \text{if }i\in\mathcal{V}_1,\ h\in\mathcal{V}_1,\ j\in\mathcal{V}_1\\
-\frac{\alpha_1^k\alpha_2^k}{\beta_1^k\beta_1^k}v_k^TF_Q^TF_K-(1+\gamma_1^k)\frac{\alpha_2^k}{\beta_1^k}(v_k^TF_K^TF_Q)\delta_{ih} & \text{if }i\in\mathcal{V}_1,\ h\in\mathcal{V}_1,\ j\in\mathcal{V}_2\\
-\frac{\alpha_2^k\alpha_1^k}{\beta_1^k\beta_2^k}v_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_1,\ h\in\mathcal{V}_2,\ j\in\mathcal{V}_1\\
\left(-\frac{\alpha_2^k}{\beta_1^k}+\delta_{jh}\right)\frac{\alpha_2^k}{\beta_1^k}v_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_1,\ h\in\mathcal{V}_2,\ j\in\mathcal{V}_2\\
\left(\frac{\alpha_1^k}{\beta_2^k}-\delta_{jh}\right)\frac{\alpha_1^k}{\beta_2^k}v_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_2,\ h\in\mathcal{V}_1,\ j\in\mathcal{V}_1\\
\frac{\alpha_1^k\alpha_2^k}{\beta_2^k\beta_1^k}v_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_2,\ h\in\mathcal{V}_1,\ j\in\mathcal{V}_2\\
\frac{\alpha_2^k\alpha_1^k}{\beta_2^k\beta_2^k}v_k^TF_Q^TF_K+(1+\gamma_2^k)\frac{\alpha_2^k}{\beta_2^k}v_k^TF_K^TF_Q\,\delta_{ih} & \text{if }i\in\mathcal{V}_2,\ h\in\mathcal{V}_2,\ j\in\mathcal{V}_1\\
\left(\frac{\alpha_1^k}{\beta_2^k}-\delta_{jh}\right)\frac{\alpha_1^k}{\beta_2^k}v_k^TF_Q^TF_K-\left(1-\gamma_2^k\right)\frac{\alpha_1^k}{\beta_2^k}v_k^TF_K^TF_Q\,\delta_{ih} & \text{if }i\in\mathcal{V}_2,\ h\in\mathcal{V}_2,\ j\in\mathcal{V}_2
\end{cases} ∂ x h ∂ A ij ( x ) = ⎩ ⎨ ⎧ ( − β 1 k α 1 k + δ j h ) β 1 k α 1 k v k T F Q T F K + ( 1 − ( γ 1 k ) 2 ) β 1 k α 1 k v k T F K T F Q δ ih − β 1 k β 1 k α 1 k α 2 k v k T F Q T F K − ( 1 + γ 1 k ) β 1 k α 2 k ( v k T F K T F Q ) δ ih − β 1 k β 2 k α 2 k α 1 k v k T F Q T F K ( − β 1 k α 2 k + δ j h ) β 1 k α 2 k v k T F Q T F K ( β 2 k α 1 k − δ j h ) β 2 k α 1 k v k T F Q T F K β 2 k β 1 k α 1 k α 2 k v k T F Q T F K β 2 k β 2 k α 2 k α 1 k v k T F Q T F K + ( 1 + γ 2 k ) β 2 k α 2 k v k T F K T F Q δ ih ( β 2 k α 1 k − δ j h ) β 2 k α 1 k v k T F Q T F K − ( 1 − γ 2 k ) β 2 k α 1 k v k T F K T F Q δ ih if i ∈ V 1 , h ∈ V 1 , j ∈ V 1 if i ∈ V 1 , h ∈ V 1 , j ∈ V 2 if i ∈ V 1 , h ∈ V 2 , j ∈ V 1 if i ∈ V 1 , h ∈ V 2 , j ∈ V 2 if i ∈ V 2 , h ∈ V 1 , j ∈ V 1 if i ∈ V 2 , h ∈ V 1 , j ∈ V 2 if i ∈ V 2 , h ∈ V 2 , j ∈ V 1 if i ∈ V 2 , h ∈ V 2 , j ∈ V 2
and hence
∑ j x j ∂ A i j ( x ) ∂ x h = { ( α 1 k β 1 k ( 1 − γ 1 k ) + ( 1 − ( γ 1 k ) 2 ) δ i h ) v k v k T F Q T F K if i ∈ V 1 , h ∈ V 1 − α 2 k β 1 k ( 1 + γ 1 k ) v k v k T F Q T F K if i ∈ V 1 , h ∈ V 2 − α 2 k β 2 k ( 1 + γ 2 k ) v k v k T F Q T F K if i ∈ V 2 , h ∈ V 1 ( α 1 k β 2 k ( 1 − γ 2 k ) + ( 1 − ( γ 2 k ) 2 ) δ i h ) v k v k T F Q T F K if i ∈ V 2 , h ∈ V 2 \sum_jx_j\frac{\partial A_{ij}(x)}{\partial x_h}
=
\begin{cases}
\left(\frac{\alpha_1^k}{\beta_1^k}(1-\gamma_1^k)+(1-(\gamma_1^k)^2)\delta_{ih}\right)v_kv_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_1,\ h\in\mathcal{V}_1\\
-\frac{\alpha_2^k}{\beta_1^k}(1+\gamma_1^k)v_kv_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_1,\ h\in\mathcal{V}_2\\
-\frac{\alpha_2^k}{\beta_2^k}(1+\gamma_2^k)v_kv_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_2,\ h\in\mathcal{V}_1\\
\left(\frac{\alpha_1^k}{\beta_2^k}(1-\gamma_2^k)+(1-(\gamma_2^k)^2)\delta_{ih}\right)v_kv_k^TF_Q^TF_K & \text{if }i\in\mathcal{V}_2,\ h\in\mathcal{V}_2
\end{cases} j ∑ x j ∂ x h ∂ A ij ( x ) = ⎩ ⎨ ⎧ ( β 1 k α 1 k ( 1 − γ 1 k ) + ( 1 − ( γ 1 k ) 2 ) δ ih ) v k v k T F Q T F K − β 1 k α 2 k ( 1 + γ 1 k ) v k v k T F Q T F K − β 2 k α 2 k ( 1 + γ 2 k ) v k v k T F Q T F K ( β 2 k α 1 k ( 1 − γ 2 k ) + ( 1 − ( γ 2 k ) 2 ) δ ih ) v k v k T F Q T F K if i ∈ V 1 , h ∈ V 1 if i ∈ V 1 , h ∈ V 2 if i ∈ V 2 , h ∈ V 1 if i ∈ V 2 , h ∈ V 2
Concerning the normed terms,
χ ( x ) ∣ x i , j = ± v k = { ∣ 1 + η λ k γ 1 k ∣ if i ∈ V 1 ∣ 1 + η λ k γ 2 k ∣ if i ∈ V 2 \left.\chi(x)\right|_{x_{i,j}=\pm v_k}
=
\begin{cases}
|1+\eta\lambda_k\gamma_1^k| & \text{if }i\in\mathcal{V}_1\\
|1+\eta\lambda_k\gamma_2^k| & \text{if }i\in\mathcal{V}_2
\end{cases} χ ( x ) ∣ x i , j = ± v k = { ∣1 + η λ k γ 1 k ∣ ∣1 + η λ k γ 2 k ∣ if i ∈ V 1 if i ∈ V 2
and
∂ χ ( x ) ∂ x h ∣ x i , j = ± v k = { ∙ if i ∈ V 1 , h ∈ V 1 , η λ k v k T ( α 1 k β 1 k ( 1 + ( 1 − γ 1 k ) F Q T F K ) + ( ( 1 − ( γ 1 k ) 2 ) F Q T F K + ( 1 − η λ k γ 1 k ) γ 1 k ) δ i h ) , ∙ if i ∈ V 1 , h ∈ V 2 , η λ k v k T α 2 k β 1 k ( 1 − ( 1 + γ 1 k ) F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 1 , − η λ k v k T α 1 k β 2 k ( 1 − ( 1 + γ 2 k ) F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 2 , − η λ k v k T ( α 2 k β 2 k ( 1 + ( 1 − γ 2 k ) F Q T F K ) + ( ( 1 − ( γ 2 k ) 2 ) F Q T F K + ( 1 − η λ k γ 2 k ) γ 2 k ) δ i h ) \left.\frac{\partial\chi(x)}{\partial x_h}\right|_{x_{i,j}=\pm v_k}
=
\begin{cases}
\bullet\ \text{if } i\in\mathcal{V}_1,\ h\in\mathcal{V}_1,\quad
\eta\lambda_k v_k^T\left(\frac{\alpha_1^k}{\beta_1^k}\left(1+(1-\gamma_1^k)F_Q^T F_K\right)
+\left((1-(\gamma_1^k)^2)F_Q^T F_K+(1-\eta\lambda_k\gamma_1^k)\gamma_1^k\right)\delta_{ih}\right),\\
\bullet\ \text{if } i\in\mathcal{V}_1,\ h\in\mathcal{V}_2,\quad
\eta\lambda_k v_k^T\frac{\alpha_2^k}{\beta_1^k}\left(1-(1+\gamma_1^k)F_Q^T F_K\right),\\
\bullet\ \text{if } i\in\mathcal{V}_2,\ h\in\mathcal{V}_1,\quad
-\eta\lambda_k v_k^T\frac{\alpha_1^k}{\beta_2^k}\left(1-(1+\gamma_2^k)F_Q^T F_K\right),\\
\bullet\ \text{if } i\in\mathcal{V}_2,\ h\in\mathcal{V}_2,\quad
-\eta\lambda_k v_k^T\left(\frac{\alpha_2^k}{\beta_2^k}\left(1+(1-\gamma_2^k)F_Q^T F_K\right)
+\left((1-(\gamma_2^k)^2)F_Q^T F_K+(1-\eta\lambda_k\gamma_2^k)\gamma_2^k\right)\delta_{ih}\right)
\end{cases} ∂ x h ∂ χ ( x ) x i , j = ± v k = ⎩ ⎨ ⎧ ∙ if i ∈ V 1 , h ∈ V 1 , η λ k v k T ( β 1 k α 1 k ( 1 + ( 1 − γ 1 k ) F Q T F K ) + ( ( 1 − ( γ 1 k ) 2 ) F Q T F K + ( 1 − η λ k γ 1 k ) γ 1 k ) δ ih ) , ∙ if i ∈ V 1 , h ∈ V 2 , η λ k v k T β 1 k α 2 k ( 1 − ( 1 + γ 1 k ) F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 1 , − η λ k v k T β 2 k α 1 k ( 1 − ( 1 + γ 2 k ) F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 2 , − η λ k v k T ( β 2 k α 2 k ( 1 + ( 1 − γ 2 k ) F Q T F K ) + ( ( 1 − ( γ 2 k ) 2 ) F Q T F K + ( 1 − η λ k γ 2 k ) γ 2 k ) δ ih )
( x i + η F V ∑ j A i j ( x ) x j ) ∂ ∂ x h χ ( x ) χ ( x ) 2 ∣ x i , j = ± v k = { ∙ if i ∈ V 1 , h ∈ V 1 , η λ k v k v k T ( α 1 k β 1 k ( 1 + ( 1 − γ 1 k ) F Q T F K ) ) 1 + η λ k γ 1 k + [ ( 1 − ( γ 1 k ) 2 ) F Q T F K + ( 1 − η λ k γ 1 k ) γ 1 k ] δ i h 1 + η λ k γ 1 k , ∙ if i ∈ V 1 , h ∈ V 2 , η λ k v k v k T α 2 k β 1 k ( 1 − ( 1 + γ 1 k ) F Q T F K ) 1 + η λ k γ 1 k , ∙ if i ∈ V 2 , h ∈ V 1 , η λ k v k v k T α 1 k β 2 k ( 1 − ( 1 + γ 2 k ) F Q T F K ) 1 + η λ k γ 2 k , ∙ if i ∈ V 2 , h ∈ V 2 , η λ k v k v k T ( α 2 k β 2 k ( 1 + ( 1 − γ 2 k ) F Q T F K ) ) 1 + η λ k γ 2 k + [ ( 1 − ( γ 2 k ) 2 ) F Q T F K + ( 1 − η λ k γ 2 k ) γ 2 k ] δ i h 1 + η λ k γ 2 k \left.
\frac{\left(x_i+\eta F_V\sum_j A_{ij}(x)x_j\right)\frac{\partial}{\partial x_h}\chi(x)}
{\chi(x)^2}
\right|_{x_{i,j}=\pm v_k}
=
\begin{cases}
\bullet\ \text{if } i\in\mathcal{V}_1,\ h\in\mathcal{V}_1,\quad
\frac{\eta\lambda_k v_kv_k^T\left(\frac{\alpha_1^k}{\beta_1^k}(1+(1-\gamma_1^k)F_Q^T F_K)\right)}
{1+\eta\lambda_k\gamma_1^k}
+\frac{\left[(1-(\gamma_1^k)^2)F_Q^T F_K+(1-\eta\lambda_k\gamma_1^k)\gamma_1^k\right]\delta_{ih}}
{1+\eta\lambda_k\gamma_1^k},\\
\bullet\ \text{if } i\in\mathcal{V}_1,\ h\in\mathcal{V}_2,\quad
\frac{\eta\lambda_k v_kv_k^T\frac{\alpha_2^k}{\beta_1^k}(1-(1+\gamma_1^k)F_Q^T F_K)}
{1+\eta\lambda_k\gamma_1^k},\\
\bullet\ \text{if } i\in\mathcal{V}_2,\ h\in\mathcal{V}_1,\quad
\frac{\eta\lambda_k v_kv_k^T\frac{\alpha_1^k}{\beta_2^k}(1-(1+\gamma_2^k)F_Q^T F_K)}
{1+\eta\lambda_k\gamma_2^k},\\
\bullet\ \text{if } i\in\mathcal{V}_2,\ h\in\mathcal{V}_2,\quad
\frac{\eta\lambda_k v_kv_k^T\left(\frac{\alpha_2^k}{\beta_2^k}(1+(1-\gamma_2^k)F_Q^T F_K)\right)}
{1+\eta\lambda_k\gamma_2^k}
+\frac{\left[(1-(\gamma_2^k)^2)F_Q^T F_K+(1-\eta\lambda_k\gamma_2^k)\gamma_2^k\right]\delta_{ih}}
{1+\eta\lambda_k\gamma_2^k}
\end{cases} χ ( x ) 2 ( x i + η F V ∑ j A ij ( x ) x j ) ∂ x h ∂ χ ( x ) x i , j = ± v k = ⎩ ⎨ ⎧ ∙ if i ∈ V 1 , h ∈ V 1 , 1 + η λ k γ 1 k η λ k v k v k T ( β 1 k α 1 k ( 1 + ( 1 − γ 1 k ) F Q T F K ) ) + 1 + η λ k γ 1 k [ ( 1 − ( γ 1 k ) 2 ) F Q T F K + ( 1 − η λ k γ 1 k ) γ 1 k ] δ ih , ∙ if i ∈ V 1 , h ∈ V 2 , 1 + η λ k γ 1 k η λ k v k v k T β 1 k α 2 k ( 1 − ( 1 + γ 1 k ) F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 1 , 1 + η λ k γ 2 k η λ k v k v k T β 2 k α 1 k ( 1 − ( 1 + γ 2 k ) F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 2 , 1 + η λ k γ 2 k η λ k v k v k T ( β 2 k α 2 k ( 1 + ( 1 − γ 2 k ) F Q T F K ) ) + 1 + η λ k γ 2 k [ ( 1 − ( γ 2 k ) 2 ) F Q T F K + ( 1 − η λ k γ 2 k ) γ 2 k ] δ ih
which lead to the expression for J ( ± v k ) J(\pm v_k) J ( ± v k ) .
Combining these terms together, we obtain the two components of ∂ δ f i ( x ) ∂ x h \frac{\partial\delta f_i(x)}{\partial x_h} ∂ x h ∂ δ f i ( x )
I δ i h + η F V ( ∑ j x j ∂ A i j ( x ) ∂ x h + A i h ( x ) I ) χ ( x ) ∣ x i , j = ± v k = { ∙ if i ∈ V 1 , h ∈ V 1 , η α 1 k β 1 k ( F V + ( 1 − γ 1 k ) λ k v k v k T F Q T F K ) ∣ 1 + η λ k γ 1 k ∣ + ( I + η ( 1 − ( γ 1 k ) 2 ) λ k v k v k T F Q T F K ) δ i h ∣ 1 + η λ k γ 1 k ∣ , ∙ if i ∈ V 1 , h ∈ V 2 , η α 2 k β 1 k ( F V − ( 1 + γ 1 k ) λ k v k v k T F Q T F K ) ∣ 1 + η λ k γ 1 k ∣ , ∙ if i ∈ V 2 , h ∈ V 1 , η α 1 k β 2 k ( F V − ( 1 + γ 2 k ) λ k v k v k T F Q T F K ) ∣ 1 + η λ k γ 2 k ∣ , ∙ if i ∈ V 2 , h ∈ V 2 , η α 2 k β 2 k ( F V + ( 1 − γ 2 k ) λ k v k v k T F Q T F K ) ∣ 1 + η λ k γ 2 k ∣ + ( I + η ( 1 − ( γ 2 k ) 2 ) λ k v k v k T F Q T F K ) δ i h ∣ 1 + η λ k γ 2 k ∣ \left.
\frac{I\delta_{ih}+\eta F_V\left(\sum_j x_j\frac{\partial A_{ij}(x)}{\partial x_h}+A_{ih}(x)I\right)}
{\chi(x)}
\right|_{x_{i,j}=\pm v_k}
=
\begin{cases}
\bullet\ \text{if } i\in\mathcal{V}_1,\ h\in\mathcal{V}_1,\quad
\frac{\eta\frac{\alpha_1^k}{\beta_1^k}\left(F_V+(1-\gamma_1^k)\lambda_kv_kv_k^T F_Q^T F_K\right)}
{|1+\eta\lambda_k\gamma_1^k|}
+\frac{\left(I+\eta(1-(\gamma_1^k)^2)\lambda_kv_kv_k^T F_Q^T F_K\right)\delta_{ih}}
{|1+\eta\lambda_k\gamma_1^k|},\\
\bullet\ \text{if } i\in\mathcal{V}_1,\ h\in\mathcal{V}_2,\quad
\frac{\eta\frac{\alpha_2^k}{\beta_1^k}\left(F_V-(1+\gamma_1^k)\lambda_kv_kv_k^T F_Q^T F_K\right)}
{|1+\eta\lambda_k\gamma_1^k|},\\
\bullet\ \text{if } i\in\mathcal{V}_2,\ h\in\mathcal{V}_1,\quad
\frac{\eta\frac{\alpha_1^k}{\beta_2^k}\left(F_V-(1+\gamma_2^k)\lambda_kv_kv_k^T F_Q^T F_K\right)}
{|1+\eta\lambda_k\gamma_2^k|},\\
\bullet\ \text{if } i\in\mathcal{V}_2,\ h\in\mathcal{V}_2,\quad
\frac{\eta\frac{\alpha_2^k}{\beta_2^k}\left(F_V+(1-\gamma_2^k)\lambda_kv_kv_k^T F_Q^T F_K\right)}
{|1+\eta\lambda_k\gamma_2^k|}
+\frac{\left(I+\eta(1-(\gamma_2^k)^2)\lambda_kv_kv_k^T F_Q^T F_K\right)\delta_{ih}}
{|1+\eta\lambda_k\gamma_2^k|}
\end{cases} χ ( x ) I δ ih + η F V ( ∑ j x j ∂ x h ∂ A ij ( x ) + A ih ( x ) I ) x i , j = ± v k = ⎩ ⎨ ⎧ ∙ if i ∈ V 1 , h ∈ V 1 , ∣1 + η λ k γ 1 k ∣ η β 1 k α 1 k ( F V + ( 1 − γ 1 k ) λ k v k v k T F Q T F K ) + ∣1 + η λ k γ 1 k ∣ ( I + η ( 1 − ( γ 1 k ) 2 ) λ k v k v k T F Q T F K ) δ ih , ∙ if i ∈ V 1 , h ∈ V 2 , ∣1 + η λ k γ 1 k ∣ η β 1 k α 2 k ( F V − ( 1 + γ 1 k ) λ k v k v k T F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 1 , ∣1 + η λ k γ 2 k ∣ η β 2 k α 1 k ( F V − ( 1 + γ 2 k ) λ k v k v k T F Q T F K ) , ∙ if i ∈ V 2 , h ∈ V 2 , ∣1 + η λ k γ 2 k ∣ η β 2 k α 2 k ( F V + ( 1 − γ 2 k ) λ k v k v k T F Q T F K ) + ∣1 + η λ k γ 2 k ∣ ( I + η ( 1 − ( γ 2 k ) 2 ) λ k v k v k T F Q T F K ) δ ih
To avoid dealing with absolute values in 1 + η λ k γ i 1+\eta\lambda_k\gamma_i 1 + η λ k γ i , i = 1 , 2 i=1,2 i = 1 , 2 , in J ( ± v k ) J(\pm v_k) J ( ± v k ) , it is convenient to restrict the step size η \eta η opportunely.
Lemma 13 When η < min ( 1 λ 1 , 1 ∣ λ d ∣ ) \eta<\min\left(\frac{1}{\lambda_1},\frac{1}{|\lambda_d|}\right) η < min ( λ 1 1 , ∣ λ d ∣ 1 ) then 1 + η λ k γ i k > 0 1+\eta\lambda_k\gamma_i^k>0 1 + η λ k γ i k > 0 , i = 1 , 2 i=1,2 i = 1 , 2 .
Proof. Notice first that, since ∣ γ i k ∣ ≤ 1 |\gamma_i^k|\le1 ∣ γ i k ∣ ≤ 1 , ∣ λ k ∣ ≥ ∣ λ k γ i k ∣ |\lambda_k|\ge|\lambda_k\gamma_i^k| ∣ λ k ∣ ≥ ∣ λ k γ i k ∣ , hence min ( 1 λ 1 , 1 ∣ λ d ∣ ) ≤ ∣ λ k ∣ ≤ 1 ∣ λ k γ i k ∣ \min\left(\frac{1}{\lambda_1},\frac{1}{|\lambda_d|}\right)\le|\lambda_k|\le\frac{1}{|\lambda_k\gamma_i^k|} min ( λ 1 1 , ∣ λ d ∣ 1 ) ≤ ∣ λ k ∣ ≤ ∣ λ k γ i k ∣ 1 . Consequently, η < min ( 1 λ 1 , 1 ∣ λ d ∣ ) \eta<\min\left(\frac{1}{\lambda_1},\frac{1}{|\lambda_d|}\right) η < min ( λ 1 1 , ∣ λ d ∣ 1 ) implies η ∣ λ k γ i k ∣ ≤ 1 \eta|\lambda_k\gamma_i^k|\le1 η ∣ λ k γ i k ∣ ≤ 1 , or 1 − η ∣ λ k γ i k ∣ > 0 1-\eta|\lambda_k\gamma_i^k|>0 1 − η ∣ λ k γ i k ∣ > 0 , which in turn implies 1 + η λ k γ i k ≥ 0 1+\eta\lambda_k\gamma_i^k\ge0 1 + η λ k γ i k ≥ 0 , i = 1 , 2 i=1,2 i = 1 , 2 .
This limitation on η \eta η implies σ 1 = σ 2 = 1 \sigma_1=\sigma_2=1 σ 1 = σ 2 = 1 , which leads to a considerable simplification in the Jacobian terms of (11), and therefore in the calculation of its eigenvalues.
Lemma 14 When η < min ( 1 λ 1 , 1 ∣ λ d ∣ ) \eta<\min\left(\frac{1}{\lambda_1},\frac{1}{|\lambda_d|}\right) η < min ( λ 1 1 , ∣ λ d ∣ 1 ) , at a bipartite consensus point ± v k \pm v_k ± v k , the eigenvalues of the Jacobian J ( ± v k ) J(\pm v_k) J ( ± v k ) are
( 1 − η λ k γ 1 k ) η λ k γ 1 k 1 + η λ k γ 1 k \frac{(1-\eta\lambda_k\gamma_1^k)\eta\lambda_k\gamma_1^k}{1+\eta\lambda_k\gamma_1^k} 1 + η λ k γ 1 k ( 1 − η λ k γ 1 k ) η λ k γ 1 k of multiplicity n 1 n_1 n 1 , and ( 1 − η λ k γ 2 k ) η λ k γ 2 k 1 + η λ k γ 2 k \frac{(1-\eta\lambda_k\gamma_2^k)\eta\lambda_k\gamma_2^k}{1+\eta\lambda_k\gamma_2^k} 1 + η λ k γ 2 k ( 1 − η λ k γ 2 k ) η λ k γ 2 k of multiplicity n 2 n_2 n 2 .
μ j , ± k = 1 2 ( a j k + d j k ± ( a j k − d j k ) 2 + 4 c j k b j k ) \mu_{j,\pm}^k=\frac{1}{2}\left(a_j^k+d_j^k\pm\sqrt{(a_j^k-d_j^k)^2+4c_j^kb_j^k}\right) μ j , ± k = 2 1 ( a j k + d j k ± ( a j k − d j k ) 2 + 4 c j k b j k ) for j = 1 , … , k − 1 , k + 1 , … , d j=1,\ldots,k-1,k+1,\ldots,d j = 1 , … , k − 1 , k + 1 , … , d , where a j k a_j^k a j k , b j k b_j^k b j k , c j k c_j^k c j k and d j k d_j^k d j k are given by (7).
1 1 + η λ k γ 1 k \frac{1}{1+\eta\lambda_k\gamma_1^k} 1 + η λ k γ 1 k 1 and 1 1 + η λ k γ 2 k \frac{1}{1+\eta\lambda_k\gamma_2^k} 1 + η λ k γ 2 k 1 , of total multiplicity n d − n − 2 d + 2 nd-n-2d+2 n d − n − 2 d + 2 .
Proof. For J ( ± v k ) J(\pm v_k) J ( ± v k ) there are 3 classes of eigenvectors:
If 1 + η λ k γ i k > 0 1+\eta\lambda_k\gamma_i^k>0 1 + η λ k γ i k > 0 , i = 1 , 2 i=1,2 i = 1 , 2 , then choose p ℓ = [ 0 … 0 ⏟ ℓ − 1 v k T 0 … 0 ⏟ n − ℓ ] T p^\ell=[\underbrace{0\ldots0}_{\ell-1}\ v_k^T\ \underbrace{0\ldots0}_{n-\ell}]^T p ℓ = [ ℓ − 1 0 … 0 v k T n − ℓ 0 … 0 ] T . There are n n n such eigenvectors,
and they are obviously all orthogonal to each other. For ℓ ≤ n 1 \ell\le n_1 ℓ ≤ n 1 it is
J o 11 v k = η α 1 k β 1 k ( F V − λ k v k v k T ) 1 + η λ k γ 1 k v k = η α 1 k β 1 k ( λ k v k − λ k v k ) 1 + η λ k γ 1 k = 0 J o 21 v k = η α 2 k β 2 k ( F V − λ k v k v k T ) 1 + η λ k γ 2 k v k = η α 2 k β 2 k ( λ k v k − λ k v k ) 1 + η λ k γ 2 k = 0 J d 1 v k = I − ( 1 − η λ k γ 1 k ) η λ k γ 1 k v k v k T 1 + η λ k γ 1 k v k = 1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k 1 + η λ k γ 1 k v k \begin{aligned}
J_o^{11}v_k&=\frac{\eta\frac{\alpha_1^k}{\beta_1^k}(FV-\lambda_kv_kv_k^T)}{1+\eta\lambda_k\gamma_1^k}v_k=\frac{\eta\frac{\alpha_1^k}{\beta_1^k}(\lambda_kv_k-\lambda_kv_k)}{1+\eta\lambda_k\gamma_1^k}=0\\
J_o^{21}v_k&=\frac{\eta\frac{\alpha_2^k}{\beta_2^k}(FV-\lambda_kv_kv_k^T)}{1+\eta\lambda_k\gamma_2^k}v_k=\frac{\eta\frac{\alpha_2^k}{\beta_2^k}(\lambda_kv_k-\lambda_kv_k)}{1+\eta\lambda_k\gamma_2^k}=0\\
J_d^1v_k&=\frac{I-(1-\eta\lambda_k\gamma_1^k)\eta\lambda_k\gamma_1^k v_kv_k^T}{1+\eta\lambda_k\gamma_1^k}v_k\\
&=\frac{1-(1-\eta\lambda_k\gamma_1^k)\eta\lambda_k\gamma_1^k}{1+\eta\lambda_k\gamma_1^k}v_k
\end{aligned} J o 11 v k J o 21 v k J d 1 v k = 1 + η λ k γ 1 k η β 1 k α 1 k ( F V − λ k v k v k T ) v k = 1 + η λ k γ 1 k η β 1 k α 1 k ( λ k v k − λ k v k ) = 0 = 1 + η λ k γ 2 k η β 2 k α 2 k ( F V − λ k v k v k T ) v k = 1 + η λ k γ 2 k η β 2 k α 2 k ( λ k v k − λ k v k ) = 0 = 1 + η λ k γ 1 k I − ( 1 − η λ k γ 1 k ) η λ k γ 1 k v k v k T v k = 1 + η λ k γ 1 k 1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k v k
meaning that
J ( ± v k ) p = 1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k 1 + η λ k γ 1 k p J(\pm v_k)p=\frac{1-(1-\eta\lambda_k\gamma_1^k)\eta\lambda_k\gamma_1^k}{1+\eta\lambda_k\gamma_1^k}p J ( ± v k ) p = 1 + η λ k γ 1 k 1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k p
i.e., 1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k 1 + η λ k γ 1 k \frac{1-(1-\eta\lambda_k\gamma_1^k)\eta\lambda_k\gamma_1^k}{1+\eta\lambda_k\gamma_1^k} 1 + η λ k γ 1 k 1 − ( 1 − η λ k γ 1 k ) η λ k γ 1 k is an eigenvalue of J ( ± v k ) J(\pm v_k) J ( ± v k ) of multiplicity n 1 n_1 n 1 . For ℓ > n 1 \ell>n_1 ℓ > n 1 , similar calculations give
J o 12 v k = J o 22 v k = 0 , J d 2 v k = 1 − ( 1 − η λ k γ 2 k ) η λ k γ 2 k 1 + η λ k γ 2 k v k J_o^{12}v_k=J_o^{22}v_k=0,\qquad J_d^2v_k=\frac{1-(1-\eta\lambda_k\gamma_2^k)\eta\lambda_k\gamma_2^k}{1+\eta\lambda_k\gamma_2^k}v_k J o 12 v k = J o 22 v k = 0 , J d 2 v k = 1 + η λ k γ 2 k 1 − ( 1 − η λ k γ 2 k ) η λ k γ 2 k v k
i.e., 1 − ( 1 − η λ k γ 2 k ) η λ k γ 2 k 1 + η λ k γ 2 k \frac{1-(1-\eta\lambda_k\gamma_2^k)\eta\lambda_k\gamma_2^k}{1+\eta\lambda_k\gamma_2^k} 1 + η λ k γ 2 k 1 − ( 1 − η λ k γ 2 k ) η λ k γ 2 k is an eigenvalue of J ( ± v k ) J(\pm v_k) J ( ± v k ) of multiplicity n 2 n_2 n 2 .
Second class: Consider d − 1 d-1 d − 1 vectors q h q^h q h s.t. q h = [ ( w 1 h ) T ⋯ ( w 1 h ) T ( w 2 h ) T ⋯ ( w 2 h ) T ] T q^h=[(w_1^h)^T\ \cdots\ (w_1^h)^T\ (w_2^h)^T\ \cdots\ (w_2^h)^T]^T q h = [( w 1 h ) T ⋯ ( w 1 h ) T ( w 2 h ) T ⋯ ( w 2 h ) T ] T , with w 1 h = ∑ j = 1 n 1 ξ j h , 1 v j w_1^h=\sum_{j=1}^{n_1}\xi_j^{h,1}v_j w 1 h = ∑ j = 1 n 1 ξ j h , 1 v j and w 2 h = ∑ j = 1 n 2 ξ j h , 2 v j w_2^h=\sum_{j=1}^{n_2}\xi_j^{h,2}v_j w 2 h = ∑ j = 1 n 2 ξ j h , 2 v j . Choose w i h w_i^h w i h s.t. ξ k h , i = 0 \xi_k^{h,i}=0 ξ k h , i = 0 , so that v k T w i h = 0 v_k^Tw_i^h=0 v k T w i h = 0 . We have
J o 11 w 1 h = η α 1 k β 1 k ∑ j ≠ k λ j ξ j h , 1 v j 1 + η λ k γ 1 k J_o^{11}w_1^h=\frac{\eta\frac{\alpha_1^k}{\beta_1^k}\sum_{j\ne k}\lambda_j\xi_j^{h,1}v_j}{1+\eta\lambda_k\gamma_1^k} J o 11 w 1 h = 1 + η λ k γ 1 k η β 1 k α 1 k ∑ j = k λ j ξ j h , 1 v j
J o 12 w 2 h = η α 2 k β 2 k ∑ j ≠ k λ j ξ j h , 2 v j 1 + η λ k γ 1 k J_o^{12}w_2^h=\frac{\eta\frac{\alpha_2^k}{\beta_2^k}\sum_{j\ne k}\lambda_j\xi_j^{h,2}v_j}{1+\eta\lambda_k\gamma_1^k} J o 12 w 2 h = 1 + η λ k γ 1 k η β 2 k α 2 k ∑ j = k λ j ξ j h , 2 v j
J o 21 w 1 h = η α 1 k β 1 k ∑ j ≠ k λ j ξ j h , 1 v j 1 + η λ k γ 2 k J_o^{21}w_1^h=\frac{\eta\frac{\alpha_1^k}{\beta_1^k}\sum_{j\ne k}\lambda_j\xi_j^{h,1}v_j}{1+\eta\lambda_k\gamma_2^k} J o 21 w 1 h = 1 + η λ k γ 2 k η β 1 k α 1 k ∑ j = k λ j ξ j h , 1 v j
J o 22 w 2 h = η α 2 k β 2 k ∑ j ≠ k λ j ξ j h , 2 v j 1 + η λ k γ 2 k J_o^{22}w_2^h=\frac{\eta\frac{\alpha_2^k}{\beta_2^k}\sum_{j\ne k}\lambda_j\xi_j^{h,2}v_j}{1+\eta\lambda_k\gamma_2^k} J o 22 w 2 h = 1 + η λ k γ 2 k η β 2 k α 2 k ∑ j = k λ j ξ j h , 2 v j
and
J d 1 w 1 h = w 1 h 1 + η λ k γ 1 k , J d 2 w 2 h = w 2 h 1 + η λ k γ 2 k . J_d^1w_1^h=\frac{w_1^h}{1+\eta\lambda_k\gamma_1^k},\qquad
J_d^2w_2^h=\frac{w_2^h}{1+\eta\lambda_k\gamma_2^k}. J d 1 w 1 h = 1 + η λ k γ 1 k w 1 h , J d 2 w 2 h = 1 + η λ k γ 2 k w 2 h .
The q h q^h q h are obtained solving the algebraic equation J ( ± v k ) q h = μ q h J(\pm v_k)q^h=\mu q^h J ( ± v k ) q h = μ q h where also the eigenvalue μ \mu μ is an unknown. Expanding we obtain a block of n 1 n_1 n 1 identical equations
∑ j ≠ k ( η n 1 α 1 k β 1 k ξ j h , 1 + η n 2 α 2 k β 2 k ξ j h , 2 ) λ j v j + ∑ j ≠ k ξ j h , 1 v j 1 + η λ k γ 1 k = μ ∑ j ≠ k ξ j h , 1 v j \frac{\sum_{j\ne k}\left(\eta n_1\frac{\alpha_1^k}{\beta_1^k}\xi_j^{h,1}+\eta n_2\frac{\alpha_2^k}{\beta_2^k}\xi_j^{h,2}\right)\lambda_jv_j+\sum_{j\ne k}\xi_j^{h,1}v_j}{1+\eta\lambda_k\gamma_1^k}
=\mu\sum_{j\ne k}\xi_j^{h,1}v_j 1 + η λ k γ 1 k ∑ j = k ( η n 1 β 1 k α 1 k ξ j h , 1 + η n 2 β 2 k α 2 k ξ j h , 2 ) λ j v j + ∑ j = k ξ j h , 1 v j = μ j = k ∑ ξ j h , 1 v j
and another of n 2 n_2 n 2 identical equations
∑ j ≠ k ( η n 1 α 1 k β 1 k ξ j h , 1 + η n 2 α 2 k β 2 k ξ j h , 2 ) λ j v j + ∑ j ≠ k ξ j h , 2 v j 1 + η λ k γ 2 k = μ ∑ j ≠ k ξ j h , 2 v j \frac{\sum_{j\ne k}\left(\eta n_1\frac{\alpha_1^k}{\beta_1^k}\xi_j^{h,1}+\eta n_2\frac{\alpha_2^k}{\beta_2^k}\xi_j^{h,2}\right)\lambda_jv_j+\sum_{j\ne k}\xi_j^{h,2}v_j}{1+\eta\lambda_k\gamma_2^k}
=\mu\sum_{j\ne k}\xi_j^{h,2}v_j 1 + η λ k γ 2 k ∑ j = k ( η n 1 β 1 k α 1 k ξ j h , 1 + η n 2 β 2 k α 2 k ξ j h , 2 ) λ j v j + ∑ j = k ξ j h , 2 v j = μ j = k ∑ ξ j h , 2 v j
whose solution provides both the desired eigenvector w i h w_i^h w i h and the associated eigenvalues μ \mu μ . Projecting these equations along the eigenvector v j v_j v j and rearranging
( 1 + η n 1 α 1 k β 1 k λ j 1 + η λ k γ 1 k − μ ) ξ j h , 1 + η n 2 α 2 k β 2 k λ j 1 + η λ k γ 1 k ξ j h , 2 = 0 \left(\frac{1+\eta n_1\frac{\alpha_1^k}{\beta_1^k}\lambda_j}{1+\eta\lambda_k\gamma_1^k}-\mu\right)\xi_j^{h,1}
+\frac{\eta n_2\frac{\alpha_2^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_1^k}\xi_j^{h,2}=0 1 + η λ k γ 1 k 1 + η n 1 β 1 k α 1 k λ j − μ ξ j h , 1 + 1 + η λ k γ 1 k η n 2 β 2 k α 2 k λ j ξ j h , 2 = 0
η n 1 α 1 k β 2 k λ j 1 + η λ k γ 2 k ξ j h , 1 + ( 1 + η n 2 α 2 k β 2 k λ j 1 + η λ k γ 2 k − μ ) ξ j h , 2 = 0. \frac{\eta n_1\frac{\alpha_1^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_2^k}\xi_j^{h,1}
+\left(\frac{1+\eta n_2\frac{\alpha_2^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_2^k}-\mu\right)\xi_j^{h,2}=0. 1 + η λ k γ 2 k η n 1 β 2 k α 1 k λ j ξ j h , 1 + 1 + η λ k γ 2 k 1 + η n 2 β 2 k α 2 k λ j − μ ξ j h , 2 = 0.
and another of n 2 n_2 n 2 identical equations
∑ j ≠ k ( η n 1 α 1 k β 1 k ξ j h , 1 + η n 2 α 2 k β 2 k ξ j h , 2 ) λ j v j + ∑ j ≠ k ξ j h , 2 v j 1 + η λ k γ 2 k = μ ∑ j ≠ k ξ j h , 2 v j \frac{\sum_{j\ne k}\left(\eta n_1\frac{\alpha_1^k}{\beta_1^k}\xi_j^{h,1}+\eta n_2\frac{\alpha_2^k}{\beta_2^k}\xi_j^{h,2}\right)\lambda_jv_j+\sum_{j\ne k}\xi_j^{h,2}v_j}{1+\eta\lambda_k\gamma_2^k}
=\mu\sum_{j\ne k}\xi_j^{h,2}v_j 1 + η λ k γ 2 k ∑ j = k ( η n 1 β 1 k α 1 k ξ j h , 1 + η n 2 β 2 k α 2 k ξ j h , 2 ) λ j v j + ∑ j = k ξ j h , 2 v j = μ j = k ∑ ξ j h , 2 v j
whose solution provides both the desired eigenvector w i h w_i^h w i h and the associated eigenvalues μ \mu μ . Projecting these equations along the eigenvector v j v_j v j and rearranging
( 1 + η n 1 α 1 k β 1 k λ j 1 + η λ k γ 1 k − μ ) ξ j h , 1 + η n 2 α 2 k β 2 k λ j 1 + η λ k γ 1 k ξ j h , 2 = 0 \left(\frac{1+\eta n_1\frac{\alpha_1^k}{\beta_1^k}\lambda_j}{1+\eta\lambda_k\gamma_1^k}-\mu\right)\xi_j^{h,1}
+\frac{\eta n_2\frac{\alpha_2^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_1^k}\xi_j^{h,2}=0 1 + η λ k γ 1 k 1 + η n 1 β 1 k α 1 k λ j − μ ξ j h , 1 + 1 + η λ k γ 1 k η n 2 β 2 k α 2 k λ j ξ j h , 2 = 0
η n 1 α 1 k β 2 k λ j 1 + η λ k γ 2 k ξ j h , 1 + ( 1 + η n 2 α 2 k β 2 k λ j 1 + η λ k γ 2 k − μ ) ξ j h , 2 = 0. \frac{\eta n_1\frac{\alpha_1^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_2^k}\xi_j^{h,1}
+\left(\frac{1+\eta n_2\frac{\alpha_2^k}{\beta_2^k}\lambda_j}{1+\eta\lambda_k\gamma_2^k}-\mu\right)\xi_j^{h,2}=0. 1 + η λ k γ 2 k η n 1 β 2 k α 1 k λ j ξ j h , 1 + 1 + η λ k γ 2 k 1 + η n 2 β 2 k α 2 k λ j − μ ξ j h , 2 = 0.
Notice that a j k a_j^k a j k , b j k b_j^k b j k , c j k c_j^k c j k and d j k d_j^k d j k are independent of the index h h h , hence, to avoid repeated identical algebraic equations, we can take h = j h=j h = j and drop one index in the ξ j h , i \xi_j^{h,i} ξ j h , i variables: ξ j h , i = ξ j i \xi_j^{h,i}=\xi_j^i ξ j h , i = ξ j i , obtaining
( a j k − μ ) ξ j 1 + b j k ξ j 2 = 0 (a_j^k-\mu)\xi_j^1+b_j^k\xi_j^2=0 ( a j k − μ ) ξ j 1 + b j k ξ j 2 = 0
c j k ξ j 1 + ( d j k − μ ) ξ j 2 = 0 , c_j^k\xi_j^1+(d_j^k-\mu)\xi_j^2=0, c j k ξ j 1 + ( d j k − μ ) ξ j 2 = 0 ,
which leads to the formula for the eigenvalues μ j , ± k = 1 2 ( a j k + d j k ± ( a j k − d j k ) 2 + 4 c j k b j k ) \mu_{j,\pm}^k=\frac{1}{2}\left(a_j^k+d_j^k\pm\sqrt{(a_j^k-d_j^k)^2+4c_j^kb_j^k}\right) μ j , ± k = 2 1 ( a j k + d j k ± ( a j k − d j k ) 2 + 4 c j k b j k ) . The relationship between the components of the two vectors w ℓ j w_\ell^j w ℓ j is then ξ j 2 = − a j k − μ j k b j k ξ j 1 \xi_j^2=-\frac{a_j^k-\mu_j^k}{b_j^k}\xi_j^1 ξ j 2 = − b j k a j k − μ j k ξ j 1 . Notice that for each q j q^j q j there are two eigenvalues μ j , ± k \mu_{j,\pm}^k μ j , ± k , for a total of 2 ( d − 1 ) 2(d-1) 2 ( d − 1 ) eigenvalues in this class.
The third class contains the n d − n − 2 d + 2 nd-n-2d+2 n d − n − 2 d + 2 remaining eigenvectors subdivided into two groups: r 1 = [ ϵ 1 v h T ⋯ ϵ n 1 v h T 0 ⋯ 0 ] T r_1=[\epsilon_1v_h^T\ \cdots\ \epsilon_{n_1}v_h^T\ 0\ \cdots\ 0]^T r 1 = [ ϵ 1 v h T ⋯ ϵ n 1 v h T 0 ⋯ 0 ] T and r 2 = [ 0 ⋯ 0 ϵ 1 v h T ⋯ ϵ n 2 v h T ] T r_2=[0\ \cdots\ 0\ \epsilon_1v_h^T\ \cdots\ \epsilon_{n_2}v_h^T]^T r 2 = [ 0 ⋯ 0 ϵ 1 v h T ⋯ ϵ n 2 v h T ] T where v h v_h v h is an eigenvector of F V FV F V , h ≠ k h\ne k h = k , and ∑ j = 1 n 1 ϵ j = 0 \sum_{j=1}^{n_1}\epsilon_j=0 ∑ j = 1 n 1 ϵ j = 0 , ∑ j = 1 n 2 ϵ j = 0 \sum_{j=1}^{n_2}\epsilon_j=0 ∑ j = 1 n 2 ϵ j = 0 . By construction, v k T v h = 0 v_k^Tv_h=0 v k T v h = 0 and ( w j T v h = 0 (w_j^T v_h=0 ( w j T v h = 0 for all j = 1 , … , k − 1 , k + 1 , … , d j=1,\ldots,k-1,k+1,\ldots,d j = 1 , … , k − 1 , k + 1 , … , d and ℓ = 1 , 2 \ell=1,2 ℓ = 1 , 2 . Computing:
J ( ± v k ) r 1 = [ η α 1 k β 1 k λ h ( ∑ j = 1 n 1 ϵ j ) v h + ϵ 1 v h 1 + η λ k γ 1 k ⋮ η α 1 k β 1 k λ h ( ∑ j = 1 n 1 ϵ j ) v h + ϵ n 1 v h 1 + η λ k γ 1 k η α 2 k β 2 k λ h ( ∑ j = 1 n 1 ϵ j ) v h 1 + η λ k γ 2 k ⋮ η α 2 k β 2 k λ h ( ∑ j = 1 n 1 ϵ j ) v h 1 + η λ k γ 2 k ] = 1 1 + η λ k γ 1 k r 1 J(\pm v_k)r_1=
\begin{bmatrix}
\frac{\eta\frac{\alpha_1^k}{\beta_1^k}\lambda_h(\sum_{j=1}^{n_1}\epsilon_j)v_h+\epsilon_1v_h}{1+\eta\lambda_k\gamma_1^k}\\
\vdots\\
\frac{\eta\frac{\alpha_1^k}{\beta_1^k}\lambda_h(\sum_{j=1}^{n_1}\epsilon_j)v_h+\epsilon_{n_1}v_h}{1+\eta\lambda_k\gamma_1^k}\\
\frac{\eta\frac{\alpha_2^k}{\beta_2^k}\lambda_h(\sum_{j=1}^{n_1}\epsilon_j)v_h}{1+\eta\lambda_k\gamma_2^k}\\
\vdots\\
\frac{\eta\frac{\alpha_2^k}{\beta_2^k}\lambda_h(\sum_{j=1}^{n_1}\epsilon_j)v_h}{1+\eta\lambda_k\gamma_2^k}
\end{bmatrix}
=\frac{1}{1+\eta\lambda_k\gamma_1^k}r_1 J ( ± v k ) r 1 = 1 + η λ k γ 1 k η β 1 k α 1 k λ h ( ∑ j = 1 n 1 ϵ j ) v h + ϵ 1 v h ⋮ 1 + η λ k γ 1 k η β 1 k α 1 k λ h ( ∑ j = 1 n 1 ϵ j ) v h + ϵ n 1 v h 1 + η λ k γ 2 k η β 2 k α 2 k λ h ( ∑ j = 1 n 1 ϵ j ) v h ⋮ 1 + η λ k γ 2 k η β 2 k α 2 k λ h ( ∑ j = 1 n 1 ϵ j ) v h = 1 + η λ k γ 1 k 1 r 1
and, similarly, J ( ± v k ) r 2 = 1 1 + η λ k γ 2 k r 2 J(\pm v_k)r_2=\frac{1}{1+\eta\lambda_k\gamma_2^k}r_2 J ( ± v k ) r 2 = 1 + η λ k γ 2 k 1 r 2 . ▪
Remark 8 As for the multiagent Oja system, in Lemma 14 the first class of eigenvectors is “extrinsic” and the other two “intrinsic”, i.e., they belong to the tangent space T x ( S d − 1 ) n T_x(\mathbb{S}^{d-1})^n T x ( S d − 1 ) n . Only the last two classes count when deciding the local asymptotic stability properties of the bipartite equilibria.
Lemma 15 The polygonal equilibria are all unstable for (1).
Proof. The idea of the proof is similar to that used in Lemma 6 for the multiagent Oja flow. A polygonal equilibrium point x = s = [ s 1 … s n ] ∈ ( S d − 1 ) n x=s=[s_1\ \ldots\ s_n]\in(\mathbb{S}^{d-1})^n x = s = [ s 1 … s n ] ∈ ( S d − 1 ) n is s.t. F V ∑ j = 1 n A i j ( s ) s j = 0 F_V\sum_{j=1}^n A_{ij}(s)s_j=0 F V ∑ j = 1 n A ij ( s ) s j = 0 . Let us compute the linearization of (1) at s s s , obtained perturbing s s s with a perturbation w = [ w 1 … w n ] w=[w_1\ldots w_n] w = [ w 1 … w n ] with s i T w i = 0 s_i^T w_i=0 s i T w i = 0 . For the non-normalized next iterate it is
x ~ i = s i + w i + η n F V ∑ j A i j ( s + w ) ( s j + w j ) = s i + η F V ∑ j A i j ( s ) s j ⏟ = 0 + w i + η F V ∑ j A i j ( s ) w j \begin{aligned}
\widetilde{x}_i=s_i+w_i+\frac{\eta}{n}F_V\sum_j A_{ij}(s+w)(s_j+w_j) \\
&=s_i+\eta F_V\underbrace{\sum_j A_{ij}(s)s_j}_{=0}+w_i+\eta F_V\sum_j A_{ij}(s)w_j
\end{aligned} x i = s i + w i + n η F V j ∑ A ij ( s + w ) ( s j + w j ) = s i + η F V = 0 j ∑ A ij ( s ) s j + w i + η F V j ∑ A ij ( s ) w j
+ η F V ∑ j ∑ h ∂ A i j ( s ) ∂ w h w h w j + h . o . t . \qquad+\eta F_V\sum_j\sum_h\frac{\partial A_{ij}(s)}{\partial w_h}w_hw_j+h.o.t. + η F V j ∑ h ∑ ∂ w h ∂ A ij ( s ) w h w j + h . o . t .
where the vectors ∂ A i j ( s ) ∂ w h \frac{\partial A_{ij}(s)}{\partial w_h} ∂ w h ∂ A ij ( s ) are computed in (9). Denote ψ i j ( w ) : = ∑ h ∂ A i j ( s ) ∂ w h w h \psi^{ij}(w):=\sum_h\frac{\partial A_{ij}(s)}{\partial w_h}w_h ψ ij ( w ) := ∑ h ∂ w h ∂ A ij ( s ) w h and observe that ψ i j ( w ) \psi^{ij}(w) ψ ij ( w ) is a sum of bilinear forms s ℓ B k w h s_\ell B_kw_h s ℓ B k w h for some matrices B k B_k B k (see (9) for their specific expressions). Since ∥ s ℓ ∥ = 1 \|s_\ell\|=1 ∥ s ℓ ∥ = 1 and w h w_h w h is small enough, from the matrix Cauchy-Schwartz inequality, for each of these bilinear forms it holds − ∥ B k ∥ 2 ≤ s ℓ B k w h ≤ ∥ B k ∥ 2 -\|B_k\|_2\le s_\ell B_kw_h\le\|B_k\|_2 − ∥ B k ∥ 2 ≤ s ℓ B k w h ≤ ∥ B k ∥ 2 , where ∥ B k ∥ 2 \|B_k\|_2 ∥ B k ∥ 2 is independent of w h w_h w h .
Denoting u i : = w i + η F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) u_i:=w_i+\eta F_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j) u i := w i + η F V ∑ j ( ψ ij ( w ) s j + A ij ( s ) w j ) , the norm of x ~ i \widetilde{x}_i x i is
∥ x ~ i ∥ = ( 1 + ∥ u i ∥ 2 + 2 η s i T F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) ) 1 2 \|\widetilde{x}_i\|=\left(1+\|u_i\|^2+2\eta s_i^TF_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j)\right)^{\frac12} ∥ x i ∥ = ( 1 + ∥ u i ∥ 2 + 2 η s i T F V j ∑ ( ψ ij ( w ) s j + A ij ( s ) w j ) ) 2 1
where we have used s i T w i = 0 s_i^Tw_i=0 s i T w i = 0 . Observe that ∥ u i ∥ 2 \|u_i\|^2 ∥ u i ∥ 2 is composed entirely of terms of order 2 or higher in w i w_i w i , hence, using the binomial series expansion ( ( 1 + ξ ) − 1 2 ≈ 1 − ξ 2 + h . o . t . ) ((1+\xi)^{-\frac12}\approx1-\frac{\xi}{2}+h.o.t.) (( 1 + ξ ) − 2 1 ≈ 1 − 2 ξ + h . o . t . ) ,
x i + = x ~ i ∥ x ~ i ∥ ≈ ( s i + u i ) ( 1 − ∥ u i ∥ 2 2 − η s i T F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) ) + h . o . t . ≈ s i − η s i T F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) s i + u i + h . o . t . = s i − η s i s i T F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) + w i + η F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) + h . o . t . = s i + w i + η ( I − s i s i T ) F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) . \begin{aligned}
x_i^+=\frac{\widetilde{x}_i}{\|\widetilde{x}_i\|}\approx(s_i+u_i)\left(1-\frac{\|u_i\|^2}{2}-\eta s_i^TF_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j)\right)+h.o.t. \\
&\approx s_i-\eta s_i^TF_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j)s_i+u_i+h.o.t. \\
&=s_i-\eta s_is_i^TF_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j)+w_i+\eta F_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j)+h.o.t. \\
&=s_i+w_i+\eta(I-s_is_i^T)F_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j).
\end{aligned} x i + = ∥ x i ∥ x i ≈ ( s i + u i ) ( 1 − 2 ∥ u i ∥ 2 − η s i T F V j ∑ ( ψ ij ( w ) s j + A ij ( s ) w j ) ) + h . o . t . ≈ s i − η s i T F V j ∑ ( ψ ij ( w ) s j + A ij ( s ) w j ) s i + u i + h . o . t . = s i − η s i s i T F V j ∑ ( ψ ij ( w ) s j + A ij ( s ) w j ) + w i + η F V j ∑ ( ψ ij ( w ) s j + A ij ( s ) w j ) + h . o . t . = s i + w i + η ( I − s i s i T ) F V j ∑ ( ψ ij ( w ) s j + A ij ( s ) w j ) .
The linearized equation is then
w i + = w i + η ( I − s i s i T ) F V ∑ j ( ψ i j ( w ) s j + A i j ( s ) w j ) . w_i^+=w_i+\eta(I-s_is_i^T)F_V\sum_j(\psi^{ij}(w)s_j+A_{ij}(s)w_j). w i + = w i + η ( I − s i s i T ) F V j ∑ ( ψ ij ( w ) s j + A ij ( s ) w j ) .
Expanding all w i w_i w i and s i s_i s i in the basis of eigenvectors v 1 , … , v d v_1,\ldots,v_d v 1 , … , v d , and denoting w i = ∑ ℓ ξ i ℓ v ℓ w_i=\sum_\ell\xi_i^\ell v_\ell w i = ∑ ℓ ξ i ℓ v ℓ and s i = ∑ ℓ ζ i ℓ v ℓ s_i=\sum_\ell\zeta_i^\ell v_\ell s i = ∑ ℓ ζ i ℓ v ℓ ,
w i + = ∑ ℓ ( ξ i ℓ ) + v ℓ = ∑ ℓ ξ i ℓ v ℓ + η ( I − ∑ k ( ζ i k ) 2 v k ∑ ℓ ζ i ℓ v ℓ T ) ⋅ ∑ j , ℓ λ ℓ ( ψ i j ( w ) ζ j ℓ + A i j ( s ) ξ j ℓ ) v ℓ . w_i^+=\sum_\ell(\xi_i^\ell)^+v_\ell=\sum_\ell\xi_i^\ell v_\ell+\eta\left(I-\sum_k(\zeta_i^k)^2v_k\sum_\ell\zeta_i^\ell v_\ell^T\right)\cdot\sum_{j,\ell}\lambda_\ell(\psi_{ij}(w)\zeta_j^\ell+A_{ij}(s)\xi_j^\ell)v_\ell. w i + = ℓ ∑ ( ξ i ℓ ) + v ℓ = ℓ ∑ ξ i ℓ v ℓ + η ( I − k ∑ ( ζ i k ) 2 v k ℓ ∑ ζ i ℓ v ℓ T ) ⋅ j , ℓ ∑ λ ℓ ( ψ ij ( w ) ζ j ℓ + A ij ( s ) ξ j ℓ ) v ℓ .
Assuming that the perturbation w w w is aligned with v 1 v_1 v 1 , i.e., for all i i i , ξ i 1 ≠ 0 \xi_i^1\ne0 ξ i 1 = 0 and ξ i k = 0 \xi_i^k=0 ξ i k = 0 for k = 2 , … , d k=2,\ldots,d k = 2 , … , d , then, projecting along v 1 v_1 v 1 , yields
( ξ i 1 ) + = ( ξ i 1 ) + η ( 1 − ( ζ i 1 ) 2 ) λ 1 ( ∑ j ψ i j ( w ) ζ j 1 + ∑ j A i j ( s ) ξ j 1 ) . (\xi_i^1)^+=(\xi_i^1)+\eta\left(1-(\zeta_i^1)^2\right)\lambda_1\left(\sum_j\psi_{ij}(w)\zeta_j^1+\sum_jA_{ij}(s)\xi_j^1\right). ( ξ i 1 ) + = ( ξ i 1 ) + η ( 1 − ( ζ i 1 ) 2 ) λ 1 ( j ∑ ψ ij ( w ) ζ j 1 + j ∑ A ij ( s ) ξ j 1 ) .
Denoting ξ 1 = [ ξ 1 1 … ξ n 1 ] T \xi_1=[\xi_1^1\ \ldots\ \xi_n^1]^T ξ 1 = [ ξ 1 1 … ξ n 1 ] T and ζ 1 = [ ζ 1 1 … ζ n 1 ] T \zeta_1=[\zeta_1^1\ \ldots\ \zeta_n^1]^T ζ 1 = [ ζ 1 1 … ζ n 1 ] T the collection of the ξ i 1 \xi_i^1 ξ i 1 and ζ i 1 \zeta_i^1 ζ i 1 components of all agents, the previous ODEs can be expressed in vector form as
ξ 1 + = ξ 1 + η λ 1 ( I − Z 1 2 ) ( Ψ ζ 1 + A ( s ) ξ 1 ) (12) \xi_1^+=\xi_1+\eta\lambda_1(I-Z_1^2)(\Psi\zeta_1+A(s)\xi_1) \tag*{(12)} ξ 1 + = ξ 1 + η λ 1 ( I − Z 1 2 ) ( Ψ ζ 1 + A ( s ) ξ 1 ) (12)
where Z 1 = diag ( ζ 1 ) Z_1=\operatorname{diag}(\zeta_1) Z 1 = diag ( ζ 1 ) , Ψ = [ ψ i j ] \Psi=[\psi_{ij}] Ψ = [ ψ ij ] is a matrix with lower and upper bounds independent of w w w , and ζ 1 \zeta_1 ζ 1 is fixed. A ( s ) A(s) A ( s ) is a row stochastic matrix, ρ ( A ( s ) ) = 1 \rho(A(s))=1 ρ ( A ( s )) = 1 and A ( s ) 1 = 1 A(s)\mathbf{1}=\mathbf{1} A ( s ) 1 = 1 . Since ∣ ζ i 1 ∣ < 1 |\zeta_i^1|<1 ∣ ζ i 1 ∣ < 1 because s s s is not an eigenvector of F V F_V F V and λ 1 > 0 \lambda_1>0 λ 1 > 0 , it is ρ ( I + η λ 1 ( I − Z 1 2 ) A ( s ) ) > 1 \rho(I+\eta\lambda_1(I-Z_1^2)A(s))>1 ρ ( I + η λ 1 ( I − Z 1 2 ) A ( s )) > 1 , and the system (12) diverges when ξ 1 = ϵ 1 \xi_1=\epsilon\mathbf{1} ξ 1 = ϵ 1 for some scalar ϵ \epsilon ϵ . Hence the polygonal equilibrium s s s is unstable. ■
Remark 9 As for the multiagent Oja system, the perturbation used in Lemma 15 is “intrinsic”, i.e., w i ∈ T s i S d − 1 w_i\in T_{s_i}\mathbb{S}^{d-1} w i ∈ T s i S d − 1 for all i i i .
Proof of Theorem 2. The proof is the direct combination of Lemmas 11, 14 and 15, with the only observation that in the second class of eigenvalues of the bipartite consensus case of Lemma 14, using the Schur-Cohn formula for stability of a 2 × 2 2\times2 2 × 2 matrix in discrete time, the condition ∣ μ j , ± k ∣ < 1 |\mu_{j,\pm}^k|<1 ∣ μ j , ± k ∣ < 1 becomes a j k d j k − b j k c j k < 1 a_j^kd_j^k-b_j^kc_j^k<1 a j k d j k − b j k c j k < 1 and a j k + d j k < 1 + a j k d j k − b j k c j k a_j^k+d_j^k<1+a_j^kd_j^k-b_j^kc_j^k a j k + d j k < 1 + a j k d j k − b j k c j k , ∀ j = 1 , … , k − 1 , k + 1 , … , d \forall j=1,\ldots,k-1,k+1,\ldots,d ∀ j = 1 , … , k − 1 , k + 1 , … , d . ■
Remark 10 Similarly to the continuous-time case analyzed in [3 ] , bipartite consensus equilibria can be locally stable for the single-head discrete-time transformer in (1), even though numerically this seems to be a rare event, and to be associated to very small basins of attraction. A simulation example is shown in Figure 2 . Notice that under the assumption of Theorem 2, from the third condition of the theorem ( 1 1 + η λ k γ i k < 1 ) \left(\frac{1}{1+\eta\lambda_k\gamma_i^k}<1\right) ( 1 + η λ k γ i k 1 < 1 ) , it is straightforward to deduce that if λ k < 0 \lambda_k<0 λ k < 0 is an eigenvalue of F V F_V F V , then the associated bipartite equilibria x i = ± v k x_i=\pm v_k x i = ± v k are unstable, because it is 1 + η λ k γ i k < 1 1+\eta\lambda_k\gamma_i^k<1 1 + η λ k γ i k < 1 for all admissible values of η < min ( 1 λ 1 , 1 λ d ) \eta<\min\left(\frac{1}{\lambda_1},\frac{1}{\lambda_d}\right) η < min ( λ 1 1 , λ d 1 ) .
Figure 2. Example of bipartite consensus with d = 3 d = 3 d = 3 and n = 10 n = 10 n = 10 . (a): when a very small perturbation is applied to a locally asymptotically stable bipartite consensus point (aligned with v 1 v_1 v 1 ), the system returns to the bipartite equilibrium; (b): when a larger perturbation is applied to the same bipartite consensus point, the trajectory escapes towards one of the two the consensus points associated to the principal eigenvector v 1 v_1 v 1 . The two tokens in blue and green “migrate” to the antipodal point, thereby achieving consensus.
Extensions
In this section we discuss a few extensions of the results, most notably to the multihead case.
Multihead case
Real transformers are multihead, meaning that different pieces of the token vectors x i x_i x i attend to different convex combinations of the other tokens. This mechanism is constructed by using multiple query, key and value matrices, and combining them through a fourth weight matrix called output matrix, using an operation normally referred to as a “concatenation” [24 ] . Let h = 1 , … , H h=1,\ldots,H h = 1 , … , H be the head index. If W Q ( h ) W_Q^{(h)} W Q ( h ) , W K ( h ) W_K^{(h)} W K ( h ) , W V ( h ) W_V^{(h)} W V ( h ) , and W O W_O W O are the learned matrices in the original notation of [24 ] , then in our column-token convention the corresponding matrices are obtained by transposition:
F Q ( h ) = ( W Q ( h ) ) T , F K ( h ) = ( W K ( h ) ) T , F O = W O T F_Q^{(h)}=(W_Q^{(h)})^{\mathsf T},\qquad F_K^{(h)}=(W_K^{(h)})^{\mathsf T},\qquad F_O=W_O^{\mathsf T} F Q ( h ) = ( W Q ( h ) ) T , F K ( h ) = ( W K ( h ) ) T , F O = W O T
F V ( 1 ) = [ ( W V ( 1 ) ) T 0 ⋮ 0 ] , … , F V ( H ) = [ 0 0 ⋮ ( W V ( H ) ) T ] F_V^{(1)}=
\begin{bmatrix}
(W_V^{(1)})^{\mathsf T}\\
0\\
\vdots\\
0
\end{bmatrix},
\ldots,
F_V^{(H)}=
\begin{bmatrix}
0\\
0\\
\vdots\\
(W_V^{(H)})^{\mathsf T}
\end{bmatrix} F V ( 1 ) = ( W V ( 1 ) ) T 0 ⋮ 0 , … , F V ( H ) = 0 0 ⋮ ( W V ( H ) ) T
where the zero-padding in F V ( h ) F_V^{(h)} F V ( h ) places the nonzero entries into the rows corresponding to the h h h head and corresponds to the “concatenation” operation of [24 ] . Each head has an associated attention matrix A ( h ) ( x ) A^{(h)}(x) A ( h ) ( x ) of components
A i j ( h ) ( x ) = e ⟨ F Q ( h ) x i , F K ( h ) x j ⟩ ∑ ℓ = 1 n e ⟨ F Q ( h ) x i , F K ( h ) x ℓ ⟩ . A_{ij}^{(h)}(x)=\frac{e^{\langle F_Q^{(h)}x_i,F_K^{(h)}x_j\rangle}}{\sum_{\ell=1}^{n}e^{\langle F_Q^{(h)}x_i,F_K^{(h)}x_\ell\rangle}}. A ij ( h ) ( x ) = ∑ ℓ = 1 n e ⟨ F Q ( h ) x i , F K ( h ) x ℓ ⟩ e ⟨ F Q ( h ) x i , F K ( h ) x j ⟩ .
The multi-head case corresponds to the following time-invariant dynamical system
x i ( t + 1 ) = x i ( t ) + η F O ∑ h = 1 H F V ( h ) ∑ j A i j ( h ) ( x ( t ) ) x j ( t ) ∥ x i ( t ) + η F O ∑ h = 1 H F V ( h ) ∑ j A i j ( h ) ( x ( t ) ) x j ( t ) ∥ . (13) x_i(t+1)=\frac{x_i(t)+\eta F_O\sum_{h=1}^{H}F_V^{(h)}\sum_j A_{ij}^{(h)}(x(t))x_j(t)}{\left\|x_i(t)+\eta F_O\sum_{h=1}^{H}F_V^{(h)}\sum_j A_{ij}^{(h)}(x(t))x_j(t)\right\|}. \tag*{(13)} x i ( t + 1 ) = x i ( t ) + η F O ∑ h = 1 H F V ( h ) ∑ j A ij ( h ) ( x ( t )) x j ( t ) x i ( t ) + η F O ∑ h = 1 H F V ( h ) ∑ j A ij ( h ) ( x ( t )) x j ( t ) . (13)
As for the single head model, if we disregard attention (which varies from token to token) the matrix that lumps together the contribution of the H H H heads occurring in the transformer layer is the following “layer matrix”
F = F O ∑ h = 1 H F V ( h ) . F=F_O\sum_{h=1}^{H}F_V^{(h)}. F = F O h = 1 ∑ H F V ( h ) .
Let λ 1 , … , λ d \lambda_1,\ldots,\lambda_d λ 1 , … , λ d be the eigenvalues of F F F , and v 1 , … , v d v_1,\ldots,v_d v 1 , … , v d the associated eigenvectors, normalized s.t. ∥ v j ∥ = 1 \lVert v_j\rVert=1 ∥ v j ∥ = 1 . Under the special case of F F F which is symmetric, the asymptotic behavior of the system (13) is described in the following theorem.
Theorem 3. Consider the system (13). Assume the attention matrices A ( h ) A^{(h)} A ( h ) , h = 1 , … , H h=1,\ldots,H h = 1 , … , H , are full and the matrix F = F O ∑ h = 1 H F V ( h ) F=F_O\sum_{h=1}^{H}F_V^{(h)} F = F O ∑ h = 1 H F V ( h ) is symmetric with λ 1 > λ i \lambda_1>\lambda_i λ 1 > λ i , i = 2 , … , d i=2,\ldots,d i = 2 , … , d , λ 1 > 0 \lambda_1>0 λ 1 > 0 . Assume further that η < 2 ∣ λ 1 + λ d ∣ \eta<\frac{2}{|\lambda_1+\lambda_d|} η < ∣ λ 1 + λ d ∣ 2 whenever − λ d > λ 1 -\lambda_d>\lambda_1 − λ d > λ 1 . Then the consensus point x i = v 1 x_i=v_1 x i = v 1 ∀ i = 1 , … , n \forall i=1,\ldots,n ∀ i = 1 , … , n (or x i = − v 1 x_i=-v_1 x i = − v 1 ∀ i = 1 , … , n \forall i=1,\ldots,n ∀ i = 1 , … , n ) is a locally asymptotically stable equilibrium point for the system (13) when T → ∞ T\to\infty T → ∞ .
Proof. Under the assumption of the theorem, the system (13) has the consensus points at the eigenvectors of F F F as equilibria, as can be verified by an argument similar to Lemma 8. In particular, when x i x_i x i approaches a consensus point, the attention matrices of (13) still approach a uniform matrix: A i j ( h ) ( x ) → 1 n A_{ij}^{(h)}(x)\to\frac{1}{n} A ij ( h ) ( x ) → n 1 , h = 1 , … , H h=1,\ldots,H h = 1 , … , H . Therefore we can use the same argument used in Theorem 2: at consensus, the system (13) has the Jacobian J ( v k ) J(v_k) J ( v k ) of the multiagent Oja system (2), whose eigenvalues were computed in Lemma 3. Consensus aligned with the principal eigenvector v 1 v_1 v 1 is locally asymptotically stable, while all other consensus points at the other eigenvectors of F F F are unstable.
While the picture for consensus is easily obtainable from that of the single-head case, what happens to the bipartite consensus points is less clear. We currently have no (analytical nor numerical) evidence of such points being stable equilibria for (13).
Longer step size
To check stability of the consensus equilibria a condition on the step size is needed only when λ d < 0 \lambda_d<0 λ d < 0 , and ∣ λ d ∣ > λ 1 |\lambda_d|>\lambda_1 ∣ λ d ∣ > λ 1 , i.e., when the spectral radius of F F F (or F V F_V F V for the single-head case) is ∣ λ d ∣ |\lambda_d| ∣ λ d ∣ , not λ 1 \lambda_1 λ 1 . Extra conditions on η \eta η are required only for checking the stability of the bipartite consensus points. These extra conditions are only sufficient, and meant to simplify the expression of the eigenvalues of the Jacobian J ( ± v k ) J(\pm v_k) J ( ± v k ) , see Lemma 13. As mentioned above, locally asymptotically stable bipartite consensus equilibria appear to be rare, even in the single-head case.
Asymmetric layer (or value) matrix
The assumption of symmetric F F F (or F V F_V F V in the single head case) can be significantly relaxed. In fact, what really matters to capture the asymptotic behavior of the self-attention dynamics is that the dominant eigenvalue of F F F , λ 1 \lambda_1 λ 1 , is real, while λ 2 , … , λ d \lambda_2,\ldots,\lambda_d λ 2 , … , λ d can be any. This condition together with a strict dominance condition on λ 1 \lambda_1 λ 1 (i.e., λ 1 > Re ( λ j ) \lambda_1>\operatorname{Re}(\lambda_j) λ 1 > Re ( λ j ) , j = 2 , … , d j=2,\ldots,d j = 2 , … , d ) is the essence of the Perron-Frobenius theorem extended beyond nonnegative matrices. In fact, when the dominance is strict not much changes in the behavior of the single-head system (1) and neither of its multi-head version (13) by considering an F F F which is not symmetric. A numerical analysis of the asymmetric F F F case is carried out when dealing with the ALBERT transformer shown in Section VI-B.
Experiments
Small-scale numerical examples
In Figure 1 we show a numerical simulation of the dynamics of the single-head self-attention system (1) when d = 3 d=3 d = 3 and n = 10 n=10 n = 10 . In this case x i ∈ S 2 x_i\in\mathbb{S}^2 x i ∈ S 2 , i.e., we can represent trajectories of the self-attention dynamics on a sphere in R 3 \mathbb{R}^3 R 3 . The trajectory in Figure 1 converges to consensus, aligned with the principal eigenvector v 1 v_1 v 1 of F V F_V F V .
Figure 1. Example of single-head self-attention dynamics with d = 3 d = 3 d = 3 and n = 10 n = 10 n = 10 . Top panel: the trajectory of the 10 tokens is shown on the sphere S 2 \mathbb{S}^2 S 2 . The solid dot is the endpoint of a trajectory, i.e., the consensus point reached by all tokens. Lower panel: the correlation corr ( x i , v 1 ) \operatorname{corr}(x_i, v_1) corr ( x i , v 1 ) tends to 1 as consensus is achieved (all tokens become aligned with the principal eigenvector v 1 v_1 v 1 ). The black dotted line is the mean correlation over the 10 tokens.
In Figure 2 , for the single-head case, we show instead an example of a bipartite consensus equilibrium which is locally asymptotically stable, as checked analytically using Theorem 2. In Figure 2 (a), a small perturbation added to a bipartite equilibrium point aligned with v 1 v_1 v 1 is reabsorbed. However, the basin of attraction is very small: as soon as a slightly larger perturbation is applied (Figure 2 (b)), the tokens on one of the two antipodal points migrate to the other point, and consensus is achieved (still aligned with v 1 v_1 v 1 , as expected from Theorem 2). The (very) small basin of attraction of the bipartite stable equilibria appears to be a constant characteristic of these equilibria in our simulations. Analytical calculations of the basin of attraction are prohibitive for this system.
ALBERT [14 ] is a multihead transformer in which all weights are identical across layers. The version we consider here, called ALBERT-large, is characterized by d = 1024 d = 1024 d = 1024 , H = 16 H = 16 H = 16 and T = 24 T = 24 T = 24 . For it the principal eigenvalue of F F F , λ 1 = 2.0674 \lambda_1 = 2.0674 λ 1 = 2.0674 , is real, positive, simple, and strictly dominant, hence the heuristic extension to nonsymmetric weight matrices mentioned in § 5 -C holds. Once we disregard the FFN part and we consider an L 2 L_2 L 2 normalization, (13) holds.
In the simulations we consider a small number of tokens n = 10 n = 10 n = 10 and the time horizon T = 24 T = 24 T = 24 given by the real number of layers. Figure 3 (a) shows that over 10 3 10^3 1 0 3 experiments, the intertoken distance ∥ x i − x j ∥ \lVert x_i-x_j\rVert ∥ x i − x j ∥ tends to vanish rather quickly, meaning the tokens align with each other. Figure 3 (b) and (c) show that the tokens align also with the principal eigenvector v 1 v_1 v 1 of F F F , even though this alignment is not complete within a time horizon equal to the number of layers (T = 24 T = 24 T = 24 ). Consensus can be towards v 1 v_1 v 1 or − v 1 -v_1 − v 1 , see Figure 3 (c).
Figure 3. Example of real shared-weight transformer: ALBERT. (a): Inter-token distance for 10 3 10^3 1 0 3 experiments. (b): Correlation between x i ( t ) x_i(t) x i ( t ) and v 1 v_1 v 1 for t = 1 , … , 24 t = 1,\ldots,24 t = 1 , … , 24 over multiple experiments. (c): Histogram of the correlation between x i ( T ) x_i(T) x i ( T ) and v 1 v_1 v 1 at T = 24 T = 24 T = 24 over 10 3 10^3 1 0 3 experiments.
Conclusions
This paper provides a thorough analysis of the asymptotic behavior of a discrete-time self-attention dynamical system, meant to represent an idealized transformer. The locus of equilibria and their stability properties are investigated and confirmed to be analogous to their continuous-time counterparts. The analysis provides insight into the convergence
properties of this model: the consensus point always aligns itself with the direction of the principal eigenvector of the value matrix, including in the multihead case (where the value matrix is replaced by what we call the layer matrix). These predictions are confirmed by investigating the behavior of a real shared weight transformer.
Acknowledgments
The author would like to thank Chenglong Li for providing the weight matrices of the ALBERT transformer.