Steering Rectified Flow Models in the Vector Field for Controlled Image Generation

Maitreya Patel, Song Wen, Dimitris N. Metaxas, Yezhou Yang

TL;DR

FlowChef enables controlled image generation—including linear inverse problems, image editing, and style transfer—on rectified flow models (such as InstaFlow and Flux) without needing expensive image inversion or backpropagation through the model. By exploiting the straight trajectories and smooth vector fields of rectified flows, FlowChef steers sampling via simple "gradient skipping," cutting latency from minutes to seconds while scaling to 12-billion-parameter models.

What Problem Does This Paper Address?

Controlling the output of generative models during inference (for example, restoring degraded images or performing text-based edits) typically relies on diffusion models guided by gradient backpropagation (e.g., DPS, FreeDoM) or latent inversion (e.g., DDIM inversion, Null-text inversion).

However, these techniques carry crippling computational costs:

  1. Backpropagating through the solver: Computing gradients with respect to intermediate noisy states requires differentiating through the model or ODE solver repeatedly, which demands massive memory and runtime (often 1–5 minutes per image).
  2. Inversion bottlenecks: Inverting an existing image back into noise is error-prone, sensitive to numerical drift, and computationally heavy.
  3. Inability to scale: State-of-the-art flow-based architectures like Flux.1 and SD3 have billions of parameters, causing existing inversion and backpropagation-based guidance schemes to crash due to out-of-memory (OOM) errors.

Methods

FlowChef re-evaluates the error dynamics of ordinary differential equations (ODEs) during guided generation.

  • Error Dynamics & Straight Paths: In non-linear ODEs or curved diffusion trajectories, approximating gradients directly introduces an error term $\epsilon(t)$ driven by trajectory crossovers and curvature, causing optimization to diverge. In contrast, Rectified Flow Models (RFMs) enforce straight sampling paths between data and noise, causing crossover-induced errors to vanish ($\epsilon(t) \to 0$).
  • Gradient Skipping via Jacobian Constancy: Standard guidance computes $\nabla_{x_t} \mathcal{L}$. FlowChef mathematically proves that under local linearity and Jacobian constancy, $\nabla_{x_t}\mathcal{L} \approx (I + t \cdot J_{u_\theta})^T \nabla_{\hat{x}_0}\mathcal{L}$. As timestep $t \to 0$, this matrix approaches the identity matrix ($I$). Thus, the gradient with respect to the intermediate state can be replaced by the gradient directly evaluated at the predicted clean image ($\nabla_{\hat{x}_0}\mathcal{L}$).
  • Deterministic Steering: FlowChef applies an intuitive update rule during inference: $$x_{t-\Delta t} = x_t + \Delta t \cdot u_\theta(x_t, t) - s' \nabla_{\hat{x}_0}\mathcal{L}$$ where $s'$ is the guidance scale. This eliminates the need to backpropagate through the flow network $u_\theta$ entirely.

Datasets

  • ImageNet 64×64: Evaluated on classifier guidance using pre-trained IDDPM and Rectified Flow++ (RF++).
  • CelebA & AFHQ-Cat: Evaluated on pixel-space linear inverse tasks (box inpainting, $2\times$/$4\times$ super-resolution, Gaussian deblurring).
  • PIE-Bench: 100 randomly sampled prompts used for MTurk human evaluation on text-driven image editing (1,500 total ratings).
  • SFHQ (Synthetic Faces High Quality): 256 face images tested for image editing tasks (e.g., adding eyeglasses) against concurrent flow-inversion methods.

Key Insights and Ideas

  • Why diffusion breaks, but rectified flow succeeds: Diffusion trajectories curve and cross over each other, making the mapping from intermediate states $x_t$ to predicted clean states $\hat{x}_0$ sensitive and non-injective. RFMs construct straight-line paths, so a single forward step yields an accurate estimate of $\hat{x}_0$, allowing gradient skipping to stay on the data manifold.
  • No inversion needed for editing: Because the vector field can be steered deterministically via an additive guidance term alongside standard classifier-free guidance, image editing can be executed starting from pure random noise rather than requiring a pre-inverted latent code.
  • Extreme memory savings: Bypassing backpropagation through the ODE solver means the GPU only needs to store activation maps for the loss function evaluation on $\hat{x}_0$, rather than backpropagating through billions of transformer parameters.

Key Results

  • Linear Inverse Problems:
  • In pixel space (RF++ on CelebA/AFHQ), FlowChef consistently outperforms DPS, FreeDoM, and D-Flow across PSNR, SSIM, and LPIPS (e.g., achieving 26.32 dB PSNR on easy box inpainting vs. 23.61 dB for DPS and 20.37 dB for D-Flow).
  • FlowChef executes in 4.31 seconds (0.43 GB VRAM) on an A6000 GPU, compared to 80.42 seconds (6.44 GB VRAM) for D-Flow.
  • Latent-Space Inpainting & Restoration: On latent models, FlowChef runs in 18 seconds and requires 14 GB VRAM, whereas diffusion baselines like PSLD and Resample require 3 to 5 minutes and up to 33 GB VRAM.
  • Scaling to Flux.1[Dev]: FlowChef scales seamlessly to the 12B-parameter Flux model at $1024 \times 1024$ resolution within 30 steps—a setup where previous backprop-based methods run out of memory.
  • Image Editing & Inversion Comparison: In human A/B testing on PIE-Bench, FlowChef beats inversion-free baselines DiffEdit and InfEdit. Compared to the concurrent flow method RF-Inversion, FlowChef cuts editing runtime in half (~15s vs. ~31s) while achieving better text alignment (CLIP-T: 0.2828 vs. 0.2790).

Limitations and Future Work

  • Model-Specific Trajectory Non-linearity: While InstaFlow has highly linear trajectories, larger distillation-free models like Flux.1[Dev] exhibit slight trajectory curvature, requiring careful hyperparameter tuning and occasionally causing color degradation.
  • VAE Non-linearity: In latent models, pixel-space loss functions passed through the non-linear VAE decoder lead to minor artifacts or failure modes in under 10% of deblurring and super-resolution cases.
  • Manual Masking: The image editing pipeline currently assumes user-annotated or external masks; integrating automatic cross-attention masking remains an open next step.
  • Extension Beyond 2D: While preliminary demonstrations show promise for 3D multi-view generation, extending FlowChef efficiently to video generation is left for future research.

Summary updated

BibTeX
@inproceedings{patel2025steering,
  author = {Maitreya Patel and Song Wen and Dimitris N. Metaxas and Yezhou Yang},
  title = {{Steering Rectified Flow Models in the Vector Field for Controlled Image Generation}},
  booktitle = {FPI @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=p3DUUpd2No},
}
Figure