MambaMIM: Pre-training Mamba with State Space Token Interpolation and its Application to Medical Image Segmentation

Fenghe Tang, Bingkun Nian, Yingtai Li, Zihang Jiang, Jie Yang, Wei Liu, S. Kevin Zhou

TL;DR

MambaMIM introduces the first masked image modeling (MIM) pre-training framework tailored for State Space Models (Mamba) in 3D medical image segmentation. By replacing traditional random mask tokens with a novel mathematical token-interpolation strategy (TOKI), it preserves Mamba's inherent causal properties and achieves state-of-the-art performance across multiple clinical benchmarks.

What Problem Does This Paper Address?

While Vision Transformers (ViTs) and CNNs have dominated medical image segmentation, Transformers suffer from quadratic computational complexity, and CNNs struggle to capture long-range dependencies. Recently, Mamba—a State Space Model (SSM) with linear scaling—has emerged as a powerful alternative for long-sequence modeling.

However, self-supervised pre-training for Mamba via Masked Image Modeling (MIM) has faced a major bottleneck. Standard MIM approaches (like MAE) drop image patches and replace them with static, learnable "mask tokens" during decoding. For Mamba, this is highly problematic: its input-dependent selective scan relies on a continuous, causal sequence flow. Inserting random tokens disrupts this historical context. Furthermore, when combining CNNs and Mamba into hybrid architectures, maintaining a consistent masking pattern across heterogeneous modules and feature scales is incredibly difficult, leading to pixel distribution shifts that degrade representation learning.

Fig. 3: The illustration of the masking inconsistency problem. (a) Directly dropping in Mamba. (b) Sparsely dropping in CNN. (c) Masking inconsistency in hybrid architecture. (d) Masking consistency in hybrid architecture. Mask inconsistency in hybrid architectures refers to the cross-architecture inconsistency in mask position that induces pixel intensity distributional shifts during encoding, which degrades representation learning.

Methods

The authors propose MambaMIM, featuring two core innovations designed to unleash Mamba's potential:

  1. Selective Structured State Space Sequence Token-Interpolation (TOKI): Instead of filling masked regions with random or learnable tokens, TOKI mathematically interpolates masked tokens based on the state-space context of adjacent unmasked tokens. This ensures the filled tokens respect the causal flow of Mamba's selective scan mechanism.
  2. Bottom-Up Hybrid Masking Strategy: To enable pre-training on HyMamba (a custom hybrid backbone combining MedNeXt CNN layers at the top and Vision Mamba at the bottom), the authors initialize the mask at the final CNN stage and map it hierarchically to earlier stages. This enforces strict positional masking consistency across different architectural components and feature scales.
Fig. 4: The whole structure of MambaMIM. The hybrid encoder performs bottom-up masked modeling, the initialization unmasking patch is white, the bottom-up mapping unmasking patch is purple and the masking position is empty. The CNN stage (yellow) utilizes 3D sparse operator for hierarchical encoding and fills learnable mask tokens in masked position for decoding. The Mamba stage (purple) only learns unmasked sequences, and TOKI is applied during decoding which can preserve the continuity of 1D selective structure state space sequence.

Datasets

  • Pre-training: A massive, diverse dataset of 6,814 unlabeled 3D CT scans aggregated from 13 public datasets (including BTCV, FLARE'22, AbdomenCT-1k, TotalSegmentator, and various Medical Segmentation Decathlon tasks).
  • Downstream Evaluation: Evaluated across 8 public benchmarks spanning multi-organ and lesion segmentation: BTCV, AMOS, MSD (Pancreas, Hepatic Vessel, Spleen), CT-ORG, KiTS 23, and BraTS 21 (used to test cross-modality generalization to MRI scans).

Key Insights and Ideas

  • Causality Matters for SSMs: Standard learnable mask tokens act as "speed bumps" in Mamba's sequential scan. Treating mask filling as a continuous state-space interpolation problem rather than a discrete token replacement is the key to unlocking generative pre-training for Mamba.
  • Hybrid Harmony: Combining CNNs (excellent for local feature extraction) and Mamba (excellent for long-range context) requires strict spatial alignment during masking. Without a bottom-up masking strategy, the feature distributions mismatch, ruining the benefits of self-supervised learning.
  • Semantic Independence: Pre-training on CT scans using a generative pixel-reconstruction task allows the model to learn fundamental anatomical geometries, enabling it to transfer seamlessly to entirely different modalities like MRI without structural collapse.

Key Results

  • State-of-the-Art Segmentation: HyMamba pre-trained with MambaMIM achieved an average Dice Similarity Coefficient (DSC) of 80.16% on the BTCV dataset, outperforming the train-from-scratch baseline (77.56%) and beating standard learnable token approaches (79.38%).
  • Outperforming Existing SSL: MambaMIM consistently outperformed top-tier self-supervised methods, including Transformer-based MAE (73.49% DSC) and CNN-based SparK (75.79% DSC).
  • Robust Generalization: On unseen datasets like KiTS 23 and CT-ORG, MambaMIM maintained top performance. When transferred to the BraTS 21 MRI dataset, it achieved a SOTA average DSC of 89.91%, proving its cross-modality robustness.
Fig. 2: Different mask token strategies for Vanilla Mamba and Hybrid Mamba pre-trained on the BTCV dataset (Landman et al., 2015) for the 3D segmentation task. The improvements brought by TOKI surpass previous SSL methods with the learnable token, and they are much better than those without pre-training.

Limitations and Future Work

While MambaMIM sets a new benchmark, the authors note a few areas for expansion:

  • Scanning Strategies: Ablation studies showed that alternative scanning paradigms (like Shuffle scan) can alter downstream performance (boosting DSC to 80.89%). Future work could focus on adaptively optimizing these scanning paths during pre-training.
  • Task Diversity: The evaluation focused heavily on 3D medical image segmentation. Extending this framework to other downstream tasks like 3D image registration, classification, or multi-modal clinical prediction remains an open avenue.

Summary updated

Abstract

Recently, the state space model Mamba has demonstrated efficient long-sequence modeling capabilities, particularly for addressing long-sequence visual tasks in 3D medical imaging. However, existing generative self-supervised learning methods have not yet fully unleashed Mamba's potential for handling long-range dependencies because they overlook the inherent causal properties of state space sequences in masked modeling. To address this challenge, we propose a general-purpose pre-training framework called MambaMIM, a masked image modeling method based on a novel TOKen-Interpolation strategy (TOKI) for the selective structure state space sequence, which learns causal relationships of state space within the masked sequence. Further, MambaMIM introduces a bottom-up 3D hybrid masking strategy to maintain a masking consistency across different architectures and can be used on any single or hybrid Mamba architecture to enhance its multi-scale and long-range representation capability. We pre-train MambaMIM on a large-scale dataset of 6.8K CT scans and evaluate its performance across eight public medical segmentation benchmarks. Extensive downstream experiments reveal the feasibility and advancement of using Mamba for medical image pre-training. In particular, when we apply the MambaMIM to a customized architecture that hybridizes MedNeXt and Vision Mamba, we consistently obtain the state-of-the-art segmentation performance. The code is available at: https://github.com/FengheTan9/MambaMIM.
BibTeX
@article{tang2025mambamim,
  author = {Fenghe Tang and Bingkun Nian and Yingtai Li and Zihang Jiang and Jie Yang and Wei Liu and S. Kevin Zhou},
  title = {{MambaMIM: Pre-training Mamba with State Space Token Interpolation and its Application to Medical Image Segmentation}},
  journal = {Medical Image Analysis},
  year = {2025},
  doi = {10.1016/j.media.2025.103606},
}
Figure