Vim4Path: Self-Supervised Vision Mamba for Histopathology Images

Ali Nasiri-Sarvi, Vincent Quoc-Huy Trinh, Hassan Rivaz, Mahdi S. Hosseini

Abstract

Computational pathology requires models capable of processing large-scale Whole Slide Images (WSIs) with limited annotations. While Vision Transformers (ViTs) offer global context, their quadratic complexity and high data requirements pose significant challenges. We present Vim4Path, which integrates Vision Mamba (Vim)—a state-space model with linear complexity—into a self-supervised DINO framework. Vim4Path achieves substantial performance gains, particularly at smaller scales, demonstrating an 8.21% AUC improvement over comparable ViTs. Furthermore, the architecture's bidirectional scanning approach naturally mimics the diagnostic scanning patterns used by human pathologists, offering both efficiency and biological relevance.

Introduction

Analyzing Gigapixel Whole Slide Images (WSIs) is a cornerstone of modern computational pathology. However, these images present two primary hurdles: label scarcity and architectural trade-offs. Expert annotations at the patch level are prohibitively expensive, forcing reliance on slide-level labels. Architecturally, Convolutional Neural Networks (CNNs) excel at local texture extraction but struggle with long-range spatial relationships. Conversely, Vision Transformers (ViTs) capture global context but suffer from quadratic computational complexity ($O(N^2)$) and lack the inductive biases necessary for efficient learning on smaller datasets.

Vim4Path addresses these challenges by adopting State Space Models (SSMs), specifically the Vision Mamba (Vim) architecture, to provide a computationally efficient alternative that maintains long-range perception without the overhead of standard attention mechanisms.

Methodology

Vision Mamba (Vim) and SSMs

Unlike Transformers that rely on self-attention, Vim utilizes a selective SSM approach. This allows the model to process image patches as a sequence with linear complexity ($O(N)$), significantly reducing memory and compute requirements for long sequences. To adapt this 1D sequence processing to 2D histopathology images, Vim employs a bidirectional scan, processing tokens in both forward and backward directions to capture comprehensive spatial context.

Self-Supervised Learning with DINO

Vim4Path is integrated into the DINO (Self-distillation with no labels) framework. This self-supervised approach allows the model to learn robust feature representations from unlabeled data by training a "student" network to predict the output of a "teacher" network. To accommodate the multi-scale crops required by DINO training, the authors implemented a positional encoding interpolation module using bicubic interpolation, allowing the inherently rigid Vim architecture to handle varying input sizes.

Experimental Setup

Datasets and Pre-training

The model was evaluated using the Camelyon16 dataset, a benchmark for breast cancer metastasis detection in lymph nodes. Pre-training was conducted on the unlabeled training set.

Evaluation Metrics

Performance was assessed at two levels:

  1. Slide-level: Utilizing the Clustering-constrained Attention Multiple-instance learning (CLAM) framework to aggregate patch-level features.
  2. Patch-level: Evaluated on balanced subsets at 5x and 10x magnification (PCam-224-5x and PCam-224-10x).

Results and Discussion

Performance and Efficiency

The most significant performance gains were observed at smaller model scales. The tiny Vim model (Vim-ti, 7M parameters) achieved an AUC of 95.81, representing a massive improvement over the tiny ViT (ViT-ti, 6M parameters), which scored 87.60.

Scaling the architecture further improved results, with Vim-s (26M parameters) reaching an AUC of 98.85, outperforming established pathology models such as HIPT and CTransPath. Notably, the Vim-ti-plus variant (13M parameters) outperformed the larger ViT-S (22M parameters), suggesting that Mamba-based architectures are more parameter-efficient for histopathology tasks.

Interpretability and Biological Relevance

Explainability analysis via Grad-CAM revealed that Vim4Path focuses on specific biological markers, such as intracellular mucin and activated lymphocytes—features critical for cancer diagnosis. This contrasts with ViTs, which often focus broadly on atypical cells. Furthermore, Vim’s raster-scanning approach mimics the "lawnmower" pattern pathologists use during manual slide review, providing a more intuitive alignment with clinical workflows.

Conclusion and Future Work

Vim4Path demonstrates that State Space Models offer a powerful, efficient alternative to Transformers in computational pathology. By combining the inductive bias of local dependencies with long-range perception, Vim4Path achieves state-of-the-art results with fewer parameters. Future research will focus on validating the model across more diverse tissue types and exploring multi-scale fusion techniques to improve feature transferability across different magnifications.

Summary updated

BibTeX
@inproceedings{nasirisarvi2024vim,
  author = {Ali Nasiri-Sarvi and Vincent Quoc-Huy Trinh and Hassan Rivaz and Mahdi S. Hosseini},
  title = {{Vim4Path: Self-Supervised Vision Mamba for Histopathology Images}},
  booktitle = {Workshops @ CVPR},
  year = {2024},
}
Figure