Abstract
Out-of-Distribution (OOD) detection is critical for the safe deployment of machine learning models, yet it remains challenging in few-shot scenarios where labeled data is scarce. Traditional fine-tuning methods often suffer from overfitting and high computational costs. We present Dual-Adapter, a training-free framework that leverages the pre-trained knowledge of CLIP for efficient few-shot OOD detection. By decomposing feature vectors into positive and negative channels and employing a dual-cache mechanism, Dual-Adapter achieves state-of-the-art performance without the need for backpropagation.
Introduction
In real-world applications, machine learning models frequently encounter inputs that do not belong to any of the classes seen during training. Identifying these "unknowns" is the goal of Out-of-Distribution (OOD) detection. In the few-shot setting, where only a handful of examples per category are available, the risk of overfitting is high. Existing approaches like prompt tuning (CoOp) or adapter-based fine-tuning (Tip-Adapter) often struggle to balance identifying known classes with rejecting unknown ones.
Dual-Adapter addresses these challenges by introducing a training-free dual adaptation strategy. It avoids the pitfalls of fine-tuning by using a cache-based approach and enhances OOD sensitivity by explicitly modeling what an image is not alongside what it is.
Methodology
The Dual-Adapter framework is built upon the CLIP model and consists of two primary components: channel-wise feature selection and a dual cache model.
Feature Selection: Positive vs. Negative Channels
A key insight of this work is that not all dimensions of a CLIP feature vector are equally informative for a specific task. The authors categorize channels based on their utility:
- Positive Channels: These are dimensions with high inter-class variance and low inter-class similarity, representing the "signal" that distinguishes known categories.
- Negative Channels: These dimensions represent background noise or features common across many classes, which can interfere with classification but are useful for identifying OOD samples.
The Dual Cache Model
Instead of training weights, Dual-Adapter constructs two parallel adapters using a cache of few-shot features:
- Positive Adapter: Operates on positive channels to predict the most likely in-distribution (ID) class.
- Negative Adapter: Operates on negative channels and utilizes negative text templates (e.g., "background of {class}") to capture features that characterize what the image is not.
By combining the outputs of these two adapters through a "softmax + half" operation, the model can effectively suppress OOD samples that might otherwise receive high confidence scores from a standard classifier.
Experimental Setup
The performance of Dual-Adapter was evaluated using ImageNet-1K as the In-Distribution (ID) dataset. Four diverse datasets were used for Out-of-Distribution (OOD) testing: iNaturalist (fine-grained), SUN (scenes), Places (locations), and Texture (patterns). The model was tested in 1, 2, 4, 8, and 16-shot settings.
Results and Discussion
Dual-Adapter demonstrates significant improvements over existing few-shot methods like CoOp, LoCoOp, and Tip-Adapter.
Performance Metrics
- AUROC: Dual-Adapter achieved an average AUROC of 93.62%, consistently outperforming LoCoOp across all shot settings.
- FPR95: The method significantly reduced the False Positive Rate at 95% True Positive Rate (FPR95) to 30.50%, a 3.48% improvement over the previous state-of-the-art.
Efficiency
Unlike methods that require hours of fine-tuning (e.g., LoCoOp), Dual-Adapter is training-free. It reaches peak performance in seconds by simply populating its cache from the provided few-shot examples. This makes it highly suitable for dynamic environments where new classes must be integrated quickly.
Conclusion
Dual-Adapter provides a robust and efficient solution for few-shot OOD detection. By leveraging the inherent structure of CLIP features and a dual-cache strategy, it avoids overfitting and eliminates training overhead. Future work may explore extending this dual adaptation logic to more complex tasks such as open-world object detection and segmentation.
Summary updated