English

Probing Length Generalization in Mamba via Image Reconstruction

Machine Learning 2026-03-16 v1

Abstract

Mamba has attracted widespread interest as a general-purpose sequence model due to its low computational complexity and competitive performance relative to transformers. However, its performance can degrade when inference sequence lengths exceed those seen during training. We study this phenomenon using a controlled vision task in which Mamba reconstructs images from sequences of image patches. By analyzing reconstructions at different stages of sequence processing, we reveal that Mamba qualitatively adapts its behavior to the distribution of sequence lengths encountered during training, resulting in strategies that fail to generalize beyond this range. To support our analysis, we introduce a length-adaptive variant of Mamba that improves performance across training sequence lengths. Our results provide an intuitive perspective on length generalization in Mamba and suggest directions for improving the architecture.

Keywords

Cite

@article{arxiv.2603.12499,
  title  = {Probing Length Generalization in Mamba via Image Reconstruction},
  author = {Jan Rathjens and Robin Schiewer and Laurenz Wiskott and Anand Subramoney},
  journal= {arXiv preprint arXiv:2603.12499},
  year   = {2026}
}
R2 v1 2026-07-01T11:17:40.671Z