Out-of-Distribution (OOD) detection is a critical safety mechanism in machine learning, ensuring that models can identify inputs that deviate significantly from their training data. While Vision-Language Models (VLMs) like CLIP have advanced zero-shot OOD detection, they frequently struggle with "Near-OOD" scenarios—cases where OOD samples are semantically similar to in-distribution (ID) classes. This paper addresses this limitation by leveraging Large Language Models (LLMs) to refine the semantic space used for OOD detection.
Methodology
The proposed framework consists of a zero-shot strategy for negative label selection and a few-shot training regime to align visual and textual features.
Zero-Shot: Superclass-BG Negative Label Selection
The core innovation is the Superclass-BG strategy. Instead of using specific class labels (e.g., "tench"), which may be too narrow to act as robust anchors, the authors use an LLM to identify the immediate superclass (e.g., "Cyprinidae") and generate detailed background descriptions (e.g., "streams with pebbles").
By subtracting the background embedding from the superclass embedding, the model isolates the essential semantic features of the category. These refined features are then used to mine negative labels from WordNet without the aggressive filtering used in previous methods. By retaining candidate labels that are semantically close to ID data, the model better learns the boundaries required for challenging Near-OOD detection.
Few-Shot: Two-Phase Training Framework
To further boost performance, the authors introduce a two-phase training approach.
- Phase 1 (Prompt Tuning): Optimizes the text prompts for the ID labels to improve semantic alignment.
- Phase 2 (Visual Prompt Tuning): Introduces learnable vectors into the image encoder to better align visual features with the refined text embeddings.
To simulate OOD data during training without access to real OOD samples, the authors generate proxy OOD datasets by taking random crops of ID images that exhibit low similarity to their original labels.
Experimental Results
The researchers evaluated their method on several rigorous benchmarks, including ImageNet-1K and the challenging OpenOOD V1.5 (SSB-hard and NINCO). The proposed method achieved state-of-the-art performance across the board:
- ImageNet-1K OOD: Achieved an average AUROC of 97.67%.
- FPR95 Reduction: Reduced the False Positive Rate (at 95% TPR) by up to 12.6% compared to existing baselines.
- Near-OOD Performance: On the OpenOOD V1.5 benchmark, the method reached an AUROC of 83.04%, a significant improvement over previous zero-shot and training-based methods.
Key Insights and Conclusion
This work demonstrates that LLMs can serve as powerful semantic refiners to "clean" and structure the embedding space of VLMs. By explicitly removing common background features from text embeddings, the model focuses on unique, distinguishing characteristics. Furthermore, the hierarchical anchoring provided by superclasses offers a more stable neighborhood for negative mining than individual class labels.
Future work may involve adaptive mechanisms to optimize description length or superclass depth based on the specific task, as the authors noted that shorter descriptions favor Far-OOD detection while longer descriptions benefit Near-OOD scenarios.
Summary updated