Title: Understanding the Differences in Foundation Models: Attention, State  Space Models, and Recurrent Neural Networks
Venue: NeurIPS 2024
Accepted: yes
Keywords: deep learning architectures

softmax attention

linear attention

state space models

recurrent neural networks

dynamical system models
Abstract: Softmax attention is the principle backbone of foundation models for various artificial intelligence applications, yet its quadratic complexity in sequence length can limit its inference throughput in long-context settings. To address this challenge, alternative architectures such as linear attention, State Space Models (SSMs), and Recurrent Neural Networks (RNNs) have been considered as more efficient alternatives. While connections between these approaches exist, such models are commonly developed in isolation and there is a lack of theoretical understanding of the shared principles underpinning these architectures and their subtle differences, greatly influencing performance and scalability. In this paper, we introduce the Dynamical Systems Framework (DSF), which allows a principled investigation of all these architectures in a common representation. Our framework facilitates rigorous comparisons, providing new insights on the distinctive characteristics of each model class. For instance, we compare linear attention and selective SSMs, detailing their differences and conditions under which both are equivalent. We also provide principled comparisons between softmax attention and other model classes, discussing the theoretical conditions under which softmax attention can be approximated. Additionally, we substantiate these new insights with empirical validations and mathematical arguments. This shows the DSF's potential to guide the systematic development of future more efficient and scalable foundation models.

Understanding the Differences in Foundation Models: Attention, State Space Models, and Recurrent Neural Networks

Abstract

Softmax attention is the principle backbone of foundation models for various artificial intelligence applications, yet its quadratic complexity in sequence length can limit its inference throughput in long-context settings. To address this challenge, alternative architectures such as linear attention, State Space Models (SSMs), and Recurrent Neural Networks (RNNs) have been considered as more efficient alternatives. While connections between these approaches exist, such models are commonly developed in isolation and there is a lack of theoretical understanding of the shared principles underpinning these architectures and their subtle differences, greatly influencing performance and scalability. In this paper, we introduce the Dynamical Systems Framework (DSF), which allows a principled investigation of all these architectures in a common representation. Our framework facilitates rigorous comparisons, providing new insights on the distinctive characteristics of each model class. For instance, we compare linear attention and selective SSMs, detailing their differences and conditions under which both are equivalent. We also provide principled comparisons between softmax attention and other model classes, discussing the theoretical conditions under which softmax attention can be approximated. Additionally, we substantiate these new insights with empirical validations and mathematical arguments. This shows the DSF's potential to guide the systematic development of future more efficient and scalable foundation models.

1 Introduction

Foundation models serve as the backbone for a wide range of tasks across Artificial Intelligence due to their ability to learn complex interactions in large datasets [1]. In recent years, the attention mechanism [2] has been the dominating token-mixing strategy in foundation models. However, its major computational bottleneck, i.e., the quadratic complexity with context length, has posed a challenge to scaling and deploying these models beyond moderate context lengths [3]. In order to mitigate these issues, attention-free architectures have been proposed: prominent examples of these are the novel State Space Models (SSMs) [4-8], as well as recent efforts to enhance Recurrent Neural Networks (RNNs) [9-12]. Although these models show great promise in boosting efficiency, efforts

to provide a rigorous theoretical comparison are scarce, and current comparisons with attention are merely empirical (see Section 5 for an in-depth discussion). Despite the prevalence and ubiquity of foundation models, a principled understanding of the similarities and differences among these different design strategies is currently lacking.

In order to close this gap, we introduce the Dynamical Systems Framework (DSF) - a theoretical framework based on a control theoretic perspective - that allows us to evaluate the similarities and differences between different foundation models in a principled manner. The DSF serves as a powerful tool for approaching theoretical research questions about foundation models, enabling direct comparisons - both theoretical and experimental - across architectures such as attention mechanisms, SSMs, and RNNs. We believe that the DSF provides new insights on the most relevant features found in current architectures, and can inform a systematic development of future hybrid models. The DSF further simplifies identification of existing computational algorithms to apply to newly developed models. Rather than providing an exhaustive list of insights, the results included below are meant to exemplify important questions that the DSF can answer and guide future research. Specifically, we explore the following questions:

How are attention mechanisms, SSMs, and RNNs related? TL;DR: All three model classes can be represented as recurrent models, which can be compared using the proposed DSF.

Can softmax attention be expressed as a recurrent model? TL;DR: Softmax attention translates to a recurrent model within the DSF, however the hidden state dimension needs to be infinite.

Why does state expansion help to improve performance of RNNs and SSMs? TL;DR: This is related to the second question: state expansion increases the dimension of the hidden state thus allowing for an increased expressivity of the model (Lemma 2).

Why do SSMs significantly outperform attention on the LRA benchmark? TL;DR: The performance gap can be explained by the recurrent normalization strategy (discretization step) used by selective SSMs as discussed in Section 4.2.

How closely are linear attention, S6 (i.e. Mamba) related? TL;DR: The common feature is the coupling of state transition and input matrix via a single (normalization) parameter in their recurrent representation. However, the models differ in the parameterization of this parameter, which we analyze experimentally.

What do selective SSMs teach us about improving RNN architectures? TL;DR: Replacing the state transition in a RNN variant - qLSTM - with the state transition of S6 improves performance of the RNN.

We note that the main contribution of our paper is the introduction of the DSF, which is a unifying framework for analysis of attention mechanisms, SSMs, and RNNs. To the best of our knowledge, this is the first unified framework that allows analysis of all three model classes in the same parameterization and thus allows to identify differences in the models that lead to significant performance improvements. While some of the provided results already exist in the literature (e.g that increased state size improves performance), we also provide novel insights unique to the DSF framework in a comprehensive way that enables further analysis with control theoretical tools.

Notation: We use Latin letters in the following way: N is the size of the hidden state in the DSF, n the state expansion, d the embedding size or model size, and L the sequence length. A visual representation of these dimensions is given in Appendix A. We use superscripts, e.g. · d , to denote the elements or block-elements of a matrix and a block-matrix. We use subscripts, e.g. · i , to denote the time index (or input dependency). Specifically, v i represents the value of vector v at time i . We use bold notation to indicate sequences, i.e., v i = [ v 1 , . . . , v i ] . We use σ ( · ) to denote the sigmoid function. The products ⊙ and ⊗ denote the Hadamard (element-wise) product and the Kronecker (block-wise) product, respectively. I n denotes the identity matrix of size R n × n . Generally, we omit stating the bias term for weight matrices unless stating the bias term helps with clarity.

2 Preliminaries

In this section, we introduce the key architectural components studied in this work: attention, SSMs, and RNNs. We remark that these components are often the central block - considered to be the backbone - within a complex architecture composed of other blocks and skip connections (see for instance [13]). In what follows, we review exclusively the backbone block, which we denote as f ( · ) in y = f ( u ) , where u ∈ R L × d and y ∈ R L × d are the input and output sequences, respectively.

2.1 Attention

The standard self-attention block [2] consists of three matrices: W Q , W K , and W V , which are the learnt parameters of the model. These matrices, when multiplied with the input u , yield the queries q ∈ R d k , keys k ∈ R d k , and values v ∈ R d v , respectively:

Keys, queries, and values are then combined in the attention block to produce the output where ζ ( · ) is a map R L → R L and is applied row-wise. For standard self-attention, the softmax function is used, i.e. ζ ( · ) = softmax( · ) , but given the limitations of the softmax function, alternative formulations have been proposed. We consider two formulations of attention: softmax attention (2) and linear attention [14]. We focus on masked attention formulations, i.e., the attention matrix ζ ( qk ⊤ ) has a lower-triangular structure, and to simplify the derivations, we drop the scaling factor √ d k .

2.2 State Space Models

Architectures based on a state space parametrization compute the output y through a dynamic recurrence of input signals at each time step i , i.e.,

where h i is the hidden state of the system, and the dynamic matrices of appropriate dimensions A i , B i , C i , D i are the learnt model parameters. Different time-varying and time-invariant parameterizations for A i , B i , C i , D i have been proposed in the literature (an overview is given in [15]). Here we discuss the most prominent one.

S6. The first selective SSM parametrization (S6) was introduced together with the Mamba architecture [7]. The S6 block parametrizes the recurrence as

with ∆ i = softplus( W ∆ ( W u u i ) + b ∆ ) for every i , W ∆ , W u , W B , W C , W D , and A are learnt matrices of appropriate dimensions, and b ∆ is a learnt bias. While SSM models allow for complexvalued matrices A i , B i , C i , D i , here we restrict ourselves to real-valued matrices as in [7].

2.3 Recurrent Neural Networks

Similar to SSMs, RNNs also parameterize the input-output relationship via a recurrent computation, commonly given by the long short-term memory (LSTM) [16], i.e., at each time step i

where ¯ u i represents the pre-processed raw input u i , i.e.,

and f i , i i , and o i are the forget gate, the input gate, and the output gate, respectively,

where W f , W i , W o and U f , U i , U o are the learnt gate parameters. In this paper, we focus on two variants: quasi LSTMs (qLSTM) [9], which removes the output dependence of the gates, and RG-LRU [10], which attempts to integrate ideas from SSMs into RNNs.

qLSTM. The qLSTM model is parameterized by recurrence (5) with pre-processed input ¯ u i and gates f i , i i , o i :

RG-LRU. The RG-LRU model presents a hybrid between a qLSTM and a SSM using the recurrence

with the following gates and no pre-processing of u i :

3 Dynamical Systems Framework for Architecture Comparison

In this section, we introduce the Dynamical Systems Framework (DSF) that allows in-depth analysis of the architectural features of attention, SSMs, and RNNs from a dynamical systems perspective. We use this to rewrite the parametrizations in a common framework and provide detailed comparisons.

3.1 Dynamical Systems Framework (DSF)

The DSF relies on a dynamical systems representation of the architectures. A dynamical system models how a system's state, here denoted by h , evolves over time according to a difference or differential equation. Dynamical systems often evolve under the evolution of some input u , and the observable is an output y . These systems capture time-dependent processes, rendering them suitable for understanding the behavior of sequence models. Here, we choose a recurrent state space representation. This choice is motivated by the widespread use of state space model representations for dynamical systems. Moreover, we show in later sections that this representation encompasses attention, RNNs, and SSMs in a suitable fashion that allows for further analysis. In particular, a linear structured time-varying (LTV) dynamical system is defined by the recurrence

where h i ∈ R N is the hidden state initialized with h -1 = 0 , Λ i ∈ R N × N is the diagonal state transition matrix, B i ∈ R N × d and C i ∈ R d × N are the input and output matrices, respectively, and D i ∈ R d × d is a scaled skip connection. Dynamical system (11) can alternatively be written in its convolutional representation, i.e., y = Φu , where the convolutional kernel Φ is defined as

Note that the convolution kernel Φ is of the same dimension as the attention matrix ζ ( qk ⊤ ) and that these matrices are equivalent, up to the scaling factor W V used in self-attention.

Remark 1. This recurrent view yields a causal convolution kernel by definition. However, certain models (e.g. non-masked attention) also use non-causal kernels. This can be incorporated in the DSF (11) by modifying the state update (11a) . For the sake of simplicity and consistency with the recent literature, we stick with causal models in the following.

3.2 Architecture Reformulation

In the following, we show how popular architectures based on attention, SSMs, and RNNs can be rewritten into the DSF. To do this, all models will be reformulated into recurrence (11), i.e., all resulting DSF representations will have hidden state dimension N . 2 Although the parametrization

of models commonly found in the literature is conductive to efficient computation, here we depart from this convention. The goal of the DSF reformulation is to establish a theoretical framework that leads us to mathematical insights on the design of these models. The presented formulations are not intended to be computationally implemented in DSF form, however the framework can be used to identify computational algorithms for new architectures. For instance, the convolutional form of linear attention (12) is efficiently implemented via flash linear attention [17]. However, using the recurrent form derived below it can also be implemented via scan algorithms [18], e.g., parallel scan [5, 6] or accelerated scan [19]. Given that the structural requirements on the model parameterization of the algorithm is met, the DSF allows to identify existing algorithms to apply to new models even if the algorithm was designed for another model class.

3.2.1 Attention

In the following, we assume that we can separate the nonlinear map in (2) as

where ϕ ( · ) : R m → R n , ψ ( · ) : R m → R n , and η ( · , · ) : R m × R m × ( i +1) → R , which is the case for all the considered architectures in this paper. Note that if ζ ( · ) is a kernel function, the proposed separability is satisfied by construction, as it holds that ϕ = ψ and η = 1 . This allows us to write the self-attention input-output relationship as

with q i = W Q u i ∈ R m , k j = W V u j ∈ R m , and W Q ∈ R m × d , W K ∈ R m × d , W V ∈ R d × d . Hence, equation (14) can be reformulated into the DSF (11) as a dynamical system of dimension N = nd , i.e., with hidden state h i ∈ R nd , and dynamic matrices

We note that for the recurrence (11), the matrix Λ i is given as an nd × nd matrix, where n is the number of features in ϕ and ψ , and d is the input dimension. However, due to the scalar structure of Λ i in (15a), it can be implemented as the scalar multiplication η ( q i -1 , k i -1 ) η ( q i , k i ) h i -1 in (11). Hence, the hidden state is never materialized as such in the computation of the attention scores. Interested readers are referred to Appendix B for a detailed derivation.

Linear Attention. In the case of linear attention , both maps ϕ ( · ) and ψ ( · ) in the DSF parametrization (15) are separable and we use the kernel proposed in [14], i.e.,

where elu ( · ) is the exponential linear unit.

Generalized Linear Attention. We also study generalized linear attention, where we require that the maps ϕ ( · ) , ψ ( · ) are linear, but allow for general nonlinear normalization functions η ( q i , k i ) , i.e.,

Softmax Attention. Softmax attention also satisfies the assumption of separability (13). However, it holds that the feature vector representation of the transformed Gaussian kernel in the softmax function, i.e., e q ⊤ i k j , is infinite dimensional. Hence, the DSF representation (15) of softmax attention (2) and its corresponding hidden state dimension N would also be infinite dimensional. This insight gives further motivation to approximations of the softmax function by using, e.g., a Taylor series approximation such as in [20], to render the feature vector finite-dimensional.

Lemma 1. Softmax attention (2) can be expressed by separable attention (13) with

where ϕ ( q i ) := c · [ 1 , q i , ⊗ 2 j =1 q i , ⊗ 3 j =1 q i , . . . ] is an infinite-dimensional feature vector and c is a matrix of constant coefficients.

Proof. The exponential in softmax attention e q ⊤ i k j can be expressed in terms of its Taylor expansion, which consists of an infinite sum of polynomial kernels of increasing degree p , decomposable through the vectors of monomials ⊗ p j =1 q i . See Appendix C for a complete proof.

The work in [21] analyzes softmax attention as a kernel smoother and [14] shows that a kernel-based formulation can lead to linear complexity in sequence length for finite dimensional kernels. In [22], a kernel-based formulation of softmax is used to propose orthogonal random features to model softmax attention with linear complexity. In [20] a Taylor approximation of softmax attention is proposed, also leading to linear complexity. Finally, [23] relates transformer decoders to dynamical systems with increasing state size arising from the masked upper triangular part of the attention matrix. Compared to these works, we analyze how the proposed formulations compare in the recurrence (11) allowing us to compare to SSMs and RNNs in the following sections.

3.2.2 State Space Models

SSM models are straightforward to rewrite in the DSF given their intrinsic recurrent linear representation. However, similarly to attention, we slightly rewrite the standard representation introduced in the literature to reveal deeper insights obscured by the standard representation focused on computational efficiency. The detailed derivation can be found in Appendix E.

S6. The S6 parametrization can be written in the DSF (11) as

with ∆ i = diag ( softplus ( W ∆ ( W u u i ) + b ∆ )) ∈ R d × d , b i = W B u i ∈ R n , c i = W C u i ∈ R n , and W u ∈ R p × d , W ∆ ∈ R d × p are weight matrices with p < d , and b ∆ ∈ R d is a bias. Note that in formulation (19) the dimensions of the matrices are Λ i ∈ R nd × nd , B i ∈ R nd × d , C i ∈ R d × nd , i.e., n is the state dimension and d is the input dimension in the original formulation (4).

3.2.3 Recurrent Neural Networks

Given their recurrent nature, one can express LSTMs (5) in the DSF with some basic algebraic manipulations (see Appendix F for details). Once again, we slightly rewrite the standard representation since our goal is to obtain mathematical insights as opposed to computational efficiency.

qLSTM. In order to write the qLSTM formulation (8) in the DSF (11), a small modification is needed. In particular, the tanh functions in the input pre-processing (8) and output gate (5b) need to be dropped. Hence, the reformulated qLSTM in the DSF (11) writes as

where W f , W i , W o , W u ∈ R d × d are the learnt parameters in (8). It is important to note that here the dimension of the hidden state h i is equal to the number of input channels d , whereas in attention and SSMs the dimension of the hidden state h i in the DSF (11) is nd . For qLSTMs n = 1 , which will become relevant in further discussions; we refer to the fact that n > 1 as state expansion .

RG-LRU. Given the similarities of RG-LRU [10] and SSMs, it is straightforward to reformulate it into the DSF (11) without the need for modifications besides simple algebraic manipulations. Hence, the RG-LRU can be expressed in the DSF as where r i = diag( σ ( W R u i )) , and the function √ 1 -Λ 2 i is applied elementwise to Λ i . Similar to the qLSTM and in contrast with the other models, RG-LRU does not have state expansion, i.e. n = 1 .

4 Architecture Comparison: Theoretical and Experimental Results

In this section, we use the DSF to explore some of the long-standing questions between attention, SSMs, and RNNs. We provide theoretical results and/or numerical experiments to substantiate our claims. The experiments presented below are performed on the multi-query associate recall (MQAR) [24] and long range arena (LRA) [3] benchmarks using the code bases 3 provided with the benchmarks. The complete experimental setup and computational resources used are detailed in Appendices J and K, respectively, and a statistical analysis is provided in Appendix L.

4.1 Softmax Attention vs. Separable Attention.

Separable attention is used to avoid computation of the query-key matrix qk ⊤ . It allows to compute k ⊤ v before multiplying the queries q , which reduces the computational complexity from quadratic to linear in sequence length. While the DSF shows how separable attention, and in particular kernelized attention can be rewritten as a recurrence (11), such a reformulation is only practical for a finite state dimension. However, in the case of softmax ( · ) , an infinite-dimensional kernel is needed, i.e., in the DSF, softmax attention requires n = ∞ . This insight can mathematically explain why the good performance observed for softmax attention can only be approximated by separable attention mechanisms, SSMs, or RNNs; but no other architecture is equivalent. The DSF predicts that softmax can be better approximated by growing n , which we show in the following theoretical result.

Lemma 2. For two dynamical systems (11) with hidden state dimensions N and ¯ N with N ≤ ¯ N , the dynamical system of state dimension ¯ N can always recover the dynamical system with state dimension N .

Proof. The result follows from the fact that the first N states and the output in (11) can be chosen to be independent of the additional states. The full proof is given in Appendix D.

32

64

128

256

State expansion

/u1D45B

0

.

0

0

.

5

1

.

0

L: 256, KV-pairs: 16

32

64

128

256

State expansion

/u1D45B

L: 512, KV-pairs: 64

Linear attention (16)

Softmax attention (2)

Therefore, it holds that the expressivity of a model is non-decreasing with increasing state expansion n (and state dimension N = nd ), if the rest of the architecture is held constant. As the softmax attention has an infinite hidden state dimension, i.e. n = ∞ (Lemma 1), we investigate empirically how its performance compares to linear attention (16), with increasing state dimension on the MQAR. Figure 1 shows that with larger n linear attention converges to the performance of softmax attention, which achieves perfect accuracy throughout.

271

272

273

274

275

276

277

278

279

280

281

282

283

284

Additionally, we train the three attention-based methods on the WikiText-103 dataset [Merity et al.,

2016] and report the training perplexity in Table xy.

Softmax att. (2)

Linear att. (16)

Softmax att. (2)

Linear att. (16)

Normalized att. (21)

Normalized att. (21)

SSD [Dao and Gu, 2024]

SSD [Dao and Gu, 2024]

S6 [Gu and Dao, 2023]

Softmax att. (2)

Linear att. (16)

Normalized att. (21)

SSD [Dao and Gu, 2024]

S6 [Gu and Dao, 2023]

Softmax att. (2)

Linear att. (16)

Normalized att. (21)

SSD [Dao and Gu, 2024]

S6 [Gu and Dao, 2023]

different Attention architectures (70M

00

75

50

25

00

S6 [Gu and Dao, 2023]

1

0

0

0

0

64

128

256

512

Model size

/u1D451

0

.

0

0

.

5

1

.

0

64

128

256

512

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

64

128

256

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

.

.

.

.

512

.

Model size

/u1D451

Table 1: Training perplexity score for

rev

Model size

A

/u1D451

= a · I nd as Λ i = diag ( σ 4.2 Generalized Linear Attention vs. S6.

( ¯

W

∆

u

i

)

a

)

I

n

.

(22)

Notice that when no state expansion is considered, i.e., n = 1 and I n = 1 , this expression almost coincides with the qLSTM state transition (19a), with the only difference that (I) it uses the reversed sigmoid function instead of a sigmoid for the forget gate, and (II) there is an additional learnt parameters a in the exponent. As shown in the recent xLSTM paper [Beck et al., 2024], state expanded LSTMs 3 can yield similar performance to S6. This aligns with Lemma 2, and further highlights the importance of state expansion for expressivity. In the case of qLSTM and RGBy comparing the DSF expressions for both generalized linear attention (15) and S6 (19), we notice that the S6 parameters b i = W B u i ∈ R n , c i = W C u i ∈ R n directly correspond to the keys and queries in attention, i.e. k i = b i and q i = c i . Moreover, the state expansion n in S6 is the same as the hidden dimension in attention. However, while this leads to an equivalent output matrix C i in the DSF parametrization for both architectures, there are remarkable differences between the two:

⊗

LRU, state expansion can be easily incorporated by changing the dimensions of the projections 3 The presented state expanded LSTM versions, cannot be directly translated into the DSF framework, since the gates not only depend on the inputs u i but also on past outputs y i -1 . However, the used state expansion is essentially n = d , hence leading to a DSF system of size d 2 . 8 · Number of parameters. The transition matrix Λ i has d parameters in S6 (19) and only 1 in attention. In attention (15), η ( q i , k ) is the only parameter in Λ i , and it is by definition a scalar. In S6, the parameters in Λ i are determined by ∆ i ∈ R d , which has d different parameters. However, it was shown in [8] that the number of parameters in Λ i can be reduced to 1 - similar to attention - without compromising performance. Note that multi-headed attention increases the number of parameters in Λ i from 1 to the number of heads s ; for more details see Appendix G.

Normalization strategy vs Discretization step. In attention (15), a normalization map η ( · ) is used. This map enters as a fraction in Λ i and also as a denominator in B i . Given that this map is a scalar, these two cancel out when computing the output, as one can see in the convolution representation (12). Hence, in attention ∏ i k = j Λ k B j evaluates to 1 η ( q i , k i ) . Notice that this does not occur in S6 (19), since the only shared parameter - discretization step ∆ i - does not cancel out in Λ i and B i given their different structure. This impacts the selectivity of the matrices on the input, since some input-dependent features are normalized differently in the two architectures.

While the number of parameters in the state transition Λ i does play a role in increasing performance (multi-headed attention typically performs better than single-headed attention [2]), the results in [8] suggest that this role is small. The larger influence thus lies in the recursive structure of Λ i and B i and/or the parameterization of normalization η ( · ) . To further investigate this and the role of normalization in attention, we compare S6 and softmax attention to SSD [8], linear attention [14], and normalized attention on the MQAR [24] and LRA [3] benchmarks and train the three attention-based methods on WikiText-103. Inspired by S6, we define normalized attention as the attention function

where W η ∈ R 1 × d is an additional learnt parameter. In Appendix H we discuss two alternatives to (22). The MQAR results are shown in Figure 2 and the average accuracy on the LRA and the training perplexity on WikiText-103 in Table 1. The MQAR results suggest that proper normalization, i.e., using normalization (22), improves the performance of linear attention schemes. This is further supported by the performance of S6 and SSD on the MQAR benchmark, since these two methods also employ input-dependent normalization. Additionally, normalized attention closes part of the gap to softmax attention on the WikiText-103 dataset (Table 1). However on LRA, SSM models (S6) still achieve considerably higher performance than attention-based models. While normalized

512

attention outperforms linear and softmax attention on the LRA, it performs significantly worse than S6. This result suggests that while the S6 inspired normalization helps to improve performance, the remaining performance gap is possibly explained by the recurrent normalization strategy employed by selective SSM models. Overall these results warrant further research into normalization strategies for attention-based models to explain the performance difference to SSMs. The complete experimental results on the MQAR and LRA benchmarks are detailed in Appendices L and M, respectively.

4.3 RNNs vs. S6

Comparing RNNs and S6, it is immediate to observe several similarities. In particular, as shown in Appendix I, the state transition matrix Λ i in S6 (19) can be rewritten (assuming A = a · I nd ) as

Notice that when no state expansion is considered, i.e., n = 1 and I n = 1 , this expression almost coincides with the qLSTM state transition (20a), with the only difference that (I) it uses the reversed sigmoid function instead of a sigmoid for the forget gate, and (II) there is an additional learnt parameter a in the exponent. Inspired by the subtle difference in the state transition, we compare the original qLSTM state transition (8) and the S6-inspired state transition 23 on the MQAR benchmark. The performance of both models is shown in Figure 3. We note that the reversed sigmoid state transition outperforms the original state transition on all three benchmark tasks, i.e., the performance of qLSTMs can be improved by insights from S6. Considering state expansion ( n > 1 ) for RNNs, the recent xLSTM paper [12] shows that state expanded LSTMs 4 can yield similar performance to S6. This aligns with Lemma 2 and further highlights the importance of state expansion for expressivity. In qLSTM and RG-LRU, state expansion can be easily incorporated by changing the dimensions of the projections W f , W i , W o , where the ⊙ operation in RG-LRU would be replaced by blockwise operations ⊗ . Finally, the most apparent difference between the two RNN variants - qLSTM and RG-LRU - and S6 is the parameter coupling in Λ i and B i . While qLSTM does not use a coupling, the couplings in RG-LRU and S6 are performed with different nonlinearities, which is discussed in more detail in [10, Appendix A].

64

128

256

512

Model size

/u1D451

0

.

80

0

.

85

0

.

90

0

.

95

1

.

00

L: 64, KV-pairs: 4

qLSTM

qLSTM w/ (23)

64

128

256

512

Model size

/u1D451

0

.

6

0

.

8

1

.

0

L: 128, KV-pairs: 8

64

128

256

512

Model size

/u1D451

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

L: 256, KV-pairs: 16

5 Related Work

State-space models emerged from the S4 architecture by Gu et al. [25], who developed a new theoretically principled approach to sequence modeling rooted in polynomial approximation theory [26]. The result is a transformer-like architecture [2], where attention is replaced by a linear recurrent neural network with special reparametrization. The design of S4 got later simplified in [4, 27], achieving state-of-the-art performance on the long-range arena (LRA) [3] with a highly efficient recurrent mechanism leveraging convolutional views [28], or parallel scans [5, 6].

The high efficiency of SSMs (linear processing) makes them particularly appealing when compared to softmax attention-based transformers, where both inference time and memory suffer quadratically from sequence length. The S4 architecture found first successful applications in reinforcement

learning [29], vision [30], audio [31] as well as online learning [32]. Initial attempts in language modeling [33, 34], supported by theoretical investigations [35, 36] hint at some necessary architectural improvements to unlock the NLP domain. Leveraging in-context learning arguments, a few works [3739] started incorporating input selectivity mechanisms [40] into SSMs. These efforts culminated in the Mamba architecture [7], which proposed a highly efficient and light (in terms of parameters) input selectivity strategy, with drastic improvements when comparing to earlier variants (H3 [33] and Hyena [41]) on text. This approach was also shown to be effective at byte level [42]. Beyond text, Mamba was recently applied to the vision domain [43, 44] - with outstanding results compared to ViTs [45] both in terms of performance and efficiency. Other applications include e.g. genetics [46], and point clouds [47]. Further, improvements on architectural aspects were proposed in [8, 11, 48].

The design of Mamba is also strongly supported by theoretical evidence showing precisely its superior expressive power compared to S4 [49]. This boost in computational power is due to Mamba's novel input selectivity mechanism resembling gating, which unlocks content-dependent reasoning [7, 40]. Interestingly, input selectivity brings SSMs closer to attention: in particular, Ali et al. [50] showed that the particular parametrization of Mamba can be linked to a non-normalized softmax operator. This finding is also supported by evidence from language theory - Mamba and Attention can solve a similar class of problems [51]. Beyond Ali et al. [50] the connection between linear attention and linear RNNs has been illustrated a few times in the literature [14, 23, 52, 53]. Connections between these architectures have also been carried out using tools from communication complexity in [54, 55]. Compared to these works and to Ali et al. [50], this paper offers a more careful comparison identifying some precise distinctions between SSMs, linear, and softmax attention - which play a nontrivial role in practice and can help bring to light interesting architectural improvements.

6 Conclusion

In this paper we presented the DSF, a framework based on dynamical-systems theory that allows analysis of different deep learning architectures by writing them as linear recurrences in state space. We first showed how to reformulate different architectures into the DSF, and then explored (theoretical and experimental) insights resulting from this analysis, thereby answering the questions posed in the introduction. For instance, we showed that with proper normalization the performance of linear attention can be significantly increased (see Fig. 2). We also show, that the DSF allows to integrate insights from one architecture to another as exemplified by Section 4.2. Additionally, the DSF naturally allows analysis of the eigenvalues of the state transition matrix A , which are linked to the exploding/vanishing gradient problem [6]. In the case of SSMs and RNNs, the eigenvalues are constrained to be stable by construction, for attention-based models this is not the case and stability needs to be obtained via normalization. The eigenvalues together with the state expansion also affect a model's long-term memory [6]. Both of these aspects can be analyzed via the DSF and should be further investigated in future work. While the training dynamics (especially convergence) can be studied empirically using experiments, the DSF also allows a theoretical analysis. As discussed in Example 2 of [56], a gradient-based optimization algorithm (e.g. SGD) can be interpreted and written as a dynamical system. Using this viewpoint together with the DSF allows interpretation of the training dynamics as two interacting dynamical systems. Therefore, the training dynamics can be theoretically analyzed using tools from control theory, e.g., via Lyapunov theory for convergence and stability of the training. However, we believe this question requires an in-depth investigation and additional empirical validation of the theoretical findings. We expect that the DSF can serve as a tool for principled analysis and design of deep learning architectures.

Limitations. In terms of limitations, it is important to highlight that, while the DSF parametrization allows for a principled comparison between frameworks, architectures written in the DSF do not necessarily enjoy an efficient implementation unless their specific structure can leverage some of the existing algorithms (parallel scan, etc.). In terms of experiments, the insights mentioned above are only verified on two synthetic tasks (MQAR/LRA) and a smaller language task (WikiText-103). To strengthen the insights, a more detailed analysis is needed on larger and more complex tasks.

Acknowledgments and Disclosure of Funding

Carmen Amo Alonso was partially supported by an ETH AI Center Postdoctoral Fellowship.

References

Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258 , 2021.

Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is All you Need. In Advances in Neural Information Processing Systems , volume 30. Curran Associates, Inc., 2017.

Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long Range Arena : A Benchmark for Efficient Transformers. In International Conference on Learning Representations (ICLR) , 2021.

Albert Gu, Ankit Gupta, Karan Goel, and Christopher Ré. On the Parameterization and Initialization of Diagonal State Space Models, 2022. URL https://arxiv.org/abs/2206. 11893 .

Jimmy T.H. Smith, Andrew Warrington, and Scott Linderman. Simplified State Space Layers for Sequence Modeling. In The Eleventh International Conference on Learning Representations , 2023.

Antonio Orvieto, Samuel L Smith, Albert Gu, Anushan Fernando, Caglar Gulcehre, Razvan Pascanu, and Soham De. Resurrecting Recurrent Neural Networks for Long Sequences. In Proceedings of the 40th International Conference on Machine Learning , volume 202, pages 26670-26698. PMLR, 23-29 Jul 2023.

Albert Gu and Tri Dao. Mamba: Linear-Time Sequence Modeling with Selective State Spaces, 2023. URL https://arxiv.org/abs/2312.00752 .

Tri Dao and Albert Gu. Transformers are SSMs: Generalized Models and Efficient Algorithms with Structured State Space Duality. In ICML 2024 , 2024.

Aleksandar Stani´ c, Dylan Ashley, Oleg Serikov, Louis Kirsch, Francesco Faccio, Jürgen Schmidhuber, Thomas Hofmann, and Imanol Schlag. The Languini Kitchen: Enabling Language Modelling Research at Different Scales of Compute, 2023.

Soham De, Samuel L. Smith, Anushan Fernando, Aleksandar Botev, George Cristian-Muraru, Albert Gu, Ruba Haroun, Leonard Berrada, Yutian Chen, Srivatsan Srinivasan, Guillaume Desjardins, Arnaud Doucet, David Budden, Yee Whye Teh, Razvan Pascanu, Nando De Freitas, and Caglar Gulcehre. Griffin: Mixing Gated Linear Recurrences with Local Attention for Efficient Language Models, 2024. URL https://arxiv.org/abs/2402.19427 .

Zhen Qin, Songlin Yang, Weixuan Sun, Xuyang Shen, Dong Li, Weigao Sun, and Yiran Zhong. HGRN2: Gated Linear RNNs with State Expansion. arXiv preprint arXiv:2404.07904 , 2024.

Maximilian Beck, Korbinian Pöppel, Markus Spanring, Andreas Auer, Oleksandra Prudnikova, Michael Kopp, Günter Klambauer, Johannes Brandstetter, and Sepp Hochreiter. xLSTM: Extended Long Short-Term Memory. arXiv preprint arXiv:2405.04517 , 2024.

Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971 , 2023.

Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are RNNs: fast autoregressive transformers with linear attention. In Proceedings of the 37th International Conference on Machine Learning , ICML'20. JMLR.org, 2020.

Carmen Amo Alonso, Jerome Sieber, and Melanie N Zeilinger. State space models as foundation models: A control theoretic overview. arXiv preprint arXiv:2403.16899 , 2024.

Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation , 9(8): 1735-1780, 1997.

Songlin Yang and Yu Zhang. Fla: A triton-based library for hardware-efficient implementations of linear attention mechanism, January 2024. URL https://github.com/sustcsonglin/ flash-linear-attention .

Guy E Blelloch. Prefix sums and their applications. 1990.

Volodymyr Kyrylov. Accelerated Scan, January 2024. URL https://github.com/proger/ accelerated-scan .

Tobias Christian Nauen, Sebastian Palacio, and Andreas Dengel. Taylorshift: Shifting the complexity of self-attention from squared to linear (and back) using taylor-softmax. arXiv preprint arXiv:2403.02920 , 2024.

Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: a unified understanding of transformer's attention via the lens of kernel. arXiv preprint arXiv:1908.11775 , 2019.

Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794 , 2020.

Matanel Oren, Michael Hassid, Yossi Adi, and Roy Schwartz. Transformers are multi-state rnns. arXiv preprint arXiv:2401.06104 , 2024.

Simran Arora, Sabri Eyuboglu, Aman Timalsina, Isys Johnson, Michael Poli, James Zou, Atri Rudra, and Christopher Ré. Zoology: Measuring and Improving Recall in Efficient Language Models. arXiv:2312.04927 , 2023.

Albert Gu, Karan Goel, and Christopher Ré. Efficiently Modeling Long Sequences with Structured State Spaces. In The International Conference on Learning Representations (ICLR) , 2022.

Albert Gu, Tri Dao, Stefano Ermon, Atri Rudra, and Christopher Ré. HiPPO: Recurrent Memory with Optimal Polynomial Projections. In Advances in Neural Information Processing Systems , volume 33, pages 1474-1487. Curran Associates, Inc., 2020.

Ankit Gupta, Albert Gu, and Jonathan Berant. Diagonal state spaces are as effective as structured state spaces. In Advances in Neural Information Processing Systems , volume 35, pages 22982-22994. Curran Associates, Inc., 2022.

Yuhong Li, Tianle Cai, Yi Zhang, Deming Chen, and Debadeepta Dey. What makes convolutional models great on long sequence modeling? arXiv preprint arXiv:2210.09298 , 2022.

Chris Lu, Yannick Schroecker, Albert Gu, Emilio Parisotto, Jakob Foerster, Satinder Singh, and Feryal Behbahani. Structured state space models for in-context reinforcement learning. Advances in Neural Information Processing Systems , 2023.

Eric Nguyen, Karan Goel, Albert Gu, Gordon W. Downs, Preey Shah, Tri Dao, Stephen A. Baccus, and Christopher Ré. S4nd: Modeling images and videos as multidimensional signals using state spaces. Advances in Neural Information Processing Systems , 2022.

Karan Goel, Albert Gu, Chris Donahue, and Christopher Ré. It's raw! audio generation with state-space models. arXiv preprint arXiv:2202.09729 , 2022.

Nicolas Zucchet, Robert Meier, Simon Schug, Asier Mujika, and João Sacramento. Online learning of long-range dependencies, 2023.

Daniel Y. Fu, Tri Dao, Khaled K. Saab, Armin W. Thomas, Atri Rudra, and Christopher Ré. Hungry Hungry Hippos: Towards Language Modeling with State Space Models, 2023. URL https://arxiv.org/abs/2212.14052 .

Junxiong Wang, Jing Nathan Yan, Albert Gu, and Alexander M Rush. Pretraining without attention. arXiv preprint arXiv:2212.10544 , 2022.

Antonio Orvieto, Soham De, Caglar Gulcehre, Razvan Pascanu, and Samuel L Smith. Universality of linear recurrences followed by non-linear projections: Finite-width guarantees and benefits of complex eigenvalues. International Conference on Machine Learning , 2024.

Shida Wang and Beichen Xue. State-space models with layer-wise nonlinearity are universal approximators with exponential decaying memory. Advances in Neural Information Processing Systems , 2023.

Bo Peng, Eric Alcaide, Quentin Anthony, Alon Albalak, Samuel Arcadinho, Huanqi Cao, Xin Cheng, Michael Chung, Matteo Grella, Kranthi Kiran GV, et al. Rwkv: Reinventing rnns for the transformer era. arXiv preprint arXiv:2305.13048 , 2023.

Yutao Sun, Li Dong, Shaohan Huang, Shuming Ma, Yuqing Xia, Jilong Xue, Jianyong Wang, and Furu Wei. Retentive network: A successor to transformer for large language models, 2023.

Tobias Katsch. Gateloop: Fully data-controlled linear recurrence for sequence modeling, 2023.

Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, et al. In-context learning and induction heads. arXiv preprint arXiv:2209.11895 , 2022.

Michael Poli, Stefano Massaroli, Eric Nguyen, Daniel Y Fu, Tri Dao, Stephen Baccus, Yoshua Bengio, Stefano Ermon, and Christopher Ré. Hyena hierarchy: Towards larger convolutional language models. In International Conference on Machine Learning , pages 28043-28078. PMLR, 2023.

Junxiong Wang, Tushaar Gangavarapu, Jing Nathan Yan, and Alexander M Rush. Mambabyte: Token-free selective state space model. arXiv preprint arXiv:2401.13660 , 2024.

Yue Liu, Yunjie Tian, Yuzhong Zhao, Hongtian Yu, Lingxi Xie, Yaowei Wang, Qixiang Ye, and Yunfan Liu. Vmamba: Visual state space model. arXiv preprint arXiv:2401.10166 , 2024.

Lianghui Zhu, Bencheng Liao, Qian Zhang, Xinlong Wang, Wenyu Liu, and Xinggang Wang. Vision mamba: Efficient visual representation learning with bidirectional state space model. 2024.

Hugo Touvron, Matthieu Cord, and Herve Jegou. Deit iii: Revenge of the vit. arXiv preprint arXiv:2204.07118 , 2022.

Yair Schiff, Chia-Hsiang Kao, Aaron Gokaslan, Tri Dao, Albert Gu, and Volodymyr Kuleshov. Caduceus: Bi-directional equivariant long-range dna sequence modeling. arXiv preprint arXiv:2403.03234 , 2024.

Jiuming Liu, Ruiji Yu, Yian Wang, Yu Zheng, Tianchen Deng, Weicai Ye, and Hesheng Wang. Point mamba: A novel point cloud backbone based on state space model with octree-based ordering strategy. arXiv preprint arXiv:2403.06467 , 2024.

Songlin Yang, Bailin Wang, Yikang Shen, Rameswar Panda, and Yoon Kim. Gated linear attention transformers with hardware-efficient training. arXiv preprint arXiv:2312.06635 , 2023.

Nicola Muca Cirone, Antonio Orvieto, Benjamin Walker, Cristopher Salvi, and Terry Lyons. Theoretical foundations of deep selective state-space models. arXiv preprint arXiv:2402.19047 , 2024.

Ameen Ali, Itamar Zimerman, and Lior Wolf. The hidden attention of mamba models. arXiv preprint arXiv:2403.01590 , 2024.

William Merrill, Jackson Petty, and Ashish Sabharwal. The illusion of state in state-space models. arXiv preprint arXiv:2404.08819 , 2024.

Imanol Schlag, Kazuki Irie, and Jürgen Schmidhuber. Linear transformers are secretly fast weight programmers. In International Conference on Machine Learning , pages 9355-9366. PMLR, 2021.

Nicolas Zucchet, Seijin Kobayashi, Yassir Akram, Johannes Von Oswald, Maxime Larcher, Angelika Steger, and Joao Sacramento. Gated recurrent neural networks discover attention. arXiv preprint arXiv:2309.01775 , 2023.

Simran Arora, Sabri Eyuboglu, Michael Zhang, Aman Timalsina, Silas Alberti, James Zou, Atri Rudra, and Christopher Re. Simple linear attention language models balance the recallthroughput tradeoff. In Forty-first International Conference on Machine Learning , 2024.

Satwik Bhattamishra, Michael Hahn, Phil Blunsom, and Varun Kanade. Separations in the representational capabilities of transformers and recurrent architectures. arXiv preprint arXiv:2406.09347 , 2024.

Florian Dörfler, Zhiyu He, Giuseppe Belgioioso, Saverio Bolognani, John Lygeros, and Michael Muehlebach. Towards a systems theory of algorithms. IEEE Control Systems Letters , 2024.

Amnon Shashua. Introduction to machine learning: Class notes 67577. arXiv preprint arXiv:0904.3664 , 2009.

Daniel López-Sánchez, Angélica González Arrieta, and Juan M Corchado. Data-independent random projections from the feature-space of the homogeneous polynomial kernel. Pattern Recognition , 82:130-146, 2018.

Ilya Loshchilov and Frank Hutter. Decoupled Weight Decay Regularization. In International Conference on Learning Representations , 2019. URL https://openreview.net/forum? id=Bkg6RiCqY7 .

Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language Models are Few-Shot Learners. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems , volume 33, pages 1877-1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/ 1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf .

Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle O'Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning , pages 2397-2430. PMLR, 2023.

A Visual Representation of the matrix dimensions

Figure 4 represents the dimensions of the recurrence expressed by the linear structured time-varying (LTV) dynamical system described in (11):

where h i ∈ R N is the hidden state, Λ i ∈ R N × N is the diagonal state transition matrix, and B i ∈ R N × d is the input matrix. We highlight the role of the state expansion, where u ∈ R d and h ∈ R N = R nd .

u

i

B Derivation of Separable Attention into DSF

We consider the layer where we define the sequence of keys as

We show that this layer can be equivalently written as the LTV system (11), i.e., with Λ i ∈ R nd × nd , B i ∈ R nd × d and C i ∈ R d × nd , if the function f ( · , · ) is separable as follows

where ϕ ( q i ) ∈ R n , ψ ( k j ) ∈ R n , and η ( q i , k i ) ∈ R can be considered to be a normalization function. If the unnormalized part of f ( · , · ) is a kernel function, it holds that ψ ( k j ) = ϕ ( k j ) for some, possibly infinite dimensional, feature vector ϕ .

We can compare the output formulations

and

resulting in

Simlarly, we have and

Plugging this back in, we observe

This generalizes the dynamical system matrices to

C Proof of Lemma 1: Derivation of Softmax Attention into DSF

The softmax function R n × m → (0 , 1] n × m is defined through row-wise normalization and is given by

The attention block is given as

where softmax i,j ( · ) refers to the element ( i, j ) of the corresponding matrix. Note that e q ⊤ i k j is a kernel, implying that softmax attention can be brought into the separable form (13). In order to provide the separable form of e q ⊤ i k j , we first consider the Taylor expansion of the kernel, which is given by

Each polynomial ( q ⊤ i k j ) p represents itself a homogeneous polynomial kernel and its decomposition into a feature vector of ( n + p -1 p ) monomials, as shown in [57], is given by

The feature representation of the exponential kernel is therefore

Note that to attain the monomials in (24) for a given p , one can also use ⊗ p j =1 x , as given in, e.g., [58], which is equivalent up to the constant coefficients, such that we can use √ 1 p ! ˜ ϕ p ( x ) = c p ⊗ p j =1 x , where c p is a matrix of the respective coefficients multiplying each monomial.

D Proof of Lemma 2

Given two dynamical systems of the form (11), we denote the system of hidden state dimension N with the state h N i and the matrices Λ N i , B N i , C N i and D N i and correspondingly, the system of hidden state dimension ¯ N using the state h ¯ N i and the matrices Λ ¯ N i , B ¯ N i , C ¯ N i and D ¯ N i . We show that the system of dimension ¯ N ≥ N can recover the system of dimension N by selecting the following system matrices:

It can be seen that the N first states of the system with dimension ¯ N propagate equivalently to the states of the system of dimension N . The additional states evolve independently given any matrices ¯ Λ , ˆ Λ , ¯ B of appropriate dimension and do not affect the output, such that both systems are equivalent. The two outputs are then equivalent by setting the corresponding entries of the C ¯ N i matrix to 0 .

E Derivation of S6 into DSF

While A in (4) is represented as a dense matrix of size n × d purely for computational reasons, mathematically A is a diagonal matrix of size nd × nd . This is evident from the fact that S6 parameterizes a different submatrix A d ∈ R n × n for each embedding dimension d , leading to

To compute Λ i in (11), the matrix A is multiplied with the selective discretization time ∆ i ∈ R d × d , which is computed as

where W u ∈ R p × d , W ∆ ∈ R d × p are weight matrices with p < d , and b ∆ ∈ R d is a bias. Note that we embed the computed discretization times in a diagonal d × d matrix to simplify the next reformulations. The product of ∆ i and A is performed along the embedding dimension axis, i.e.,

To arrive at the DSF formulation (19), it only remains to take the exponential function of (27) and state B i , C i as in (4) with the appropriate dimensions.

F Derivation of LSTMs into DSF

F.1 RG-LRU

In order to replace the abundant elementwise operations ⊙ in LSTMs with more suitable matrix-vector multiplications for SSMs, we rely on the following observation for a i ∈ R d , u i ∈ R d :

As with S6 in Appendix E, we reformulate some quantities for easier presentation, namely we embed the input-dependent vectors σ ( W R u i ) ∈ R d , σ ( W B u i ) ∈ R d , where σ ( · ) denotes the sigmoid function, in a diagonal matrix, i.e.,

The DSF representation (21) is then obtained in a straightforward manner.

F.2 qLSTM

We start by using the same reformulation of the gates as in RG-LRU above:

where f i is commonly called the forget gate, i i and o i are called the input and output gates, respectively, and W f , W i , W o ∈ R d × d . By removing the tanh activation function, we effectively eliminated the input activation gate, which now serves as a standard input to the recurrence (11), i.e., we reformulated the standard qLSTM (8) to the LTV

G Dynamical System Derivation of Multi-headed Separable Attention

As in Appendix B, we assume a separable attention function, i.e.,

Additionally, we consider the multi-headed setting introduced in [2, Section 3.2.2], i.e., s different attention operations are performed in parallel. Due to the right multiplication of the input (instead of left multiplication as in the original paper), the output of the different heads is stacked row-wise instead of column-wise. Additionally, we assume there is no output mapping after the attention

operation. This yields the simplified multi-headed layer

where · s denotes the head index. As is standard for multi-headed attention, we reduce the dimensions of the queries, keys, and values by the number of heads, i.e., q i ∈ R m/s , k j ∈ R m/s , and v j ∈ R d/s . Since the s different values [ v j ] s are stacked, this is equivalent to the single headed version, i.e.,

Above observation is also valid for the queries and keys, i.e., we can e.g. write [ ϕ ( q i )] s using an indicator function I s ( · ) on the single headed query q i , i.e.,

This shows the intuition behind multi-headed attention, which essentially compares parts of the single-headed queries and keys in parallel. Therefore, we can use Appendix B to write multi-headed separable attention in the DSF as

Multiple heads therefore extend the single scalar in Λ i (in the single-headed case) to s different scalars, however these only act upon a part of the queries q i and keys k j due to the indicator function.

H Alternative Normalization Schemes

For all experiments in Section 4.2, we use the normalization scheme in (22). The exponential normalization function η ( u i ) is inspired by softmax attention and S6, which both use exponential functions for normalization (see (18) and (19)). However, other normalization functions can also be considered e.g.

where σ ( · ) denotes the sigmoid function. Table 2 shows an experimental comparison of the exponential normalization function (22) and the two alternatives (29), (30) on the LRA Image and MQAR ( L = 512 , KV-pairs = 64) tasks. All three normalization schemes perform similarly on both tasks, however the exponential normalization (22) yields the best performance, which is the reason we choose it for normalized attention throughout the paper.

I S6 uses reversed sigmoid in state transition matrix

In the following, we show that the state transition matrix Λ i in S6 is essentially a reversed sigmoid of the projected input. To show this, we assume for simplicity that A in Λ i = e -(∆ i ⊗ I n ) ⊙ A is a scalar, i.e., A = a · I nd . This assumption simplifies Λ i to where each e -a ∆ j i · I n itself is a diagonal matrix with n -times e -a ∆ j i on its diagonal. In order to analyze this expression, we simplify the computation of ∆ i by fusing the two projection matrices with out loss of generality, i.e.,

where ¯ W j, : ∆ denotes the j th row of ¯ W ∆ . Above reformulation is valid since the softplus ( · ) function is applied elementwise and we note that ∆ j i = softplus ( ¯ W j, : ∆ u i ) in (31). Using the definition of the softplus ( · ) function, we can show that

where σ rev ( · ) is the reversed sigmoid, i.e., σ rev ( x ) = 1 1+ e x . Since the reversed sigmoid is again applied elementwise to a vector or a matrix, we can write the S6 state transition matrix as

where the power a is applied elementwise. The assumption A = a · I nd we made in the beginning, can be relaxed to any diagonal matrix, however the resulting Λ i will have a more complex representation.

J Experimental Details

The experimental results provided in Section 4 are performed on the multi-query associative recall (MQAR) benchmark [24], the long range arena (LRA) benchmark [3], and the WikiText-103 dataset. To obtain the MQAR and LRA results, we modified the Zoology 5 and LRA 6 code bases and added the normalized attention model and the selective SSM models, respectively. The code for both benchmarks is provided on GitHub for MQAR 7 and for LRA 8 separately.

J.1 MQARexperiments

Training Details We evaluate the following three architecture classes:

Attention: softmax attention [2], linear attention [14], normalized attention (22). For all three attention functions, we use a standard GPT-2 style multi-headed Transformer architecture, where we replace the attention block with the respective attention function. The three attention functions are defined in Section 2.1. For all MQAR runs we use a single attention head.

State space model: S6 [7], SSD [8]. For both SSM variants, we use a standard GPT-2 style single-headed Transformer architecture, where we replace the attention block with the respective SSM variant. This means for S6 and SSD, we do not implement the preconvolution on the input or the SiLU activations; but just the S6 and SSD blocks. We do this to ensure a fair comparison of the backbones (sequence mixers) irrespective of the higher-level architecture. The S6 and SSD blocks are defined in Section 2.2 and we use the provided code base 9 to implement it.

RNN: qLSTM [9], modified qLSTM. We embed both qLSTM variants in a standard GPT-2 style single-headed Transformer architecture, where we replace the attention block with the qLSTM. We do this to ensure a fair comparison of the backbones (sequence mixers) irrespective of the higher-level architecture. The standard qLSTM is defined in Section 2.3 and the modified qLSTM is the same as the standard qLSTM but with modified state transition (23), i.e., a modified forget gate.

For all MQAR runs, we use the following training protocol:

Optimizer and schedule: Weight decay of 0.1, linear warmup with duration of 10%, AdamW optimizer [59]. For each run, we sweep the learning rates in np.logspace ( -4 , -2 , 4) and train for 64 epochs. This is the same setup as in [24].

Training duration: We use a global batch size of 512 , which we reduce to 256 if sequence length L ≥ 128 , to 128 if sequence length L ≥ 256 , and to 64 if sequence length L ≥ 512 . We do this to keep the memory consumption approximately constant over different tasks.

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 , state expansion n , sequence length L , and number of KV pairs are swept according to the experiment (see Section 4). This is the same setup as in [24].

Position information: Positional embeddings [60] are used for the attention and RNN architecture classes, but not for the SSM architecture classes. This is the same setup as in [24].

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 [24].

Performed Experiments We run the three attention models and the two state space models on four different MQAR tasks, i.e., { L = 64 , KV-pairs = 4 } , { L = 128 , KV-pairs = 8 } , { L = 256 , KV-pairs = 16 } , and { L = 512 , KV-pairs = 64 } , which progressively increase in complexity. For each model and task, we sweep both the model size d = [64 , 128 , 256 , 512] and the state expansion n = [32 , 64 , 128 , 256] , 10 resulting in a total of 320 experiments. We only report the results of the best performing learning rate; the full results of all experiments are stated in Appendix L. We run the two qLSTM variants on three different MQAR tasks, i.e., { L = 64 , KV-pairs = 4 } , { L = 128 , KV-pairs = 8 } , and { L = 256 , KV-pairs = 16 } . For both variants we sweep the model size d = [64 , 128 , 256 , 512] , resulting in a total of 24 experiments. We only report the results of the best performing learning rate; the full results are reported in Figure 3.

J.2 LRA experiments

Training Details We evaluate the following two architecture classes:

Attention: softmax attention [2], linear attention [14], normalized attention (22). For all three attention functions, we use a standard GPT-2 style multi-headed Transformer architecture, where we replace the attention block with the respective attention function. The three attention functions are defined in Section 2.1. To ensure a fair comparison, we keep all hyperparameters of the three attention models constant except the attention function.

State space model: S6 [7]. We use a standard GPT-2 style single-headed Transformer architecture, where we replace the attention block with the S6 block. This means, we do not implement the pre-convolution on the input or the SiLU activations; but just the S6 block. We do this to ensure a fair comparison of the backbones (sequence mixers) irrespective of the higher-level architecture. The S6 block is defined in Section 2.2 and we use the provided code base 11 to implement it.

For all LRA runs, we use the following training protocol:

Optimizer and schedule: Linear warmup with duration of 10% and AdamW optimizer [59].

Position information: Positional embeddings [60] are used for the attention architecture classes, but not for the SSM architecture classes.

Data: Each model is trained on the standard datasets provided with the LRA benchmark.

The exact hyperparameters for each LRA task and each model are reported in the publicly available code base. 12 Note that we do not optimize the hyperparameters, i.e., the reported accuracies might be lower than in the original LRA paper [3].

Performed Experiments We run the three attention models and the S6 models on the LRA tasks ListOps , Text , Retrieval , Image , and Pathfinder-32 , which are summarized below; for the full details we refer to [3].

List Operations ( ListOps ): This task evaluates a model's ability to capture hierarchical dependencies over long contexts. The goal is to predict the result of a mathematical operation consisting of nested mean , median , max , and min operations, 13 The task is a ten-way classification task with maximal input lengths of 2k.

Text Classification ( Text ): This task evaluates a model's ability to capture the tone of long tokenized texts. The dataset consists of IMDb movie reviews, which need to be classified as negative or positive in tone. The task is a binary classification task with maximal input lengths of 4k.

Document Retrieval ( Retrieval ): This task evaluates a model's ability to compress long sequences into representations that are suitable for similarity matching. The dataset consists of tokenized papers published by the American Academy of Neurology (AAN), which need to be classified in having a citation link or not. The task is a binary classification task with maximal input lengths of 8k.

Image Classification ( Image ): This task evaluates a model's ability to learn 2D spatial relations from a 1D vector. The dataset consists of vectorized images, which depict one of ten possible classes, e.g. a horse or a car. The task is a ten-way classification task with maximal input lengths of 1k.

Long-Range Spacial Dependency ( Pathfinder-32 ): This task evaluates a model's ability to learn spacial dependencies in a vectorized image. The dataset consists of images, which depict two circles and multiple dashed paths. The goal is to evaluate whether the two circles are connected by any of the present paths or not. The task is therefore a binary classification task with maximal input lengths of 2k.

J.3 WikiText-103 experiments

Training Details We use the 70M parameter Pythia architecture (Pythia70M) [61]. 14 For softmax attention we use the standard Pythia attention block, while for linear attention [14] and normalized attention (22) we replace the attention block in the Pythia architecture with the respective attention functions defined in Sections 2.1 and 4.2.

For all training runs on WikiText-103, we use the following protocol:

Optimizer and schedule: Weight decay of 0.1, linear warmup with duration of 10%, AdamW optimizer [59] with β = (0 . 9 , 0 . 95) , and gradient clipping = 1 . For each run, we sweep the learning rates in [0 . 0003 , 0 . 001 , 0 . 003 , 0 . 01] and train for 50 epochs.

Training duration: We use a batch size of 128 and train for 50 epochs.

Width and depth: We use a context length of 1024 and the standard Pythia70M configuration, i.e., model size of 512 , 8 heads, and 6 layers.

Position information: Positional embeddings [60] are used as in standard Pythia.

Performed Experiments We train the three attention functions on WikiText-103 and sweep the learning rates [0 . 0003 , 0 . 001 , 0 . 003 , 0 . 01] . For all three attention functions learning rate 0 . 003 performed best and the corresponding results are reported in Table 1.

K Computational Resources

All experiments (MQAR, LRA, and WikiText-103) were run on a cluster with 11 nodes with the following GPU and CPU specifications:

The MQAR and LRA training and test runs were parallelized and assigned to the best available GPU node, while the parallelized training on WikiText-103 was exclusively run on the NVIDIA A100 (80GB) node.

For each learning rate sweep of the MQAR runs described in Appendix J we estimate the average runtime to be 1h, 15 leading to a total unparallelized runtime of 54 days for all MQAR tasks. There where approximately 20 runs for debugging and training purposes, which were terminated after a few minutes, thus we did not include them in the time estimate.

For each task of the LRA benchmark, we estimate the average runtime to be 2h for Image , 5h for Text , 6h for ListOps , 30h for Retrieval , and 45h for Pathfinder , leading to a total unparallelized runtime of 31 days for all LRA tasks. Note that to obtain better hyperparameters, they would need to be tuned for each task, which would significantly increase the total runtime. There where approximately 30 runs for debugging and training purposes, which were terminated after a few minutes, thus we did not include them in the time estimate.

For the training on WikiText-103, each learning rate sweep took approximately 14h, leading to a total parallelized runtime of 42h for all three attention models. We estimate a total of 1h of runtime for tuning runs, bringing the total runtime to 43h.

L Extended Results on MQAR

Figures 5 and 6 show the MQAR results of Figures 2 and 3 but for multiple runs over 10 different seeds.

64

128

256

512

0

.

0

0

.

2

0

.

4

0

.

6

0

.

8

1

.

0

Softmax att. (2)

Linear att. (16)

Normalized att. (21)

SSD [Dao and Gu, 2024]

S6 [Gu and Dao, 2023]

Model size

/u1D451

64

128

256

512

Model size

/u1D451

0

.

80

0

.

85

0

.

90

0

.

95

1

.

00

L: 64, KV-pairs: 4

qLSTM

qLSTM w/ (22)

64

128

256

512

Model size

/u1D451

0

.

6

0

.

8

1

.

0

L: 128, KV-pairs: 8

64

128

256

512

Model size

/u1D451

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

L: 256, KV-pairs: 16

In Figure 7 we report the complete results of all MQAR experiments detailed in Appendix J. A selected subset of these are already presented in Figure 1 and Figure 2 in the main text.

The effect of state expansion can not only be observed for linear attention (Figure 1) but also for normalized attention (22), S6, and SSD for the task { L = 512 , KV-pairs = 64 } . Contrary to this, for small model sizes d and larger tasks (e.g. normalized attention, task { L = 512 , KV-pairs = 64 } , d = 64 ) the performance decreases with increased state expansion n or shows erratic behaviour. Since this behavior only occurs for small d , we hypothesis that this effect is due to the model being to small to accurately learn the task.

64

128

256

512

d

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

L: 64, KV-pairs: 4

Softmax att.

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

L: 128, KV-pairs: 8

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

L: 256, KV-pairs: 16

1.0

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

L: 512, KV-pairs: 64

64

128

256

512

d

96.5

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

Linear att.

96.8

98.9

>

99

>

99

77.6

>

99

>

99

>

99

15.6

>

99

>

99

>

99

>

99

>

99

>

99

>

99

92.7

95.4

86.0

80.5

>

99

95.9

>

99

>

99

28.0

>

99

>

99

>

99

45.7

88.9

>

99

>

99

9.7

0.9

21.8

0.9

1.6

1.6

1.6

1.6

4.2

2.1

3.7

96.2

2.1

89.4

96.6

96.4

64

128

256

512

d

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

Normalized att.

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

93.2

97.1

91.4

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

37.4

17.5

19.1

1.6

55.9

85.9

90.6

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

64

128

256

512

d

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

SSD

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

95.1

92.6

92.2

>

99

88.7

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

0.5

0.0

0.0

39.9

98.3

97.3

98.9

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

32

64

128

256

n

64

128

256

512

d

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

S6

32

64

128

256

n

94.0

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

32

64

128

256

n

90.7

97.2

88.8

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

>

99

32

64

128

256

n

0.7

0.4

0.8

2.2

68.7

81.5

87.8

>

99

62.3

81.0

>

99

>

99

95.1

>

99

>

99

>

99

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

0

.

00

0

.

25

0

.

50

0

.

75

1

.

00

While Figure 2 shows that normalized attention outperforms standard linear attention [14], Figure 7 shows an even more significant performance gap. Additionally, we note that SSD outperforms S6, which was already hinted at in [8], and that normalized attention performs on par with S6. Together these results hint at the importance of normalization both for attention and SSMs. The comparison of S6 and SSD shows that reducing the number of parameters in the state transition Λ i from d to a scalar does not hurt performance, which is further supported by the findings in [8]. These experiments

also suggest that the recursive structure in Λ i and B i (present in S6 and SSD but not in normalized attention or linear attention) is less important than proper normalization of the attention scores. Additionally, the results on WikiText-103 (Table 1) show that better normalization can close 25% of the perplexity gap between linear attention and softmax attention. Together, these results warrant more investigations into new and better normalization techniques for attention-based models.

Finally, we remark that softmax attention performs perfectly accross all sweeps except { L = 512 , KV-pairs = 64 } , d = 64 , and n = 32 , which is most likely due to a too small model or too small learning rate.

M Extended Results on LRA

In Table 3 we report the complete results of all LRA experiments detailed in Appendix J. The average performance over all tasks is reported in Table 1 in the main text.

While normalized attention (22) performs slightly better on LRA than the other two attention-based models, there is a significant performance gap to the S6 model (a selective SSM variant). The reason for this gap potentially lies in the recurrent normalization employed in selective SSMs (see Section 4.2). Interestingly, S6 only achieves significantly higher accuracy on the tasks Text and Image , showing that selective SSM models are particularly suited for long-range classification of text and image modalities.

NeurIPS Paper Checklist

1. Claims

Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?

Answer: [Yes]

Justification: Our theoretical analysis and experimental results substantiate the claims made in the abstract and introduction.

Guidelines:

The answer NA means that the abstract and introduction do not include the claims made in the paper.

The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.

The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.

It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.

2. Limitations

Question: Does the paper discuss the limitations of the work performed by the authors?

Answer: [Yes]

Justification: Limitations of the proposed framework as well as the computational experiments are discussed in Section 6.

Guidelines:

The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.

The authors are encouraged to create a separate "Limitations" section in their paper.

The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.

The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.

The authors should reflect on the factors that influence the performance of the approach. For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.

The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.

If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.

While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.

3. Theory Assumptions and Proofs

Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?

Answer: [Yes]

Justification: Lemmas 1 and 2 are properly stated, and their respective proofs are provided in Appendix C and Appendix D.

Guidelines:

The answer NA means that the paper does not include theoretical results.

All the theorems, formulas, and proofs in the paper should be numbered and crossreferenced.

All assumptions should be clearly stated or referenced in the statement of any theorems.

The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch to provide intuition.

Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.

Theorems and Lemmas that the proof relies upon should be properly referenced.

4. Experimental Result Reproducibility

Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?

Answer: [Yes]

Justification: We state the complete experimental details in Appendix J and provide a link to the full code base.

Guidelines:

The answer NA means that the paper does not include experiments.

If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.

If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.

Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.

While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example

(a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm.

(c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).

(b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully.

(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.

5. Open access to data and code

Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?

Answer: [Yes]

Justification: We provide a link to the full code base on GitHub.

Guidelines:

The answer NA means that paper does not include experiments requiring code.

Please see the NeurIPS code and data submission guidelines ( https://nips.cc/ public/guides/CodeSubmissionPolicy ) for more details.

While we encourage the release of code and data, we understand that this might not be possible, so 'No' is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).

The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines ( https: //nips.cc/public/guides/CodeSubmissionPolicy ) for more details.

The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.

The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.

At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).

Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.

6. Experimental Setting/Details

Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?

Answer: [Yes]

Justification: All training details are provided in Appendix J.

Guidelines:

The answer NA means that the paper does not include experiments.

The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them.

The full details can be provided either with the code, in appendix, or as supplemental material.

7. Experiment Statistical Significance

Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?

Answer: [Yes]

Justification: Some of the experimental results presented in this paper are accompanied by error bars. Most experiments were performed for fixed seeds and only the best results of ablated hyper-parameters are reported. For Figures 2 and 3 we provide error bars over 10 different seeds in Appendix L. However, obtaining statistical significance data for all performed experiments would have drastically increased the amount of compute and runtime needed, which were both not feasible for us.

Guidelines:

The answer NA means that the paper does not include experiments.

The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).

The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)

The assumptions made should be given (e.g., Normally distributed errors).

It should be clear whether the error bar is the standard deviation or the standard error of the mean.

It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified.

For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).

If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.

8. Experiments Compute Resources

Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?

Answer: [Yes]

Justification: The used computational resources are stated in Appendix K.

Guidelines:

The answer NA means that the paper does not include experiments.

The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.

The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.

The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper).

9. Code Of Ethics

Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines ?

Answer: [Yes] .

Justification: Ethical considerations in accordance with NeurIPS Code of Ethics have been respected throughout the research process. Potential limitations are discussed in Section 6.

Guidelines:

The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.

If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.

The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).

10. Broader Impacts

Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?

Answer: [NA]

Justification: The paper has not direct societal impacts. If the presented theoretical framework is used to design a new foundation model, there might be societal impacts of the model derived from this work. However, at this stage the societal impact is not assessable.

Guidelines:

The answer NA means that there is no societal impact of the work performed.

If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.

Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.

The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.

The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.

If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).

11. Safeguards

Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?

Answer: [NA]

Justification: The paper does not release a new dataset or high risk model.

Guidelines:

The answer NA means that the paper poses no such risks.

Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.

Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.

We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.

12. Licenses for existing assets

Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?

Answer: [Yes]

Justification: The used code is properly cited in Appendix J and the licences are appropriately given in the code base accompanying this paper.

Guidelines:

The answer NA means that the paper does not use existing assets.

The authors should cite the original paper that produced the code package or dataset.

The authors should state which version of the asset is used and, if possible, include a URL.

The name of the license (e.g., CC-BY 4.0) should be included for each asset.

For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.

If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.

For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.

If this information is not available online, the authors are encouraged to reach out to the asset's creators.

13. New Assets

Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?

Answer: [NA]

Justification: The paper does not introduce any new assets. The paper analyzes existing models and improvements to those, which are guided by the introduced theoretical framework.

Guidelines:

The answer NA means that the paper does not release new assets.

Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.

The paper should discuss whether and how consent was obtained from people whose asset is used.

At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.

14. Crowdsourcing and Research with Human Subjects

Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?

Answer: [NA] .

Justification: No human subjects or crowdsourcing were used to conduct this research.

Guidelines:

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper.

According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.

15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects

Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?

Answer: Answer: [NA] .

Justification: No human subjects or crowdsourcing were used to conduct this research.

Guidelines:

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.

We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution.

For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper concerns using the proposed \"Dynamical Systems Framework\" (DSF) to better understand the differences between linear SSMs, RNNs, linear attention and Softmax attention. The DSF shows a way to write each of these models as a linear time-varying recurrence. The paper aims to use this to answer questions about the differences between the three types of models, the role of state expansion, and how ideas from SSMs can be used to improve RNNs. Empirical experiments on the multi-query associative recall (MQAR) task and Wikitext are used to support the findings.\n\nSTRENGTHS:\n- The goal of better understanding the differences between the different models, and in particular trying to understand the gap between Softmax attention and its more efficient alternatives is important\n- The paper is well-written and clear. I particularly liked Figure 4 in Appendix A which made the dimensions being referred to throughout the paper clear. \n- The different formulations and results in the paper appear to be technically correct\n- Insights are used from SSMs to propose a different normalization scheme for linear attention which appears to improve performance on the tasks considered\n- The empirical results on the MQAR and Wikitext experiments support the claims\n\nWEAKNESSES:\n- The proposed DSF is nice in that it allows comparing each of the different types of models, but it's originality is weakened by the fact that most of the main parts of the framework have been discussed before in prior work\n  - The connections between linear attention and linear RNNs/SSMs are clear and have been discussed in prior works as mentioned in related work. \n  - In addition, the infinite dimensional representation of softmax attention as discussed in Section 3.2.1 is also discussed in Katharopoulos et al. 2020 among others\n  - Softmax attention has also been formulated as a dynamical system in https://arxiv.org/abs/2401.06104 which should be cited\n- The findings that are suggested as a result of the framework also do not seem to be new or particularly surprising\n  - The fact that larger state sizes lead to increased expressivity is not surprising and has been explored before, e.g. in https://arxiv.org/abs/2312.04927, https://arxiv.org/abs/2312.00752\n  - The proposed improvement to RNNs is to change the parameterization of a linear RNN (the quasi LSTM) by replacing its transition parameterization with that of S6. But this seems to just make it more like the already existing linear RNN, RG-LRU (with a slight different in parameterization from S6). This seems to be a much weaker finding than the claimed \"What do selective SSMs teach us about improving RNN architectures\" from line 53 of the Intro.\n   - As a counter to this point I am making, the proposed improvement to the normalization of linear attention appears to be novel and appears to improve performance on the tasks considered.\n- The focus and claims around expressivity and performance in the paper appear to be very language focused. \n  - This is obviously of interest, but perhaps narrows the ability for the DSF to provide new and interesting insights as I mention in the point above.\n  -  In addition, only 2 small tasks are considered to support the claims.  This limits the ability to understand if the claims hold in more general settings.\n  - The authors state in the limitations that to strengthen the insights, a larger and more complex language task is needed. This could be great, however I would suggest perhaps also considering more diverse data modalities could also strengthen the insights of the proposed framework.\n\nQUESTIONS:\n- Perhaps considering data modalities and examples other than language could help to highlight insights that can be drawn from the DSF? E.g. perhaps modalities that more naturally arise from dynamical systems could help to further highlight differences between softmax attention and its more efficient alternatives? Or could help highlight differences between different linear attention/SSM/RNN variants?\n\n- Are the differences between softmax attention and the other methods on the MQAR task, e.g. in Figure 5, simply due to the difference in state size? One can think of the state size of softmax attention as the size of its KV cache required for the sequence length of the task. If you make the recurrent alternatives have a state size that matches the softmax attention KV cache size for the task sequence length, do they then perform as well? Or are there other things happening in Softmax Attention as well? Perhaps exploring this through the lens of the DSF framework could also provide insights?\n\nMinor: \n- It is stated the Matrix in Equation 12 is $L\\times L$, but isn't this only the case when $B$ and $C$ are $N \\times 1$ and $1 \\times N$? The presentation in the paragraph before suggests these are general matrices.\n- Line 203 says \"The DSF makes apparent how a necessary condition for separability is \nfor the map ζ(·) to be expressed by a finite-dimensional kernel, \". But in line 154 it says \"Softmax attention also satisfies the assumption of separability\".  I realize the point that is trying to be made regarding \"practical separability\", but nonetheless, it appears to be a contradiction as currently written.\n\nLIMITATIONS:\nAdequately discussed.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-06-23"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper shows that many sequence models (including attention, SSMs, and recurrent models) can be viewed as linear time-varying dynamical systems. This is helpful for answering some questions about the differences and similarities between these architectures.\n\nSTRENGTHS:\n**Importance of unifying framework**. The present state of sequence model research is quite muddy, with tons of new architectures being proposed. On the surface these architectures often look quite complicated and differentiated, when in reality they are closely related to one another.  Because of this, I think unifying frameworks are useful for helping push progress in the space. \n\n**The role of normalization in S6 and Linear Attention.** The paper includes a very interesting discussion of the parameterization of the normalization in S6 and Linear attention.\n\nWEAKNESSES:\n**Presentation and clarity.** The introduction and abstract do not provide any details on how the Dynamical Systems Framework works and assumes a reader is familiar with dynamical systems. To improve the presentation and accessibility, I would recommend including a high-level discussion of what the DSF is and what challenges it addresses. \n\n**Theoretical Novelty.** In the first paragraph of the introduction the authors state, “Although these models show great promise in boosting efficiency, current comparisons with attention are merely empirical.” This isn’t correct: there have been many theoretical studies comparing these new recurrent architectures with Softmax attention. To name a few:\n\n- [Arora *et al.](https://arxiv.org/abs/2402.18668)* include a theoretical analysis grounded in results from communication complexity that highlights differences in models ability to perform associative recall.\n- Using tools from circuit complexity, [Merill *et al.*](https://arxiv.org/pdf/2404.08819) show that Attention and SSMs are in the same complexity class ($\\text{TC}^0$).\n- Using tools from communication complexity, [Bhattamishra *et al.*](https://arxiv.org/pdf/2406.09347)  provide separation results between attention and recurrent architectures on numerous tasks.\n\n**Empirical Novelty.** The main empirical result in this paper is that increased state size (across architectures) leads to improved performance on MQAR and that separable attention matches Softmax attention with sufficiently large recurrent size. This result has already been shown theoretically and empirically in [Arora *et al.*](https://arxiv.org/pdf/2402.18668) (ICML ‘24) - see Figure 2, Theorem 3.1, and Section 3. The work under review builds upon Arora *et al.* by including a few additional architectures to the analysis. But this prior work should be mentioned in the related work and/or the introduction given the significant overlap in results . \n\n**Claims around Lemma 2.** Some of the language around Lemma 2 is a bit incautious. The authors state that because of Lemma 2, “the larger the state expansion n, the more expressivity the architecture has”. In other words, they are claiming that increasing state expansion strictly increases expressivity. To support this claim, the theorem would need to additionally show that a dynamical system of state dimension $N$ ***cannot*** recover all dynamical systems with state dimension $\\hat{N}$.  Additionally, I think its important to add the qualification that this holds assuming everything else about the architecture is held constant. It’s of course possible for an architecture with smaller state size to admit solutions that a larger state size model cannot represent if the parameterizations are different. \n\n**Minor typos and clarifications.**\n\n- Line 32: “framework that allows to evaluate” → “allows us to evaluate”\n- Line 61: “We use $\\sigma(\\cdot)$ to denote is the sigmoid function.\n- In the list of questions answered by the paper (Line 40), I would include hyperlinks to the relevant sections.\n\nQUESTIONS:\nIt would help to add additional exposition on the results in Fig. 2. What are the takeaways? It looks like exponentiating improves performance, but this isn’t stated explicitly.\n\nLIMITATIONS:\nYes the authors discuss limitations.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-08"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper provides a dynamical system based framework for principled comparisons between various existing recurrent architectures (linear attention, SSMs, etc.). There are focuses on the formulation and the role of the hidden state dimension. Some experimental results on the multi-query associative recall (MQAR) benchmark and the WikiText-103 dataset are provided to demonstrate the differences between the considered models.\n\nSTRENGTHS:\n- The paper is overall well written and organized\n- Systematic comparisons between the formulations of various sequence models are provided, which are neat and useful for researchers without much background in the area\n\nWEAKNESSES:\n- The two proposed experiments (the MQAR benchmark and the WikiText-103 dataset) seem random and limited. There are no experiments on the more standard benchmark tasks such as the LRA task (focusing on smaller tasks such as the sequential CIFAR task would be valuable) and time series forecasting tasks \n- The theoretical insights are actually quite limited. There are unaddressed natural questions such as:\n\n     (1) one might wonder about finite-dimensional approximation of the softmax attention, \n\n     (2) how Lemma 1 could be related to the kernel method and RKHS \n\n- There are also other aspects that are left out for the comparative studies: e.g., how do the training dynamics differ between the various models (which architecture will converge faster), as well as the stability of the models (how prone are they to the infamous vanishing/exploding gradient problem). Also, can we quantify and compare the long range dependency learning capability of these models? \n- No practical guidance in terms of which architecture is suitable for what kind of task is provided. After all, this should be the main goal of the comparisons\n\nQUESTIONS:\nSee above\n\nLIMITATIONS:\nYes", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2024-07-10"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper introduces the Dynamical Systems Framework (DSF), a theoretical approach for analyzing and comparing various foundation models in AI. The DSF reformulates attention-based models, State Space Models (SSMs), and Recurrent Neural Networks (RNNs) into a common dynamical systems representation. This allows for principled comparisons and generates new insights into their similarities and differences. The authors leverage the DSF to compare linear attention and selective SSMs, provide conditions for approximating softmax attention, analyze state expansion in RNNs and SSMs, investigate differences between linear attention and S6 (Mamba) models, and apply SSM insights to RNN architectures. The paper combines theoretical results with empirical validations on the MQAR benchmark and WikiText-103 dataset.\n\nSTRENGTHS:\n- Novel unified perspective on different foundation model architectures\n- Enables new theoretical insights and comparisons between previously isolated model classes\n- Sound theoretical analysis with supporting lemmas and proofs\n- Empirical validation on MQAR and WikiText-103 provides practical grounding\n- Clear potential for guiding future development of efficient, scalable models\n- Innovative application of SSM insights to improve RNN architectures\n\nWEAKNESSES:\n- Limited empirical evaluation, focusing primarily on MQAR and a single language modeling task\n- Lack of statistical significance reporting for experimental results\n- Some theoretical results (e.g., Lemma 2) are relatively straightforward\n- Dense theoretical sections may be challenging for broader audience\n- Immediate practical impact on model performance is somewhat limited\n- Doesn't fully explore implications for training or inference efficiency\n\nQUESTIONS:\n1. How well might the DSF insights scale to much larger models (billions of parameters) used in state-of-the-art applications?\n2. Are there theoretical limits to the convergence of linear attention to softmax attention performance with increased state expansion?\n3. Have you explored alternative normalization schemes that might bridge the gap between S6 and linear attention while maintaining computational efficiency?\n4. How does the S6-inspired state transition in qLSTM affect its long-term memory capabilities?\n5. Can the theoretical insights from DSF reformulations be leveraged to develop new, efficient implementations?\n\nLIMITATIONS:\nThe authors acknowledge that the DSF parametrization, while theoretically insightful, doesn't necessarily lead to efficient implementations. Empirical validation is limited to synthetic tasks and a relatively small language modeling task, constraining generalizability. The paper also lacks comprehensive analysis of computational efficiency implications for different architectures under the DSF lens.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-13"}