U3.2 14 min read Oct 2026

U3.2 Straightening I: Reflow

Builds on2 notes

How can the learned field produce straighter trajectories?

For fixed step size and spatial stability, Euler error is bounded using

eLh∫01∥at(xt)∥ dte^Lh\int_0^1\|a_t(x_t)\|\,\mathrm dt

where acceleration measures velocity change along the generated trajectory. Constant-speed straight motion has zero acceleration and exact Euler integration.

Can we obtain nearly constant-speed straight trajectories while still transporting p0p_0 to p1p_1?

In a dispersing crowd, a traveler following local people keeps changing direction when nearby groups disagree or split.

Reference paths supply those local directions. Regression averages them; as compatible paths change along a generated trajectory, the average direction can change too.

Can a different endpoint assignment make reference directions more consistent without changing the endpoint populations?

Use the endpoints already paired by an ODE

A deterministic assignment fixes the endpoint once the starting point is known, without drawing additional randomness.

Our learned ODE already supplies such an assignment:

dZtdt=vθ(Zt,t)\frac{\mathrm dZ_t}{\mathrm dt}=v_\theta(Z_t,t)

With a unique solution, it determines the whole trajectory, and distinct trajectories cannot meet at the same time.

Each starting point therefore has a generated endpoint, rather than an independently sampled target.

SupplementWhy can unique ODE trajectories not cross at the same time?

At a shared position and time, a field gives one velocity. However, agreement of instantaneous velocity alone is not enough to establish uniqueness.

If two solutions meet, use their meeting point and time as an initial condition. Under forward and backward uniqueness, both must be the same solution, so they cannot have come from distinct initial points.

This rules out meeting and then separating at the same time. Different trajectories can still visit a spatial location at different times.

These deterministic routes may still bend. Could we retain their endpoint assignments while replacing their interiors by straight references?

Pair endpoints produced by the existing flow, then reconnect each pair with a straight line.

Let everyone follow the current navigation once. Record each person’s start and actual arrival. Use those paired endpoints for the next training round rather than assigning destinations independently again.

First consider ideal velocity learning. Begin with a coupling π(0)\pi^{(0)}, often independent, and perform three operations:

  1. Construct linear references and their marginal field vt(x)=E[X1−X0∣It=x]v_t(x)=\mathbb E[X_1-X_0\mid I_t=x].
  2. Integrate that field from Z0(1)=X0Z_0^{(1)}=X_0 to obtain Z1(1)Z_1^{(1)}.
  3. Use their joint law as the next coupling:
π(1):=Law⁡(Z0(1),Z1(1)).\pi^{(1)}:=\operatorname{Law}(Z_0^{(1)},Z_1^{(1)}).

Liu, Gong, and Liu [1] call this operation rectification. As a map between couplings,

π(1)=R(π(0)).\pi^{(1)}=\mathsf R(\pi^{(0)}).

The objective stays the same. Its training endpoint-pair distribution changes.

Repeating the construction gives

π(k+1)=R(π(k)).\pi^{(k+1)}=\mathsf R(\pi^{(k)}).

The repeated procedure is reflow.

The rectification loop: learn velocity, solve the ODE, collect endpoint pairs, and retrain.

Figure: ideal reflow yields asymptotically vanishing straightness, without guaranteeing a decrease at every round.

What does an ODE do with crossed Gaussian groups?

Consider upper and lower Gaussian clusters at both endpoints:

p0=12N((−2,1),σ2I)+12N((−2,−1),σ2I),p1=12N((2,1),σ2I)+12N((2,−1),σ2I).\begin{aligned} p_0&=\tfrac12\mathcal N((-2,1),\sigma^2I) +\tfrac12\mathcal N((-2,-1),\sigma^2I),\\ p_1&=\tfrac12\mathcal N((2,1),\sigma^2I) +\tfrac12\mathcal N((2,-1),\sigma^2I). \end{aligned}

Deliberately pair upper-left with lower-right and vice versa. Draw S∈{−1,+1}S\in\{-1,+1\} uniformly and define

X0=(−2,S)+σε0,X1=(2,−S)+σε1,ε0,ε1∼iidN(0,I).\begin{aligned} X_0&=(-2,S)+\sigma\varepsilon_0,\\ X_1&=(2,-S)+\sigma\varepsilon_1, \qquad \varepsilon_0,\varepsilon_1\overset{\mathrm{iid}}{\sim}\mathcal N(0,I). \end{aligned}

The reference streams cross. The marginal field averages their velocities using the probability that the present location belongs to either stream.

SupplementWhy is the initial field analytic?

Conditional on the group sign, the linear interpolation has the following mean, variance, and velocity:

mt,s=(−2+4t,(1−2t)s),qt=(1−t)2+t2,ρt,s(x)=N(x;mt,s,σ2qtI),ut,s(x)=(4,−2s)+2t−1qt(x−mt,s).\begin{aligned} m_{t,s}&=(-2+4t,(1-2t)s),\\ q_t&=(1-t)^2+t^2,\\ \rho_{t,s}(x)&=\mathcal N(x;m_{t,s},\sigma^2q_tI),\\ u_{t,s}(x)&=(4,-2s)+\frac{2t-1}{q_t}(x-m_{t,s}). \end{aligned}

The marginal velocity is therefore

vt(x)=∑s∈{−1,+1}12ρt,s(x)ut,s(x)∑s∈{−1,+1}12ρt,s(x).v_t(x)= \frac{\displaystyle\sum_{s\in\{-1,+1\}}\tfrac12\rho_{t,s}(x)u_{t,s}(x)} {\displaystyle\sum_{s\in\{-1,+1\}}\tfrac12\rho_{t,s}(x)}.

Equal prior weights do not imply equal posterior weights at every position. Each contribution is weighted by its local conditional density.

This closed form describes the original coupling only. After rectification, the demo rebuilds references from generated endpoint pairs and estimates their new field.

Interactive demo. Compare green crossing references, yellow rectified ODE motion, and purple reflow motion. The initial field is analytic; the next field is estimated only from the newly paired endpoints. Move time to inspect each construction.

InstaFlow [2] applies reflow to fast text-to-image generation. SD3 [3] uses rectified-flow linear-path training without repeated reflow. The shared name does not imply identical procedures.

Does reflow accomplish the intended goal?

The construction is plausible, but we need to check its properties mathematically.

We ask:

  • Does it preserve the required endpoint distributions?
  • In what precise sense does it straighten trajectories?

Assume ideal fields, exactly solved unique ODEs, and finite endpoint second moments. Let π(k)\pi^{(k)} denote the old endpoint coupling.

Its linear reference process is

It(k)=(1−t)Z0(k)+tZ1(k).I_t^{(k)}=(1-t)Z_0^{(k)}+tZ_1^{(k)}.

Its displacement labels define the ideal field

vt(x)=E ⁣[Z1(k)−Z0(k)∣It(k)=x].v_t(x)=\mathbb E\!\left[ Z_1^{(k)}-Z_0^{(k)}\mid I_t^{(k)}=x \right].

The next ODE follows that newly averaged field:

dZt(k+1)dt=vt(Zt(k+1)),Z0(k+1)=Z0(k).\frac{\mathrm dZ_t^{(k+1)}}{\mathrm dt} =v_t(Z_t^{(k+1)}), \qquad Z_0^{(k+1)}=Z_0^{(k)}.

Old endpoints determine new reference lines; averaging those lines determines the new ODE. Each round recomputes the field, rather than repeatedly integrating a fixed field.

First, preserve marginals. The new ODE retains the source law:

Z0(k+1)=Z0(k)∼p0.Z_0^{(k+1)}=Z_0^{(k)}\sim p_0.

The conditional-average theorem gives identical marginals for the new ODE and old interpolation. At the endpoint,

Z1(k+1)∼p1.Z_1^{(k+1)}\sim p_1.

Thus the new endpoint joint remains a coupling of p0p_0 and p1p_1.

Individual assignments change, while starting and destination population counts remain unchanged.

Second, compare cost. Define expected squared endpoint displacement:

C(k):=Eπ(k) ⁣[∥Z1(k)−Z0(k)∥2].C^{(k)}:=\mathbb E_{\pi^{(k)}}\!\left[ \left\|Z_1^{(k)}-Z_0^{(k)}\right\|^2 \right].

This measures assigned destination distance, not the actual path length. How much does it decrease?

For the old references, define their disagreement with the conditional mean:

V(π(k))=∫01E ⁣[∥(Z1(k)−Z0(k))−vt(It(k))∥2]dt.V(\pi^{(k)}) =\int_0^1\mathbb E\!\left[ \left\| \left(Z_1^{(k)}-Z_0^{(k)}\right)-v_t(I_t^{(k)}) \right\|^2 \right]\mathrm dt.

This is integrated conditional variance of reference labels. Zero means almost-everywhere agreement at a shared position and time. It is not neural approximation error.

For the new ODE, average velocity over the unit interval equals displacement:

∫01vt(Zt(k+1)) dt=Z1(k+1)−Z0(k+1).\int_0^1 v_t(Z_t^{(k+1)})\,\mathrm dt =Z_1^{(k+1)}-Z_0^{(k+1)}.

Now measure temporal velocity variation along each trajectory, averaged over its initial point. The original paper calls this straightness:

S(Z(k+1))=∫01E ⁣[∥(Z1(k+1)−Z0(k+1))−dZt(k+1)dt∥2]dt.S(Z^{(k+1)}) =\int_0^1\mathbb E\!\left[ \left\| \left(Z_1^{(k+1)}-Z_0^{(k+1)}\right) -\frac{\mathrm d Z_t^{(k+1)}}{\mathrm dt} \right\|^2 \right]\mathrm dt.

Zero means almost every trajectory has constant velocity equal to its endpoint displacement. Different particles may have different constant velocities; the variance compares a particle with itself over time.

DetailsHow does straightness relate to integrated acceleration?

The acceleration integral from the error analysis is

∫01∥at(Zt(k+1))∥ dt\int_0^1\left\|a_t(Z_t^{(k+1)})\right\|\,\mathrm dt

These are different quantities: straightness compares velocity with its temporal mean, while integrated acceleration measures total velocity variation. They agree on the zero-variation case:

S(Z(k+1))=0⟹dZt(k+1)dt=Z1(k+1)−Z0(k+1)⟹at(Zt(k+1))=0.S(Z^{(k+1)})=0 \quad\Longrightarrow\quad \frac{\mathrm dZ_t^{(k+1)}}{\mathrm dt} =Z_1^{(k+1)}-Z_0^{(k+1)} \quad\Longrightarrow\quad a_t(Z_t^{(k+1)})=0.

Zero straightness therefore makes the acceleration integral vanish under the smoothness assumptions. Outside that case they need not improve together. Reflow directly controls the cost decomposition below, rather than automatically controlling the entire Euler bound.

Split each old label into its conditional mean and residual. The residual has zero conditional mean, so the squared cross term vanishes:

C(k)=V(π(k))+∫01E ⁣[∥vt(It(k))∥2]dt.C^{(k)} =V(\pi^{(k)}) +\int_0^1\mathbb E\!\left[\left\|v_t(I_t^{(k)})\right\|^2\right]\mathrm dt.

The old interpolation and new ODE have equal marginals, so their expected squared field values agree:

∫01E∥vt(It(k))∥2 dt=∫01E∥vt(Zt(k+1))∥2 dt.\begin{aligned} &\int_0^1\mathbb E\|v_t(I_t^{(k)})\|^2\,\mathrm dt\\ &\qquad=\int_0^1\mathbb E\|v_t(Z_t^{(k+1)})\|^2\,\mathrm dt. \end{aligned}

Expand the new straightness and use its integrated velocity identity:

S(Z(k+1))=∫01E∥vt(Zt(k+1))∥2 dt−2C(k+1)+C(k+1).\begin{aligned} S(Z^{(k+1)}) &=\int_0^1\mathbb E\|v_t(Z_t^{(k+1)})\|^2\,\mathrm dt\\ &\quad-2C^{(k+1)}+C^{(k+1)}. \end{aligned}

This is mean squared velocity minus squared mean velocity. Rearrange:

∫01E∥vt(Zt(k+1))∥2 dt=S(Z(k+1))+C(k+1).\int_0^1\mathbb E\|v_t(Z_t^{(k+1)})\|^2\,\mathrm dt =S(Z^{(k+1)})+C^{(k+1)}.

Substitute into the old cost decomposition to obtain [1, Theorem 3.7]

C(k)−C(k+1)=V(π(k))+S(Z(k+1)).\boxed{ C^{(k)}-C^{(k+1)} =V(\pi^{(k)})+S(Z^{(k+1)}). }

Both variances are nonnegative. Thus cost never increases, and decreases strictly whenever their sum is positive.

Cost is non-increasing each round. Its decrease V+SV+S, and each component separately, need not be monotone.

DetailsDoes a general convex displacement cost also decrease?

For a convex cost with finite expectations, apply Jensen first over time, use equality of marginals, then apply Jensen to the conditional label average:

E ⁣[c ⁣(Z1(k+1)−Z0(k+1))]=E ⁣[c ⁣(∫01vt(Zt(k+1)) dt)]≤∫01E ⁣[c ⁣(vt(Zt(k+1)))]dt=∫01E ⁣[c ⁣(vt(It(k)))]dt≤E ⁣[c ⁣(Z1(k)−Z0(k))].\begin{aligned} &\mathbb E\!\left[c\!\left(Z_1^{(k+1)}-Z_0^{(k+1)}\right)\right] \\ &=\mathbb E\!\left[c\!\left(\int_0^1v_t(Z_t^{(k+1)})\,\mathrm dt\right)\right] \\ &\le\int_0^1\mathbb E\!\left[c\!\left(v_t(Z_t^{(k+1)})\right)\right]\mathrm dt \\ &=\int_0^1\mathbb E\!\left[c\!\left(v_t(I_t^{(k)})\right)\right]\mathrm dt \\ &\le\mathbb E\!\left[c\!\left(Z_1^{(k)}-Z_0^{(k)}\right)\right]. \end{aligned}

The two averages give non-increasing convex cost. The exact variance identity is specific to quadratic cost.

Sum the quadratic identities over rounds. Costs telescope:

∑k=0K(S(Z(k+1))+V(π(k)))=C(0)−C(K+1)≤C(0).\begin{aligned} \sum_{k=0}^{K}\Big( S(Z^{(k+1)})+V(\pi^{(k)}) \Big) &=C^{(0)}-C^{(K+1)}\\ &\le C^{(0)}. \end{aligned}

Divide by the number of rounds:

1K+1∑k=0K(S(Z(k+1))+V(π(k)))≤C(0)K+1.\frac{1}{K+1} \sum_{k=0}^{K} \Big(S(Z^{(k+1)})+V(\pi^{(k)})\Big) \le \frac{C^{(0)}}{K+1}.

The smallest value is at most the average:

min⁡0≤k≤K(S(Z(k+1))+V(π(k)))≤C(0)K+1=O(1/K).\min_{0\le k\le K} \Big(S(Z^{(k+1)})+V(\pi^{(k)})\Big) \le \frac{C^{(0)}}{K+1} =O(1/K).

Thus at least one of the first rounds has a small combined reference disagreement and trajectory straightness.

The summation also gives an asymptotic statement. Define

Ak:=S(Z(k+1))+V(π(k))≥0.A_k:=S(Z^{(k+1)})+V(\pi^{(k)})\ge 0.

If ideal rectification can continue indefinitely and the initial cost is finite,

∑k=0∞Ak≤C(0)<∞.\sum_{k=0}^{\infty}A_k\le C^{(0)}<\infty.

A summable sequence of nonnegative terms must tend to zero:

Ak⟶0,A_k\longrightarrow 0,

Each nonnegative component therefore tends to zero as well.

The best-iterate O(1/K)O(1/K) bound and asymptotic vanishing are different statements. Neither establishes

S(Z(k+2))≤S(Z(k+1)).S(Z^{(k+2)})\le S(Z^{(k+1)}).

Cost is monotone; the individual decreases and variances need not be. Asymptotic vanishing does not imply round-by-round improvement.

Nor does decreasing cost mean finding its minimum over all legal couplings. That stronger problem is optimal transport (OT).

SupplementWhat is quadratic optimal transport?

Among all endpoint couplings, solve

πOT∈argmin⁡π∈Π(p0,p1)E(X0,X1)∼π∥X1−X0∥2.\pi_{\mathrm{OT}}\in \underset{\pi\in\Pi(p_0,p_1)}{\operatorname{argmin}} \mathbb E_{(X_0,X_1)\sim\pi}\|X_1-X_0\|^2.

Reflow compares each round with the previous one. OT compares with every admissible coupling.

Vanishing straightness and label variance alone therefore do not imply convergence to an OT coupling.

DetailsHow can a perfectly straight flow fail to be optimal transport?

Straightness asks whether each chosen endpoint pair can be joined at constant velocity. OT additionally asks whether different endpoint assignments could reduce transport cost.

For example, let

p0=p1=N(0,I2),p_0=p_1=\mathcal N(0,I_2),

and rotate each source by 90∘90^\circ. Its linear interpolation is

It=((1−t)I+tR)X0.I_t=((1-t)I+tR)X_0.

For that rotation,

det⁡((1−t)I+tR)=(1−t)2+t2>0,\det((1-t)I+tR)=(1-t)^2+t^2>0,

The interpolation matrix is invertible throughout the interval. Position and time uniquely identify the source, so no reference labels conflict. The coupling is already straight, with S=V=0S=V=0.

But the marginals agree, so the identity coupling has cost

E∥X1−X0∥2=0,\mathbb E\|X_1-X_0\|^2=0,

while rotating points has positive cost. A direct route need not use the cheapest destination assignment. Further counterexamples appear in [5,6].

DetailsWhat additional assumptions yield stronger results?

Stronger conclusions require additional conditions or modified rectification.

  • Bansal and colleagues [4] provide sufficient Jacobian conditions for complete straightening in a subsequent rectification, and stronger conditions for a quadratic Monge map.
  • Hertrich, Chambolle, and Delon [5] give non-optimal fixed points and vanishing-loss counterexamples, clarifying the importance of support and regularity assumptions.
  • Wang and colleagues [6] study Gaussian cases and a cost-aware modified procedure, obtaining OT convergence under additional conditions. These are stronger, more specialized claims than ordinary reflow’s cost identity.

These results do not establish universal round-by-round straightness decrease or unconditional OT convergence for ordinary reflow.

DiscussionQ1

If unique ODE trajectories cannot cross, why can a single rectification still leave curved trajectories in the next round?

Show the reasoning

The next round retains endpoints, then draws new chords:

It=(1−t)Z0(1)+tZ1(1).I_t=(1-t)Z_0^{(1)}+tZ_1^{(1)}.

Disjoint curved trajectories can have crossing endpoint chords. Their new average field can therefore turn again.

Generated endpoint pairing can reduce conflict in practice, but does not guarantee zero label variance after one round. This motivates repeating the procedure.

Interactive demo. Fix one, two, or three numerical steps and compare the original field with one rectification. Yellow is a fine ODE reference; purple is coarse Euler. Their endpoint separation measures numerical error for that field.

Check your understanding

Check your understanding

Why does ideal rectification preserve endpoint marginals?

Check your understanding

What does zero trajectory straightness mean?

Check your understanding

Why can next-round references still cross?

Check your understanding

Which ideal guarantee is valid?

References

  1. Liu, X., Gong, C., Liu, Q. Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow. ICLR 2023.
  2. Liu, X., et al. InstaFlow: One Step is Enough for High-Quality Diffusion-Based Text-to-Image Generation. ICLR 2024.
  3. Esser, P., et al. Scaling Rectified Flow Transformers for High-Resolution Image Synthesis. ICML 2024.
  4. Bansal, V., et al. On the Convergence and Straightness of Rectified Flow. ICLR 2025.
  5. Hertrich, J., Chambolle, A., Delon, J. On the Relation between Rectified Flows and Optimal Transport. NeurIPS 2025.
  6. Wang, L., et al. Computational and Statistical Guarantees of the cc-Rectified Flow. 2026.