DesignEdit: Unify Spatial-Aware Image Editing via Training-free Inpainting with a Multi-Layered Latent Diffusion Framework

Yueru Jia, Aosong Cheng, Yuhui Yuan, Chuke Wang, Ji Li, Huizhu Jia, Shanghang ZhangAAAI 2025

Introduction

Spatial-aware image editing—the ability to precisely adjust the position, size, or presence of objects within a scene—remains a significant challenge for standard latent diffusion models. While models like Stable Diffusion excel at generating high-quality imagery from text prompts, they often struggle with maintaining background harmony and object identity during the editing process. When an object is moved or removed, the resulting "hole" must be filled realistically (inpainting), and when an object is resized, it frequently loses its original details or "morphs" into a different entity as the model attempts to re-generate it from scratch.

DesignEdit demonstrates a wide range of spatial-aware editing capabilities, from object removal and resizing to camera adjustments and layout redesign.

DesignEdit addresses these issues by introducing a training-free framework that brings the "layer-based" workflow of traditional graphic design to latent diffusion. By treating an image as a stack of independent layers and utilizing large language models (LLMs) for spatial reasoning, DesignEdit enables complex multi-object manipulations without the need for fine-tuning or expensive classifier guidance.

Methodology

The DesignEdit pipeline is structured into two primary stages: Multi-Layered Latent Decomposition and Multi-Layered Latent Fusion. This approach allows the system to isolate specific elements of an image, modify them independently, and then reintegrate them into a cohesive final result.

The DesignEdit framework consists of two main stages: Multi-Layered Latent Decomposition and Multi-Layered Latent Fusion, orchestrated by GPT-4V planning.

Key-Masking Self-Attention (KMSAttn)

At the heart of the decomposition stage is a novel "training-free" mechanism called Key-Masking Self-Attention. During the initial denoising steps, the framework modifies the self-attention layers of the diffusion model. By instructing the "Query" (the target pixels) to ignore "Key" features (the context) within the masked area of an object designated for removal, the model is forced to synthesize the gap using only information from the surrounding background. This ensures high background harmony without leaving behind "ghosting" artifacts common in other methods.

Multi-Layered Fusion and Artifact Suppression

Once the background is inpainted and the object layers are isolated, they are "pasted" back onto the latent canvas at a specific timestep ($T-K$). This discrete fusion preserves the high-frequency details and identity of the original objects far better than soft constraints or guidance-based methods. To further refine the output, DesignEdit employs an Artifact Suppression loop. GPT-4V is used to visually inspect the intermediate results, identify the coordinates of any remaining artifacts, and generate a refinement mask ($M_{refine}$) to guide a second pass of the inpainting process.

GPT-4V Spatial Planning

To bridge the gap between natural language instructions and precise pixel-level edits, DesignEdit leverages GPT-4V as a high-level architect. When a user provides a prompt like "move the unicorn to the left," GPT-4V analyzes the source image and generates structured, layer-wise instructions, including precise bounding boxes and transformation coordinates. This allows the diffusion model to focus entirely on rendering textures and pixels while the LLM handles the spatial logic.

Results and Evaluation

DesignEdit was evaluated against both specialized inpainting models and general-purpose editing frameworks using the MagicBrush benchmark and extensive user studies.

  • Quantitative Performance: Despite being a training-free method, DesignEdit achieved results competitive with SDXL-inpainting (a model specifically fine-tuned for the task) on the MagicBrush benchmark, recording scores of 0.969 on CLIP-I and 0.971 on DINO.
  • Human Preference: In a large-scale user study focused on object removal (113 participants), DesignEdit achieved a 51% preference rate, significantly outperforming the popular LaMa model (36%), which often produced blurring in complex background areas.
  • Versatility: The framework successfully unifies a diverse set of editing tasks, including camera panning, zooming, and occlusion-aware editing (e.g., moving an object that is partially obscured by another), into a single, cohesive pipeline.

Discussion and Future Work

While DesignEdit represents a significant step forward in training-free image editing, it is not without limitations. The quality of the final edit is ultimately bounded by the generative capabilities of the underlying base model (e.g., Stable Diffusion XL). Additionally, GPT-4V occasionally makes errors in spatial reasoning, such as miscalculating layer order or object scale.

Future research will focus on developing a "closed-loop" system where the LLM iteratively evaluates the output and provides corrective spatial instructions until the desired edit is achieved. This would further enhance the robustness of the framework and reduce the impact of initial planning errors.

Summary updated

BibTeX
@inproceedings{jia2025designedit,
  author = {Yueru Jia and Aosong Cheng and Yuhui Yuan and Chuke Wang and Ji Li and Huizhu Jia and Shanghang Zhang},
  title = {{DesignEdit: Unify Spatial-Aware Image Editing via Training-free Inpainting with a Multi-Layered Latent Diffusion Framework}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i4.32414},
}
Figure