TL;DR
This paper introduces SynOOD, a novel method for Out-of-Distribution (OOD) detection that leverages foundation models (MLLMs and diffusion models) to generate challenging, near-boundary OOD synthetic data. This synthetic data is then used to fine-tune CLIP models, significantly improving their ability to distinguish between in-distribution (InD) and OOD samples, especially those that are visually similar to InD data.
What Problem Does This Paper Address?
Modern deep learning models, particularly those deployed in open-world scenarios, frequently encounter data that deviates from their training distribution (OOD data). Accurately identifying this OOD data is crucial for security and reliability. While pre-trained vision-language models like CLIP have shown promise in OOD detection by leveraging both visual and textual information, they struggle with "hard" OOD samples that lie very close to the InD data in feature space. These samples are visually similar to InD data, making it difficult for CLIP to draw a clear distinction. Existing methods often fail to effectively address this boundary region, leading to misclassifications.
Methods
SynOOD tackles this challenge through a three-pronged approach:
- Near-Boundary OOD Image Generation: This is the core innovation. SynOOD uses a multimodal large language model (MLLM) to extract contextual elements from an InD image (e.g., "bamboo" from a "panda" image). These elements are then used as prompts for an iterative in-painting diffusion model. Instead of relying on predefined masks, the diffusion model refines generated images by adjusting noise based on OOD scores (like the energy score) from a recognition model. This process gradually transforms the image to represent OOD content while maintaining visual similarity to the original InD data, effectively creating samples that sit on the InD/OOD boundary.
- Fine-tuning of the CLIP Image Encoder: A projection layer is added after the CLIP image encoder. This layer is trained using both InD data and the newly generated synthetic OOD images, along with corresponding negative labels. The original CLIP image encoder remains frozen.
- Fine-tuning of CLIP Text Encoder Features: A subset of negative label features derived from the CLIP text encoder are made learnable. These features are then fine-tuned using the synthetic OOD images. This step aims to reduce the semantic gap between InD and negative labels, improving the overall alignment.
The image encoder and text encoder features are fine-tuned separately to ensure training stability.
Datasets
- InD Data: ImageNet-1k is used as the primary InD dataset.
- OOD Data:
- Standard Benchmarks: iNaturalist, SUN, Places365, and Texture datasets are used for evaluation.
- OpenOOD Benchmark: This benchmark is used to evaluate performance on both near-OOD and far-OOD scenarios, including datasets like ImageNet-O, SSB-hard, NINCO (near-OOD), and iNaturalist, Texture, OpenImage-O (far-OOD).
Key Insights and Ideas
- Synthetic Data for Boundary Hardening: The most significant insight is that generating specifically boundary-aware OOD samples is crucial for improving OOD detection. Simply using existing OOD datasets might not provide enough challenging examples near the decision boundary.
- Foundation Models as Generative Tools: The paper effectively demonstrates how MLLMs and diffusion models can be harnessed for task-specific data generation in OOD detection, a relatively unexplored area.
- Iterative Refinement is Key: The iterative in-painting process, guided by OOD gradients, is vital for creating nuanced and realistic synthetic OOD samples that are visually similar yet semantically distinct.
- Separate Fine-tuning for Stability: Fine-tuning the image encoder and text encoder features separately is shown to be beneficial for maintaining training stability and achieving better results.
- Negative Labels are Powerful: The continued reliance on and refinement of negative labels (labels outside the InD set) is a key component that helps SynOOD push the boundaries of detection.
Key Results
- State-of-the-Art Performance: SynOOD achieves state-of-the-art results on the ImageNet benchmark, significantly outperforming existing methods.
- AUROC and FPR95 Improvements: The method achieves a substantial AUROC improvement of 2.80% and an FPR95 reduction of 11.13% compared to previous methods.
- Efficiency: SynOOD adds minimal parameters and has a low inference time (under 2 ms per image).
- Robustness Across Architectures: SynOOD demonstrates consistent performance gains across different CLIP backbone architectures (ResNet50, ViT-B/32, ViT-B/16).
- Effectiveness on OpenOOD: The method performs competitively on the OpenOOD benchmark, showing strong results in both near-OOD and far-OOD scenarios, even with a smaller training set.
- Impact of Training Strategy: Step-by-step training (especially fine-tuning label features without the projection layer) yields better results than joint training.
Limitations and Future Work
- Overfitting with Projection Layer: The paper notes that fine-tuning the projection layer on a limited set of synthetic OOD data can lead to overfitting, suggesting that excluding it during label feature fine-tuning is beneficial.
- Optimal Data Quantity: While SynOOD's performance generally improves with more synthetic data, it slightly declines beyond 50k samples, indicating a potential balance issue between fixed and fine-tuned negative labels.
- Future Directions: The authors suggest that SynOOD opens up new directions for OOD detection and encourages further research into similar generative strategies for improving model robustness in other tasks. The iterative generation process itself could be explored for other applications.
Summary updated