Interactive simulations — the series
Each simulation shows one method together with one failure mode
Small networks trained in the browser for the AI methods of digital pathology: which simulations are ready, which are planned, and the lesson each one carries.
Three conditions for the format
A method enters this series when three things hold: (1) a model small enough to train in the browser in seconds, (2) synthetic data in which the truth of every element is known, (3) a pathology-specific failure mode the simulation makes visible. Without the third, a simulation is only a demo; every simulation in this series has a “trap” switch.
Ready
Simulation 1
Slide Bag Net — mutation prediction with MIL
Method: attention-based multiple-instance learning (ABMIL; the core of CLAM and TransMIL). Trap: when lab stain is confounded with the mutation, the network learns the stain instead of the biology. Lesson: pooling decides everything; the attention map is where the model looked, not where the mutation is.
Simulation 2
Stain Shift — normalisation and augmentation
Method: Macenko stain-vector estimation in optical density, normalising B onto A, stain augmentation in training. Trap: the same lab confound, retrained with four preprocessing choices. Lesson: domain shift can be repaired at the data level; normalisation fixes the input, augmentation stops the network relying on stain; on clean data neither buys anything.
Planned — direct extensions
These reuse Slide Bag Net’s data and shell; the first is next in line.
Simulation 3 · planned
Foundation-model pretraining (self-supervised)
Method: contrastive pretraining on 2,000 unlabelled patches, then freeze and train MIL on 80 slides. Trap: if the pretraining data come from one lab, the embedding encodes the stain. Lesson: why UNI, Virchow and Prov-GigaPath matter, and why they are frozen.
Simulation 4 · planned
Transformer MIL (self-attention across patches)
Method: one self-attention layer over the 16 patches before pooling. Trap: contextual rules such as "mutant pattern next to necrosis" that ABMIL cannot learn. Lesson: attention matrices do not read like an ABMIL map.
Planned — cell level
Simulation 5 · planned
Nucleus segmentation (U-Net / HoVer-Net)
Trap: touching nuclei merge under semantic segmentation and separate once the horizontal-vertical distance-map head is added. Lesson: Dice versus PQ.
Simulation 6 · planned
Cell detection and classification (Ki-67 / PD-L1 scoring)
Trap: lymphocytes counted as tumour cells inflate the index; the same slide scores differently at two labs. Lesson: the score depends on which cells you count.
Simulation 7 · planned
Spatial statistics (tumour microenvironment)
Method: no trained network; TIL density, nearest-neighbour distance, Ripley's K. Trap: the same TIL count reads as "inflamed" or "excluded" depending on where the invasive margin is drawn.
Planned — the clinical layer
Simulation 8 · planned
Survival prediction (Cox / DeepSurv)
Method: Cox partial likelihood on the slide embedding; censoring comes from the generator. Trap: overfitting on 80 patients with 60% censoring. Lesson: C-index, Kaplan–Meier by predicted risk.
Simulation 9 · planned
Calibration and clinical thresholds
Method: reliability diagram, temperature scaling. Trap: a threshold chosen for sensitivity 0.99 collapses at a different prevalence. Lesson: AUROC is not a clinical performance metric.
Simulation 10 · planned
Active learning and the annotation budget
Method: the network asks the pathologist "which patch should I label next"; random, uncertainty and diversity sampling. Lesson: how to spend 200 annotations.
Simulation 11 · planned
Validation study design
Method: no training; a simulator for reader studies, non-inferiority margins, site stratification, prevalence shift and drift monitoring. Lesson: why a locked algorithm validated at one site fails the intended-use question.
What does not fit this format
Generative language models that write reports (Nucleus Net has a small one), whole-slide registration, and anything that depends on real tissue appearance rather than a measurable abstraction. For those, a narrated walkthrough with real figures beats a simulation.