[Paper Review] Images Speak in Images: A Generalist Painter for In-Context Visual Learning
This paper introduces Painter, a generalist vision model that enables in-context visual learning by treating both inputs and outputs as images, using masked image modeling on stitched input-output image pairs. The model achieves state-of-the-art performance on depth estimation and competitive results across seven diverse vision tasks, including segmentation and image restoration, without task-specific architecture or loss modifications.
In-context learning, as a new paradigm in NLP, allows the model to rapidly adapt to various tasks with only a handful of prompts and examples. But in computer vision, the difficulties for in-context learning lie in that tasks vary significantly in the output representations, thus it is unclear how to define the general-purpose task prompts that the vision model can understand and transfer to out-of-domain tasks. In this work, we present Painter, a generalist model which addresses these obstacles with an "image"-centric solution, that is, to redefine the output of core vision tasks as images, and specify task prompts as also images. With this idea, our training process is extremely simple, which performs standard masked image modeling on the stitch of input and output image pairs. This makes the model capable of performing tasks conditioned on visible image patches. Thus, during inference, we can adopt a pair of input and output images from the same task as the input condition, to indicate which task to perform. Without bells and whistles, our generalist Painter can achieve competitive performance compared to well-established task-specific models, on seven representative vision tasks ranging from high-level visual understanding to low-level image processing. In addition, Painter significantly outperforms recent generalist models on several challenging tasks.
Motivation & Objective
- Address the challenge of in-context learning in computer vision, where task outputs vary significantly in representation, making generalization difficult.
- Overcome the lack of a unified, general-purpose interface for vision tasks, unlike in NLP where text tokens serve as a common interface.
- Propose a vision-centric solution that redefines vision task outputs as 3-channel images and uses image pairs as task prompts for in-context learning.
- Enable zero-shot and few-shot adaptation to out-of-domain tasks using only visual context, without requiring language understanding or model fine-tuning.
- Achieve competitive performance across diverse vision tasks—ranging from high-level understanding to low-level restoration—using a single, unified training objective.
Proposed method
- Reformulate all vision tasks as image inpainting problems by representing outputs as 3-channel tensors (i.e., 'output images').
- Construct training data by stitching input and output image pairs from the same task into a single, longer image.
- Apply standard masked image modeling (MIM) on the output image portion, conditioning the prediction on the input image patch.
- Use paired input-output images from a task as the in-context prompt during inference, enabling the model to infer the task without explicit language instructions.
- Train a single generalist model end-to-end with a unified objective, requiring no changes to architecture or loss for new tasks.
- Enable in-context inference by directly feeding the input-output example pair as context, allowing the model to generalize to unseen categories and tasks.

Experimental results
Research questions
- RQ1Can vision tasks be unified under a common interface that enables in-context learning without relying on language tokens?
- RQ2How can a generalist vision model be trained to perform diverse tasks using a single, simple objective while maintaining strong performance?
- RQ3Can a vision model generalize to out-of-domain tasks using only visual examples as prompts, without fine-tuning or language supervision?
- RQ4Does treating outputs as images and using image pairs as prompts lead to better few-shot and zero-shot generalization than existing generalist approaches?
- RQ5Can a unified image-centric framework outperform specialized models on challenging tasks like depth estimation and panoptic segmentation?
Key findings
- Painter achieves state-of-the-art performance on NYUv2 depth estimation, outperforming previous specialized models with complex architectures and loss functions.
- The model achieves competitive results on semantic segmentation (ADE-20K), instance and panoptic segmentation (COCO), and keypoint detection, matching or exceeding task-specific models.
- Painter significantly outperforms recent generalist models on challenging tasks such as image denoising, deraining, and low-light enhancement.
- The model generalizes effectively to out-of-domain categories, such as open-vocabulary keypoint detection (e.g., horse, monkey, broom) and instance segmentation (e.g., tablets), even when these categories were not in the training data.
- Prompt tuning via searched or learned prompts improves performance over random prompts, demonstrating that prompt optimization enhances in-context learning capability.
- The model shows strong robustness even with random prompts, indicating inherent stability and generalization ability in the image-centric in-context learning framework.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.