Mamba Modulation: On the Length Generalization of Mamba

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Lu, Peng, Huang, Jerry, Zeng, Qiuhao, Wang, Xinyu, Chen, Boxing, Langlais, Philippe, Cui, Yufei
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911316374978560
author Lu, Peng
Huang, Jerry
Zeng, Qiuhao
Wang, Xinyu
Chen, Boxing
Langlais, Philippe
Cui, Yufei
author_facet Lu, Peng
Huang, Jerry
Zeng, Qiuhao
Wang, Xinyu
Chen, Boxing
Langlais, Philippe
Cui, Yufei
contents The quadratic complexity of the attention mechanism in Transformer models has motivated the development of alternative architectures with sub-quadratic scaling, such as state-space models. Among these, Mamba has emerged as a leading architecture, achieving state-of-the-art results across a range of language modeling tasks. However, Mamba's performance significantly deteriorates when applied to contexts longer than those seen during pre-training, revealing a sharp sensitivity to context length extension. Through detailed analysis, we attribute this limitation to the out-of-distribution behaviour of its state-space dynamics, particularly within the parameterization of the state transition matrix $\mathbf{A}$. Unlike recent works which attribute this sensitivity to the vanished accumulation of discretization time steps, $\exp(-\sum_{t=1}^NΔ_t)$, we establish a connection between state convergence behavior as the input length approaches infinity and the spectrum of the transition matrix $\mathbf{A}$, offering a well-founded explanation of its role in length extension. Next, to overcome this challenge, we propose an approach that applies spectrum scaling to pre-trained Mamba models to enable robust long-context generalization by selectively modulating the spectrum of $\mathbf{A}$ matrices in each layer. We show that this can significantly improve performance in settings where simply modulating $Δ_t$ fails, validating our insights and providing avenues for better length generalization of state-space models with structured transition matrices.
format Preprint
id arxiv_https___arxiv_org_abs_2509_19633
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Mamba Modulation: On the Length Generalization of Mamba
Lu, Peng
Huang, Jerry
Zeng, Qiuhao
Wang, Xinyu
Chen, Boxing
Langlais, Philippe
Cui, Yufei
Machine Learning
Artificial Intelligence
The quadratic complexity of the attention mechanism in Transformer models has motivated the development of alternative architectures with sub-quadratic scaling, such as state-space models. Among these, Mamba has emerged as a leading architecture, achieving state-of-the-art results across a range of language modeling tasks. However, Mamba's performance significantly deteriorates when applied to contexts longer than those seen during pre-training, revealing a sharp sensitivity to context length extension. Through detailed analysis, we attribute this limitation to the out-of-distribution behaviour of its state-space dynamics, particularly within the parameterization of the state transition matrix $\mathbf{A}$. Unlike recent works which attribute this sensitivity to the vanished accumulation of discretization time steps, $\exp(-\sum_{t=1}^NΔ_t)$, we establish a connection between state convergence behavior as the input length approaches infinity and the spectrum of the transition matrix $\mathbf{A}$, offering a well-founded explanation of its role in length extension. Next, to overcome this challenge, we propose an approach that applies spectrum scaling to pre-trained Mamba models to enable robust long-context generalization by selectively modulating the spectrum of $\mathbf{A}$ matrices in each layer. We show that this can significantly improve performance in settings where simply modulating $Δ_t$ fails, validating our insights and providing avenues for better length generalization of state-space models with structured transition matrices.
title Mamba Modulation: On the Length Generalization of Mamba
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2509.19633