Pathology runs on stains. A hematoxylin and eosin (H&E) section reveals tissue architecture. An immunohistochemistry (IHC) preparation localizes a specific protein. An immunofluorescence (IF) panel multiplexes many markers at once. Each stain takes time, costs money, and consumes tissue.
Virtual staining is the use of machine learning to generate one stain from another. Train a model on paired images of the same tissue stained two ways, and it learns to predict the second stain from the first. Once trained, the model can be applied to images of new specimens, producing predicted stain images in seconds, with no reagents and no additional tissue.
The technique is not new in principle. Early work in the late 2010s established that generative neural networks could learn convincing mappings between modalities, first transforming unstained autofluorescence images into virtual H&E. Subsequent work extended the approach to other transitions, including H&E to special stains and H&E to multiplexed immunofluorescence. The broader literature tracks its rapid maturation.
How it works
A virtual staining model is a supervised image-to-image translation network. The standard training recipe pairs co-registered images from two staining modalities, for example an H&E section and a serial section stained for the same protein by IHC, or an unstained autofluorescence image and the H&E from the same slide after staining. The network learns to map one modality to the other, typically using a generative architecture such as a U-Net trained with an adversarial loss, a diffusion model, or more recently a transformer-based model.
The crux of the problem is pairing. Truly perfect pairing is rare in clinical practice because the staining process modifies the tissue. Most groups use serial sections with computational registration to align them. Some groups stain, image, destain, and restain the same section, which is harder but produces tighter pairs.
Once trained, inference is trivial. An unseen image goes in, a predicted stain image comes out. A model that took weeks to train can stain a slide in under a second.
Why it matters
The advantages of virtual staining cluster into four categories.
Cost. Traditional IHC and IF are expensive per slide in reagent and labor. A virtual stain costs only the compute used at inference, a tiny fraction of that. For research at scale, the difference is decisive. A large cohort that would be prohibitively expensive to stain physically can be virtually stained for a trivial cost.
Speed. An IHC protocol takes hours to days from sectioning to readable slide, and multiplexed IF can take longer still. A virtual stain runs in seconds. This collapses the iteration cycle for research questions that depend on staining many specimens with many markers.
Tissue preservation. Rare and irreplaceable specimens (pediatric tumors, autopsy material, biobanked cohorts from rare diseases) cannot be re-sectioned indefinitely. Each physical stain consumes tissue. A virtual stain consumes none. The original slide is preserved and can be virtually re-stained for any marker the model supports.
Retroactive analysis. Large public archives hold vast amounts of H&E imagery from many patients. These specimens are typically no longer accessible for new physical staining. Virtual staining permits retrospective marker analysis on these archives, opening cohorts that were previously closed to molecular pathology questions.
Underneath these four advantages is a more structural point. Physical staining is a per-slide, per-marker tax. Virtual staining converts that tax into a one-time training cost, after which marker imagery becomes a function call. The economics of pathology research change accordingly.
What virtual staining is not
The boundaries are worth stating explicitly. Virtual staining is not a primary diagnostic tool today. Regulatory pathways for AI-generated stains in clinical decision-making are immature, and most published models have been validated against ground-truth stains in research settings rather than deployed as standalone diagnostic outputs. The performance of any virtual stain is bounded by the quality and breadth of its training data, and out-of-distribution generalization remains the central open research problem in the field.
Pathologist review remains essential. Virtual staining accelerates research and broadens what is analyzable. It does not replace expert interpretation.
The open question
The hard problem is no longer whether a model can produce a convincing stain. It is whether the biological conclusions drawn from a predicted stain hold up against those drawn from a physical one. Validation studies that test exactly this are what will determine how far virtual staining can be trusted and how widely it can be used.
For researchers asking biological questions at scale, virtual staining is increasingly a practical route to markers that would otherwise be out of reach.