Component-Based Out-of-Distribution Detection

Wenrui Liu, Hong Chang, RuiBing Hou, Shiguang ShanNeurIPS 2026

TL;DR

Vision models need to know when they are looking at something entirely unfamiliar—a challenge known as Out-of-Distribution (OOD) detection. Existing methods get stuck at the wrong zoom level: looking at the whole image blurs out subtle anomalies, while scrutinizing tiny pixel patches triggers false alarms from background noise. Inspired by cognitive science, CoOD finds the "Goldilocks" middle ground by breaking objects into functional components (like handles, wings, or wheels) and checking both what those parts look like and how they fit together, all without retraining the model.

What Problem Does This Paper Address?

Imagine training an AI to recognize woven baskets. What happens when you show it a wooden bucket? Or a woven mug where the handle is mounted on the side instead of over the top? Both are Out-of-Distribution (OOD) relative to your training data, and a safe vision system should flag them rather than make a blind guess.

Current OOD detectors struggle here because of a granularity dilemma:

  • Global methods pool features across the entire image. This works great if a race car drives into your basket dataset, but it washes out local details—missing the subtle texture shift between a woven basket and a wooden bucket.
  • Local (patch-based) methods zoom in on tiny grid squares. While sensitive to fine details, individual patches are noisy, lack context, and easily overreact to harmless variations.

Worse, neither approach catches compositional OODs—like our woven mug—which are built entirely out of valid, familiar parts arranged in an invalid geometry.

Figure 1: Comparison between CoOD and global/local meth- ods. Top: From left to right are: training ID “basket”, test ID “basket”, fine-grained OOD “bucket”, and compo- sitional OOD “cup”. Middle: Causes of success or fail- ure. Bottom: CSS exposes fine-grained shift in components “bucket’s body”, while the CCS detects a compositional mis- alignment in “cup’s handle”.

Methods

Drawing from cognitive psychology's Recognition-by-Components theory, the authors propose CoOD (Component-Based OOD Detection), a post-hoc framework built on top of standard vision-language models like CLIP (meaning zero retraining required).

CoOD works in three main stages:

  1. Component Extraction & Suppression: Offline, an LLM (ChatGPT-4o) breaks down known class names into a vocabulary of functional parts (e.g., cat $\rightarrow$ head, tail, limb, trunk). At test time, standard GradCAM localizes these parts on a zoomed-in foreground. Crucially, the authors introduce non-component suppression: they blur non-target areas in the image and inject mask-guided tokens directly into the Vision Transformer (ViT) to prevent background context from "leaking" into a component's representation via self-attention.
  2. Component Shift Score (CSS): By averaging patch tokens within a clean component, CSS cancels out pixel noise while preserving local semantics—catching subtle appearance shifts (like an unfamiliar wing color on a bird).
  3. Compositional Consistency Score (CCS): To check spatial structure, CCS samples a few keypoints per component and aligns them (via classical homography) against a tiny reference "coreset" of real training images. If the parts don't line up geometrically, CCS flags a structural anomaly.
Figure 3: Illustration of CoOD framework, which firstly represents class components, and then computes complementary CSS and CCS.

The authors also introduce CoOD-F, a lightweight, high-speed variant that skips individual component visual extraction and uses the global image feature instead.

Datasets

CoOD is evaluated across three distinct regimes:

  • Coarse-grained: Standard ImageNet-1K as In-Distribution (ID), tested against SUN, Places, iNaturalist, and DTD as OOD.
  • Fine-grained: CUB-200 (bird species), splitting subclasses within superclasses between ID and OOD.
  • Compositional (Newly Constructed): Two custom benchmarks designed to isolate structural shifts: (1) ImageNet-Splits, manually regrouping ImageNet classes that share parts in different layouts, and (2) Counterfactual Data, generated via the FLUX.2 diffusion model using prompts like "a \<class> where \<component> is mounted on an impossible position" paired with normal-position counterparts generated from the exact same random seed.

Key Insights and Ideas

  • Functional components are the optimal unit of evidence: Aggregating at the part level solves the sensitivity-robustness trade-off—anything smaller adds noise without semantic meaning, while anything larger dilutes local anomalies.
  • Attention leaks ruin part-based detection unless stopped early: Simply averaging component tokens at the final layer of a ViT fails. Because self-attention mixes information across the whole image early on, non-component context contaminates the part features. Suppressing background signals at both the image and early token levels is mathematically and empirically vital.
  • It’s about geometry, not LLM magic: Even when the authors stripped away ChatGPT-4o and discovered "components" purely visually using unsupervised super-pixel clustering, CoOD only lost 0.5% AUC on ImageNet—proving the component-centric architecture itself does the heavy lifting.

Key Results

CoOD consistently outperforms both traditional and CLIP-based detectors across standard and prompt-tuned backbones:

  • Coarse & Fine-Grained: Using standard CLIP, CoOD reaches 96.2% AUC (and drops the false positive rate at 95% recall, FPR95, from 37.6% with MCM down to 15.6%) on ImageNet-1K. On fine-grained CUB, it jumps to 85.2% AUC, nearly 10 points higher than standard CLIP-MCM (75.4%).
  • Compositional: On the synthetic counterfactual dataset, standard methods perform near random guessing (MCM gets 54.5% AUC), whereas CoOD achieves 86.3% AUC. On ImageNet-Splits, it leads at 75.4% AUC (vs. ~68–70% for baselines).
  • Speed vs. Accuracy: Because full CoOD runs multiple forward passes and classical keypoint matching, it runs at 1.5 FPS (compared to 89 FPS for baseline MCM). However, the fast CoOD-F variant runs at 85 FPS while still achieving 95.4% AUC on ImageNet-1K.

Limitations and Future Work

CoOD assumes objects have distinct, spatially arranged parts; its effectiveness on texture-dominated scenes (like satellite imagery or medical tissue slides), heavy occlusions, or cluttered multi-object images remains unverified. Additionally, full CoOD's 1.5 FPS throughput is too slow for real-time, latency-critical systems without dedicated segmentation/registration accelerators. Looking ahead, the authors aim to expand beyond spatial parts to disentangle feature-level components—such as color, lighting, and viewpoint—for even broader, human-interpretable OOD detection.

Summary updated

Abstract

Out-of-Distribution (OOD) detection requires sensitivity to subtle shifts without overreacting to natural In-Distribution (ID) diversity. However, from the viewpoint of detection granularity, global representation inevitably suppresses local OOD cues, while patch-based methods are unstable due to entangled spurious-correlation and noise. And neither of them is effective in detecting compositional OODs composed of valid ID components. Inspired by recognition-by-components theory, we present a post-hoc Component-Based OOD Detection (CoOD) framework that addresses the existing limitations by decomposing inputs into functional components. To instantiate CoOD, we derive Component Shift Score (CSS) to detect local appearance shifts, and Compositional Consistency Score (CCS) to identify cross-component compositional inconsistencies. Empirically, CoOD achieves consistent improvements on both coarse- and fine-grained OOD detection.
BibTeX
@inproceedings{liu2026component,
  author = {Wenrui Liu and Hong Chang and RuiBing Hou and Shiguang Shan},
  title = {{Component-Based Out-of-Distribution Detection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=z4SLzKzu0y},
}
Figure