A$^2$-Edit: Precise Reference-Guided Image Editing of Arbitrary Objects and Ambiguous Masks

Huayu Zheng, Guangzhao Li, Baixuan Zhao, Siqi Luo, Hantao Jiang, Guangtao Zhai, Xiaohong LiuarXiv 2026

TL;DR

A$^2$-Edit is a unified reference-guided image inpainting framework capable of seamlessly inserting arbitrary objects into target scenes using only coarse or ambiguous masks. By introducing a Mixture of Transformers (MoT) architecture and a progressive Mask Annealing Training Strategy (MATS), it overcomes the limitations of domain-specific editing models and strict geometric mask requirements. Supported by a newly curated 500K multi-category dataset, UniEdit-500K, it delivers state-of-the-art generalization and robustness across diverse real-world editing tasks.

What Problem Does This Paper Address?

Reference-guided image inpainting—the task of transferring an object from a reference image into a masked region of a target image—is foundational for applications like virtual try-on, e-commerce product placement, and personalized image customization. However, current state-of-the-art methods suffer from two major bottlenecks:

  1. Domain Specialization vs. Generalization: Existing models are typically optimized for narrow domains (e.g., only garments or only portraits). Different object categories demand fundamentally conflicting modeling objectives: garment editing requires texture consistency, portraits require strict identity preservation, and rigid objects require precise geometric representations. Standard shared-parameter architectures struggle to balance these heterogeneous goals, leading to performance degradation when applied across diverse categories.
  2. Fragility to Coarse Masks: Most models rely on pixel-perfect, high-precision segmentation masks. In real-world applications, users typically provide rough sketches or bounding boxes. When mask quality degrades, conventional models fail to interpret the user's intent, often causing severe boundary artifacts or blending failures.

Methods

A$^2$-Edit is built on top of the FLUX.1 Fill Diffusion Transformer (DiT) backbone and introduces two key technical innovations to address category diversity and mask ambiguity:

1. Mixture of Transformers (MoT)

While traditional Mixture-of-Experts (MoE) methods restrict sparse routing to the Feed-Forward Network (FFN) layers, A$^2$-Edit extends expert routing to both the Attention and FFN modules. This is a crucial design choice for image editing, where structural relationships—such as shape alignment, texture consistency, and spatial coherence—are primarily governed by the Attention mechanism.

Each expert is implemented as a lightweight LoRA adapter to minimize computational overhead. The framework utilizes an Anchor-Guided Routing (AGR) strategy: a universal "backbone" expert is permanently activated to retain general knowledge, while specialized "assistant" experts are dynamically routed based on the semantic characteristics of the input object.

Overview of the A$^2$-Edit framework

2. Mask Annealing Training Strategy (MATS)

To break the model's dependency on flawless geometric boundaries, the authors propose a three-stage curriculum learning strategy that progressively relaxes mask precision during training:

  • Stage 1: Fine Mask Training: The model trains on precise segmentation masks to establish baseline structural generation capabilities.
  • Stage 2: Augmented Rough Mask Training: Masks are dilated and distorted using Perlin noise to simulate human drawing errors and edge extensions.
  • Stage 3: Bounding Box Training: The mask is simplified entirely to a bounding box, forcing the model to independently infer the object's pose, scale, and local structure based purely on context.

Datasets

To fuel the training of this unified framework, the authors introduced UniEdit-500K, a large-scale, multi-category dataset containing 500,104 reference-target image pairs.

Overview of the UniEdit-500K dataset

The dataset spans 8 major categories (Garments, Portraits, Animals, Plants, Accessories, Furniture, Vehicles, and Architecture) and is further refined into 209 fine-grained subcategories. It was constructed using a hybrid strategy combining video-driven dynamic sampling (from VidGen-1M), multi-view open data platforms, and automated segmentation pipelines using Grounding DINO and SAM.

For evaluation, the authors tested their approach against standard benchmarks like VITON-HD (for virtual try-on) and AnyInsertion, alongside a dedicated 200-sample multi-category test split from UniEdit-500K.

Key Insights and Ideas

  • Attention-Level Routing is Essential for Vision MoE: Splitting only the FFN layers is insufficient for complex image manipulation. Relational features like texture alignment and spatial deformation require category-specific attention spaces.
  • Mask Relaxation as a Semantic Catalyst: Progressively stripping away mask precision acts as a regularizer. It forces the network to shift from memorizing geometric boundaries to developing a deeper contextual understanding of how an object naturally fits into an environment.
  • Dynamic Expert Collaboration: The AGR gating mechanism allows multiple experts to activate simultaneously. This enables cross-category semantic transfer, allowing the model to generalize effectively even to out-of-distribution or unseen object categories by blending expert knowledge.

Key Results

A$^2$-Edit consistently outperformed specialized and general baselines (including AnyDoor, MimicBrush, ACE++, and InsertAnything) across both fine and rough mask conditions.

Quantitative Performance

  • Multi-Category Generalization (UniEdit Test Set): Under rough mask conditions, A$^2$-Edit achieved a DINO-I score of 62.28 and a CLIP-I score of 77.45, substantially outperforming the next best method, ACE++ (56.68 and 73.66, respectively). It also achieved the lowest Fréchet Inception Distance (FID) of 54.62, indicating superior visual realism.
  • Common Domain Benchmarks: On the specialized VITON-HD dataset, A$^2$-Edit maintained top-tier performance, achieving a CLIP-I score of 81.53 with fine masks, proving that a unified model can match or exceed domain-specific experts.

Qualitative & User Preference

Qualitative evaluations demonstrate that A$^2$-Edit generates sharper details, preserves identity features (even in challenging portrait and pet face-swaps), and avoids "semantic leakage" into the background.

Qualitative comparison with existing mask-guided image editing methods

A user study involving 24 participants confirmed these findings, with A$^2$-Edit being preferred over competing methods by significant margins (e.g., preferred over AnyDoor in 92% of cases and over InsertAnything in 69% of cases).

Limitations and Future Work

Despite its strong performance, the authors note a few limitations:

  • Excessively Large Masks: When a user-provided mask is overly expansive, the model can occasionally struggle to accurately infer the exact placement or intent of the edit.
  • Hardware Demands: The MoT routing mechanism introduces a slight memory overhead, increasing peak inference memory usage to 42 GB (compared to 39.8 GB for the baseline DiT) on an NVIDIA A100 GPU.
  • Rare Categories: While UniEdit-500K is highly diverse, it still lacks deep representation for highly specialized professional fields or rare objects, which the authors plan to address in future dataset expansions.

Summary updated

BibTeX
@misc{zheng2026edit,
  author = {Huayu Zheng and Guangzhao Li and Baixuan Zhao and Siqi Luo and Hantao Jiang and Guangtao Zhai and Xiaohong Liu},
  title = {{A$^2$-Edit: Precise Reference-Guided Image Editing of Arbitrary Objects and Ambiguous Masks}},
  year = {2026},
  eprint = {2603.10685},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.10685},
}
Figure