All models

2DMamba

A whole slide image classifier that scans the 2D grid of patch features with a 2D selective state space model.

Medical imaging · 298 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (22 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
265.5K
Operations
298
Framework
PyTorch
Recurrent
No
Published
CVPR 2025
Cited by
41 (as of 27 October 2026)
Authors
Jingwei Zhang, Anh Tien Nguyen, Xi Han and others
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m14432
Graph hash
a5ce8f3c696e79e2e1b5ab1f3a595e32e9b9a98e35bf702c84b8f6d18688ced8
Skeleton hash
eba4e6e4780a0546e952b57a9a88d666cc23f4b6628209fdb66eead0d9b9c8f1
Architecture hash
692ef9465a2be1be3fcdeea56491db10fd084a9b7022c34c5cb07667ca23a7c5
Diagram SHA-256
753b86a25fbe1ab99ccd422ef36478febfed98d303629a6ac5f5e041e1ec722c
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

2DMambaMIL is the paper's framework for whole slide image (WSI) representation, built on 2DMamba, a 2D selective state space model that directly scans a 2D image without first flattening it into a 1D sequence. WSIs are typically analyzed in a Multiple Instance Learning (MIL) manner, and the paper notes that earlier Mamba-based methods still flatten 2D images into 1D sequences, so spatial discrepancies persist.

The model first tiles an input WSI into patches. Tissue patches are embedded with a pre-trained feature extractor, and a learnable token represents the non-tissue patches padded to obtain a 2D rectangle feature map. The 2DMamba blocks keep the design of the original Mamba block and replace its 1D selective scan with the 2D variant. That scan first runs a horizontal scan on each row independently and then a vertical scan, so each location aggregates information from its upper left locations. An aggregator, an attention based module with two linear projections, then produces a slide feature. The paper also proposes a hardware-aware 2D selective scan operator to extend the 1D Mamba parallelism into 2D.

On 10 public datasets for WSI classification and survival analysis, the paper reports improvements of up to 2.48% in AUC, 3.11% in F1 score, 2.47% in accuracy and 5.52% in C-index. Integrated with VMamba for natural images, the method is reported to add 0.5 to 0.7 mIoU on ADE20k semantic segmentation and 0.2% accuracy on ImageNet-1K classification.

Key idea. The paper proposes a 2D selective state space model that scans an image without flattening it into a 1D sequence, with a hardware-aware operator that extends Mamba's parallelism to 2D.

  • 2dmamba
  • 2d mamba
  • 2dmambamil
  • 2d selective state space model
  • whole slide image classification
  • wsi
  • multiple instance learning
  • computational pathology
  • giga-pixel images

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{zhang20262dmambaefficientstatespace,
      title={2DMamba: Efficient State Space Model for Image Representation with Applications on Giga-Pixel Whole Slide Image Classification}, 
      author={Jingwei Zhang and Anh Tien Nguyen and Xi Han and Vincent Quoc-Huy Trinh and Hong Qin and Dimitris Samaras and Mahdi S. Hosseini},
      year={2026},
      eprint={2412.00678},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2412.00678}, 
}