Inferensys

Glossary

Multiple Instance Learning (MIL)

A weakly supervised learning paradigm where a model is trained on labeled bags of instances, rather than individually labeled instances, commonly used in computational pathology where a whole slide image is a bag of tissue patches.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
WEAKLY SUPERVISED LEARNING

What is Multiple Instance Learning (MIL)?

Multiple Instance Learning is a weakly supervised paradigm where models are trained on labeled 'bags' of instances rather than individual labeled instances, making it essential for computational pathology where whole slide images are treated as bags of tissue patches.

Multiple Instance Learning (MIL) is a weakly supervised learning paradigm where a model is trained on labeled bags containing multiple unlabeled instances, rather than on individually labeled instances. A bag is classified as positive if it contains at least one positive instance, and negative only if all instances are negative. This framework is foundational in computational pathology, where a gigapixel whole slide image (WSI) is treated as a bag of thousands of tissue patches, and only a slide-level diagnosis label is available without pixel-level annotations.

Modern MIL architectures employ attention-based pooling to learn instance-level importance weights, enabling the model to identify diagnostically relevant regions within a slide while training only on slide-level labels. The attention mechanism aggregates instance embeddings into a bag-level representation by computing a weighted average, where weights are learned end-to-end. This approach, combined with self-supervised feature extractors pre-trained on histology images, has achieved state-of-the-art performance in cancer detection, grading, and subtyping tasks without requiring exhaustive manual annotation.

WEAKLY SUPERVISED LEARNING

Core Characteristics of MIL

Multiple Instance Learning (MIL) is a paradigm where labels are assigned to bags of instances rather than individual samples. A bag is classified as positive if it contains at least one positive instance, making it ideal for computational pathology where a gigapixel whole slide image (the bag) is labeled by diagnosis, but individual tissue patches (instances) lack annotations.

01

Bag-Level Supervision

In MIL, the fundamental unit of supervision is the bag—a collection of instances. The model receives a single label for the entire bag, not for its constituent parts.

  • Positive bag: Contains at least one positive instance (e.g., a slide with tumor tissue)
  • Negative bag: Contains only negative instances (e.g., a benign slide)
  • This mirrors clinical reality where pathologists assign a single diagnosis to an entire gigapixel whole slide image without annotating every cell
02

The Standard MIL Assumption

The classical MIL assumption states: a bag is positive if and only if it contains at least one positive instance. This is the foundation upon which most MIL algorithms are built.

  • A negative bag guarantees all instances are negative
  • A positive bag reveals only that at least one instance is positive—the others may be negative or positive
  • This assumption drives the max-pooling operation commonly used in MIL aggregators to extract the most suspicious instance score
03

Embedding-Level vs. Instance-Level MIL

Modern MIL approaches fall into two paradigms:

Instance-Level: A classifier scores each instance independently, then a permutation-invariant pooling operator (max, mean, or attention-weighted) aggregates scores into a bag prediction. Simple but can miss contextual relationships.

Embedding-Level: Each instance is mapped to a low-dimensional embedding. A permutation-invariant aggregation function—often an attention mechanism—combines these embeddings into a single bag representation before a final classifier. This preserves richer information and dominates current state-of-the-art pathology models like ABMIL and CLAM.

04

Attention-Based Deep MIL

Introduced by Ilse et al. (2018), attention-based MIL replaces rigid pooling with a learned, weighted average of instance embeddings.

  • A two-layer neural network computes an attention score for each instance
  • Scores are normalized via softmax, producing a weighted sum of instance features
  • The model learns to assign high attention to diagnostically relevant regions (e.g., tumor nests) and low attention to irrelevant tissue (e.g., stroma, fat)
  • This provides inherent interpretability—attention maps can be visualized as heatmaps over the slide, showing which regions drove the prediction
05

Permutation Invariance

A critical mathematical constraint in MIL: the bag-level prediction must be invariant to the order of instances. Swapping two patches must not change the output.

  • This is guaranteed by using symmetric aggregation functions (sum, mean, max, attention-weighted mean)
  • Operations like concatenation or recurrent neural networks violate this property unless carefully constrained
  • The Deep Sets theorem (Zaheer et al., 2017) proves that any permutation-invariant function on a set can be decomposed as: ρ(Σ φ(x_i))—a sum of transformed elements followed by a final transformation
06

Multi-Instance Learning for WSI Classification

Whole Slide Image (WSI) analysis is the killer application of MIL. A single WSI can contain 100,000+ tissue patches at high magnification, making dense annotation infeasible.

  • The WSI is tiled into patches (e.g., 256×256 pixels at 20× magnification)
  • A pre-trained feature extractor (e.g., a Vision Transformer or ResNet) encodes each patch into a feature vector
  • The MIL aggregator processes these vectors to produce a slide-level diagnosis
  • Leading frameworks: CLAM (clustering-constrained attention), DSMIL (dual-stream), and TransMIL (transformer-based aggregation)
MIL EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about Multiple Instance Learning, a weakly supervised paradigm foundational to computational pathology and beyond.

Multiple Instance Learning (MIL) is a weakly supervised learning paradigm where a model is trained on labeled bags of instances, rather than individually labeled instances. A bag receives a positive label if it contains at least one positive instance, and a negative label only if all its instances are negative. The model must simultaneously learn which instances are discriminative and how to aggregate them for a bag-level prediction. In computational pathology, a gigapixel Whole Slide Image (WSI) is treated as a bag, and the thousands of extracted tissue patches are the instances. The model learns to identify the critical tumor patches that drive a slide-level diagnosis without requiring a pathologist to annotate every single cell.

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.