Certified Ranges for Cell-Type Proportions in Spatial Transcriptomics

Spatial transcriptomics measures gene expression at fixed spots on a tissue slice. Each spot pools RNA from many cells, so computational deconvolution must estimate which cell types each spot contains, using a single-cell reference atlas. Every widely used deconvolution method returns one best-guess proportion per cell type per spot. Real tissue, however, has no ground truth for checking that guess. When two reference cell types have nearly identical expression profiles, many different mixtures explain a spot equally well, and the method's point estimate is effectively arbitrary. We propose to compute, for every spot and every cell type, the full range of proportions consistent with the observed counts up to measurement noise. Each end of the range comes with a mathematical certificate that it is valid. The output is a pair of numbers that says what the data can and cannot distinguish: "this spot is 30–35% astrocyte" or "anywhere from 5% to 60% macrophage."

The connection to learned optimization is direct. Methods that train neural solvers without solver-computed labels rely on the fact that checking an answer is much cheaper than finding one. Duality from convex optimization sharpens that idea. A dual point is a set of multipliers attached to the constraints, and any such point gives a valid bound on the best achievable objective, computable in closed form. We train a network to output these multipliers, with the bound itself as the loss. Because each bound is verified at inference time, a badly trained network can only produce looser ranges, never wrong ones. That property is what makes it safe to amortize millions of small optimization problems across the 10^5–10^6 spots of high-resolution platforms. It is also safe to let a spatial graph network share information across neighbouring spots without risking the boundary leakage that afflicts spatial smoothing.

Core Claim

The claim has two parts, and the first is the scientific one. Per-spot identifiability ranges, defined as the minimum and maximum of each cell-type proportion over all mixtures whose fit to the spot is within a noise-calibrated tolerance, track the actual error of existing deconvolution tools far better than their own uncertainty estimates do. They also expose collinear and missing cell types that point estimates hide. The second part is the engineering one. These ranges can be computed at million-spot scale by a self-supervised network that predicts dual multipliers, with no solver-generated labels and no loss of validity.

Formally, for spot $s$ with count vector $y_s$, total count $n_s$, reference profile matrix $X$ (genes by $K$ cell types), and diagonal gene weights $W_s$ from a noise-variance model, the feasible set is

$$\mathcal{C}_s = \{\, c \in \Delta_K : (y_s - n_s X c)^\top W_s (y_s - n_s X c) \le \varepsilon_s \,\},$$

where $\Delta_K$ is the probability simplex and $\varepsilon_s$ is a tolerance set from the noise model. The range for type $k$ is $[L_{s,k}, U_{s,k}]$, the minimum and maximum of $c_k$ over $\mathcal{C}_s$. Write $A = n_s X$, $Q = A^\top W_s A$, $p = A^\top W_s y_s$, and $a = e_k + \mu - \nu \mathbf{1}$, where $e_k$ is the $k$-th unit vector. Then for any multipliers $\lambda > 0$, $\mu \ge 0$ and $\nu$,

$$U_{s,k} \le \nu + \lambda(\varepsilon_s - y_s^\top W_s y_s) + \frac{(a + 2\lambda p)^\top Q^{-1}(a + 2\lambda p)}{4\lambda}.$$

This is the Lagrangian dual of the maximization. Evaluating it needs only one $K \times K$ linear solve, with $K$ typically 10–50. The lower end $L_{s,k}$ is handled symmetrically. When $Q$ is near-singular because reference types are collinear, the bound blows up exactly along the directions the data cannot resolve, which is the phenomenon we want to report.

A spot whose minimum achievable residual over the simplex exceeds $\varepsilon_s$ has an empty feasible set. A dual certificate of this, a certified lower bound on that residual, flags spots the reference cannot explain. These are candidates for missing transitional or malignant states.

Relation to Prior Work

Several papers motivate the gap. MEAD shows that treating estimated proportions as known constants inflates false positives downstream. It supplies sandwich-type confidence intervals for bulk deconvolution. Those intervals, however, rest on asymptotic arguments, identifiability conditions, and a complete reference. They quantify sampling noise around a unique solution, not the width of the set of solutions the data permit. We borrow MEAD's inverse-noise-variance gene weighting as our $W_s$ and its globally estimated platform scaling factors as a fixed preprocessing step. We do not inherit its identifiability assumption: we measure non-identifiability directly. The benchmarking study of Li et al. identifies CARD, Cell2location and Tangram as top performers. It also stresses that real spots lack ground truth, so a practitioner on a new tissue cannot tell when any of them is wrong. That is the gap our ranges address.

Other papers supply the comparison methods. Count Bridges is the closest generative work. It trains a Poisson birth–death bridge on aggregated counts by expectation–maximization and draws single-cell profiles that sum exactly to the spot. Its samples describe a learned posterior, so their spread depends on the learned prior and on sampler quality. It carries no guarantee that values outside the sampled spread are excluded by the data. Our ranges are prior-free outer bounds that hold for any network weights.

MAST-Decon and GraphST share information across spots, using histology-aware kernels and graph contrastive learning respectively. They improve accuracy, for example MAST-Decon's tertiary-lymphoid-structure ARI of 0.575 against RCTD's 0.228. Both, though, can over-smooth across sharp boundaries, and neither reports per-spot reliability. We use a spatial and histology encoder only to predict multipliers. Smoothing in that encoder can loosen a spot's certificate but cannot corrupt it.

The method itself comes from Self-Supervised Primal-Dual Learning for Constrained Optimization. That work trains a primal network and a dual network under augmented Lagrangian dynamics with no solver labels, reaching a 0.141% mean optimality gap on quadratically constrained quadratic programs at about 64,340 times Gurobi's speed. The file notes that its min–max training can oscillate. We change its role. The dual network here does not merely assist primal training: its output is the deliverable, and it is trained by directly minimizing the closed-form dual bound. That objective is convex in the multipliers for each spot, so no adversarial dynamics arise. A primal network, trained as in that paper and followed by a cheap feasibility repair, supplies feasible mixtures. Their $c_k$ values bound $U_{s,k}$ from below, and the difference between the two bounds measures how tight the certificate is.

The broader label-free optimization literature, such as Unsupervised Training for Neural TSP Solver and DIG-MILP, motivates the stance that an optimization problem can supervise itself. DIG-MILP in particular shows that duality can stand in for expensive verification.

Research Program

We will build three components and one calibration procedure.

The first is an exact reference implementation. It solves the $2K$ range problems per spot, plus the infeasibility test, with a conic solver. It defines the target quantities and is practical on Visium-scale slices of a few thousand spots.

The second is the amortized certifier. A shared encoder, either a per-spot network or a spatial graph network over spot adjacency with histology image features as in MAST-Decon, outputs $(\lambda, \mu, \nu)$ for each of the $2K$ problems. It is trained on the target slice itself by minimizing the summed dual bounds. A matching primal head supplies feasible points.

The third is the infeasibility detector, which produces a certified lower bound on each spot's best achievable residual.

The calibration question is how to set $\varepsilon_s$, and this is where the method can fail honestly. Our default sets $\varepsilon_s$ from a chi-square quantile of the weighted residual under the noise model, inflated by an overdispersion factor estimated from the slice's own median residual. We will report how coverage changes as $\varepsilon_s$ varies. The certificate is exact for the stated set, but whether the true mixture lies in that set depends on the noise model and on the residual platform effect left after MEAD-style scaling. A Poisson-deviance version of $\mathcal{C}_s$ is a natural extension, at the cost of losing the closed-form dual. We treat it as secondary.

Baselines

The naive reference point is what practitioners do now. They run CARD, Cell2location or RCTD, take the point estimates, and treat them as exact, perhaps flagging spots with large reconstruction residual. The point estimates define the errors our ranges must predict. A residual-norm threshold is the naive detector for missing cell types.

The strongest competitor for uncertainty on spatial data is Cell2location's Bayesian posterior intervals. Cell2location is a top performer in the Li et al. benchmark, and its intervals are the uncertainty output practitioners actually use. We will run it with its recommended settings on the same reference, gene set and slices, giving it a hyperparameter budget equal to ours. For bulk samples the matching competitor is MEAD's sandwich intervals, run on the pancreatic islet cross-platform benchmark it was developed on. We add gene-bootstrap intervals around RCTD and CARD as a cheap generic alternative, and posterior sample spread from Count Bridges on the MERFISH data it already uses.

No reported coverage or interval-calibration result for any of these was found on Lacuna. The file reports only point accuracy, such as MAST-Decon's 0.575 ARI. Every coverage number will therefore come from our own runs under identical conditions. Beating them means two things. First, our ranges must reach empirical coverage of the true proportion at or above the nominal level in regimes with deliberately collinear or missing cell types, where we expect posterior intervals to under-cover. Second, our range width must have a higher Spearman correlation with the absolute error of the best point estimator than any competitor's interval width.

For the amortized certifier, the strongest competitor is the exact per-spot solver, which is also its ground truth. Beating it means matching its ranges to within a small tolerance (median excess width under 0.02 in proportion units) at large wall-clock savings on 10^5-spot data.

Two ablations isolate the key ingredients. In the first, we replace the certified dual bound with a primal network trained under a fixed soft penalty, in the style of the DC3 baseline that the primal–dual paper reports at 4–6% optimality gaps. This tests whether certification, rather than amortization alone, is what keeps the ranges valid. In the second, we swap the spatial and histology encoder for a per-spot encoder. This measures whether neighbourhood information tightens certificates near boundaries without, by construction, ever invalidating them.

Why not just…?

Why not just solve the range problems exactly with an off-the-shelf solver? For a Visium slice of a few thousand spots this works, and we use it as the reference implementation. The scientific claim about identifiability ranges does not depend on amortization. The threat is real at scale, but its size is uncertain. At 10^5–10^6 spots with $K = 30$, there are millions of small conic programs per slice, plus re-solves whenever $\varepsilon$ or the reference changes. Whether that is prohibitive depends on per-problem solve time, which we will measure rather than assume. The QCQP speedups in the primal–dual paper were on different problems and do not transfer automatically. If the exact solver turns out cheap enough on Stereo-seq-sized data, we will say so and present the amortized certifier only as a convenience.

Why not just use Cell2location posteriors or MEAD confidence intervals? These describe uncertainty around a solution selected by a prior or by asymptotic identifiability. When two reference types are nearly collinear, a prior can quietly break the tie and report a narrow interval around an arbitrary split. MEAD explicitly assumes the identifiability that collinearity violates. Our MERFISH pseudo-spot experiments with controlled collinearity directly test whether this under-coverage happens. If posterior intervals cover as well as ours and track error as well, the first half of our claim fails.

Why not just threshold the reconstruction residual? For detecting cell types missing from the reference, a residual threshold is nearly equivalent to our infeasibility certificate, and we expect similar detection accuracy. We do not claim an advantage there. The residual says nothing about the other failure mode: a spot fit perfectly by many different mixtures has a small residual and a wide range. The held-out-type and collinear-type experiments separate these two cases.

Proposed Experiments

The decisive experiments use benchmarks where ground truth exists. Our main testbed is MERFISH mouse brain sections binned into pseudo-spots, as used by Count Bridges. It supplies true cell counts per spot. We supplement it with the seqFISH+ and simulated datasets from the Li et al. suite and the mouse visual cortex simulation used by MAST-Decon. On these we vary three things: how close reference types are, by merging or splitting subtypes; whether a cell type is removed from the reference while kept in the tissue; and sequencing depth.

The metrics are interval coverage, width, the width-to-error Spearman correlation against CARD, Cell2location and RCTD point estimates, and AUROC for flagging spots that contain a held-out type. The decisive result is a strong width–error correlation together with near-nominal coverage where posterior intervals under-cover. Failure of either half sinks the proposal.

For platform shift, the pancreatic islet benchmark crosses the Xin and Segerstolpe references. Running deconvolution with one reference on mixtures built from the other tests whether MEAD-style scaling plus our overdispersion calibration keeps coverage. We expect this to be the hardest case and will report it as such.

On real tissue without ground truth, we run on DLPFC Visium slices and the HCC dataset. We check whether wide ranges concentrate at known layer and tumor–stroma boundaries and among the closely related macrophage and T-cell subsets described by the HCC immune study. We also check whether certified-infeasible spots concentrate in malignant regions where the reference is expected to be incomplete.

For scale, we time the exact solver against the amortized certifier on the largest Stereo-seq and Slide-seqV2 datasets in the Li et al. suite. We report excess range width, the fraction of spots whose primal–dual gap falls below 0.01, and wall-clock time. This settles whether amortization earns its place.