TL;DR
This paper tackles a key limitation in Rectified Flow (RF) generative models: the learned velocity field often fails to satisfy crucial boundary conditions, leading to inaccurate sampling, especially near the data distribution. The authors introduce "Boundary-enforced Rectified Flow" (Boundary RF) by modifying the model to explicitly enforce these conditions, significantly improving sample quality and stability, particularly for stochastic sampling.
What Problem Does This Paper Address?
Generative models like diffusion models and flow-based models have shown remarkable success in creating realistic data. Rectified Flow (RF), a type of flow-based model, frames generation as solving an Ordinary Differential Equation (ODE) that transforms a simple noise distribution into a complex data distribution. This is achieved by learning a "velocity field" that guides this transformation.
The core idea is that if you have a noise sample ($X_0$) and a data sample ($X_1$), you can define a path between them (e.g., a straight line). RF learns a velocity field that, when integrated, follows these paths. Crucially, for the standard straight-line interpolation, the velocity field has specific theoretical properties at the start ($t=0$) and end ($t=1$) of the process. At $t=1$, the velocity field should ideally become the identity map, meaning it just outputs the input itself.
However, vanilla RF models, which use unconstrained neural networks to learn this velocity field, often fail to satisfy these boundary conditions. This inaccuracy becomes particularly problematic during inference when generating new samples. When using stochastic sampling methods (which add a bit of randomness to improve sample quality), errors in the velocity field near the boundary ($t=1$) are amplified, leading to degraded sample quality, such as oversmoothed or "cartoonish" results. This paper aims to fix this by ensuring the learned velocity field respects these essential boundary conditions.
Methods
The authors propose "Boundary-enforced Rectified Flow" (Boundary RF) models. The core idea is to modify the parameterization of the velocity field to explicitly enforce the boundary conditions. They introduce two main variants:
- Mask-based Boundary RF Model: This approach structures the velocity field $v(x, t)$ as a combination of learned components and predefined functions that guarantee the boundary conditions are met. The velocity field is expressed as $v(x, t) = g(t) \cdot (C – x) + f(t) \cdot x + h(t) \cdot m_0(x,t)$, where $m_0(x,t)$ is a neural network (like a U-Net or DiT), and $f, g, h$ are scalar functions designed to be zero or one at the boundaries ($t=0, 1$) as needed. For example, they propose using cosine and sine functions for $f, g, h$. This method enforces both $t=0$ and $t=1$ boundary conditions.
- Subtraction-based Boundary RF Model: This variant offers a simpler approach. It enforces only the $t=1$ boundary condition ($v(x, 1) = x$) by defining the velocity field as $v(x, t) = x + m_0(x, t) – m_0(x, 1)$. Here, $m_0(x,t)$ is a standard neural network output. By subtracting the network's output at $t=1$ from its output at time $t$, the model is guaranteed to satisfy $v(x, 1) = x$ by design. This method is simpler to implement but requires an extra forward pass of the neural network at $t=1$ for each evaluation.
Both methods aim to improve the learned velocity field without sacrificing the representational power of the underlying neural network architectures.
Datasets
The models were trained and evaluated on the following datasets:
- CIFAR-10: A standard dataset of 32x32 resolution images.
- ImageNet: Used at resolutions of 256x256 and 512x512.
No new benchmarks were introduced; standard datasets were used to evaluate performance against existing methods.
Key Insights and Ideas
- Boundary Conditions Matter: The paper strongly emphasizes that the theoretical boundary conditions of the velocity field in RF are not just theoretical niceties but have a direct, practical impact on generative quality, especially for stochastic sampling.
- Unconstrained Models Fail: Vanilla RF models, by using unconstrained neural networks, often fail to learn these boundary conditions accurately, leading to suboptimal performance.
- Explicit Enforcement Works: Directly enforcing these boundary conditions through model architecture modifications (mask-based or subtraction-based) significantly improves generative performance.
- Stochastic Sampling Benefits Most: The improvements are particularly pronounced when using stochastic sampling methods, which are sensitive to score function accuracy near the data distribution.
- Simplicity vs. Performance: The subtraction-based method offers a simpler implementation and still achieves excellent results, demonstrating that enforcing even just the $t=1$ boundary condition is highly beneficial.
Key Results
- Improved FID Scores: On ImageNet 256x256, the Boundary RF Model (specifically the subtraction-based variant) achieved an FID of 6.32, outperforming the vanilla RF baseline's FID of 6.87. This represents an 8.01% improvement using ODE sampling and 8.98% improvement using SDE sampling.
- Better Sample Quality: Qualitative results showed that Boundary RF models generate images with better structure, fewer artifacts, and improved visual fidelity compared to vanilla RF.
- Stable Stochastic Sampling: Boundary RF models demonstrated more stable performance with varying levels of stochasticity (noise scale), mitigating oversmoothing artifacts often seen in vanilla RF.
- Scalability: The proposed methods scale well to larger models (DiT-L/XL) and higher resolutions (512x512), consistently outperforming vanilla RF.
Limitations and Future Work
- Computational Cost: The subtraction-based method requires an additional forward pass of the neural network, increasing inference cost by approximately 2x compared to the mask-based or vanilla RF models.
- Future Work: The authors suggest exploring adaptive boundary enforcement strategies for further performance gains and task-specific customization. They also propose extending Boundary RF Model to larger models and higher resolutions for text-to-image and video generation tasks.
Summary updated