Out-of-Distribution Detection with Positive and Negative Prompt Supervision Using Large Language Models

Zhixia He, Chen Zhao, Minglai Shao, Xintao Wu, Xujiang Zhao, Dong Li, Qin Tian, Linlin YuarXiv 2025 · DOI

Introduction

In real-world machine learning deployments, such as autonomous driving or medical diagnostics, models inevitably encounter "Out-of-Distribution" (OOD) data—samples from classes they were never trained to recognize. Standard models often mistakenly classify these with high confidence, creating significant safety risks. While Vision-Language Models (VLMs) like CLIP have improved OOD detection by using text labels, they typically rely on generic prompts (e.g., "a photo of a dog"). The Positive and Negative Prompt Supervision (PNPS) framework addresses this by using Large Language Models (LLMs) to generate highly specific "what it is" and "what it isn't" descriptions, creating sharper classification boundaries.

Methodology

The PNPS framework operates in three distinct phases to bridge the gap between textual semantic knowledge and visual processing:

  1. Prompt Construction with LLMs: Instead of generic descriptions, the system prompts LLMs (like GPT-4o or Claude) to identify features that distinguish one class from its "super-class" neighbors. For example, to distinguish a tiger, the LLM might generate a positive feature ("striped fur") and a negative feature ("no pointy ears").
  2. Alignment of Modalities: Learnable parameter matrices for both text and images are optimized using five specialized loss functions (PIR, PPD, NIR, NND, and NPD). These ensure that positive prompts stay close to their images, negative prompts stay near class boundaries, and all prompts remain semantically distinct.
  3. Cross-Modal Graph Neural Networks: Using a Vision GNN (ViG), the model builds a graph where image patches and optimized prompt representations are nodes. This allows high-level semantic knowledge to propagate directly into visual features, helping the model "know what to look for" to identify OOD samples.
The three-phase architecture of the PNPS framework, illustrating prompt construction, modality alignment, and the cross-modal graph neural network.

Key Insights and Results

The Power of Negative Prompts

A striking finding of this research is that negative prompts ("what a class is not") are often more effective at defining decision boundaries for OOD detection than positive prompts. Ablation studies demonstrate that a model using only negative prompts consistently outperforms one using only positive ones. This suggests that defining the "not-class" space is critical for robust OOD detection.

Performance Benchmarks

PNPS achieved new state-of-the-art results across major benchmarks like CIFAR-100 and ImageNet-1K. On the CIFAR-100 benchmark, PNPS improved the AUROC by 1.06% to 4.41% over existing baselines. Furthermore, the framework significantly lowered the False Positive Rate at a 95% True Positive Rate (FPR95). For instance, on the Texture dataset, PNPS reduced FPR95 to 18.83%, compared to 37.74% for the CLIPN baseline.

Performance comparison of PNPS against ablation variants (without negative or positive prompts) across AUROC, AUPR, and FPR95 metrics on multiple datasets.

LLM Agnosticism

While GPT-4o performed marginally better, the variance between different top-tier LLMs (including DeepSeek-R1 and Claude 3.7 Sonnet) was remarkably low. This indicates that the optimization and graph architecture of the PNPS framework are the primary drivers of performance, rather than the specific choice of LLM.

Conclusion

The PNPS framework demonstrates that integrating fine-grained semantic supervision—particularly negative descriptions—significantly enhances a model's ability to distinguish between known and unknown distributions. By leveraging the descriptive power of LLMs and the relational processing of GNNs, PNPS sets a new standard for safe and reliable visual recognition in open-world environments.

Summary updated

BibTeX
@misc{he2025out,
  author = {Zhixia He and Chen Zhao and Minglai Shao and Xintao Wu and Xujiang Zhao and Dong Li and Qin Tian and Linlin Yu},
  title = {{Out-of-Distribution Detection with Positive and Negative Prompt Supervision Using Large Language Models}},
  year = {2025},
  eprint = {2511.10923},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.10923},
}
Figure