Embracing Collaboration Over Competition: Condensing Multiple Prompts for Visual In-Context Learning
Jinpeng Wang, Tianci Luo, Yaohua Zha, Yan Feng, Ruisheng Luo, Bin Chen, Tao Dai, Long Chen, Yaowei Wang, Shu-Tao Xia
TL;DR
The paper addresses the limitation of single-prompt selection in Visual In-Context Learning by introducing prompt condensation, where multiple prompts collaborate through the Condenser plugin to provide rich, high-resolution context. The Condenser performs end-to-end, patch-wise cross-attention across candidate prompts to produce a condensed prompt, optimized with two learning objectives: token prediction for query labels and a pre-alignment term to align condensed prompts with the query. Experiments on foreground segmentation, object detection, and image colorization show Condenser outperforms state-of-the-art baselines, with better scalability as the number of prompts increases and enhanced efficiency compared to ensemble approaches. This approach demonstrates a practical pathway to improve VICL generalization and efficiency, enabling more robust use of diverse contextual cues in vision tasks.
Abstract
Visual In-Context Learning (VICL) enables adaptively solving vision tasks by leveraging pixel demonstrations, mimicking human-like task completion through analogy. Prompt selection is critical in VICL, but current methods assume the existence of a single "ideal" prompt in a pool of candidates, which in practice may not hold true. Multiple suitable prompts may exist, but individually they often fall short, leading to difficulties in selection and the exclusion of useful context. To address this, we propose a new perspective: prompt condensation. Rather than relying on a single prompt, candidate prompts collaborate to efficiently integrate informative contexts without sacrificing resolution. We devise Condenser, a lightweight external plugin that compresses relevant fine-grained context across multiple prompts. Optimized end-to-end with the backbone, Condenser ensures accurate integration of contextual cues. Experiments demonstrate Condenser outperforms state-of-the-arts across benchmark tasks, showing superior context compression, scalability with more prompts, and enhanced computational efficiency compared to ensemble methods, positioning it as a highly competitive solution for VICL. Code is open-sourced at https://github.com/gimpong/CVPR25-Condenser.
