Research
Learning Relative Gene Expression Trends from Pathology Images in Spatial Transcriptomics
Overview Research area: Computational pathology / computer vision applied to spatial transcriptomics — predicting gene expression from histopathology images. Technical level: Intermediate. The paper a
- arXiv
- 2512.06612
- Published
- 2025-12-07
- Authors
- Kazuya Nishimura, Haruka Hirose, Ryoma Bise, Kaito Shiku, Yasuhiro Kojima
AI summary
Overview
- Research area: Computational pathology / computer vision applied to spatial transcriptomics — predicting gene expression from histopathology images.
- Technical level: Intermediate. The paper assumes familiarity with loss functions (MSE, ranking losses), count distributions (binomial, multinomial), and standard deep learning training pipelines, but the central idea can be grasped without deep transcriptomics background.
- Scope: The paper proposes a new loss function family (STRank) that trains image-based models to predict relative gene expression rankings rather than absolute expression values, and evaluates it on synthetic and real spatial transcriptomics datasets.
What This Paper Is About
Spatial transcriptomics can measure gene expression at spots in a tissue while preserving spatial location, but it is expensive, so researchers want to estimate expression directly from pathology images. Existing methods train with pointwise losses such as mean squared error, which try to predict absolute expression values — a target that is corrupted by batch effects (differences in reagents, equipment, protocols) and stochastic noise from cell heterogeneity. The paper's goal is to sidestep absolute prediction entirely and instead learn the relative ordering of gene expression between patches from the same tissue, an objective the authors argue is both more robust and more useful for downstream analysis such as differential expression.
Key Contributions
- Task redefinition: The paper reframes gene expression estimation from pathology images as a rank score estimation problem, where the model
f: x^{n,i} → r^{n,i}outputs a scale-invariant score whose ordering matches the ordering of true expression within a tissue, rather than estimating raw expression values. - A noise-robust loss function (STRank): The authors introduce STRank in two forms — a pairwise version that models counts with a Binomial distribution, and a listwise version that models them with a Multinomial distribution — so the loss adaptively weights comparisons according to the relative magnitude of expression counts. A correction term using per-spot total expression
l^iis added to preserve the discrete count structure. - Synthetic validation of the hypothesis: Using controlled 1D synthetic data with known mean functions, known batch parameters, and negative-binomial noise, the paper isolates the effects of batch effects and stochastic noise on loss-function behavior.
- Real-data validation: The paper evaluates STRank against five baseline losses on seven HEST-1k datasets spanning Xenium and Visium platforms, plus a sparsity stress test and an analysis of the listwise group size
N^k.
Main Findings
- Relative learning beats pointwise learning on synthetic data: Under the uniform setting, MSE scored 0.748 SCC, Poisson 0.777, NB 0.788, Rank 0.835, PCC 0.858, PairSTRank 0.907, and ListSTRank 0.945. Under the imbalanced setting, MSE 0.583, Poisson 0.603, NB 0.601, Rank 0.738, PCC 0.560, PairSTRank 0.818, and ListSTRank 0.828. The proposed methods were best in both settings.
- Listwise outperformed pairwise on synthetic data: ListSTRank (0.945 / 0.828) exceeded PairSTRank (0.907 / 0.818), which the authors attribute to listwise learning capturing global expression patterns across a batch rather than localized pairwise comparisons.
- STRank leads on average in real data: Across IDC, PRAD, PAAD, COAD, READ, ccRCC, and IDC-L, the average SCC was ListSTRank 0.345, PairSTRank 0.343, PCC 0.326, MSE 0.306, Poisson 0.293, NB 0.244, and Rank 0.228.
- Real-data wins are not universal: The paper reports that STRank "did not consistently outperform alternatives across all conditions in real datasets." For example, PCC reached 0.640 on COAD versus 0.597 for ListSTRank and 0.613 for PairSTRank, and Rank reached 0.566 on COAD. The authors note that real-data evaluation itself is based on noisy observations.
- Robustness under simulated sparsity: When gene counts were downsampled with probabilities
p = {0.01, 0.05, 0.1, 0.2, 0.5, 0.8, 1}, both Pair and List STRank outperformed Rank and PCC at every downsampling rate, with the difference becoming significant at the most aggressive rate of 0.01. This experiment used the top 50 highest-mean-expression genes, since ground truth for low-expression genes is unavailable. - Group size
N^kmatters up to a point: IncreasingN^kbeyond 4 improved performance. ListSTRank scored 0.958 atN^k = 8in the uniform setting and 0.845 atN^k = 128in the imbalanced setting, with stable behavior reported atN^k = 8andN^k = 16. Larger values bring numerical instability and computational overhead, and performance was not monotonically increasing (e.g., 0.926 atN^k = 64in the uniform setting). - Theoretical link to classic ranking loss: The authors show analytically that when the score gap
r̂^i ≫ r̂^jis assumed, the pairwise STRank reduces to a form proportional tor̂^j_g − r̂^i_g, which with a margin and max operation recovers conventional hinge-based pairwise ranking loss. The full STRank is therefore described as a relaxed ranking loss that also accounts for count magnitude.
Methodology in Plain English
The researchers start from a simple observation: even if two labs measure a gene at different absolute levels, or a spot's count fluctuates randomly, the ordering — patch A has more of this gene than patch B — tends to hold. So instead of training a model to output a number that matches the measured expression, they train it to output a rank score, and they only compare patches drawn from the same tissue so cross-tissue scaling bias never enters the loss.
To make the comparison statistically principled, they treat the observed counts as the outcome of a counting process. For a pair of patches i and j, the total count for a gene across both spots (t = e^i + e^j) is known, and the question becomes how that total is split between them. That is exactly a binomial distribution, with the split probability produced by applying a softmax to the model's two rank scores. Training minimizes the negative log-likelihood of the binomial; the combinatorial term is constant and drops out, leaving a loss that sums −e^i log p̂^i − e^j log p̂^j over genes. Because the count values e^i and e^j appear as weights, highly expressed genes and unambiguous comparisons get more influence, while low-count, noisy genes are automatically down-weighted.
The listwise version generalizes this: instead of two patches, a group of N^k patches from the same tissue is assumed to follow a multinomial distribution, with probabilities from a softmax over all group members' scores. The resulting loss is a cross-entropy-like sum over genes and group members. A correction multiplies each softmax term by the per-spot total expression l^i, preventing standard normalization from turning discrete counts into continuous values.
For synthetic validation, they made a 1D toy problem where the true mean function is a sum of two sinusoids and observations are drawn from a negative binomial distribution. Two simulated "patients" had different batch scaling and offset parameters (α = 1, β = 0 versus α = 10, β = 10), and uniform versus imbalanced sampling of inputs was compared. For real-data evaluation, they froze a pathology foundation model (CONCH) as the feature extractor and trained only a single fully connected layer, so that any performance difference could be attributed to the loss function rather than to the architecture.
Why This Matters
This work argues that the field has been optimizing the wrong target. Absolute gene expression values are unreliable across experiments, but relative trends are not, and relative trends are what most downstream biological analyses actually consume. That reframing could make image-based expression prediction cheaper and more transferable across hospitals and platforms, which matters because spatial transcriptomics remains costly enough that it cannot be run at scale.
Real-world applications:
- Cancer diagnostics from routine slides: Estimating cancer-specific gene expression trends from H&E images without sequencing could flag tumors that would benefit from gene-targeted therapy.
- Biomarker discovery and differential expression: Because rank scores directly encode relative expression between patches, they plug into differential expression workflows that compare cell clusters or tumor regions.
- Cross-institution research collaboration: Batch-robust training targets could let models trained at one hospital transfer to another with different scanners or reagent lots.
- Low-resource settings: Reducing sequencing cost by image-based inference could widen access to transcriptomic insight in labs that cannot afford full spatial assays.
Industry relevance: Pharmaceutical and diagnostics companies investing in digital pathology and companion diagnostics have direct interest in image-only prediction of expression, especially if it degrades gracefully across cohorts and platforms.
Future Directions
- Explaining the real-data gaps. The authors state explicitly that the fundamental reasons why STRank fails to outperform conventional losses on some datasets have yet to be elucidated, and that rigorous evaluation on real data remains an open challenge.
- Making sparsity work in practice. STRank succeeded in the simulated downsampling experiment but the authors report they could not confirm its effectiveness in a sparse situation of a real dataset (Supplementary D), so reconciling these two results is an open problem.
- Multi-cohort robustness. In settings where samples come from different hospitals and procedures, the paper reports limitations with a large number of genes, because batch effects in expression are amplified and pathology images are themselves affected by imaging-condition batch effects. The authors call for more robust and generalizable approaches.
- Convergence and efficiency at scale. STRank converges more slowly than PCC on single-patient data, and large
N^kvalues introduce numerical instability and computational overhead — suggesting room for better optimization strategies and scaling behavior.
Target Audience
This paper is most useful to machine learning researchers working on computational pathology and spatial transcriptomics, particularly those designing loss functions or training objectives for image-to-expression prediction. It also benefits bioinformaticians interested in batch-effect mitigation, computational biologists evaluating whether image-based expression estimation is reliable enough for downstream analysis, and practitioners in digital pathology or pharma who want to understand the trade-offs between absolute and relative prediction targets. Readers primarily seeking biological findings will find little here — the contribution is methodological.
Authors’ abstract
Gene expression estimation from pathology images has the potential to reduce the RNA sequencing cost. Point-wise loss functions have been widely used to minimize the discrepancy between predicted and absolute gene expression values. However, due to the complexity of the sequencing techniques and intrinsic variability across cells, the observed gene expression contains stochastic noise and batch effects, and estimating the absolute expression values accurately remains a significant challenge. To mitigate this, we propose a novel objective of learning relative expression patterns rather than absolute levels. We assume that the relative expression levels of genes exhibit consistent patterns across independent experiments, even when absolute expression values are affected by batch effects and stochastic noise in tissue samples. Based on the assumption, we model the relation and propose a novel loss function called STRank that is robust to noise and batch effects. Experiments using synthetic datasets and real datasets demonstrate the effectiveness of the proposed method. The code is available at https://github.com/naivete5656/STRank.