Lambda-Skip Connections: the architectural component that prevents Rank Collapse

## Abstract

Abstract Rank collapse, a phenomenon where embedding vectors in sequence models rapidly converge to a uniform token or equilibrium state, has recently gained attention in the deep learning literature. This phenomenon leads to reduced expressivity and potential training instabilities due to vanishing gradients. Empirical evidence suggests that architectural components like skip connections, LayerNorm, and MultiLayer Perceptrons (MLPs) play critical roles in mitigating rank collapse. While this issue is well-documented for transformers, alternative sequence models, such as State Space Models (SSMs), which have recently gained prominence, have not been thoroughly examined for similar vulnerabilities. This paper extends the theory of rank collapse from transformers to SSMs using a unifying framework that captures both architectures. We study how a parametrized version of the classic skip connection component, which we call lambda-skip connections , provides guarantees for rank collapse prevention. Through analytical results, we present a sufficient condition to guarantee prevention of rank collapse across all the aforementioned architectures. We also study the necessity of this condition via ablation studies and analytical examples. To our knowledge, this is the first study that provides a general guarantee to prevent rank collapse, and that investigates rank collapse in the context of SSMs, offering valuable understanding for both theoreticians and practitioners. Finally, we validate our findings with experiments demonstrating the crucial role of architectural components such as skip connections and gating mechanisms in preventing rank collapse. {NoHyper} † † Preprint. Under Review.

## 1 Introduction

The phenomenon of rank collapse has been recently reported in the deep learning literature Dong et al. [], Noci et al. [], Shi et al. [], He et al. [], Geshkovski et al. [], Wu et al. [, ]. Rank collapse is a phenomenon by which embedding vectors exhibit a fast convergence rate into a *uniform token*, or equilibrium embedding vector. Various explanations why this phenomenon arises have been proposed: Dong et al. [] proposed a path decomposition argument and suggests that one of the reasons on why rank collapse happens is that the attention matrix is row stochastic. Geshkovski et al. [] instead proposes an analysis of rank collapse from a statistical physics perspective by treating transformers as mean-field interacting particle systems and observes that the resulting system converges to a metastable state corresponding to a Dirac delta measure. In practice, this convergence to a uniform token reduces model expressivity Daneshmand et al. [], Dong et al. [], Noci et al. [], Wu et al. [] since a low rank in the output matrix means that the model is unable to capture complex relationships between tokens. Furthermore, this phenomenon can also cause vanishing gradients during training [Noci et al., ].

Rank collapse has primarily been studied in the transformer architecture Vaswani et al. []. In particular, it has been reported that the convergence rate to the equilibrium embedding vector of self-attention Vaswani et al. [] (corresponding to a rank-1 matrix) is doubly exponential (Dong et al. []). Both empirical observations and theoretical results support that the presence of skip connections (He et al. []) as well as the LayerNorm component (Ba et al. []) in the architecture mitigate the issue of rank collapse Dong et al. [], Wu et al. [].
In particular, Dong et al. [] shows that by adding skip connections, there exist an infinite amount of parametrizations of the network for which rank collapse does not happen. Wu et al. [] instead argues that adding LayerNorm slows down rank collapse by showing that in this setting the upper bound on the rank collapse measure is higher than for networks without these components. This implies that, in order to have convergence to 0 0, stricter conditions on input sequence and attention weights are needed.

Sequence models alternative to transformers have recently gained widespread attention. In particular, State Space Models (SSMs) such as S4 Gu et al. [], S5 Smith et al. [], H3 Fu et al. [] and Mamba Dao and Gu [], Gu and Dao [] have been very prominent, where attention was replaced by SSM blocks, which operate in combination with other components such as Gating Mechanisms (Hochreiter and Schmidhuber [], Chung et al. []), MLPs (Popescu et al. [] and skip connections (He et al. []). Furthermore, comparisons between these architectures have been discussed in [Sieber et al., , Hè and Kabic, , Tiezzi et al., ], and a larger framework where both the transformer and SSMs are seen as different realizations of the same general model has recently been proposed (Ali et al. [], Dao and Gu []). However, whether they suffer from similar weaknesses, and whether rank collapse happens more broadly in these architectures, is still an open question.

In this work, we focus on the specific issue of rank collapse and explore how slight modifications in the architecture, referred to as lambda-skip connections, can help to prevent it. Although parametrized versions of skip connections have been explored in the past (see e.g. He et al. [],Srivastava et al. []), their impact in providing guarantees to prevent rank collapse has not been studied. Moreover, here we develop a general theory of rank collapse using the unifying framework for sequence models presented in Ali et al. [] and [Dao and Gu, ], comprising both transformers and SSM architectures. To the best of our knowledge, the rank collapse phenomenon in the SSM setting has not yet been studied. Since rank collapse can be a very serious issue for practitioners, investigating broadly when rank collapse occurs and designing robust architectures that prevent rank collapse is of central interest not only to theorists but also to experimentalists. Our contributions can be outlined as follows:

- •
We extend the theory on rank collapse originally developed for transfomers to SSMs by using the recently proposed framework unifying these two architecture types (Ali et al. [],[Dao and Gu, ]).
- •
We investigate how lambda-skip connections influence rank collapse. In particular, we give sufficient conditions that guarantee that rank collapse does not occur in the finite layers setting. Our conditions apply to both transformers and SSMs. We also study the necessity of this condition via ablation analysis and analytical examples.
- •
We provide experimental details in support of our theory, by showing how adding a parameter controlling the skip connection strength could be beneficial in preventing rank collapse.
- •
We also empirically show the role of gating mechanisms in preventing rank collapse. To the best of our knowledge, we are the first to make this connection between gating mechanisms, which were originally constructed for improving memory capabilities of the models (Hochreiter and Schmidhuber []), and rank collapse.

## 2 Related Works

##### Rank Collapse.

Rank collapse is the phenomenon in which the rank of the output layer of the network collapses to 1 (Dong et al. []). To mathematically capture this, measuring the rank is not ideal since for every finite amount of layers, the output matrix will always be full rank with probability 1. This led to the development of an alternative metric to measure rank collapse Dong et al. [], which intuitively evaluates how “ill-conditioned” is the matrix of the output layer, i.e., how close it is to being rank $1$. In Dong et al. [], this metric is defined by computing how far the columns of the matrix are from the mean of all columns. It was shown in e.g. Dong et al. [], Wu et al. [] that this metric quickly decays to 0 as the depth of the model increases. Hence, rank collapse is an intrinsic issue of deep-learning models.
Rank collapse has mainly been studied for transformers (Vaswani et al. []), Graph Neural Networks (Zhou et al. []) and ReLU networks (Agarap []), but not SSMs. The work in Daneshmand et al. [] studied rank collapse in randomly initialized linear and ReLU networks
and proved that Batch Normalization can be helpful to mitigate the phenomenon. In Dong et al. [] the authors show that in self-attention-only transformers, rank collapse occurs doubly exponentially, i.e. with rate $O(a^{b^{n}})$ for some $a,b\in\mathbb{R}$. In the same paper, the authors propose for the first time that skip connections and MLPs (Popescu et al. []) are helpful in preventing rank collapse from happening. Moreover, the work in Noci et al. [] shows that rank collapse is not only an issue during inference but also hinders training due to vanishing gradient problems at initialization. In
Wu et al. [] the authors show that rank collapse also happens in graph attention networks (in this setting the phenomenon is also known as oversmoothing), also causing the model to lose expressive power. Finally, the work in Wu et al. [] studies the effect of LayerNorm on rank collapse in transformers, by proving that both of these components can help preventing or mitigating rank collapse.

##### Skip Connections.

Skip connections were first introduced in ResNets He et al. [] with the purpose of easing training and
optimization in deep neural networks (He et al. [], Veit et al. [], Balduzzi et al. []. More precisely, the introduction of skip connections addresses the
vanishing gradient problem by decomposing back-propagation of gradients into multiple paths and thus allowing them to skip and bypass layers. As an alternative explanation, it was shown in Li et al. [] that adding skip connections also results in a loss function which is much smoother and hence it is harder for gradients to get stuck in local minima, facilitating the training procedure. In transformers and SSMs, the introduction of the skip connection followed the same motivation as for ResNets and other deep neural networks, i.e. to improve and facilitate optimization. The work in Dong et al. [] is the first to also connect the benefit of skip connections to avoiding rank collapse by studying the paths decomposition in transformers. Regarding modifications to the skip connection, Bachlechner et al. [] also considers a control parameter in residual networks. However, their approach differs in that it is used as a gating with the main network layer again with the purpose of stabilizing optimization, which allows for training of much deeper models. The work in Srivastava et al. [] proposes adding an extra feedforward layer to each residual layer. The output of each residual layer is then expressed as a convex combination of two terms: one gated by the residual connection and the other by the output of the primary network layer. The effect of these modifications on skip connection have not been analyzed. Lastly, He et al. [] studies the lambda-skip connection proposed here in terms of training efficiency and concludes that the standard choice of $\lambda=1$ is usually beneficial.

##### LayerNorm.

LayerNorm (Ba et al. []) has become the standard choice of normalization layer for sequence models such as transformers (Vaswani et al. []) and Mamba (Dao and Gu []). In contrast to batch normalization (Ioffe and Szegedy []), LayerNorm performs the shifting and the normalization token-wise and not sequence-wise. This is particularly beneficial as the embedding dimension is usually much smaller than the sequence dimension, resulting in a much cheaper computational overhead than BatchNorm. It has also been shown that LayerNorm is helpful to stabilize training (Xiong et al. []) and to increase the expressivity of the attention layer (Brody et al. []). Related instead to rank collapse, the work in Dong et al. [] was the first to analyze a potential connection between rank collapse and LayerNorm. However, they conjecture that LayerNorm has no impact on rank collapse. Later on, the work in Wu et al. [] refutes this claim, showing both empirically and theoretically that LayerNorm helps slow down rank collapse.

## 3 Problem Setup

### 3.1 Sequence Model Deep-Learning Architecture

Rank collapse is defined as the convergence – in the limit of infinite depth – of the output matrix of the network’s layers to a Rank-1 matrix. In this sense, rank collapse is intrinsic to deep-learning architectures. In what follows, we outline the different components on a *single-layer* of the architecture considered in this paper. We note that the presented architecture is general enough to capture both transformers and SSM-like architectures.

We start by introducing some notation. We index each layer of the architecture with $k\in\{1,...,K\}$. We denote $X^{(k)}\in\mathbb{R}^{N\times d}$ and $Y^{(k)}\in\mathbb{R}^{N\times d}$ to be the input and output of the $k$-th layer, respectively, where $N$ is the sequence length. In this setting, $Y^{(0)}$ is the input sequence to the model. Each layer $k$ has the following components.

##### Main mechanism.

The main mechanism differs between attention in transformers, and a recurrent block in SSMs. However, as shown in Ali et al. [] and Dao and Gu [], both models can be seen as part of a general framework

$$ $O^{(k)}=M^{(k)}V^{(k)}.$ (1) $$

In the case of attention,

$$ $V^{(k)}=X^{(k)}W_{V}^{(k)}\in\mathbb{R}^{N\times d}\quad\text{and}\quad M^{(k) }=\text{softmax}\left(\frac{X^{(k)}W_{Q}^{(k)}(W_{K}^{(k)})^{T}(X^{(k)})^{T}}{ \sqrt{d_{QK}}}\right)\in\mathbb{R}^{N\times N},$ $$

with $W_{Q}^{(k)}\in\mathbb{R}^{d\times d}$, $W_{K}^{(k)}\in\mathbb{R}^{d\times d}$ and $W_{V}^{(k)}\in\mathbb{R}^{d\times d}$ are the query, key and value matrices respectively.

In the case of the recurrent block, $V^{(k)}=X^{(k)}$, and $M^{(k)}$ is a lower triangular matrix with

$$ $M_{ji}^{(k)}=C_{j}^{(k)}\left(\prod_{l=0}^{j-i-1}A_{j-l}^{(k)}\right)B_{i}^{(k )},$ $$

where $A^{(k)}_{t}\in\mathbb{R}^{dH\times dH},B^{(k)}_{t}\in\mathbb{R}^{dH\times 1},C
^{(k)}_{t}\in\mathbb{R}^{1\times dH},D^{(k)}_{t}\in\mathbb{R}^{1\times 1}$. The first versions of the SSM blocks consisted of Linear Time Invariant (LTI) representations, i.e., $A_{t}=A$, $B_{t}=B$, $C_{t}=C$ and $D_{t}=D$ for all time steps $t$ [Gu et al., , , Smith et al., ]. Recently, in order to improve the expressivity and the performance of such models, selective State Space Models have been proposed [Gu and Dao, , Dao and Gu, ]. In these models, matrices $A_{t}$, $B_{t}$, and $C_{t}$ are input-dependent. We refer to Appendix A.1 for a detailed explanation of attention and the recurrent block.

##### Skip Connection.

The skip connection sums the unmodified input to the output of the self-attention layer:

$$ $\tilde{Y}^{(k)}=X^{(k)}+O^{(k)}.$ (2) $$

Although it was originally proposed to stabilize training by avoiding vanishing gradients (He et al. []), it was recently shown that it also has a role in modulating rank collapse Dong et al. []. In SSM architectures, skip connections are often preceded by gating mechanisms, i.e., $O^{(k)}$ in equation 2 is replaced by $\tilde{O}^{(k)}=O^{(k)}\odot\sigma(W^{(k)}X^{(k)})$.(^1^11$\sigma(\cdot)$ is a non-linearity, often SILU, $W^{(k)}$ is a weight matrix and $\odot$ is the Hadamard product.). However, we ignore these in the theoretical part of this paper for simplicity. In this work, we modify the skip connection by allowing it to have an additional parameter $\lambda^{(k)}\in\mathbb{R}$, that controls the strength of the skip connection, i.e.,

###### Definition 3.1 .

Given a standard skip connection as per equation 2 and a parameter $\lambda^{(k)}\in\mathbb{R}$, a *lambda-skip connection* is defined as

$$ $\tilde{Y}^{(k)}=\lambda^{(k)}X^{(k)}+O^{(k)}.$ (3) $$

In the theoretical section, we will consider $\lambda^{(k)}$ to be fixed for all the layers for simplicity. However, in the experimental section, we will also consider models with learnable $\lambda^{(k)}$, i.e. it might vary across layers.

###### Definition 3.1 .

##### Layer Norm.

The LayerNorm [Ba et al., ] computation shifts and normalizes the output $\tilde{Y}^{(k)}$ after the skip connection. Similar to the skip connection, the purpose of the LayerNorm is also to stabilize training. It was recently shown to also help to mitigate rank collapse [Wu et al., ]. Here, we consider a slightly simplified version of LayerNorm, similar to Wu et al. [], where we only apply normalization and not shifting, namely:

$$ $Y^{(k)}=D^{(k)}\tilde{Y}^{(k)},$ (4) $$

where $D^{(k)}=\text{diag}(d_{1}^{(k)},d_{2}^{(k)},...,d_{N}^{(k)})\in\mathbb{R}^{N
\times N}$ and $d_{i}^{(k)}=\frac{1}{||\tilde{Y}^{(k)}_{i,:}||_{2}}$.

##### Other components.

After the above-mentioned computations, the input $Y$ passes through an MLP [Popescu et al., ], which can intuitively be seen as a non-linear feature extractor or a kernel. MLPs might play a role in mitigating rank collapse since they increase the Lipschitz constant of the network [Dong et al., ]. In particular, the Lipschitz constant of the MLP layer appears in the double exponential decay term of the upper bounds of the rank collapse measure. This is beneficial since it allows for a wider range of choices for the parametrization of other components while maintaining a high-enough upper bound. Since the role of the MLP layer on rank collapse is well-understood, in this work we focus on the effect that LayerNorm and skip connections have on rank collapse. We anticipate that the addition of MLP will further improve the bound, and hence the rank collapse avoidance conditions.

### 3.2 Problem Statement

In mathematical terms, the phenomenon of rank collapse means that the columns of the final output matrix are proportional to each other. The representational capacity of the model is severely hindered by this phenomenon: since the final representations of each token are proportional to each other, there is limited diversity of tokens to be chosen from. Given that the rank of the output layer will be full rank with probability one (since rank-deficient matrices are a zero measure subspace of the space of all matrices), a different metric was introduced in Dong et al. [], Wu et al. [] to assess rank collapse:

$$ $\mu(Y^{(k)})=||Y^{(k)}-\textbf{1}\gamma_{Y^{(k)}}||_{F},$ (5) $$

where $Y^{(k)}\in\mathbb{R}^{N\times d}$ is the output matrix resulting from the k-th layer, $\gamma_{Y^{(k)}}:=\frac{1}{N}\textbf{1}^{T}Y^{(k)}$, and $||\cdot||_{F}$ is the Frobenius norm.

In order to study the impact of the architecture on the phenomenon of rank collapse, we make use of the equations describing the architecture: equation 1, equation 3, and equation 4. Moreover, we note that the output of layer $k-1$ is the input to layer $k$, i.e. $X^{(k+1)}=Y^{(k)}$. Combining these equations we obtain

$$ $Y^{(k)}=D^{(k)}(M^{(k-1)}+\lambda^{(k)}I)Y^{(k-1)}C_{V}^{(k-1)},$ (6) $$

where $C^{(k)}_{V}=W^{(k)}_{V}$ for the attention block and $C^{(k)}_{V}=I$ for the recurrent block.

The goal of this paper is to show how the introduction of $\lambda^{(k)}$ in the lambda-skip connection influences rank collapse. For this purpose, the main quantity of interest is $\mu(Y^{(K)})$ i.e., the value of the token-similarity metric on the output of the last layer. We provide a mathematical analysis of this metric in terms of the different architectural components in the next section.

## 4 Lambda-Skip Connection: Necessary and Sufficient to prevent rank collapse

Here, we present the analysis resulting from studying rank collapse with lambda-skip connections. In Section 4.1, we analyze the scenario where we replace the regular skip connection by a lambda-skip connection and show that, together with LayerNorm, an appropriate choice of $\lambda$ in equation 3 is sufficient to prevent rank collapse in the finite layers setting. For simplicity, here we consider a fixed value of $\lambda$ for all the layers, i.e. $\lambda^{(k)}=\lambda\ \forall k$. Specifically, we provide the value of $\lambda\in\mathbb{R}$ in the lambda-skip connection that guarantees the absence of rank collapse. This result holds for any arbitrary amount of layers and all the three architectures studied in the paper (transformers, LTI SSMs and selective SSMs). In Section 4.2, we study the necessity of this condition. First we show that in the ablated architecture without skip connection, rank collapse occurs exponentially, i.e., $\mu(Y^{(K)})$ converges to 0 0 exponentially. If, additionally, LayerNorm is also ablated, rank collapse occurs doubly exponentially. Second, we highlight via examples that the strength of the lambda-skip connection (parametrized through $\lambda\in\mathbb{R}$) plays a crucial role in determining the effect of skip connections on rank collapse.

### 4.1 Lambda-Skip Connection: sufficient to prevent rank collapse

Here we show the role that the parameter $\lambda\in\mathbb{R}$ plays in guaranteeing, under appropriate conditions, the prevention of rank collapse. To do this, we provide a $\lambda$-dependent lower bound for the rank collapse metric $\mu(Y^{(K)})$ in equation 5. We start by defining the following quantity:

$$ $b:=\frac{1}{a^{K}}\frac{2\lambda NS^{2}C_{M}}{\lambda^{2}c^{2}-aS^{2}(C_{M}+ \lambda)^{2}},$ $$

with $C_{M}:=\sup_{k}||M^{(k)}||_{F}$, $S:=\sup_{k}\sigma_{\text{max}}(C_{V}^{(k)})$, $c:=\inf_{k}\sigma_{\text{min}}(C_{V}^{(k)})$.(^2^22$\sigma_{\text{min}}(A)$ and $\sigma_{\text{max}}(A)$ denote the smallest and largest singular value of $A$.) We also define the collapse rate as:

###### Definition 4.1 .

The *collapse rate*, $a>0$, is the rate at which the lower bound for the rank collapse metric $\mu(Y^{(K)})^{2}$ decays with the number of layers, i.e $\mu(Y^{(K)})^{2}\geq a^{K}\mu(Y^{(0)})^{2}$.

###### Theorem 4.1 (Lower Bound on Rank Collapse) .

Let the input sequence $Y^{(0)}$ be such that $\mu({Y^{(0)}})^{2}\geq b.$ If the skip connection strength $\lambda$ is chosen to satisfy

$$ $\lambda^{2}c^{2}-aS^{2}(C_{M}+|\lambda|)^{2}>0,$ (7) $$

then we can lower bound $\mu(Y^{(K)})$ by $\mu(Y^{(K)})^{2}\geq a^{K}\mu(Y^{(0)})^{2}$ for all $K\in\mathbb{N}$.

###### Proof.

The key part of the proof is to show the following relationship between the rank collapse measure at two consecutive layers: $\mu(Y^{(k+1)})^{2}\geq\frac{1}{S^{2}(C_{M}+\lambda)^{2}}\left(\lambda^{2}c^{2}
\mu(Y^{(k)})^{2}-2\lambda NS^{2}C_{M}\right)$, which is done by algebraic manipulation and upper bounds on $||Y^{(k+1)}||_{F}$. The claim then follows by imposing the right-hand side above greater of equal to $a\mu(Y^{(k)})^{2}$, rearranging the terms and imposing the condition on $\lambda$ to guarantee the feasibility of this. The full proof can be found in Appendix A.4.
∎

We note that this result is very general, since it holds for any model that can be expressed in the form of equation 6, independent of its specific implementation or parametrization. Moreover, the presence of LayerNorm implies that the bound provided in equation 7 does not depend on the input even when the matrix $M$ is input-dependent. This is because the input is normalized before being fed through $M$. Specifically, the constant $C_{M}$ is only dependent on the weights and on the sequence length (^3^33In transformers $C_{M}=\sqrt{N}$, in structured LTI SSMs $C_{M}\geq\sup_{k}||A^{(k)}||\ ||B^{(k)}||\ ||C^{(k)}||_{F}$ and in selective SSMs $C_{M}\geq\sup_{k}||W_{B}^{(k)}||\ ||W_{C}^{(k)}||_{F}$ (since in Selective SSMs it is common practice to choose $A_{t}^{(k)}$ with eigenvalues smaller than one).)

Theorem 4.1 also provides an important intuition for the choice of $\lambda$. In particular, we note that to guarantee prevention of rank collapse, the ideal choice is $a=1$. However, this choice will be mediated by the values of $c$ and $S$ in the different architectures. In particular, it is easy to see that the only way to guarantee a solution to 7 is by having $c^{2}-aS^{2}>0$, for which $\lambda$ needs to satisfy $|\lambda|>\frac{aC_{M}S^{2}+\sqrt{ac^{2}C_{M}^{2}S^{2}}}{c^{2}-aS^{2}}$.

###### Remark 4.1 .

In the case of Mamba, $C_{V}=I$ and $c=S=1$. This implies that the only possible choice for the collapse rate is $a<1$. Although this does not guarantee $\mu(Y^{(K)})^{2}\geq\mu(Y^{(0)})^{2}$, in practice $a$ can be chosen to be very close to 1. For instance, one can set $a=0.9999$. Given $K=64$ (standard number of layers in Mamba), $a^{K}\approx 0.993$. Hence, in practice, if we choose $\lambda$ appropriately, this choice still prevents rank collapse (see e.g. Figure 2).

###### Definition 4.1 .

###### Theorem 4.1 (Lower Bound on Rank Collapse) .

###### Proof.

###### Remark 4.1 .

### 4.2 Lambda-Skip Connection: necessary to prevent rank collapse?

Next, we explore the role that the lambda-skip connection plays in terms of being necessary to prevent rank collapse. Although we do not provide a formal necessary condition, we explore this idea in two ways. First, we provide theoretical results on how rank collapse occurs when the (standard) skip connection is ablated. Then, we give two examples of how rank collapse may occur when the lambda-skip connection does not attain the bound in Theorem 4.1.

#### 4.2.1 Rank collapse occurs without skip connections

Here we show how, for different architectures, rank collapse occurs in the absence of skip connections. Here we focus on transformers and selective SSMs. Additional results on LTI SSMs are presented in Appendix A.8.

##### Transformers.

We start by reporting for completeness the result in Wu et al. [] for transformers architectures with Self-Attention and LayerNorm only.

###### Theorem 4.2 (Corollary 1, Wu et al. [ 2024a ] (Informal)) .

Under certain assumptions on the self-attention weights and the input sequence, there exist $C>0$, $\epsilon>0$ and $r>0$ such that $N\epsilon<1$ and

$$ $\mu(Y^{(K)})\leq C(1-\epsilon^{2r})^{\frac{K}{2r}},\quad\forall K\geq 0.$ $$

meaning that tokens converge to a common point on $\mathbb{S}^{d-1}$ exponentially.

We refer to Appendix A.5 for a rigorous presentation of Theorem 4.2. The main takeaway from this result is that, under appropriate conditions on the architecture and the input sequence, removing skip connections and only using attention layers and LayerNorm can cause an exponentially fast convergence to a rank-$1$ matrix. This highlights the importance of skip connections to mitigate rank collapse. It is also interesting to compare the result in Theorem 4.2 to the setting of self-attention only transformers, i.e. removing both LayerNorm and skip connections, reported in Dong et al. []. In particular, under certain assumptions on the attention matrix and the input sequence, rank collapse occurs at a doubly exponential rate. We report the full result for completeness in Theorem A.3 and Corollary A.3.1 (where we adapted the Theorem to the rank collapse measure provided in the problem statement).

###### Theorem 4.2 (Corollary 1, Wu et al. [ 2024a ] (Informal)) .

##### Selective SSMs.

According to Dao and Gu [], for selective SSMs where $A_{t}=\alpha_{t}I$ (e.g., Mamba-2), the matrix $M$ can be compactly written as $M^{(k)}=\text{1SS}(\alpha)\odot\left(Y^{(k)}W_{C}W_{B}^{\top}Y^{{(k)}^{T}}\right)$,
where $\text{1SS}(\alpha)$ is a lower-triangular matrix 1-semiseparable matrix.(^4^44Specifically, $\text{1SS}(\alpha):=\left[\begin{array}[]{ccccc}1&&&&\\ \alpha_{1}&1&&&\\ \alpha_{2}\alpha_{1}&\alpha_{2}&1&&\\ \vdots&\vdots&\ddots&\ddots&\\ \alpha_{N-1}\ldots\alpha_{1}&\alpha_{N-1}\ldots a_{2}&\ldots&\alpha_{N-1}&1 \end{array}\right]$.) In what follows, we introduce the following assumption on selectivity:

###### Assumption 4.1 .

Only the matrices $B_{t}=Y_{t,:}^{(k)}W_{B}$ and $C_{t}=Y_{t,:}^{(k)}W_{C}$ are input-dependent, while $A_{t}=A=\alpha I\ \forall t$ (with $\alpha\leq 1$) is independent of the input.

This choice is done for ease of exposition. Although it may seem restrictive in theory, we show experimentally that eliminating skip connections can cause rank collapse for selective SSMs where $A_{t}$ is input dependent as well, such as Mamba (see e.g. the plot corresponding to $\lambda=0$ in Figure 2). In the following derivation, we neglect gating mechanisms for the sake of the theoretical analysis–we will thoroughly analyze their effect on rank collapse in simulation (see e.g. Figure 3).

###### Theorem 4.3 (Rank Collapse for selective SSMs without skip connection) .

Let $\phi^{(k)}=\min_{i,j\in[N]}\langle Y^{(k)}_{i,:},Y^{(k)}_{j,:}\rangle$, where $\langle\cdot,\cdot\rangle$ indicates the inner product. Under Assumption 4.1 and if $c\leq\phi^{(0)}<1$
for some $c>0\in\mathbb{R}$, $\lambda_{\text{min}}>0$, $\sum_{j}M_{ij}\geq 1\ \forall i$, then it holds that:

$$ $\mu(Y^{(K)})\leq\sqrt{N}\left(1-c^{2}\lambda_{\text{min}}^{2}\alpha^{2N}\right )^{K}\ \forall K\geq 0,$ $$

where $\lambda_{\text{min}}$ and $\lambda_{\text{max}}$ the minimum and maximum eigenvalues of $\frac{W_{B}W_{C}^{\top}+W_{C}W_{B}^{\top}}{2}$.

###### Proof.

The proof adapts the derivation in Corollary 1 in Wu et al. [] to selective SSMs. In particular, the key is to find a recursive relation between $1-\phi^{(k)}$ and $1-\phi^{(k+1)}$. The full proof can be found in Appendix A.7.
∎

In particular, when $\lambda_{\text{min}}\leq\frac{2}{c^{2}\alpha^{2N}}$, the model suffers from exponential rank collapse. Note that the above result holds for a model with layers having the same parametrization.

In Appendix A.9 Theorem A.10, we show that if we instead have a selective SSM with ablated the skip connections and LayerNorms, then rank collapse can happen doubly exponentially under certain conditions, similarly to what we have in transformers architecture. In contrast with the LTI SSM case (Theorems A.7
and A.8), which exhibits an exponential decay, the matrix $M^{(k)}$ depends quadratically on the input for selective SSMs: $||M^{(k)}||_{F}\leq\sqrt{N}||Y^{(k)}||^{2}_{F}||W_{BC}||_{F}$. where $W_{BC}=W_{C}W_{B}^{\top}$. This dependency is what causes the doubly exponential behavior.

###### Assumption 4.1 .

###### Theorem 4.3 (Rank Collapse for selective SSMs without skip connection) .

###### Proof.

#### 4.2.2 Rank Collapse can still occur with skip connections under specific choices of λ 𝜆 \lambda italic_λ : examples

Here we show analytical examples of how, for different architectures, rank collapse occurs in the presence of lambda-skip connections, if $\lambda$ does not satisfy the condition in Theorem 4.1.

##### Structured LTI SSMs.

Consider the system $A_{t}=A=\alpha I,B_{t}=B=I\ \text{and}\ C_{t}=C=I$, and let $N=2$ and $d=2$. By using the relation $M_{ji}=C_{j}^{\top}A_{j}\ldots A_{i+1}B_{i}$ whenever $j\geq i$ [Dao and Gu, ], we get that $M+\lambda I=\begin{pmatrix}1+\lambda&0\\
\alpha&1+\lambda\end{pmatrix}$. Let us denote this system, equipped with LayerNorm, as [Sys-1].

###### Proposition 4.3.1 .

Given [Sys-1], if we choose $\alpha=2$, i.e. $M=\begin{pmatrix}1&0\\
2&1\end{pmatrix}$, $\lambda>-2$
and $Y^{(0)}=I$, then we have that $\mu(Y^{(k)})\rightarrow 0$. Conversely, given the choices above with $\lambda<-2$ (with $\lambda\neq-1$, then rank collapse does not happen, i.e. $\mu(Y^{(k)})\not\rightarrow 0$.

###### Proof.

The result follows by calculating $Y^{(k)}$ inductively and by showing that the corresponding $\mu(Y^{(k)})$ decays to 0. See Appendix A.10 for the full proof.
∎

###### Proposition 4.3.1 .

###### Proof.

##### Selective SSMs.

Consider the system $A_{t}=A=\alpha I$ (for simplicity, we consider $\alpha$ not to be input dependent here), $B=YW_{B}$ and $C=YW_{C}$ input dependent (where $y_{t}$ is the $t$-th row of $Y$) with LayerNorm applied to the output of each layer. Once again, we let $N=2$ and $d=2$.
We have $M=W_{A}\odot\left(YW_{C}W_{B}^{\top}Y^{\top}\right)$ where $W_{A}=\begin{pmatrix}1&0\\
\alpha&1\\
\end{pmatrix}$. By choosing $\alpha=1$ and $W_{B}=W_{C}=I$, we get that $M=\begin{pmatrix}1&0\\
y_{1}^{\top}y_{2}&1\end{pmatrix}$ since the input to the layer is normalized by LayerNorm. Let us denote this system as [Sys-2].

###### Proposition 4.3.2 .

Given [Sys-2], if we then choose $\lambda>-\frac{3}{2}$, $M$ as above and $Y^{(0)}=\begin{pmatrix}1&0\\
\frac{\alpha_{0}}{\sqrt{\alpha_{0}^{2}+\beta_{0}^{2}}}&\frac{\beta_{0}}{\sqrt{
\alpha_{0}^{2}+\beta_{0}^{2}}}\end{pmatrix}$ for any $\alpha_{0},\beta_{0}$ with $\alpha_{0}>0$, then we have that $\mu(Y^{(k)})\rightarrow 0$. On the other hand, if we choose $\lambda<-\frac{3}{2}$ and $M$ and $Y^{(0)}$ as above, then rank collapse is avoided.

###### Proof.

Again, the result follows by calculating $Y^{(k)}$ inductively and by showing that the corresponding $\mu(Y^{(k)})$ decays to 0 for $\lambda>-\frac{3}{2}$ while this does not happen if $\lambda<-\frac{3}{2}$. We refer to Appendix A.11 for the full proof.
∎

###### Proposition 4.3.2 .

###### Proof.

## 5 Experiments

In this section, we aim to both explore the link between gating mechanisms and rank collapse and to empirically validate our theoretical findings. In Section 5.1, we empirically validate Theorem 4.1, demonstrating the importance of selecting the appropriate skip connection strength to mitigate rank collapse. In Section 5.2, we show that for the Mamba-2 architecture (Dao and Gu []), gating mechanisms indeed play a crucial role in preventing rank collapse. Finally, we provide additional experiments on the S4 architecture [Gu et al., ] in Appendix A.12.1.

### 5.1 Comparison of Rank Collapse for Mamba Architecture with different values of λ 𝜆 \lambda italic_λ

We start by validating our main finding, i.e. that by controlling the value of $\lambda$ in the skip connection, we can prevent rank collapse from happening. In order to do so, we consider a 2 billion parameters pre-trained Mamba-2 model available on [HuggingFace](https://huggingface.co/state-spaces) and remove the gating mechanisms. Instead, we add an additive skip connection with varying $\lambda$. For simplicity, we keep the value of $\lambda$ constant at every layer.
Similar to Dong et al. [], Wu et al. [], we sample 32 text excerpts from Wikipedia using the Wikipedia API and tokenize them in sequences of at least 128 tokens using the BERT tokenizer Devlin et al. []. We then forward pass these inputs through the pre-trained model and evaluate the rank collapse measure $\mu$ (normalized by the norm of the layer output) for each of the 64 layers for different values of $\lambda$, as shown in Figure 2. We observe that when $|\lambda|$ is small, the model suffers from rank collapse. This happens even when $\lambda=1$, which is usually the default design choice. After sufficiently increasing or decreasing $\lambda$, we note that we avoid rank collapse, consistent with our theoretical results, particularly Theorem 4.1. This suggests that rather than fixing the skip connection strength at $\lambda=1$ (as is standard), it may be beneficial to treat $\lambda$ as a learnable parameter or hyperparameter to improve model stability.

Figure: Figure 1: (Normalized) Rank Collapse measure plotted for different values of the skip connection’s strength $\lambda$. Again, shaded areas represent one standard deviation from the mean calculated over the 32 examples.
Refer to caption: x1.png

In Figure 2, we analyze how the rank collapse measure at the last layer varies with different skip connection strengths for both the Albert’s architecture (Lan et al. []) and Mamba-2, keeping the full architecture (also LayerNorm). In both cases, we note the importance of tuning and choosing the correct value of $\lambda$ to avoid rank collapse. We see how a value of $\lambda$ very close to 0, as we expected, is detrimental and causes a very low value of $\mu$, even in the presence of LayerNorm, which is consistent with our findings in Theorem 4.3. Additionally, we see that a negative $\lambda$ leads to a higher $\mu$. Intuitively, the reason for this could be that a negative $\lambda$ can be interpreted as negative feedback in the system, hence helping stabilizing it. Note that even if in both cases our condition on $\lambda$ in Theorem 4.1 is too conservative (e.g. for Mamba-2 with $a=0.9$, $\lambda$ needs to satisfy$|\lambda|>937.924$), in practice much lower values of $\lambda$ are good enough to prevent rank collapse.

To investigate whether using $\lambda$ as a trainable parameter affects the learning performance, we train two transformer-based architectures and two SSM-based architectures on the image task of the long range arena (LRA) benchmark [Tay et al., ] and on a multi-query associative recall (MQAR) task [Arora et al., ]. The accuracy of all four architectures on both tasks are reported in Table 1 and the details on the experimental setup are provided in Appendix A.13. From the achieved accuracy we note that learning $\lambda$ does not affect the performance and even outperforms the models with fixed $\lambda$ in some cases.

Figure: Table 1: Model performance in terms of test accuracy on the Image task of the LRA benchmark and the MQAR task $\{L=512,\textup{KV-pairs}=64\}$.

### 5.2 Comparison of Rank Collapse for Mamba Architecture with and without Gating Mechanisms and LayerNorm

We also analyze the effect of gating mechanisms and LayerNorms in the Mamba architecture.
Because gating mechanisms can be viewed as a multiplicative form of skip connections, we aim to empirically explore whether they, like skip connections, contribute to stability and prevent rank collapse.
We repeat the same procedure as above, i.e., forward passing 32 excerpts from Wikipedia to the pre-trained model and calculating the rank collapse measure across all layers. We replicate this for all considered cases, namely gating plus LayerNorm, only gating, only LayerNorm, and neither gating nor LayerNorm.

Figure: Figure 3: (Normalized) Rank Collapse measure of the Mamba-2 model plotted as a function of layer depth. The shaded areas represent one standard deviation from the mean calculated over the 32 examples. Gating=True/False indicates we use a Mamba2 architecture with/without gating whereas LN=True/False indicate we use the architecture with/without LayerNorm
Refer to caption: x3.png

As shown in Figure 3, when removing the gating mechanism, we either observe the rank collapse measure approaching zero especially for later layers if the LayerNorm is present, or we observe an initial drop in the rank collapse measure followed by a dramatic increase if we remove the LayerNorm. This highlights the importance of having LayerNorm to keep the model stable, as was also observed in Dao and Gu []. Indeed, even when the model contains a gating mechanism, although we prevent rank collapse, removing LayerNorm leads to a sudden increase in the rank collapse measure, indicating instability. Interestingly, we find that gating mechanisms, originally designed to enhance memory capabilities, also play a crucial role in preventing rank collapse. To the best of our knowledge, this is the first time this connection has been made.

## 6 Conclusion

This paper studies the phenomenon of rank collapse across general sequence model architectures, using the unifying framework from Ali et al. [] and Dao and Gu []. Our main contribution is the introduction of a lambda-skip connection, which adds a regulatory term to the standard skip connection component to control its strength. We provide sufficient conditions for this parameter under which rank collapse does not occur. We do this via a lower bound on the rank collapse measure, which holds for transformers, LTI SSMs, selective SSMs and more generally, all architectures that can be written in the framework from Ali et al. [] and Dao and Gu []. We further study the necessity of the lambda-skip connection by showing that when this component is ablated, selective SSMs also experience rank collapse even in the presence of LayerNorm. Moreover, we show that similarly to Transformers, selective SSMs can also be affected by doubly exponential rank collapse when both skip connections and LayerNorm are ablated. We suggest that the primary cause of this doubly exponential rank collapse is the input dependence of the $M^{(k)}$ matrix. We validate our theoretical analysis with simulation experiments and further analyze other components such as the Gating Mechanism, which we have found also play a role in rank collapse.

Limitations and Future Work. A limitation of this work is the exclusion of gating mechanisms from the theoretical analysis. Since gating mechanisms help to mitigate the effect of rank collapse, we expect their inclusion in the derivations would result in tighter upper bounds on the rank collapse measure for Mamba. Furthermore, one other line worth exploring is to consider the effect on lower bounds of MLPs on a theoretical standpoint instead of only considering skip connections and LayerNorm, which have not been considered in this paper. Finally, deriving a tighter lower bound that matches the results in our experiments is also a very promising avenue of research. Finally, Remark 4.1
offers intriguing insights from a control-theoretic perspective, as it suggests that the $\lambda$ parameter can be interpreted as a control gain. We believe that further theoretical analysis of the stability and performance associated with $\lambda$-skip connections could lead to a more principled design of learning architectures.

## Appendix A Appendix

### A.1 Preliminaries

We present a brief description of the sequence models considered in this work, namely attention (Stollenga et al. [], Luong et al. [], Song et al. [], Vaswani et al. []) and recurrent blocks in State Space Models (Voelker et al. [], Gu et al. [, , ], Fu et al. [], and their corresponding architectural components (from Transformers Vaswani et al. [] and Mamba Gu and Dao []).

### A.2 Attention

Attention is considered to be the backbone of the Transformer architecture. This is thanks to its ability to capture correlations and dependencies between tokens in the sequence. In particular, the attention block can be expressed as follows:

$$ $O=\text{softmax}\left(\frac{XW_{Q}W_{K}^{T}X^{T}}{\sqrt{d_{QK}}}\right)XW_{v} \in\mathbb{R}^{N\times d},$ (8) $$

where the softmax operation is applied row-wise and $\sqrt{d_{QK}}\in\mathbb{R}$ acts as a sort of temperature parameter to modulate the strength of the interactions between tokens. $W_{Q}\in\mathbb{R}^{d\times d}$, $W_{K}\in\mathbb{R}^{d\times d}$ and $W_{V}\in\mathbb{R}^{d\times d}$ are the query, key and value matrices respectively, and $X\in R^{N\times d}$ is the input sequence, where $d$ is the embedding dimension and $N$ is the length of the sequence. In preparation for later sections, we also provide an alternative form for the attention block, as proposed by Dao and Gu []:

$$ $O=MV$ (9) $$

with $V=XW_{v}\in\mathbb{R}^{N\times d}$ and $M=\text{softmax}(\frac{XW_{Q}W_{K}^{T}X^{T}}{\sqrt{d_{QK}}})\in\mathbb{R}^{N
\times N}$ for attention.

### A.3 Recurrent Block

SSMs lie their foundations in linear (often input-dependent) dynamical systems, which can be seen as linear RNNs (Orvieto et al. []). In particular, the classic recurrent block for a generic SSM takes the following form:

$$ $\begin{cases}h_{k}=A_{k}h_{k-1}+B_{k}x_{k}\\ o_{k}=C_{k}h_{k}+D_{k}x_{k}\end{cases}$ (10) $$

where $x_{k}\in R^{d}$ is the input at time $k$, where $k\in\{1,2,...,N\}$, $h_{k}\in R^{H}$ is the hidden state and $o_{k}\in R^{d}$ is the output of the SSM layer at time $k$. We note the connection with the Transformer’s notation $x_{k}:=X_{k,:}$, and similarly denote $O\in R^{N\times d}$ to be the output matrix of the SSM block, i.e. $o_{k}=O_{k,:}$. Here, given a matrix $A$, we indicate $A_{k,:}$ to be the k-th row.

One fundamental difference between attention and the recurrent block is that the attention mechanism does not have the capacity for memory, so the whole sequence of previous inputs $X$ has to be fed every time step. In contrast, the recurrent block in equation 10 is able to capture previous inputs’ information, so only the last token has to be fed in. Yet, this expression also allows for a convolutional representation, where equation 10 is unrolled in time as:

$$ $o_{k}=\sum_{j=0}^{k}C_{k}\left(\prod_{l=0}^{k-j-1}A_{k-l}\right)B_{j}x_{j}+D_{ k}x_{k},$ (11) $$

where $A_{k}\in\mathbb{R}^{H\times H},B_{k}\in\mathbb{R}^{H\times d},C_{k}\in\mathbb{
R}^{d\times H},D_{k}\in\mathbb{R}^{d\times d}$. The first versions of the SSM blocks consisted of Linear Time Invariant (LTI) representations, i.e., $A_{k}=A$, $B_{k}=B$, $C_{k}=C$ and $D_{k}=D$ for all time steps $k$. Recently, in order to improve the expressivity and the performance of such models, selective State Space Models have been proposed Gu and Dao [], Dao and Gu []. In these models, matrices $A_{k}$, $B_{k}$, and $C_{k}$ are input-dependent.

As shown in Dao and Gu [], the SSM update rule in equation 11 can be equivalently expressed as in equation 9, where $M$ is a lower triangular matrix with $M_{ji}=C_{j}\left(\prod_{l=0}^{j-i-1}A_{j-l}\right)B_{i}$ and $V=X$. In the reminder of the paper, this formulation will be used as it covers both the attention and the recurrent block.

### A.4 Proof of Lower Bound of Rank Collapse Measure

###### Lemma A.1 .

Let $A\in R^{m\times n}$ and $B\in R^{n\times p}$ two matrices. Then it holds that $||AB||_{F}\geq\sigma_{\text{min}}(B)||A||_{F}$, where $\sigma_{\text{min}}(B)$ is the smallest singular value of $B$.

###### Proof.

From Fang et al. [], it holds that $||CD||_{F}\geq\sigma_{\text{min}}(C)||D||_{F}$.
By the properties of the Frobenius norm, we have that $||AB||_{F}=||B^{\top}A^{\top}||_{F}$. Hence, we have $||B^{\top}A^{\top}||_{F}\geq\sigma_{\text{min}}(B^{\top})||A^{\top}||_{F}$. The result then simply follows from the fact that $\sigma_{\text{min}}(B^{\top})=\sigma_{\text{min}}(B)$.
∎

See 4.1

###### Proof.

In the following, we denote $V_{i}^{(k)}:=V_{:,i}^{(k)}$ and $\mu^{(k)}=\mu(Y^{(k)})$ for brevity.

$$ $\displaystyle\tilde{\mu}^{{(k+1)}^{2}}$ $\displaystyle=\Big{|}\Big{|}\tilde{Y}^{(k+1)}-\frac{\bm{1}\bm{1}^{T}}{N}\tilde {Y}^{(k+1)}\Big{|}\Big{|}_{F}^{2}=\Big{|}\Big{|}(M^{(k)}+\lambda I)V^{(k)}- \frac{\bm{1}\bm{1}^{T}}{N}(M^{(k)}+\lambda I)V^{(k)}\Big{|}\Big{|}_{F}^{2}$ $\displaystyle=\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k )}\Big{|}\Big{|}_{F}^{2}+\sum_{i=1}^{d}\left\|M^{(k)}V_{i}^{(k)}-\bm{11^{T}}M^ {(k)}\frac{V_{i}^{(k)}}{N}\right\|_{2}^{2}+$ $\displaystyle+\sum_{i=1}^{d}2\lambda\left(M^{(k)}V_{i}^{(k)}-\bm{11^{T}}M^{(k) }\frac{V_{i}^{(k)}}{N}\right)^{T}\left(V_{i}^{(k)}-\bm{11^{T}}\frac{V_{i}^{(k) }}{N}\right)$ $\displaystyle=\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k )}\Big{|}\Big{|}_{F}^{2}+\sum_{i=1}^{d}\left(M^{(k)}V_{i}^{(k)}-\bm{11^{T}}M^{ (k)}\frac{V_{i}^{(k)}}{N}\right)^{T}\Bigg{(}\Bigg{.}M^{(k)}V_{i}^{(k)}-$ $\displaystyle-\bm{11^{T}}M^{(k)}\frac{V_{i}^{(k)}}{N}+2\lambda V_{i}^{(k)}-2 \lambda\bm{11^{T}}\frac{V_{i}^{(k)}}{N}\Bigg{.}\Bigg{)}$ $\displaystyle=\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k )}\Big{|}\Big{|}_{F}^{2}+\sum_{i=1}^{d}\left(M^{(k)}V_{i}^{(k)}-\bm{11^{T}}M^{ (k)}\frac{V_{i}^{(k)}}{N}\right)^{T}\Bigg{(}\Bigg{.}(M^{(k)}+2\lambda I)V_{i}^ {(k)}-$ $\displaystyle\bm{11^{T}}(M^{(k)}+2\lambda I)\frac{V_{i}^{(k)}}{N}\Bigg{.}\Bigg {)}$ $\displaystyle=\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k )}\Big{|}\Big{|}_{F}^{2}+\sum_{i=1}^{d}\Bigg{(}\Bigg{.}V_{i}^{{(k)}^{T}}M^{{(k )}^{T}}(M^{(k)}+2\lambda I)V_{i}^{(k)}+$ $\displaystyle+\frac{V_{i}^{{(k)}^{T}}}{N}M^{{(k)}^{T}}\bm{11^{T}}(\bm{11^{T}}) ^{T}M^{(k)}\frac{V_{i}^{(k)}}{N}+\frac{V_{i}^{{(k)}^{T}}}{N}M^{{(k)}^{T}}\bm{1 1^{T}}(M^{(k)}+2\lambda I)V_{i}^{(k)}-$ $\displaystyle-V_{i}^{{(k)}^{T}}M^{{(k)}^{T}}\bm{11^{T}}(M^{(k)}+2\lambda I) \frac{V_{i}^{(k)}}{N}\Bigg{.}\Bigg{)}$ $\displaystyle=\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k )}\Big{|}\Big{|}_{F}^{2}+\sum_{i=1}^{d}V_{i}^{{(k)}^{T}}\Bigg{[}\Bigg{.}M^{{(k )}^{T}}(M^{(k)}+2\lambda I)+\frac{1}{N}M^{{(k)}^{T}}\bm{11^{T}}M^{(k)}-$ $\displaystyle-\frac{2}{N}M^{{(k)}^{T}}\bm{11^{T}}(M^{(k)}+2\lambda I)\Bigg{.} \Bigg{]}V_{i}^{(k)}$ $\displaystyle=\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k )}\Big{|}\Big{|}_{F}^{2}+\sum_{i=1}^{d}V_{i}^{{(k)}^{T}}\Bigg{[}M^{{(k)}^{T}} \left(I-\frac{1}{N}\bm{11^{T}}\right)M^{(k)}+$ $\displaystyle+2\lambda M^{{(k)}^{T}}\left(I-\frac{2}{N}\bm{11^{T}}\right)\Bigg {]}V_{i}^{(k)}$ $\displaystyle\geq\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^ {(k)}\Big{|}\Big{|}_{F}^{2}+\sum_{i=1}^{d}V_{i}^{{(k)}^{T}}\Bigg{[}2\lambda M^ {{(k)}^{T}}\left(I-\frac{2}{N}\bm{11^{T}}\right)\Bigg{]}V_{i}^{(k)}$ $$

where the last inequality follows from the fact that $M^{{(k)}^{T}}\left(I-\frac{1}{N}\bm{11^{T}}\right)M^{(k)}$ is Symmetric and Positive Semi-Definite.
Continuing from here, we get:

$$ $\displaystyle\tilde{\mu}^{{(k+1)}^{2}}$ $\displaystyle\geq\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^ {(k)}\Big{|}\Big{|}_{F}^{2}-2\lambda\sum_{i=1}^{d}||V_{i}^{{(k)}}||^{2}\ ||M^{ (k)}||\ \Bigg{|}\Bigg{|}\left(I-\frac{2}{N}\bm{11^{T}}\right)\Bigg{|}\Bigg{|}$ $\displaystyle\geq\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^ {(k)}\Big{|}\Big{|}_{F}^{2}-2\lambda\sum_{i=1}^{d}||V_{i}^{{(k)}}||^{2}\ ||M^{ (k)}||$ $\displaystyle\geq\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^ {(k)}\Big{|}\Big{|}_{F}^{2}-2\lambda\sum_{i=1}^{d}||V_{i}^{{(k)}}||^{2}\ ||M^{ (k)}||_{F}$ $\displaystyle=\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k )}\Big{|}\Big{|}_{F}^{2}-2\lambda||V^{{(k)}}||_{F}^{2}\ ||M^{(k)}||_{F}$ $\displaystyle\geq\lambda^{2}\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^ {(k)}\Big{|}\Big{|}_{F}^{2}-2\lambda N\sigma_{\text{max}}(C_{V}^{(k)})^{2}||M^ {(k)}||_{F}$ $$

where the last inequality follows since $||V^{(k)}||_{F}\leq||Y^{(k)}||_{F}\sigma_{\text{max}}(C_{V}^{(k)})$ and since we are using LayerNorm and hence every row of $Y^{{(k)}}$ has norm 1.
Furthermore, from Lemma A.1, we have that:

$$ $\Big{|}\Big{|}V^{(k)}-\frac{\bm{1}\bm{1}^{T}}{N}V^{(k)}\Big{|}\Big{|}_{F}^{2} \geq\sigma_{\text{min}}(C_{V}^{(k)})^{2}\mu^{(k)^{2}}$ $$

Hence, we have that:

$$ $\displaystyle\tilde{\mu}^{{(k+1)}^{2}}$ $\displaystyle\geq c^{2}\lambda^{2}\mu^{(k)^{2}}-2\lambda NS^{2}||M^{(k)}||_{F}$ $$

We now need to analyze the relationship between $\mu^{(k+1)}$ and $\tilde{\mu}^{(k+1)}$.

$$ $\displaystyle\mu^{{(k+1)}^{2}}$ $\displaystyle=\Big{|}\Big{|}D^{(k+1)}\tilde{Y}^{(k+1)}-\frac{\bm{11^{T}}}{N}D^ {(k+1)}\tilde{Y}^{(k+1)}\Big{|}\Big{|}_{F}^{2}=\Big{|}\Big{|}\left(I-\frac{\bm {11^{T}}}{N}\right)D^{(k+1)}\tilde{Y}^{(k+1)}\Big{|}\Big{|}_{F}^{2}$ $\displaystyle=\sum_{j=1}^{N}\sum_{i=1}^{d}\left(\sum_{l=1}^{N}\left(I-\frac{ \bm{11^{T}}}{N}\right)_{jl}\frac{\tilde{Y}^{(k+1)}_{il}}{||\tilde{Y}^{(k+1)}_{ i,:}||_{2}}\right)^{2}$ $\displaystyle\geq\sum_{j=1}^{N}\sum_{i=1}^{d}\left(\sum_{l=1}^{N}\left(I-\frac {\bm{11^{T}}}{N}\right)_{jl}\frac{\tilde{Y}^{(k+1)}_{il}}{\max_{i\in[N]}|| \tilde{Y}^{(k+1)}_{i,:}||_{2}}\right)^{2}$ $\displaystyle\geq\frac{1}{\max_{i\in[N]}||\tilde{Y}^{(k+1)}_{i,:}||^{2}_{2}} \sum_{j=1}^{N}\sum_{i=1}^{d}\left(\sum_{l=1}^{N}\left(I-\frac{\bm{11^{T}}}{N} \right)_{jl}\tilde{Y}^{(k+1)}_{il}\right)^{2}$ $\displaystyle=\frac{1}{\max_{i\in[N]}||\tilde{Y}^{(k+1)}_{i,:}||^{2}_{2}} \tilde{\mu}^{{(k+1)}^{2}}$ $$

Combining the previous two results, we then get:

$$ $\mu^{{(k+1)}^{2}}\geq\frac{1}{\max_{i\in[N]}||\tilde{Y}^{(k+1)}_{i,:}||^{2}_{2 }}\left(c^{2}\lambda^{2}\mu^{(k)^{2}}-2\lambda NS^{2}||M^{(k)}||_{F}\right)$ $$

We will now proceed in upper bounding $\max_{i\in[N]}||\tilde{Y}^{(k+1)}_{i,:}||^{2}_{2}$.

$$ $\displaystyle\max_{i\in[N]}||\tilde{Y}^{(k+1)}_{i,:}||^{2}_{2}$ $\displaystyle=\max_{i\in[N]}\sum_{j}\tilde{Y}_{ij}^{{(k+1)}^{2}}=\max_{i\in[N] }\sum_{j}\left(\sum_{l}\left(M^{(k)}+\lambda I\right)_{il}V^{{(k)}}_{lj}\right )^{2}$ $\displaystyle\leq\max_{i\in[N]}\sum_{l}\left(M^{(k)}+\lambda I\right)^{2}_{il} \sum_{j}\sum_{m}\underbrace{Y_{lm}^{(k)^{2}}}_{\leq 1}C_{V_{mj}}^{2}$ $\displaystyle\leq S^{2}(||M^{(k)}||_{F}+|\lambda|)^{2}$ $$

Using the fact that $||M^{(k)}||_{F}\leq C_{M}$, we get:

$$ $\mu^{{(k+1)}^{2}}\geq\frac{1}{S^{2}(C_{M}+|\lambda|)^{2}}\left(\lambda^{2}c^{2 }\mu^{{(k)}^{2}}-2\lambda NS^{2}C_{M}\right)$ $$

To guarantee that $\mu^{{(k+1)}^{2}}\geq a\mu^{{(k)}^{2}}$ for some $a<1$, we can simply lower bound the right hand side. Hence, we want that $\frac{1}{S^{2}(C_{M}+|\lambda|)^{2}}\left(\lambda^{2}c^{2}\mu^{{(k)}^{2}}-2
\lambda NS^{2}C_{M}\right)\geq a\mu^{{(k)}^{2}}$.
Hence, we need:

$$ $\left(\lambda^{2}c^{2}-aS^{2}(C_{M}+|\lambda|)^{2}\right)\mu^{{(k)}^{2}}\geq 2 \lambda NC_{M}$ $$

To do so, we need to guarantee that $\lambda^{2}c^{2}-aS^{2}(C_{M}+|\lambda|)^{2}>0$. Hence, if $\lambda$ satisfies the condition above and we have that $\mu^{{(k)}^{2}}\geq\frac{2\lambda NS^{2}C_{M}}{\lambda^{2}c^{2}-aS^{2}(C_{M}+|
\lambda|)^{2}}$, then $\mu^{{(k+1)}^{2}}\geq a\mu^{{(k)}^{2}}$. Note that in order to satisfy the condition on $\mu^{{(k)}^{2}}$ up until time $K$, we need to choose $\mu^{{(0)}^{2}}\geq\frac{1}{a^{K}}\frac{2\lambda NS^{2}C_{M}}{\lambda^{2}c^{2}
-aS^{2}(C_{M}+|\lambda|)^{2}}$, which concludes the proof.

∎

###### Lemma A.1 .

###### Proof.

###### Proof.

### A.5 Theorem on Rank Collapse in Self-Attention Only Transformers with LayerNorm

We first define some notation that is used in the Theorem. First, we denote $\phi^{(t)}=Y^{(t)}_{i,:},Y^{(t)}_{j,:}\rangle$ where $\langle,\cdot,\cdot,\rangle$ is the inner product. Then, $\mathcal{G}$ represents the graph induced by the attention mask. In particular, if there is a directed edge from $j$ to $i$, this means that token $i$ attends to token $j$. A Quasi-Strongly Connected graph is a graph $\mathcal{G}$ in which there exists a node from which every other node in the directed graph $\mathcal{G}$ is reachable (i.e. there exist a directed path connecting the two nodes). Finally, the authors consider the following assumptions:

###### Assumption A.1 .

$\mathcal{G}$ contains self-loops, i.e. every token in the sequence attends to itself

###### Assumption A.2 .

There exists a constant $C\in\mathbb{R}$
such that $\max_{t\in\mathbb{N}}\left\{||W_{Q}^{(t)}||_{2},||W_{K}^{(t)}||_{2}\right\}\leq
C$

###### Theorem A.2 (Corollary 1, Wu et al. [ 2024a ] ) .

Consider the architecture defined in 6 by choosing $\lambda=0$, i.e. a Self-Attention Network with LayerNorm and no skip connection. Let $\mathcal{G}$ be a quasi-strongly connected graph. Under A.1 and A.2, if $W_{V}^{(t)}$ is orthogonal for all $t\geq 0$ and $\phi^{(0)}\geq 0$,
there exist $C>0$ and $\epsilon>0$ such that $N\epsilon<1$ and

$$ $\mu(Y^{(K)})\leq C(1-\epsilon^{2r})^{\frac{K}{2r}},\quad\forall K\geq 0.$ $$

where $r$ is the diameter of $\mathcal{G}$,
meaning that tokens converge to a common point on $\mathbb{S}^{d-1}$ exponentially.

###### Assumption A.1 .

###### Assumption A.2 .

###### Theorem A.2 (Corollary 1, Wu et al. [ 2024a ] ) .

### A.6 Theorem on Rank Collapse in Self-Attention only Transformers without LayerNorm

Let $\text{res}(Y)=Y-\frac{\bm{1}\bm{1}^{\top}Y}{N}$. Note that with this notation, we can redefine $\mu(Y)=||\text{res}(Y)||_{F}$. Then, it holds that:

###### Theorem A.3 (Rank Collapse Transformers Dong et al. [ 2023 ] ) .

For any single-head Self-Attention network consisting of K layers with $\left\|\bm{W}_{Q}^{(k)}W_{K}^{{(k)}^{\top}}\right\|_{1}\left\|\bm{W}_{V}^{(k)}
\right\|_{1,\infty}\leq\beta$ and for a term $\gamma$ that depends on the attention entries, we have that

$$ $\|\operatorname{res}(Y^{(K)})\|_{1,\infty}\leq\left(\frac{4\gamma\beta}{\sqrt{ d_{qk}}}\right)^{\frac{3^{K}-1}{2}}\|\operatorname{res}(Y^{(0)})\|_{1,\infty}^ {3^{K}}$ $$

which amounts to a doubly exponential convergence to a rank-1 matrix.

###### Corollary A.3.1 .

Under the same conditions of Theorem A.3, it holds that

$$ $||\operatorname{res}(Y^{(K)})||_{F}\leq\left(\frac{4\gamma\sqrt{\min(N,d)} \beta}{\sqrt{d_{qk}}}\right)^{\frac{3^{K}-1}{2}}||\operatorname{res}(Y^{(0)})| |^{3}_{F}.$ $$

###### Proof.

Follows straightforward from the relations between Frobenius norm and the $1$- and $\infty$-norms, i.e. given a matrix we have $A\in R^{N\times d}$ $||A||_{F}\geq||A||_{1}$, $||A||_{F}\geq||A||_{\infty}$, $||A||_{F}\leq\min(N,d)||A||_{1}$, $||A||_{F}\leq\min(N,d)||A||_{\infty}$.
∎

###### Theorem A.3 (Rank Collapse Transformers Dong et al. [ 2023 ] ) .

###### Corollary A.3.1 .

###### Proof.

### A.7 Proof of Rank Collapse for Selective SSMs with LayerNorm but without Skip Connections

###### Lemma A.4 .

If $\alpha\leq 1$, We have that $M^{(k)}_{ij}\geq\lambda_{\text{min}}\cdot\phi^{(k)}\alpha^{N}$ for $i\geq j$

###### Proof.

If $i\geq j$, we have that:

$$ $\displaystyle M^{(k)}_{ij}$ $\displaystyle=\alpha^{i-j}Y^{(k)^{\top}}_{i,:}W_{C}W_{B}^{\top}Y^{(k)}_{j,:} \geq\alpha^{i-j}\lambda_{\text{min}}\langle Y^{(k)}_{i,:},Y^{(k)}_{j,:}\rangle \geq\alpha^{j-i}\lambda_{\text{min}}\cdot\phi^{(k)}$ $$

Note that the worst case is when $i-j=N-1$, which leads to the desired lower bound by lower bounding $\alpha^{i-j}\geq\alpha^{N-1}\geq\alpha^{N}$ since $a\leq 1$.
∎

###### Lemma A.5 .

We have that $D_{i,i}^{(k)}\geq\frac{1}{N^{\frac{3}{2}}\lambda_{\text{max}}}\ \forall k$

###### Proof.

From the definition of LayerNorm, we have $D_{i,i}^{(k)}=\frac{1}{||\tilde{Y}^{(k)}_{i,:}||_{2}}$. Furthermore, we have that $||\tilde{Y}^{(k)}_{i,:}||_{2}=||\sum_{j=1}^{N}M^{(k-1)}_{ij}Y^{(k-1)}_{j,:}||_
{2}\leq\sum_{j=1}^{N}M^{(k-1)}_{ij}\underbrace{||Y^{(k-1)}_{j,:}||_{2}}_{=1}
\leq N\lambda_{\text{max}}$.
∎

See 4.3

###### Proof.

For the fist part of the proof, we will follow the proof of Corollary 1 in Wu et al. []:

$$ $\displaystyle\phi^{(k+1)}$ $\displaystyle=\min_{i,j\in[N]}\langle Y^{(k+1)}_{i,:},Y^{(k+1)}_{j,:}\rangle= \langle Y^{(k+1)}_{i^{(k+1)},:},Y^{(k+1)}_{j^{(k+1)},:}\rangle$ $\displaystyle=\left\langle\sum_{k_{1}=1}^{N}\left(D^{(k)}M^{(k)}\right)_{i^{(k +1)}k_{1}}Y^{(k)}_{k_{1},:},\sum_{l_{1}=1}^{N}\left(D^{(k)}M^{(k)}\right)_{j^{ (k+1)}l_{1}}Y^{(k)}_{l_{1},:}\right\rangle$ $\displaystyle\geq\frac{1}{N\lambda_{\text{max}}}\left\langle\sum_{k_{1}=1}^{N} M^{(k)}_{i^{(k+1)}k_{1}}Y^{(k)}_{k_{1},:},\sum_{l_{1}=1}^{N}M^{(k)}_{j^{(k+1)} l_{1}}Y^{(k)}_{l_{1},:}\right\rangle$ $$

where the last inequality follows from Lemma A.5.

From here, using Lemma A.4 and the assumption that $\lambda_{\text{max}}\leq\frac{1}{N}$ we have that:

$$ $\displaystyle\phi^{(k+1)}$ $\displaystyle\geq\sum_{k_{1}=1}^{N}\sum_{l_{1}=1}^{N}M^{(k)}_{i^{(k+1)}k_{1}}M ^{(k)}_{j^{(k+1)}l_{1}}\langle Y^{(k)}_{k_{1},:},Y^{(k)}_{l_{1},:}\rangle$ $\displaystyle=\sum_{m=1}^{N}M^{(k)}_{i^{(k+1)}m}M^{(k)}_{j^{(k+1)}m} \underbrace{\langle Y^{(k)}_{m,:},Y^{(k)}_{m,:}\rangle}_{=1}+\sum_{k_{1}=1}^{N }\sum_{l_{1}=1,l_{1}\neq k_{1}}^{N}M^{(k)}_{i^{(k+1)}k_{1}}M^{(k)}_{j^{(k+1)}l _{1}}\underbrace{\langle Y^{(k)}_{k_{1},:},Y^{(k)}_{l_{1},:}\rangle}_{\geq\phi ^{(k)}}$ $\displaystyle\geq\lambda_{\text{min}}^{2}\phi^{(k)^{2}}\alpha^{2N}+(1-\lambda_ {\text{min}}^{2}\alpha^{2N}\phi^{(k)^{2}})\phi^{(k)}$ $\displaystyle\geq c^{2}\lambda_{\text{min}}^{2}\alpha^{2N}+\left(1-c^{2} \lambda_{\text{min}}^{2}\alpha^{2N}\right)\phi^{(k)}$ $$

where the last two inequalities follow since $\sum_{j}M_{ij}\geq 1\ \forall i$ and $\phi^{(k)}\geq c$ respectively. Note also that by iterating the above recurrence starting from $t=1$, it is easy to show by induction that since $\phi^{(0)}\geq c$, then $\phi^{(k)}\geq c\ \forall k$. By rearranging the terms, we have that:

$$ $1-\phi^{(k+1)}\leq\left(1-c^{2}\lambda_{\text{min}}^{2}\alpha^{2N}\right)\left (1-\phi^{(k)}\right)$ $$

By recursively unrolling the relationship, we get:

$$ $\displaystyle 1-\phi^{(K)}$ $\displaystyle\leq\left(1-c^{2}\lambda_{\text{min}}^{2}\alpha^{2N}\right)^{K} \left(1-\phi^{(0)}\right)$ $\displaystyle\leq\left(1-c^{2}\lambda_{\text{min}}^{2}\alpha^{2N}\right)^{K}$ $$

since $0<c\leq\phi^{(0)}<1$

Since by definition, $1-\phi^{(k)}\geq 1-\langle Y_{i,:}^{(k)},Y_{j,:}^{(k)}\rangle\geq\|Y_{i,:}^{(k
)}-Y_{j,:}^{(k)}\|_{2}^{2}/2$ it follows that:

$$ $\displaystyle\mu(Y^{(K)})$ $\displaystyle=\|Y^{(K)}-\bm{11}^{\top}Y^{(K)}/N\|_{F}=\sqrt{\sum_{i=1}^{N}\|Y_ {i,:}^{(K)}-\bm{1}^{\top}Y^{(K)}/N\|_{2}^{2}}$ $\displaystyle=\sqrt{\frac{1}{2N}\sum_{i=1}^{N}\sum_{j=1}^{N}\|Y_{i,:}^{(K)}-Y_ {j,:}^{(K)}\|_{2}^{2}}$ $\displaystyle\leq\sqrt{N}\left(1-c^{2}\lambda_{\text{min}}^{2}\alpha^{2N} \right)^{K}$ $$

∎

###### Lemma A.4 .

###### Proof.

###### Lemma A.5 .

###### Proof.

###### Proof.

### A.8 Rank Collapse for LTI SSMs with no Skip Connections and LayerNorm

###### Lemma A.6 .

$$ $||Y^{(k)}||_{F}\leq||W||^{k}||Y^{0}||_{F}$ $$

###### Proof.

We have that $||Y^{(k+1)}||_{F}=||M^{(k)}Y^{(k)}||_{F}\leq||W||||Y^{(k)}||_{F}$. By simply solving the recurrence we get the desired result.
∎

We now analyze rank collapse for Structured LTI SSMs. For simplicity of exposition, here we neglect the gating mechanism and focus on the recurrent block. In particular, we will analyze a network consisting of $K$ layers of stacked Structured LTI SSM blocks. We recall that for structured LTI SSM blocks, which satisfy with $A_{t}=a_{t}I$, we have that the matrix $M$ takes the form $M^{(k)}=W_{A}^{(k)}\odot(W^{(k)}_{C}W_{B}^{{(k)}^{T}}):=W^{(k)}$, where $W_{A}=\left[\begin{array}[]{ccccc}1&&&&\\
a_{1}&1&&&\\
a_{2}a_{1}&a_{2}&1&&\\
\vdots&\vdots&\ddots&\ddots&\\
a_{N-1}\ldots a_{1}&a_{N-1}\ldots a_{2}&\ldots&a_{N-1}&1\end{array}\right]$. We first consider the case where all the layers have the same parameters, i.e. it holds that $W^{(k)}=W\ \forall k$ for some matrix $W$. We then have the following result:

###### Theorem A.7 (Rank Collapse Structured LTI SSMs) .

For a $K$ layer network of only Structured LTI SSM blocks where all layers have the same parametrization, it holds that $\mu(Y^{(k)})\leq||W||^{K}\ ||Y^{(0)}||_{F}$

###### Proof.

We have that:

$$ $M^{(k)}Y^{(k)}-1\gamma_{k+1}=\left(I-\frac{11^{\top}}{N}\right)WY^{(k)}$ $$

From here, by using Lemma A.6, we get:

$$ $\displaystyle\mu(Y^{(k+1)})$ $\displaystyle=||M^{(k)}Y^{(k)}-1\gamma_{k+1}||_{F}$ $\displaystyle\leq\left|\left|I-\frac{11^{\top}}{N}\right|\right|\left|\left|WY ^{(k)}\right|\right|_{F}\leq||Y^{(k+1)}||_{F}$ $\displaystyle\leq||W||^{k+1}||Y^{(0)}||_{F}$ $$

∎

Hence, whenever $||W||_{F}<1$, we have rank collapse for the case of structured LTI-SSMs. Note that however here the overall dynamics and behavior is different: the convergence is exponential rather than doubly exponential like in the Attention case. This is due to the fact that the matrix $M$ is not input dependent, which is what causes the double exponential convergence. We will see that for selective SSMs, which also have a similar input dependence to attention (apart from the softmax) for the matrix $M$, the convergence will again be doubly exponential. Furthermore, note that here the initial input sequence does not have any influence on rank collapse, whereas in the attention case this was not the case (since there was also a doubly exponential dependence on $||\text{res}(Y^{(0)})||_{F}$). Again, we will see a similar behavior in the selective SSM setting.
For the case where we have different parametrizations for different layers, we then have:

###### Theorem A.8 (Rank Collapse Structured LTI SSMs General) .

For a $K$ layer network of only Structured LTI SSM blocks it holds that $\mu(Y^{(K)})\leq\prod_{k=1}^{K}||W^{(k)}||\ ||Y^{(0)}||_{F}$

###### Proof.

From the proof of Lemma A.6, we have that $||Y^{(k+1)}||_{F}=||M^{(k)}Y^{(k)}||_{F}\leq||W^{(k)}||\ ||Y^{(k)}||_{F}$. Applying this recursively gives us $||Y^{(K)}||_{F}\leq\prod_{k=1}^{K}||W^{(k)}||\ ||Y^{(0)}||_{F}$. Then, similarly to the proof of TheoremA.7, we have:

$$ $\displaystyle\mu(Y^{(K+1)})$ $\displaystyle=||M^{(K)}Y^{(K)}-1\gamma_{K+1}||_{F}$ $\displaystyle\leq\left|\left|I-\frac{11^{\top}}{N}\right|\right|\ \left|\left| W^{(K)}Y^{(K)}\right|\right|_{F}\leq\sqrt{N}||Y^{(K+1)}||_{F}$ $\displaystyle\leq\prod_{k=1}^{K+1}||W^{(k)}||\ ||Y^{(0)}||_{F}$ $$

∎

In this case, one simple sufficient condition to have exponential convergence of the rank collapse measure is that $||W^{(k)}||_{F}<1\ \forall k$.

###### Lemma A.6 .

###### Proof.

###### Theorem A.7 (Rank Collapse Structured LTI SSMs) .

###### Proof.

###### Theorem A.8 (Rank Collapse Structured LTI SSMs General) .

###### Proof.

### A.9 Proof of Upper Bound of Rank Collapse Measure for Selective SSMs without LayerNorm and Skip Connections

###### Lemma A.9 .

For a selective SSM, it holds that:

$$ $||Y^{(k)}||_{F}\leq\left(\sqrt{N}||W_{BC}||_{F}\right)^{\frac{3^{k}-1}{2}}||Y^ {(0)}||_{F}^{3^{k}}$ $$

where $W_{BC}=W_{C}W_{B}^{\top}$

###### Proof.

We have that:

$$ $\displaystyle||Y^{(k+1)}||_{F}$ $\displaystyle=||M^{(k)}Y^{(k)}||_{F}\leq||M^{(k)}||_{F}\ ||Y^{(k)}||_{F}$ $\displaystyle=||\text{1SS}(\alpha)\odot\left(Y^{(k)}W_{C}W_{B}^{\top}Y^{{(k)}^ {T}}\right)||_{F}\ ||Y^{(k)}||_{F}$ $\displaystyle\leq||\text{1SS}(\alpha)||_{F}||Y^{(k)}W_{C}W_{B}^{\top}Y^{{(k)}^ {T}}||_{F}\ ||Y^{(k)}||_{F}$ $\displaystyle\leq\sqrt{N}||W_{BC}||_{F}||Y^{(k)}||^{3}_{F}$ $$

By simply solving the recurrence we get the desired result.
∎

###### Theorem A.10 (Rank Collapse for Selective SSMs) .

Given a selective SSM with same parametrization for each layer with no skip connection, it holds that:

$$ $\mu(Y^{(k)})\leq\left(\sqrt{N}||W_{BC}||_{F}\right)^{\frac{3^{k-1}+1}{2}}||Y^{ (0)}||_{F}^{3^{k}}.$ $$

###### Proof.

We start by observing that:

$$ $\displaystyle\mu(Y^{(k)})$ $\displaystyle=\Big{|}\Big{|}\left(I-\frac{11^{\top}}{N}\right)M^{(k-1)}Y^{(k-1 )}\Big{|}\Big{|}_{F}\leq\sqrt{N}||M^{(k-1)}||_{F}\ ||Y^{(k-1)}||_{F}$ $\displaystyle\leq\sqrt{N}||W_{BC}||\ ||Y^{(k-1)}||_{F}^{3}$ $$

By using Lemma A.9, we get that:

$$ $\mu(Y^{(k)})\leq\left(\sqrt{N}||W_{BC}||_{F}\right)^{\frac{3^{k-1}+1}{2}}||Y^{ (0)}||_{F}^{3^{k}}$ $$

proving the result.
∎

###### Lemma A.9 .

###### Proof.

###### Theorem A.10 (Rank Collapse for Selective SSMs) .

###### Proof.

### A.10 Proof of Counterexample for LTI SSMs

See 4.3.1

###### Proof.

We will prove the theorem by induction.
In particular, we will prove that $Y^{(k)}$ will take the following form:

$$ $Y^{(k)}=\begin{pmatrix}1&0\\ \sqrt{\frac{\alpha_{k}-1}{\alpha_{k}}}&\frac{1}{\sqrt{\alpha_{k}}}\end{pmatrix}$ (12) $$

where $\alpha_{0}=1$ and $\alpha_{k}$ satisfy the recurrence: $\alpha_{k+1}=\alpha_{k}\left(1+\frac{4}{(1+\lambda)^{2}}\right)+\frac{4}{1+
\lambda}\sqrt{\alpha_{k}-1}\sqrt{\alpha_{k}}$. For $\lambda>-1$, we simply have that $\alpha_{k+1}\geq\alpha_{k}\left(1+\frac{4}{(1+\lambda)^{2}}\right)$, implying that $\alpha_{k}\geq\alpha_{0}\left(1+\frac{4}{(1+\lambda)^{2}}\right)^{k}$, which causes $\alpha_{k}$ to diverge. Similarly, if $-2<\lambda<-1$, we have that $\alpha_{k+1}\geq\alpha_{k}\left(1+\frac{2}{1+\lambda}\right)^{2}$, i.e. $\alpha_{k}\geq\alpha_{0}\left(\frac{3+\lambda}{1+\lambda}\right)^{2k}$, which also diverges. This implies that $Y^{(k)}\rightarrow\begin{pmatrix}1&0\\
1&0\end{pmatrix}$, which is a rank one matrix, hence also implying that $\mu(Y^{(k)})\rightarrow 0$.

Let’s consider now the case where $\lambda<-2$. We will prove that the sequence $\alpha_{k}$ remains bounded from above. Note that this automatically proves that rank collapse does not happen, since a necessary condition for this is that $\alpha_{k}\rightarrow\infty$. Let define $r=\frac{1}{1+\lambda}$ and $\beta=\frac{1}{1-r^{2}}>1$ for $\lambda<-2$. We prove by induction that $\alpha_{k}\leq\beta\forall k$. Since $\beta>1$, the statement clearly holds for $k=0$. Suppose now that the statement holds for $k$. We prove that the statement holds for $k+1$. We have that $\alpha_{k+1}\leq\beta(1+4r^{2})+4r\sqrt{\beta}{\sqrt{\beta-1}}$. We want the quantity on the right hand side to be smaller than $\beta$. This is equivalent to saying that $r^{2}\beta\leq-r\sqrt{\beta}\sqrt{\beta-1}$. By squaring both sides and solving the inequality we can see that $\beta=\frac{1}{1-r^{2}}$ satisfies this inequality.

We now go on to prove the above statement in Equation 12 about the structure of $Y^{(k)}$ using induction. Clearly, the statement is true for $k=0$. Now, let’s assume the statement holds for $k$. We will prove that then the statement holds for $k+1$. We have that:

$$ $\tilde{Y}^{(k+1)}=(M+\lambda I)Y^{(k)}=\begin{pmatrix}1+\lambda&0\\ 2&1+\lambda\end{pmatrix}\begin{pmatrix}1&0\\ \sqrt{\frac{\alpha_{k}-1}{\alpha_{k}}}&\frac{1}{\sqrt{\alpha_{k}}}\end{pmatrix }=\begin{pmatrix}1+\lambda&0\\ {\frac{(1+\lambda)\sqrt{\alpha_{k}-1}+2\sqrt{\alpha_{k}}}{\sqrt{\alpha}_{k}}}& \frac{1+\lambda}{\sqrt{\alpha_{k}}}\end{pmatrix}$ $$

Hence, after we apply LayerNorm to $\tilde{Y}^{(k+1)}$, by letting $\gamma=\left(4+(1+\lambda)^{2}\right)\alpha_{k}+4(1+\lambda)\sqrt{\alpha_{k}}
\sqrt{\alpha_{k}-1}$, we get that:

$$ $Y^{(k+1)}=\begin{pmatrix}1&0\\ \frac{(1+\lambda)\sqrt{\alpha_{k}-1}+2\sqrt{\alpha_{k}}}{\sqrt{\gamma}}&\frac{ 1+\lambda}{\sqrt{\gamma}}\end{pmatrix}$ $$

Choosing $\alpha_{k+1}=\left(1+\frac{4}{(1+\lambda)^{2}}\right)\alpha_{k}+\frac{4}{1+
\lambda}\sqrt{\alpha_{k}-1}\sqrt{\alpha_{k}}$ clearly results to $k+1$ being of the form

$$ $Y^{(k+1)}=\begin{pmatrix}1&0\\ \sqrt{\frac{\alpha_{k+1}-1}{\alpha_{k+1}}}&\frac{1}{\sqrt{\alpha_{k+1}}}\end{pmatrix}$ $$

which proves the induction hypothesis.
∎

###### Proof.

### A.11 Proof of Counterexample for Selective SSMs

See 4.3.2

###### Proof.

Again, we proceed by induction. In particular, we will show that under the assumptions of the theorem, $Y^{(k)}$ takes the following form:

$$ $Y^{(k)}=\begin{pmatrix}1&0\\ \frac{(2+\lambda)^{k}\alpha_{0}}{\sqrt{(2+\lambda)^{2k}\alpha_{0}^{2}+(1+ \lambda)^{2k}\beta_{0}^{2}}}&\frac{(1+\lambda)^{k}\beta_{0}}{\sqrt{(2+\lambda) ^{2k}\alpha_{0}^{2}+(1+\lambda)^{2k}\beta_{0}^{2}}}\end{pmatrix}$ $$

Note that if this result holds, as long as $\alpha_{0}>0$ and $|2+\lambda|>|1+\lambda|$ (which happens iff $\lambda>-\frac{3}{2}$), we have that $Y^{(k)}\rightarrow\begin{pmatrix}1&0\\
1&0\end{pmatrix}$, which is a rank one matrix, hence also implying that $\mu(Y^{(k)})\rightarrow 0$. On the other hand, if $\lambda<-\frac{3}{2}$ we have that $Y^{(k)}$, as k increases, tends to oscillate between the matrices $\begin{pmatrix}1&0\\
0&1\end{pmatrix}$ and $\begin{pmatrix}1&0\\
0&-1\end{pmatrix}$. Although in this case the limit of $Y^{(k)}$ does not exist, we have that both the matrices above have full rank and hence rank collapse does not happen.

We now proceed to prove the statement above. Clearly, the statement is true for $k=0$. Let’s suppose that the statement holds for $k$. We will prove that it holds for $k+1$. We have that under the choice of $M$ and $\lambda$ for the theorem, we have that:

$$ $\displaystyle\tilde{Y}^{(k+1)}$ $\displaystyle=\begin{pmatrix}1+\lambda&0\\ \frac{(2+\lambda)^{k}\alpha_{0}}{\sqrt{(2+\lambda)^{2k}\alpha_{0}^{2}+(1+ \lambda)^{2k}\beta_{0}^{2}}}&1+\lambda\end{pmatrix}\begin{pmatrix}1&0\\ \frac{(2+\lambda)^{k}\alpha_{0}}{\sqrt{(2+\lambda)^{2k}\alpha_{0}^{2}+(1+ \lambda)^{2k}\beta_{0}^{2}}}&\frac{(1+\lambda)^{k}\beta_{0}}{\sqrt{(2+\lambda) ^{2k}\alpha_{0}^{2}+(1+\lambda)^{2k}\beta_{0}^{2}}}\end{pmatrix}$ $\displaystyle=\begin{pmatrix}1+\lambda&0\\ \frac{(2+\lambda)^{k+1}\alpha_{0}}{\sqrt{(2+\lambda)^{2k}\alpha_{0}^{2}+(1+ \lambda)^{2k}\beta_{0}^{2}}}&\frac{(1+\lambda)^{k+1}\beta_{0}}{\sqrt{(2+ \lambda)^{2k}\alpha_{0}^{2}+(1+\lambda)^{2k}\beta_{0}^{2}}}\end{pmatrix}$ $$

Hence, after applying LayerNorm to $\tilde{Y}^{(k+1)}$, we get that:

$$ $Y^{(k)}=\begin{pmatrix}1&0\\ \frac{(2+\lambda)^{k+1}\alpha_{0}}{\sqrt{(2+\lambda)^{2k+2}\alpha_{0}^{2}+(1+ \lambda)^{2k+2}\beta_{0}^{2}}}&\frac{(1+\lambda)^{k+1}\beta_{0}}{\sqrt{(2+ \lambda)^{2k+2}\alpha_{0}^{2}+(1+\lambda)^{2k+2}\beta_{0}^{2}}}\end{pmatrix}$ $$

which proves the claim and finishes the proof.
∎

###### Proof.

### A.12 Additional Experiments

#### A.12.1 Comparison of Rank Collapse for the S4 Architecture with and without skip connection and LayerNorm

In the following, we consider a different SSM model, i.e. the S4 architecture Gu et al. [], to analyze the effect of skip connections and LayerNorm on a different model. In particular, we use the S4 variant with diagonal $A$, i.e. S4D Gu et al. []. We train the S4D architecture with 32 layers and 1.6 million parameters on the Cifar10 dataset. We then sample 32 images from this dataset and forward pass them through the trained model. Again, we calculate the normalized rank collapse measure $\mu$ at each layer. We repeat this for all considered cases, namely skip connections plus LayerNorm, only skip connections, only LayerNorm, and neither skip connections or LayerNorm.

Figure: Figure 4: (Normalized) Rank Collapse measure as a function of layer depth for the S4D model. The shaded areas represent one standard deviation from the mean calculated over the 32 examples. Skip=True/False indicates we use a S4D architecture with/without skip connection whereas LayerNorm=True/False indicate we use a S4D architecture with/without LayerNorm
Refer to caption: x4.png

Figure 4 shows that for S4D, even when removing the skip connection and the LayerNorm from the model, rank collapse is not observed. This can be explained by the fact that the condition on the Frobenius norm of the weight matrix being smaller than 1 to guarantee rank collapse is quite stringent in practice and hence it is not met by the model. Additionally, note that while for Transformers and for Mamba-2 the observation of rank collapse depended (at least theoretically) on both the values of the weight matrices and the inputs values, for standard SSMs (e.g. S4) rank collapse only depends on the weight matrix. This renders the SSM model more ”robust” to rank collapse, in the sense that to observe rank collapse one needs to find a precise parametrization of the model and cannot simply find an ”adversarial” input sequence causing rank collapse (which instead could be done for every parametrization of Transformers and selective SSMs).

### A.13 Experimental Details

For both the LRA image task and the MQAR task we use the standard code bases provided online.(^5^55[https://github.com/HazyResearch/zoology](https://github.com/HazyResearch/zoology) and [https://github.com/google-research/long-range-arena](https://github.com/google-research/long-range-arena)) We use the standard transformer architecture, the linear attention model proposed in Katharopoulos et al. [], the Mamba architecture [Gu and Dao, ], and the Mamba-2 architecture [Dao and Gu, ]. For the MQAR experiments we use the following training protocol:

- •
Optimizer and schedule: Weight decay of 0.1, linear warmup with duration of 10%, AdamW optimizer [Loshchilov and Hutter, ]. For each run, we sweep the learning rates in $\texttt{np.logspace}(-4,-2,4)$ and train for 64 epochs. This is the same setup as in [Arora et al., ].
- •
Initialization: For all models we use their standard initialization and initialize $\lambda=-1$ in each layer.
- •
Training duration: We use a global batch size of $64$.
- •
Width and depth: For all runs, we use two layers (each with a sequence model and a MLP, interleaved with layer normalization). The model dimensions $d=128$, state dimension $n=64$, sequence length $L=512$, and number of KV pairs $=64$ are kept constant for all four architectures.
- •
Position information: Positional embeddings [Brown et al., ] are used for the attention architectures, but not for the SSM architecture classes. This is the same setup as in [Arora et al., ].
- •
Data: Each model is trained on 100,000 datapoints and evaluated on 3,000 datapoints. The data and its order are constant for all runs. This is the same setup as in [Arora et al., ].

For the LRA image experiments we use the following training protocol:

- •
Optimizer and schedule: Linear warmup with duration of 10%, AdamW optimizer [Loshchilov and Hutter, ]. For attention-based models we use weight decay $0.0$ and learning rate $5e-4$ and for SSM-based models we use weight decay $0.01$ and learning rate $2e-4$.
- •
Initialization: For all models we use their standard initialization and initialize $\lambda=-1$ in each layer.
- •
Training duration: We use a global batch size of $64$.
- •
Width and depth: For all runs, we use four layers (each with a sequence model and a MLP, interleaved with layer normalization). The model dimensions $d=256$ and state dimension $n=64$ are kept constant for all four architectures.
- •
Data: Each model is trained on 35,200 datapoints and evaluated on 7,850 datapoints. The data and its order are constant for all runs.

Since we keep the model sizes constant among all architectures and do not optimize the hyperparameters, the accuracies reported in Table 1 are generally lower than in the literature. However, the main point of these experiments is to investigate if learning $\lambda$ affects performance.

## Peer Reviews

confidence: 2
contribution: 3
initial_rating: 6
presentation: 3
questions: I have a reasonable estimate of creativity and technical depth, but it is difficult for me to assess impact.  I am not familiar with the area and my assessment has limited confidence. I would not, for example, know if rank collapse is widely appreciated within even the transformer "community" (if there is any such thing).  I have not seen MAMBA become that visible or widely used compared to standard transformer-based LLMs, but cannot speculate if rank collapse played a role.  $\lambda$-tuning for robustness seems quite useful, but again I do not know the area well enough to know if, in practice, $\lambda=1$ is frequently dangerous.  If the authors point to specific places in the paper where the above issues are discussed, or add some more motivating support, that would be helpful.

A few writing style and notation nits:

L156-L159 set up $X^{(k)}$ as layer input and $Y^{(k)}$ as layer output.  However, equation (1) introduces $O^{(k)}$ without explaining it will provide skipping ability in equation (2).

L174-L178 There seem to be some inconsistent subscripts and superscripts. On one side we see $A^{(k)}_t, B^{(k)}_t$ etc. But just after the displayed equation, for LTI systems we see the superscript $(k)$ disappear, without an explanation if this is because the LTI system is assumed to have one layer.

L888-L903 While setting up expressions and bounds with so many variables, it helps to afterward highlight the most import 1-2 variables, and give qualitative connections between their typical values in practice and the implications on the bounds.  E.g., how easy or difficult would be to choose an acceptable $\lambda$ in a typical LLM?  Also, some of the definitions like $S$ are very far from the proofs in the appendix.
soundness: 3
strengths: Reasons to accept:
* Identifies rank collapse problem in state-space models like MAMBA, similar to earlier discovery of this problem in transformer-type networks.
* Identifies skip strength parameter $\lambda$ as an important knob to limit the damage of rank collapse.
summary: Dao and Gu [https://arxiv.org/pdf/2405.21060] established a form of equivalence between transformers and continuous-time state-space models.  In a different development, Dong et al. [https://arxiv.org/abs/2103.03404] showed that self-attention layers without skip connections or MLPs suffer from "rank collapse" ― with increasing layers, the output matrix tends to rank-1, i.e., all token positions tend to the same representation.

The present submissions puts these together to show that rank collapse is a problem also for state-space models.  It shows that the skip connection provides vital protection against rank collapse, but that a weighted addition (with weight $\lambda$ which may be regarded as a hyperparameter, or perhaps trainable) with the skip connection is more flexible.
weaknesses: Reasons to reject:
* Given the two papers on which this paper builds, it might be argued that the present work is relatively incremental.  (That being said, I appreciate the candor while setting up the contributions of this paper, and I learnt something from it.)

---

confidence: 3
contribution: 2
initial_rating: 6
presentation: 2
questions: See above.
soundness: 3
strengths: 1. The lower boundary of the rank collapse of $\lambda$ skip connections is analytically derived. The results agree well with empirical analysis.
2. The paper presents the convergence rate in the absence of skip connections, contributing valuable insights.
summary: This paper analyzes the rank collapse of SSM due to identical $\lambda$ skip connections. The authors provide a rigorous convergence rate for the rank collapse and offer sufficient guarantees to prevent it. Experimental results demonstrate the effectiveness of their analysis.
weaknesses: 1. The authors analyze the $\lambda$ skip connections. However, the skip strength $\lambda_k$ may vary on different layers.The paper should discuss how the findings hold up under these varying conditions. Additionally, many models implement skip connections selectively across layers rather than uniformly. A discussion on the generalizability of the results would enhance the paper.
2. Theorem 4.1 paves the way to choose suitable $\lambda$. However, in Figure 2, it appears that when $\lambda$ is sufficiently large, the rank collapse index shows little variation. Clarification on how to determine the optimal value of $\lambda$ would be beneficial.
3. Based on theorem 4.1, could the authors explore adding constraints to the parameters to optimize $C_M$, $S$ and $c$ for improved neural network performance?

---

confidence: 4
contribution: 3
initial_rating: 8
presentation: 3
questions: The rank collapse metric is not normalized in the definition. Would it be enough to lower bound the rank collapse metric, when the norm itself evolves across layers?
soundness: 3
strengths: This paper addresses the significant issue of rank collapse in sequence model architectures. It offers both theoretical analysis and empirical evaluation to support the proposed architectural component aimed at resolving this problem. I like the remark that provides the parameters corresponding to the practical architectural settings.

Additionally, the theoretical development and overall presentation of the paper are commendably clear and well-structured.
summary: This paper examines the phenomenon of rank collapse in general sequence model architectures, including transformers and state space models. To mitigate this issue, the paper proposes a parameterized version of the skip connection that multiplies the residual stream by a constant factor. Theoretical analysis identifies the conditions on the parameter sufficient to prevent rank collapse, and an analytical example demonstrates that neither the absence of skip connections nor the standard implementation prevents rank collapse. Finally, empirical evaluations support the findings of theoretical analysis.
weaknesses: The theory investigates the sufficient conditions for preventing rank collapse in the worst-case scenario. This could imply that the required conditions are overly stringent.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: Q1. Between Eq. (3) and Eq. (6), there is ambiguity regarding the residual term, specifically whether X or V serves as the residual component. This inconsistency could impact the theoretical derivations that follow. Could the authors clarify this definition? Additionally, using the same symbol D for both SSM and LayerNorm contexts creates potential confusion. Distinct notations would enhance clarity.
Q2. The theoretical conditions for λ appear to be conservative compared to empirical findings. Could the authors explain this discrepancy? Furthermore, the appendix notes cases of rank stability without skip connections, which might challenge the theory. An analysis of these cases would be valuable.
Q3. Could the authors provide additional experiments showing the model’s downstream performance as a function of layer depth and skip strength? Also, would the inclusion of alternative metrics, such as effective rank, offer a more comprehensive assessment of rank collapse?
soundness: 3
strengths: S1. The paper tackles the problem of rank collapse, extending its analysis from transformers to SSMs.
S2. Through theoretical proofs, the paper demonstrates that lambda-skip connections prevent rank collapse, preserving model expressivity in both transformers and SSMs.
S3. Experimental results show that lambda-skip connections and other components enhance expressivity and stability across different model architectures.
summary: This paper addresses rank collapse, a phenomenon where embedding vectors in deep learning models converge to a uniform state. Building on previous studies that focused on transformers, this paper extends the analysis to State Space Models (SSMs). The study employs theoretical and empirical analysis to demonstrate how lambda-skip connections, LayerNorm, and gating mechanisms contribute to both the stability and expressivity of transformers and SSMs.
weaknesses: W1. The definition of the residual term between Eq.(3) and Eq.(6) is inconsistent, with ambiguity around whether X or V serves as the residual term. This inconsistency impacts the theoretical derivations that follow and should be clarified to ensure precise interpretations. Additionally, certain symbols, such as D, are used in both the SSM and LayerNorm contexts but represent different meanings. Distinct notation would improve readability and reduce potential confusion.
W2. While the experiments generally align with the theoretical predictions, some disparities remain unaddressed. For example, the theoretical threshold for λ appears more conservative than the empirical results suggest, and additional clarification would help. Further, the appendix notes rank stability even without skip connections, which might challenge the presented theory.
W3. The paper primarily focuses on rank collapse within the model’s architecture but does not connect this phenomenon to downstream task performance. Adding experimental results that measure downstream task performance in relation to model depth and skip connection strength could provide a more comprehensive assessment.

Meta-review: The paper discusses the phenomenon of rank collapse in LLMs, extending the study done on transformers to the SSM architecture. This issue is highly motivated given the popularity of SSM-based LLMs. The reviews note that the paper provides valuable insights to the problem coupled with a theoretically backed solution to it. This solution is mentioned to be practical and shown to be effective with convincing empirical evidence. 

The reviews did mention some vague parts in the paper requiring clarifications and suggested ways in which the analysis can be made more thorough. From the discussion, these issues are either resolved by the authors explanations or appear to be minor. The changes required to integrate the needed parts of the discussion into the paper are quite minor and can be made towards a camera-ready version. 

I believe the paper’s strengths outweigh the relatively minor weaknesses pointed out in the reviews, leading me to recommend accepting it to ICLR.

Decision: Accept (Poster)