Spatial Cell-Guided Pretraining for Scalable Spatial Transcriptomics Foundation Model

Jing Gong, Yixuan Wang, Nicholas Ho, Xingyi Cheng, Le Song, Eric P. Xing

TL;DR

AIDO.Tissue is a spatial transcriptomics foundation model that pretrains on paired single-cell spatial and gene expression data by treating neighboring cells much like Multiple Sequence Alignments (MSAs) in protein modeling. By introducing an asymmetric encoder-decoder that attends to cross-cell gene dependencies, the framework demonstrates that increasing spatial neighborhood context yields significantly greater performance gains than simply scaling model parameter size.

What Problem Does This Paper Address?

While single-cell foundation models (such as scGPT or Geneformer) have advanced our understanding of cellular biology, they are overwhelmingly pretrained on dissociated cell suspensions—stripping away all spatial context. In intact tissue, cell function and identity are dictated by physical microenvironments and cell-cell communication.

Emerging spatial foundation models like CellPLM and Nicheformer attempt to incorporate spatial information, but they typically process each sample centered on a single cell or lack gene-level, cross-cell attention. This prevents them from capturing the fine-grained, inter-cellular regulatory patterns that drive tissue organization.

Methods

AIDO.Tissue formulates spatial transcriptomics pretraining using an architecture inspired by MSA-based protein models:

[Center Cell + k Nearest Neighbors] 
        │
        ▼
[Column-wise Masking] ── (prevents trivial copying of neighbor gene values)
        │
        ▼
[Encoder (Sparse)] ───── (processes ONLY expressed genes across all cells)
        │
        ▼
[Decoder (Targeted)] ─── (reconstructs ONLY the center cell's expression)
  1. Neighborhood Retrieval: For every center cell, its $k \in \{8, 16, 32, 64\}$ nearest neighbors are identified in 2D Euclidean space and stacked into a joint multi-cell input matrix.
  2. Column-Wise Masking: Pretraining uses masked expression value prediction. To prevent the model from trivial "copy-pasting" the target gene's value directly from an unmasked neighbor, entire columns (the same gene across all neighbors and the center cell) are masked simultaneously.
  3. Embeddings: Each gene is embedded using the sum of its gene identity embedding, an MLP projection of its normalized expression value, and a 2D rotary positional embedding capturing both the gene index and cell index.
  4. Asymmetric Encoder-Decoder:
  5. Encoder: Keeps and processes only expressed (non-zero) genes across the center cell and its neighbors. This sparse self-attention captures cross-cell, gene-to-gene interactions while keeping quadratic attention costs manageable.
  6. Decoder: Discards neighbor tokens and inputs only the center cell's latent vector (along with masked/zero tokens) to reconstruct the full expression profile using Mean Squared Error (MSE) loss on masked entries.

Datasets

  • Pretraining: A curated corpus of approximately 21.7 million cells across 76 slides from three major spatial imaging and sequencing platforms:
  • Vizgen / MERSCOPE (19 slides, ~9.3M cells)
  • NanoString / CosMx (12 slides, ~1.7M cells)
  • 10x Genomics / Xenium (45 slides, ~10.7M cells)
  • Downstream Evaluation:
  • CosMx Human Liver Dataset: Benchmarked for cell type classification (22 cell types) and spatial niche classification (6 microenvironments).
  • Xenium Human Lung Dataset: Benchmarked for cell density prediction (estimating cell type proportion within a local radius).

Key Insights and Ideas

  • Spatial Context Trumps Model Size: When systematically scaling both parameter count (3M vs. 60M) and neighborhood size ($k = 8$ to $64$), increasing neighbor count drove substantial gains across downstream tasks, while scaling model parameters yielded only marginal improvements. In spatial transcriptomics, data context richness matters more than raw parameter capacity.
  • Gene-Level Inter-Cell Attention is Feasible: Standard attention over all genes across tens of neighboring cells would explode token lengths ($>10^5$). By restricting the encoder to non-zero expressed genes and having the decoder only reconstruct the center cell, full gene-to-gene cross-cell modeling becomes computationally scalable.

Key Results

AIDO.Tissue was evaluated against state-of-the-art baselines Nicheformer and CellPLM:

  • Cell Type Prediction: Achieved an F1 score of 0.7726, outperforming CellPLM (0.7580) and Nicheformer (0.7324).
  • Niche Type Prediction: Displayed a dramatic improvement, boosting the macro F1 score to 0.7503 compared to CellPLM (0.5209) and Nicheformer (0.5029), cleanly delineating tissue microenvironment zones (e.g., periportal vs. pericentral liver zones).
  • Cell Density Estimation: Reduced Mean Absolute Error (MAE to 4.5830), compared to CellPLM (5.9262) and Nicheformer (7.0841).

Limitations and Future Work

  • Model Scale Ceiling: The authors investigated models only up to 60M parameters; whether billion-parameter regimes exhibit different scaling dynamics in the presence of even larger spatial context remains untested.
  • Dimensionality: The formulation currently relies on 2D coordinates; extension to 3D volumetric spatial omics was not explored.
  • Platform Heterogeneity: Differences in gene panel sizes across platforms (targeted panels vs. whole-transcriptome approaches) can bias the input sparsity, an area requiring further standardization.

Summary updated

BibTeX
@inproceedings{gong2025spatial,
  author = {Jing Gong and Yixuan Wang and Nicholas Ho and Xingyi Cheng and Le Song and Eric P. Xing},
  title = {{Spatial Cell-Guided Pretraining for Scalable Spatial Transcriptomics Foundation Model}},
  booktitle = {GenBio @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=ywMEiJyV0m},
}
Figure