Tsinghua University / PharMolix Inc. / Peking University
Spatial transcriptomics foundation model pairing gene-scale cell embeddings with an SE(2) Transformer over cell coordinates, pretrained on 88M cells.
SToFM is a foundation model for spatial transcriptomics (ST) that learns cell representations from three scales of tissue information at once: the gene expression profile of each cell, the micro-scale composition of its immediate neighborhood, and the macro-scale morphology of the slice it sits in. It was developed at the Institute for AI Industry Research at Tsinghua University with PharMolix and Peking University, and published at ICML 2025.
The gap it addresses is structural. Single-cell foundation models such as Geneformer and scGPT encode a cell's transcriptome but discard where that cell sits in the tissue; Nicheformer pretrains on ST data yet still encodes each cell independently. CellPLM was the first to combine expression with coordinates, but treats a tissue as a flat set of cells. SToFM's argument is that a slice carries information at several resolutions simultaneously, and that a model seeing only one of them loses the tissue architecture that makes ST worth generating.
The practical obstacle is scale: an ST slice can contain hundreds of thousands of cells, far past what pairwise attention can absorb. SToFM decomposes each slice into sub-slices of roughly 1,000 spatially contiguous cells and injects a compressed summary of the whole slice into every one of them, so local attention retains a view of global structure.
The cell encoder is a 12-layer transformer with hidden size 512, 8 attention heads, a 25,426-token gene vocabulary, and a 2,048-token context. The SE(2) Transformer above it is 4 layers with hidden size 256, taking up to 2,048 cell and virtual-cell tokens per sub-slice. Pretraining used SToCorpus-88M — approximately 2,000 high-resolution slices totaling 88 million human and mouse cells from six technologies (MERFISH, 10x Xenium, CosMx, SeekSpace, Stereo-seq, Slide-seqv2), about 1.6-fold larger than the previous largest ST corpus and covering twice as many technologies. Training ran one epoch of domain adaptation followed by three epochs of multi-scale representation learning on 4 NVIDIA A100 GPUs over roughly 20 days.
With head tuning on frozen embeddings, SToFM leads every reported task. On cross-slice tissue region segmentation it reaches macro F1 0.4588 on human embryo Stereo-seq slices versus 0.3985 for CellPLM, and 0.6437 on DLPFC 10x Visium layers versus 0.5953 — notable because Visium appears in no model's pretraining data. Cell type annotation on mouse brain gives macro F1 0.4951 and 0.8362 against best baselines of 0.4186 and 0.7575. Zero-shot Leiden clustering of embeddings on a MERFISH mouse brain slice scores ARI 0.953 / NMI 0.921, against 0.902 / 0.891 for CellPLM. Cross-slice spatial deconvolution on mouse liver reaches Pearson 0.7546, and gene imputation on human skin Xenium data 0.4877.
SToFM produces general-purpose cell embeddings that a lab can attach a linear or shallow head to for the standard ST analysis stack: annotating anatomical regions in developmental and neuroanatomical atlases, assigning cell types where sparse gene capture defeats expression-only methods, deconvolving spot-level data into cell type proportions, and imputing genes a targeted panel never measured. Because its margins are widest in the cross-slice setting, it suits transferring annotations across a slide series rather than relabeling each slice from scratch.
SToFM shows that explicit multi-scale decomposition, rather than a larger flat context, is an effective way to bring tissue architecture into ST representation learning, and its ablation confirms each scale contributes independently. The code is MIT-licensed, the pretrained cell encoder and SE(2) Transformer checkpoints are downloadable, and SToCorpus-88M is public, making the corpus itself a reusable asset for the field; the authors plan to fold the model into PharMolix's OpenBioMed toolkit. Limitations are acknowledged: the model spans only three scales, ignores histology images and ligand-receptor priors that could sharpen microenvironment modeling, and its evaluations rest on a handful of slices per task rather than large held-out cohorts.
Papers that recently cited this model.
The most-cited papers that cite this model.
Providers that host SToFM for inference, fine-tuning, or weight download.
No providers recorded yet. Browse all providers
Not enough data