When Test-Time Guidance Is Enough: Fast Image and Video Editing with Diffusion Guidance

Ahmed Ghorbel, Badr Moufad, Navid Bagheri Shouraki, Alain Oliviero Durmus, Thomas Hirtz, Eric Moulines, Jimmy Olsson, Yazid Janati

TL;DR

This paper tackles the challenge of computationally expensive test-time guidance for diffusion models in image and video editing. They extend a VJP-free approximation, providing theoretical insights and demonstrating its effectiveness on large-scale benchmarks, showing it can match or even surpass training-based methods without requiring model updates.

What Problem Does This Paper Address?

Image and video editing, especially with text prompts, is often framed as an inpainting problem. While diffusion models have shown great promise, directly training them for inpainting is computationally expensive. An alternative is "test-time guidance," which uses a pre-trained diffusion model as a prior and a "likelihood" to enforce consistency with observed regions. This approach avoids training but relies on approximating an "intractable guidance term." Existing methods for this approximation involve costly "vector-Jacobian product" (VJP) computations, which significantly slow down the editing process and limit scalability. This paper aims to address this bottleneck by further developing and empirically validating a VJP-free approximation for test-time guidance.

Methods

The core of this work builds upon a VJP-free approximation for test-time guidance proposed by Moufad et al. (2025). The key idea is to decouple the intermediate variable of interest from the diffusion model during the guidance calculation. This is achieved by approximating the guidance term using a mixture model, which effectively eliminates the need for VJP computations. For linear inverse problems like inpainting, this approximation allows for closed-form posterior updates, making the process much faster. The authors provide theoretical insights into this VJP-free approximation, explaining its connection to neglecting the Jacobian of the noise predictor and assuming an isotropic conditional covariance. They also extend this approach to operate directly in the latent space of diffusion models, which is more efficient for high-resolution data.

Datasets

The paper evaluates their method on several datasets:

  • Image Editing: HumanEdit (Bai et al., 2024) and InpaintCOCO (Rösch et al., 2024).
  • Video Editing: VPBench (Bai et al., 2024).

Key Insights and Ideas

  • VJP-free guidance is sufficient: The paper strongly suggests that test-time guidance, when implemented efficiently (VJP-free), can achieve performance comparable to, and sometimes better than, methods that require training or fine-tuning. This significantly lowers the barrier to entry for advanced editing capabilities.
  • Theoretical grounding for VJP-free: The authors provide theoretical explanations for why the VJP-free approximation works, linking it to specific assumptions about the diffusion model's internal dynamics. This adds rigor to the empirical findings.
  • Latent space editing is key: Performing inpainting directly in the latent space of diffusion models is crucial for efficiency, especially for high-resolution images and videos.
  • Mitigating latent space limitations: The paper acknowledges and addresses issues like "context leakage" in latent space editing by using mask dilation, demonstrating a practical solution to a known problem.
  • Open-source contribution: The release of the "DInG-editor" Python package is a significant contribution, making these advanced editing techniques accessible to the research community.

Key Results

  • Competitive performance: The DING method (based on the VJP-free approximation) achieves performance on par with or exceeding training-based methods like SD3 + ControlNet on image editing tasks, even within similar or shorter runtime constraints.
  • Video editing success: The approach also shows strong results in video editing, outperforming other training-free methods and approaching the performance of a trained video inpainting model (Wan2.1-VACE).
  • Speed advantage: The VJP-free nature of the method leads to significant speedups, allowing for fast image and video editing within seconds or minutes per sample. For instance, DING is shown to be competitive with SD3 + ControlNet within a 30-second runtime.
  • Qualitative improvements: The qualitative examples showcase high-quality edits with good controllability, demonstrating the method's ability to accurately reconstruct masked regions according to text prompts.

Limitations and Future Work

  • Latent space limitations: The paper acknowledges that operating in latent space has inherent limitations. The quality of edits is constrained by the encoder-decoder architecture, and masks smaller than the downsampling factor can lead to inaccuracies. Mask dilation is used to mitigate this, but it can slightly alter regions around the mask edges.
  • Audio support: While the DInG-editor package currently supports image and video editing, audio support is noted as being under active development.
  • Potential for misuse: The authors highlight the dual-use nature of diffusion-based inpainting methods, warning about their potential misuse for generating deceptive content and emphasizing the need for responsible deployment.

Summary updated

BibTeX
@inproceedings{ghorbel2026when,
  author = {Ahmed Ghorbel and Badr MOUFAD and Navid Bagheri Shouraki and Alain Oliviero Durmus and Thomas Hirtz and Eric Moulines and Jimmy Olsson and Yazid Janati},
  title = {{When Test-Time Guidance Is Enough: Fast Image and Video Editing with Diffusion Guidance}},
  booktitle = {ReALM-GEN @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=eIBhcdHsFA},
}
Figure