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.

published · difficulty 4/5 · 16 min read

Reading map and next steps

Intuition

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

PredictName the object in plain language, then predict what should change.Leave with one reusable mental picture before notation appears.

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=(1−t)x0+tx1x_t=(1-t)x_0+t x_1 but trains on the constant velocity ut=x1−x0u_t=x_1-x_0. The arrow from xtx_t to x1x_1 is only the remaining displacement, not the training target.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

Math

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

InspectTrack the same object through the notation and check each symbol.Leave with the invariant the equations preserve.

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,x1 ∥vθ(xt,t)−ut∥2.\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=(1−t)x0+tx1,ut=ddtxt=x1−x0,x1−xt=(1−t)(x1−x0).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 x1−xtx_1-x_t is shorter than the training label except at t=0t=0.

So the useful identity is:

xt+(1−t)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.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

Code

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

TraceMatch variables to symbols before reading the implementation.Leave with a runnable witness for the math.
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),
    )
Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

Interactive Demo

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

ManipulateChange one control and predict the visible response before reveal.Leave with the observed invariant or a repaired model.

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 inquiry checkpoint

Manipulate one control and predict the visible change.

01Choose lensTrace a quantity
02ObserveDemo state pending
03GroundName the equation, invariant, or control that explains it.
04CarryNext: Efficiency: Quantization, Distillation, LoRA & Sparse MoE

Choose what to inspect in Flow Matching & Rectified Flows. This shared fallback is an observation guide, not evidence of learning.

Loading interactive demo...

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.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

4/4 sections ready

Concept: Flow Matching & Rectified Flows

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

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

Flow Matching & Rectified Flows

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

Mode questionCan I say the mechanism back in one sentence before I reveal anything?

Start with the prediction checkpoint, then compare the reveal to the mental model.

Take this move

Study modes

Keep the object fixed; change the lens.

Route back through the notebook

Carry the same object through intuition, math, code, and demo.

4/4 sections ready
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.

After The First Pass

Turn the concept into an inspected object.

The lower panels are one second act: keep the object fixed, inspect it visually, check source boundaries, practice transfer, then attach the research question.
ConceptFlow Matching & Rectified FlowsGenerative Models

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.

Demo notes 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 readyDemo notes 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.

Object - ConceptFlow Matching & Rectified FlowsQuestion

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

concept:generative-models/flow-matching
Boundary

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

Check

Open the closest source note before trusting the local explanation.

Evidence

2 selected-object sources shown first; 2 references total.

Next move

Audit the claim boundary, then ask from the same selected object.

selected object source · paper · 2022Flow Matching for Generative ModelingLipman et al.
Located CF editorial boundary

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

Used here as

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 rect...

Caveat

Reviews 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 equi...

Open source
selected object source · paper · 2022Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified FlowLiu, Gong, and Liu
Located CF editorial boundary

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

Used here as

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 rect...

Caveat

Reviews 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 equi...

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.

Object - ConceptFlow Matching & Rectified FlowsQuestion

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

concept:generative-models/flow-matching
Boundary

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

Check

Treat every claim as provisional until source support and a local witness agree.

Evidence

1 structured claim check on this concept.

Next move

Run the prediction or practice transfer before asking for a grounded review.

1 CF editorial source-scope review recorded

Publisher-side editorial review is not independent replication. Claims without it still need exact source-support review. 2 references and 3 local witnesses are available for inspection.

Flow 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.
Used here as

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=...

Local witness
Equation 1
dxtdt=vθ(xt,t),L=Et,x0,x1 ∥vθ(xt,t)−ut∥2.\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.
Equation 2
xt=(1−t)x0+tx1,ut=ddtxt=x1−x0,x1−xt=(1−t)(x1−x0).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).
Caveat

Reviews 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 erro...

Review stateCF editorial source-scope reviewClaim metadata: source checkedPublisher-side editorial review only; not independent replication. 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 · Flow Matching & Rectified Flows

Try the idea in your own words

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.

Concept · Current object

Flow Matching & Rectified Flows

Source boundary: sources: lipman-2022-flow-matching, liu-2022-rectified-flow

Object context and links

Generative Models

concept:generative-models/flow-matching
Choose a task

Explain the mechanism

For Flow Matching & Rectified Flows: What is the smallest example that makes Flow Matching & Rectified Flows click without losing the math? Explain your answer, including what changes, why, and which assumption matters.

No answer yet

A rough first thought is enough. Your draft stays when you change tasks.

Local to this page session. Not saved after leaving or reloading.

A little help · Explain

Open one hint at a time. These are suggestions, not your answer or a grade.

0 of 3 hints shown for this question.

    Clearing your answer does not erase help history. Outside help cannot be verified here.

    Where am I stuck? (optional)
    Your own description, not an automatic diagnosis

    Choose one, or leave this unspecified. Select it again to clear it.

    Take your draft to a feedback conversation

    No AI feedback runs here. You can copy a prompt to use elsewhere; nothing is sent automatically. Review the text before sharing, and leave out private information.

    Write an attempt before copying a feedback prompt.

    This draft and any AI response do not establish mastery. Try a different case later without help; this page has not measured that learning.

    Grounded object roomClose
    Selected object routeAsk from this object; carry one invariant back.sources: lipman-2022-flow-matching, liu-2022-rectified-flow
    1. ObjectConceptFlow Matching & Rectified Flows
    2. PredictBefore revealFlow Matching & Rectified Flows prediction
    3. WitnessCompare codeFlow Matching & Rectified Flows code witness 1
    4. RoomAsk groundedChecking local snapshot
    ConceptFlow Matching & Rectified FlowsGenerative Models
    Code witness comparisonFlow Matching & Rectified Flows code witness 1rng = np.random.default_rng(0)Prediction before revealFlow Matching & Rectified Flows predictionManipulate one control and predict the visible change.
    Grounded room questionWhat is the smallest example that makes Flow Matching & Rectified Flows click without losing the math?Checking local snapshot

    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?

    Source boundaryInspect source ids: lipman-2022-flow-matching, liu-2022-rectified-flowStable content-object key attached
    Role lenses for this object

    These are fixed, deterministic perspectives derived from the selected object. They do not represent people, community contributions, or independent review.

    Learner evidence requestAsk what would make "Flow Matching & Rectified Flows" feel predictable rather than familiar.
    Assumption

    Source ids lipman-2022-flow-matching, liu-2022-rectified-flow must support the exact object, not just the surrounding topic.

    Source-checking summary

    Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion.

    Proposed experiment

    Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo.

    Next action

    The learner can state the mechanism in their own words

    Evidence4 checks
    PredictionChecking carried observation
    ActionReady for one action
    AILearner handoff ready
    Open source object
    01PredictionChecking browser-local route memory
    02EvidenceChecking for a carried observation
    03BoundaryInspect source ids: lipman-2022-flow-matching, liu-2022-rectified-flow
    04Next moveSave one next action
    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
    Object-attached 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 Deterministic role lenses for this object: - Boundary: fixed perspectives, not people, community contributions, or independent review - Source-checking summary: Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Teach/transfer move: Turn the mechanism into one sentence that predicts a neighboring concept. - Assumptions: - Source ids lipman-2022-flow-matching, liu-2022-rectified-flow must support the exact object, not just the surrounding topic. - The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. - The concept explanation is local atlas prose until checked against its math, code, and source support. - Prerequisite gaps should become a repair route, not a reason to leave the object vague. - Role-lens requests: - Learner: ask for "Ask what would make "Flow Matching & Rectified Flows" feel predictable rather than familiar." | assumption: Source ids lipman-2022-flow-matching, liu-2022-rectified-flow must support the exact object, not just the surrounding topic. | next action: The learner can state the mechanism in their own words - Researcher: ask for "Source ids to inspect: lipman-2022-flow-matching, liu-2022-rectified-flow" | assumption: The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. | next action: The learner can name the prerequisite that would repair confusion - Experimenter: ask for "Choose one variable or condition to perturb before asking for an explanation." | assumption: The concept explanation is local atlas prose until checked against its math, code, and source support. | next action: The learner can predict how the mechanism changes under one perturbation - Professor: ask for "Find the smallest transferable rule a learner could reuse without the AI." | assumption: Prerequisite gaps should become a repair route, not a reason to leave the object vague. | next action: Teach or transfer: Turn the mechanism into one sentence that predicts a neighboring concept. 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. Current deterministic role lens for this object: - Role lens: Learner - Evidence request: Ask what would make "Flow Matching & Rectified Flows" feel predictable rather than familiar. - Assumption to keep visible: Source ids lipman-2022-flow-matching, liu-2022-rectified-flow must support the exact object, not just the surrounding topic. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Next action: The learner can state the mechanism in their own words

    concept/concept-notebook/generative-models/flow-matching concept:generative-models/flow-matching