Imagine you’re a doctor looking at a rare medical scan. You’ve seen thousands of X-rays, but this one feels... off. It’s not just that it’s a different disease; maybe the lighting is weird, or the scanner was a different model. In the world of AI, this is called Out-of-Distribution (OOD) detection. It’s the "I don't know what this is, but I know it’s not what I usually see" reflex.
In a new paper, researchers introduce CLASP (Complementary Layer Selection and Profiling), a framework designed to give Vision-Language Models (VLMs) that same gut feeling, helping them flag unfamiliar medical images without needing any extra training or "cheat sheets" of known anomalies.
TL;DR
CLASP improves how medical AI detects unfamiliar images by automatically picking the most informative internal layers of a Vision-Language Model and preserving the rich "dialogue" between images and text prompts. By moving beyond simple confidence scores, it achieves state-of-the-art performance in identifying distribution shifts in histopathology, X-rays, and MRIs without any fine-tuning.
What Problem Does This Paper Address?
Deep learning models are notoriously overconfident. Even when shown something they’ve never seen before—like a brain scan from a different hospital's machine—they might confidently misclassify it.
Vision-Language Models (like CLIP) are a popular fix because they "understand" images through text descriptions. However, most current OOD methods only look at the very last layer of the model or use "entropy" (a measure of uncertainty) to pick which layers to trust. The authors of CLASP found a major flaw here: just because a model is "certain" about its usual data (low entropy) doesn't mean it will be good at spotting weird data.
As shown in Figure 1(a), there is a very weak correlation between low entropy and actual OOD detection performance. We need a better way to decide which parts of the model’s "brain" to listen to.
Methods
CLASP is an "ID-only" framework, meaning it only needs to see normal, in-distribution (ID) data to learn what "weird" looks like. It works through three clever steps:
- Smart Layer Ranking: Instead of using entropy, CLASP uses Gaussian Conditional Mutual Information (CMI). Think of this as building a team of experts: it ranks layers based on how much new information they provide compared to the layers already selected.
- Anchored Spectral Selection: It doesn't just pick a fixed number of layers. It uses a stability-based approach to automatically decide how many layers are actually useful for a specific task.
- Layer–Prompt Profiling (LPP): This is the secret sauce. Most models boil down the relationship between an image and text prompts into a single "maximum similarity" score. CLASP argues this discards too much info. As seen in Figure 1(b), two images might have the same "Max" score but totally different "profiles" across different text prompts. CLASP keeps the whole profile.
Finally, it combines these profiles with visual features and fits a simple statistical model (a Gaussian). If a new image falls too far from this "normal" cluster (measured by Mahalanobis distance), it’s flagged as OOD.
Datasets
The authors put CLASP through its paces across three distinct medical domains:
- Histopathology: Using the MIDOG benchmark to detect shifts in cell imaging across different labs.
- Chest X-ray: Using RSNA (normal/pneumonia) as the baseline, with NIH ChestX-ray14 and pediatric scans providing semantic and covariate shifts.
- Brain MRI: Comparing healthy brain images from OASIS-3 against glioma-containing volumes from BraTS-GLI.
Key Insights and Ideas
- The Entropy Trap: The most surprising finding is that the standard practice of picking layers with the lowest entropy is often suboptimal. CLASP’s CMI-based ranking proves that "complementary" information is more valuable than "certain" information.
- Don't Flatten the Conversation: By preserving the full matrix of image-text similarities (the LPP), the model can distinguish between images that look similar on the surface but react differently to specific textual concepts.
- Visual vs. Textual Balance: The paper reveals that for some shifts (like different scanners), visual features are better. For others (like new diseases), the text-alignment features shine. CLASP’s joint modeling allows it to get the best of both worlds.
Key Results
CLASP consistently outperformed standard baselines, especially on the challenging MIDOG histopathology task.
- MIDOG near-OOD: Achieved 87.54% AUROC (a measure of detection accuracy), significantly beating confidence-based methods like MCM.
- Brain MRI: Achieved a near-perfect 99.97% AUROC in distinguishing healthy brains from those with tumors.
- Chest X-ray: Showed strong performance on "far-OOD" (images that aren't even X-rays) and "covariate shifts" (different patient groups), though "semantic shifts" (different diseases) remain a tougher nut to crack.
As Figure 2 demonstrates, CLASP (the solid black line) maintains high performance even as you change the number of layers, whereas other methods are much more sensitive.
Limitations and Future Work
While CLASP is a big step forward, the authors admit it still struggles with semantic shifts—cases where the image looks like a valid medical scan but contains a disease the model wasn't expecting.
Future work will likely focus on making the layer selection even more robust and finding better ways to integrate visual and prompt-based features adaptively, rather than just concatenating them. For now, CLASP provides a powerful, "zero-shot" way to make medical AI a little more self-aware of its own limitations.
Summary updated