Inject Where It Matters: Objective-Dependent Feature Control in Rectified-Flow Image Editing
Organizations: HSE University · FusionBrain Lab
Abstract
Many prompt-driven FLUX editing methods rely on injecting source features into target-conditioned generation, creating an inherent trade-off between source preservation and the desired edit. We address this problem by controlling where source features are injected and which transformer blocks are used. First, we introduce adaptive masks that spatially gate feature injection using differences between source- and target-conditioned block outputs at matched inversion states. Second, we use REINFORCE to select Top-K injection blocks under different preservation-editability objectives. The selected blocks are fixed at inference and require no online search. On PIE-Bench with FLUX.1-dev, spatial masking controls the alignment-preservation trade-off. On 60 validation examples, a learned nine-block set gives lower whole-image LPIPS than the 18-block RF-Edit set within the same masked pipeline, with slightly lower alignment. Among 50 random nine-block sets, it has the lowest LPIPS but not the highest reward. Separate objective sweeps reveal different block preferences for preservation and alignment.
Figures & tables
| Layer set | CLIPScore | LPIPS | Reward | |
|---|---|---|---|---|
| Stable Flow | 9 | 26.092 | 0.429 | 3.485 |
| Random | 9 | 26.460 | 0.471 | 3.498 |
| sample s.d. | 0.126 | 0.020 | 0.026 | |
| Learned (ours) | 9 | 26.392 | 0.430 | 3.529 |
| RF-Edit | 18 | 26.550 | 0.453 | 3.530 |
| Method | Blocks | CLIPScore | LPIPS |
|---|---|---|---|
| RF-Edit | 18 | 25.728 | 0.3627 |
| FireFlow | 38 | 26.634 | 0.3997 |
| DNAEdit | – | 25.428 | 0.2835 |
| ReFlex | 32 | 26.105 | 0.3250 |
| Stable Flow | 9 | 23.881 | 0.1867 |
| Ours (RF-Edit layers) | 18 | 26.747 | 0.4295 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Parameter | Value |
|---|---|
| Candidate blocks | 57 |
| Sampled blocks | 9 (main policy) |
| Sets per example | 8 |
| Examples per optimizer update | 8 |
| Editing rollouts per update | 64 |
| Optimizer | Adam |
| LPIPS-only Top- | CLIP-only Top- | |
|---|---|---|
| 3 | ||
| 6 | ||
| 9 |
| Step 80 | Step 160 | |
|---|---|---|
| Top- set | ||
| CLIPScore | 26.368 | 26.392 |
| LPIPS | 0.440 | 0.430 |
| Reward | 3.515 | 3.529 |
| Layer set | CLIPScore | LPIPS | |
|---|---|---|---|
| Random (mean) | 26.841 | 0.4480 | 3.5782 |
| sample s.d. | 0.209 | 0.0135 | 0.0273 |
| Random (highest reward) | 27.228 | 0.4427 | 3.6414 |
| Learned (step 160) | 26.623 | 0.4129 | 3.5805 |
| Method | Configuration |
|---|---|
| RF-Edit | 25/25, ; 18 value blocks; no mask |
| FireFlow | 8-step, ; 38 value blocks; no spatial mask |
| DNAEdit | 24/24; no injection |
| ReFlex | 21/28; 32 sharing blocks; native mask |
| Stable Flow | 50/50; 9 K/V-sharing blocks; no spatial mask |
| Ours (RF-Edit) | 25/25, ; 18 output blocks; endpoint mask, |
Image Editing
Image editing changes selected visual content while preserving the parts of an image that should remain unchanged.
See all 351 papers