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

Jerome Sieber, Carmen Amo Alonso, Alexandre Didier, Melanie Zeilinger, Antonio Orvieto

Introduction

The rapid evolution of foundation model architectures—ranging from the ubiquitous Transformer to resurgent State Space Models (SSMs) like Mamba—has created a diverse "zoo" of models. While these architectures often achieve comparable performance, they are frequently developed in isolation, making it difficult to discern the fundamental principles driving their success. Researchers from ETH Zurich and the ELLIS Institute have addressed this gap by providing a "Rosetta Stone" for sequence mixers: the Dynamical Systems Framework (DSF).

This unified framework represents Softmax Attention, SSMs, and RNNs as a single class of linear recurrences. By mapping these disparate architectures into a shared mathematical space, the researchers reveal that the superior performance of modern models often stems from specific "recurrent normalization" strategies and state expansion rather than their high-level architectural labels alone.

The Dynamical Systems Framework (DSF)

The core contribution of this research is the reformulation of modern sequence mixers as a Linear Structured Time-Varying (LTV) system. In this framework, the evolution of a model's hidden state $h_i$ and its output $y_i$ are governed by the following equations:

$$h_i = \Lambda_i h_{i-1} + B_i u_i$$ $$y_i = C_i h_i + D_i u_i$$

Where $\Lambda_i$ represents the state transition matrix and $B_i$ is the input matrix. By applying this lens, the researchers categorized the major architectures:

  • Softmax Attention: Viewed as a system where the "memory" (hidden state) is updated by keys and values. Crucially, the authors prove that Softmax Attention is equivalent to a recurrent model with an infinite-dimensional hidden state.
  • State Space Models (SSMs): Defined by their discretization steps, which dictate how the state transition and input matrices are coupled.
  • Recurrent Neural Networks (RNNs): Modern variants like RWKV or Griffin are simplified into this linear recurrence by removing specific non-linearities, allowing for direct comparison with SSMs.

Theoretical Insights: Why Models Perform Differently

The DSF allows for a rigorous analysis of the design choices that drive scalability and accuracy. Three key insights emerge from this unification:

1. The Power of State Expansion

A primary challenge for finite-state models (like SSMs and RNNs) is approximating the "infinite" memory of Softmax Attention. The authors provide a formal proof (Lemma 2) demonstrating that increasing the "state expansion" factor ($n$)—where the hidden state is larger than the input dimension—monotonically increases a model's expressivity. This explains why modern alternatives to the Transformer require significantly larger hidden states to remain competitive.

2. Normalization as the "Secret Sauce"

The performance gap between SSMs and Linear Attention is not solely due to the "state space" mathematics. Instead, it often boils down to how they normalize. SSMs utilize "recurrent normalization" via discretization, which couples the state transition and the input. By introducing a new "Normalized Attention" variant inspired by these SSM techniques, the researchers were able to significantly improve the performance of standard Linear Attention.

3. Cross-Pollination of Architectures

By viewing Mamba (S6) through the DSF, the researchers identified a specific "reversed sigmoid" state transition. When this S6-inspired transition was integrated into a standard RNN (qLSTM), the RNN's performance on associative recall tasks improved dramatically, suggesting that specific architectural components are highly transferable once understood through a unified framework.

Empirical Validation

The authors validated these insights across three distinct benchmarks:

  1. Multi-Query Associative Recall (MQAR): This synthetic task tests a model's ability to retrieve specific key-value pairs. The results showed that as state expansion ($n$) increases, the accuracy of Linear Attention converges toward the near-perfect performance of Softmax Attention.
  2. Long Range Arena (LRA): Evaluating long-sequence handling (up to 8k tokens), the S6 (Mamba) model maintained dominance with 66.84% accuracy. However, the DSF-inspired "Normalized Attention" improved Linear Attention's score from 53.52% to 58.08%.
  3. WikiText-103: On real-world language modeling, the normalization strategies derived from the DSF successfully reduced training perplexity for attention-based models.

Conclusion and Future Work

The Dynamical Systems Framework provides a powerful analytical tool for the foundation model era. It clarifies that the distinction between "attention-free" models and Transformers is less about a fundamental paradigm shift and more about how they manage finite versus infinite hidden states and normalization.

While the DSF offers a theoretical roadmap, the authors note that translating these forms into GPU-efficient implementations remains a challenge. Future research will likely focus on scaling these insights to models with billions of parameters and designing "hybrid" architectures that combine the infinite-dimensional expressivity of attention with the efficiency of recurrent state-space systems.

Summary updated

BibTeX
@inproceedings{sieber2024understanding,
  author = {Jerome Sieber and Carmen Amo Alonso and Alexandre Didier and Melanie Zeilinger and Antonio Orvieto},
  title = {{Understanding the Differences in Foundation Models: Attention, State Space Models, and Recurrent Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=iF7MnXnxRw},
}
Figure