AI Research Library

Flow Matching and Continuous Generative Transport

Rajesh Ranjan Mahapatra

Flow matching learns the velocity of a chosen probability path; faster generation follows only when that path, its coupling and its numerical integration are easier than the denoising alternative.

© 2026 Rajesh Ranjan Mahapatra. 30 min read

Flow Matching and Continuous Generative Transport

Flow matching learns the velocity of a chosen probability path; faster generation follows only when that path, its coupling and its numerical integration are easier than the denoising alternative.

TLDR

  • Flow matching is a path-design method: it trains a continuous normalising flow to imitate the instantaneous velocity of a prescribed journey from a simple source distribution to data.
  • The trainable target becomes practical by sampling conditional paths, then using squared-error regression to recover their density-weighted marginal velocity.
  • Low-step generation depends on coupling ambiguity, curvature, stiffness, time discretisation and solver order, not on calling the network output a velocity.
  • Diffusion and flow matching overlap: diffusion probability paths can be trained by flow matching, while score models can generate through a deterministic probability-flow ODE.
  • Choose flow matching only after a matched transport stress test shows that its quality-cost curve beats denoising under the same model, data, decoder and evaluation budget.

Place two identical clouds of particles on the left of a page and the same shaped target cloud on the right. In the first animation, every particle travels almost directly to its destination. In the second, the whole cloud rotates, stretches and loops before arriving at exactly the same endpoint distribution. A viewer who sees only the first and final frames cannot tell the journeys apart. A numerical solver can. One journey may need a single large step; the other may accumulate serious error unless it is resolved with many smaller evaluations.

This is the central puzzle behind flow matching. A generative model must transform easy-to-sample noise into complicated data. Knowing the two endpoint distributions is insufficient. We must also choose, learn or induce a continuous path between them. The hidden curriculum of a continuous generative model is the probability path it is asked to follow. That path determines which local velocities become training targets, whether different examples demand contradictory arrows at the same location, and how difficult the learned ordinary differential equation is to integrate.

Flow matching supplies an elegant training answer. Prescribe a family of intermediate distributions, obtain tractable conditional velocities, and train a neural field by regression. The resulting ordinary differential equation transports samples through continuous time. Lipman and colleagues framed this as a simulation-free way to train continuous normalising flows and showed that diffusion paths are included within the same construction.[5] The important word is prescribe. Flow matching does not remove the path choice. It makes that choice explicit and trainable.

The practical claim of this paper is narrower than “flows are faster than diffusion”. A flow can be cheap when its coupling and probability path produce a learnable, regular vector field that a low-order solver can integrate within the available error budget. A diffusion or score model can also be sampled through a deterministic ODE. Conversely, a badly chosen flow path can be curved, stiff or conditionally ambiguous and therefore expensive. The architecture decision should be based on a matched quality-versus-function-evaluation curve, not on the family name.

Part one

The path is the hidden curriculum

Begin with a source distribution p0, such as a standard Gaussian, and a target data distribution p1. A continuous generative model introduces distributions pt for times t between zero and one. The individual sample state xt evolves under a time-dependent velocity field vt. Neural ordinary differential equations made this continuous-depth construction a practical modelling primitive, while continuous normalising flows connected the dynamics to density transformation and likelihood.[1][2]

d xt / d t = vt(xt) Here xt is one moving sample, t is continuous time, and vt(x) gives the local direction and speed. Integrating from 0 to 1 turns a noise draw into a generated sample.
Probability mass moving through a learned vector field Three snapshots show a circular source cloud changing into a two-lobed target cloud. Streamlines and arrowheads indicate continuous transport through time. t = 0simple source t = 0.5intermediate density t = 1target density
Figure 1. Probability mass moving through a vector field. An authored conceptual figure. A sample follows the field locally, while the whole population changes density globally. The endpoints do not determine the intervening geometry.

The population must move consistently with the sample dynamics. The continuity equation supplies that conservation law. It says that density inside a small region changes because probability mass flows across its boundary. Mass is neither created nor destroyed by the deterministic ODE.

∂pt(x) / ∂t + ∇ · [pt(x) vt(x)] = 0 pt(x) is density, ∇· is divergence, and ptvt is probability flux. Positive outward flux lowers local density; net inward flux raises it.
The continuity equation as a probability balance A control volume receives three inward probability flux arrows and sends one larger outward arrow, illustrating falling local density. inward fluxlarger outward fluxdensity falls insidenet divergence is positive
Figure 2. Density is an accounting consequence of local motion. An authored conceptual control volume. The figure is illustrative, not a measured fluid simulation.

Thought experiment: identical endpoints, different journeys

Fix one source draw z and one target y. Path A moves linearly: xt = (1 − t)z + t y. Its target velocity is the constant vector y − z. Path B reaches the same y, but rotates the intermediate state by an angle that rises and then returns to zero. The endpoints, training pairs and final distribution remain unchanged. Only the path changes.

A one-step Euler solver is exact for Path A when the learned field is constant along the trajectory. The same solver can miss Path B badly because it extrapolates the initial tangent across an entire curved journey. A higher-order solver or more time steps can repair the approximation. The endpoint modelling problem and the numerical transport problem are separable. A generator can represent the correct destination yet still be expensive or inaccurate to sample.

This thought experiment also limits a common claim. Predicting velocity is not itself a speed guarantee. Velocity is simply the derivative of the chosen path. If that derivative changes sharply with time or state, the solver must resolve the change. The executable experiment later in the article varies only this causal feature.

Part two

Conditional arrows become a marginal flow

If the exact marginal velocity ut(x) were known at every intermediate state, flow matching could train a neural field vθ by ordinary squared-error regression. The direct objective is conceptually simple:

LFM(θ) = Et, x∼pₜ ||vθ(t, x) − ut(x)||² θ denotes network parameters. Lower loss means the model's arrow is closer to the prescribed marginal arrow at sampled times and states.

The obstacle is that sampling from the marginal pt and evaluating its velocity can be as difficult as the original generative problem. Conditional flow matching avoids this circularity. Draw a data example y, a source example z, and a time t. Construct a conditional intermediate state with a known formula, then regress against its known derivative. For the linear interpolation

xt = (1 − t)z + ty and ut(x | z, y) = y − z. Each sampled pair supplies a complete supervised example: a location, a time and the arrow that this conditional journey wants there.

The original flow-matching derivation shows that, under its regularity conditions, the conditional objective has the same parameter gradients as the intractable marginal objective.[5] The optimum of squared-error regression has an intuitive form:

v*(t, x) = E[ut(x | z, y) | xt = x]. At a shared state, the learned marginal field averages the conditional arrows, weighted by how likely each hidden pairing is to have produced that state.

Conditional flow matching converts an inaccessible population velocity into accessible per-example arrows. The conversion is powerful, but the conditional expectation exposes the main design debt. If many incompatible journeys meet at the same x and t, regression returns their average. That average can point somewhere no individual pair requested.

Conditional target velocities averaging into one marginal arrow Several coloured arrows start from nearby states and point in different directions. Their weighted mean is shown as a thicker indigo arrow. conditional arrowsdifferent hidden pairsdensity-weighted meanthe regression targetsame observed state x at the same time t
Figure 3. The network sees one state, while the training construction knows many journeys. An authored conceptual figure. The thick arrow is a conditional mean, not a vote for the most common endpoint.

Worked example: an affine Gaussian transport

Let z be standard normal in one dimension and define a paired target y = 3 + 1.5z. The source is N(0, 1); the target is N(3, 1.5²). Choose the linear path. Substitution gives

xt = 3t + (1 + 0.5t)z, ut = 3 + 0.5z. Since z = (x − 3t)/(1 + 0.5t), the target can also be written as a field: v(t, x) = 3 + 0.5(x − 3t)/(1 + 0.5t).

Every source value has a deterministic paired target. There is no hidden disagreement about which way to move. At t = 0 the field is affine in x, and the exact solution reaches the target Gaussian at t = 1. This case is deliberately easy. It demonstrates that the training target can be derived without simulating the ODE and that a structured coupling can make the field identifiable.

Affine Gaussian probability path Four bell curves shift right and widen as time progresses from zero to one. t = 0t = .33t = .67t = 1 −30369state x
Figure 4. One-dimensional affine transport. An authored analytic illustration. The means and standard deviations follow the worked equations; curve heights are normalised for visual comparison rather than plotted on one common density scale.

Schedules are part of the target

The linear interpolation is only one member of a broader Gaussian conditional family. Write xt = α(t)y + σ(t)z, where α controls the data contribution and σ controls the source-noise contribution. Differentiation gives the supervised target ut = α′(t)y + σ′(t)z. Changing the schedule therefore changes the magnitude, direction and time concentration of the labels even when the endpoints remain fixed.

This has two operational consequences. First, time sampling and loss weighting allocate model capacity across the journey. Uniformly sampling t does not imply uniform difficulty: a short endpoint interval may contain the largest target norms or fastest field variation. Second, a parameterisation that is numerically well scaled for one α-σ schedule may be poorly scaled for another. Targets should be inspected by time, not only through one average loss.

A useful diagnostic bins held-out examples by t and records target norm, conditional target variance, model residual and endpoint sensitivity after a perturbation at that time. A schedule is successful when it distributes learnable transport work, not merely when its endpoint equations are elegant. This diagnostic also provides an early warning for stiff or under-trained regions before an expensive image-quality sweep.

Thought experiment: crossing pairs and lost identity

Now use two-dimensional pairs. Send (−1, −1) to (1, 1), and send (−1, 1) to (1, −1), both along straight conditional lines. At t = 0.5, both paths pass through (0, 0). The first asks for velocity (2, 2); the second asks for (2, −2). A deterministic field cannot assign two velocities to the same state and time. Squared-error regression returns their average, (2, 0).

This is not merely noisy supervision. It is a structural collision. A well-posed ODE has one future from one state and time, so trajectories cannot cross there and then depart with different velocities. Rectified flow interprets the learned ODE as a rewiring of the original coupling: the endpoint marginals can be preserved even when individual source-target identities change.[6]

Crossing conditional paths and deterministic rewiring The left panel shows two crossing straight pairings with conflicting arrows at the centre. The right panel shows non-crossing curved ODE trajectories that preserve endpoints as a set but reassign pair identity. conditional pairinglearned ODE flow two demanded velocities at one state one velocity per state, pair identity may change
Figure 5. A deterministic flow resolves crossings by changing the coupling. An authored thought experiment. The final set of target points can be correct while the original example-to-example correspondence is not preserved.

This matters differently across tasks. In unconditional image generation, preserving which Gaussian noise point was originally paired with which image may have no semantic value. In unpaired translation, molecular transport, trajectories between observed cell states or any application claiming individual correspondence, rewiring is a substantive assumption. Distribution matching does not certify identity-preserving transport.

Coupling methods therefore belong to the model, even when they add no neural parameters. Conditional flow matching with minibatch optimal transport and multisample flow matching use non-trivial pairings to reduce target variance or crossings. Their reported experiments connect such couplings with simpler or straighter learned flows and better low-cost sampling.[7][8] Yet an optimal conditional line for sampled pairs does not automatically prove that the resulting marginal flow is the globally optimal transport map. The coupling approximation, minibatch size and problem geometry remain part of the evidence boundary.

Part three
The argument in one passChart · flow
flowchart LR
  A["The path is the hidden curriculum"] --> B["Conditional arrows become a<br/>marginal flow"]
  B --> C["Flow matching and denoising<br/>are neighbours"]
  C --> D["Geometry decides whether few<br/>steps work"]
  D -. "re-test" .-> A
  classDef first fill:#0a1424,stroke:#7B4CD8,stroke-width:2px,color:#e6f3ff
  classDef step fill:#0a1424,stroke:#3f7da0,stroke-width:1px,color:#e6f3ff
  class A first
  class B,C,D step
A structural route through Flow Matching and Continuous Generative Transport, from The path is the hidden curriculum to Choose the path before the fashion. Reading use: follow the relation, then test it against the surrounding evidence and limits.

Flow matching and denoising are neighbours

The most misleading comparison says that diffusion learns to denoise through many stochastic steps while flow matching learns one deterministic route. It mixes training target, probability path and sampler into one slogan. Each dimension can be varied separately.

Denoising diffusion probabilistic models define a forward corruption process that gradually turns data into noise, then learn a reverse generative process.[3] In continuous time, score-based models learn the score ∇x log pt(x), the direction in state space along which log density rises most rapidly. The score enables a reverse-time stochastic differential equation. The same marginal distributions also admit a deterministic probability-flow ODE.[4]

Flow matching starts from a prescribed probability path and trains the velocity field that transports its marginals. The original framework includes a family of Gaussian paths, including paths associated with diffusion constructions.[5] Stochastic interpolants make the shared structure even more explicit: one interpolating family can support deterministic transport equations and families of stochastic forward or backward dynamics.[10]

The scientifically useful contrast is not “flow versus diffusion”; it is which object is supervised, which path is induced, and which dynamics are integrated at inference. A diffusion model can be sampled deterministically. A flow-matching model can use a diffusion probability path. A network can predict noise, score, clean data or a velocity-like linear combination under different parameterisations. The output name alone does not identify the model family.

Score and velocity as different fields on the same evolving density A density contour is shown with score arrows normal to contours and a curved velocity trajectory tangent to motion across time. score fieldnormal to density contoursvelocity fieldtangent to temporal transport
Figure 6. Two lenses on evolving probability. An authored conceptual figure. Score arrows describe the spatial slope of log density at a fixed time; velocity arrows describe how samples move as time changes. Equations can relate them for a specified stochastic process, but they are not the same definition.
Design questionFlow-matching constructionScore or diffusion constructionWhat must be controlled in a comparison
Training targetConditional or marginal velocity of a chosen pathNoise, clean data, score, or a related parameterisationLoss weighting, target scale, time sampling and model capacity
Probability pathExplicitly selected interpolation or bridgeInduced by a forward noising SDE or discrete scheduleEndpoint signal-to-noise, path geometry and conditioning
Inference dynamicsUsually a deterministic ODEReverse SDE, probability-flow ODE, or a discrete samplerSolver order, NFE, time grid, stochasticity and error tolerance
PairingNoise-data coupling directly shapes conditional targetsTraining often corrupts each data point with sampled noiseMatched pairs, independent pairs and reflow data
LikelihoodRequires change-of-variables integration if neededDepends on objective and sampler; probability-flow ODE can support itSame likelihood estimator and numerical tolerance

One diffusion path, two learned objects

The relation can be made concrete. Consider a forward stochastic differential equation dx = f(x, t)dt + g(t)dw. Its score is st(x) = ∇x log pt(x). Under the score-SDE construction, the associated probability-flow ODE has velocity

vPF(t, x) = f(x, t) − ½ g(t)² st(x). The reverse stochastic drift uses the full score correction, while the deterministic probability-flow ODE uses half and has the same time-indexed marginal densities under the construction's assumptions.

A score network can therefore be converted into a velocity for this specific path. Flow matching can instead regress the corresponding velocity directly from conditional path samples. The two objectives expose different errors and may weight time differently, but their samplers can target the same marginal evolution. This is why a fair experiment should preserve the probability path before attributing a result to score learning or velocity learning.

The equation also shows why “score points towards data” is too crude. The actual transport velocity includes the forward drift f, the diffusion scale g, the score and the chosen time direction. A larger score norm does not by itself mean a faster sample trajectory. The learned object becomes an action only after the governing dynamics specify how it is used.

Where the analogy breaks

It is helpful to imagine denoising as reading density geometry and flow matching as reading transport geometry. The analogy fails if it suggests a unique route from either object. Many velocity fields can generate the same marginal density evolution, especially when divergence-free components are possible. A score identifies a log-density gradient but needs the specified diffusion dynamics to become a reverse drift. The bridge equations, schedules and boundary conditions matter.

Likewise, “simulation-free training” has a bounded meaning. Flow matching can compute regression targets without solving the generative ODE inside each training example. Sampling still integrates an ODE. Exact likelihood, when required, still involves divergence accumulation and numerical error, as in continuous normalising flows. The solver has moved out of the training target, not out of the system.

Published evidence Flow matching's seminal paper reports stable large-scale training and strong results for diffusion and optimal-transport-style paths.[5] Those experiments establish performance for the tested architectures, datasets and solvers. They do not establish that every linear path, coupling or flow model will dominate a diffusion baseline.
Part four

Geometry decides whether few steps work

A numerical ODE solver never sees the whole trajectory at once. Euler's method evaluates the field at the current point and takes a tangent step. Higher-order methods sample several intermediate slopes. Adaptive solvers shrink the step when their local error estimate rises. All of them pay in neural function evaluations, commonly abbreviated NFE.

For an exactly constant velocity, one Euler step reaches the endpoint. When direction or speed changes, the same step extrapolates stale information. Research on ODE-based generators has related trajectory curvature to numerical truncation error and sampling cost.[9] More recent analysis introduces piecewise straightness measures and bounds Wasserstein sampling error using path geometry under stated assumptions.[12]

Curvature is not the only difficulty. A field can be nearly straight yet stiff, meaning small state changes cause large velocity changes in a narrow time region. It can have sharp endpoint behaviour. Classifier-free guidance or another conditioning intervention can alter the sampling field after training. Approximation error in the neural field can dominate solver error. “Straight” is a useful diagnostic, not a complete certificate of cheap generation.

Four mechanisms that shape low-NFE performance

First, coupling controls conditional ambiguity. Independent noise-data pairing is easy to sample but may produce crossing conditional lines and high variance in target velocities. Minibatch optimal transport, multisample coupling, or matched pairs generated by a teacher can reduce disagreement. The gain must be weighed against coupling cost, bias and any semantic meaning assigned to the pairing.

Second, the probability path controls local geometry. Linear conditional interpolants make each pair's target velocity constant, but the marginal field can still curve because many conditional paths are averaged. Diffusion paths change signal and noise scales according to a schedule. Curved paths can sometimes avoid low-density or semantically awkward regions. The shortest Euclidean line in latent coordinates need not be the easiest learned route.

Third, the trained field controls approximation regularity. Finite data, finite capacity and optimisation error mean the learned field differs from the prescribed target. Even a theoretically easy path can become irregular. Time weighting determines which regions receive model capacity. A low average regression loss can hide a narrow interval that dominates endpoint error.

Fourth, the sampler controls numerical error. One-step Euler, four-step Runge-Kutta and an adaptive solver are different algorithms, not interchangeable reporting details. A comparison by “steps” is unfair when each step uses a different number of model calls. Compare total NFE, wall-clock latency, memory traffic and output quality under identical guidance and precision.

Negative control: straightness may be the wrong explanation

A serious causal claim needs a result that could make the preferred explanation unnecessary. Rectified Diffusion argues that the benefit commonly attributed to rectified-flow straightness can arise from training on matched noise-sample pairs and learning a path that is well approximated to first order, even when that path is inherently curved. Its authors report that the flow-matching form and a particular velocity parameterisation are not essential to their rectification procedure.[11]

This does not invalidate path geometry. It changes the hypothesis. Instead of asking only whether trajectories look straight, test whether the field's one-step or few-step approximation error falls after pairing, while holding the path family and solver fixed. Then change the path while holding pairing fixed. If matched pairing improves low-NFE quality without straightening the path, coupling was the active mechanism. If a straighter path improves only Euler but not a higher-order solver at matched NFE, the gain was solver-specific.

Failure boundary Flow matching ceases to be a sufficient story when the state space is discrete, the decoder is lossy, semantic correspondence matters but the coupling can rewire it, the field becomes stiff near an endpoint, or quality is dominated by guidance, conditioning or model error. The ODE can still be useful, but path regression alone does not resolve these problems.

Run the flow experiment

The companion artefact uses synthetic two-dimensional Gaussian samples. It fixes the source distribution, the exact endpoint map and the target distribution. The only experimental treatment is the path. The control path is a constant translation. The detour rotates the moving cloud by an angle that rises and returns to zero, so every sample reaches the same exact endpoint. Euler and fourth-order Runge-Kutta integration then estimate that endpoint at several NFE budgets.

The script is intentionally model-free. There is no neural approximation to blame. That makes it a strong negative case for the slogan that velocity prediction creates fast sampling. Even an exact velocity field can be expensive for a coarse solver when its trajectory bends.

0.000one-step Euler RMSE, straight path
4.902one-step Euler RMSE, rotating detour
0.010four-step RK4 RMSE, same detour
Endpoint error falls differently with path and solver A log-scale line chart shows zero error for a straight path under Euler, high declining error for a detour under Euler, and much faster decline for the same detour under RK4. 1010.10.010.0010.000112481632neural function evaluationsendpoint RMSE, log scale Euler, detourRK4, detourEuler, straight
Figure 7. Same endpoints, different numerical burden. Measured synthetic results from the supplied Python artefact, seed 7, 512 samples. Straight-path error is below 10−12 and is drawn on the lower plotting boundary. RK4 uses four field evaluations per step, so points are placed by total NFE.

The mean detour path length in the experiment is 2.038 times the direct translation length. Euler's detour RMSE falls from 4.902 at one NFE to 0.267 at 32 NFE. RK4 reaches 0.010 at 16 NFE and approximately 0.0007 at 32 NFE. These are synthetic measurements, not image-generation quality claims. They isolate the causal relation between path geometry, solver order and endpoint error.

Executable Python artefact and expected output

Assumptions. Python 3.10 or later; standard library only; synthetic Gaussian data. Save the code as flow_transport_lab.py and run python flow_transport_lab.py. The positive case, negative case, solver control and zero-amplitude path control are asserted in code.

"""Flow-path stress test for 'Flow Matching and Continuous Generative Transport'.

Python 3.10+. Standard library only.
All data, paths and thresholds are synthetic teaching fixtures.

The experiment keeps the source distribution, target distribution and exact endpoint
map fixed. It changes only the path between them, then measures numerical integration
error. This isolates path geometry from endpoint quality and model capacity.
"""
from __future__ import annotations

from dataclasses import dataclass
import math
import random
from typing import Callable, Iterable

Vec = tuple[float, float]
Velocity = Callable[[float, Vec], Vec]
Integrator = Callable[[Vec, Velocity, int], Vec]

SHIFT: Vec = (2.0, -1.0)
SEED = 7
SAMPLES = 512


def add(a: Vec, b: Vec) -> Vec:
    return (a[0] + b[0], a[1] + b[1])


def scale(s: float, a: Vec) -> Vec:
    return (s * a[0], s * a[1])


def rotate(theta: float, x: Vec) -> Vec:
    c, s = math.cos(theta), math.sin(theta)
    return (c * x[0] - s * x[1], s * x[0] + c * x[1])


def quarter_turn(x: Vec) -> Vec:
    return (-x[1], x[0])


def norm(x: Vec) -> float:
    return math.hypot(x[0], x[1])


def straight_velocity(_: float, __: Vec) -> Vec:
    return SHIFT


def detour_velocity(amplitude: float) -> Velocity:
    """Return the exact velocity of a rotating detour with unchanged endpoints."""

    def velocity(t: float, x: Vec) -> Vec:
        angle = amplitude * math.sin(math.pi * t)
        angular_speed = amplitude * math.pi * math.cos(math.pi * t)
        rotational = scale(angular_speed, quarter_turn(x))
        translational = rotate(angle, SHIFT)
        return add(rotational, translational)

    return velocity


def exact_state(t: float, z: Vec, amplitude: float) -> Vec:
    """Analytic path: rotate(z + t*SHIFT), returning to zero rotation at t=1."""
    angle = amplitude * math.sin(math.pi * t)
    return rotate(angle, add(z, scale(t, SHIFT)))


def euler(z: Vec, velocity: Velocity, steps: int) -> Vec:
    x = z
    h = 1.0 / steps
    for k in range(steps):
        t = k * h
        x = add(x, scale(h, velocity(t, x)))
    return x


def rk4(z: Vec, velocity: Velocity, steps: int) -> Vec:
    x = z
    h = 1.0 / steps
    for k in range(steps):
        t = k * h
        k1 = velocity(t, x)
        k2 = velocity(t + h / 2, add(x, scale(h / 2, k1)))
        k3 = velocity(t + h / 2, add(x, scale(h / 2, k2)))
        k4 = velocity(t + h, add(x, scale(h, k3)))
        weighted = add(add(k1, scale(2, k2)), add(scale(2, k3), k4))
        x = add(x, scale(h / 6, weighted))
    return x


def endpoint_rmse(samples: Iterable[Vec], velocity: Velocity,
                  integrator: Integrator, steps: int) -> float:
    squared_errors: list[float] = []
    for z in samples:
        estimate = integrator(z, velocity, steps)
        target = add(z, SHIFT)
        squared_errors.append(
            (estimate[0] - target[0]) ** 2 + (estimate[1] - target[1]) ** 2
        )
    return math.sqrt(sum(squared_errors) / len(squared_errors))


def path_length_ratio(z: Vec, amplitude: float, slices: int = 2000) -> float:
    """Midpoint estimate of path length divided by direct endpoint distance."""
    velocity = detour_velocity(amplitude)
    h = 1.0 / slices
    length = 0.0
    for k in range(slices):
        t = (k + 0.5) * h
        x = exact_state(t, z, amplitude)
        length += h * norm(velocity(t, x))
    return length / norm(SHIFT)


@dataclass(frozen=True)
class Result:
    solver: str
    path: str
    steps: int
    nfe: int
    rmse: float


def run() -> None:
    rng = random.Random(SEED)
    samples = [(rng.gauss(0, 1), rng.gauss(0, 1)) for _ in range(SAMPLES)]
    amplitude = 1.1
    detour = detour_velocity(amplitude)

    results: list[Result] = []
    for solver_name, integrator, calls_per_step in (
        ("Euler", euler, 1),
        ("RK4", rk4, 4),
    ):
        for path_name, velocity in (
            ("straight", straight_velocity),
            ("detour", detour),
        ):
            for steps in (1, 2, 4, 8, 16, 32):
                results.append(
                    Result(
                        solver=solver_name,
                        path=path_name,
                        steps=steps,
                        nfe=calls_per_step * steps,
                        rmse=endpoint_rmse(samples, velocity, integrator, steps),
                    )
                )

    ratios = [path_length_ratio(z, amplitude) for z in samples]
    print("Same source, same endpoint map, different path geometry")
    print(f"Mean detour path-length ratio: {sum(ratios) / len(ratios):.3f}x")
    print()
    print(f"{'solver':<8} {'path':<9} {'steps':>5} {'NFE':>5} {'endpoint RMSE':>15}")
    for row in results:
        print(
            f"{row.solver:<8} {row.path:<9} {row.steps:>5} "
            f"{row.nfe:>5} {row.rmse:>15.6f}"
        )

    # Positive case: a straight constant field is exactly solved by one Euler step.
    assert endpoint_rmse(samples, straight_velocity, euler, 1) < 1e-12

    # Negative case: calling the target a velocity does not make a curved path cheap.
    assert endpoint_rmse(samples, detour, euler, 1) > 1.0

    # Solver control: a higher-order solver resolves the same curved field accurately.
    assert endpoint_rmse(samples, detour, rk4, 4) < 0.02

    # Path control: zero detour amplitude collapses exactly to the straight path.
    assert endpoint_rmse(samples, detour_velocity(0.0), euler, 1) < 1e-12

    print("\nAll positive, negative and control assertions passed.")


if __name__ == "__main__":
    run()
Part five
How the claim changes under pressureChart · state
stateDiagram-v2
  [*] --> Claim
  state "Thought experiment: identical<br/>endpoints, different journeys" as Claim
  state "Worked example: an affine<br/>Gaussian transport" as Test
  state "Schedules are part of the target" as Revision
  Claim --> Test: expose mechanism
  Test --> Decision: evidence survives
  Test --> Revision: rival survives
  Revision --> Claim: narrow or rebuild
  Decision --> [*]
The revision loop begins with Thought experiment, identical endpoints,… and keeps counterexamples inside the reasoning path. Reading use: follow the relation, then test it against the surrounding evidence and limits.

Build and evaluate a transport model

Worked example: a conditioned latent flow

Consider a production-shaped but synthetic text-conditioned image system. A fixed image encoder maps training images to continuous latent vectors y. A text encoder produces condition c. Draw Gaussian noise z, sample time t, and construct xt = (1 − t)z + t y. A time-conditioned U-Net or transformer receives (xt, t, c) and predicts y − z. At inference, draw fresh z, integrate the learned ODE, and decode its endpoint.

This description is short because the mechanism is short. The evidence burden is not. The encoder defines the geometry in which a straight line is being privileged. The text condition changes which data modes are relevant. Independent noise-data pairing can make conditional targets ambiguous. Guidance changes the field used at sampling. The decoder can turn a small latent endpoint error into a visible artefact or hide a large one. A latent flow is a compound system whose transport claims must be localised to the latent state actually modelled.

Production-shaped latent flow system and its evaluation boundaries Training constructs latent path states from image latents and noise, while inference integrates a learned velocity field and decodes the result. Evaluation taps are shown at field, latent endpoint and decoded output levels. traininggeneration image encoderlatent ynoise zpath samplerxₜ, t, target uₜvelocity modelvθ(xₜ,t,c)regression lossfield error fresh noisez ~ p₀ODE solverNFE and tolerancelatent endpointŷ and readoutdecoderoutput fixed encoder, model capacity, condition and data mixture must be controlledevaluation taps: target-field errorendpoint errordecoded quality, diversity and harm
Figure 8. A flow model is only one layer of the generator. An authored production-shaped scenario, not a deployment claim. Each evaluation tap answers a different causal question and prevents decoder quality from being mistaken for transport accuracy.

A matched experiment, not a model-family tournament

Use one dataset split, one latent encoder and decoder, one conditioning stack, and architectures with comparable capacity. Train a flow-matching model and a denoising baseline under declared compute budgets. Preserve a high-accuracy reference sampler for each model. Then sweep NFE and solver choices. At every point, record at least three kinds of evidence:

Transport evidence measures conditional target variance, field regression error by time, trajectory curvature or local truncation proxies, and endpoint deviation from a high-accuracy integration. Generative evidence measures fidelity, diversity, conditional compliance and memorisation with uncertainty. Operating evidence measures wall-clock latency, peak memory, batch sensitivity, numerical precision and failure rate on the intended hardware.

A low-NFE model should not be compared with a high-quality baseline using different guidance strength or a stronger decoder. Nor should one system be allowed adaptive high-order integration while the other is counted in nominal steps. Report model evaluations, not just solver steps. If distillation, reflow or teacher-generated matched pairs are used, include their training cost and lineage. A fast student may be operationally attractive even when its total creation cost is high; those are separate decisions.

Failure injection before release

A benchmark generated under nominal settings can conceal the exact regions that will fail in service. Deliberately perturb the sampler. Remove one intermediate time band from training, coarsen the time grid near each endpoint, raise guidance beyond its validated range, reduce numerical precision, and inject a transient non-finite field value. Record whether the system detects the deviation, falls back to a safer sampler, or quietly emits a plausible but altered result.

Separate four outcomes. A model failure persists even under high-accuracy integration. A solver failure shrinks when tolerance or order improves. A conditioning failure appears only for particular prompts, classes or guidance settings. A decoder failure emerges after a latent endpoint that otherwise satisfies the transport checks. Without this separation, an attractive output can hide a wrong latent trajectory, while an unattractive output can falsely condemn a correct flow.

Recovery should also be bounded. An adaptive retry is useful only when the trigger is observable and the maximum extra NFE is declared. Repeating an unstable integration without changing its conditions is not recovery. For consequential generation, retain a decision receipt containing model version, path and coupling version, sampler, time grid, precision, random seed, guidance, NFE and the postcondition checks applied to the result.

The transport stress test

The following instrument turns the argument into an architecture decision record. It is intentionally mechanism-first. A paper or system passes only when its proposed efficiency gain can be located in an observable change rather than inferred from the method label.

Transport stress test decision field A two-axis matrix places transport designs by conditional ambiguity and solver difficulty. The preferred lower-left region has clear pairwise targets and a regular field, while the upper-right calls for coupling, path or sampler redesign. solver redesignregular pairing, difficult fieldchange schedule, solver or time weightingtransport redesignambiguous pairing, difficult fieldchange coupling and path before scalinglow-NFE candidateclear targets, regular fieldverify quality and endpoint semanticscoupling redesignambiguous targets, easy local solverreduce crossings or accept rewiring conditional ambiguitylowhighsolver difficultylowhigh
Figure 9. Diagnose the active transport debt before choosing a remedy. An authored decision instrument. The axes must be populated with measured proxies such as conditional velocity variance, endpoint error by NFE, local field variation and solver rejection rates.
TestObservableDiscriminating controlDecision if it fails
Endpoint validityHigh-accuracy sampler reaches the intended distribution and conditionCompare with empirical data and a non-neural transport baseline where possibleFix model or path fit before optimising NFE
Coupling ambiguityConditional velocity variance at matched states and timesIndependent versus minibatch or teacher-matched pairsRedesign coupling or declare that identity rewiring is acceptable
Field regularityTime-local curvature, Jacobian norms, solver rejection or endpoint sensitivitySame coupling with alternative path schedulesChange path, weighting, regularisation or solver
Low-NFE retentionQuality and endpoint error across total function evaluationsEuler and higher-order solvers at matched NFEReject a universal one-step claim; choose the measured budget
System outcomeDecoded fidelity, diversity, compliance, memorisation, latency and memoryFixed encoder, decoder, guidance and precisionAttribute the bottleneck to the correct component
Recovery boundaryDetection of solver divergence, non-finite states or unacceptable outputsFailure injection near difficult times and conditionsAdd fallback sampler, abstention or bounded retry

The instrument changes the order of work. Do not begin by asking whether to adopt flow matching. First ask whether a continuous latent path is appropriate, whether individual correspondence matters, and where the present sampler loses quality. Then run the coupling and path controls. Only after those results should the team select an objective, parameterisation and solver.

Practitioner synthesis A useful release gate is a three-curve packet: decoded quality versus NFE, latent endpoint error versus NFE, and latency versus batch size. Keep the high-accuracy reference trajectory and the exact configuration that produced each point. This separates model error, numerical error and hardware economics.

Compact glossary

Probability path
A time-indexed family of distributions connecting a source to a target.
Velocity field
A function assigning the instantaneous direction and speed to every state and time.
Continuous normalising flow
An invertible distribution transformation defined by an ODE, with density change governed by divergence.
Coupling
A joint distribution over source and target samples whose marginals equal the two endpoint distributions.
Score
The spatial gradient of log density, ∇x log pt(x), at a fixed time.
NFE
Number of neural function evaluations used by a sampler. It is more comparable than nominal solver steps.
Rectification or reflow
Retraining on pairs produced by an existing flow to obtain a coupling that may support easier few-step transport.
Stiffness
A numerical condition in which stable or accurate integration requires very small steps in some regions.
The evidence conversationChart · sequence
sequenceDiagram
  participant Q as Question
  participant M as Mechanism
  participant E as Evidence
  participant D as Decision
  Q->>M: The path is the hidden curriculum
  M->>E: Thought experiment: identical endpoints, different journeys
  E-->>M: compare rival explanations
  E->>D: Choose the path before the fashion
  D-->>Q: revise scope or act
Question, mechanism, evidence and decision exchange the burdens developed in Flow Matching and Continuous Generative Transport. Reading use: follow the relation, then test it against the surrounding evidence and limits.

Choose the path before the fashion

Flow matching earns its place by making continuous generative transport trainable through ordinary regression. It supplies tractable conditional arrows and, under the framework's conditions, recovers the marginal velocity that carries one distribution into another. That is a precise and valuable mechanism.

Its strongest lesson is not that denoising has been replaced. Diffusion paths live inside the broader construction, and score models can generate through deterministic probability-flow ODEs. The decisive variables are lower level: the coupling between endpoints, the intermediate probability path, the regularity of the learned field, and the numerical method used to integrate it.

The architecture decision changed by this argument is simple: treat flow matching as a transport hypothesis, not a speed label. Require a matched experiment that varies coupling, path and solver separately. Preserve endpoint semantics where they matter. Compare by total function evaluations and operating latency. Keep a high-accuracy trajectory as a reference. Reject one-step claims that disappear under a different pairing or solver control.

The resulting question is more demanding but more useful. Do not ask, “Is flow matching faster?” Ask: Which path makes the required probability mass movement unambiguous to learn, cheap to integrate, and faithful to the outcome we actually care about? That question can fail in an experiment. Because it can fail, it can also accumulate defensible evidence.

References

  1. Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt and David Duvenaud. Neural Ordinary Differential Equations. NeurIPS, 2018.
  2. Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, Ilya Sutskever and David Duvenaud. FFJORD: Free-form Continuous Dynamics for Scalable Reversible Generative Models. ICLR, 2019.
  3. Jonathan Ho, Ajay Jain and Pieter Abbeel. Denoising Diffusion Probabilistic Models. NeurIPS, 2020.
  4. Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon and Ben Poole. Score-Based Generative Modeling through Stochastic Differential Equations. ICLR, 2021.
  5. Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel and Matt Le. Flow Matching for Generative Modeling. ICLR, 2023.
  6. Xingchao Liu, Chengyue Gong and Qiang Liu. Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow. ICLR, 2023.
  7. Alexander Tong, Kilian Fatras, Nikolay Malkin, Guillaume Huguet, Yanlei Zhang, Jarrid Rector-Brooks, Guy Wolf and Yoshua Bengio. Improving and Generalizing Flow-Based Generative Models with Minibatch Optimal Transport. Transactions on Machine Learning Research, 2024.
  8. Aram-Alexandre Pooladian, Heli Ben-Hamu, Carles Domingo-Enrich, Brandon Amos, Yaron Lipman and Ricky T. Q. Chen. Multisample Flow Matching: Straightening Flows with Minibatch Couplings. ICML, 2023.
  9. Sangyun Lee, Beomsu Kim and Jong Chul Ye. Minimizing Trajectory Curvature of ODE-based Generative Models. ICML, 2023.
  10. Michael S. Albergo, Nicholas M. Boffi and Eric Vanden-Eijnden. Stochastic Interpolants: A Unifying Framework for Flows and Diffusions. Journal of Machine Learning Research, 2025.
  11. Fu-Yun Wang, Ling Yang, Zhaoyang Huang, Mengdi Wang and Hongsheng Li. Rectified Diffusion: Straightness Is Not Your Need in Rectified Flow. ICLR, 2025.
  12. Vansh Bansal, Saptarshi Roy, Alessandro Rinaldo and Purnamrita Sarkar. On the Convergence and Straightness of Rectified Flow. arXiv, revised 2026.
  13. Xingchao Liu and collaborators. Official Rectified Flow implementation.
  14. Alexander Tong and collaborators. Official Conditional Flow Matching implementation.
Back to top