VIRAL: Visual In-Context Reasoning via Analogy in Diffusion Transformers
Zhiwen Li, Zhongjie Duan, Jinyan Ye, Cen Chen, Daoyuan Chen, Yaliang Li, Yingda Chen
TL;DR
The paper tackles visual in-context learning (V-ICL) for diverse vision tasks by enabling task-agnostic inference from a single demonstration. It introduces VIRAL, recasting V-ICL as visual analogy conditional generation on a frozen Diffusion Transformer with role-aware multi-image conditioning and Mixture-of-Experts LoRA. A large-scale In-Context Editing Dataset spanning perception, restoration, and open-domain editing supports learning from exemplar-query quadruplets. Empirical results demonstrate strong V-ICL performance, competitive results with task-specific models, and evidence that the visual analogy formulation $x_s : x_t :: x_q : y_q$ enables a unified visual generalist.
Abstract
Replicating In-Context Learning (ICL) in computer vision remains challenging due to task heterogeneity. We propose \textbf{VIRAL}, a framework that elicits visual reasoning from a pre-trained image editing model by formulating ICL as conditional generation via visual analogy ($x_s : x_t :: x_q : y_q$). We adapt a frozen Diffusion Transformer (DiT) using role-aware multi-image conditioning and introduce a Mixture-of-Experts LoRA to mitigate gradient interference across diverse tasks. Additionally, to bridge the gaps in current visual context datasets, we curate a large-scale dataset spanning perception, restoration, and editing. Experiments demonstrate that VIRAL outperforms existing methods, validating that a unified V-ICL paradigm can handle the majority of visual tasks, including open-domain editing. Our code is available at https://anonymous.4open.science/r/VIRAL-744A
