arXiv:2610.28339cs.CVOct 2026

Manuscript Offprint

arXiv:2610.28339

HistoLoop: Iterative Contextual Inference with a Looped Transformer for Histology-Based Spatial Gene Expression Prediction

Ziang Liu, Jie Liu, Shuai Li, Yigui Feng, Qinglin Wang

Abstract

Predicting spatial gene expression from H&E images offers a scalable complement to experimental spatial transcriptomics. However, despite progress in spatial context modeling, how to construct subsequent context from spot states updated by earlier contextual interactions remains underexplored. We introduce HistoLoop, a looped Transformer that formulates prediction as iterative contextual inference. At each refinement step, HistoLoop aggregates the current spot states into context tokens at the corresponding resolution, processes them with a shared spatial Transformer, and retrieves spot-specific contextual information through cross-attention. A memory-mediated update integrates this information into persistent spot states, which are then used to construct context at the next, finer resolution. Under the HEST-Bench HVG50 evaluation protocol, HistoLoop achieves the highest macro-averaged gene-wise Pearson correlation among the compared methods across six cancer-specific tasks spanning five organs in HEST-1K. Ablation studies support the importance of recurrent state refinement and reconstructing context from updated spot states at progressively finer resolutions. Expression-derived clustering further suggests that HistoLoop better captures spatially organized multigene patterns.

Introduction

Spatial transcriptomics (ST) profiles gene expression while preserving its spatial organization within tissue, enabling the characterization of spatial heterogeneity, tissue microenvironments, and cell–cell interactions (Stahl et al. 2016; Longo et al. 2021; Cang et al. 2023). However, current ST technologies remain costly and experimentally demanding, which limits their routine application to large cohorts and archival tissue collections (Moses and Pachter 2022). In contrast, hematoxylin and eosin (H&E)-stained whole-slide images are routinely acquired in clinical pathology and contain rich morphological signals associated with underlying molecular states (Schmauch et al. 2020). These complementary properties have motivated histology-based spatial gene expression prediction, which seeks to reconstruct spatially resolved transcriptomic profiles directly from standard H&E images (Zeng et al. 2022; Xie et al. 2023; Chung et al. 2024).

However, the mapping from local histological morphology to molecular state is inherently context dependent. Morphologically similar tissue regions may occur in distinct anatomical or pathological environments and exhibit different transcriptional programs, such that local appearance alone may provide an ambiguous basis for molecular prediction. Spatial context can help reduce this ambiguity by relating local morphology to its surrounding tissue organization. This motivates studying both the spatial evidence available to a predictor and how that evidence is incorporated into spot representations.

Recent methods have increasingly moved beyond isolated patch-level prediction by incorporating spatial relationships and broader tissue context. Hist2ST models both global and neighboring spatial dependencies through Transformer- and graph-based modules (Zeng et al. 2022), while TRIPLEX integrates target, neighborhood, and global tissue information across multiple resolutions (Chung et al. 2024). More recent hierarchical architectures further propagate information across spatial scales to enrich local representations (Wu et al. 2026). Together, these methods establish the importance of nonlocal context for histology-based spatial gene expression prediction. Building on these advances, we ask whether prediction benefits from coupling spot-state refinement with spatial context reconstruction. Specifically, updated spot representations can be reused to construct context at subsequent resolutions, allowing previously incorporated spatial evidence to influence later contextual messages. We investigate whether this recurrent coupling provides benefits beyond access to multiple spatial scales alone.

To investigate this question, we propose HistoLoop, a looped Transformer framework for iterative contextual inference. Starting from spot-level histological features and spatial coordinates, HistoLoop maintains a persistent representation for each spot. At each iteration, it constructs scale-specific context from the current spot states and processes this context with a shared spatial Transformer core. Spot-conditioned cross-attention retrieves the resulting contextual information, which is integrated into the persistent spot states through a memory-mediated update. These updated states provide the input for context construction at the next iteration, following a coarse-to-fine resolution schedule.

We evaluate HistoLoop on six cancer-specific tasks spanning five organs in HEST-1k (Jaume et al. 2024) under a

∗^{*}Corresponding author: Qinglin Wang (wangqinglin@nudt.edu.cn).

unified five-seed protocol. On the predefined 50-gene HEST-Bench subset, HistoLoop achieves a macro-averaged gene-wise Pearson correlation coefficient (PCC) of 0.480, compared with 0.435 for MoLF (Hu and Speidel 2026), the strongest evaluated baseline under the same protocol. Controlled ablations highlight the contributions of recurrent refinement, coarse-to-fine ordering, and state-dependent context reconstruction.

Our main contributions are summarized as follows:

• We introduce an iterative contextual inference perspective for histology-based spatial gene expression prediction, in which spot representations are recurrently refined and used to reconstruct spatial context for subsequent updates.

• We propose HistoLoop, a multi-resolution looped Transformer that couples spot-conditioned context retrieval with memory-mediated state updates under a coarse-to-fine refinement schedule.

• We evaluate HistoLoop on six cancer-specific tasks spanning five organs and conduct controlled ablations to examine the contributions of recurrent refinement, scale ordering, and state-dependent context reconstruction.

References (31)