All models

CLAM

Attention-based multiple instance learning model that classifies a whole slide image from patch feature vectors.

Medical imaging · 19 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (27 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
790.8K
Operations
19
Framework
PyTorch
Recurrent
No
Published
Nature Biomedical Engineering 2021
Cited by
2,279 (as of 29 October 2026)
Authors
Ming Y. Lu, Drew F. K. Williamson, Tiffany Y. Chen and others
License
GPL-3.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15105
Graph hash
5469c1b1797f1760b49158e426c9dee8355318d6d0e86a8cec9c9dbea52a1361
Skeleton hash
f7421f8c365ca197eba6ac40ce332f912e367148edca0ce2d13ee4fa1e51fb0f
Architecture hash
4422af1784db0c23b2751e560a42eb13e00b9717ca0de86114275edbe5b13fb2
Diagram SHA-256
89ab598d3982e0bc6d58c245bd5ffbd88dd2eae152d8a68f40bbe156fd783dc1
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

CLAM (Clustering-constrained Attention Multiple instance learning) classifies a whole slide image in pathology and needs only slide-level labels for training. It uses attention to find the sub-regions of high diagnostic value, and adds instance-level clustering over those regions to constrain and refine the feature space.

The network does not read pixels: the patches of each slide are passed to it as feature vectors. A ResNet50 pretrained on ImageNet first converts each 256 × 256 patch into a 1024-dimensional vector. A fully-connected layer compresses each vector to 512 dimensions. An attention network then scores every patch, and the slide-level representation is the average of all patches weighted by those scores. In the paper's multi-class design the attention network splits into n parallel branches, one per class, and a classification layer examines each class-specific slide representation.

During training, pseudo-labels are generated for the most and least attended patches, and a clustering layer with 512 hidden units learns to separate them using the smooth top1 SVM loss. The paper reports a 10-fold mean test AUC of 0.991 for three-class Renal Cell Carcinoma subtyping, 0.956 for Non-small Cell Lung Carcinoma subtyping and 0.953 for breast cancer metastasis detection in lymph nodes.

Key idea. CLAM pairs attention-based pooling with instance-level clustering of the most and least attended patches, so a slide classifier can be trained from slide-level labels alone.

  • CLAM
  • Clustering-constrained Attention Multiple Instance Learning
  • whole slide image classification
  • WSI
  • computational pathology
  • weakly supervised learning
  • attention MIL
  • histopathology
  • attention heatmap
  • slide-level labels

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{lu2020dataefficientweaklysupervised,
      title={Data Efficient and Weakly Supervised Computational Pathology on Whole Slide Images}, 
      author={Ming Y. Lu and Drew F. K. Williamson and Tiffany Y. Chen and Richard J. Chen and Matteo Barbieri and Faisal Mahmood},
      year={2020},
      eprint={2004.09666},
      archivePrefix={arXiv},
      primaryClass={eess.IV},
      url={https://arxiv.org/abs/2004.09666}, 
}