MeanFlowLab · Daily Build 2026-07-12

One step, not fifty:
the average-velocity field

Diffusion and flow-matching models paint noise into data by integrating a learned velocity field — dozens of ODE steps per image. MeanFlow (NeurIPS 2025) and its 2026 offspring learn the time-averaged velocity instead, and generate in a single step. This lab computes the exact marginal flow-matching field for a point cloud in your browser and shows, with real numerics, exactly why one instantaneous step fails and one average step doesn't.

Zero dependencies. All linear algebra runs client-side. Topic: flow matching · rectified flow · MeanFlow Niche check: optimizer/interp labs ≠ generative-transport geometry
01The probability pathpt = (1−t)·noise + t·data

Flow matching defines a straight-line bridge between a Gaussian source and each target point: x_t = (1−t)·x0 + t·x1. Drag t from 0 (pure noise) to 1 (data). Every particle is coupled to one target sample, so you watch the whole distribution transport. Pick a target shape — each is just a cloud of 2-D points the field is built from.

particle at time ttarget cloud x1source samples x0
At t→1 the bridge collapses onto data. The marginal velocity that generates this path (Panels 2–3) is the posterior-weighted average of every particle's straight direction — it has a closed form, no neural net required.
02Instantaneous vs. average velocity field

The exact marginal field is v(x,t) = Σᵢ wᵢ·(x1ⁱ − x)/(1−t) with softmax weights wᵢ ∝ exp(−‖x − t·x1ⁱ‖² / 2(1−t)²). That's the instantaneous velocity — where a particle heads right now. The average velocity u(x,0,t) = (x − x0)/t points from where the particle started straight to here. Toggle them and sweep t: the instantaneous field swirls and bends; the average field is nearly straight and aims at the modes. That straightness is what makes one-step sampling possible.

velocity arrowsdata
Arrow length ∝ speed (clipped). Notice how the instantaneous field blows up near t→1 (the 1/(1−t) term) — the exact stiffness that forces many small ODE steps.
03Sampler race — NFE that lands on the manifoldthe headline

Same random noise seeds, two samplers. Left: Euler integration of the instantaneous field with the number of function evaluations (NFE) you choose. Right: a single MeanFlow step using the exact average velocity x1 = x0 + u(x0,0,1). The bars show manifold coverage — the fraction of the data cloud that has a generated sample nearby. A single instantaneous step collapses toward the field's mean and covers almost nothing; a single average-velocity step covers it all. Drag NFE up and watch instantaneous catch up only after several steps.

Instantaneous Euler — NFE = 4
coverage: –
MeanFlow — NFE = 1
coverage: –
NFE for 95% coverage
measuring…
MeanFlow one-step error
–
speedup at parity
–
The MeanFlow field here is the ideal average velocity, obtained by integrating each seed's trajectory once and taking net displacement / Δt — the exact target a trained MeanFlow network regresses onto. A real network approximates it; the geometry it must learn is precisely this.
04Straightening — reflow & rectified trajectories

Curved trajectories are what punish one-step samplers. Reflow (Rectified Flow, and 2026's Re-MeanFlow) re-couples each noise point to the data point its own trajectory reached, then trains on those straight pairs. Curvature collapses toward 1. Hit reflow and watch the straightness histogram path-length / endpoint-distance pile up at 1.0 — and the one-step error drop.

reflow steps
0
mean straightness
–
curvature (str−1)
–
Straightness = 1.000 means the ODE path is the straight line from noise to data — one Euler step is then exact. This is why "2-rectified flow" and Re-MeanFlow report huge one-step-quality jumps.
05The MeanFlow Identity — verified numerically

MeanFlow's whole training objective rests on one exact relation between average velocity u and instantaneous velocity v. Differentiate (t−r)·u(zt,r,t) = ∫ᵣᵗ v(zτ,τ)dτ in t:

u(zt,r,t)  =  v(zt,t)  −  (t−r)·d/dt u(zt,r,t)     // total derivative along the flow: d/dt = ∂t + v·∇z

Pick a point and two times; the lab integrates the true field to get u, its total derivative by finite differences, and checks the identity. LHS and RHS should match to numerical precision — the network never has to run an ODE at inference, it just satisfies this equation at training time.

LHS  u(z,r,t)
–
RHS  v − (t−r)·u̇
–
‖LHS − RHS‖
–
identity holds?
–
This is the exact mechanism that lets a MeanFlow model skip the sampler: it regresses u under a loss whose fixed point is this identity, so a single forward pass at u(x0,0,1) replaces the whole reverse ODE.