Demystifying Oversmoothing in Attention-Based Graph Neural Networks
Oversmoothing in Graph Neural Networks (GNNs) refers to the phenomenon where
increasing network depth leads to homogeneous node representations. While
previous work has established that Graph Convolutional Networks (GCNs)
exponentially lose expressive power, it remains controversial whether the graph
attention mechanism can mitigate oversmoothing. In this work, we provide a
definitive answer to this question through a rigorous mathematical analysis, by
viewing attention-based GNNs as nonlinear time-varying dynamical systems and
incorporating tools and techniques from the theory of products of inhomogeneous
matrices and the joint spectral radius. We establish that, contrary to popular
belief, the graph attention mechanism cannot prevent oversmoothing and loses
expressive power exponentially. The proposed framework extends the existing
results on oversmoothing for symmetric GCNs to a significantly broader class of
GNN models, including random walk GCNs, Graph Attention Networks (GATs) and
(graph) transformers. In particular, our analysis accounts for asymmetric,
state-dependent and time-varying aggregation operators and a wide range of
common nonlinear activation functions, such as ReLU, LeakyReLU, GELU and SiLU.
Xinyi Wu, Amir Ajorlou, Zihui Wu, Ali Jadbabaie
# Demystifying Oversmoothing in

###### Abstract

Oversmoothing in Graph Neural Networks (GNNs) refers to the phenomenon where increasing network depth leads to homogeneous node representations. While previous work has established that Graph Convolutional Networks (GCNs) exponentially lose expressive power, it remains controversial whether the graph attention mechanism can mitigate oversmoothing. In this work, we provide a definitive answer to this question through a rigorous mathematical analysis, by viewing attention-based GNNs as nonlinear time-varying dynamical systems and incorporating tools and techniques from the theory of products of inhomogeneous matrices and the joint spectral radius. We establish that, contrary to popular belief, the graph attention mechanism cannot prevent oversmoothing and loses expressive power exponentially. The proposed framework extends the existing results on oversmoothing for symmetric GCNs to a significantly broader class of GNN models. In particular, our analysis accounts for asymmetric, state-dependent and time-varying aggregation operators and a wide range of common nonlinear activation functions, such as ReLU, LeakyReLU, GELU and SiLU.

## 1 Introduction

Graph neural networks (GNNs) have emerged as a powerful framework for learning with graph-structured data [4; 8; 9; 13; 19; 32; 36] and have shown great promise in diverse domains such as molecular biology [43], physics [1] and recommender systems [38]. Most GNN models follow the _message-passing_ paradigm [12], where the representation of each node is computed by recursively aggregating and transforming the representations of its neighboring nodes.

One notable drawback of repeated message-passing is _oversmoothing_, which refers to the phenomenon that stacking message-passing GNN layers makes node representations of the same connected component converge to the same vector [5; 18; 19; 24; 26; 31; 39]. As a result, whereas depth has been considered crucial for the success of deep learning in many fields such as computer vision [16], most GNNs used in practice remain relatively shallow and often only have few layers [19; 36; 40]. On the theory side, while previous works have shown that the symmetric Graph Convolution Networks (GCNs) with ReLU and LeakyReLU nonlinearities exponentially lose expressive power, analyzing the oversmoothing phenomenon in other types of GNNs is still an open question [5; 26]. In particular, the question of whether the graph attention mechanism can prevent oversmoothing has not been settled yet. Motivated by the capacity of graph attention to distinguish the importance of different edges in the graph, some works claim that oversmoothing is alleviated in Graph Attention Networks (GATs), heuristically crediting to GATs' ability to learn adaptive node-wise aggregation operators via the attention mechanism [25]. On the other hand, it has been empirically observed that similar to the case of GCNs, oversmoothing seems inevitable for GATs [30; 31].
In this paper, we provide a definitive answer to this question -- attention-based GNNs also lose expressive power exponentially, albeit potentially at a slower exponential rate compared to GCNs. Given that attention-based GNNs can be viewed as nonlinear time-varying dynamical systems, our analysis is built on the theory of products of inhomogeneous matrices [14; 31] and the concept of joint spectral radius [29], as these methods have been long proved effective in the analysis of time-inhomogeneous markov chains and ergodicity of dynamical systems [2; 14; 33]. While classical results only apply to generic one-dimensional linear time-varying systems, we address four major challenges arising in analyzing attention-based GNNs: (1) the aggregation operators computed by attention are state-dependent, in contrast to conventional fixed graph convolutions; (2) the systems are multi-dimensional, which involves the coupling across feature dimensions; (3) the dynamics are nonlinear due to the nonlinear activation function in each layer; (4) the learnable weights and aggregation operators across different layers result in time-varying dynamical systems.

**Below, we highlight our key contributions:**

* As our main contribution, we establish that oversmoothing happens exponentially as model depth increases for attention-based GNNs, resolving the long-standing debate about whether attention-based GNNs can prevent oversmoothing.
* We analyze attention-based GNNs through the lens of nonlinear, time-varying dynamical systems. The strength of our analysis stems from its ability to exploit the inherently common connectivity structure among the typically asymmetric state-dependent aggregation operators at different attentional layers. This enables us to derive rigorous theoretical results on the ergodicity of infinite products of matrices associated with the evolution of node representations across layers. Incorporating results from the theory of products of inhomogeneous matrices and their joint spectral radius, we then establish that oversmoothing happens at an exponential rate for attention-based GNNs from our ergodicity results.
* Our analysis generalizes the existing results on oversmoothing for symmetric GCNs to a significantly broader class of GNN models with asymmetric, state-dependent and time-varying aggregation operators and nonlinear activation functions under general conditions. In particular, our analysis can accommodate a wide range of common nonlinearities such as ReLU, LeakyReLU, and even non-monotone ones like GELU and SiLU. We validate our theoretical results on three real-world datasets with two attention-based GNN architectures and five common nonlinearities.

## 2 Related Work

Oversmoothing problem in GNNsOversmoothing is a well-known problem in deep GNNs, and many techniques have been proposed in order to mitigate it practically [6; 15; 20; 21; 28; 41; 44]. On the theory side, analysis of oversmoothing has only been carried out for the graph convolution case [5; 18; 26; 39]. In particular, by viewing graph convolutions as a form of Laplacian filter, prior works have shown that for GCNs, the node representations within each connected component of a graph will converge to the same value exponentially [5; 26]. However, oversmoothing is also empirically observed in attention-based GNNs such as GATs [30; 31]. Although some people hypothesize based on heuristics that attention can alleviate oversmoothing [25], a rigorous analysis of oversmoothing in attention-based GNNs remains open [5].

Theoretical analysis of attention-based GNNsExisting theoretical results on attention-based GNNs are limited to one-layer graph attention. Recent works in this line include Brody et al. [3] showing that the ranking of attention scores computed by a GAT layer is unconditioned on the query node, and Fountoulakis et al. [11] studying node classification performance of one-layer GATs on a random graph model. More relevantly, Wang et al. [37] made a claim that oversmoothing is asymptotically inevitable in GATs. Aside from excluding nonlinearities in the analysis, there are several flaws in the proof of their main result (Theorem 2). In particular, their analysis assumes the same stationary distribution for all the stochastic matrices output by attention at different layers. This is typically not the case given the state-dependent and time-varying nature of these matrices. In fact, the main challenge in analyzing multi-layer attention lies in the state-dependent and time-varying nature of these input-output mappings. Our paper offers novel contributions to the research on attention-based GNNs by developing a rich set of tools and techniques for analyzing multi-layer
graph attention. This addresses a notable gap in the existing theory, which has primarily focused on one-layer graph attention, and paves the way for future research to study other aspects of multi-layer graph attention.

## 3 Problem Setup

### Notations

Let \(\mathbb{R}\) be the set of real numbers and \(\mathbb{N}\) be the set of natural numbers. We use the shorthands \([n]:=\{1,\ldots,n\}\) and \(\mathbb{N}_{\geq 0}:=\mathbb{N}\cup\{0\}\). We denote the zero-vector of length \(N\) by \(\mathbf{0}\in\mathbb{R}^{N}\) and the all-one vector of length \(N\) by \(\mathbf{1}\in\mathbb{R}^{N}\). We represent an undirected graph with \(N\) nodes by \(\mathcal{G}=(A,X)\), where \(A\in\{0,1\}^{N\times N}\) is the _adjacency matrix_ and \(X\in\mathbb{R}^{N\times d}\) are the _node feature vectors_ of dimension \(d\). Let \(E(\mathcal{G})\) be the set of edges of \(\mathcal{G}\). For nodes \(i,j\in[N]\), \(A_{ij}=1\) if and only if \(i\) and \(j\) are connected with an edge in \(\mathcal{G}\), i.e., \((i,j)\in E(\mathcal{G})\). For each \(i\in[N]\), \(X_{i}\in\mathbb{R}^{d}\) represents the feature vector for node \(i\). We denote the _degree matrix_ of \(\mathcal{G}\) by \(D_{\mathrm{deg}}=\mathrm{diag}(A\mathbf{1})\) and the set of all neighbors of node \(i\) by \(\mathcal{N}_{i}\).

Let \(\|\cdot\|_{2}\), \(\|\cdot\|_{\infty}\), \(\|\cdot\|_{F}\) be the \(2\)-norm, \(\infty\)-norm and Frobenius norm, respectively. We use \(\|\cdot\|_{\max}\) to denote the matrix max norm, i.e., for a matrix \(M\in\mathbb{R}^{m\times n}\), \(\|M\|_{\max}:=\max\limits_{ij}|M_{ij}|\). We use \(\leq_{\mathrm{ew}}\) to denote element-wise inequality. Lastly, for a matrix \(M\), we denote its \(i^{th}\) row by \(M_{i}\). and \(j^{th}\) column by \(M_{\cdot j}\).

### Graph attention mechanism

We adopt the following definition of graph attention mechanism. Given node representation vectors \(X_{i}\) and \(X_{j}\), we first apply a shared learnable linear transformation \(W\in\mathbb{R}^{d\times d^{\prime}}\) to each node, and then use an attention function \(\Psi:\mathbb{R}^{d^{\prime}}\times\mathbb{R}^{d^{\prime}}\rightarrow\mathbb{R}\) to compute a raw attention coefficient

\[e_{ij}=\Psi(W^{\top}X_{i},W^{\top}X_{j})\]

that indicates the importance of node \(j\)'s features to node \(i\). Then the graph structure is injected into the mechanism by performing masked attention, where for each node \(i\), we only compute its attention to its neighbors. To make coefficients easily comparable across different nodes, we normalize \(e_{ij}\) among all neighboring nodes \(j\) of node \(i\) using the softmax function to get the normalized attention coefficients:

\[P_{ij}=\mathrm{softmax}_{j}(e_{ij})=\frac{\exp(e_{ij})}{\sum_{k\in\mathcal{N} _{i}}\exp(e_{ik})}\,.\]

The matrix \(P\), where the entry in the \(i^{th}\) row and the \(j^{th}\) column is \(P_{ij}\), is a row stochastic matrix. We refer to \(P\) as an _aggregation operator_ in message-passing.

### Attention-based GNNs

Having defined the graph attention mechanism, we can now write the update rule of a single graph attentional layer as

\[X^{\prime}=\sigma(PXW)\,,\]

where \(X\) and \(X^{\prime}\) are are the input and output node representations, respectively, \(\sigma(\cdot)\) is a pointwise nonlinearity function, and the aggregation operator \(P\) is a function of \(XW\).

As a result, the output of the \(t^{th}\) graph attentional layers can be written as

\[X^{(t+1)}=\sigma(P^{(t)}X^{(t)}W^{(t)})\qquad t\in\mathbb{N}_{\geq 0}, \tag{1}\]

where \(X^{(0)}=X\) is the input node features, \(W^{(t)}\in\mathbb{R}^{d^{\prime}\times d^{\prime}}\) for \(t\in\mathbb{N}\) and \(W^{(0)}\in\mathbb{R}^{d\times d^{\prime}}\). For the rest of this work, without loss of generality, we assume that \(d=d^{\prime}\).

The above definition is based on _single-head_ graph attention. _Multi-head_ graph attention uses \(K\in\mathbb{N}\) weight matrices \(W_{1},\ldots,W_{K}\) in each layer and averages their individual single-head outputs [11; 36]. Without loss of generality, we consider single graph attention in our analysis in Section 4, but we note that our results automatically apply to the multi-head graph attention setting since \(K\) is finite.
### Measure of oversmoothing

We adopt the following notion of oversmoothing proposed in Rusch et al. [31]:

**Definition 1**.: _For an undirected and connected graph \(\mathcal{G}\), \(\mu:\mathbb{R}^{N\times d}\to\mathbb{R}_{\geq 0}\) is called a node similarity measure if it satisfies the following axioms:_

1. \(\exists c\in\mathbb{R}^{d}\) _such that_ \(X_{i}=c\) _for all node_ \(i\) _if and only if_ \(\mu(X)=0\)_, for_ \(X\in\mathbb{R}^{N\times d}\)_;_
2. \(\mu(X+Y)\leq\mu(X)+\mu(Y)\)_, for all_ \(X,Y\in\mathbb{R}^{N\times d}\)_._

_Then oversmoothing with respect to \(\mu\) is defined as the layer-wise exponential convergence of the node-similarity measure \(\mu\) to zero, i.e. for \(t\in\mathbb{N}\), with constants \(C_{1}\), \(C_{2}>0\),_

\[\mu(X^{(t)})\leq C_{1}e^{-C_{2}t}. \tag{2}\]

We establish our results on oversmoothing for attention-based GNNs using the following node similarity measure:

\[\mu(X):=\|X-\mathbf{1}\gamma_{X}\|_{F},\text{ where }\gamma_{X}=\frac{\mathbf{1} ^{\top}X}{N}\,. \tag{3}\]

**Proposition 1**.: \(\|X-\mathbf{1}\gamma_{X}\|_{F}\) _is a node similarity measure._

The proof of the above proposition is provided in Appendix B. Other common node similarity measures include the Dirichlet energy [5; 30; 31]. Our measure is mathematically equivalent to the measure \(\inf\limits_{Y=\mathbf{1}c^{\top},c\in\mathbb{R}^{d}}\{\|X-Y\|_{F}\}\) defined in Oono and Suzuki [26], but our form is more direct to compute. One way to see the equivalence is to consider the orthogonal projection into the space perpendicular to \(\mathrm{span}\{\mathbf{1}\}\), denoted by \(B\in\mathbb{R}^{(N-1)\times N}\). Then our definition of \(\mu\) satisfies \(\|X-\mathbf{1}\gamma_{x}\|_{F}=\|BX\|_{F}\), where the latter quantity is exactly the measure defined in [26].

### Assumptions

We make the following assumptions (in fact, quite minimal) in deriving our results:

1. The graph \(\mathcal{G}\) is connected and has a self-loop at each node.
2. The attention function \(\Psi(\cdot,\cdot)\) is continuous.
3. The sequence \(\{\|\prod_{t=0}^{k}|W^{(t)}|\|_{\max}\}_{k=0}^{\infty}\) is bounded.
4. The point-wise nonlinear activation function \(\sigma(\cdot)\) satisfies \(0\leq\frac{\sigma(x)}{x}\leq 1\) for \(x\neq 0\) and \(\sigma(0)=0\).

We note that all of these assumptions are either standard or quite general. Specifically, \(\mathbf{A1}\) is a standard assumption for theoretical analysis on graphs. For graphs with more than one connected components, the same results apply to each connected component. \(\mathbf{A1}\) can also be replaced with requiring the graph \(\mathcal{G}\) to be connected and non-bipartite. Self-loops and non-bipartiteness both ensure that long products of stochastic matrices corresponding to aggregation operators in different graph attentional layers will eventually become strictly positive.

The assumptions on the GNN architecture \(\mathbf{A2}\) and \(\mathbf{A4}\) can be easily verified for commonly used GNN designs. For example, the attention function \(\mathrm{LeakyReLU}(a^{\top}[W^{\top}X_{i}||W^{\top}X_{j}]),a\in\mathbb{R}^{2d^ {\prime}}\) used in the GAT [36], where \([\cdot||\cdot]\) denotes concatenation, is a specific case that satisfies \(\mathbf{A2}\). As for \(\mathbf{A4}\), one way to satisfy it is to have \(\sigma\) be \(1\)-Lipschitz and \(\sigma(x)\leq 0\) for \(x<0\) and \(\sigma(x)\geq 0\) for \(x>0\). Then it is easy to verify that most of the commonly used nonlinear activation functions such as ReLU, LeakyReLU, GELU, SiLU, ELU, tanh all satisfy \(\mathbf{A4}\).

Lastly, \(\mathbf{A3}\) is to ensure boundedness of the node representations' trajectories \(X^{(t)}\) for all \(t\in\mathbb{N}_{\geq 0}\). Such regularity assumptions are quite common in the asymptotic analysis of dynamical systems, as is also the case for the prior works analyzing oversmoothing in symmetric GCNs [5; 26].

## 4 Main Results

In this section, we lay out a road-map for deriving our main results, highlighting the key ideas of the proofs. The complete proofs are provided in the Appendices.
We start by discussing the dynamical system formulation of attention-based GNNs in Section 4.1. By showing the boundedness of the node representations' trajectories, we prove the existence of a common connectivity structure among aggregation operators across different graph attentional layers in Section 4.2. This implies that graph attention cannot fundamentally change the graph connectivity, a crucial property that will eventually lead to oversmoothing. In Section 4.3, we develop a framework for investigating the asymptotic behavior of attention-based GNNs by introducing the notion of ergodicity and its connections to oversmoothing. Then utilizing our result on common connectivity structure among aggregation operators, we establish ergodicity results for the systems associated with attention-based GNNs. In Section 4.4, we introduce the concept of the joint spectral radius for a set of matrices [29] and employ it to deduce exponential convergence of node representations to a common vector from our ergodicity results. Finally, we present our main result on oversmoothing in attention-based GNNs in Section 4.5 and comment on oversmoothing in GCNs in comparison with attention-based GNNs in Section 4.6.

### Attention-based GNNs as nonlinear time-varying dynamical systems

The theory of dynamical systems concerns the evolution of some state of interest over time. By viewing the model depth \(t\) as the time variable, the input-output mapping at each graph attentional layer \(X^{(t+1)}=\sigma(P^{(t)}X^{(t)}W^{(t)})\) describes a nonlinear time-varying dynamical system. The attention-based aggregation operator \(P^{(t)}\) is state-dependent as it is a function of \(X^{(t)}W^{(t)}\). Given the notion of oversmoothing defined in Section 3.4, we are interested in characterizing behavior of \(X^{(t)}\) as \(t\to\infty\).

If the activation function \(\sigma(\cdot)\) is the identity map, then repeated application of (1) gives

\[X^{(t+1)}=P^{(t)}\dots P^{(0)}XW^{(0)}\dots W^{(t)}\,.\]

The above linear form would enable us to leverage the rich literature on the asymptotic behavior of the products of inhomogeneous row-stochastic matrices (see, e.g., [14; 33]) in analyzing the long-term behavior of attention-based GNNs. Such a neat expansion, however, is not possible when dealing with a nonlinear activation function \(\sigma(\cdot)\). To find a remedy, let us start by observing that element-wise application of \(\sigma\) to a vector \(y\in\mathbb{R}^{d}\) can be written as

\[\sigma(y)=\operatorname{diag}\left(\frac{\sigma(y)}{y}\right)y\,, \tag{4}\]

where \(\operatorname{diag}\left(\frac{\sigma(y)}{y}\right)\) is a diagonal matrix with \(\sigma(y_{i})/y_{i}\) on the \(i^{th}\) diagonal entry. Defining \(\sigma(0)/0:=1\) along with the assumption \(\sigma(0)=0\) in **A4**, it is easy to check that the above identity still holds for vectors with zero entries.

We can use (4) to write the \(i^{th}\) column of \(X^{(t+1)}\) as

\[X^{(t+1)}_{\cdot i}=\sigma(P^{(t)}(X^{(t)}W^{(t)})_{\cdot i})=D^{(t)}_{i}P^{(t )}(X^{(t)}W^{(t)})_{\cdot i}=D^{(t)}_{i}P^{(t)}\sum_{j=1}^{d}W^{(t)}_{ji}X^{(t) }_{\cdot j}\,, \tag{5}\]

where \(D^{(t)}_{i}\) is a diagonal matrix. It follows from the assumption on the nonlinearities **A4** that

\[\operatorname{diag}(\mathbf{0})\leq_{\text{ew}}D^{(t)}_{i}\leq_{\text{ew}} \operatorname{diag}(\mathbf{1})\,.\]

We define \(\mathcal{D}\) to be the set of all possible diagonal matrices \(D^{(t)}_{i}\) satisfying the above inequality:

\[\mathcal{D}:=\{\operatorname{diag}(\mathbf{d}):\mathbf{d}\in\mathbb{R}^{N}, \mathbf{0}\leq_{\text{ew}}\mathbf{d}\leq_{\text{ew}}\mathbf{1}\}.\]

Using (5) recursively, we arrive at the following formulation for \(X^{(t+1)}_{\cdot i}\):

\[X^{(t+1)}_{\cdot i}=\sum_{j_{t+1}=i,\,(j_{t},\dots,j_{0})\in[d]^{t+1}}\left( \prod_{k=0}^{t}W^{(k)}_{j_{t+1}j_{k}}\right)D^{(t)}_{j_{t+1}}P^{(t)}...D^{(0)} _{j_{1}}P^{(0)}X^{(0)}_{j_{0}}\,. \tag{6}\]
### Common connectivity structure among aggregation operators across different layers

We can use the formulation in (6) to show the boundedness of the node representations' trajectories \(X^{(t)}\) for all \(t\in\mathbb{N}_{\geq 0}\), which in turn implies the boundedness of the input to graph attention in each layer, \(X^{(t)}W^{(t)}\).

**Lemma 1**.: _Under assumptions_ **A3**_-_**A4**_, there exists \(C>0\) such that \(\|X^{(t)}\|_{\max}\leq C\) for all \(t\in\mathbb{N}_{\geq 0}\)._

For a continuous \(\Psi(\cdot,\cdot)\)1, the following lemma is a direct consequence of Lemma 1, suggesting that the graph attention mechanism cannot fundamentally change the connectivity pattern of the graph.

Footnote 1: More generally, for \(\Psi(\cdot,\cdot)\) that outputs bounded attention scores for bounded inputs.

**Lemma 2**.: _Under assumptions_ **A2**_-_**A4**_, there exists \(\epsilon>0\) such that for all \(t\in\mathbb{N}_{\geq 0}\) and for any \((i,j)\in E(\mathcal{G})\), we have \(P_{ij}^{(t)}\geq\epsilon\)._

One might argue that Lemma 2 is an artifact of the continuity of the softmax function. The softmax function is, however, often favored in attention mechanisms because of its trainability in back propagation compared to discontinuous alternatives such as hard thresholding. Besides trainability issues, it is unclear on a conceptual level whether it is reasonable to absolutely drop an edge from the graph as is the case for hard thresholding. Lemma 2 is an important step towards the main convergence result of this work, which states that all the nodes will converge to the same representation vector at an exponential rate. We define the family of row-stochastic matrices satisfying Lemma 2 below.

**Definition 2**.: _Let \(\epsilon>0\). We define \(\mathcal{P}_{\mathcal{G},\epsilon}\) to be the set of row-stochastic matrices satisfying the following conditions:_

1. \(\epsilon\leq P_{ij}\leq 1\)_, if_ \((i,j)\in E(\mathcal{G})\)_,_
2. \(P_{ij}=0,\) _if_ \((i,j)\notin E(\mathcal{G})\)_,_

### Ergodicity of infinite products of matrices

_Ergodicity_, in its most general form, deals with the long-term behavior of dynamical systems. The oversmoothing phenomenon in GNNs defined in the sense of (2) concerns the convergence of all rows of \(X^{(t)}\) to a common vector at an exponential rate. To this end, we define ergodicity in our analysis as the convergence of infinite matrix products to a rank-one matrix with identical rows.

**Definition 3** (Ergodicity).: _Let \(B\in\mathbb{R}^{(N-1)\times N}\) be the orthogonal projection onto the space orthogonal to \(\operatorname{span}\{\mathbf{1}\}\). A sequence of matrices \(\{M^{(n)}\}_{n=0}^{\infty}\) is ergodic if_

\[\lim_{t\to\infty}B\prod_{n=0}^{t}M^{(n)}=0\,.\]

We will take advantage of the following properties of the projection matrix \(B\) already established in Blondel et al. [2]:

1. \(B\mathbf{1}=0\);
2. \(\|Bx\|_{2}=\|x\|_{2}\) for \(x\in\mathbb{R}^{N}\) if \(x^{\top}\mathbf{1}=0\);
3. For \(M\in\mathbb{R}^{N\times N}\), there exists a unique matrix \(\tilde{M}\in\mathbb{R}^{(N-1)\times(N-1)}\) such that \(BM=\tilde{M}B\,.\)

We can use the existing results on the ergodicity of infinite products of inhomogeneous stochastic matrices [14, 33] to show that any sequence of matrices in \(\mathcal{P}_{\mathcal{G},\epsilon}\) is ergodic.

**Lemma 3**.: _Fix \(\epsilon>0\). Consider a sequence of matrices \(\{P^{(t)}\}_{t=0}^{\infty}\) in \(\mathcal{P}_{\mathcal{G},\epsilon}\). That is, \(P^{(t)}\in\mathcal{P}_{\mathcal{G},\epsilon}\) for all \(t\in\mathbb{N}_{\geq 0}\). Then \(\{P^{(t)}\}_{t=0}^{\infty}\) is ergodic._

The main proof strategy for Lemma 3 is to make use of the Hilbert projective metric and the Birkhoff contraction coefficient. These are standard mathematical tools to prove that an infinite product of inhomogeneous stochastic matrices is ergodic. We refer interested readers to the textbooks [14, 33] for a comprehensive study of these subjects.
Despite the nonlinearity of \(\sigma(\cdot)\), the formulation (6) enables us to express the evolution of the feature vector trajectories as a weighted sum of products of matrices of the form \(DP\) where \(D\in\mathcal{D}\) and \(P\in\mathcal{P}_{\mathcal{G},\epsilon}\). We define the set of such matrices as

\[\mathcal{M}_{\mathcal{G},\epsilon}:=\{DP:D\in\mathcal{D},P\in\mathcal{P}_{ \mathcal{G},\epsilon}\}\,.\]

A key step in proving oversmoothing for attention-based GNNs under our assumptions is to show the ergodicity of the infinite products of matrices in \(\mathcal{M}_{\mathcal{G},\epsilon}\). In what follows, we lay out the main ideas of the proof, and refer readers to Appendix F for the details.

Consider a sequence \(\{D^{(t)}P^{(t)}\}_{t=0}^{\infty}\) in \(\mathcal{M}_{\mathcal{G},\epsilon}\), that is, \(D^{(t)}P^{(t)}\in\mathcal{M}_{\mathcal{G},\epsilon}\) for all \(t\in\mathbb{N}_{\geq 0}\). For \(t_{0}\leq t_{1}\), define

\[Q_{t_{0},t_{1}}:=D^{(t_{1})}P^{(t_{1})}\dots D^{(t_{0})}P^{(t_{0})}\]

and

\[\delta_{t}=\|D^{(t)}-I_{N}\|_{\infty}\,,\]

where \(I_{N}\) denotes the \(N\times N\) identity matrix. The common connectivity structure among \(P^{(t)}\)'s established in Section 4.2 allows us to show that long products of matrices \(DP\) from \(\mathcal{M}_{\mathcal{G},\epsilon}\) will eventually become a contraction in \(\infty\)-norm. More precisely, we can show that there exists \(T\in\mathbb{N}\) and \(0<c<1\) such that for all \(t\in\mathbb{N}_{\geq 0}\),

\[\|Q_{t,t+T}\|_{\infty}\leq 1-c\delta_{t}.\]

Next, define \(\beta_{k}:=\prod_{t=0}^{k}(1-c\delta_{t})\) and let \(\beta:=\lim_{k\to\infty}\beta_{k}\). Note that \(\beta\) is well-defined because the partial product is non-increasing and bounded from below. We can use the above contraction property to show the following key lemma.

**Lemma 4**.: _Let \(\beta_{k}:=\prod_{t=0}^{k}(1-c\delta_{t})\) and \(\beta:=\lim_{k\to\infty}\beta_{k}\)._

1. _If_ \(\beta=0\)_, then_ \(\lim_{k\to\infty}Q_{0,k}=0\,;\)__
2. _If_ \(\beta>0\)_, then_ \(\lim_{k\to\infty}BQ_{0,k}=0\,.\)__

The ergodicity of sequences of matrices in \(\mathcal{M}_{\mathcal{G},\epsilon}\) immediately follows from Lemma 4.

**Lemma 5**.: _Any sequence \(\{D^{(t)}P^{(t)}\}_{t=0}^{\infty}\) in \(\mathcal{M}_{\mathcal{G},\epsilon}\) is ergodic._

RemarkThe proof techniques developed in [5, 26] are restricted to symmetric matrices hence cannot be extended to more general family of GNNs, as they primarily rely on matrix norms for convergence analysis. Analyses solely using matrix norms are often too coarse to get meaningful results when it comes to asymmetric matrices. For instance, while the matrix \(2\)-norm and matrix eigenvalues are directly related for symmetric matrices, the same does not generally hold for asymmetric matrices. Our analysis, on the other hand, exploits the inherently common connectivity structure among these matrices in deriving the ergodicity results in Lemma 3-5.

### Joint spectral radius

The last step in proving our main results is to show that oversmoothing happens at an exponential rate in attention-based GNNs under assumptions **A1**-**A4**, using the ergodicity results established in the previous section. To this end, we introduce the notion of _joint spectral radius_, which is a generalization of the classical notion of spectral radius of a single matrix to a set of matrices. The notion was initially proposed by Gian-Carlo Rota and Gilbert Strang [29] in 1960 and later popularized by the work of Ingrid Daubechies and Jeffrey Lagarias [7]. Since then, it has found a wide range of applications, including the study of wavelets, combinatorial words theory, and multi-agent systems. We refer interested readers to the textbook [17] for a comprehensive study of the subject.

**Definition 4** (Joint Spectral Radius).: _For a collection of matrices \(\mathcal{M}\), the joint spectral radius \(\operatorname{JSR}(\mathcal{M})\) is defined to be_

\[\operatorname{JSR}(\mathcal{M})=\limsup_{k\to\infty}\sup_{M_{1},M_{2},\dots,M _{k}\in\mathcal{M}}\|M_{1}M_{2}...M_{k}\|^{\frac{1}{k}}\,,\]

_and it is independent of the norm used._
In plain words, the joint spectral radius measures the maximal asymptotic growth rate that can be obtained by forming long products of matrices taken from the set \(\mathcal{M}\). To analyze the convergence rate of products of matrices in \(\mathcal{M}_{\mathcal{G},\epsilon}\) to a rank-one matrix with identical rows, we investigate the dynamics induced by the matrices on the subspace orthogonal to \(\mathrm{span}\{\mathbf{1}\}\). More precisely, with the notion of ergodicity in Definition 3 and the goal of studying the convergence rate of a matrix product \(BM_{1}M_{2}\ldots M_{k}\) where each \(M_{i}\in\mathcal{M}_{\mathcal{G},\epsilon}\), we use the third property of the orthogonal projection \(B\) established in Section 4.3 to write

\[BM_{1}M_{2}\ldots M_{k}=\tilde{M}_{1}\tilde{M}_{2}...\tilde{M}_{k}B\,,\]

where each \(\tilde{M}_{i}\) is the unique matrix in \(\mathbb{R}^{(N-1)\times(N-1)}\) that satisfies \(BM_{i}=\tilde{M}_{i}B\). To analyze products of such matrices \(\tilde{M}_{i}\), let us define \(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon}:=\{\tilde{M}:BM=\tilde{M}B,M\in \mathcal{M}_{\mathcal{G},\epsilon}\}\). We can use the ergodiciy result developed in the previous section, Lemma 5, to show that the joint spectral radius of \(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon}\) is strictly less than \(1\).

**Lemma 6**.: _Let \(0<\epsilon<1\). Under assumptions_ **A1**_-_**A4**_, \(\mathrm{JSR}(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon})<1\)._

It follows from the definition of the joint spectral radius that if \(\mathrm{JSR}(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon})<1\), for any \(\mathrm{JSR}(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon})<q<1\), there exists a \(C\) for which

\[\|\tilde{M}_{1}\tilde{M}_{2}...\tilde{M}_{k}y\|\leq Cq^{k}\|y\| \tag{7}\]

for all \(y\in\mathbb{R}^{N-1}\) and \(\tilde{M}_{1},\tilde{M}_{2},...,\tilde{M}_{k}\in\tilde{\mathcal{M}}_{\mathcal{ G},\epsilon}\).

### Main Theorem

Applying (7) to the recursive expansion of \(X_{\cdot i}^{(t+1)}\) in (6) using the \(2\)-norm, we can prove the exponential convergence of \(\mu(X^{(t)})\) to zero for the similarity measure \(\mu(\cdot)\) defined in (3), which in turn implies the convergence of node representations to a common representation at an exponential rate. This completes the proof of the main result of this paper, which states that oversmoothing defined in (2) is unavoidable for attention-based GNNs.

**Theorem 1** (Oversmoothing happens exponentially in attention-based GNNs).: _Under assumptions_ **A1**_-_**A4**_, \(\mathrm{JSR}(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon})<1\) and for any \(q\) satisfying \(\mathrm{JSR}(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon})<q<1\), there exists \(C_{1}(q)>0\) such that_

\[\mu(X^{(t)})\leq C_{1}q^{t}\,\forall t\geq 0\,,\]

_where \(\mu(X)=\|X-\frac{\mathbf{1}\mathbf{1}^{\top}X}{N}\|_{F}\). As a result, node representations \(X^{(t)}\) exponentially converge to the same value as the model depth \(t\rightarrow\infty\)._

Theorem 1 establishes that oversmoothing is asymptotically inevitable for attention-based GNNs with general nonlinearities. Despite similarity-based importance assigned to different nodes via the aggregation operator \(P^{(t)}\), _such attention-based mechanisms are yet unable to fundamentally change the connectivity structure of \(P^{(t)}\)_, resulting in node representations converging to a common vector at an exponential rate. Our results hence indirectly support the emergence of alternative ideas for changing the graph connectivity structure such as edge-dropping [15; 28] or graph-rewiring [21], in an effort to mitigate oversmoothing.

### Comparison with the GCN

Computing or approximating the joint spectral radius for a given set of matrices is known to be hard in general [35], yet it is straightforward to lower bound \(\mathrm{JSR}(\mathcal{M}_{\mathcal{G},\epsilon})\) as stated in the next proposition.

**Proposition 2**.: _Let \(\lambda\) be the second largest eigenvalue of \(D_{\mathrm{deg}}^{-1/2}AD_{\mathrm{deg}}^{-1/2}\). Then under assumptions_ **A1**_-_**A4**_, it holds that \(\lambda\leq\mathrm{JSR}(\tilde{\mathcal{M}}_{\mathcal{G},\epsilon})\)._

A direct consequence of the above result is that the upper bound \(q\) on the convergence rate that we get for graph attention in Theorem 1 is at least as large as \(\lambda\). On the other hand, previous work has already established that in the graph convolution case, the convergence rate of \(\mu(X^{(t)})\) is \(O(\lambda^{t})\)[5; 26]. It is thus natural to expect attention-based GNNs to potentially have better expressive power at finite depth than GCNs, even though they both inevitably suffer from oversmoothing. This is also evident from the numerical experiments that we present in the next section.
Numerical Experiments

In this section, we validate our theoretical findings via numerical experiments using the three commonly used benchmark datasets: Cora, CiteSeer and PubMed [42]. More details about the experiments are provided in Appendix J.

For each dataset, we trained a \(128\)-layer single-head GAT and a \(128\)-layer GCN with the random walk graph convolution \(D_{\text{des}}^{-1}A\), each having 32 hidden dimensions and trained using the standard features and splits. The GCN with the random walk graph convolution is a special type of attention-based GNNs where the attention function is constant. For each GNN model, we considered various nonlinear activation functions: ReLU, LeakyReLU (with three different negative slope values: \(0.01\), \(0.4\) and \(0.8\)) and GELU. Here, we chose GELU as an illustration of the generality of our assumption on nonlinearities, covering even non-monotone activation functions such as GELU. We ran each experiment \(10\) times. Figure 1 shows the evolution of \(\mu(X^{(n)})\) in log-log scale on the largest connected component of each graph (which accounts for \(91.8\%/63.7\%/100\%\) of total nodes in Cora/CiteSeer/PubMed, respectively) as we forward pass the input \(X\) into a trained model. The solid curve is the average over \(10\) runs and the band indicates one standard deviation around the average.

We observe that, as predicted by our theory, oversmoothing happens at an exponential rate for both GATs and GCNs, regardless of the choice of nonlinear activation functions in the GNN architectures. Notably, GCNs exhibit a significantly faster rate of oversmoothing compared to GATs. This aligns the observation made in Section 4.6, expecting a potentially better expressive power for GATs than GCNs at finite depth. Furthermore, the exponential convergence rate of oversmoothing varies among GNNs with different nonlinear activation functions. From a theory perspective, as different activation functions constitute different subsets of \(\mathcal{M}_{\mathcal{G},\epsilon}\) and different sets of matrices have different joint spectral radii, it is not surprising that the choice of nonlinear activation function would affect the convergence rate. In particular, among the nonlinearities we considered, ReLU in fact magnifies oversmoothing the second most. As a result, although ReLU is often the default choice for the standard implementation of many GNN architectures [10; 19], one might wish to consider switching to other nonlinearities to better mitigate oversmoothing.

## 6 Conclusion

Oversmoothing is one of the central challenges in developing more powerful GNNs. In this work, we reveal new insights on oversmoothing in attention-based GNNs by rigorously providing a negative answer to the open question of whether graph attention can implicitly prevent oversmoothing. By analyzing the graph attention mechanism within the context of nonlinear time-varying dynamical

Figure 1: Evolution of \(\mu(X^{(n)})\) (in log-log scale) on the largest connected component of three benchmark datasets: Cora, Citeseer, and PubMed. Oversmoothing happens exponentially in both GCNs and GATs with the rates varying depending on the choice of activation function. Notably, GCNs demonstrate faster rates of oversmoothing compared to GATs.
systems, we establish that attention-based GNNs lose expressive power exponentially as model depth increases.

We upper bound the convergence rate for oversmoothing under very general assumptions on the nonlinear activation functions. One may try to tighten the bounds by refining the analysis separately for each of the commonly used activation functions. Future research should also aim to improve the design of graph attention mechanisms based on our theoretical insights and utilize our analysis techniques to study other aspects of multi-layer graph attention.

## Acknowledgments

Xinyi Wu would like to thank Jennifer Tang and William Wang for helpful discussions. The authors acknowledge the MIT SuperCloud and Lincoln Laboratory Supercomputing Center for providing computing resources that have contributed to the research results reported within this paper.

This research has been supported in part by ARO MURI W911NF-19-0217, ONR N00014-20-1-2394, and a Vannevar Bush Fellowship from the Office of the Secretary of Defense.
