Introduction
The landscape of sequence modeling is currently defined by a tension between the interpretability of Transformers and the efficiency of Gated-Linear Recurrent Neural Networks (RNNs) like Mamba, RWKV, and Griffin. While Transformers allow researchers to visualize "attention maps" to understand model decision-making, RNNs have largely remained "black boxes" due to their complex internal state-space logic. This paper bridges that gap by introducing a unified mathematical framework that reinterprets these modern recurrent architectures as "implicit" causal self-attention layers.
The Unified Formulation
Previous attempts to find "hidden attention" within models like Mamba often focused solely on the core mathematical engine (e.g., the S6 layer). However, this approach ignores critical "peripheral" components such as 1D convolutions, gating branches, and specific activation functions that significantly influence the model's behavior.
The authors propose a holistic method to linearize the entire sequence-modeling block, expressing the output $y$ as a simple matrix multiplication: $y = \tilde{\alpha}x$, where $\tilde{\alpha}$ represents the Implicit Attention Matrix. This algebraic unrolling involves several key steps:
- Converting Convolutions: Treating 1D causal convolutions as Toeplitz-like matrix operations.
- Diagonal Gating: Representing element-wise gating (like SiLU or Sigmoid branches) as diagonal matrices.
- Unrolling Recurrence: Mathematically expanding the recurrent rules of models into a single token-to-token map.
- Fusion: Integrating these disparate operations into one unified operator.
Experimental Evaluation
The framework was evaluated across Vision and Natural Language Processing (NLP) tasks using datasets such as ImageNet, Pascal-VOC 2012, IMDB, and the ARC-E reasoning challenge. By generating attention-like maps for these recurrent models, the researchers could apply explainability tools (XAI) previously reserved for Transformers.
Key Results
- Superior Interpretability: In perturbation tests—where parts of an input are hidden to observe model degradation—the unified method identified relevant features much more accurately than previous Mamba-specific techniques.
- Semantic Segmentation: On the Pascal-VOC dataset, the method achieved a 52.11% mIoU (mean Intersection-over-Union), a substantial leap over the previous state-of-the-art for Mamba (35.99%).
- LLM Performance Boost: The authors utilized their attribution maps to enhance in-context learning via the AMPLIFY prompt engineering method. This resulted in a 1.2 percentage point accuracy improvement for a Mamba-2.8B model on reasoning tasks.
- Visual Evidence: Qualitative results show that the generated maps for Mamba and RWKV are remarkably similar to Transformer attention maps, indicating that these models learn to attend to distant, relevant tokens as depth increases.
Insights and Future Work
A primary takeaway is that the "peripherals"—the 1D convolutions and gating branches—are not merely auxiliary; they are essential to shaping the model's attention. Including them produces sharper, more accurate attention maps. Furthermore, this work demonstrates that despite their architectural differences, Mamba, Griffin, and RWKV share a common underlying "implicit attention" vocabulary.
While the current framework covers several leading models, future work aims to extend this to other architectures like Hyena or HGRN2. Additionally, while these maps provide strong correlations, the authors note the ongoing "Attention is not Explanation" debate, suggesting that these maps are a vital first step for auditing models for safety, bias, and fairness.
Summary updated