Learning for Control: Imitation, RL and Sim-to-Real
You'll be able to:
You can explain why behaviour cloning suffers from compounding error and how DAgger fixes it, state when reinforcement learning is worth its sample cost over imitation, and describe domain randomisation and why it transfers policies from simulation to hardware.
Three ways to get a controller you could not write
When the mapping from observations to actions is too messy to write by hand, you learn it. There are three main routes, and the craft is in knowing which one fits the data you can get and the risk you can take.
Imitation learning and the compounding-error problem
Behaviour cloning (BC) is supervised learning: collect (observation, action) pairs from an expert, usually a person teleoperating the robot, and fit a model that predicts the action. It is simple, stable and needs no reward function, and it is where most real-robot learning starts.
Its flaw is subtle. Supervised learning assumes test inputs come from the same distribution as training inputs. But the clone's small mistakes carry it into states the expert never visited, where it has no idea what to do, so it makes bigger mistakes, and so on. Ross and Bagnell showed (and the DAgger paper recaps) that the expected cost of a cloned policy over a horizon of T steps can grow like T², whereas an expert with the same per-step error grows like T. In the CartPole mission you will see this directly: the clone's return is good for a while and then collapses as soon as the pole tilts further than the expert ever let it.
DAgger (Dataset Aggregation) is the fix, and it is a procedure worth memorising:
- Train a policy on the expert's demonstrations.
- Run the learned policy and record the states it visits.
- Ask the expert what it would have done in each of those states, and add those labels to the dataset.
- Retrain on the aggregated dataset; repeat.
The learner now sees its own mistakes, labelled with the recovery. The catch is step 3: with a human teleoperator, relabelling thousands of off-distribution states is expensive and awkward, so in practice teams approximate it by recording recovery demonstrations or by asking operators to intervene only when the policy drifts.
Modern imitation systems such as Diffusion Policy and ACT (the ALOHA paper) add two ideas on top of plain BC: predict a chunk of future actions rather than one, which reduces the number of decisions where error can compound, and model the action distribution as multimodal, so that when demonstrators sometimes went left and sometimes right around an obstacle the policy does not average them into the obstacle.
Reinforcement learning
RL drops the expert and learns from a reward signal by trial and error. Its advantage is that it can find behaviours no demonstrator showed and can exceed the demonstrator. Its costs are brutal in robotics: millions of interactions for algorithms like PPO, a reward function that must be specified and will be exploited if it has loopholes, and exploration that on real hardware means crashing. The honest summary of a decade of work is that model-free RL on robots happens in simulation, with PPO or SAC, and the result is transferred. OpenAI's Spinning Up is the cleanest path into the algorithms; read its "Kinds of RL Algorithms" page before you read any single paper.
When is RL worth it over imitation? When demonstrations are hard to collect (dexterous in-hand manipulation, agile locomotion), when the task has a clear, cheap reward (did the cube reach the goal), and when you have a simulator that is close enough to reality. When you have a teleoperation rig and a patient operator, imitation usually gets you further faster.
Sim-to-real and domain randomisation
A policy trained in simulation meets a reality gap on two fronts: perception (rendered images do not look like camera images) and dynamics (friction, masses, motor delays and backlash are not what the simulator assumed). Two strategies address it.
System identification measures the real parameters and sets the simulator to match. It is the right first move for dynamics and the wrong one for appearance, since you cannot identify every lighting condition.
Domain randomisation, introduced by Tobin et al., gives up on matching reality and instead varies the simulator so widely, in textures, lighting, camera pose and object colours, that the real world looks like just one more sample. The policy is forced to learn features that are invariant to the things you randomised. The same trick applied to physics parameters, randomising friction, masses and actuator delays, is what let OpenAI's Learning Dexterous In-Hand Manipulation transfer a cube-reorientation policy to a real hand after training only in simulation. The price is that randomisation makes the training problem harder and the resulting policy more conservative; randomise too widely and nothing is learnable.
Choosing
- Data is a person with a controller: start with BC, then chunked, multimodal BC, then DAgger-style corrections.
- Data is a simulator and a reward: RL with randomisation, then transfer, then fine-tune on a small amount of real data.
- Both: pre-train on demonstrations, fine-tune with RL. This hybrid is where much current work sits, and offline RL (learning from fixed logged data without further interaction) is an active, unsettled research direction rather than a tool you can rely on yet.
What to remember
- BC fails by drifting into states it never saw; the error compounds over the horizon.
- DAgger fixes this by labelling the learner's own states, at the cost of expert queries.
- Action chunking and multimodal action models are the two upgrades that made BC work on real robots.
- RL earns its sample cost when demonstrations are hard or the reward is trivial to specify, and it lives in simulation.
- Domain randomisation buys transfer by making reality look like one more training sample; too much and the task becomes unlearnable.
Curated Materials
2hThe deep work happens here — the lesson is your briefing.
Live on aiqbench
This lesson's subject on the rest of the site, today.
In the news, last 30 days
- Cenotian raises $48M to underwrite robotics deployments and cut factory riskDealroom.co ·
- DeepSeek Officially Posts Job for Talent in Embodied Intelligence36Kr ·
- NVIDIA Expands US Technology Initiatives Across Energy, Robotics and Quantum ComputingThe Quantum Insider ·
Test your knowledge
5 questions in 100 seconds, on a page of its own. Read everything above first.
Test your knowledge →Module Mission
35–45 minIn Gymnasium's CartPole-v1, write a hand-coded expert (push toward the side the pole is falling). Record 20 expert episodes, train a tiny classifier (logistic regression or a two-layer MLP) on the state→action pairs, and roll it out for 50 episodes. Report the expert's and the clone's mean return. Then do one DAgger round: run the clone, relabel its visited states with the expert, retrain, re-evaluate. Deliver the three numbers and one paragraph on compounding error.
Loading your work…