NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

InstructEdit: Improving Automatic Masks for Diffusion-based Image Editing With User Instructions

Qian Wang, Biao Zhang, Michael Birsak, Peter Wonka · DOI

Introduction

While diffusion models have revolutionized image generation, fine-grained editing remains a significant challenge. Current state-of-the-art methods generally fall into two categories: mask-free methods, which often suffer from "global bleed" where unintended parts of the image are altered, and automatic masking methods like DiffEdit, which rely on noisy diffusion internals to estimate masks. These noise-based masks frequently fail in complex, multi-object scenes or when captions lack sufficient detail. InstructEdit addresses this "masking bottleneck" by leveraging Large Language Models (LLMs) to bridge the gap between intuitive natural language instructions and precise spatial grounding.

The InstructEdit Framework

InstructEdit is a modular, tuning-free framework designed to perform high-quality local edits without retraining. It consists of three primary components:

  1. Language Processor: Utilizing LLMs (e.g., ChatGPT), this module parses user instructions into three distinct strings: a segmentation prompt, an input caption, and an edited caption. For ambiguous instructions, the system incorporates BLIP-2 to provide visual context.
  2. Segmenter: To avoid the inaccuracies of noise-based masking, InstructEdit employs Grounded Segment Anything (Grounded SAM). This combines Grounded DINO for object detection with the Segment Anything Model (SAM) to generate pixel-perfect binary masks.
  3. Image Editor: The final stage uses Stable Diffusion with a mask-guided DDIM denoising process. This ensures that only the pixels within the generated mask are modified, preserving the rest of the image perfectly.
InstructEdit generates precise masks compared to previous methods like DiffEdit, enabling accurate local edits.

Experimental Results

The framework was evaluated across diverse scenarios, including single objects with multiple parts and complex multi-object scenes.

Quantitative Performance

InstructEdit demonstrates superior performance across standard metrics:

  • LPIPS: Achieved a score of 0.121 (compared to DiffEdit's 0.167), indicating significantly better preservation of original image structure.
  • CLIP Score: Scored 27.404, reflecting higher alignment between the edited image and the textual instruction.
  • Human Preference: In a study conducted via Amazon Mechanical Turk, users preferred InstructEdit over baselines in 83.0% to 84.5% of cases.

Qualitative Analysis

Visual comparisons highlight InstructEdit's ability to target specific objects accurately. While previous methods might create "blobs" that cover incorrect areas, InstructEdit's masks are sharp and context-aware.

Qualitative comparison of InstructEdit against DiffEdit and various editing tasks including object replacement and environmental changes.

Conclusion

InstructEdit demonstrates that the key to stable, high-quality image editing lies in the precision of the mask. By using LLMs as "prompt engineers" for specialized vision models, the framework removes the burden of manual prompt engineering from the user while delivering state-of-the-art results in complex editing tasks. Future work will explore extending this framework to video editing and addressing current limitations in handling significant object deformations.

Summary updated

BibTeX
@misc{wang2023instructedit,
  author = {Qian Wang and Biao Zhang and Michael Birsak and Peter Wonka},
  title = {{InstructEdit: Improving Automatic Masks for Diffusion-based Image Editing With User Instructions}},
  year = {2023},
  eprint = {2305.18047},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.18047},
}
Figure