2026-08-10
A self-supervised spatial-transcriptomics foundation model trained on 112M cells, TERRA yields gene, cell, and neighborhood embeddings for zero-shot niche ID and in-silico gene knockout.
Spatial transcriptomics maps gene expression at cellular and even subcellular resolution, showing how cells assemble into multicellular niches. But analysis after the fact has stayed a one-dataset-per-pipeline affair: swap in new samples or a new sequencing platform and you re-tune, re-annotate, and produce conclusions that do not transfer across studies. Worse, most tools describe what is there; none can predict what happens to a tissue if you knock out a gene.
Single-cell sequencing already has foundation models like Geneformer and scGPT that learn transferable representations from dissociated cells. But dissociation erases where each cell sat and who its neighbors were. Existing spatial foundation models tend to work at one scale, lean on dataset-specific training, or drop gene-level resolution, and independent benchmarks show their zero-shot embeddings are sometimes matched by simple baselines while their perturbation predictions lose to linear models. TERRA targets that gap: a model pretrained on hundreds of millions of real spatial profiles, usable zero-shot across tissues, retaining gene, cell, and neighborhood scales at once, and able to predict perturbations in place.
The pretraining corpus, HST-Corpus-112M, holds 112 million single-cell-resolved human spatial transcriptomic profiles from 636 tissue sections across five imaging-based assays (Xenium, MERFISH, CosMx, STARmap, ISS CARTANA), spanning 20 tissues and 26 disease conditions. To keep training and evaluation separate, the authors trained two versions: TERRA-112M on the full corpus for in-corpus analysis, and TERRA-96M with 215 sections held out for zero-shot benchmarking.
Two design choices do the heavy lifting. First, a spatially aware tokenization represents each gene as a four-part token: the gene symbol, its expression value, its within-cell expression rank, and the cell's distance rank in the neighborhood. Encoding rank and value together gives a scale-free normalization that tolerates library-size and sensitivity differences, while preserving the quantitative signal that rank alone throws away. Second, pretraining uses JEPA, a joint-embedding predictive architecture: keep some gene tokens as context, mask the rest as targets, and predict the masked tokens in latent space rather than reconstruct raw counts. That choice targets the real properties of spatial data, which is sparse, noisy, and gathered on inconsistent gene panels. Reconstructing noise is pointless; capturing stable microenvironmental structure is the goal.
A lightweight batch metatoken, fed to both context and target streams during training and padded at inference, integrates data across assays without any explicit batch correction. Ablations show that removing it collapses cross-assay mixing.
Evaluation spans four escalating hold-out levels: unseen sample, donor, dataset, and assay. On zero-shot niche identification, TERRA posts the highest NMI on every held-out dataset against four spatial foundation models (CellPLM, Nicheformer, scGPT-spatial, Novae).
| Task | Setting | Result |
| Niche ID | zero-shot, held-out datasets | highest NMI on each |
| Niche label transfer | multi-patient skin, held-out patients | beats spatial FMs; fine-tuning adds little over linear probe |
| Cross-platform | 10x Visium embryo, 52 sections, LoRA on 42, eval on 10 | both zero-shot and LoRA beat scGPT-spatial |
| Cell-type ID | held-out datasets | on par with strongest spatial FM |
| Disease classification | eczema vs psoriasis, patient/sample level | comparable to best model |
The perturbation result is the most substantial. On untreated kidney sections, in-silico knockout of immune-checkpoint blockade (ICB) target genes predicts a 23-gene nephrotoxicity signature. That signature is validated in kidney cortex exposed to long-term ICB, where it maps to lymphocytic infiltrates; it is recovered in peripheral-blood mononuclear-cell scRNA-seq; and it is upregulated in patients with clinically confirmed ICB-related kidney injury. This closed loop of predicting on untreated tissue, validating on treated tissue, and recovering in blood is one of the paper's hardest results.
On a nine-organ, 28-million-cell subset, TERRA distills macrophage neighborhoods into six recurring cross-organ archetypes. One, enriched for macrophages and fibroblasts and remodeling the extracellular matrix, is prognostic in an independent kidney-cancer cohort and sits at the RCC pseudocapsule, an established anatomical structure.
For computational biology and AI4Science, TERRA is an attempt to move spatial transcriptomics from bespoke per-paper pipelines to a reusable pretrained substrate, the way ESM is for proteins and AlphaGenome for the genome. A single model emitting gene, cell, and neighborhood embeddings means one forward pass covers cell identity, gene programs, and tissue microenvironment, without a separate trained model per task.
For drug development, the virtual knockout has practical value: before running a real experiment, you can prescreen on in-situ tissue what cellular and microenvironmental response a target perturbation would trigger. The ICB nephrotoxicity case runs that chain from prediction to clinical sample. It is an early-signal tool that saves experiments, not a replacement for them.
The authors are explicit: pretraining uses only imaging-based assays with targeted gene panels, so gene coverage is constrained (though LoRA adapts it to sequencing platforms like 10x Visium); neighborhoods are a fixed k-nearest-neighbor graph; naming niches and gene programs still needs expert interpretation; evaluation leans on imperfect reference annotations that may understate the true quality; and the pancreas and kidney zero-shot analyses are small donor cohorts that cannot fully account for sex or inter-patient variability.
Two things stand out as worth questioning. First, the evaluation ceiling: NMI and similar metrics depend on reference labels that are themselves incomplete, so "highest NMI" in a high-scoring regime may not mean a meaningful lead, a point the paper concedes. Second, the boundary of the perturbation result: the authors frame it as a complementary first step, acknowledging that spatial perturbation data is scarce, so the in-silico knockout extrapolates from a large observational corpus rather than learning perturbation responses from dedicated screens the way dissociated-cell models do. It closed the loop on the 23-gene nephrotoxicity case, but generalization to other genes and settings is unproven.