Learn from demonstrations without copying hidden state
Collect observation-action pairs and understand where behavior cloning fails.
Teach a Go2 by showing it
Press Start recording, then use the slider or arrow keys to drive the robot to the 1 m line and stop it there. You have 12 seconds. A policy is then fitted to your commands and has to drive on its own.
Go2 test lane
The 3D workspace loads when it comes into view.
The robot is at 0.000 m at 0.0 s. The orange line marks the 1 m target. You are driving.
2D reference and fallback
Model, fit, and limits
The same one-dimensional model of the Go2 as the control lessons: the drive approaches its commanded speed with a 0.4 s lag and the command is limited to ±0.80 m/s. Your slider value is recorded every 0.1 s. The policy is a least-squares fit of three numbers, so it can only represent a straight-line rule. A vision-language-action model is trained on the same kind of observation and action pairs, but with camera images as input, a far larger model, and many demonstrations. Nothing here is sent to a robot.
Opening the Python editor…
Requirements and learning goals
Before you start
- A browser with JavaScript for the experiment
- Python and arrays for the NumPy exercise
You will be able to
- Build a demonstration schema
- Split by episode
- Recognize distribution shift
The browser exercise above works without extra setup. The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?
trains a from examples of someone performing a task. Behavior cloning is its simplest form: predict the demonstrated action from the observation. It is useful when you can demonstrate a behavior more easily than design a . Here you will fit a tiny example and learn why matching recorded actions does not guarantee recovery from mistakes.
Use application recording streams to preserve observations and actions with timestamps. Converting recordings into aligned training demonstrations remains part of your data pipeline.
Try it in your browser
The experiment above is behavior cloning at its smallest scale. You are the demonstrator.
- Press Start recording. Drive the robot to the 1-meter line with the slider and stop it there. A rough attempt is fine.
- After 12 seconds, a policy is fitted to your commands. Read the rule it learned: a weight on position error, a weight on velocity, and a constant.
- Watch the clone drive. Compare its final error and with your own run.
- Under Test the clone in, select the steady push. Your demonstration never included a push. Read the clone's final error again.
- Record a deliberately poor demonstration, such as stopping well short of the line, and compare what the policy learns.
The policy does not know where the target is. It reproduces the relationship between what you saw and what you did. If you stopped short, it stops short. Nothing in your demonstration showed how to answer a push, so expect a different final error under one. The average command gap can stay small in both cases: copying a demonstration well is not the same as completing the task.
Learn the demonstrated action
A cloned policy may reproduce familiar states while failing to recover from its own mistakes.
Record observation, action, capture time, execution time, and ID. Keep future measurements and the demonstrator's private knowledge out of model inputs.
Fit a visible baseline
This synthetic NumPy exercise fits target error and velocity to an action:
import numpy as np
rng = np.random.default_rng(4)
observations = rng.uniform(-1, 1, size=(200, 2))
actions = 0.7 * observations[:, 0] - 0.2 * observations[:, 1]
features = np.c_[observations, np.ones(len(observations))]
weights, *_ = np.linalg.lstsq(features, actions, rcond=None)
print(weights) # approximately [0.7, -0.2, 0]This checks feature ordering and action meaning. It is not a robot policy.
Collect recoveries too
Include varied starts, pauses, disturbances, and corrections. Split by episode or session rather than adjacent frames. Store unsuccessful attempts with explicit labels.
Evaluate the learned controller in a loop where its own actions change future observations. Low offline prediction error does not establish successful behavior. Compare completion, interventions, and distance to the goal with the demonstrator.
The G1 reference-conditioned example shows why reference files and joint conventions matter. Its required dataset and parent checkpoint are not bundled, so the small exercise above is the self-contained starting point.
Common snag: delayed action labels make a policy appear hesitant. Measure observation-to-action timing before training.
Optional extension: collect recovery demonstrations at the states where the cloned policy actually fails, then evaluate on new episodes.
Before you move on
Can you do each of these?
- Build a demonstration schema
- Split by episode
- Recognize distribution shift
0 of 2 checkpoints solved. Try checkpoint 1