NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Synthesizing Near-Boundary OOD Samples for Out-of-Distribution Detection

Jinglun Li, Kaixun Jiang, Zhaoyu Chen, Bo Lin, Yao Tang, Weifeng Ge, Wenqiang Zhang

TL;DR

This paper introduces SynOOD, a novel method for improving out-of-distribution (OOD) detection by generating challenging, near-boundary OOD samples using diffusion models and multimodal large language models (MLLMs). These synthetic samples are then used to fine-tune CLIP models, significantly enhancing their ability to distinguish between in-distribution (InD) and OOD data, especially for difficult cases near the decision boundary.

What Problem Does This Paper Address?

Modern vision-language models like CLIP are powerful for OOD detection, but they struggle with "hard" OOD samples that are visually similar to InD data, often falling near the InD/OOD decision boundary. These ambiguous samples can be misclassified because their feature representations are too close to InD classes, making it difficult for CLIP to establish clear semantic boundaries. Existing methods lack effective ways to generate these specific, challenging OOD samples for fine-tuning, which is crucial for improving robustness in real-world, open-world scenarios where encountering such data is inevitable.

Methods

SynOOD tackles this problem through a three-pronged approach:

  1. Near-Boundary OOD Image Generation: This is the core innovation. It leverages an MLLM to extract contextual elements from an InD image (e.g., "bamboo" from a "panda" image, excluding the main subject). These elements are then used as prompts for an iterative in-painting diffusion model. Instead of directly generating OOD images, the process refines them by using OOD scores (from a separate detector) as a gradient signal to guide the diffusion model. This iterative process gradually shifts the image's focus away from the original subject towards the contextual elements, creating synthetic OOD images that are visually similar to InD data but semantically distinct and located near the InD/OOD boundary.
  2. Fine-tuning the CLIP Image Encoder: A projection layer is added to the CLIP image encoder. This layer, along with the CLIP image encoder (which remains frozen), is trained using both InD data and the generated synthetic OOD images paired with negative labels. The selection of InD data for this phase is strategic, prioritizing images with higher complexity to ensure the model learns robust representations.
  3. Fine-tuning the CLIP Text Encoder Features: A subset of negative label features derived from the CLIP text encoder is 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, further improving the model's ability to align confusing OOD samples with appropriate negative labels.

Datasets

  • InD Data: ImageNet-1k (standard for training and evaluation).
  • OOD Datasets: iNaturalist, SUN, Places365, Texture, ImageNet-O, SSB-hard, NINCO, OpenImage-O.
  • Benchmark: OpenOOD benchmark is used for evaluation, which includes both near-OOD and far-OOD scenarios.

Key Insights and Ideas

  • The Power of "Near-Boundary" Data: The paper strongly emphasizes that generating OOD samples specifically near the decision boundary is key to improving detection. These are the hardest cases, and SynOOD's iterative generation process excels at creating them.
  • MLLMs as Creative Assistants: Using MLLMs to extract contextual elements for diffusion prompts is an innovative way to guide image generation beyond simple text-to-image synthesis, enabling more nuanced OOD sample creation.
  • Iterative Refinement is Crucial: The iterative in-painting process, guided by OOD scores, is more effective than single-pass generation for creating realistic and challenging OOD samples. It allows for controlled manipulation of image content.
  • Step-by-Step Fine-tuning Wins: The experiments show that a step-by-step fine-tuning approach (first image encoder, then text features) is more stable and effective than joint training, highlighting the importance of carefully structuring the training pipeline.
  • Negative Labels are Essential for Boundary Cases: Fine-tuning with negative labels is critical for pushing ambiguous OOD samples away from InD classes, and SynOOD's method of adapting these negative label features is a significant contribution.

Key Results

SynOOD achieves state-of-the-art performance on the ImageNet benchmark, outperforming existing methods by:

  • Improving AUROC by 2.80%.
  • Reducing FPR95 by 11.13%.

The method also demonstrates strong performance on the OpenOOD benchmark, particularly in challenging far-OOD scenarios, even when trained on a smaller subset of ImageNet data. The computational overhead is minimal, adding less than 1% additional parameters and taking under 2 ms per image during inference.

Limitations and Future Work

  • Data Generation Cost: While efficient, the iterative generation process still involves diffusion models, which can be computationally intensive.
  • Fine-tuning Strategy: The paper notes that fine-tuning the projection layer with a large number of synthetic samples might lead to overfitting, and the best performance is achieved when the projection layer is trained separately from the negative label features. This suggests a delicate balance is needed.
  • Future Directions: The authors suggest that SynOOD opens new directions for OOD detection using generative methods and encourages research into similar strategies for improving model robustness in other tasks. The success of SynOOD highlights the potential of synthetic data generation for addressing complex machine learning challenges.

Summary updated

BibTeX
@inproceedings{li2025synthesizing,
  author = {Jinglun Li and Kaixun Jiang and Zhaoyu Chen and Bo Lin and Yao Tang and Weifeng Ge and Wenqiang Zhang},
  title = {{Synthesizing Near-Boundary OOD Samples for Out-of-Distribution Detection}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
}
Figure