nnMIL: A generalizable MIL framework for computational pathology.We present nnMIL, a generalizable multiple instance learning framework that converts patch-level features from pathology foundation models into slide-level clinical predictions. nnMIL incorporates random sampling at both the patch and feature levels, and employs a lightweight aggregator with sliding-window inference for ensemble predictions and uncertainty quantification. Evaluated across 40,000 whole-slide images spanning 35 clinical tasks and four different foundation models, nnMIL consistently improves over existing methods in disease diagnosis, histologic classification, biomarker detection, and survival prediction, with reliable performance across external cohorts.