Robot Learning & Sim-to-Real
Learning control in a physical world.
A simulated robot can gather years of experience in a day; a real one breaks things, needs resets and lives in physics that no simulator gets exactly right. Robot learning sits between two imperfect sources of data, simulators and demonstrations, and the theory says precisely how the errors of each propagate: through the simulation lemma for one, through compounding mistakes for the other.
What you’ll learn
- Quantify the sim-to-real gap with the simulation lemma, formalize domain randomization as a latent-parameter POMDP, and prove that memory can double the value of a randomized policy.
- Prove DAgger's guarantee from the performance-difference lemma and no-regret online learning, and show that behavior cloning's quadratic bound can be tight.
- Explain why inverse RL is ill-posed, prove that matching feature expectations guarantees near-expert performance for every bounded linear reward, and derive the maximum-entropy IRL gradient.
- Describe diffusion policies, action chunking and vision–language–action models, and the open problems of generalist robot policies as of the mid-2020s.
The reality gap and domain randomization
Robots add constraints that games and gridworlds lack: continuous, high-dimensional actions issued tens to hundreds of times per second, noisy partial observations, hardware that wears out, and safety limits on what may be tried. GPU-based simulators run thousands of environments in parallel (Makoviychuk et al., 2021), so training moves into simulation whenever possible, and the question becomes how much of what is learned there survives contact with reality. The simulation lemma (Bellman Equations & Contraction) answers in the worst case: if every transition distribution of the simulator is within of reality in , a policy optimal in the simulator loses at most in the real world.
With , what per-step model error does that bound require before it promises that the simulator-optimal policy loses less than 10% of the maximum possible value ?
- About
- About
- About
- About
Show the answer
C. About
The bound is , and 10% of the maximum value is , so . No simulator of contact and friction is that accurate everywhere, so transfer cannot rest on accuracy alone; it needs robustness or adaptation. The bound is a worst case, which is also why policies often transfer better than it promises.
Let with probability each, a motor wired one way or the other. At each of steps the robot pushes left or right; in pushing right earns 1 and left 0, and in the reverse. Observations are constant, so they reveal nothing about , but rewards do. A memoryless policy pushes right with a fixed probability at every step:
A policy with memory pushes right once, notes whether it was rewarded, and pushes the correct way for the remaining steps:
The ratio tends to 2. Robustness over cannot replace the information a single probe reveals; only memory can use it. Chen et al. (2022) analyze domain randomization in this latent-MDP model, show that it can transfer without any real-world samples under conditions on the simulator family, and their bounds highlight the role of history-dependent policies.
Practice followed the same logic. Tobin et al. (2017) randomized textures, lighting and camera poses so that a detector trained only on synthetic images worked on real ones. OpenAI's in-hand manipulation work used recurrent policies with automatic domain randomization, which widens each parameter's range as the policy masters the current one, and found evidence that the trained network adapts within an episode (OpenAI et al., 2019). Legged robots are often trained with a privileged teacher that sees in simulation and a student that must infer it from its sensor history (Lee et al., 2020), or with an adaptation module that estimates latent "extrinsics" from recent states and actions (rapid motor adaptation; Kumar et al., 2021).
Imitation: compounding errors and DAgger
Fix a -step task with costs , a deterministic expert , and , where is 's state distribution at step and its average. Behavior cloning, supervised learning on the expert's state–action pairs, minimizes a surrogate loss , such as the indicator of disagreeing with the expert, on the expert's distribution, , and can pay up to (Ross & Bagnell, 2010; proved in Sequence-to-Sequence Models).
Think first Can behavior cloning really lose order , or is the bound just loose?
It can. Let the expert follow a narrow path, and let any wrong action drop the robot into a region the expert never visits, where every step costs 1 and the cloned policy, never trained there, cannot find its way back. If the learner errs with probability per step while still on the path, its first error falls at step with probability about and then costs about . Summing, the expected extra cost is about . Ross and Bagnell give a construction of this kind.
Performance difference, finite-horizon form. Telescoping the expert's cost-to-go along the learner's trajectory, as in the discounted lemma of Bellman Equations & Contraction, gives for any :
Each bracket vanishes where agrees with the expert and is at most where it does not, so it is at most . The loss is weighted by the learner's own state distribution:
No regret. In round the learner plays and suffers , which is exactly 's on-policy loss. Average regret at most means
Some is no worse than the average, so its on-policy loss is at most , and the second step finishes the proof. Training on the aggregated data is follow-the-leader, which is no-regret for strongly convex losses with .
Two caveats are built into the statement. is the best loss achievable in the class on the learner's own states, so if the policy class cannot imitate the expert there, more data does not help. And encodes recoverability: for driving-like tasks , but when one wrong step can be fatal, can be of order and DAgger's bound is quadratic too. Practical variants lighten the expert's burden: human-gated interventions (HG-DAgger; Kelly et al., 2019), noise injected into the expert's own demonstrations so that they cover recovery states (DART; Laskey et al., 2017), and teachers that are themselves policies with privileged simulator state.
Inverse RL: learning what the expert wants
Imitation copies actions; inverse reinforcement learning (IRL) infers a reward that explains them, which can transfer to situations where copying cannot. Ng & Russell (2000) showed that the problem is ill-posed: the zero reward makes every policy optimal, and in a finite MDP the rewards for which a given policy is optimal form a convex cone cut out by linear inequalities. Potential-based shaping, , never changes the optimal policies (Ng, Harada & Russell, 1999), so rewards are identifiable at best up to shaping and scale. IRL algorithms resolve the ambiguity with an extra criterion: a margin, maximum entropy, or a divergence between occupancy measures.
Proof. By linearity of expectation , so by Cauchy–Schwarz. In occupancy-measure terms (RL Foundations), , so feature matching matches linear projections of the occupancy measure. Abbeel and Ng's algorithm alternates between finding weights that best separate the expert's feature expectations from those of the policies found so far and solving the RL problem for that reward, and it returns a mixture of policies that matches within after finitely many iterations.
Feature matching leaves many policies, and many weight vectors, consistent with the data. Ziebart et al. choose the trajectory distribution of maximum entropy subject to matching the expert's average feature counts . For deterministic dynamics, Lagrangian duality yields an exponential family over trajectories, with :
Fit by maximum likelihood on demonstrations . The gradient of is the model's expected feature count, so the gradient is expert features minus model features, and it vanishes exactly when they match:
The model expectation comes from a soft, log-sum-exp version of value iteration, so each gradient step solves a planning problem. The log-likelihood is concave in , and the model treats the expert as noisily rational, likelier to take better trajectories but not always the best, which tolerates imperfect demonstrations.
GAIL (Ho & Ermon, 2016) showed that maximum-entropy IRL followed by RL amounts to matching occupancy measures under a convex regularizer, and chose a regularizer that turns the problem into a game between the policy and a discriminator :
At the optimal discriminator, the policy minimizes a Jensen–Shannon divergence between its occupancy measure and the expert's, as in a GAN (Generative Adversarial Networks). GAIL recovers a policy without ever writing down a reward, at the price of on-policy RL in its inner loop.
Generalist robot policies (as of the mid-2020s)
Large-scale imitation has driven much of the recent progress in manipulation, and three design choices recur.
- What to predict. Behavior cloning with a squared-error loss regresses to the mean of the demonstrated actions; when demonstrators pass an obstacle on both sides, the mean goes through it, the same failure as blurry video prediction (World Models & Video Generation). Diffusion policies (Chi et al., 2023) model the whole multimodal action distribution by denoising, as diffusion models do for images (Diffusion Models), and discretizing actions into bins and predicting tokens does the same with a categorical distribution.
- How far ahead. Action chunking (ACT; Zhao, Kumar, Levine & Finn, 2023) predicts the next actions at once, which divides the number of decisions per episode by , and with it the opportunities for compounding error.
- What to start from. Vision–language–action (VLA) models start from a pretrained vision–language model.
| Approach | Action output | Strength | Weakness |
|---|---|---|---|
| Behavior cloning with squared error | one continuous action | simple and fast | averages multimodal demonstrations |
| Diffusion or flow-matching policy | continuous, multimodal | expressive; smooth trajectories | several denoising steps per action |
| Tokenized actions (RT-2, OpenVLA) | discrete bins as tokens | reuses language-model machinery and web knowledge | coarse precision; low control rates |
| Action chunking | blocks of actions | fewer decisions; smoother motion | less reactive within a chunk |
RT-1 (Brohan et al., 2022) trained a transformer on a large collection of real demonstrations, mapping camera images and language instructions to discretized actions. RT-2 (Brohan et al., 2023) fine-tuned vision–language models to emit actions as text tokens while co-training on web data, introduced the term vision–language–action model, and showed that semantic knowledge from the web carried over to instructions about objects and concepts absent from the robot data. The Open X-Embodiment collaboration (2023) pooled datasets from many labs and robot types, OpenVLA (Kim et al., 2024) released an open-weights VLA, and π0 (Black et al., 2024) paired a vision–language backbone with a flow-matching "action expert" for high-frequency continuous control.
Key takeaways
- The simulation lemma makes sim-to-real gaps scale like , far too large to rely on accuracy alone, so transfer relies on robustness and adaptation.
- Domain randomization optimizes the expected return over a distribution of simulators: a latent-parameter POMDP in which memory enables implicit system identification and can double the value over memoryless policies.
- Behavior cloning can lose order , and the bound is tight; DAgger's on-policy labels and no-regret learning give , linear in when mistakes are recoverable.
- Inverse RL is ill-posed, but matching feature expectations guarantees near-expert return for every bounded linear reward; maximum-entropy IRL and GAIL turn imitation into likelihood fitting or occupancy-measure matching.
- Multimodal action models, action chunking and vision–language–action models drive generalist manipulation as of the mid-2020s, while data, evaluation and reliability remain open problems.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why can a history-dependent policy trained with domain randomization beat the best memoryless policy?
- It has more parameters
- It can infer the hidden simulator parameters from its own history and adapt, while a memoryless policy must act the same way under every parameter value
- It is trained on more simulators
- Memoryless policies cannot be trained with domain randomization
Show the answer
B. It can infer the hidden simulator parameters from its own history and adapt, while a memoryless policy must act the same way under every parameter value
With hidden, domain randomization is a POMDP over . A memoryless policy can only hedge across simulators, earning in the motor-wiring example, while a policy with memory probes once, identifies and earns .
In the proof of DAgger's guarantee, what does the no-regret property contribute?
- It makes the expert optimal
- It makes the recoverability constant small
- It guarantees that the policy class contains the expert
- It bounds the iterates' average loss on their own state distributions by the best loss in hindsight on the aggregated data, plus
Show the answer
D. It bounds the iterates' average loss on their own state distributions by the best loss in hindsight on the aggregated data, plus
Round 's loss is the on-policy loss of the iterate, so no regret gives . The performance-difference lemma converts an on-policy loss into a cost gap of at most times that loss.
A policy's feature expectations match the expert's within in the Euclidean norm. What does Abbeel and Ng's argument guarantee?
- The policy recovers the expert's true reward weights
- The policy takes the expert's action in every state
- for every reward with
- The policy is optimal for every reward function
Show the answer
C. for every reward with
Returns are linear in feature expectations, , so Cauchy–Schwarz gives . The guarantee holds for the unknown true reward without identifying it, which IRL's ill-posedness would make impossible anyway.
Demonstrators pass an obstacle on the left half the time and on the right half the time. A policy trained by behavior cloning with a squared-error loss on these demonstrations tends to…
- steer toward the middle, into the obstacle
- pass on the left, the first mode it sees
- pick left or right at random in each episode
- stop in front of the obstacle
Show the answer
A. steer toward the middle, into the obstacle
Squared error is minimized by the conditional mean, and the mean of "left" and "right" points straight ahead. A model of the whole action distribution, such as a diffusion policy or a categorical distribution over action tokens, can represent both modes and sample one of them.
Further reading
- S. Ross, G. J. Gordon & J. A. Bagnell, "A reduction of imitation learning and structured prediction to no-regret online learning," AISTATS (2011).
- J. Tobin, R. Fong, A. Ray, J. Schneider, W. Zaremba & P. Abbeel, "Domain randomization for transferring deep neural networks from simulation to the real world," IROS (2017).
- P. Abbeel & A. Y. Ng, "Apprenticeship learning via inverse reinforcement learning," ICML (2004).
- A. Brohan et al., "RT-2: Vision-language-action models transfer web knowledge to robotic control," CoRL (2023).
- T. Osa, J. Pajarinen, G. Neumann, J. A. Bagnell, P. Abbeel & J. Peters, "An algorithmic perspective on imitation learning," Foundations and Trends in Robotics (2018).