让标签指导提示检索,提升视觉上下文学习性能
Love Me, Love My Label: Rethinking the Role of Labels in Prompt Retrieval for Visual In-Context Learning

- 设计图像-标签联合表征,显式利用标签信息选提示
- 在多个任务上实现显著且一致的性能提升
- 适合需要高质量提示检索的视觉模型研究者
视觉上下文学习(VICL)通过示范性提示引导视觉基础模型完成多任务。提示选择极大影响VICL效果,是关键挑战。现有方法主要关注提示图像而忽略标签,导致有时选取视觉相似但标签不一致的提示,可能降低性能。我们发现查询与提示间更高的标签一致性更有利于提升VICL表现。为此提出LaPR(标签感知提示检索)框架,显式强调标签作用:首先构建图像-标签联合表示以融入标签线索;针对测试时查询标签缺失的问题,引入专家混合机制与查询自适应路由,使各专家捕捉特定标签模式,路由模块动态分配权重以学习标签感知表示。通过基于VICL性能的对比损失和标签引导的对比损失分别优化专家与路由。大量实验表明,LaPR在上下文分割、检测和着色任务上均有显著且一致的提升。同时在不同特征提取器和跨折场景中表现出良好泛化能力,验证了标签在提示检索中不可或缺的作用。代码已开源。
原文摘要 · Abstract (English)
Visual in-context learning (VICL) enables visual foundation models to handle multiple tasks by steering them with demonstrative prompts. The choice of such prompts largely influences VICL performance, standing out as a key challenge. Prior work has made substantial progress on prompt retrieval and reranking strategies, but mainly focuses on prompt images while overlooking labels. We reveal these approaches sometimes get visually similar but label-inconsistent prompts, which potentially degrade VICL performance. On the other hand, higher label consistency between query and prompts preferably indicates stronger VICL results. Motivated by these findings, we develop a framework named LaPR (Label-aware Prompt Retrieval), which highlights the role of labels in prompt selection. Our framework first designs an image-label joint representation for prompts to incorporate label cues explicitly. Besides, to handle unavailable query labels at test time, we introduce a mixture-of-expert mechanism to the dual encoders with query-adaptive routing. Each expert is expected to capture a specific label mode, while the router infers query-adaptive mixture weights and helps to learn label-aware representation. We carefully design alternative optimization for experts and router, with a VICL performance-guided contrastive loss and a label-guided contrastive loss, respectively. Extensive experiments show promising and consistent improvement of LaPR on in-context segmentation, detection, and colorization tasks. Moreover, LaPR generalizes well across feature extractors and cross-fold scenarios, suggesting the importance of label utilization in prompt retrieval for VICL. Code is available at https://github.com/luotc-why/CVPR26-LaPR.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。