TriPrompt: Progressive Local Prompting for Few-shot Out-of-Distribution Detection

Ziyou Xiang, Chaowei Fang, Zhihong Wu, Jiliang Li, Di Xu, De ChengNeurIPS 2026

TL;DR

Vision-language models like CLIP often struggle to reject unfamiliar objects when those objects share subtle visual parts with known categories. TriPrompt solves this by teaching the model to view image patches not in black-and-white ("known" vs. "background"), but in three shades: unmistakable class features, clear background, and the ambiguous gray area in between. By explicitly modeling this fuzzy transition zone—using only a handful of training images and zero external anomaly data—TriPrompt dramatically cuts down false alarms in open-world recognition.

What Problem Does This Paper Address?

Imagine deploying a wildlife classifier trained on wolves. One night, a coyote walks past the camera. A reliable system needs Out-of-Distribution (OOD) detection—the ability to say "I don't know what that is" instead of confidently yelling "Wolf!"

Pre-trained vision-language models like CLIP are great foundations for this, especially in few-shot settings (where you only have 4 or 16 training images per class and zero examples of OOD anomalies). Early CLIP-based detectors relied on global, whole-image features, which easily miss subtle regional clues. Newer methods look at local image patches, typically splitting them into a strict binary: foreground object ("in-distribution" or ID) versus background ("non-ID").

Here’s the catch: nature isn’t binary. What about furry ears or paws that appear on both wolves and coyotes? If a model absorbs these ambiguous, shared patches into its definition of "wolf," it will falsely accept coyotes. If it treats them strictly as "non-wolf," it throws away useful clues for recognizing actual wolves. Existing methods leave this tricky transition zone completely unmodeled.

Methods

Keeping the CLIP backbone completely frozen, TriPrompt optimizes tiny sets of learnable text tokens (prompts) that act as specialized detectors across image patches produced in a single forward pass.

Figure 1: Overview of TriPrompt. TriPrompt is built upon a frozen CLIP backbone and integrates a global prompt branch with Core-ID, OOD, and Far-ID local prompts to model reliable ID evidence, weak non-ID proxies, and ambiguous transition-region cues.

Instead of a binary split, TriPrompt decomposes local patch evidence into three progressive regimes:

  • Core-ID Prompts (Standard): Built on an existing framework (GalLop), each known class gets positive prompts trained to lock onto the most unmistakable, class-defining object parts.
  • OOD Prompts (Novel): Since no real OOD images exist during training, how do you learn what "unknown" looks like? TriPrompt mines the patches in training images that trigger the lowest Core-ID responses (like sky, grass, or generic textures) as weak non-ID proxies. A shared pool of OOD prompts aligns with these background patches, regularized to stay diverse so they don't all collapse onto the same feature.
  • Far-ID Prompts (Novel): This is the secret sauce. Looking at the remaining non-background patches, TriPrompt calculates the gap between OOD and Core-ID scores. Patches where the two scores are nearly tied sit right in the ambiguous gray zone. Class-specific Far-ID prompts are trained to capture these boundary features, while mathematical guardrails (orthogonality and suppression losses) prevent them from encroaching on Core-ID territory.

At inference time, TriPrompt combines a standard global CLIP confidence score with a local score. Crucially, both OOD and calibrated Far-ID responses act as suppression terms—actively pushing down the model's confidence when an unfamiliar object tries to sneak by on the strength of a few familiar-looking patches.

Datasets

No new benchmarks are introduced; the authors evaluate on standard OOD suites:

  • In-Distribution (ID): ImageNet-1K (trained with 4-shot and 16-shot samples per class).
  • Standard OOD: Disjoint categories from iNaturalist (plants/animals), SUN (scenes), Places, and Textures.
  • Near-OOD: ImageNet-10 and ImageNet-20 swapped back and forth as ID and OOD sets to test fine-grained semantic separation where classes look remarkably similar.

Key Insights and Ideas

  • Ambiguity needs its own bucket: Ablation studies show that adding OOD prompts helps, and adding Far-ID prompts helps—but combining them yields the best results. Modeling the gray zone explicitly prevents shared object parts from triggering overconfident false positives.
  • "Patch-native" efficiency: Prior local OOD methods often rely on expensive, repeated random cropping and multiple forward passes to isolate local regions. Because TriPrompt mines Core-ID, Far-ID, and OOD proxies directly from the patch tokens of a single CLIP forward pass, training supervision aligns natively with inference.
  • Plug-and-play compatibility: TriPrompt's local scoring isn't married to one detector; it acts as a modular booster rocket that improves several distinct zero-shot global CLIP scoring methods right out of the box.

Key Results

  • Standard OOD: On ImageNet-1K (16-shot), TriPrompt drops the average FPR95 (the false positive rate on OOD samples when 95% of ID samples are correctly detected—lower is much better) to 20.41%, beating recent few-shot competitors like Local-Prompt (28.27%) and APT (26.03%), and even outperforming full-dataset methods like LAPT (23.40%).
Table 1: Results when ImageNet-1k is used as ID data. We compare full-data and few-shot tuning methods. † represents the result by our re-implementation. For the few-shot (4-shot/16-shot) setting, Bold and underline denote the best and second-best results in each column, respectively. The same convention is used in all subsequent tables, where best and second-best are determined within each shot setting.
  • Near-OOD: On the tough ImageNet-10 / ImageNet-20 benchmark, TriPrompt slashes average FPR95 to 3.35% (down from 5.05% for Local-Prompt) with a 99.15% AUROC.
  • Global Compatibility: Pairing TriPrompt's local branch with global zero-shot detectors cuts MCM's average FPR95 more than in half (from 43.93% to 20.51%) and pushes CSP down from 17.51% to 14.00%.
  • ID Accuracy: It maintains a competitive 74.3% classification accuracy on ImageNet-1K, proving it doesn't sacrifice basic recognition to achieve OOD safety. Visual heatmaps and t-SNE plots confirm Core-ID hugs foregrounds, OOD hugs backgrounds, and Far-ID cleanly straddles the boundary between knowns and unknowns.

Limitations and Future Work

The authors do not include a dedicated limitations section, though Tables 1 and 3 show minor trade-offs: on texture-heavy anomalies (Textures dataset), TriPrompt trails specialized methods like ID-like and FAGL, and its 16-shot ID accuracy (74.3%) sits slightly below its base architecture GalLop (75.1%). For future work, the authors suggest moving beyond rigid binary ID–OOD separation toward more nuanced, multi-stage uncertainty modeling for open-world recognition.

Summary updated

Abstract

Few-shot out-of-distribution (OOD) detection is essential for deploying recognition models in open-world environments, where a reliable model should correctly recognize in-distribution (ID) samples while rejecting samples from unseen categories. Recent CLIP-based methods have shown promising few-shot OOD detection ability by exploiting transferable vision--language representations. However, many methods rely mainly on global image features or emphasize only the most class-discriminative local cues, making them less effective for OOD detection where ID and OOD samples share visually similar local patterns. Although local prompting introduces patch-level reasoning, existing methods often treat local evidence as a binary distinction between ID-related and non-ID cues, leaving the ambiguous transition region between reliable ID evidence and clear non-ID evidence insufficiently modeled. To address this issue, we propose ThriPrompt, a progressive local prompting framework for few-shot OOD detection. TriPrompt decomposes patch-level evidence into three complementary components within a unified local feature space: Core-ID cues that provide reliable class-defining evidence, Far-ID cues that capture ambiguous transition-region evidence, and OOD cues learned from weak non-ID proxies mined directly from patch features. This patch-native design enables suppression-aware local reasoning without requiring additional OOD data or repeated multi-crop feature extraction. At inference time, TriPrompt combines global CLIP confidence with Core-ID, Far-ID, and OOD local responses to reduce overconfident ID assignment on hard OOD samples. Experiments on ImageNet-1K OOD benchmarks show that TriPrompt consistently improves few-shot OOD detection performance and remains compatible with mainstream CLIP-based scoring methods. Our code is provided in the supplementary material.
BibTeX
@inproceedings{xiang2026triprompt,
  author = {Ziyou Xiang and Chaowei Fang and Zhihong Wu and Jiliang Li and Di Xu and De Cheng},
  title = {{TriPrompt: Progressive Local Prompting for Few-shot Out-of-Distribution Detection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=v0wZGD2GDB},
}
Figure