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

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.
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.
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.
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
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
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.
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
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
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)
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.
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 weakly supervised paradigms and architectural patterns that enable learning from bag-level labels in computational pathology.
Weakly Supervised Learning
A learning paradigm where models are trained on coarse-grained or noisy labels rather than precise, instance-level annotations. In computational pathology, this means a model learns to classify an entire Whole Slide Image (WSI) as cancerous based only on the slide-level diagnosis, without requiring a pathologist to annotate every individual cell. This is the superordinate category that MIL falls under, contrasting with fully supervised learning that requires exhaustive pixel-level segmentation masks.
Attention-Based MIL Pooling
A permutation-invariant aggregation operator that computes a weighted average of instance embeddings, where the weights are learned by a gated attention mechanism. This allows the model to assign higher importance to diagnostically relevant patches (e.g., tumor regions) and down-weight irrelevant ones (e.g., stroma or adipose tissue). Key properties include:
- Permutation Invariance: The output is unchanged regardless of the order of patches in the bag.
- Interpretability: Attention weights can be visualized as a heatmap over the WSI to identify regions of interest.
- Trainability: The entire pipeline, from feature extractor to attention mechanism, is end-to-end differentiable.
Whole Slide Image (WSI)
A gigapixel digital representation of a glass pathology slide, scanned at high magnification (typically 20x or 40x). A single WSI can contain billions of pixels and is far too large to process as a single input to a GPU. In the MIL framework, the WSI is the bag, and the thousands of smaller image tiles or patches extracted from it are the instances. The inherent challenge is that a WSI-level label (e.g., 'metastatic carcinoma') applies to the entire slide, but the disease may only occupy a small fraction of the tissue.
Standard MIL Assumptions
The classical MIL framework relies on one of two assumptions that define the relationship between instance labels and bag labels:
- Standard Assumption: A bag is positive if and only if it contains at least one positive instance. This is the most common assumption in binary classification.
- Collective Assumption: All instances in a bag contribute equally to the bag label, and the bag label is determined by a summary statistic (e.g., mean, max) of instance predictions. Modern attention-based MIL relaxes these rigid assumptions by learning a flexible, weighted combination of instances.
Instance-Level vs. Embedding-Level MIL
Two fundamental approaches to implementing MIL:
- Instance-Level: A classifier scores each instance independently, and these scores are aggregated (e.g., via max-pooling) to produce a bag-level prediction. This is computationally efficient but can lose contextual information.
- Embedding-Level: Each instance is first mapped to a feature vector (embedding). These embeddings are then aggregated into a single bag-level representation, which is passed to a final classifier. This approach preserves richer information and is the dominant paradigm in modern attention-based MIL for pathology.

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