Vision-language models (VLMs) enable zero-shot out-of-distribution (OOD) detection in medical imaging, yet existing approaches often rely on final-layer confidence or entropy-based layer selection, potentially missing complementary information. We show that low in-distribution (ID) confidence entropy does not reliably predict OOD discrimination. We introduce CLASP (Complementary Layer Selection and Profiling), an ID-only framework that jointly models layer--prompt responses and visual features. CLASP ranks visual encoder layers using Gaussian conditional mutual information and selects a compact subset through anchored spectral selection, without fixing the number of layers. It then combines the selected layer--prompt profiles with PCA-compressed visual embeddings and fits a single shrinkage-regularized Gaussian. OOD scores are computed using squared Mahalanobis distance, without fine-tuning, OOD training data, or test-time adaptation. Across histopathology, chest X-ray, and brain MRI benchmarks with UniMedCLIP and BioMedCLIP, CLASP performs strongly under varied distribution shifts. On MIDOG near-OOD, it achieves 87.54% AUROC with UniMedCLIP, outperforming confidence-based baselines; with BioMedCLIP, it remains competitive but trails visual-only Mahalanobis modeling. Ablations highlight the value of layer--prompt interactions and cross-feature dependencies, while exposing shift-dependent contributions and limitations under semantic shifts.
Figures & tables
Figure 1: Motivation for Layer–Prompt Profiles (LPP). (a) Relationship between ID histogram entropy and near-OOD AUROC across candidate layer subsets on MIDOG using UniMedCLIP. The weak correlation suggests that minimizing ID entropy does not necessarily identify the most OOD-discriminative representations. (b) Two illustrative images exhibit identical layer-wise maximum similarity scores despite different layer–prompt response patterns. Reducing these responses to scalar confidence scores discards information preserved by the complete layer–prompt profile.
Figure 2: Impact of layer selection and representation choice on OOD detection. UniMedCLIP AUROC across selected-layer budgets for Chest X-ray L5 semantic OOD and MIDOG near-OOD. LPP stands for layer-prompt profiling and LPP-V combines LPP with visual representations.
Figure 3: Overview of CLASP. A frozen VLM extracts visual embeddings and layer–prompt similarities. Gaussian conditional mutual information (CMI) ranks candidate layers, while anchored spectral admission determines how many ranked layers to retain within a fixed visual capacity. The admitted layers define a matched layer–prompt profile, which is jointly modeled with complementary visual features using an ID-fitted Gaussian. Squared Mahalanobis distance serves as the OOD anomaly score.
Method
Explicit class- identity use
Ext. OOD
Additional Training
UniMedCLIP
BioMedCLIP
Near-OOD
Far-OOD
Near-OOD
Far-OOD
AUROC ↑
FPR@95 ↓
AUROC ↑
FPR@95 ↓
AUROC ↑
FPR@95 ↓
AUROC ↑
FPR@95 ↓
MCM [ 21 ]
✗
✗
✗
47.25
91.95
81.64
51.56
40.08
97.61
36.95
100.00
SRE [ 20 ]
✗
✗
✗
29.10
99.70
97.10
16.60
32.10
97.30
99.80
1.30
MRE [ 25 ]
✗
✗
✗
54.60
94.40
97.40
13.40
36.40
100.00
99.50
2.70
GL-MCM [ 23 ]
✗
✗
✗
47.53
92.98
81.29
53.31
42.19
96.55
54.27
97.08
Table 1: MIDOG OOD detection: unweighted macro averages across seven near-OOD and two far-OOD domains. AUROC ↑ and FPR@95 ↓ are in %. Explicit class-identity use denotes class-specific assignments or modeling beyond predefined ID text descriptions. Voyager is not reported because MIDOG contains only one semantic ID class, described by ten synonymous prompts, making its class-based layer-expert scores degenerate. PROTON+ results are averaged over five balanced online streams due to its test-time adaptation protocol, whereas the other methods are evaluated on complete test populations. Best results are highlighted in bold.
Backbone
Method
Chest X-ray: L1 (2 ID prompts)
Chest X-ray: L5 (8 ID prompts)
Brain MRI
Semantic
Covariate
Far-OOD
Semantic
Covariate
Far-OOD
Near-OOD
UniMedCLIP
MCM [ 21 ]
54.20/89.67
46.76/87.50
27.56/99.67
54.18/ 77.50
78.43/46.50
84.62/43.00
38.90/100.00
SRE [ 20 ]
64.32/87.50
20.17/99.67
82.81/86.33
59.51/89.00
93.10/30.33
100.00 / 0.00
11.50/100.00
MRE [ 25 ]
64.32/87.50
20.17/99.67
82.81/86.33
60.37/89.75
88.25/48.08
100.00 / 0.00
15.20/100.00
GL-MCM [ 23 ]
55.36/92.83
47.71/91.00
33.18/99.33
54.46/79.33
81.18/55.33
91.52/34.00
40.40/95.00
PROTON+ [ 3 ]
61.39/88.13
93.88/29.00
91.52/37.93
49.90/92.13
88.50/36.53
96.86/9.53
35.90/100.00
Table 2: Chest X-ray and Brain MRI OOD detection under the L1 (2 prompts) and L5 (8 prompts) settings. Each cell reports AUROC ↑ / FPR@95 ↓ (in %). The Brain MRI column reports the OASIS-3 versus BraTS-GLI benchmark using four ID prompts. Bold denotes the best reported result for each backbone and OOD category.
Ranking criterion
MIDOG near
Chest L5 semantic
Selected layers
AUROC/FPR@95
Selected layers
AUROC/FPR@95
Gaussian Visual CMI (ours)
{3,8,12}
87.54 / 30.88
{4,12}
65.40/ 87.83
Entropy ordering
{7,12}
80.31/51.43
{11,12}
63.24/88.33
Conditional covariance
{5,8,12}
85.14/36.73
{5,12}
65.54 /88.17
Marginal visual MI
{11,12}
78.70/55.67
{11,12}
63.24/88.33
Table 3: Ablation of layer-ranking criteria using UniMedCLIP. Each ranking is followed by the same spectral admission. Results report AUROC ↑ / FPR@95 ↓ (in %).
Covariance model
MIDOG near
Chest L5 semantic
Full Ledoit–Wolf covariance (ours)
87.54 / 30.88
65.40 / 87.83
Diagonal covariance
80.16/49.82
58.24/92.83
Identity covariance
80.16/49.82
58.24/92.83
Table 4: Ablation of covariance modeling using UniMedCLIP. All variants use identical CLASP representations. Results report AUROC/FPR@95 (%).
Figure 4: Effect of layer–prompt aggregation. Comparison of layer-wise maximum, mean, and complete layer–prompt profiling (LPP) using UniMedCLIP.
Figure 5: Ablation of matched profiling and joint representation. Comparison of matched LPP, visual PCA32, full LPP with visual PCA32, and CLASP with anchored spectral admission selected layers.
Benchmark
Reference layers
Agreement (%)
Jaccard
AUROC/FPR@95
MIDOG near
{3,8,12}
50.00
0.72
86.74±0.64 / 32.41±1.76
Chest L5 semantic
{4,12}
30.00
0.54
65.02±0.84 / 88.20±0.97
Table 5: ID calibration stability of CLASP using UniMedCLIP across ten repetitions with approximately 80% calibration data. Agreement measures recovery of the full-calibration layer set, while Jaccard measures pairwise overlap between selected sets. AUROC and FPR@95 are reported as mean ± standard deviation (%).
Out-of-distribution (OOD) detection is crucial for safe deployment of medical AI systems, where domain shifts arise across institutions, acquisition protocols, and patient populations. VLMs enable zero-shot OOD detection by embedding images into a language-aligned latent space, where cross-modal similarity serves as a non-parametric confidence signal for identifying in-distribution samples. Yet existing methods rely almost exclusively on final-layer embeddings, implicitly assuming that the deepest representations are universally optimal. We first show that this assumption does not hold in medical imaging: intermediate layers provide complementary OOD signals, and the optimal representational depth depends on the respective image modality. While prior work selects layer combinations via entropy minimization of normalized histograms, we demonstrate that single-resolution entropy estimation is highly sensitive to binning choices, leading to performance variations of up to 19.3% AUROC. To address this instability, we propose a multi-resolution entropy estimation strategy that aggregates histogram statistics across multiple discretization scales, enabling robust and stable intermediate-layer selection. Across two medical OOD benchmarks, namely MIDOG and OASIS, covering distinct imaging modalities, diverse shift types, and different VLM backbones, our method consistently outperforms state-of-the-art approaches, offering a lightweight and stable solution for zero-shot OOD detection.
Shyam Nandan Rai, Francesco Di Salvo, Sebastian Doerrich +1
xAILab Bamberg, University of Bamberg, Bamberg, Germany
Medical vision-language models (VLMs) enable zero-shot clinical image classification, yet reliably detecting out-of-distribution (OOD) inputs at deployment remains an open problem. No static scoring method works across all shift types: Maximum Concept Matching (MCM) on FLAIR achieves 76.4% AUROC for far-OOD but only 42.4% for covariate shifts such as ultra-wide-field fundus images, effectively random. We trace this to a structural mismatch: covariate-shifted inputs are indistinguishable from in-distribution samples in softmax space, yet occupy distinct regions in the VLM embedding space. To exploit this untapped signal, we propose PROTON (PROtotype-based Test-time ONline OOD detection), a lightweight post-hoc module that maintains an online prototype bank from high-confidence test predictions and adaptively fuses prototype distance with MCM scoring via stream-level variance statistics, requiring no model modification, training data, or prompt engineering. On the ophthalmology benchmark FLAIR + FIVES, PROTON improves MCM by +23.9 AUROC on covariate shift, +8.8 on semantic shift, and +8.1 on far-OOD, making it the only zero-shot method to improve all three without hierarchical prompts or labeled data. Code is available at https://github.com/GenMI-Lab/PROTON, and the project page is available at https://genmi-lab.github.io/PROTON.
Abhijit Das, Nichula Wasalathilaka, Yifan Lu +4
MBZUAI, Abu Dhabi, UAE · University of Peradeniya, Sri Lanka · Khalifa University, Abu Dhabi, UAE +2
Medical Vision-Language Models (VLMs) exhibit strong zero-shot performance, yet their effectiveness still declines on out-of-distribution (OOD) data due to domain shifts and class bias inherited from large-scale pretraining. Existing few-shot adaptation methods typically introduce additional trainable components, which can be unstable in extremely low-data regimes (e.g., 1-shot), and lack robustness on different medical data. We present TCLA, a purely training-free few-shot adaptation method for Medical VLMs, which is fast and model-agnostic. TCLA corrects inference logits based on a small set of support samples, boosting pretrained VLMs performance by improving inter-class deconfusion and reducing domain shift. Extensive experiments on nine datasets across multiple medical imaging modalities including X-ray, Ultrasound, MRI, CT, Histopathology, demonstrate that TCLA consistently improves OOD performance of Medical VLMs and, in most of cases, outperforms existing training-based adaptation methods.
Tianyou Jiang, Ziyu Zhou
University of Bern, Bern, Switzerland · Shanghai Jiao Tong University, Shanghai, China