Abstract
Instruction-based diffusion models often struggle with complex, multi-step image editing tasks like object movement or resizing, frequently suffering from spatial imprecision and quality degradation. We present FunEditor, a novel framework that decomposes complex edits into simple, "atomic" functions—such as removal, enhancement, and harmonization. By aggregating these functions and applying them simultaneously via localized cross-attention masking, FunEditor achieves high-quality results in just four inference steps. Our approach is up to 24 times faster than current state-of-the-art methods while maintaining superior visual fidelity and background consistency.
Introduction
While models like InstructPix2Pix have simplified image editing through natural language, they face significant challenges with complex operations. Specifically, tasks like moving an object require a multi-step process: removing the object from its source location and recreating it at a target location. Sequential execution of these steps often leads to "error accumulation," where each pass degrades the overall image quality. Furthermore, text-only prompts often lack the spatial precision required to prevent unintended global changes.
FunEditor addresses these limitations by adopting a "divide and conquer" strategy. It treats complex edits as a combination of localized atomic operations, performed in a single denoising pass to ensure efficiency and precision.
Methodology: Function Aggregation
The core innovation of FunEditor is the concept of Function Aggregation. Rather than training on complex end-to-end tasks, the model is trained on a library of atomic functions:
- Object Removal ($f_{OR}$): Inpainting a masked region with a natural background.
- Edge Enhancement ($f_{EE}$): Refining the boundaries of a newly introduced or modified object.
- Harmonization ($f_{HR}$): Adjusting lighting and texture to integrate an object into a new environment.
Technical Implementation
- Task Tokens: Each atomic function is associated with a unique learnable token (e.g.,
<Task_OR>) integrated into the model's vocabulary. - Cross-Attention (CA) Masking: To prevent "leakage" between different edit regions or into the background, the model utilizes binary masks. During cross-attention, the model is constrained to attend to specific task tokens only within their corresponding masked areas.
- Aggregation Logic: Complex edits are formulated by combining these tokens. For instance, moving an object involves applying the removal token to the source area and the enhancement token to the target area simultaneously.
- Efficiency via Distillation: By employing LCM-LoRA distillation, FunEditor produces high-quality outputs in only 4 denoising steps, significantly reducing inference time.
Evaluation and Results
FunEditor was evaluated using the COCOEE benchmark (3,500 images) and the ReS dataset (100 real-world pairs).
Performance and Speed
FunEditor demonstrates a significant speed advantage, achieving 5–24x faster inference than optimization-based baselines. On an NVIDIA V100 GPU, FunEditor processes an image in approximately 1 second, compared to 24 seconds for methods like DiffEditor.
Qualitative and Quantitative Superiority
Quantitative metrics across Image Quality Assessment (IQA) and background consistency scores show FunEditor consistently outperforming models like AnyDoor and Paint-by-Example. Qualitatively, FunEditor excels at preserving the identity of the original object during movement, avoiding the "hallucinations" common in other diffusion-based editors.
Discussion and Limitations
A key insight of this work is that composition is more effective than direct complexity. Teaching a model simple tasks perfectly allows for near-infinite generalization through aggregation. However, FunEditor currently depends on external binary masks (e.g., from SAM) and is limited to the set of atomic functions it was trained on. Future work will focus on integrating automatic mask generation and expanding the library of task tokens to include operations like style transfer.
Conclusion
FunEditor provides a scalable and efficient solution for complex image editing. By leveraging function aggregation and localized masking, it bridges the gap between intuitive instruction-based editing and the precision required for professional-grade results.
Summary updated