TL;DR
BrushEdit is a novel, agent-based image editing framework that unifies Multimodal Large Language Models (MLLMs) and a dual-branch image inpainting model to enable interactive, instruction-guided image manipulation. By treating editing as a localized inpainting task rather than a global noise inversion process, BrushEdit handles complex structural changes—like adding or removing objects—with arbitrary mask shapes while perfectly preserving unedited backgrounds. Remarkably, it achieves state-of-the-art background fidelity and text alignment with a fraction of the inference time required by traditional inversion methods.
What Problem Does This Paper Address?
Text-guided image editing via diffusion models typically falls into two camps, both of which suffer from distinct drawbacks:
- Inversion-based methods: These techniques invert a real image into latent noise and manipulate attention maps during generation. While good at preserving unedited regions, they struggle with large structural modifications (e.g., completely removing an object or swapping a background) because the structural layout is deeply baked into the inverted noise. They are also computationally expensive, requiring multiple sampling passes.
- Instruction-based methods: Frameworks like InstructPix2Pix map natural language directly to image edits. However, they operate as "black boxes," offering users no granular control over the exact editing region or intensity, and they often suffer from unstable generation quality due to noisy training data.
Furthermore, existing specialized inpainting models (such as the original BrushNet) typically require separate training for different mask types (e.g., random brush strokes vs. precise segmentation boundaries). Real-world user-drawn masks often combine elements of both, causing these models to produce edge artifacts or inconsistent boundaries.
BrushEdit bridges these gaps by introducing an interactive, multi-turn, "all-in-one" inpainting framework driven by natural language instructions.
Methods
BrushEdit coordinates image editing through an agent-cooperative framework split into two primary roles: the Editing Instructor and the Editing Conductor.
1. The Editing Instructor (MLLM Agent)
When a user provides a free-form text instruction (e.g., "Replace the hedgehog with a flamingo"), a pre-trained MLLM acts as the instructor. It classifies the edit type (addition, removal, local edit, or background edit) and identifies the target object. It then calls an open-world detection model (Grounded-SAM) to automatically generate a precise mask for the target region. Finally, the MLLM synthesizes a descriptive target caption for the final image.
2. The Editing Conductor (All-in-One Inpainting Model)
The actual pixel manipulation is handled by an enhanced, dual-branch inpainting architecture based on BrushNet. Crucially, the base diffusion model's weights remain completely frozen to preserve its rich generative priors. Features from the masked image, the downsampled mask, and the noisy latent are processed in a separate trainable control branch and injected layer-by-layer into the frozen UNet.
To ensure seamless blending at the boundaries, BrushEdit introduces a simple yet effective pixel-space approach: it applies a slight blur to the mask before executing a copy-and-paste operation to merge the unmasked source background with the newly generated foreground.
Datasets
To train a single model capable of handling any mask shape, the authors curated BrushData-v2, expanding on their previous dataset by integrating subsets of both segmentation and random masks from LAION-Aesthetic. They specifically selected images with clean backgrounds and paired them randomly with masks to simulate object removal, significantly boosting the model's deletion capabilities.
For evaluation, the authors tested BrushEdit across multiple benchmarks:
- Image Editing: PIE-Bench (700 images across 10 editing types).
- Image Inpainting: BrushBench (600 images with segmentation masks) and EditBench (240 images with random brush masks).
Key Insights and Ideas
- Inpainting as the Ultimate Editor: Instead of fighting the structural constraints of global latent noise inversion, localizing edits via an inpainting pipeline allows for massive structural changes (like complete object removal) without altering the rest of the image.
- Unified Mask Training: By training on a blend of structural segmentation masks and chaotic random brush strokes, BrushEdit achieves an "all-in-one" capability. It eliminates the need for separate specialized models and gracefully handles imperfect, user-drawn masks.
- Decoupled Control for Plug-and-Play Flexibility: Because the base diffusion model remains frozen, BrushEdit is entirely plug-and-play. It can be instantly attached to community fine-tuned weights (e.g., DreamShaper, Realistic Vision) to inherit distinct artistic styles without retraining.
Key Results
BrushEdit significantly outperforms previous inversion-based editing methods both quantitatively and qualitatively.
Quantitative Performance
On the PIE-Bench image editing benchmark, BrushEdit achieved a PSNR of 32.16 and an SSIM of 97.08, drastically outperforming competitive baselines like Plug-and-Play (PnP) and MasaCtrl, which hover around PSNRs of 22.46 and SSIMs of 79.68.
Inference Speedup
Because it bypasses the costly optimization loops of inversion techniques, BrushEdit requires only a single forward pass. It completes an edit in just 3.57 seconds, compared to 148.48 seconds for Null-Text Inversion and 382.98 seconds for Style Diffusion.
Qualitative Excellence
As shown below, traditional inversion methods often leave persistent structural artifacts or fail entirely when attempting to delete or add objects. BrushEdit cleanly executes these commands while maintaining flawless background consistency.
Limitations and Future Work
Despite its strong performance, BrushEdit inherits a few limitations:
- Dependence on the Base Model: The visual quality and style of the edited region are fundamentally bounded by the capabilities of the underlying frozen diffusion backbone.
- Mask and Text Mismatches: If the user-provided mask is highly irregular, or if the text prompt generated by the MLLM aligns poorly with the surrounding context, the model can still produce suboptimal or unrealistic generations.
Future work will focus on addressing these edge cases and exploring tighter integration between the MLLM agent and the generation branch to handle highly complex, multi-object reasoning tasks.
Summary updated