RePlan: Reasoning-guided Region Planning for Complex Instruction-based Image Editing

Tianyuan Qu, Lei Ke, Xiaohang Zhan, Longxiang Tang, Yuqi Liu, Bohao Peng, Bei Yu, Dong Yu, Jiaya Jia · DOI

Introduction

Instruction-based image editing has seen significant progress with models like InstructPix2Pix. However, these models often struggle with Instruction-Visual Complexity (IV-Complexity)—scenarios involving cluttered scenes or instructions requiring deep semantic reasoning. For instance, an instruction like "Replace the cup that has been used and left on the desk with a small plant" requires the model to first identify which cup is "used" among several objects and then perform a localized replacement without affecting the rest of the scene.

RePlan addresses these challenges through a "plan-then-execute" framework. It decouples the reasoning required to understand complex instructions from the generative process, ensuring surgical precision in multi-region edits.

The RePlan Framework

RePlan splits the editing task into two distinct stages: a reasoning-heavy Planner and a precision-focused Executor.

1. The Planner: Reasoning and Grounding

The Planner serves as the system's cognitive core, utilizing a Vision-Language Model (VLM), specifically Qwen2.5-VL. Instead of directly generating an image from a text prompt, the Planner performs Chain-of-Thought (CoT) reasoning to analyze the scene and identify target objects. It outputs a structured JSON plan containing precise bounding boxes for edited regions, regional hints for modifications, and negative hints to prevent unwanted changes in the background.

The Planner identifies specific objects and generates bounding boxes for targeted editing.

To enhance reliability, the VLM is fine-tuned using Group Relative Policy Optimization (GRPO). This reinforcement learning technique allows the model to follow complex reasoning steps and formatting requirements effectively, even with a small dataset of 1,000 high-quality examples.

2. The Executor: Attention Region Injection

The Executor is a Diffusion Transformer (DiT) that carries out the planned edits. To maintain strict regional control without expensive retraining, RePlan introduces a training-free attention region injection mechanism. By manipulating the attention masks during the diffusion process, the model ensures that specific image patches only attend to their corresponding regional hints. This isolation prevents "bleeding" effects where edits spill over into unintended areas, while still allowing patches to share global context for stylistic consistency.

Evaluation and Results

To rigorously test RePlan, the authors introduced IV-Edit, a benchmark comprising approximately 800 instruction-image pairs across 16 task types, including spatial reasoning and physics-based modifications.

RePlan successfully executes a complex edit, replacing a specific object based on semantic reasoning while preserving the background.

RePlan demonstrates superior performance compared to both open-source and proprietary models. Key findings include:

  • High Consistency: RePlan maintains the integrity of unedited regions better than competitors, outperforming models like GPT-4o in consistency metrics.
  • Target Accuracy: On the IV-Edit benchmark, RePlan (using Flux.1 as a backbone) showed a significant improvement in identifying and modifying the correct targets.
  • Complex Logic Handling: The model successfully processes indirect instructions, such as performing mathematical calculations or applying world knowledge to identify targets.

Conclusion

RePlan shifts the paradigm of image editing from simple prompt-following to a structured reasoning process. By separating planning from execution and utilizing attention-based grounding, it overcomes the hurdles of IV-Complexity. While the system's speed is currently limited by the two-step process and its accuracy depends on the VLM's initial localization, RePlan sets a new standard for precise, reasoning-guided image manipulation.

Summary updated

BibTeX
@misc{qu2025replan,
  author = {Tianyuan Qu and Lei Ke and Xiaohang Zhan and Longxiang Tang and Yuqi Liu and Bohao Peng and Bei Yu and Dong Yu and Jiaya Jia},
  title = {{RePlan: Reasoning-guided Region Planning for Complex Instruction-based Image Editing}},
  year = {2025},
  eprint = {2512.16864},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.16864},
}
Figure