Inferensys

Glossary

Multiple Instance Learning (MIL)

A weakly-supervised learning paradigm where a model is trained using slide-level labels by aggregating predictions from unlabeled patches extracted from a gigapixel whole-slide image.
ML engineer managing model training cluster on laptop, GPU utilization visible, technical deep learning setup.
WEAKLY-SUPERVISED PARADIGM

What is Multiple Instance Learning (MIL)?

Multiple Instance Learning is a weakly-supervised learning paradigm where a model is trained using slide-level labels by aggregating predictions from unlabeled patches extracted from a gigapixel whole-slide image.

In Multiple Instance Learning (MIL), the training data is organized into 'bags' of instances. A bag receives a positive label if it contains at least one positive instance, and a negative label only if all instances are negative. In digital pathology, a gigapixel Whole-Slide Image (WSI) is treated as a bag, and the thousands of extracted image patches are the instances. The model learns to identify which patches contain diagnostic features, such as tumor morphology, using only the patient-level diagnosis as supervision.

MIL architectures typically employ an attention-based aggregation mechanism, where a neural network assigns a learned weight to each instance embedding before pooling them into a single bag-level representation. This allows the model to identify the most diagnostically relevant regions without requiring pixel-level annotations from pathologists. The attention heatmap generated during inference provides spatial interpretability, highlighting the tissue regions that contributed most to the slide-level prediction.

WEAKLY-SUPERVISED LEARNING

Key Characteristics of MIL

Multiple Instance Learning (MIL) is a paradigm that learns from bags of instances rather than individually labeled examples. In digital pathology, a whole-slide image is a bag containing thousands of unlabeled patches, and only a slide-level label is provided.

01

Bag-Level Supervision

In MIL, training labels exist only at the bag level (the entire slide), not for individual instances (patches). The model must infer which patches are diagnostically relevant without explicit patch-level annotations.

  • A positive bag contains at least one positive instance
  • A negative bag contains only negative instances
  • Eliminates the bottleneck of manual pixel-level annotation
  • Enables training on routine clinical reports rather than curated datasets
02

Permutation Invariance

MIL aggregators must be permutation-invariant: the output must not depend on the order of instances. This reflects the biological reality that tissue topology is not sequential.

  • Mean pooling: Averages all instance features
  • Max pooling: Selects the single most activated instance
  • Attention-based pooling: Learns a weighted sum where weights sum to 1
  • Transformer aggregation: Uses self-attention without positional encoding
03

Attention-Based Aggregation

Modern MIL architectures use gated attention mechanisms to learn instance-level importance weights. The model assigns higher attention to diagnostically relevant regions while suppressing irrelevant tissue.

  • Attention weights provide built-in interpretability
  • Generates attention heatmaps for pathologist review
  • Gated attention uses a sigmoid gate with tanh activation
  • Enables discovery of novel morphological biomarkers
04

Instance-Level Feature Extraction

Before aggregation, each patch is encoded into a compact feature vector using a pre-trained encoder. This reduces gigapixel images to manageable representations.

  • ResNet-50 or ViT backbones pre-trained on histology
  • Features typically 512 to 2048 dimensions per patch
  • Self-supervised pre-training (e.g., SimCLR, DINO) improves features
  • Foundation models like UNI and Virchow provide state-of-the-art embeddings
05

Standard MIL Assumptions

MIL relies on specific assumptions about the relationship between instances and bag labels. Understanding these is critical for model design.

  • Standard assumption: A bag is positive if at least one instance is positive
  • Threshold-based: A bag is positive if a minimum fraction of instances are positive
  • Count-based: Bag label depends on the number of positive instances
  • In pathology, the presence of even a small tumor region makes the slide positive
06

WSI Pre-Processing Pipeline

Before MIL training, whole-slide images undergo a standardized pre-processing workflow to extract viable tissue patches.

  • Tissue segmentation: Otsu thresholding or U-Net to identify tissue regions
  • Tiling: Extract non-overlapping patches at a fixed magnification (e.g., 20x)
  • Quality control: Discard patches with blur, pen marks, or low tissue content
  • Stain normalization: Standardize H&E color distributions across slides
MIL EXPLAINED

Frequently Asked Questions

Clear, technical answers to the most common questions about the weakly-supervised learning paradigm that powers modern computational pathology.

Multiple Instance Learning (MIL) is a weakly-supervised learning paradigm where a model is trained using labels assigned to bags of instances rather than to individual instances. In computational pathology, a bag is an entire gigapixel Whole-Slide Image (WSI) labeled as 'cancer' or 'normal,' while the instances are thousands of unlabeled image patches extracted from that slide. The model learns to aggregate patch-level predictions into a single slide-level decision without requiring a pathologist to annotate every individual region. During training, the MIL algorithm processes all patches from a slide, assigns attention weights or scores to each, and combines them—typically via a permutation-invariant pooling operator like attention-based pooling or max pooling—to produce the final classification. This approach elegantly solves the 'label scarcity' problem in digital pathology, where obtaining pixel-level annotations for gigapixel images is prohibitively expensive and time-consuming.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.