TL;DR
Local-Prompt is a novel coarse-to-fine prompt tuning paradigm that significantly boosts few-shot Out-of-Distribution (OOD) detection in vision-language models like CLIP. By freezing global prompts and optimizing trainable local prompts to capture fine-grained regional differences, it achieves state-of-the-art performance—reducing average FPR95 by 5.17% on ImageNet-1k with just 4 training examples per class.
What Problem Does This Paper Address?
Out-of-Distribution (OOD) detection ensures that machine learning systems can safely flag unknown objects or anomalies rather than confidently misclassifying them. Recently, researchers have turned to Vision-Language Models (VLMs) like CLIP for this task, using "few-shot prompt tuning" to adapt the model using only a handful of In-Distribution (ID) images.
However, existing methods focus almost entirely on optimizing global prompts (e.g., describing the whole image). This creates a massive blind spot: the most challenging OOD cases often look identical to ID classes on a macro level and only differ in subtle, localized regions. For instance, a cat and a tiger share massive global similarities, differing primarily in local textures or facial markings. Global prompt tuning fails to capture these fine-grained regional nuances, leading to high false-positive rates.
Methods
To bridge this gap, the authors propose Local-Prompt, a coarse-to-fine tuning paradigm that decouples global and local prompt optimization. They freeze the global prompts and introduce trainable local prompts designed to interact specifically with patch-wise regional image features.
The framework consists of two core components:
- Global Prompt Guided Negative Augmentation: Since real OOD data isn't available during few-shot training, the method generates "imaginary" local outliers. It takes random crops of an ID image and uses the frozen, coarse global prompts to rank them. Crops with the highest similarity serve as positive ID regions, while crops with the lowest similarity are treated as "hard negative" (outlier) regions.
- Local Prompt Enhanced Regional Regularization: The model trains local prompts for known classes alongside a set of "local negative prompts" to capture outlier semantics. It optimizes these using a regional contrastive loss (forcing the model to highlight ID regions and push away negative regions) and a diversity regularization loss to prevent the negative prompts from collapsing into identical representations.
An elegant advantage of this approach is its extensibility. Because it focuses purely on local prompts, it is fully orthogonal to existing global prompt tuning methods (like LoCoOp). At inference time, users can seamlessly pair these trained local prompts with any optimized global prompts to get a synergistic performance boost.
Datasets
The authors evaluated their method using large-scale benchmarks:
- In-Distribution (ID) Datasets: ImageNet-1k and ImageNet-100.
- Out-of-Distribution (OOD) Datasets: A standard evaluation suite combining iNaturalist, SUN, Places, and Texture.
- Near-OOD Benchmarks: ImageNet-10 and ImageNet-20 subsets, specifically used to evaluate performance on highly semantically similar ID/OOD pairs.
Key Insights and Ideas
- The Power of Prompt Decoupling: Using the same prompt template for both global image tokens and local patch tokens introduces a domain gap. Separating them allows local prompts to specialize in fine-grained textures and regional boundaries.
- Sensing Outliers via Space Translation: Simple random cropping, when guided by a frozen global model, is surprisingly effective at isolating background noise, context, and non-class features to simulate local outlier knowledge.
- No Trade-off Between Safety and Accuracy: Traditionally, tuning a model to aggressively reject OOD samples can compress the feature space and harm standard classification accuracy. Local-Prompt avoids this, actually improving ID classification accuracy by refining the model's understanding of local class-specific features.
Key Results
- State-of-the-Art OOD Rejection: In 4-shot tuning on ImageNet-1k, combining Local-Prompt with LoCoOp reduced the average False Positive Rate at 95% recall (FPR95) by 5.17% compared to the previous best method. Remarkably, its 4-shot performance outperformed the 16-shot performance of prior methods.
- Conquering Near-OOD Tasks: On the difficult ImageNet-10 vs. ImageNet-20 task (where categories are highly similar), Local-Prompt slashed the average FPR95 from 11.60% (LoCoOp) down to 5.05%.
- Simultaneous Accuracy Boost: Local-Prompt achieved a 1.02% improvement in ID classification accuracy under the 4-shot setting and a 2.38% boost in the 16-shot setting, proving that local feature refinement aids standard classification.
Limitations and Future Work
- Training Time Overhead: The negative augmentation step requires processing multiple random crops per image, which increases computational overhead during training. However, the authors note it is still highly practical, requiring only about 4 hours for a 4-shot training run on a single NVIDIA A6000 GPU.
- Frozen Global Constraints: In this work, global prompts are kept strictly frozen during the training of local prompts. Jointly optimizing both in a unified, end-to-end framework remains an open challenge.
- Expansion Beyond Classification: The current iteration is tailored for image classification. Extending local prompts to dense open-world vision tasks, such as object detection and semantic segmentation, is a promising direction for future research.
Summary updated