AutoEdit: Automatic Hyperparameter Tuning for Image Editing

Chau Pham, Quan Dao, Mahesh Bhosale, Yunjie Tian, Dimitris N. Metaxas, David Doermann

Abstract

Text-guided image editing with diffusion models requires a precise balance between modifying the image to match a new prompt and preserving the original background. Current methods rely on manual hyperparameter tuning, which is computationally expensive and varies significantly across different images. We present AutoEdit, a reinforcement learning (RL) framework that treats hyperparameter selection as a sequential decision-making process. By dynamically adjusting parameters at each denoising step, AutoEdit reduces search complexity from exponential to linear while matching or exceeding the quality of manual tuning.

Introduction

Diffusion-based image editing methods, such as Prompt-to-Prompt and MasaCtrl, have demonstrated remarkable capabilities in transforming images based on text instructions. However, their success is often contingent on finding the "sweet spot" for various hyperparameters—such as the specific timesteps for prompt injection or the intensity of cross-attention replacement.

Because the optimal settings change for every image-prompt pair, users are currently forced into a brute-force search. If a method involves $K$ hyperparameters with $N$ possible values over $T$ diffusion steps, the search complexity reaches $O(T N^K)$. This makes high-quality editing computationally agonizing and impractical for real-time applications. AutoEdit addresses this by automating the tuning process through a lightweight policy network.

The AutoEdit Framework

MDP Formulation

AutoEdit reframes hyperparameter tuning as a Markov Decision Process (MDP). Instead of selecting a static set of parameters for the entire diffusion process, an RL agent makes decisions at each denoising step:

  • State: The noisy image latent at the current timestep.
  • Action: The specific hyperparameter configuration chosen for that step.
  • Reward: A dual-objective function measuring Prompt Alignment (via CLIP score or LVLM feedback) and Background Preservation (via Mean Squared Error outside the edit mask).

Two-Phase Training Strategy

To navigate the vast state space of a 50-step diffusion process, the authors employ a two-phase training approach using Proximal Policy Optimization (PPO):

  1. Phase 1 (Pretraining): The policy is trained to mimic known, sensible default ranges for hyperparameters. This initialization prevents the agent from starting in a state of total divergence.
  2. Phase 2 (RL Optimization): The agent explores the parameter space to maximize the reward signal, fine-tuning its ability to balance edit fidelity with background consistency.

Innovations in Reward Design

One of the critical insights of the AutoEdit research is the limitation of standard CLIP scores. While CLIP is effective for global style changes, it often fails to recognize fine-grained edits, such as changing the color of a small object.

To solve this, the researchers integrated a Large Vision-Language Model (LVLM) reward. By querying an LVLM with specific questions (e.g., "Is the cat now a tiger?"), the system receives a more accurate binary reward for localized changes. This approach significantly improves the model's performance on detailed editing tasks where traditional metrics fall short.

Experimental Results

Performance and Efficiency

AutoEdit was evaluated using the PieBench dataset, covering 700 diverse editing scenarios. Across multiple baseline architectures—including DDIM/DDPM-Inversion, P2P, and InstructPix2Pix—AutoEdit consistently improved background preservation metrics (PSNR, SSIM) with negligible impact on prompt alignment.

Crucially, the computational overhead is minimal. The policy network adds only approximately 1.1 million parameters to the Stable Diffusion U-Net. Inference time increases by a mere 0.6%, shifting from 20.89ms to 21.03ms per step, while reducing the overall search complexity from exponential to linear ($O(T)$).

Human Preference

In a user study involving 50 participants, AutoEdit-generated images were preferred in 82.78% of cases compared to images produced using the default hyperparameters of baseline methods. This underscores the framework's ability to find more aesthetically pleasing and contextually accurate balances than static settings.

Conclusion and Limitations

AutoEdit represents a significant step toward making diffusion-based editing accessible and efficient. By automating the most tedious aspect of the pipeline, it allows for high-quality results without manual intervention.

However, AutoEdit is an optimization layer rather than a standalone generative model. Its performance is inherently capped by the capabilities of the underlying editing method; if the base model cannot physically perform a specific transformation, AutoEdit cannot optimize its way to a solution. Future work involves integrating more advanced multimodal LLMs directly into the RL loop to handle increasingly complex, multi-step instructions.

Summary updated

BibTeX
@inproceedings{pham2025autoedit,
  author = {Chau Pham and Quan Dao and Mahesh Bhosale and Yunjie Tian and Dimitris N. Metaxas and David Doermann},
  title = {{AutoEdit: Automatic Hyperparameter Tuning for Image Editing}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=goNuX2kQzd},
}
Figure