Difference Inversion: Interpolate and Isolate the Difference with Token Consistency for Image Analogy Generation

Hyunsoo Kim, Donghyun Kim, Suhyun Kim

Abstract

How can we generate an image B' that satisfies A:A'::B:B', given the input images A,A' and B? Recent works have tackled this challenge through approaches like visual in-context learning or visual instruction. However, these methods are typically limited to specific models (e.g. InstructPix2Pix, Inpainting models) rather than general diffusion models (e.g. Stable Diffusion, SDXL). This dependency may lead to inherited biases or lower editing capabilities. In this paper, we propose Difference Inversion, a method that isolates only the difference from A and A' and applies it to B to generate a plausible B'. To address model dependency, it is crucial to structure prompts in the form of a "Full Prompt" suitable for input to stable diffusion models, rather than using an "Instruction Prompt". To this end, we accurately extract the Difference between A and A' and combine it with the prompt of B, enabling a plug-and-play application of the difference. Our extensive experiments demonstrate that Difference Inversion outperforms existing baselines both quantitatively and qualitatively, indicating its ability to generate more feasible B' in a model-agnostic manner.

Introduction

The "image analogy" problem ($A : A' :: B : B'$) is a classic challenge in computer vision. The objective is to take a transformation observed in a reference pair ($A \rightarrow A'$) and apply it to a target image ($B \rightarrow B'$). For instance, if $A$ is a cabin and $A'$ is that same cabin turned into a castle, the system should transform any target image $B$ into its "castle" equivalent.

Existing approaches face two major hurdles: Information Leakage, where specific details from the reference images (like background mountains) are incorrectly transferred to the target, and Model Dependency, where tools are tied to specific architectures. Difference Inversion addresses these by isolating the precise mathematical "difference" between the first two images and encoding it into specialized tokens.

Methodology

Difference Inversion treats the transformation as a modular "Delta" ($\Delta$) that can be extracted and applied like a plug-and-play component.

Delta Interpolation and DIFF Tokens

To capture the essence of the change between $A$ and $A'$, the method utilizes Delta Interpolation. It combines a Visual Delta (from CLIP image embeddings) and a Semantic Delta (from BLIP2-generated text descriptions) using Spherical Linear Interpolation (Slerp). This ensures the extracted difference captures both the visual appearance and the conceptual meaning of the change.

The transformation is then optimized into a set of Difference (DIFF) Tokens. Unlike instruction-based methods, these tokens are used within a "Full Prompt" format (e.g., [Prompt for B] + [DIFF Tokens]), which allows the method to be compatible with standard, pre-trained Stable Diffusion models without specialized retraining.

The overall pipeline of Difference Inversion (left) and the visualization of the Interpolated Delta (right).

Token Consistency and Initialization

To prevent information leakage, the authors introduce a Token Consistency Loss. This bidirectional constraint ensures that adding the DIFF token to the prompt for $A$ helps reconstruct $A'$, while subtracting it from the prompt for $A'$ reconstructs $A$. This forces the tokens to encode only the change rather than static features of the reference scene. Additionally, Zero-Initialization of token embeddings ensures the optimization starts from a blank slate, further reducing bias.

Experimental Results

The researchers evaluated their method using the InstructPix2Pix dataset and base models like Stable Diffusion 2.1 and XL.

Quantitative and Qualitative Performance

Difference Inversion achieved the highest Directional CLIP and DINO-v2 scores compared to baselines like DIA, Analogist, and VISII. This indicates that the direction of the change in the generated image $B'$ most closely matched the direction of the change in the reference $A \rightarrow A'$.

Qualitatively, human evaluators preferred Difference Inversion 72% of the time over other image-only baselines. Large Vision-Language Models (VLMs) like GPT-4o also overwhelmingly chose the authors' results as the most plausible analogies, with win rates often exceeding 80-90%.

Qualitative comparison of image analogy generation across different methods and instructions, demonstrating the superior consistency of Difference Inversion.

Conclusion and Limitations

Difference Inversion provides a robust, model-agnostic framework for image analogy generation by isolating the vector of change. While highly effective, the method currently faces challenges with massive global shifts (e.g., weather across complex landscapes) and extremely fine details. Future work may involve using more refined embedding spaces to bridge the gap between CLIP's latent space and human perception.

Summary updated

BibTeX
@inproceedings{kim2025difference,
  author = {Hyunsoo Kim and Donghyun Kim and Suhyun Kim},
  title = {{Difference Inversion: Interpolate and Isolate the Difference with Token Consistency for Image Analogy Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  url = {https://openreview.net/forum?id=FEp3mhfAY4},
}
Figure