State-Space Models (SSMs) like Mamba have taken the AI world by storm, offering a promising, linear-time alternative to the computationally expensive Transformer. While empirical evidence shows Mamba performs better than its predecessors, the "why" has remained somewhat of a mystery. A new paper, "Understanding Input Selectivity in Mamba," provides a rigorous mechanistic look under the hood, revealing how Mamba’s unique "selectivity" allows it to master memory and logic in ways older models simply couldn't.
The Core Problem: Speed vs. Expressivity
For years, the deep learning community has faced a trade-off: Transformers are incredibly powerful but slow (scaling quadratically with sequence length), while traditional State-Space Models (SSMs) are lightning-fast (scaling linearly) but historically struggle with complex reasoning and long-term memory.
Mamba bridged this gap by introducing input selectivity—making the model's parameters change based on the specific tokens it sees. However, we lacked a structural explanation of how this selectivity actually translates to performance. Does it just add more parameters, or does it change the fundamental "math" the model can perform? This paper tackles that question by analyzing Mamba's expressivity, memory retention, and its ability to solve "associative recall" tasks.
Key Insights and Mechanisms
Through a mix of rigorous mathematical proofs and targeted empirical experiments, the authors uncover several fundamental advantages of Mamba's architecture:
- Haar Wavelets vs. Fourier Bases: The paper proves that Mamba’s S6 layer can represent Haar wavelets. While older SSMs (like S4D) are limited to smooth, wave-like Fourier bases—which struggle with sharp transitions—Mamba can efficiently model "spiky" or discontinuous signals. This is crucial for language, where a single word can completely shift the context. Mamba approximates these discontinuous functions at a rate of $O(2^{-N/3m})$, significantly faster than the $O(N^{-1})$ rate of non-selective SSMs.
- "Freezing" Time to Prevent Memory Decay: Standard SSMs suffer from exponential memory decay, naturally "forgetting" over time. The authors show that Mamba’s selectivity allows it to dynamically set its discretization step ($\Delta$) to near-zero. This effectively "pauses" the clock for specific tokens, allowing the model to carry important information across long sequences without it fading away.
- The Power of the "Mixer": A major finding is that the SSM layer doesn't work alone. To solve associative recall, Mamba uses its short convolution to pair keys with values and its SSM layer to store that pair in a specific "column" of its hidden state.
- Mamba-2 is Leaner: The analysis reveals that Mamba-2 is more parameter-efficient than vanilla Mamba for associative recall because it uses three independent convolutions to process keys, values, and queries separately.
Benchmarking Memory and Logic
The study validates its theoretical claims using three key synthetic benchmarks designed to test specific "mechanistic" capabilities:
- KEEP n-TH: A task requiring the model to memorize and retrieve exactly the $n$-th token in a sequence.
- MQAR (Multiple-Query Associative Recall): A sophisticated retrieval task where the model sees a list of key-value pairs and must later provide the correct value for multiple shuffled keys.
- INDUCTION HEADS: A classic test for LLMs where the model must predict the next token based on its previous occurrence in a similar context (e.g., if it saw "Apple... [A]" earlier, it should predict "[A]" when it sees "Apple" again).
In testing these tasks, the authors' predicted model sizes for solving MQAR were remarkably accurate. In experiments, models just slightly smaller than the theoretical bound failed, while those at or above it achieved 100% accuracy.
Future Directions
The authors also discovered that making the state matrix input-dependent along the state dimension (rather than just the embedding dimension)—a variant they call Mamba-$\Delta^\top$—makes the model much better at the Induction Heads task. This suggests a concrete path for improving future Mamba-style architectures.
While this paper provides a brilliant mechanistic look at Mamba, its analysis is currently limited to synthetic tasks. How these mechanisms scale to the "messy" data of natural language, and why gradient descent is so adept at finding these specific wavelet-like solutions, remain exciting open questions for the field.
Paper Citation: Huang, N., et al. (2025). Understanding Input Selectivity in Mamba: Impact on Approximation Power, Memorization, and Associative Recall Capacity. Proceedings of the 42nd International Conference on Machine Learning (ICML).
Summary updated