Introduction
In the field of Natural Language Processing (NLP), Large Language Models (LLMs) like GPT-4 have demonstrated a remarkable capability known as "in-context learning" (ICL). This allows models to perform new tasks simply by observing a few examples provided in the prompt, without requiring specific fine-tuning. Historically, computer vision has lacked this flexibility, with most models acting as specialists for single tasks like depth estimation or edge detection.
Recent research introduces Prompt Diffusion, a framework designed to bring ICL to vision-language foundation models. By providing a single example pair of images and a text instruction, this model can understand and execute a wide variety of vision tasks on new query images, effectively acting as a generalist vision model.
The Prompt Diffusion Framework
The core innovation of Prompt Diffusion is its redefinition of the generation process through a multimodal prompt. Unlike standard diffusion models that rely solely on text, Prompt Diffusion utilizes three distinct inputs:
- An Example Pair: Two images ($Image_1 \rightarrow Image_2$) that demonstrate the desired transformation (e.g., a segmentation map and its corresponding photo).
- Text Guidance: Natural language instructions to provide context or specific stylistic constraints.
- A Query Image: The new input ($Image_3$) that the model must transform based on the logic of the example pair.
Architecture and Training
Built upon Stable Diffusion (v1.5) and ControlNet, the architecture incorporates two specialized encoders: an Example-Pair Encoder to extract the relationship between the demonstration images, and a Query Encoder for the new input. These embeddings are integrated into the ControlNet branch, while a standard CLIP encoder handles text guidance.
To enable ICL, the model underwent joint training on six diverse tasks: three "forward" tasks (Image $\rightarrow$ Depth/HED/Segmentation) and three "inverse" tasks (Depth/HED/Segmentation $\rightarrow$ Image). This multi-task approach teaches the model to prioritize the relationship between images over specific pixel memorization.
Key Insights and Generalization
A significant finding of this work is the model's ability to generalize to unseen tasks. Even though it was never explicitly trained on "Scribble-to-Image" or "Normal-to-Image" transformations, it can perform them successfully when provided with a single visual example.
Furthermore, Prompt Diffusion is semantically aware and robust to misalignment. It can grasp the underlying task even if the example pairs are not pixel-perfect, a major advantage over previous "stitching" methods that required strict alignment.
Quantitative and Qualitative Results
In zero-shot evaluations, Prompt Diffusion demonstrated performance comparable to specialized models. For the Depth-to-Image task, it achieved a Fréchet Inception Distance (FID) of 18.60, notably outperforming the specialized ControlNet baseline of 19.81. Qualitatively, the model produces high-fidelity images that strictly adhere to both the visual logic of the prompt and the nuances of the text guidance, excelling in complex scenarios like style transfer and text-guided editing.
Limitations and Future Work
While a major step forward, the model's visual vocabulary is currently constrained by its training data, performing best on images similar to its synthetic training sets. It also struggles with complex physical transformations, such as object rotation, without explicit training. Future research will focus on expanding the range of joint tasks during training to further refine the model's in-context reasoning and physical understanding.
Summary updated