TL;DR
Vision-language models can detect out-of-distribution (OOD) images by comparing them to thousands of "negative" text labels, but many of these labels fail to activate on actual test data. This paper introduces Test-time Activated Negative Labels (TANL), a training-free method that dynamically selects and weights negative labels based on real-time test data activations. TANL slashes the false positive rate (FPR95) on the large-scale ImageNet benchmark from 17.5% to 9.8% without needing any optimization or fine-tuning.
What Problem Does This Paper Address?
Out-of-distribution (OOD) detection is a critical safety mechanism for deploying machine learning models in the wild, ensuring that a system can say "I don't know" when encountered with concepts outside its training data. Recent zero-shot approaches leverage Vision-Language Models (VLMs) like CLIP by mining thousands of "negative labels" (words semantically distant from in-distribution [ID] classes) from a massive text corpus. The intuition is simple: an OOD image should align better with these negative labels than with known ID labels.
However, the authors identify a major flaw in this pipeline: these negative labels are selected purely based on text-to-text distances from ID labels, completely ignoring the actual distribution of the test images. Consequently, many mined negative labels exhibit poor "activation" (low classification probability) on actual OOD samples, acting as noise or even misleading the detector by sitting closer to the ID data.
Methods
To address this, the authors propose TANL (Test-time Activated Negative Labels), a framework that dynamically evaluates and mines candidate negative labels online during the testing process.
The core components of TANL include:
- Label Activation Metric: Quantifies how "active" a label is by measuring its average classification probability across a dataset.
- Distribution-Adaptive Queues: TANL maintains two fixed-length First-In-First-Out (FIFO) queues containing high-confidence positive (ID) and negative (OOD) test image features. These queues dynamically update online to adaptively align with the real-world test distribution.
- Batch-Adaptive Refinement: To handle sudden temporal shifts or localized data characteristics, TANL blends historical queue information with the current test batch data using a balancing hyperparameter ($\alpha$).
- Activation-Aware Scoring Function ($S_{aa}$): Instead of treating all negative labels equally, TANL introduces a novel scoring function that implicitly assigns higher weights to labels with stronger activations, amplifying their contribution to the final OOD decision.
Datasets
The authors validated TANL across a wide array of benchmarks:
- In-Distribution (ID) Benchmarks: ImageNet-1k and CIFAR.
- Out-of-Distribution (OOD) Datasets: iNaturalist, SUN, Places, and Textures.
- Evaluation Settings: OpenOOD benchmark (Near-OOD and Far-OOD tasks), full-spectrum OOD (including covariate shifts like ImageNet-C, ImageNet-R, and ImageNet-V2), and specialized medical image datasets.
Key Insights and Ideas
- Static Text Mining is Blind to Visual Reality: Mining negative labels purely via text embeddings results in a long-tailed activation distribution. Only a tiny fraction of labels actually help detect OOD samples; the rest introduce performance-degrading noise.
- Test-Time Adaptation Without Backpropagation: Traditional test-time adaptation relies on slow, resource-intensive gradient descent optimizations. TANL proves that tracking running statistics via simple FIFO queues of image features is fast, efficient, and highly adaptive.
- Implicit Weighting Beats Hard Thresholds: The activation-aware score function naturally amplifies the impact of highly active labels by repeating them in the denominator of the probability calculation. This makes the system incredibly robust to the total number of negative labels ($M$) selected.
Key Results
- State-of-the-Art Zero-Shot Performance: On the large-scale ImageNet-1k benchmark, TANL reduces the False Positive Rate (FPR95) to 9.81%, down from NegLabel's 25.40% and the previous leading training-free method CSP's 17.51%.
- Challenging Near-OOD Improvements: In the difficult OpenOOD Near-OOD setting, TANL achieves an FPR95 of 60.06%, significantly outperforming NegLabel (69.45%).
- High Efficiency: TANL operates at 527 FPS on a standard ViT-B/16 backbone, making it highly practical for real-time streaming applications. It even achieves strong results using smaller backbones like ResNet50 (790 FPS, 10.37% FPR95).
Limitations and Future Work
- Initialization Dependency: At the very beginning of the testing process, the FIFO queues must be initialized using ID label features and random Gaussian noise images. Performance during these initial frames might be less stable before high-confidence test samples accumulate.
- Corpus Scale: The quality of the activated negative labels is inherently bounded by the diversity of the external text corpus used. Integrating large language models (LLMs) to generate more descriptive or context-aware candidate labels on the fly represents a promising future direction.
Summary updated