Introduction
Existing image inpainting frameworks have traditionally relied on strictly supervised training paradigms. While effective for basic tasks, this approach suffers from a critical flaw: an over-reliance on ground-truth reconstruction. By forcing models to perfectly recreate a single, static target image, they often produce conservative, over-smoothed outputs that lack creative diversity and fail to align with human aesthetic preferences.
To address this, researchers have proposed the first online reinforcement learning (RL) framework for text-guided image inpainting. By integrating Group Relative Policy Optimization (GRPO) and Direct Preference Optimization (DPO), this novel approach abandons rigid ground-truth matching in favor of flexible, human-aligned aesthetic control. The result is a system capable of generating diverse, high-quality, and seamless image edits across major architectures like Stable Diffusion and FLUX.
The Problem: The "Ground-Truth" Trap
In a standard supervised reconstruction setup, an inpainting model is given a masked image and a text prompt, then trained to minimize the pixel-level difference (e.g., Mean Squared Error) between its output and a single ground-truth image.
This creates two major bottlenecks:
- Stifled Creativity: If a prompt allows for multiple valid outcomes (e.g., "a dog on a stool"), forcing the model to reconstruct one specific dog limits its generative potential. The model learns to play it "safe," resulting in bland outputs.
- Stitching Traces: Standard global reward models often fail to detect unnatural artifacts at the boundary where generated pixels meet the original image, leading to visible seams.
Methodology: An Online RL Pipeline
To overcome these limitations, the authors treat inpainting as a sequential decision-making process, allowing the model to explore diverse visual spaces and receive real-time feedback.
Key technical innovations include:
1. GRPO & DPO Integration
The framework utilizes Group Relative Policy Optimization (GRPO), which is significantly more memory-efficient than standard Proximal Policy Optimization (PPO) because it eliminates the need for a separate "Critic" network. By estimating baselines from group scores, it scales elegantly to large models like FLUX.1.
2. Boundary Gradient Consistency Score (BGCS)
To eliminate unnatural seams, the researchers developed BGCS. This metric uses morphological operations to compare the gradients of the newly generated pixels (the inner boundary) with the preserved background (the outer boundary). By penalizing discontinuities, the model learns to blend edits seamlessly into the original image.
3. Scale-Aware Dynamic Reward Mechanism
The authors identified a critical "Background Dominance" issue: standard aesthetic reward models (like ImageReward or HPS) are virtually blind to small edits because the unchanged background dominates the overall score. To fix this, they introduced a dynamic, scale-aware reward mechanism based on the mask ratio.
- For small occlusions: The reward heavily prioritizes boundary consistency (BGCS) to ensure seamless blending.
- For large-scale generation: The reward shifts focus toward overall visual aesthetics and text alignment.
4. Decoupled Training
By removing the requirement for paired image-text datasets, the model can be trained on unpaired data. This significantly expands the diversity of scenarios and lighting conditions the model can handle.
Experimental Setup
The framework was validated across several diverse benchmarks:
- Training: 24,000 stylistically diverse images from the LAION dataset, annotated via Multimodal Large Language Models (MLLMs).
- Testing: FluxBench (50 high-res images), EditBench (240 complex editing instructions), and BrushBench (600 object-shaped masks).
Key Results
The proposed RL pipeline acts as a highly effective, architecture-agnostic post-training alignment strategy, working seamlessly on both U-Net (Stable Diffusion 1.5) and Diffusion Transformer (FLUX.1) backbones.
- Massive Quantitative Gains: On FluxBench, the fine-tuned "Flux.1 (Ours)" achieved an ImageReward of 31.41, a staggering improvement over the base model's -32.53. It also demonstrated superior performance across HPSv3 and PickScore metrics.
- Qualitative Superiority: Visual comparisons reveal that the RL-tuned models produce significantly finer textures—such as individual blades of grass or realistic fabric folds—overcoming the "over-smoothed" look typical of base models.
- Human Preference: In a double-blind study with 76 participants, the proposed FLUX.1-based model received 410 votes, overwhelmingly defeating competitors like BrushNetX (122 votes) and PowerPaint v2 (98 votes).
Limitations and Future Directions
While the dynamic reward mechanism drastically improves inpainting quality, quantifying human perception of boundaries remains an ongoing challenge. Current metrics are vastly improved but do not yet perfectly capture the nuances of human aesthetic intuition.
Future research will likely focus on developing boundary metrics with even higher perceptual discriminability and designing finer-grained reward functions for complex, multi-object editing. Finally, as high-fidelity inpainting becomes increasingly accessible, addressing the ethical implications of visual forgery through robust digital watermarking standards will be paramount.
Summary updated