arXiv:2610.09498cs.CVOct 2026

Manuscript Offprint

arXiv:2610.09498

SpatialUQ: Post-Hoc Uncertainty Quantification from Spatial Consistency in Black-Box Vision Models

Md Kawsher Mahbub, Milon Biswas, Mirza Niaz Morshed, Wei Yu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Clinical vision models are often deployed as frozen black boxes with no access to internals, retraining, or ground truth at inference time. We introduce SpatialUQ, a post-hoc uncertainty method using only output probabilities. It measures the Jensen-Shannon divergence between the global prediction and the mean of five fixed spatial crops in six deterministic forward passes. The premise is simple, trustworthy predictions are spatially consistent. On NIH ChestX-ray14 (DenseNet-121, N=25,596), our Multicrop Uncertainty Score (MUS) reaches 0.784 failure-detection AUC versus 0.664 for MC-Dropout ( p<10−6p<10^{-6}) at one-fifth the compute, with native calibration (SCE=0.049 vs. 0.127 for ℓ1\ell_1), the best-calibrated among methods above 0.78 AUC. A supervised fusion of MUS with entropy, confidence, and ℓ1\ell_1 reaches 0.832, outperforming a five-member ensemble (0.813). MUS scales with model quality, reaching 0.899 with BiomedCLIP ( ρ=0.846\rho=0.846), while this relationship remains meaningful in-distribution ( ρ=0.523\rho=0.523) but breaks down under severe distribution shift (VinBigData, ρ=0.027\rho=0.027). MUS is well-suited to diffuse findings but is less dependable for small focal lesions such as nodules. Code and experimental materials are publicly available at https://huggingface.co/datasets/kawsher11/SpatialUQ.

1 INTRODUCTION

Deep neural networks can fail silently on out-of-distribution inputs (Amodei et al., 2016; Hendrycks and Dietterich, 2019), posing patient-safety risks in medical imaging where confident errors are consequential (Leibig et al., 2017; Kendall and Gal, 2017). Reliable deployment therefore requires inference-time failure detection without ground truth. However, frozen black-box classifiers exclude many existing UQ approaches. Bayesian methods such as MC-Dropout (Gal and Ghahramani, 2016) require training-time modifications, ensembles (Lakshminarayanan et al., 2017) and TTA (Krizhevsky et al., 2012) add substantial compute, while post-hoc methods such as DDU (Mukhoti et al., 2023), Mahalanobis (Lee et al., 2018), energy (Liu et al., 2020), ODIN (Liang et al., 2017), and conformal prediction (Angelopoulos and Bates, 2023) require model internals, feature distributions, or calibration data. Recent consistency-based (Khan and Fu, 2024) and augmentation-sensitivity (Shu et al., 2026) methods operate in related settings but rely on linguistic or photometric perturbations, leaving geometric evidence largely unexplored.

We propose SpatialUQ grounded on a single premise: a reliable model produces spatially consistent predictions across an image and its sub-regions. Well-localized features create strong agreement between global and crop-level predictions. On the other hand, distributional mismatch, low image quality, or atypical presentations make them diverge. We measure this divergence as the Jensen-Shannon Divergence (JSD) between the global prediction and the mean of five fixed spatial crops, in six deterministic forward passes. This geometric signal needs no internals, sampling, or reference data, and differs fundamentally from TTA (Krizhevsky et al., 2012; Wang et al., 2019) (Lemma 1; Section 5.4.1). A supervised logistic fusion of MUS with entropy, confidence, and ℓ1\ell_{1} improves failure detection further, except under severe shift where MC-Dropout remains preferable.

Our key contributions are summarized as follows:

• SpatialUQ: A post-hoc uncertainty framework for frozen black-box classifiers using only output probabilities, with no internals, gradients, training data, or retraining. MUS is natively calibrated and extends to frozen foundation models, reaching 0.899 AUC with BiomedCLIP ( ρ=0.846\rho = 0.846). Spatial perturbations provide the key signal, with photo-metric JSD reducing AUC from 0.784 to 0.755.

• Formalization and self-diagnosing deployment gate: A formal bound connects MUS to mean absolute spatial probability shift, while a small labeled calibration sample provides a deployment diagnostic. The correlation remains meaningful in-distribution ( ρ=0.523\rho = 0.523) but collapses under severe shift (VinBigData, ρ=0.027\rho = 0.027).

• State-of-the-art failure detection at one-fifth the cost: MUS achieves 0.784 AUC on NIH ChestX-ray14, outperforming MC-Dropout (0.664, p<10−6p < 10^{-6}) with 6 vs. 30 forward passes. Fusion reaches 0.832 AUC, exceeding a five-member ensemble (0.813) without retraining.

• Cross-domain transferability: MUS achieves 0.708 AUC on CheXpert, a 0.109 gain over MC-Dropout; fusion reaches 0.917–0.937 on ImageNet and 0.885–0.913 on MS COCO.

Spatial inconsistency is complementary rather than universal, it excels when models are overconfident on multi-label tasks but degrades when failures are spatially uniform.