Skip to the lesson
FixTheRobot Home / VLA / Phase 4 / 4.7

VLA · Phase 4 · Action Representation and Policy Learning

4.7 — Flow Matching for Action Generation

A related generative approach that learns a smooth path from noise to actions.

  • Roadmap phase 4
  • Action Representation and Policy Learning
  • About 14 minutes to read

Flow matching trains a network to say which way and how fast to move at each point on the way from noise to a real action. This lesson builds a tiny one and shows what happens with one step versus several.

Claims about papers, models and textbooks carry numbered references, listed with what each one is cited for in the References. Code marked “Toy model” is our own illustration, not the cited system.

Learning objectives

After this lesson, you should be able to:

  • Describe a velocity field from noise to data.
  • Build a flow-matching training example.
  • Explain why one step gives the average and several steps give real options.
  • Relate flow matching to π0’s action expert and to latency.
  1. Pick noise x0 and a real action x1
  2. Pick a time t and the point on the path between them
  3. Train the network to predict the velocity x1 − x0
  4. At run time, start from noise
  5. Follow the predicted velocity in a few steps
Flow matching.

The one-sentence idea

Learn arrows that carry noise to actions, then follow them.

Training is regression; generation follows the arrows in several steps.

A path from noise to data

Diffusion (lesson 4.6) removes noise in many small, noisy steps. Flow matching takes a more direct view. Picture every possible noise sample as a point that has to travel to a point of real data. If you know, for each place and time, which way to move and how fast (a velocity field), you can carry noise to data by following the arrows, like a leaf on a stream. Flow Matching is a simulation-free way to train such flows: a network is fitted by regression to the vector fields of fixed conditional probability paths, and sampling then works with off-the-shelf numerical ODE solvers.[1] The paper's family of Gaussian paths between noise and data includes diffusion paths as special cases, and optimal-transport paths are reported to speed up training and sampling.[1]

For robots, π0 builds on a pretrained vision-language model and adds a flow-matching architecture so that it inherits the model’s Internet-scale semantic knowledge,[2] with a separate set of weights, the action expert, that generates action chunks with flow matching.[2] For a guided tour of the original flow-matching paper (the method, its experiments and a critical review), see the Flow Matching paper guide, and for what straight-line regression does and does not guarantee about transport cost, its companion, the Rectified Flow paper guide.

The training recipe is just regression

Pick a noise sample x0 and a real action x1. Draw the straight line between them and choose a time t between 0 and 1. The point on the line is xt = (1−t)·x0 + t·x1. Along a straight line the velocity is constant: x1 − x0. The network’s job is to predict that velocity from xt and t (and, for a robot, from the camera view). It is a plain regression, with no simulation of the path during training:

import numpy as np
rng = np.random.default_rng(0)

x0 = rng.normal()                  # a noise sample
x1 = 1.0                           # a real action
t = 0.3                            # how far along the path we are

x_t = (1 - t) * x0 + t * x1        # where we are on the straight line
target_velocity = x1 - x0          # the direction and speed of the whole line

print("noise x0:", round(float(x0), 3))
print("x_t at t=0.3:", round(float(x_t), 3))
print("network should predict velocity:", round(float(target_velocity), 3))
print("check: x_t + (1-t) * velocity =", round(float(x_t + (1 - t) * target_velocity), 3), "= x1")

Output:

noise x0: 0.126
x_t at t=0.3: 0.388
network should predict velocity: 0.874
check: x_t + (1-t) * velocity = 1.0 = x1

Toy model. The straight-line path is one simple choice. The paper treats a general family of paths.

Averaged over many noise-and-action pairs, the learned velocity at a given place is the average direction toward the data, which is not the same as a single straight line to one particular target.

Training a tiny flow and sampling with few or many steps

Here is the whole pipeline in NumPy for the “left or right” data again (actions −1 and +1). The velocity model is a ridge regression on 200 random features, a tiny stand-in for a neural network. After training, we generate by starting from noise and taking N small Euler steps along the learned arrows. How many steps are needed?

import numpy as np
rng = np.random.default_rng(0)

# training data: noise x0, real actions x1 in {-1, +1}, random times t
N = 20000
x0 = rng.normal(size=N); x1 = rng.choice([-1.0, 1.0], size=N); t = rng.uniform(size=N)
x_t = (1 - t) * x0 + t * x1
target = x1 - x0

# a tiny "network": random tanh features + ridge regression
H = 200
W = rng.normal(size=(2, H)) * 3; b = rng.normal(size=H) * 2
def features(x, t): return np.tanh(np.column_stack([x, t]) @ W + b)
F = features(x_t, t)
w = np.linalg.solve(F.T @ F + 1e-3 * np.eye(H), F.T @ target)

def generate(n, steps):
    x = rng.normal(size=n)                                  # start from noise
    for k in range(steps):
        tk = np.full(n, k / steps)
        x = x + features(x, tk) @ w / steps                  # follow the learned arrows
    return x

for steps in (1, 2, 5, 10):
    x = generate(5000, steps)
    mid = np.mean(np.abs(x) < 0.5)
    print(f"{steps:>2} steps: share stuck in the middle {mid:.3f}, share near -1: {np.mean(np.abs(x+1) < 0.3):.2f}, near +1: {np.mean(np.abs(x-1) < 0.3):.2f}")

Output:

 1 steps: share stuck in the middle 0.985, share near -1: 0.00, near +1: 0.00
 2 steps: share stuck in the middle 0.480, share near -1: 0.21, near +1: 0.17
 5 steps: share stuck in the middle 0.010, share near -1: 0.49, near +1: 0.50
10 steps: share stuck in the middle 0.001, share near -1: 0.51, near +1: 0.49

Toy model. One number as the action, a random-feature regression as the network. The pattern, not the numbers, is the lesson.

With a single step the model jumps straight to the average direction and lands in the middle, the very answer we wanted to avoid. A few steps are enough for the paths to bend toward one option or the other, and the samples split into the two real options. This is the intuition for why flow and diffusion policies take several network passes per chunk. In this toy five steps were enough; the number needed depends on the problem and the model.

Cost and where it is used

Each Euler step is a pass through the network, so the latency arithmetic from lesson 4.6 applies: passes × time per pass. How many steps a particular model uses is a setting that you should read from its code or paper (lesson 6.3). FAST reports that its tokenised π0 variant can match the performance of diffusion VLAs with up to 5× less training time,[3] so the comparison between flow, diffusion and token approaches is still an active one.

Common misconceptions

Misconception 1 “Flow matching is a different kind of thing from diffusion.”

Correction The paper’s path family includes diffusion paths as special cases.

Misconception 2 “One step is enough.”

Correction In the toy, one step landed in the middle; a few steps were needed to reach the real options.

Misconception 3 “Flow matching needs simulation during training.”

Correction It is simulation-free: the network is fitted by regression.

Engineering takeaways

  1. Target velocity on a straight path is x1 − x0.
  2. Training = regression.
  3. Sampling = follow the arrows.
  4. Few steps average; more steps pick options.

Follow the arrows from noise to an action.

Knowledge check

Try each question first, then reveal the explanation.

Question 1

x0 = −0.5, x1 = 1.0. What velocity does the straight path define?

Explanation

1.5. x1 − x0.

Question 2

In the toy, why did one step land in the middle?

Explanation

One step follows the average direction, which points between the two options.

Question 3

What does the cost of generating one action chunk with flow matching depend on?

Explanation

The number of steps times the time of one network pass.

References

Numbered notes in the text, like [1], point here. Each entry says what it is cited for and how that was checked. Papers and books can be revised or misread, so follow the links before relying on a detail. Code marked “Toy model” is our own illustration of an idea, not the code of the cited system.

  1. Lipman, Y., Chen, R. T. Q., Ben-Hamu, H., Nickel, M. and Le, M. (2023). Flow matching for generative modeling. ICLR 2023 / arXiv. arXiv:2210.02747

    Cited for:

    • Flow Matching is a simulation-free way to train continuous normalizing flows by regressing the vector fields of fixed conditional probability paths; sampling works with off-the-shelf numerical ODE solvers. Checked against the paper’s abstract.
    • Works with a general family of Gaussian probability paths between noise and data, which includes diffusion paths as special cases; optimal-transport paths are reported to speed up training and sampling. Checked against the paper’s abstract.
  2. Black, K., et al. (2024). π0: A vision-language-action flow model for general robot control. arXiv:2410.24164

    Cited for:

    • Proposes a flow-matching architecture built on top of a pretrained vision-language model, so that it inherits Internet-scale semantic knowledge. Checked against the paper’s abstract.
    • Pairs the pretrained vision-language model with a separate set of weights for the action outputs (the “action expert”) that generates action chunks with flow matching. Checked against the paper, via summaries of its text.
  3. Pertsch, K., Stachowicz, K., et al. (2025). FAST: Efficient action tokenization for vision-language-action models. RSS 2025 / arXiv. arXiv:2501.09747

    Cited for:

    • Combined with π0, it can scale to training on 10k hours of robot data and match the performance of diffusion VLAs while reducing training time by up to 5×. Checked against the paper’s abstract.

What’s next

Last in this phase: FAST, a way to compress action chunks into compact tokens.

Next lesson

4.8 — FAST action tokenization

Compressing action sequences into compact tokens a language-model-style policy can predict.

Back to the VLA roadmap