Mamba2MIL: State Space Duality Based Multiple Instance Learning for Computational Pathology

Yuqi Zhang, Xiaoqian Zhang, Jiakai Wang, Yuancheng Yang, Taiying Peng, Chao TongarXiv 2024 · DOI

Abstract

Multiple Instance Learning (MIL) is a cornerstone of digital pathology, yet existing aggregators struggle to balance the capture of global slide properties with the local spatial context of image patches, often at the cost of high computational complexity. We introduce Mamba2MIL, a framework leveraging State Space Duality (SSD) from the Mamba-2 architecture. By implementing a novel sequence squaring and structured reordering technique, Mamba2MIL effectively fuses order-dependent and order-independent features with linear complexity. Our model achieves state-of-the-art performance on lung and breast cancer classification benchmarks, demonstrating superior training stability and generalization compared to existing Transformer and SSM-based models.

Introduction

In computational pathology, Whole Slide Images (WSIs) are gigapixel-scale files that cannot be processed directly by standard neural networks. The standard approach is Multiple Instance Learning (MIL), where a slide is treated as a "bag" of thousands of image patches. The challenge lies in the aggregator: Transformers offer global context but suffer from $O(N^2)$ complexity, while CNNs are efficient but lack a global receptive field. Mamba2MIL addresses these limitations by utilizing the State Space Duality (SSD) framework to provide a computationally efficient yet expressive solution for long-sequence pathology data.

Methodology

State Space Duality (SSD)

The core of Mamba2MIL is the SSD model, the mathematical foundation of Mamba-2. SSD allows the model to transition between a recurrence-based view (ideal for sequential dependencies) and a matrix-based view (similar to linear attention). This flexibility enables the model to handle the massive sequences found in pathology with linear scaling ($O(N)$).

Sequence Squaring and Reordering

To handle varying WSI sizes and capture diverse feature relationships, Mamba2MIL introduces a unique preprocessing step. The 1D sequence of patch features is padded and reshaped into a perfect square matrix of size $\lceil\sqrt{N}\rceil \times \lceil\sqrt{N}\rceil$. From this square, three parallel processing branches are created:

  1. Original Sequence: Maintains the standard scanline order.
  2. Flipped Sequence: Reverses the order to mitigate history decay inherent in standard SSMs.
  3. Transposed Sequence: Transposing the "squared" matrix structuredly shuffles the sequence. This preserves local neighborhoods while exposing the model to new global relationships, effectively capturing order-independent "bag" properties.
The Mamba2MIL architecture utilizes three parallel SSD branches (Original, Flipped, and Transposed) to process squared patch sequences, followed by a weighted feature selection mechanism.

Weighted Feature Selection

Rather than simple concatenation, the model employs a branch-wise attention mechanism. Using a Tanh-activated linear layer, the framework automatically weights the importance of each sequence view (Original, Flipped, or Transposed) for a specific slide, allowing for adaptive feature fusion.

Experimental Results

Datasets and Performance

The model was evaluated on two major benchmarks:

  • NSCLC (Non-Small Cell Lung Cancer): A binary classification task (LUSC vs. LUAD) using 1,052 samples from TCGA. Mamba2MIL achieved a state-of-the-art 0.9533 AUC and 0.8794 Accuracy.
  • BRACS (BReast Cancer Subtyping): A multiclass task involving 7 subtypes across 537 samples. The model achieved a 0.7986 AUC, showing significantly more stable training than other modern sequence-based models.

Training Stability and Efficiency

Compared to previous leaders like TransMIL and the original MambaMIL, Mamba2MIL demonstrated faster and more stable loss reduction. The SSD-based architecture proves to be a significant upgrade, offering the efficiency of SSMs with the expressive power of attention mechanisms.

Training curves for AUC, Accuracy, and Loss on the NSCLC dataset, comparing Mamba2MIL against TransMIL (top row) and MambaMIL (bottom row).

Discussion and Conclusion

Mamba2MIL successfully bridges the gap between local spatial context and global slide-level features. The use of matrix transposition on squared sequences is a key innovation, allowing the model to capture order-independent features without destroying local structure. While the model shows high sensitivity to hyperparameters like the state expansion factor, its performance on complex multiclass tasks like BRACS highlights its potential for robust clinical application. Future work will explore extending this framework to multi-modal data, integrating genomic information with digital pathology images.

Summary updated

BibTeX
@misc{zhang2024mamba,
  author = {Yuqi Zhang and Xiaoqian Zhang and Jiakai Wang and Yuancheng Yang and Taiying Peng and Chao Tong},
  title = {{Mamba2MIL: State Space Duality Based Multiple Instance Learning for Computational Pathology}},
  year = {2024},
  eprint = {2408.15032},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.15032},
}
Figure