Therapies that "reprogram" tumor-associated macrophages aim to flip them from a tumor-protecting state (often called M2) to a tumor-attacking state (M1). Whether a drug did this is increasingly judged from spatial transcriptomics, which measures gene expression at known positions in a tissue slice. The claims that matter most are often about small tissue neighborhoods with only a handful of macrophages. Examples are a hypoxic hub at an invasive edge, or the M1 cluster that the PAZ@Fe-MOF study could barely analyze because so few cells were recovered (Determining M2 macrophages content…). These are exactly the places where current tools are least trustworthy. A hierarchical Bayesian model of polarization across neighborhoods is the natural way to borrow strength from data-rich niches for sparse ones. That model, however, produces a "funnel" posterior: a probability landscape that is very wide where a niche's variance is large and very narrow where it is near zero. Standard samplers handle funnels badly, so practitioners fall back on point estimates or variational approximations, and those shrink the error bars in the sparse niches.
The proposal is to build an explicit hierarchical model of within-macrophage polarization shifts across spatial niches, and to fit it with a sampler whose step size adapts locally to the funnel. The goal is calibrated credible intervals for "how much did macrophages in this niche shift toward M1 or M2, and how sure are we." The sampler is AutoStep-style: the step size is treated as part of the sampler's state and halved or doubled at each move. The deliverable is a posterior that says honestly when a sparse niche does not support a reprogramming claim, together with posterior-predictive counterfactuals of the kind MintFlow produces, but with uncertainty attached.
Core Claim
Hierarchical polarization models, where niches range from hundreds of macrophages down to a few, have mixed geometry. Data-rich niches favor a "centered" parameterization, in which niche effects are written directly. Sparse niches favor a "non-centered" one, in which niche effects are written as standardized noise times a scale. No single global step size or parameterization serves both. A sampler that adapts its step size to the local curvature at every move should give nominal-coverage credible intervals in sparse niches, at a cost per effective sample comparable to tuned alternatives. Hamiltonian Monte Carlo with its no-U-turn variant (NUTS), mean-field variational inference, and empirical-Bayes plug-ins should all under-cover in those niches. The claim is falsifiable: if NUTS with a well-chosen parameterization matches the adaptive sampler's coverage, the sampling contribution disappears, and only the modeling contribution remains.
Model
For each spot $s$, deconvolution gives an estimated macrophage abundance $a_s$. Each spot is also assigned to a niche $k(s)$, using Starfysh-style hubs or BayesTME segments. Macrophage-attributable counts of gene $g$ follow a negative binomial distribution. Its mean is a baseline macrophage profile plus $z_s w_g$, where $w_g$ is a gene loading on a single polarization axis and $z_s$ is the spot's polarization score. The score is modeled as $z_s \sim \mathcal{N}(\mu_{k(s)}, \sigma_{k(s)}^2)$, with niche means $\mu_k \sim \mathcal{N}(\mu_0, \tau^2)$. The niche scales $\sigma_k$ get half-Cauchy priors. These niche scales are what create the funnel.
The sign of the axis is fixed by a prior that forces positive loadings on established M2 markers such as Mrc1, Cd163 and IL-10/TGF-β pathway genes (Tumor-Associated Macrophages). This is a cheap, biologically grounded answer to the sign-flip problem that Projected Bayesian Spatial Factor Models leaves to post-hoc relabeling. With one anchored axis, flipping is impossible within the chain, which matters because a flip would literally swap the pro-tumor and anti-tumor readings. A spatial Gaussian process on $z_s$, approximated with nearest neighbors as in PBSF for $O(n)$ cost, is an optional extension rather than the core.
The scientific readouts are posterior contrasts between niches, such as "MBC hypoxic hub vs. ER⁺ stroma," and counterfactual predictions. For a counterfactual, we change a niche's covariates, for example by removing Treg abundance, and propagate full posterior uncertainty into the predicted $z$. This is the Bayesian analogue of MintFlow's virtual macrophage deletion (MintFlow).
Relation to Prior Work
Four papers already connect probabilistic modeling to the tumor microenvironment, and each motivates a different part of this design. BayesTME builds a reference-free hierarchical model with within-cell-type spatial programs. It fits that model by multi-stage empirical Bayes, so its niche-level variances are point estimates. We keep its negative-binomial observation model but sample the variances, because their uncertainty is exactly what is lost in sparse niches. Starfysh finds M2-rich hypoxic hubs in breast cancer using a variational autoencoder. We reuse its hubs and data as the niche definition. We do not reuse its mean-field inference, which is known to understate variance. MintFlow shows that predicting reprogramming from neighbor composition is biologically useful. It gives no credible intervals; we give up its expressive neural flow in exchange for an interpretable model whose uncertainty can be checked. PBSF/ProjMC² shows that geometry-aware MCMC can scale to roughly 70k cells. It reports that fixing the geometry raised median effective sample size from 103 to over 7,000. That paper addresses rotational non-identifiability of factor models in healthy kidney; ours addresses scale-funnel geometry in tumor niches.
On the sampling side, AutoStep supplies the method. It is an involutive MCMC scheme with step size as an auxiliary state, exactly invariant for the target, which recovers from initial step sizes 14 orders of magnitude off and out-samples NUTS on Neal's funnel. SA-SGLD supplies a minibatch fallback for whole-slide scale. It rescales time by the gradient norm, and it stayed stable under sharp horseshoe priors where plain SGLD diverged. The known costs of AutoStep act as constraints on the design. Its doubling/halving search needs several density evaluations per step, and local adaptation of a full metric is too expensive. We therefore adapt only a scalar step on a diagonally preconditioned target, and we report cost per effective sample rather than per iteration.
Research Program
The work has three stages. The first is semi-synthetic ground truth. We take real macrophage-containing spots from the Starfysh breast cohort, plant known niche-level polarization shifts, and thin macrophage counts per niche from about 200 down to about 3. The thinning mimics the sparse-cluster regime of the PAZ@Fe-MOF study. Simulation protocols follow the deconvolution benchmark of Sacchi-style comprehensive benchmarking so that deconvolution error propagates realistically.
The second stage runs every inference method on identical data and measures calibration. The core test is simulation-based calibration and the empirical coverage of 90% intervals for $\mu_k$ and for niche contrasts, stratified by macrophage count. The third stage fits the real data and checks the posterior against known biology. That data comprises the 14 Starfysh biopsies (>37,000 spots), the BayesTME melanoma sections, and the healthy Xenium kidney from PBSF as a negative control, where niche polarization contrasts should be near zero.
Baselines
The naive reference point is per-niche pooling. We average marker-based M2 scores within each niche and attach bootstrap intervals, which is what many reprogramming papers implicitly do. It should be badly overconfident or undefined in niches with three cells, and any principled method must beat it on sparse-niche coverage.
The strongest competitor is NUTS in Stan on the same model. We tune its parameterization carefully, running it centered, non-centered, and with a per-niche choice of parameterization based on data size. Each variant gets the same number of gradient evaluations as our sampler and the same warmup budget. This is the real threat, because reparameterization is the standard fix for funnels. No reported result found on Lacuna for NUTS on a spatial macrophage-polarization model. The closest reported evidence is AutoStep's qualitative out-sampling of NUTS on 2D and 100D funnels, which gives no single headline number in the file. Beating NUTS means coverage of the 90% interval within a few points of nominal in niches with fewer than ten macrophages, where NUTS shows divergences or under-coverage, at equal or better effective samples per gradient evaluation. Matching NUTS on rich niches is required, not optional.
The variational baseline is mean-field inference on the same model, plus Starfysh's own pipeline for niche-level estimates. On simulated deconvolution Starfysh reports R² = 0.85 and Pearson correlation 0.93 (Starfysh). We expect comparable point accuracy but lower interval coverage. The empirical-Bayes baseline is a BayesTME-style plug-in that fixes $\sigma_k$ at its estimated values. MintFlow with a five-member deep ensemble provides uncertainty for the counterfactual-prediction comparison only.
Two ablations isolate the key ingredient. The first replaces local step adaptation with a single globally tuned step, as in MALA with Robbins–Monro tuning, plus global covariance adaptation. The second removes the marker-anchored sign prior and measures how often the polarization axis flips within a chain.
Why not just…?
Why not just use NUTS with a non-centered parameterization? This is the most serious alternative and may succeed when all niches are similarly sparse. Our argument is that real tumor slides mix data-rich and data-poor niches, so either global parameterization is wrong for some of them. The data-size-based mixed parameterization baseline is included precisely to test this. If it reaches nominal coverage at similar cost, we will report that the sampling contribution is unnecessary. The paper then becomes a modeling and calibration study, recommending per-niche reparameterized NUTS.
Why not just use variational inference, as Starfysh does, and inflate its intervals? Mean-field approximations under-represent posterior variance in hierarchical scales. No fixed inflation factor is right in both rich and sparse niches. Coverage curves stratified by macrophage count will show directly whether a constant correction suffices.
Why not just add ensembles to MintFlow for uncertainty? Ensembles capture disagreement among trained networks, not uncertainty arising from few observed cells. MintFlow also reports sensitivity to dropout (MintFlow). We will compare counterfactual interval coverage on planted perturbations. If ensembles cover nominally, the case for an explicit Bayesian model rests only on interpretability, and we will say so.
Why not just use empirical Bayes, as BayesTME does? Plugging in estimated niche variances ignores their uncertainty. That is harmless when there are many cells per niche and harmful when there are few. The planted-shift simulation quantifies exactly when it matters.
Proposed Experiments
The decisive experiment is the coverage curve: empirical coverage of 90% intervals for planted niche shifts, plotted against macrophage count per niche, for all methods. We also report effective samples per gradient evaluation, divergence or failure rates, and wall-clock time. The proposal succeeds if the adaptive sampler stays near nominal coverage down to roughly five cells per niche while NUTS variants and variational inference drop below it. It must do this without exceeding the PBSF-scale budget of hours on a single machine for tens of thousands of spots.
As a sampler sanity check, we rerun AutoStep's funnel benchmarks inside our codebase before touching tissue. On real data, three checks apply. The posterior should place high probability on stronger M2 shift in metaplastic-breast-cancer hypoxic hubs than in ER⁺ stroma, consistent with Starfysh's findings. It should place near-zero contrasts on healthy kidney. And it should give held-out-gene predictive log-likelihood at least as good as the empirical-Bayes fit. Finally, we pose a MintFlow-style counterfactual on the breast data, removing Treg-rich neighbors from M2 hubs. We report whether the predicted shift toward M1 is credibly nonzero once the uncertainty in sparse niches is taken into account. That is the question reprogramming studies need answered before trusting an in silico claim.
References
- Determining M2 macrophages content for the anti-tumor effects of metal-organic framework-encapsulated pazopanib nanoparticles in breast cancer
- Tumor-Associated Macrophages: Recent Insights and Therapies
- Projected Bayesian Spatial Factor Models
- Mapping and reprogramming human tissue microenvironments with MintFlow
- BayesTME: A unified statistical framework for spatial transcriptomics
- Starfysh reveals heterogeneous spatial dynamics in the breast tumor microenvironment
- AutoStep: Locally adaptive involutive MCMC
- Adaptive Stepsizing for Stochastic Gradient Langevin Dynamics in Bayesian Neural Networks
- A comprehensive benchmarking with practical guidelines for cellular deconvolution of spatial transcriptomics