Abstract
State Space Models (SSMs) like Mamba offer a promising alternative to Transformers by providing linear scaling with sequence length. However, they often struggle with simple recall and copying tasks, a deficiency previously attributed to fundamental capacity limits. This paper introduces Mimetic Initialization, a compute-free technique that initializes SSM layers to behave like linear attention at the start of training. We demonstrate that the "recall gap" is primarily an optimization challenge rather than a capacity issue. With Mimetic Initialization, Mamba learns recall tasks significantly faster and generalizes to sequences up to 4x longer than those encountered during training.
Introduction
While Transformers dominate modern AI, their quadratic memory growth relative to sequence length poses a significant bottleneck for long-context applications. State Space Models (SSMs), such as Mamba, address this with constant memory requirements. Despite this efficiency, SSMs have historically performed poorly on tasks requiring exact associative recall (e.g., retrieving a value associated with a specific key seen earlier). This paper investigates whether this failure stems from a lack of model capacity or a difficult optimization landscape, ultimately proposing a weight initialization strategy to bridge the gap.
Methodology: Mimetic Initialization
The authors propose Mimetic Initialization, a method to set starting weights so that an SSM "mimics" the behavior of self-attention. By viewing an SSM layer as a form of linear attention with a learnable causal mask, they modify four architectural components at initialization:
- State Persistence ($A \approx 1$): The state transition matrix is initialized to ensure slow decay of the hidden state, allowing the model to retain information from the distant past.
- Temporal Resolution ($\Delta \approx 1$): The discretization step size is set near one to standardize how the model processes time steps.
- Correlated Projections ($W_C^T W_B \approx I$): Input and output projections are initialized to be correlated, encouraging the model to treat tokens as matching "keys" and "queries."
- Identity Convolution: In Mamba 2, internal convolution layers are initialized as identity matrices to prevent signal distortion during the first steps of training.
Experimental Setup
The method was evaluated on several synthetic "stress tests" designed to challenge long-range dependency handling:
- Copying and Stack-order Copying: Predicting strings in forward or reverse order.
- Multi-Query Associative Recall (MQAR): Retrieving values for specific keys from a list of pairs.
- Sorting: Ordering tokens numerically.
A primary focus was length generalization, where models were trained on short sequences (e.g., 50 tokens) and tested on sequences up to 300 tokens.
Key Insights
Optimization over Capacity
The study proves that SSMs possess the mathematical capacity for long-range recall; the difficulty lies in navigating the loss landscape from a random starting point. By inspecting pretrained models, the researchers found that Mamba naturally evolves layers that resemble the proposed mimetic initialization, suggesting that "attention-like" behavior is the optimal strategy for these tasks.
Compute-Free Performance Gains
Unlike architectural changes that add parameters or layers, Mimetic Initialization is essentially "free." It merely changes the starting values of the weight matrices, yet it provides benefits comparable to large-scale pretraining for recall-heavy tasks.
Results and Discussion
Accelerated Learning and Generalization
Mamba models using Mimetic Initialization learn to solve copying tasks in a fraction of the time required by baseline models. Furthermore, these models achieved $2\times$ to $4\times$ length generalization, a feat previously difficult for pure SSMs.
Scaling and Precision
With this initialization, Mamba's recall capacity grows linearly with its state size, whereas default initialization shows almost no benefit from increased state size. Additionally, Mamba's non-linearities allow it to produce "sharper" attention maps than pure linear attention, leading to higher precision in retrieval.
Conclusion
Mimetic Initialization effectively "pre-codes" the ability to attend to the past into State Space Models. While its impact on general natural language pretraining is still being explored, it provides a powerful tool for improving the algorithmic reasoning and recall capabilities of efficient non-Transformer architectures.
Summary updated