Introduction
Computational pathology relies on Whole Slide Images (WSIs), which are gigapixel-scale images containing tens of thousands of patches. Analyzing these images typically involves Multiple Instance Learning (MIL), where a slide is treated as a "bag" of patches. However, existing MIL methods face a "trilemma": Attention-based models often lack structural context, Transformers suffer from quadratic computational complexity ($O(N^2)$), and State Space Models (SSMs), while efficient ($O(N)$), are highly sensitive to patch ordering. SemaMIL addresses these challenges by introducing "semantic intelligence" into the SSM architecture.
The SemaMIL Framework
SemaMIL introduces two core innovations to make SSMs effective for pathology: Semantic Reordering (SR) and the Semantic-guided Retrieval State Space Module (SRSM). The entire pipeline utilizes a pre-trained feature extractor (TITAN) to convert image patches into embeddings before processing.
Semantic Reordering (SR)
Standard SSMs process sequences linearly, making them sensitive to input order. In traditional MIL, patches are often ordered randomly or in a fixed grid, which destroys histological meaning. SR uses a lightweight router to group semantically similar patches—such as tumor cells or stroma—together. This reordering ensures that histologically related information is processed contiguously, allowing the model to capture discriminative context more effectively while maintaining spatial integrity through reversible permutations.
Semantic-guided Retrieval State Space Module (SRSM)
The SRSM acts as a dynamic tuner for the model's parameters. It identifies a representative subset of "query" patches—the most informative regions of the slide—and uses them to adjust the SSM's discrete parameters. This retrieval-guided mechanism allows the model to adapt its global modeling behavior to the specific morphological features of each slide, effectively suppressing background noise and bridging the gap between local patch details and holistic slide context.
Experimental Results
SemaMIL was evaluated on four diverse WSI datasets: EBRAINS (brain tumors), BRACS (breast carcinoma), IPD-Brain (glioma), and TCGA (The Cancer Genome Atlas). The model consistently outperformed strong baselines, including TransMIL and MambaMIL.
SemaMIL achieved a top accuracy of 75.1% on EBRAINS and 60.3% on BRACS. Beyond diagnostic accuracy, the model is remarkably lean. It requires only 0.248 GFLOPs and 0.464M parameters. For comparison, the popular TransMIL model uses more than double the FLOPs (0.502G) and has more parameters (0.542M), yet yields lower accuracy. Qualitative analysis also showed that SemaMIL correctly classified difficult cases that other state-of-the-art models missed, particularly subtle glioma subtypes.
Conclusion and Future Work
SemaMIL demonstrates that sequence order is a critical feature in MIL. By leveraging semantic awareness, the model achieves state-of-the-art performance with significantly lower computational costs than Transformer-based alternatives. While currently focused on cancer subtyping, future work will explore extending this framework to survival prediction and tissue segmentation tasks, as well as refining the routing mechanisms for even more precise patch sequencing.
Summary updated