Rethinking Where to Edit: Task-Aware Localization for Instruction-Based Image Editing

Jingxuan He, Xiyu Wang, Mengyu Zheng, Xiangyu Zeng, Yunke Wang, Chang XuarXiv 2026

TL;DR

This paper introduces a training-free framework to solve the "over-editing" problem in instruction-based image editing by explicitly localizing where changes should occur. By leveraging the internal latent features and dual-stream architecture of modern Diffusion Transformers (DiTs), the authors create task-aware masks that significantly improve content consistency in non-target regions without requiring additional training or supervision.

What Problem Does This Paper Address?

Instruction-based image editing (IIE) allows users to modify images using natural language (e.g., "add a lamp on the table"). While recent models built on Diffusion Transformers (DiTs) produce high-quality results, they frequently suffer from over-editing.

Because these models lack an explicit mechanism to restrict changes, they often inadvertently alter parts of the image that should remain untouched—such as changing a person's facial features when adding an object nearby, or shifting the entire viewpoint of a scene. As shown in Figure 1, standard models might successfully follow an instruction but fail to preserve the "identity" of the rest of the image.

Figure 1: Motivation of our work. While the base image editing model [34] is capable of producing visually appealing results, it may introduce unexpected modifications such as human beautification (the first example) or slight viewpoint changes (the second example). Our edit localization framework is thus motivated to yield more faithful editing results.

Methods

The authors propose a Task-Aware Edit Localization framework that operates in three main stages, all without retraining the underlying model:

  1. Attention-Based Semantic Estimation: The framework first extracts coarse localization cues from the model's internal joint attention matrices. It uses a "random-walk" interpretation to propagate these signals, helping to identify regions relevant to the text instruction.
  2. Feature-Based Semantic Assignment: Recognizing that raw attention maps are often noisy, the authors use the coarse cues to identify "edit" and "non-edit" feature centroids in the latent space. They then refine the mask by calculating the cosine similarity of every image token to these centroids.
  3. Task-Aware Mask Construction: A key insight is that different tasks require different localization strategies. For subject addition, the signal is strongest in the target image stream. For subject removal, it's in the source stream. For replacement, the framework combines signals from both.

Finally, a Mask-Guided Latent Preservation step blends the generated latents with source-aligned latents in the identified "non-edit" regions to ensure they remain unchanged.

Figure 2: Overview of our framework. Given an editing instruction, an initial noise, and a source image, the model performs joint attention over text, target, and source tokens within each DiT layer. We first decompose and propagate attention to derive attention maps that provide coarse estimation of instruction-relevant regions (Attention-Based Semantic Estimation). The attention maps are leveraged to compute clustering centroids, and each token is assigned to the nearest centroid based on feature similarity (Feature-Based Semantic Assignment). We then construct the edit mask conditioned on the task type (Task-Aware Mask Construction). Finally, mask-guided latent preservation enforces localized edits while maintaining consistency in non-target regions (Mask-Guided Latent Preservation).

Datasets

The researchers evaluated their method using two primary benchmarks:

  • EdiVal-Bench: A recently introduced object-centric benchmark containing 572 real-world images with instructions categorized into nine types (addition, removal, replacement, color change, etc.).
  • PIE-Bench: A standard benchmark for image editing consisting of 700 images, where the authors focused on a subset of 554 images requiring localized edits.

Key Insights and Ideas

  • Latent Features > Attention Maps: One of the most important findings is that the deep latent features within a DiT provide much more robust and precise localization signals than the raw attention maps typically used in prior work. As seen in Figure 4, feature-derived masks have cleaner boundaries and better coverage.
  • Localization is Task-Dependent: You can't use the same strategy for every edit. The "emergence" of a new object (addition) happens in the target stream, while the "disappearance" of an old one (removal) is best tracked in the source stream.
  • Deeper is Better: Ablation studies (Figure 6) show that edit semantics are progressively formed and become most discriminative in the deeper layers of the transformer (peaking around layer 50 for Qwen-Image-Edit).
Quantitative analysis showing that latent features (red curves) consistently outperform attention-based signals across different tasks.

Key Results

The framework was tested on top of powerful backbones like Step1X-Edit and Qwen-Image-Edit.

  • Consistency Gains: On EdiVal-Bench, the method improved background consistency by +3.18 and object consistency by +5.27 for the Qwen model.
  • Instruction Following: Crucially, these consistency gains did not come at the cost of following the user's instructions. In some cases, instruction following (EdiVal-IF) actually improved because the model could focus its generative power on a smaller, localized region.
  • Qualitative Superiority: As shown in Figure 5, the proposed method produces much "cleaner" difference maps, indicating that changes are strictly confined to the intended areas compared to baselines like GRAG.
Qualitative comparison showing superior content preservation and localized editing compared to other state-of-the-art methods.

Limitations and Future Work

The authors identify two main failure modes:

  1. Global Layout Shifts: If the base model insists on a massive global change (like a total viewpoint shift), the mask-guided preservation can lead to "stitching" artifacts where the new content doesn't blend naturally with the frozen background.
  2. Disjoint Regions: The current post-processing step focuses on the largest connected component, which can fail when an edit involves multiple separate areas (e.g., adding text in two different corners of an image).

Future work aims to develop more robust mask estimation techniques that can handle complex, multi-region scenarios and better blending for extreme layout changes.

Summary updated

BibTeX
@misc{he2026rethinking,
  author = {Jingxuan He and Xiyu Wang and Mengyu Zheng and Xiangyu Zeng and Yunke Wang and Chang Xu},
  title = {{Rethinking Where to Edit: Task-Aware Localization for Instruction-Based Image Editing}},
  year = {2026},
  eprint = {2604.20258},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.20258},
}
Figure