Null-text Inversion for Editing Real Images using Guided Diffusion Models

Ron MokadyAmir HertzKfir AbermanYael PritchDaniel Cohen-Or

article2022CVPR1,454 citations

Introduces an inversion technique for classifier-free guided diffusion models that optimizes unconditional text embeddings, enabling precise, high-fidelity real image editing without fine-tuning model weights.

Listen

Recent advances in text-guided diffusion models have enabled realistic image generation from text prompts. However, applying intuitive text-based modifications to real photographs remains a major challenge. Existing editing tools require inverting a real image into the diffusion model's latent representation. Previous inversion techniques either produce inaccurate reconstructions, require users to draw manual masks, or rely on fine-tuning entire model weights for each edit, which causes high computational overhead and damages the model's learned priors.

The article demonstrates an accurate and efficient inversion framework, termed Null-text Inversion, designed to facilitate intuitive text-based editing of real images without modifying model weights or requiring user masks. The method is built and evaluated upon the publicly available Stable Diffusion architecture.

The approach introduces two primary components to overcome reconstruction errors: Diffusion Pivotal Inversion and null-text optimization. First, standard deterministic inversion produces an initial noisy trajectory that acts as an anchor or pivot. Second, the method optimizes only the unconditional "null-text" embedding used in classifier-free guidance at each diffusion timestamp, keeping the conditional prompt embedding and the model weights completely intact. The authors evaluated the approach across 100 benchmark image-caption pairs and conducted human perceptual user studies comparing it against leading text-guided editing baselines.

The evaluation yielded several critical findings. First, pivotal null-text optimization reaches near-optimal reconstruction fidelity within 250 to 500 optimization steps, taking approximately one minute on a single graphics processing unit. Second, in a 50-participant comparative user study, the proposed method was preferred by 65.1% of participants for balancing text instruction fidelity with original image preservation, significantly outperforming alternative methods like Text2LIVE (16.6%), SDEdit (14.5%), and VQGAN+CLIP (3.8%). Third, unlike methods that tune model weights and require separate training for every modification, a single one-minute inversion with this technique allows infinite subsequent text edits on the same image, with each edit executing in roughly 10 seconds. Finally, the framework is robust to varying input captions and successfully improves fidelity when paired with other existing editing techniques.

These findings indicate that high-fidelity image manipulation can be achieved at a fraction of the computational and memory cost associated with model fine-tuning. By avoiding model duplication, deployment costs and infrastructure overhead are drastically reduced. Furthermore, preserving the core model weights mitigates the risk of semantic drift and preserves generative prior knowledge across repeated edits.

Organizations developing creative editing tools should adopt this lightweight inversion strategy rather than full-model fine-tuning pipelines. To automate workflows, organizations can pair the system with off-the-shelf captioning models to automatically supply source prompts. Future technical development should focus on reducing the initial inversion time to enable real-time interactive performance and extending the underlying diffusion architectures to handle complex structural posture transformations.

The primary limitation of the method is the initial one-minute inversion runtime, which prevents real-time, instantaneous editing. Additionally, the approach relies on the underlying auto-encoder and cross-attention precision of the base model, which can occasionally introduce minor facial artifacts or misaligned attention maps. Despite these constraints, the results demonstrate high confidence in providing robust, high-fidelity, and scalable image manipulation for non-real-time production pipelines.

Cover for Null-text Inversion for Editing Real Images using Guided Diffusion Models

Abstract

Recent text-guided diffusion models provide powerful image generation capabilities. Currently, a massive effort is given to enable the modification of these images using text only as means to offer intuitive and versatile editing. To edit a real image using these state-of-the-art tools, one must first invert the image with a meaningful text prompt into the pretrained model's domain. In this paper, we introduce an accurate inversion technique and thus facilitate an intuitive text-based modification of the image. Our proposed inversion consists of two novel key components: (i) Pivotal inversion for diffusion models. While current methods aim at mapping random noise samples to a single input image, we use a single pivotal noise vector for each timestamp and optimize around it. We demonstrate that a direct inversion is inadequate on its own, but does provide a good anchor for our optimization. (ii) NULL-text optimization, where we only modify the unconditional textual embedding that is used for classifier-free guidance, rather than the input text embedding. This allows for keeping both the model weights and the conditional embedding intact and hence enables applying prompt-based editing while avoiding the cumbersome tuning of the model's weights. Our Null-text inversion, based on the publicly available Stable Diffusion model, is extensively evaluated on a variety of images and prompt editing, showing high-fidelity editing of real images.

Citation

MLA
Mokady, R., et al. “Null-text Inversion for Editing Real Images Using Guided Diffusion Models”. arXiv, 2022, http://arxiv.org/abs/2211.09794v1.
APA
Mokady, R., Hertz, A., Aberman, K., Pritch, Y., & Cohen-Or, D. (2022). Null-text Inversion for Editing Real Images using Guided Diffusion Models. arXiv. http://arxiv.org/abs/2211.09794v1
Chicago
Mokady, R., A. Hertz, K. Aberman, Y. Pritch, and D. Cohen-Or. 2022. “Null-text Inversion for Editing Real Images Using Guided Diffusion Models”. arXiv. http://arxiv.org/abs/2211.09794v1.
Harvard
Mokady, R. et al. (2022) “Null-text Inversion for Editing Real Images using Guided Diffusion Models”, arXiv [Preprint]. Available at: http://arxiv.org/abs/2211.09794v1.
Vancouver
1. Mokady R, Hertz A, Aberman K, Pritch Y, Cohen-Or D (2022) Null-text Inversion for Editing Real Images using Guided Diffusion Models. arXiv

BibTeX

@article{mokady2022null,
  title = {Null-text Inversion for Editing Real Images using Guided Diffusion Models},
  author = {Mokady, Ron and Hertz, Amir and Aberman, Kfir and Pritch, Yael and Cohen-Or, Daniel},
  year = {2022},
  journal = {arXiv},
  url = {http://arxiv.org/abs/2211.09794v1},
  eprint = {2211.09794}
}
Metadata:arXiv

Source Code

This paper has an official code repository available. Click below to access the source code.

View Repository

Access the Paper

This paper is available from its original source. Click below to access the PDF.

Open PDF
License: IEEE