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.
Glossary
Multiple Instance Learning (MIL)

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.
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.
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.
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
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
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
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
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
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
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.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Understanding Multiple Instance Learning requires familiarity with the data structures, learning paradigms, and architectural components that enable weakly-supervised analysis of gigapixel pathology images.
Weakly-Supervised Learning
A learning paradigm where models are trained using coarse, imprecise labels rather than exhaustive per-instance annotations. In digital pathology, this means using only slide-level diagnoses (e.g., 'cancer present') to train a model that must learn which individual patches contain tumor morphology. This dramatically reduces the annotation burden on pathologists compared to pixel-level segmentation.
Attention-Based MIL Pooling
A permutation-invariant aggregation operator that computes a weighted average of instance embeddings, where weights are learned by a gated attention mechanism. Key properties:
- Weights sum to 1, providing a natural interpretability mechanism
- The attention network learns to assign high weights to diagnostically relevant patches
- Produces an attention heatmap that highlights tumor regions without pixel-level supervision
Instance-Level vs. Embedding-Level MIL
Two fundamental MIL paradigms:
- Instance-level: Classifies each patch independently, then aggregates predictions (e.g., max pooling). Prone to noisy gradients when most patches are negative.
- Embedding-level: Maps each patch to a feature vector, aggregates all vectors into a single bag representation, then classifies the bag. Modern attention-based methods use this approach for superior performance and richer representations.
Permutation Invariance
A mathematical property requiring that the aggregation function produce the same output regardless of input ordering. Since patches in a WSI have no natural sequence, MIL pooling operators must satisfy: f(x₁, x₂, ..., xₙ) = f(x_π(1), x_π(2), ..., x_π(n)) for any permutation π. Attention-based weighted averaging and Deep Sets architectures are designed to guarantee this property.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us