TL;DR
This paper provides a "Rosetta Stone" for modern sequence models, mathematically proving that "attention-free" architectures like Mamba, RWKV, and Griffin are actually computing implicit causal self-attention. By unifying these models under a single formulation, the authors enable the use of powerful Transformer-based explainability and performance-tuning tools on these efficient, sub-quadratic alternatives.
What Problem Does This Paper Address?
While Transformers dominate AI, their quadratic complexity ($O(L^2)$) makes them slow and memory-hungry for long sequences. This has led to the rise of "Gated-Linear RNNs" and State Space Models (SSMs) like Mamba, which scale linearly ($O(L)$).
However, these new models are often seen as "black boxes." Unlike Transformers, which offer intuitive attention maps that show which tokens the model is focusing on, RNN-based models process data hidden within a recurrent state. This lack of transparency makes it difficult to debug, explain, or improve these models using established techniques. The authors aim to bridge this gap by showing these models are more similar to Transformers than they appear.
Methods
The authors demonstrate that through a series of algebraic manipulations, the layers of Mamba, Griffin, and RWKV can be rewritten in the form $y = \tilde{\alpha}x$, where $\tilde{\alpha}$ is a data-dependent implicit attention matrix.
Key technical steps include:
- Linearization: Treating non-linear components (like SiLU or GeLU activations) and gating branches as data-controlled diagonal matrices.
- Recurrence Unrolling: Converting recurrent update rules (like those in Mamba's S6 layer or Griffin's RG-LRU) into a single matrix that represents how every token in a sequence interacts with every previous token.
- Holistic Integration: Unlike previous work that only looked at the core SSM, this method incorporates "peripheral" components like Conv1D layers and normalization (GroupRMSNorm) into the attention matrix.
Datasets
The researchers evaluated their formulation across diverse domains:
- Vision: ImageNet (for classification and perturbation tests), ImageNet-Segmentation, and Pascal-VOC 2012 (for weakly supervised segmentation).
- NLP: IMDB movie reviews (sentiment analysis) and the ARC-E dataset (zero-shot reasoning).
- LLM Benchmarks: Snarks, CommonsenseQA, and Formal Fallacies to test performance-enhancing prompt engineering.
Key Insights and Ideas
- Gating is Filtering: The gating mechanisms in these models act as a dynamic filter, effectively functioning as the "Value" weighting in an attention mechanism.
- Convolutions Smooth the View: Short Conv1D layers, common in these architectures, act as local mixers that "smooth" the resulting attention maps, making them more coherent.
- Emergent Focus: Just like Transformers, these models develop more sophisticated, long-range dependencies in their deeper layers. As shown in the figure below, the attention matrices become more complex as you move from the 25% depth to the 75% depth of the model.
Key Results
- Superior Explainability: The proposed method produces sharper and more accurate heatmaps than previous Mamba-specific formulations. In vision tasks, it significantly outperformed the baseline in identifying relevant objects within an image.
- Quantitative Gains in Vision: On the ImageNet-Segmentation task, the authors' "Mamba-Attr" method achieved a mean Intersection-over-Union (mIoU) of 62.51%, compared to 54.24% for the previous state-of-the-art Mamba explanation method.
- Boosting LLM Performance: By using their implicit attention matrices to identify "important" tokens for prompt engineering (the AMPLIFY method), they improved Mamba-2.8B's performance on reasoning tasks by an average of 9.8% over the vanilla model.
Limitations and Future Work
While the paper covers the most prominent modern RNNs, the authors acknowledge that other architectures like Hyena and HGRN2 still need to be integrated into the framework. Additionally, while they can now visualize what these models are doing, the inherent "causal" nature of RNNs (they can only look backward) means their inductive biases are still fundamentally different from standard Transformers. Future work will explore how these different biases impact model safety, fairness, and robustness.
Summary updated