Improving Rectified Flow with Boundary Conditions

Xixi Hu, Runlong Liao, Keyang Xu, Bo Liu, Yeqing Li, Eugene Ie, Hongliang Fei, Qiang Liu · DOI

Generative modeling has seen a massive shift toward "flow-based" approaches like Rectified Flow (RF). By learning to map a simple noise distribution to complex data via a straight-line path, RF models offer faster sampling and high-quality results. However, even state-of-the-art models like FLUX.1-dev have a hidden flaw: they often fail to satisfy the mathematical "boundary conditions" at the start and end of their generation trajectory.

A new paper from researchers at UT Austin and Google identifies this "leaky boundary" problem and proposes a remarkably simple architectural fix that significantly boosts image quality and sampling stability.

Conceptual overview of Rectified Flow with boundary conditions and qualitative comparison of predicted velocity.

The Boundary Violation Problem

In Rectified Flow, a neural network learns a velocity field—essentially a set of instructions on how to move a point from "noise space" to "data space" over a time interval from $t=0$ to $t=1$. Theoretically, at the very end of the process ($t=1$), the velocity should reduce to a simple identity map (the velocity should equal the data point itself).

However, because unconstrained neural networks are used to learn this velocity, they often "miss" these theoretical endpoints. This is particularly catastrophic during stochastic sampling (using SDEs). In these cases, the model uses a "score function" to refine the image, but the math for that function involves dividing by $(1-t)$. As $t$ approaches 1, any tiny error in the velocity field gets amplified toward infinity, causing the sampler to diverge and produce "over-smoothed" or "cartoonish" artifacts.

Proposed Solutions: Boundary-enforced RF

The authors propose the Boundary-enforced Rectified Flow Model (Boundary RF Model). Instead of letting the neural network predict velocity directly, they wrap the network in a mathematical structure that forces it to satisfy the boundaries by design. They introduce two main variants:

  1. Mask-based Boundary RF: This uses scalar "masking" functions (like sines and cosines) to blend the neural network's output with the required boundary values. At $t=0$ and $t=1$, the masks ensure the output matches the theoretical requirements, regardless of the internal weights.
  2. Subtraction-based Boundary RF: A simpler "residual" approach where the model calculates the error at the terminal boundary ($t=1$) and subtracts it from the current prediction. While this requires an extra forward pass, it is incredibly easy to implement and highly effective.

Experimental Results

The models were evaluated on standard competitive benchmarks including CIFAR-10 and ImageNet ($256 \times 256$ and $512 \times 512$). The improvements were consistent across different model sizes (from DiT-B to DiT-XL).

Quantitative comparison of FID and IS metrics across different sampling steps and methods.

On ImageNet ($256 \times 256$), the Boundary RF Model improved the FID score by 8.01% (from 6.87 to 6.32) using standard ODE sampling. When using SDE samplers, the improvement was even higher (8.98%), proving that boundary enforcement is vital for noise-based refinement. Qualitatively, visual comparisons show that Boundary RF produces images with significantly more fine-grained detail compared to the "mushier" outputs of vanilla RF models.

Conclusion

Enforcing boundaries doesn't just make the model more accurate; it makes the sampling process stable. By preventing the score function from exploding near $t=1$, these models allow for larger step sizes and more aggressive stochastic noise during generation. While the "Subtraction-based" variant adds computational overhead, the "Mask-based" approach offers a nearly free performance boost that could likely be scaled to other domains like video generation.

Summary updated

BibTeX
@inproceedings{hu2025improving,
  author = {Xixi Hu and Runlong Liao and Keyang Xu and Bo Liu and Yeqing Li and Eugene Ie and Hongliang Fei and Qiang Liu},
  title = {{Improving Rectified Flow with Boundary Conditions}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
}
Figure