TL;DR
This paper uses causal interventions to reveal that while Transformers and State Space Models (SSMs) like Mamba can both successfully solve associative retrieval tasks, they do so using completely different internal mechanisms. Crucially, the authors discover that Mamba's retrieval success relies heavily on its short convolution layers to mimic transformer-like induction, rather than the core SSM block itself.
What Problem Does This Paper Address?
State Space Models (SSMs) are rapidly emerging as efficient, linear-time alternatives to quadratic-attention Transformers. However, SSMs frequently struggle with in-context retrieval—the basic ability to find and copy information from earlier in a prompt.
Traditionally, researchers evaluate retrieval capabilities using "behavioral metrics" like accuracy on synthetic tasks (e.g., Associative Recall). But behavioral metrics only tell you if a model works, not how it works or why it fails. This paper bridges the gap by opening the black box, using mechanistic interpretability to see how different architectures actually route and store information under the hood.
Methods
The authors employ interchange interventions (a form of causal intervention) using the open-source pyvene library to map out the information flow inside the models.
The experimental setup is elegant:
- They run a "clean" input sequence through the model.
- They run a "corrupted" version of the same sequence where a critical key token is changed (which normally causes the model to fail).
- During the corrupted run, they overwrite specific internal activations (at a chosen layer, component, or token position) with the corresponding activations from the clean run.
If swapping in the clean activation at a specific component restores the model's ability to output the correct answer, that component is causally verified as playing a vital role in the retrieval mechanism.
Datasets
The models were evaluated on two synthetic tasks:
- Associative Recall (AR): The standard benchmark for context retrieval. The model is fed a sequence of random key-value pairs followed by a query key, and it must predict the matching value (e.g.,
A 2 C 3 F 9 D 1 C → 3). - Associative Treecall (ATR): A novel hierarchical retrieval task introduced in this paper. Generated using a probabilistic context-free grammar (PCFG), ATR forces models to associate keys and values that are not adjacent in the text, better mimicking the complex, non-positional structures found in natural language.
Key Insights and Ideas
- Same Accuracy, Different Mechanics: Transformers and the Based SSM solve retrieval via a two-layer induction mechanism (storing key-value associations at the value token position). Most other SSMs use direct retrieval, a single-layer mechanism that writes the association directly to the query token.
- Mamba's Secret Weapon is Convolution: Mamba's ability to solve Associative Recall isn't driven by its core state-space model block, but by its short convolution layers. The convolutions handle the key-value association step, while the SSM block merely handles retrieval.
- Latent Induction Capabilities: When short convolutions are removed, Mamba fails completely at standard AR. However, on the new hierarchical ATR task, a convolution-less Mamba successfully falls back to learning an Attention-like, two-layer induction mechanism. This proves SSMs can perform induction, but their architectural priors bias them toward simpler positional shortcuts if available.
Key Results
- AR Performance: Attention and Based achieve 100% accuracy/likelihood at model dimensions $d \ge 32$. Mamba and DeltaNet follow closely behind (~90.3% likelihood at $d=256$), while other SSMs like H3 and Hyena fail.
- The Convolution Threshold: Ablation experiments showed that reducing Mamba's convolution kernel size below 2 completely destroys its performance on AR, proving that local context mixing via short convolutions is strictly necessary for its standard retrieval mechanism.
- ATR Superiority: On the new hierarchical ATR task, Mamba actually matches or outperforms all other architectures across all model dimensions. Even without short convolutions, Mamba achieves 93.4% accuracy at $d=256$, outperforming Based (92.2%) and BaseConv (89.7%).
Limitations and Future Work
- Synthetic Focus: The study is strictly limited to synthetic tasks (AR and ATR) trained from scratch at small scales.
- Scaling to Real-World Models: Future work is required to validate whether these exact mechanistic circuits (like Mamba's reliance on convolutions for induction) hold true in large-scale, production-grade language models trained on natural language text.
- Complementary Metrics: The authors note that behavioral metrics are still necessary to properly contextualize these mechanistic findings, as interpretability tools alone do not capture overall task performance.
Summary updated