Generative models like diffusion typically synthesize data by slowly transforming a simple noise distribution into a complex data distribution. Mathematically, this transformation is often guided by an Ordinary Differential Equation (ODE) or a Stochastic Differential Equation (SDE) that defines a path through a latent space.
However, in traditional diffusion models, these paths are highly curved. This curvature introduces a severe computational penalty: when a numerical differential equation solver attempts to take large steps along a curved path, it overshoots the true trajectory, accumulating discretization errors and causing the model to drift away from the true data manifold. To prevent this, standard models must take dozens or hundreds of tiny steps, calculating the network's outputs at every single turn.
The core insight behind trajectory straightening—realized through frameworks like Rectified Flow and Flow Matching—is that the most efficient way to connect two distributions is a straight line. By forcing the generative paths to be linear, models can eliminate curvature, minimize discretization errors, and drastically accelerate inference down to a handful of steps, or even a single step.
The Geometry of Rectified Flows
To understand why trajectory straightening works, we can look at how these models construct their target paths during training. Let $x_0$ be a sample drawn from a simple prior distribution (such as Gaussian noise) and $x_1$ be a sample from the target data distribution (such as a real image).
The simplest way to connect these two points over a time horizon $t \in [0, 1]$ is a linear interpolation:
$$x_t = (1 - t)x_0 + t x_1$$
If we take the time derivative of this path, we get the velocity vector that points directly from the noise to the data:
$$\frac{dx_t}{dt} = x_1 - x_0$$
In flow matching, a neural network is trained to regress this velocity field. Instead of predicting complex noise scores at varying schedules, the network learns to predict a straight-line vector field. As noted by Nakkiran et al., these straight-line paths maintain a more consistent velocity throughout the generation process, making them inherently more stable numerically than traditional curved diffusion paths.
When the generative trajectory is a straight line, a numerical solver does not need to constantly adjust its direction. As demonstrated by Esser et al. in scaling up rectified flow transformers, this geometric simplification drastically improves sample efficiency, allowing high-resolution models to generate high-fidelity outputs with far fewer computational steps.
The Problem of Crossing Paths
If constructing a straight path is as simple as linear interpolation, why do generative trajectories ever become curved? The issue arises because of how noise and data are paired during training.
If we independently sample a random noise vector $x_0$ and a random image $x_1$, their straight-line paths will inevitably cross the paths of other noise-image pairs at intermediate time steps.
Independent Coupling (Paths Cross) Optimal Transport (Parallel Paths)
x_1 (Data) x_1 (Data)
/ \ | |
/ \ | |
/ \ | |
X X <-- Intersection | |
/ \ | |
x_0 x_0 (Noise) x_0 x_0 (Noise)
An intersection creates a fundamental mathematical conflict. At the exact point of intersection, a deterministic vector field can only assign a single velocity vector. Because the network cannot output two different velocities simultaneously, it is forced to learn the average velocity of all trajectories passing through that point. This averaging effect destroys the linearity of the individual paths, bending the vector field and reintroducing the very curvature we want to avoid.
To resolve this, the trajectories must be un-entangled so that they run as parallel as possible. The authors of various flow-matching frameworks achieve this using Optimal Transport (OT) couplings. As explored by Kollovieh et al. and Song et al., pairing noise and data samples to minimize the total transport cost ($\mathbb{E}[\|x_0 - x_1\|^2]$) mathematically guarantees that the linear trajectories do not cross. This optimization yields a smooth, straight vector field where the network can easily learn a direct mapping.
Trajectory Rectification and Distillation
When working with an existing model that already suffers from curved trajectories, the paths can be straightened post-hoc through an iterative process known as rectification or reflow.
As described by Guo et al., trajectory rectification operates by using a pre-trained, curved model to generate synthetic data from known noise starting points. By pairing the initial noise $x_0$ with the model's deterministic output $\hat{x}_1$, the authors create a new, perfectly aligned dataset. Re-training a model on these rectified pairs forces the transport paths to become linear.
Once a trajectory is completely straight, the mapping from noise to data becomes entirely predictable. This predictability is the ultimate prerequisite for compressing multi-step models into ultra-fast samplers.
- One-Step Generation: Liu et al. demonstrated that once probability flows are linearized, a student model can accurately approximate the entire continuous mapping in a single inference step. This allows one-step distillation without the massive quality degradation typical of curved architectures.
- Piecewise Linearization: Rather than forcing a global straight line over the entire generation process, YAN et al. showed that dividing the trajectory into discrete time windows and straightening each segment individually reduces numerical errors even further, preserving structural details in as few as four steps.
Broad Applications
By reducing the stiffness of the underlying ordinary differential equations (Onken et al.), trajectory straightening makes generative modeling computationally viable for real-time and cross-modal applications where traditional diffusion is too slow.
The efficiency gains span multiple domains. In audio-visual synthesis, Wang et al. utilize rectified flow matching to align video and audio latents along straight trajectories, ensuring temporal sync with minimal sampling steps. For dense perception tasks, Wang et al. leverage straight-line velocity fields to establish deterministic, reversible paths between images and semantic masks, enabling real-time generative perception. Similarly, Hu et al. apply linear trajectory flow matching to time-series generation, preventing the model drift and numerical accumulation errors that frequently plague autoregressive or curved diffusion baselines.