nnMIL: A generalizable multiple instance learning framework for computational pathology

Xiangde Luo, Jinxi Xiang, Yuanfeng Ji, Ruijiang Li
11/18/2025
cs.CV

No official code found. Best implementation: Luoxd1996/nnMIL (53 stars, last commit 2026-02-28).

Abstract

Computational pathology holds substantial promise for improving diagnosis and guiding treatment decisions. Recent pathology foundation models enable the extraction of rich patch-level representations from large-scale whole-slide images (WSIs), but current approaches for aggregating these features into slide-level predictions remain constrained by design limitations that hinder generalizability and reliability. Here, we developed nnMIL, a simple yet broadly applicable multiple-instance learning framework that connects patch-level foundation models to robust slide-level clinical inference. nnMIL introduces random sampling at both the patch and feature levels, enabling large-batch optimization, task-aware sampling strategies, and efficient and scalable training across datasets and model architectures. A lightweight aggregator performs sliding-window inference to generate ensemble slide-level predictions and supports principled uncertainty estimation. Across 40,000 WSIs encompassing 35 clinical tasks and four pathology foundation models, nnMIL consistently outperformed existing MIL methods for disease diagnosis, histologic subtyping, molecular biomarker detection, and pan- cancer prognosis prediction. It further demonstrated strong cross-model generalization, reliable uncertainty quantification, and robust survival stratification in multiple external cohorts. In conclusion, nnMIL offers a practical and generalizable solution for translating pathology foundation models into clinically meaningful predictions, advancing the development and deployment of reliable AI systems in real-world settings.

View on arXivView PDF

Code Implementations(1)

Luoxd1996/nnMILCommunity77%

nnMIL: A generalizable multiple instance learning framework for computational pathology

532Shell, PythonNov 2, 20257 months ago
multiple-instance-learningpathology-foundation-modelwhole-slide-image

Similar Papers

Cite this paper

@article{luo2025nnmil,
  title  = {nnMIL: A generalizable multiple instance learning framework for computational pathology},
  author = {Xiangde Luo and Jinxi Xiang and Yuanfeng Ji and Ruijiang Li},
  year   = {2025},
  eprint = {2511.14907},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2511.14907v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2511.14907.svg)](https://codeofpaper.com/paper/2511.14907)

Discussion