Abstract
DM-Align is a novel framework for text-based image editing that moves away from "black-box" generation by explicitly reasoning about which parts of an image to change. By aligning words between a source caption and a target instruction, the model creates precise masks that preserve the background and handle complex, long-form instructions far better than current state-of-the-art baselines.
Introduction
While diffusion models have made image generation look easy, semantic image editing—changing specific parts of an image while keeping everything else identical—remains a challenge. Most current models treat editing as a black-box process, which often leads to "background leakage," where the model unintentionally alters the style, lighting, or content of parts of the image that were supposed to remain untouched. Furthermore, many existing models struggle with long, descriptive instructions; they tend to lose track of the specific edits requested as the text becomes more complex. To get around this, users often have to manually draw masks, which is time-consuming and defeats the purpose of a "natural language" interface.
Methods
The authors propose DM-Align (Diffusion Masking with word Alignments), a five-step pipeline designed for transparency and precision:
- Word Alignment: The model takes a source caption and a target instruction, using a neural semi-Markov Conditional Random Field (CRF) to find one-to-one alignments between words. This identifies which nouns are being replaced, kept, or modified.
- Cross-Modal Grounding: Based on the identified nouns, the system uses Grounded-SAM to detect and segment the corresponding objects in the physical image.
- Global Diffusion Masking: It runs two parallel denoising processes to generate a rough "global" mask of where the changes should occur by calculating the absolute difference between noise estimates.
- Mask Refinement & Noise Cancellation: The rough global mask is refined using precise object segments. Crucially, the model applies noise cancellation—zeroing out the noise variable in regions intended to be preserved—to ensure the background remains bit-perfect.
- Inpainting: Finally, the refined mask and target instruction are fed into a Stable Diffusion inpainting model to generate the final edit.
Key Results
DM-Align consistently outperformed baselines like FlexIT, DiffEdit, ControlNet, and InstructPix2Pix across several metrics. On the Imagen dataset, DM-Align improved the FID score by 23.42% over the best-performing baseline. It also achieved significantly lower PWMSE (Pixel-wise Mean Square Error), proving it leaves the "untouched" parts of the image alone. In human evaluations, annotators rated DM-Align highest for both instruction following (3.90/5) and background preservation (4.35/5). While not the absolute fastest, DM-Align produces a high-quality edit in about 16 seconds on an NVIDIA RTX 3090, making it practical for real-world use.
Conclusion
By using word alignment, DM-Align provides explainability, allowing users to see exactly which words triggered which mask regions. The model's robustness to complexity stems from breaking instructions down into discrete object-level operations. Future work aims to address current limitations, such as the sequential nature of multi-object edits and the dependency on accurate source captions, while expanding the linguistic scope to include actions and complex spatial postures.
Summary updated