Steering a flow toward what we want
Flow matching turns a simple cloud of points into something more interesting. But what if we want some outcomes more than others? Our paper studies how to steer that flow toward the outcomes we prefer, using an energy signal.
Lower energy means a more desirable outcome. Drag the slider to compare no guidance, a CEG baseline, and our ideal guidance field, all starting from the same points.
On the Guidance of Flow Matching
One starting cloud. Three ways to move it.
Preparing the flow…
Without energy guidance: sample the original distribution. With an energy goal: favor the low-energy regions below.
- Samples
- Velocity / vector field
- Recent sample paths
- Target clusters
Energy landscape · J(x)
Mean energy of the samples
- No guidance
- CEG baseline
- Our ideal guidance
The vertical line follows the slider. The dashed horizontal line is the reweighted target’s mean energy at the endpoint.
No guidance
t = 0.00No energy reweighting: all eight target clusters have equal mass.
CEG baseline
t = 0.00With energy: oracle CEG-form correction. Stops at t = 0.95, as in the released example.
Our guidance · ideal
t = 0.00With the same energy goal: general guidance favors the southwest and west clusters.
Dots are samples; arrows are local velocities, with lengths capped for readability. Faint lines show recent paths. Dashed rings mark the target clusters; their emphasis changes with the energy goal. The energy landscape is fixed, while the sample clouds, velocity fields and energy readouts follow flow time.
Which energy and baseline are shown?
The source is uniform on [−1, 1]². The original endpoint distribution p₁ has eight equally weighted Gaussian components on the unit circle, each with standard deviation 0.1. The energy J is the released code’s angular-sector cost, with values 0–7. Energy guidance targets p₁(x) exp(−J(x)) / Z, instead of the original p₁(x).
All three panels use the same exact unguided marginal flow and the same 200 stratified starting points, seed 20261201. The ideal guided field is computed by endpoint integration on a 512 × 512 grid, with 800 RK4 steps for particle trajectories.
The baseline applies the released CEG-form correction ∇ log Zₜ(x), with constant multiplier 1 and each component clipped to [−1, 1]. Here Zₜ = E[exp(−J(X₁)) | Xₜ = x] is computed by quadrature, rather than estimated by a trained CEG network. Its gradient is the analytic derivative of that quadrature; the discontinuous J is not silently smoothed. As in the released notebook, the CEG trajectory stops at flow time 0.95; its panel clock freezes and its energy curve ends there.
These are numerical illustrations of the formulas, not replays or performance comparisons of trained neural networks. The mean-energy curves evaluate J at the current particle positions. They need not decrease monotonically, and they are not training losses or paper benchmark scores.
Energy definition · Original comparison notebook · CEG implementation
November 30, 2026 · Ruiqi Feng