Multicellular Transformer: learning contextual gene embeddings
A while ago, we asked ourselves a question: could we learn representations of genes that capture not only what happens within cells, but also how genes relate to one another across cells? And could these representations be contextual, changing depending on the biological environment?
In our bioRxiv paper, we introduce the Multicellular Transformer (MCT), a model we developed in Genentech’s AI for Biology & Translation (AIBT) department to address these questions. MCT takes a population of cells from a sample and learns contextual gene embeddings that capture relationships among genes both within and across cells, reflecting the sample’s multicellular environment.
In this post, I’ll walk you through why we wanted these representations, how we built MCT to address these questions, and two results I find particularly exciting.
Why genes and context?
Why gene embeddings?
Whether we’re working with tissue-level data (e.g., bulk RNA-seq) or cell-level data (e.g., single-cell RNA-seq), we’re often ultimately interested in gene-level information—especially in drug target discovery. Genes and their protein products are actionable and testable: we can knock them out, overexpress them, or otherwise perturb their activity. A cell cluster or tissue phenotype is harder to target directly, while a gene or protein gives us something more concrete to act on.
So why go through the hoops of learning tissue- or cell-level embeddings, rather than going directly to genes?
Why contextual?
Gene relationships aren’t necessarily fixed. Take TGFB1: in healthy epithelial tissue, TGF-β signaling helps regulate cell proliferation, while in cancer it can promote epithelial-to-mesenchymal transition (EMT), tissue remodeling, and immune suppression. We’d want the gene’s representation to reflect these differences, rather than assigning it one fixed set of relationships across every sample.
We could condition representations on predefined labels, such as disease or tissue type, but these labels don’t capture the full diversity of individual samples. Instead, we let the cell population define the context. The cells present in a sample, along with their gene expression, provide information about its multicellular environment.
Single-cell RNA sequencing (scRNA-seq) is a natural fit for this: it measures expression across individual cells, preserves cellular heterogeneity, and is widely available across tissues and diseases.
How MCT works
1. Represent each gene across a cell population
The key idea was to treat the entire sample (cell population) as a single observation, similar to a set. We also needed to make a mental switch and think of genes as observations rather than features. The features are the expression of each gene across the cells in the sample.
We started with a pretraining corpus of over 14 million cells across 4,200 samples, harmonized the cell type labels, and assigned fixed input slots to each cell type based on its abundance in the corpus. For example, with 1,024 slots, if macrophages made up 5% of the cells, roughly 51 slots would be reserved for macrophages. For each sample, we randomly sampled cells to fill these slots, padding with zeros when needed. This gave us a vector for each gene describing its expression across the cell population.
2. Let genes exchange information
The workhorse of the model is a transformer. For each gene, we want to capture both its identity and how it is expressed across the cell population. We therefore combine a learned gene identity embedding with an expression embedding produced by a two-layer MLP. Together, these form what we call multicellular gene embeddings; notably, these are not yet contextual.
To make the embeddings contextual, we feed them to a 12-layer transformer encoder. Through self-attention, each gene can incorporate information from other genes, allowing the model to learn cross-cell (intercellular) relationships—for example, between a ligand expressed in one cell type and its receptor in another. The resulting embeddings reflect both the cell population and the other genes in the sample.
3. Learn by reconstructing expression and predicting identity
We trained the model with two objectives:
- Gene expression reconstruction: Reconstruct each gene’s expression across the cell population from its contextual embedding.
- Masked gene identity prediction: Inspired by BERT, we selected 15% of genes, masking their identity (70%), masking their expression (10%), replacing their identity with a random one (10%), or leaving them unchanged (10%). The model then predicted the original gene identity.
By hiding parts of a gene’s information, we encourage the transformer to use other genes to infer what’s missing. Since each gene already carries expression information across cells, the model can learn relationships between genes that extend beyond individual cells.
The paper contains several results, but we’ll highlight two of my favorites here:
- Predicting ligand-receptor interactions from gene embeddings, a task relevant to cell–cell communication.
- Identifying disease-associated changes in gene relationships using contextual embeddings.
Example 1: Predicting ligand–receptor interactions
In this task, we try to identify which ligands pair with which receptors. I like this task a lot because it’s often inherently cross-cell: a ligand produced by one cell can bind to a receptor on another.
For ligand-receptor prediction, we’re actually not going to use the contextual embeddings. Instead, we extract static, zero-shot gene embeddings from the gene identity classifier weights. While whether a ligand and receptor actually interact depends on the biological context, their underlying ability to interact is often conserved. We’d therefore expect some of these relationships to be captured during pretraining, regardless of the particular sample.
We compute cosine similarity between the respective embeddings of each ligand and receptor, derived from the final gene identity classifier weights. We do this for known ligand-receptor pairs and for a set of randomly sampled negative pairs (which may include interactions not yet known). We then calculate the AUROC to see whether known ligand-receptor pairs tend to be closer in embedding space than sampled negative pairs.
MCT outperformed all the evaluated foundation model baselines, reaching an AUROC of 0.71, compared with 0.65 for the second-best model, scGPT. Interestingly, this includes CellPLM, which also incorporates multicellular information, but primarily learns cell-level representations rather than gene-level ones.
Figure 2. Gene embedding benchmarks: ligand–receptor and transcription factor–target relationships. Bars show mean AUROC; error bars show standard deviation across negative-sampling seeds. The co-expression baselines are from a separate local evaluation, so pair coverage may differ.
We also wanted to know whether learning cross-cell relationships came at the expense of relationships within cells. As a comparison, we evaluated transcription factor–target relationships (TF regulons): transcription factors regulate the expression of other genes within the same cell. This gives us a useful within-cell task to test whether MCT also captures intracellular gene relationships. MCT performed comparably to existing methods on this benchmark, with only small differences in AUROC, suggesting that learning multicellular relationships doesn’t necessarily mean sacrificing intracellular ones.
Example 2: Context-aware gene embeddings reveal disease-associated gene relationships
For the second result, we turn to the contextual gene embeddings. Unlike the static embeddings used above, these are produced for each sample, so the representation of a gene can change with the cell population it is embedded in.
We used single-cell data from patients with systemic lupus erythematosus (SLE), an autoimmune disease, and from healthy controls. We wanted to find genes whose relationships with other genes changed between health and disease.
For each sample, MCT produces a contextual embedding for each gene included in the sample. We can then look at a gene’s nearest neighbors: the genes with the most similar embeddings in that sample. Together, these neighbors give us a picture of the gene’s learned relationships in that multicellular context, including relationships that may span cells.
We compared these neighborhoods across samples. A gene stood out if its neighbors were similar among samples from the same condition, but different between healthy and SLE samples. This suggests that the gene’s relationships change with the disease context.
For the comparison, we measured neighborhood overlap using Jaccard similarity. We used each gene’s 20 nearest neighbors for comparisons within a condition and the 40 most common neighbors in each condition for comparisons between conditions.
OAS2: a changing gene neighborhood
One of the genes that emerged in our SLE example was OAS2, an interferon-stimulated gene involved in the antiviral response and associated with immune dysregulation in SLE. Its embedding neighborhood changed between healthy and diseased samples, with a neighborhood enriched for interferon-inducible genes, suggesting a shift in its relationships with other genes.
Figure 3. Conceptual gene neighborhoods, the observed OAS2 patient heatmap, and the reported overlap with differential expression.
What MCT adds
A change in a gene’s relationships doesn’t necessarily mean a change in its expression. OAS2 was identified through changes in its embedding neighborhood despite relatively modest expression differences.
When we compared our top 20 SLE-associated genes against conventional differential expression analysis, only 40% overlapped. In other words, the two approaches highlighted partly different sets of genes. This suggests that contextual embeddings can provide information beyond what we’d obtain by looking at expression changes alone.
🌱 Looking ahead
We think MCT is a first step toward representing genes in the context of the multicellular environments they’re part of. By treating the tissue sample as a population of cells, rather than looking at cells in isolation, we hope this approach will help us better understand how genes relate to and coordinate with one another across cells, and generate testable hypotheses about tissue biology and disease. There is still much to improve, and we’re excited to see how these ideas develop.
Acknowledgments
This work was carried out in Genentech’s AI for Biology & Translation department. A big shoutout to Maciej Wiatrak, our excellent intern who spearheaded this project and brought so many creative ideas to it, and to Aicha BenTaieb, the PI who oversaw the project.
Wiatrak, M., Andersson, A., Hoi, K. H., Biancalani, T., & BenTaieb, A. Learning gene co-regulation across cells with Multicellular Transformer. bioRxiv (2026). https://doi.org/10.64898/2026.11.14.766251