In-Context Learning Unlocked for Diffusion Models

Zhendong Wang, Yifan Jiang, Yadong Lu, Yelong Shen, Pengcheng He +3 more
2/12/2026

No official code found. Best implementation: Zhendong-Wang/Prompt-Diffusion (414 stars, Apache-2.0, last commit 2024-03-25).

Abstract

We present Prompt Diffusion, a framework for enabling in-context learning in diffusion-based generative models. Given a pair of task-specific example images, such as depth from/to image and scribble from/to image, and a text guidance, our model automatically understands the underlying task and performs the same task on a new query image following the text guidance. To achieve this, we propose a vision-language prompt that can model a wide range of vision-language tasks and a diffusion model that takes it as input. The diffusion model is trained jointly over six different tasks using these prompts. The resulting Prompt Diffusion model is the first diffusion-based vision-language foundation model capable of in-context learning. It demonstrates high-quality in-context generation on the trained tasks and generalizes effectively to new, unseen vision tasks with their respective prompts. Our model also shows compelling text-guided image editing results. Our framework aims to facilitate research into in-context learning for computer vision. We share our code and pre-trained models at https://github.com/Zhendong-Wang/Prompt-Diffusion.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Official PyTorch implementation of the paper "In-Context Learning Unlocked for Diffusion Models"

41412Shell, PythonApr 27, 20232 years agoApache-2.0

Similar Papers

Cite this paper

@article{wang2026incontext,
  title  = {In-Context Learning Unlocked for Diffusion Models},
  author = {Zhendong Wang and Yifan Jiang and Yadong Lu and Yelong Shen and Pengcheng He and Weizhu Chen and Zhangyang Wang and Mingyuan Zhou},
  year   = {2026},
  eprint = {2305.01115},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2305.01115},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.01115.svg)](https://codeofpaper.com/paper/2305.01115)

Discussion