Abstract
Visual In-Context Learning (VICL) enables foundation models to perform new tasks via few-shot examples. However, performance is highly sensitive to the specific examples chosen. We present Partial2Global, a framework that identifies globally optimal prompts using a transformer-based list-wise ranker and a consistency-aware aggregator. Our method significantly outperforms existing similarity-based and pair-wise ranking approaches across segmentation, detection, and colorization tasks.
Introduction
Visual In-Context Learning (VICL) allows Visual Foundation Models (VFMs) to solve new tasks—like segmenting a specific object or colorizing an image—simply by looking at a few "prompt" examples (pairs of images and their corresponding labels). The choice of examples matters immensely; a "bad" prompt can lead to total failure, while a "good" one unlocks the model's full potential. Previous approaches usually relied on simple visual similarity or pair-wise ranking, which often fail to capture the complex relationships between multiple candidate examples. This paper introduces Partial2Global to solve the "needle in a haystack" problem of prompt selection.
Methodology
The authors introduce Partial2Global, a two-stage framework designed to find the "global optimal" prompt from a large pool of candidates.
Transformer-based List-wise Ranker
Instead of looking at candidates in isolation, this model takes a query image and a list of $k$ potential in-context examples. By using a transformer architecture, the model can "see" how candidates relate to each other and the query simultaneously, leading to a much more nuanced ranking.
Consistency-aware Ranking Aggregator
Ranking every single candidate in a massive database at once is computationally impossible. Instead, Partial2Global ranks many small, overlapping subsets. To turn these partial rankings into a single, reliable "master list," the authors use a least-squares optimization approach (inspired by Hodge theory) to minimize inconsistencies and produce a globally consistent ranking.
Experimental Results
The framework was evaluated on three distinct visual tasks: foreground segmentation (Pascal-$5^i$), single object detection (Pascal VOC 2012), and image colorization (ImageNet).
Key Insights
- Similarity is not Quality: Visual similarity (measured by feature distance) is a poor predictor of how well an example will perform as a prompt. Many images with high visual similarity to the query result in poor performance (low IoU).
- The Power of the "List": Moving from pair-wise comparison to list-wise comparison allows the model to learn the "inner relationship" between alternatives.
- Robustness through Aggregation: By treating the global ranking as an optimization problem, the system can correct occasional mistakes made by the partial rankers.
Quantitative and Qualitative Performance
Partial2Global establishes a new state-of-the-art for VICL prompt selection. On the Pascal-$5^i$ benchmark, it outperformed the previous best method (SupPR) by an average of 2.84 mIoU. For detection, it achieved 30.66 mIoU, a significant jump over SupPR's 28.22. Qualitatively, the model is much better at handling complex scenes, selecting prompts that clarify spatial relationships and target objects more effectively.
Conclusion
Partial2Global provides a robust solution for the prompt selection bottleneck in VICL. While performance is still capped by the capabilities of the underlying Visual Foundation Model, the transition to list-wise ranking and global aggregation offers a significant accuracy boost. Future directions include exploring stronger foundation models and investigating how to mitigate biases in training data.
Summary updated