arXiv:2508.09949cs.CVcs.LG2025-08ICCV被引 11

无需微调,稳定扩散模型可直接实现视觉上下文学习。

Stable Diffusion Models are Secretly Good at Visual In-Context Learning

  • 在自注意力层中重计算上下文,利用提示对任务进行动态适应。
  • 六项视觉任务性能超越现有方法,分割任务提升8.9%的mIoU。
  • 支持多提示集成,适合快速适配新任务的场景应用。

大型语言模型在自然语言处理中展现出强大的上下文学习能力——仅通过少量示例提示即可适应各类任务而无需更新模型权重。该能力近期被引入计算机视觉领域,但现有方法需专门训练或额外数据,限制了通用性。本文发现,现成的Stable Diffusion模型可直接用于视觉上下文学习(V-ICL)。我们提出在Stable Diffusion架构的自注意力层中进行原位注意力重计算,显式建模查询与示例提示间的上下文关系。无需任何微调,该方法即可适应六种任务:前景分割、单对象检测、语义分割、关键点检测、边缘检测和着色。例如,在Pascal-5i数据集上,该方法使前景分割的平均交并比(mIoU)相比Visual Prompting和IMProv分别提升8.9%和3.2%。此外,通过提示集成可进一步提升任务推断性能。

原文摘要 · Abstract (English)

Large language models (LLM) in natural language processing (NLP) have demonstrated great potential for in-context learning (ICL) -- the ability to leverage a few sets of example prompts to adapt to various tasks without having to explicitly update the model weights. ICL has recently been explored for computer vision tasks with promising early outcomes. These approaches involve specialized training and/or additional data that complicate the process and limit its generalizability. In this work, we show that off-the-shelf Stable Diffusion models can be repurposed for visual in-context learning (V-ICL). Specifically, we formulate an in-place attention re-computation within the self-attention layers of the Stable Diffusion architecture that explicitly incorporates context between the query and example prompts. Without any additional fine-tuning, we show that this repurposed Stable Diffusion model is able to adapt to six different tasks: foreground segmentation, single object detection, semantic segmentation, keypoint detection, edge detection, and colorization. For example, the proposed approach improves the mean intersection over union (mIoU) for the foreground segmentation task on Pascal-5i dataset by 8.9% and 3.2% over recent methods such as Visual Prompting and IMProv, respectively. Additionally, we show that the proposed method is able to effectively leverage multiple prompts through ensembling to infer the task better and further improve the performance.

视觉上下文学习稳定扩散零样本学习提示工程

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。