AdaNeg: Adaptive Negative Proxy Guided OOD Detection with Vision-Language Models

Yabin Zhang, Lei Zhang

In the world of open-world AI, knowing what you don't know is just as important as knowing what you do. This is the core of Out-of-Distribution (OOD) detection: the ability of a model to flag test samples that belong to classes it never saw during training.

A new paper from researchers at The Hong Kong Polytechnic University, titled AdaNeg, introduces a clever way to boost OOD detection in Vision-Language Models (VLMs) like CLIP without requiring any extra training or manual annotations.

TL;DR

AdaNeg improves OOD detection by dynamically generating "adaptive negative proxies" from actual test images during inference. By moving away from static, text-based "negative labels" and instead learning from the visual features of the OOD data it actually encounters, AdaNeg achieves state-of-the-art performance while remaining fast and training-free.

What Problem Does This Paper Address?

Standard OOD detection often relies on "negative labels"—textual descriptions of things that are definitely not in the training set. For example, if a model is trained to recognize dogs and cats (In-Distribution, or ID), a researcher might give it a list of "negative labels" like "car," "tree," or "airplane" to help it identify OOD samples.

The problem is semantic misalignment. Static text labels are often a poor proxy for the actual visual space of OOD images a model might encounter in the wild. A text label like "boat" doesn't capture the infinite visual variety of actual boats, nor does it help if the model suddenly encounters a "microscope." There is a fundamental mismatch between the fixed textual proxies and the dynamic visual reality of the test environment.

Methods

The authors propose AdaNeg (Adaptive Negative proxies), which shifts the focus from static text to dynamic visual features. Here is how the framework operates:

AdaNeg Architecture
  1. Selective Caching: As the model processes test images, it identifies samples it is highly confident are OOD. It stores the visual features of these samples in a feature memory bank. To ensure the memory isn't "polluted" by misclassified ID samples, they use a "gap" strategy—only caching samples that fall well outside the ID score range.
  2. Task-Adaptive Proxies: The model averages the features in the memory bank to create a global representation of the current OOD "task." This helps the model understand the general characteristics of the specific OOD dataset it is currently facing.
  3. Sample-Adaptive Proxies: To get even more granular, AdaNeg uses an attention mechanism. When a new test image comes in, it acts as a "query" to the memory bank, weighting the cached features based on their similarity to that specific image. This captures fine-grained, sample-level nuances.
  4. Multi-modal Scoring: Finally, the model combines the scores from the traditional textual negative labels with the scores from these new visual adaptive proxies. This blends the broad "common sense" of language with the specific "visual evidence" from the test stream.

Crucially, this entire process is training-free. It happens entirely during the "test-time" or inference phase, involving only lightweight memory operations rather than expensive backpropagation.

Datasets

The researchers evaluated AdaNeg on several rigorous benchmarks:

  • ID Datasets: ImageNet-1k, CIFAR-10, and CIFAR-100.
  • OOD Datasets: iNaturalist, SUN, Places, and Textures.
  • OpenOOD Benchmark: A comprehensive suite that categorizes OOD data into "near-OOD" (visually similar to ID) and "far-OOD" (visually distinct).
  • Medical Domain: To test generalization, they used the BIMCV-COVID19+ dataset (chest X-rays vs. CT scans).

Key Insights and Ideas

  • Visual Knowledge > Textual Proxies: The core insight is that the best proxy for an OOD image is other OOD images. By looking at the actual distribution of "unknowns" during testing, the model can build a much sharper boundary than it ever could with pre-defined text labels.
  • Selectivity is Safety: You can't just trust every "unknown" sample. The authors' use of a "confidence gap" for caching is vital. It prevents the model from accidentally learning that an unusual "dog" (ID) is actually a proxy for "not-dog" (OOD).
  • Efficiency Matters: Many "test-time adaptation" methods are slow because they require updating model weights. AdaNeg maintains a high throughput because it only updates a small external memory bank.

Key Results

AdaNeg sets a new high bar for training-free OOD detection.

OOD Detection Performance Comparison
  • ImageNet Performance: On the massive ImageNet benchmark, AdaNeg achieved a 2.45% increase in AUROC (Area Under the Receiver Operating Characteristic) and a massive 6.48% reduction in FPR95 (False Positive Rate at 95% True Positive Rate) compared to the previous state-of-the-art, NegLabel.
  • Robustness: It consistently outperformed competitors across both "near-OOD" and "far-OOD" scenarios.
  • Cross-Domain Success: Without any fine-tuning, AdaNeg significantly outperformed existing methods on medical imaging datasets, proving that its adaptive nature allows it to jump into entirely new domains with ease.

Limitations and Future Work

The authors identify one primary limitation: Memory Requirements. While the computational cost is low, storing the feature memory bank requires extra RAM (about 215MB for ImageNet). While negligible for a server, this could be a constraint for memory-limited edge devices like smart cameras or drones.

Future work might explore ways to compress this memory bank or adaptively prune it to keep the footprint even smaller without sacrificing the performance gains.

Summary updated

BibTeX
@inproceedings{zhang2024adaneg,
  author = {Yabin Zhang and Lei Zhang},
  title = {{AdaNeg: Adaptive Negative Proxy Guided OOD Detection with Vision-Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=vS5NC7jtCI},
}
Figure