Prompt Tuning Inversion for Text-Driven Image Editing Using Diffusion Models

Wenkai Dong, Song Xue, Xiaoyue Duan, Shumin HanICCV 2023 · DOI

Abstract

Prompt Tuning Inversion (PTI) is a novel framework for text-driven image editing that addresses the fundamental trade-off between reconstruction fidelity and editing capability in diffusion models. By optimizing learnable conditional embeddings during inversion and employing linear interpolation with target prompts, PTI enables precise semantic edits without requiring manual masks or complex source descriptions. Experimental results demonstrate that PTI significantly outperforms existing methods in both reconstruction quality and editing accuracy.

Introduction

Diffusion models have revolutionized image generation, yet editing existing real-world images remains a significant challenge. The core of this challenge lies in "inversion"—the process of finding a noise map that reconstructs the original image. Current inversion techniques, such as DDIM, often suffer from low fidelity at high guidance scales, leading to unwanted alterations in non-edited regions. Furthermore, many high-fidelity methods impose user friction by requiring manual masks or detailed source prompts. PTI addresses these issues by treating prompt embeddings as learnable parameters, providing a robust structural anchor for subsequent edits.

Methodology

The PTI framework operates in two distinct stages: reconstruction and editing.

Stage 1: Reconstruction via Prompt Tuning

Instead of using a fixed text prompt, PTI optimizes a conditional embedding ($c_t$) for each timestep to minimize the error between the reconstructed latent and the original image's latent trajectory. During this stage, the diffusion model's weights remain frozen. This "prompt tuning" captures the unique structural details of the input image within the embedding space, ensuring high-fidelity reconstruction.

The two-stage PTI pipeline: Stage 1 optimizes conditional embeddings for reconstruction, and Stage 2 performs editing via condition interpolation.

Stage 2: Editing via Condition Interpolation

To perform an edit, PTI introduces Condition Interpolation. The model linearly blends the optimized embedding from Stage 1 (representing the original structure) with the target text embedding (representing the desired change). This semantic mixing allows the model to blend concepts at the prompt level, preserving the original image's geometry and background while successfully applying the requested transformation. The authors found this approach significantly more effective than "Latent Interpolation" (mixing at the pixel or feature level), which often resulted in cluttered or distorted images.

Experimental Results

The authors evaluated PTI on ImageNet and the COCO validation set, focusing on reconstruction metrics and qualitative editing performance.

Quantitative Performance

PTI achieved a PSNR of 25.71, substantially outperforming standard DDIM inversion (13.64) and Null-Text Inversion (24.45). Notably, PTI demonstrated faster convergence, reaching higher quality scores in just 5 iterations compared to baseline methods.

Qualitative Comparison

Visual evaluations on ImageNet tasks—such as changing a car's color or an animal's species—highlight PTI's superior ability to maintain background consistency and object pose. While baseline methods like DiffEdit often distort geometry or alter the environment, PTI produces seamless edits.

Qualitative comparison of PTI against baseline methods for editing a car's color and model.

Discussion and Conclusion

While PTI offers a significant advancement in text-driven editing, it faces limitations in complex, multi-object scenes where targeting individual objects remains difficult. Future research will explore integrating attention map control to improve localization and further refining the balance between editability and fidelity. Overall, PTI provides an efficient, mask-free solution for high-fidelity image editing that is both faster and more accurate than current state-of-the-art techniques.

Summary updated

BibTeX
@inproceedings{dong2023prompt,
  author = {Wenkai Dong and Song Xue and Xiaoyue Duan and Shumin Han},
  title = {{Prompt Tuning Inversion for Text-Driven Image Editing Using Diffusion Models}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
  doi = {10.1109/iccv51070.2023.00683},
}
Figure