December 2025 · 15 min read

Walking, Reaching and Not Falling Over: Fast Humanoid Control with Flow Matching

We took a humanoid controller that writes out its own future motion with a diffusion model, swapped the diffusion model for flow matching, and got a controller that needs four times fewer network calls per step, falls less when pushed, and can reach for things it never saw anyone reach for.

Zehua Wang, Videet Mehta, Qiao Sun · MIT

Table of contents
  1. TL;DR
  2. Walking and reaching at once
  3. Why diffusion controllers are slow
  4. Flow matching in one picture
  5. From motion capture to a model
  6. Steering at test time
  7. Fewer steps, fewer falls
  8. Steering with a joystick
  9. Reaching without a reaching demo
  10. Why it works
  11. What we don't claim
  12. The paper

TL;DR

1. Walking and reaching at once

A humanoid is attractive because the world is built for human bodies: it fits through our doors, reaches our shelves and climbs our stairs. The hard part is that for a humanoid, moving and manipulating are the same problem. This is called loco-manipulation.

A robot arm bolted to a table can reach without thinking about its feet. A humanoid can't. Reaching forward shifts its center of mass, so the legs have to compensate. Carrying something changes how the whole body swings while walking. The controller has to plan for the whole body at once, across 20 to 30 motors, while respecting joint limits, torque limits and balance.

Hand-built controllers and trajectory optimizers can do impressive things, but they need accurate models and lots of task-specific tuning, and they tend to break when reality doesn't match the model. Reinforcement learning on human motion-capture clips produces very natural motion, but usually one policy per task.

2. Why diffusion controllers are slow

A newer idea treats control as generation. Instead of mapping the current state straight to an action, a generative model writes out a short plan: the next action, and the next few states and actions after it. BeyondMimic showed that if the model predicts states as well as actions, you can steer it toward a goal at test time (walk to this waypoint, follow this joystick, avoid this obstacle) with no retraining. One model, many tasks.

The catch is speed. BeyondMimic uses a diffusion model (DDPM). Diffusion models generate by starting from pure noise and removing a little of it at a time, over 20 to 50 steps. Each step is a full forward pass through the network, and all of them have to happen inside every control step. On edge hardware that works out to roughly 10 Hz, which is too slow for fast, reactive moves like catching yourself while reaching mid-stride.

So the question for this project was simple: can we keep everything good about the diffusion controller, including the test-time steering, but make each plan much cheaper to produce?

3. Flow matching in one picture

Flow matching is a different way to train the same kind of generative model, and in image generation it has shown better quality with far fewer steps than diffusion.

The intuition: take a real trajectory from the training data and a random noise sample of the same shape. Draw a straight line from the noise to the data. Pick a random point along that line, and train the network to answer one question there: which direction, and how fast, should I move to get to the data? For a straight line, the answer is just the difference between the two endpoints.

L = ‖ vθ(τt, t, Ot) − (τ1 − τ0) ‖²

Here τ0 is the noise, τ1 is the real trajectory, τt is the in-between point, Ot is the robot's recent history, and vθ is the network's predicted velocity. To generate, you start from fresh noise and follow the predicted velocity in a few steps. Each step is one network call, so the number of steps is the "number of function evaluations", or NFE.

Diffusion (DDPM)

noisewalking motions 20–50 small steps each removes a little noise

Flow matching

noisewalking motions 5 straight steps follow the learned velocity
Figure 1. The intuition, drawn by hand (not data). Diffusion removes noise in many small, carefully scheduled steps. Flow matching learns a velocity that points along a straight path from noise to data, so a few large steps land in nearly the same place.

That is the whole trick. Nothing about the network architecture changes. What changes is what it is trained to predict, and therefore how many steps you need at run time.

4. From motion capture to a trajectory model

Motion-capture data tells you how a person's body moved, but not which motor commands would make a robot move that way. So, following BeyondMimic, we build the training data in stages.

  1. Walking clipsThe walking sequences from the LAFAN1 motion-capture dataset. No reaching, no grasping.
  2. One expert per clipAn RL policy (PPO) per walking clip, rewarded for tracking the clip's poses and velocities in physics simulation.
  3. Noisy rolloutsRun each expert with noise added to its actions, and record what it does to recover.
  4. One generative modelA flow-matching transformer trained on all of it, then steered at test time.
Figure 2. The pipeline. Experts turn motion-capture clips into motor commands; one generative model distills all of them.

Teaching the model to recover

If you only ever show a model perfect demonstrations, it has no idea what to do once it drifts off them. A trick from PDP fixes this: perturb the expert while recording, but store the clean action the expert would have taken from each perturbed state. The data then contains a "noise band" around every demonstration, full of corrective moves.

We push this further by recording at several noise levels at once. For every motion clip we run 40 simulated environments, most of them with gentle noise and a few with heavy noise:

Figure 3. How the 40 environments per clip are split across action-noise levels (σ is the standard deviation of the Gaussian noise added to actions). Low noise gives dense coverage near the expert; high noise shows the model bigger recoveries.

That comes to roughly 40 rollouts, about 3.5 hours of data, per motion sequence.

What the model sees and predicts

The body is the SMPL skeleton with 23 ball joints. Rather than describe the body by its joint angles, we run forward kinematics and describe it by where each body part is in space and how fast it is moving, all in a "character frame" that moves and turns with the robot. That makes goals like "put the hand here" easy to express, and avoids small angle errors piling up along the chain from hip to hand.

Given the last 4 steps of history (about 0.13 s), the model writes out a plan: the action to take now, followed by H future states and actions.

Figure 4. Grey: the history the model is conditioned on. Blue and orange: the plan it generates, future states and actions. Only at is executed; the plan is regenerated at the next control step. Predicting states is what makes steering possible.

The network itself is small: a 6-layer transformer decoder with 8 heads and 512-dimensional embeddings, about 20M parameters and about 1 GB of GPU memory at inference. We trained a DDPM version (as in BeyondMimic) and a flow-matching version with the same architecture, each for about 24 hours on 32 TPU v4 cores, and measured inference on an RTX 4060 and an A6000 with TensorRT. The DDPM-versus-flow-matching comparison uses a horizon of H = 4; the steering experiments use H = 16.

5. Steering at test time

Here is where predicting the future pays off. Suppose we want the robot to walk at a certain velocity, or put its right hand at a point in space. We write that wish as a cost G on the planned trajectory: zero if the plan does what we want, larger the further off it is. Then, at every generation step, we nudge the model's velocity downhill on that cost:

v′θ = vθ − w ∇τ G

The model's own velocity vθ keeps the plan looking like realistic walking; the gradient term pulls it toward the goal; w sets how hard we pull. Change the cost and the same model does a different task. This is called classifier guidance, and the paper shows it carries over from diffusion to flow matching.

plans that look like walking goal: hand target here vθ −w∇G v′ current noisy plan
Figure 5. Guidance, drawn by hand. The model's velocity pulls the plan toward realistic motion; the guidance term pulls it toward the goal; the plan follows their sum.

Two practical details. First, following earlier work on diffusion, we switch guidance off for the last 5 of 20 steps when generating with NFE = 20; guiding only over an interval made things much more stable. Second, for reaching we compute the hand position from the planned joint angles with forward kinematics, so the cost is just the distance between the hand and the target:

Lreach = ‖ FK(qt) − ptarget ‖²

Nothing in the model knows about reaching. It only knows how walking bodies move. The cost asks for a reach, and the model finds the most walking-like way to deliver one.

A simulated humanoid robot mid-stride with one hand raised next to a red sphere
Figure 6. The flow-matching policy, guided to raise and wave its hand in the air (Fig. 1 in the paper). The training data contained only walking.

6. Result: fewer steps, fewer falls

The first experiment asks how robust each controller is, and how that changes as we cut the number of generation steps. The robot walks with no goal while being shoved: every second its root gets a random velocity kick of up to 0.5 m/s. We count simulation steps until it falls (its head drops below 0.2 m), averaged over 50 trials.

4×faster inference: flow matching at 5 network calls per control step matches or beats DDPM at 20 (about 20 ms)
820 vs 280mean steps survived under pushes at NFE = 5, flow matching vs DDPM
280 vs 30at NFE = 1: one network call, and flow matching still walks
Line chart of mean survival steps against number of function evaluations (20, 10, 5, 2, 1, log scale) for Flow Matching and DDPM, with shaded standard deviation bands
Figure 7. Mean survival steps against NFE (log scale, fewer steps to the right), from the paper (Fig. 2). Shaded bands are one standard deviation over 50 trials. At 20 steps both survive about 470 steps; as the step count drops, DDPM falls off and flow matching holds on.

At 20 steps the two are tied, at about 470 steps each. Below that they split:

Two caveats are visible in the chart itself. The bands are wide, so individual trials vary a lot. And at 10 steps DDPM's mean is actually higher than flow matching's; the gap only opens up in the few-step regime. That regime is exactly the one that matters for real-time control.

The motion looks different too. DDPM with few steps produces unnatural poses and jerky movement that drift away from anything in the training data. Flow matching still produces smooth, natural walking at a single step.

7. Result: steering with a joystick

Next, a steering task. A "joystick" issues four commands in turn, forward, backward, turn left and turn right, each held for 3 seconds. The guidance cost is the squared gap between the plan's horizontal root velocity and the commanded velocity, summed over the plan. We score the root-mean-square error (RMSE) between achieved and commanded velocity.

Two knobs matter. The planning horizon H: going from H = 2 to H = 16 lowers RMSE from about 1.05 to 0.70, a 33% drop. A longer plan gives guidance room to change speed gradually rather than all at once. The guidance strength w: going from w = 10 to w = 40 lowers RMSE from about 0.725 to 0.55, a 24% improvement.

Joystick RMSE vs horizon H

Joystick RMSE against prediction horizon 2, 4, 8, 16, falling from about 1.05 to about 0.69

Joystick RMSE vs guidance scale w

Joystick RMSE against classifier guidance scale 10, 20, 30, 40, falling from about 0.725 to about 0.55
Figure 8. Joystick velocity tracking, from the paper (Figs. 3 and 4, left panels). Lower is better. Both a longer horizon and stronger guidance help.

Stronger isn't always better, though. Above w = 40 the walking gait starts to destabilize and the robot falls more often, so the sweet spot for velocity control is around w = 30 to 40.

8. Result: reaching without a reaching demo

This is the result we find most striking. The robot has to move its hand to randomly placed targets while keeping its balance and walking. The training set contains no reaching, grasping or manipulation at all, only walking. The only thing asking for a reach is the forward-kinematics cost from section 5.

It works. At the best settings, hand-tracking RMSE is about 1.1. The same two knobs behave as before, with a twist:

Hand-target RMSE vs horizon H

End-effector RMSE against prediction horizon 2, 4, 8, 16: about 1.41, 1.51, 1.46 and 1.15

Hand-target RMSE vs guidance scale w

End-effector RMSE against guidance scale 20 to 140: drops sharply from about 1.49 at 20 to about 1.15 at 40, flat around 1.11 to 1.14 up to 120, then rises to about 1.18 at 140
Figure 9. End-effector (hand) tracking, from the paper (Figs. 3 and 4, right panels). Lower is better. Too little guidance doesn't get the hand there; too much produces unnatural arm motion and the error rises again.

Reaching wants much stronger guidance than velocity control (around w ≈ 100 versus w ≈ 40). Our guess is that hand targets sit further from where arms naturally are during walking, so the model has to be pulled harder to get there.

The takeaway: flow matching gives you the steerable, generate-a-plan controller of BeyondMimic at a fraction of the cost per control step, and it degrades gracefully when you cut steps instead of falling apart. And a model that has only ever seen walking can be steered into reaching.

9. Why it works

Why flow matching survives with few steps

DDPM learns a reverse process in discrete steps, each removing a fixed amount of noise, with a schedule tuned for a particular step count. Cut the step count and each step has to jump further than it was trained for. Errors compound, because each step builds on the last, and the result lands off the data. At a single step, DDPM's samples are far from anything realistic.

Flow matching learns a continuous velocity field along straight paths. Straight paths are easy to follow with a few big steps; even one Euler step lands roughly on the data. That is where the 4× speedup comes from.

Why reaching emerges from walking

We think three things combine. Walking already contains a lot of arm motion: arms swing and posture shifts, covering a good part of the arm's reachable space. The model learns a smooth "surface" of physically plausible poses that can be bent toward new ones. And guidance supplies the push along that surface toward the target. The practical upshot: walking data is far easier to come by than manipulation demos or teleoperation, and it may be enough to bootstrap reaching.

Horizon and strength trade off

A longer horizon gives better tracking but costs more compute, roughly linearly in H. Since flow matching does well at low NFE, a good operating point is a moderate horizon (H ≈ 16) with few steps (NFE ≈ 5). Guidance strength is a different trade: more of it improves tracking until it pushes the plan into poses the model has never seen, and then the robot falls.

10. What we don't claim

Next steps we'd like to try: training on more varied motion (running, jumping, dancing, manipulation), putting a higher-level planner on top to hand the controller waypoints, online data collection to fight distribution shift, and of course a real robot.

The paper

Fast Humanoid Loco-Manipulation via Flow Matching

Zehua Wang, Videet Mehta, Qiao Sun · MIT

Acknowledgements

This was a project for MIT's 6.4210; thanks to the teaching staff for their guidance and feedback. It builds directly on BeyondMimic (Liao et al.), PDP's noise-band data collection (Truong et al.), the flow matching and rectified flow papers (Lipman et al.; Liu et al.), and the LAFAN1 motion-capture dataset.