Generative Models

Flow Matching & Rectified Flows

Learn flow matching as velocity-label regression: straight conditional paths use x_t=(1-t)x0+t x1 but supervise the full target u_t=x1-x0.

status: publishedimportance: importantdifficulty 4/5math: graduateread: 16mlive demo
Editorial generative-model illustration of particles transported by a learned velocity field from noise into a target distribution.

Concept Structure

Flow Matching & Rectified Flows

01Intuition

Start with the picture, metaphor, or geometric mechanism.

02Math

Make the objects explicit and connect them with notation.

03Code

Mirror the equations with runnable implementation details.

04Interactive Demo

Manipulate the mechanism and watch the idea respond.

2prerequisites
1next concepts
2related links

Learning map

Flow Matching & Rectified Flows
BeforeDiffusion, Score-Based Models & Flow MatchingNow4/4 sections readyTryManipulate one control and predict the visible change.NextEfficiency: Quantization, Distillation, LoRA & Sparse MoE

Object flow

4/4 sections readyAsk about thisResearch room
ConceptFlow Matching & Rectified FlowsGenerative Models
2 sources attachedLocal snapshot ready
concept:generative-models/flow-matching

Conceptual Bridge

What should feel connected as you move through this page.

Carry inDiffusion, Score-Based Models & Flow Matching

Bring the mental model from Diffusion, Score-Based Models & Flow Matching; this page will reuse it instead of restarting from zero.

Work hereFlow Matching & Rectified Flows

Learn flow matching as velocity-label regression: straight conditional paths use x_t=(1-t)x0+t x1 but supervise the full target u_t=x1-x0.

Carry outEfficiency: Quantization, Distillation, LoRA & Sparse MoE

The next edge should feel earned: use the demo prediction here before following Efficiency: Quantization, Distillation, LoRA & Sparse MoE.

Test the linkManipulate one control and predict the visible change.Then continue to Efficiency: Quantization, Distillation, LoRA & Sparse MoE
01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

Section prompt

Diffusion models teach a model to "undo noise" step by step. Flow matching teaches a model something more direct: which direction to move.

Imagine starting with a cloud of noise points and wanting to morph it into a cloud shaped like your data. If you knew a time-dependent "wind field" v(x,t)v(x,t) that pushes particles, you could integrate an ODE and watch noise turn into samples.

The first idea to get right is the supervised label. For one chosen noise/data pair, a straight conditional path uses the current point xt=(1t)x0+tx1x_t=(1-t)x_0+t x_1 but trains on the constant velocity ut=x1x0u_t=x_1-x_0. The arrow from xtx_t to x1x_1 is only the remaining displacement, not the training target.

02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

Section prompt

Generative flow and regression target

We model a trajectory xtx_t with a neural velocity field vθv_\theta, then train that field to match a target velocity utu_t:

dxtdt=vθ(xt,t),L=Et,x0,x1vθ(xt,t)ut2.\frac{dx_t}{dt}=v_\theta(x_t,t),\qquad \mathcal L=\mathbb E_{t,x_0,x_1}\,\big\|v_\theta(x_t,t)-u_t\big\|^2.

Rectified flow (straight paths)

Choose a straight interpolation between noise x0x_0 and data x1x_1. Differentiating the path gives the supervised velocity label:

xt=(1t)x0+tx1,ut=ddtxt=x1x0,x1xt=(1t)(x1x0).x_t=(1-t)x_0+t x_1,\qquad u_t=\frac{d}{dt}x_t=x_1-x_0,\qquad x_1-x_t=(1-t)(x_1-x_0).

The remaining displacement x1xtx_1-x_t is shorter than the training label except at t=0t=0.

So the useful identity is:

xt+(1t)ut=x1.x_t + (1-t)u_t = x_1.

For a single straight conditional pair, the velocity label stays fixed as tt changes; the remaining integration time shrinks.

03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

Section prompt
import numpy as np

rng = np.random.default_rng(0)
x0 = rng.standard_normal(5)

# A simple deterministic "data" mapping for the toy example
x1 = 2.0 * x0 + 1.0

for t in [0.0, 0.25, 0.5, 0.75, 1.0]:
    xt = (1 - t) * x0 + t * x1
    u = x1 - x0
    remaining = x1 - xt

    # For this toy mapping, the exact velocity field can be written as v(xt,t):
    # xt = (1+t)x0 + t  =>  x0 = (xt - t)/(1+t)  =>  u = x0 + 1 = (xt + 1)/(1+t)
    v = (xt + 1.0) / (1.0 + t)
    print(
        "t=", t,
        "max|u-v|=", float(np.max(np.abs(u - v))),
        "remaining/full=", round(float(np.linalg.norm(remaining) / np.linalg.norm(u)), 2),
    )
04

04

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

Section prompt

Use the demo to predict the hidden conditional velocity target for one paired example. The page keeps the pairings synthetic on purpose: it is teaching the regression label, not claiming to solve an optimal-transport assignment.

Live Concept Demo

Explore Flow Matching & Rectified Flows

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 4/5graduatecode-aligned
Demo Prediction Checkpoint

Manipulate one control and predict the visible change.

Commit to what Flow Matching & Rectified Flows should make visible before reading the result.

After The First Pass

Turn the concept into an inspected object.

Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.

Mechanism Storyboard

See the idea move before the page explains it

Learn flow matching as velocity-label regression: straight conditional paths use x_t=(1-t)x0+t x1 but supervise the full target u_t=x1-x0.

Prediction open01 / Intuition
Editorial generative-model illustration of particles transported by a learned velocity field from noise into a target distribution.
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Flow Matching & Rectified Flows should make visible.

Visual Inquiry

Make the image answer a mathematical question

Learn flow matching as velocity-label regression: straight conditional paths use x_t=(1-t)x0+t x1 but supervise the full target u_t=x1-x0.

4/4 stages readyLive demo connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Flow Matching & Rectified Flows easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

paper · 2022Flow Matching for Generative ModelingLipman et al.

Grounds flow matching as direct regression of a vector field for continuous normalizing flows.

Open source
paper · 2022Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified FlowLiu, Gong, and Liu

Grounds the straight-path rectified-flow intuition used by the velocity-label demo.

Open source

Claim Review

Learn flow matching as velocity-label regression: straight conditional paths use x_t=(1-t)x0+t x1 but supervise the full target u_t=x1-x0.

Status1 substantive review recorded

Claims without a substantive review badge still need exact source-support review.

Sources2 references

lipman-2022-flow-matching, liu-2022-rectified-flow

Witnesses4 local objects

Use equation, code, and demo objects to check whether the source support is operational.

Substantively reviewedFlow matching uses regression of a neural ODE velocity field against a target vector field; in the rectified-flow straight interpolation x_t=(1-t)x_0+t x_1, the per-example least-squares label is x_1-x_0, not the remaining displacement x_1-x_t.Claim metadata: source checked

Lipman et al. ground Flow Matching as CNF/neural-ODE vector-field regression, including squared-error FM/CFM objectives against target or conditional vector fields. Liu et al. define rectified flow with X_t=tX_1+(1-t)X_0 and least-squares target X_1-X_0. Local equations/code/demo show the label-vs-remaining-displacement distinction.

Sources: Flow Matching for Generative Modeling, Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified FlowReviews only conditional straight-path velocity labels. After training, v_theta(x,t) aggregates over examples, not pair identity. Toy witnesses do not review OT optimality, diffusion equivalence, solver error, one-step generation, sampling quality, or production speedups.A bounded review summary is present; still check caveats and exact source scope.

Lipman supports CNF/ODE vector fields and FM/CFM squared-error regression to target or conditional vector fields. Liu supports rectified-flow straight interpolation X_t=tX_1+(1-t)X_0 and least-squares target X_1-X_0. Local equations/code/demo contrast that constant label with remaining displacement X_1-X_t=(1-t)(X_1-X_0); no OT/performance claim is reviewed.

Reviewer: codex+oracle+codex-5.3; reviewed 2026-05-08

Practice Loop

Try the idea before it explains itself

Learn flow matching as velocity-label regression: straight conditional paths use x_t=(1-t)x0+t x1 but supervise the full target u_t=x1-x0.

Readiness0/3 checks ready
Predict

Before touching the demo, predict one visible change that should happen in Flow Matching & Rectified Flows.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Object research drawerClose
ConceptFlow Matching & Rectified FlowsGenerative Models

Research Room

Attach the question to an exact object

Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptGenerative Models

Flow Matching & Rectified Flows

Anchored question

What is the smallest example that makes Flow Matching & Rectified Flows click without losing the math?

Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays locally in this browser for concept:generative-models/flow-matching.

No local draft saved.
Evidence to inspect
  • Source ids to inspect: lipman-2022-flow-matching, liu-2022-rectified-flow
  • Definition, prerequisite, and contrast concept links
  • The equation or code witness that makes the concept operational
  • One demo state that shows the invariant instead of a slogan
What would resolve this
  • The learner can state the mechanism in their own words
  • The learner can name the prerequisite that would repair confusion
  • The learner can predict how the mechanism changes under one perturbation
Grounded AI handoff

I am working in Continuous Function's research reading room. Object: concept - Flow Matching & Rectified Flows Object key: concept:generative-models/flow-matching Context: Generative Models Anchor id: concept/concept-notebook/generative-models/flow-matching Open question: What is the smallest example that makes Flow Matching & Rectified Flows click without losing the math? Evidence to inspect: - Source ids to inspect: lipman-2022-flow-matching, liu-2022-rectified-flow - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.

Open source object
concept/concept-notebook/generative-models/flow-matching concept:generative-models/flow-matching