AI Wiki中文/EN

Sim-to-real transfer: from simulator to robot

仿真到现实迁移

Why robot policies are trained in simulators, what the reality gap is made of, and how system identification, randomized simulators, memory and real-data adaptation try to close it, with a synthetic control toy whose answers can be checked by hand.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

Practise in a simulator, perform on a robot

Sim-to-real transfer means training a robot’s behaviour in a computer simulation and then running it on the physical robot. Simulated practice is cheap and fast, and it cannot break anything. The catch is that no simulator is exact, so a behaviour that scores well in simulation can fail on the real machine. Why simulate

Some vocabulary first. A policy is the rule that turns what the robot senses into what it does next. Reinforcement learning (RL) finds a policy by trial and error, guided by a reward score. A simulator is a program that imitates the robot and its surroundings, so those trials can happen in software. See reinforcement learning for the general method.

Why bother with a simulator? Deep RL can need hundreds of thousands or millions of trials. Many early trials are random flailing. On a real arm that would take a very long time, and it could damage the arm or things nearby. In a simulator the same trials can run on many computers at once. Sample needs Data and safety

The difference between the simulator and the real world is called the reality gap. Part of it is wrong numbers, such as a mass or a friction coefficient. Part of it is physics the simulator leaves out, such as bending parts, slack in gears, wear and fluids. Simulated cameras also draw cleaner, simpler images than real cameras see. Reality gap

Small modelling errors add up, so the simulated robot and the real one can drift apart quickly. That is why a policy trained on an imprecise model usually needs significant changes before it works on the robot. Under-modelling

There are four broad responses. You can make the simulator match the robot more closely. You can train on many varied simulators, so the policy learns to cope with mismatch. You can give the policy memory, so it works out the real dynamics while it runs. Or you can adapt the policy with some real data. A 2020 survey reports the second approach, called domain randomization, as the most widely used. Families of methods

This article explains where the gap comes from and how each remedy works. Then it runs a small synthetic example. A controller that is nearly perfect in its simulator fails on the “real” system, and two remedies fix it. Randomization is treated in depth in domain randomization. The wider robot-learning problem is in robotics overview, and general methods that use target data are in domain adaptation and transfer learning.

What the gap is made of, and four ways to close it

This section names the parts of the reality gap, explains why a simulated score cannot reveal them, and describes the main remedies.

Parts of the gap

Wrong parameters. Every simulator contains numbers such as masses, friction and motor strengths. They are measured or guessed, and never exactly right. Zhao et al. add that one robot’s parameters can drift with temperature, humidity, positioning or wear. System identification, §III-B

Missing effects. Tobin et al. list effects that simulators usually leave out: parts that are not rigid, gear backlash (slack between gear teeth), wear-and-tear and fluid dynamics. Even very careful parameter fitting leaves such effects unmodelled. Introduction

Sensing and rendering. A renderer is the part of a simulator that draws camera images. Tobin et al. note that simulated sensors such as renderers miss the richness and noise of real ones. Zhao et al. add that realistic rendered images are hard to produce. Introduction §III-B

Delays. Real robots take time to sense and to act, so a command takes effect only some steps later. Kober et al. point out that most RL algorithms assume an action acts at once. Adding recent actions to the state restores that assumption, but makes the state larger. §3.2

Exploited quirks. Deep RL policies tend to exploit oddities of the simulator. The result can be behaviour that works in simulation but is impossible in the real world. §IV

Kober et al. also give a rule of thumb. Transfer often works for self-stabilising tasks, where damping absorbs small disturbances. It works poorly for unstable tasks such as balancing a pole. They add that approximate models stay useful for testing algorithms and for rehearsing a task before trying it for real. §3.3

Why a simulated score is optimistic

In ordinary machine learning you keep some data aside to detect overfitting, which means fitting the training data too closely. In sim-to-real the training data come from the simulator, but the test is the real world. If no real data are used in training, there are none to check against. §IV-B, footnote 2

Tobin et al. saw exactly this. Their object detectors had errors of 0.3–0.5 cm on simulated images but about 1.5 cm on real ones. §IV-B A held-out simulated set only catches overfitting to particular simulated samples. It cannot catch overfitting to the simulator itself.

Remedy 1: identify the system

System identification means estimating a model’s parameters from data recorded on the real system. §III-B The most common tool is least squares. The regression below is our own setup for the example later in this article.

θ^=arg⁡min⁡θ∑t(xt+1−φt⊤θ)2,φt=(xt,  ut−d)⊤, θ=(a,  b)⊤\hat\theta=\arg\min_{\theta}\sum_t\big(x_{t+1}-\varphi_t^{\top}\theta\big)^2,\qquad \varphi_t=(x_t,\;u_{t-d})^{\top},\ \theta=(a,\;b)^{\top}

In words: pick the parameters θ\theta whose one-step predictions φt⊤θ\varphi_t^\top\theta come closest to the recorded next states xt+1x_{t+1}. Here xtx_t is the state, and ut−du_{t-d} is the command that takes effect at step tt after a delay of dd steps. The unknown numbers to be fitted are aa and bb.

Tobin et al. call system identification time-consuming and error-prone. Introduction Its deeper limit is that it can only tune what the model contains. If the model has the wrong structure, for example no delay, the fit will be wrong. The example shows this.

A related idea is iterative learning control. Real runs improve the dynamics model, and the better model then improves the controller. §II-C

Remedy 2: randomize the simulator

Domain randomization trains on many randomized versions of the simulator instead of one. Tobin et al. state the hope plainly: with enough variety, the real world may look like just one more variation. Abstract Peng et al. write the training goal for randomized dynamics as follows. §IV

max⁡π  Eμ∼ρμ Eτ∼p(τ∣π,μ)[∑t=0T−1r(st,at)]\max_{\pi}\;\mathbb{E}_{\mu\sim\rho_\mu}\,\mathbb{E}_{\tau\sim p(\tau\mid\pi,\mu)}\Big[\sum_{t=0}^{T-1} r(s_t,a_t)\Big]

In words: find the policy π\pi with the highest total reward rr, averaged over many simulators. Each simulator’s physical parameters μ\mu (masses, friction and so on) are drawn from a distribution ρμ\rho_\mu. Inside each simulator it is also averaged over trajectories τ\tau, the sequences of states sts_t and actions ata_t over TT steps. Training on one simulator is the special case where ρμ\rho_\mu always picks the same μ\mu.

Peng et al. describe this as treating the difference between simulator and reality as variability inside the simulator. §II-B How to choose what to randomize, and how widely, is covered in domain randomization.

Remedy 3: give the policy memory

A policy without memory sees only the current state. The best it can do is be robust: one fixed behaviour that is acceptable across the whole training range. A policy with memory can look at how the robot has just responded and adjust to it.

Peng et al. use an LSTM, a type of neural network that carries an internal memory from step to step (see LSTM). They describe that memory as implicit system identification, learned end to end. The alternative would be a separate module that explicitly predicts parameters such as mass and friction. §IV-D

Remedy 4: adapt with real data

Domain adaptation assumes plenty of labelled data in a source domain, here the simulator. It assumes the same task and little or no data in the target domain, here the real robot. §II-C In RL terms, Zhao et al. describe source and target as sharing actions and roughly the transitions, with structurally similar rewards. Their observations can differ because simulated and real sensors differ. §III-D

Zhao et al. group the methods into discrepancy-based, adversarial and reconstruction-based ones. All of them aim at features that look the same in both domains. §III-D Peng et al. note that such methods still need real data during training, which domain randomization tries to avoid. §II-A Fine-tuning, which means continuing training on a small amount of real data, is the simplest version.

Zero-shot transfer and the wider map

Zero-shot transfer, also called direct transfer, means using the policy on the real robot without any further training. It needs a realistic enough simulator or enough simulated experience. §III-A In this article “zero-shot” always means “no training on the real robot”.

Zhao et al. also list meta-learning (learning how to adapt quickly), imitation learning and knowledge distillation, where a small “student” policy is trained to copy a larger “teacher”. Abstract, §II Imitation learning is covered in imitation learning, and learned dynamics models in model-based RL.

A toy system where the simulator is wrong

This section builds a tiny control problem whose answers can be computed exactly. A gain tuned in simulation fails on the “real” system, and two remedies fix it. Everything here is an original synthetic toy (numpy only, fixed seeds). It is not evidence about any real robot.

The plant, meaning the system being controlled, has one number as its state. Think of xx as how far a part is from where it should be. The policy is one feedback gain kk: push back in proportion to the error.

xt+1=a xt+b ut−d+wt,ut=−k xt,wt∼N(0,σ2)x_{t+1}=a\,x_t+b\,u_{t-d}+w_t,\qquad u_t=-k\,x_t,\qquad w_t\sim\mathcal N(0,\sigma^2)

In words: the next state is the drift aa times the current state, plus the actuator gain bb times the command sent dd steps earlier, plus random noise wtw_t. The noise has standard deviation σ\sigma, and the command utu_t pushes against the state with strength kk. We use a=1.2a=1.2, so without control the state grows by 20% per step. The noise is σ=0.05\sigma=0.05, the start x0x_0 is uniform between −1 and 1, and each episode lasts 60 steps.

The simulator has b=1.0b=1.0 and no delay (d=0d=0). The “real” plant has b=1.5b=1.5 and a one-step delay (d=1d=1). Its actuator is 50% stronger, and it has a delay the simulator does not model at all.

Each step costs min⁡(x2+0.1u2, 25)\min(x^2+0.1u^2,\,25). If ∣x∣|x| goes above 5 the episode fails, and every remaining step costs 25. The cost reported is the average per step, so 25 is the worst possible. Gains are searched on a grid of 0.01 from 0 to 2.

Stability can be checked exactly. A feedback loop like this is stable when all its poles, the roots of its characteristic polynomial, have size (modulus) below 1. The largest modulus is called the spectral radius. The conditions below are our own derivation from the standard Schur–Jury test, not taken from the sources. For feedback in general see PID control and LQR.

d=0: ∣a−bk∣<1;d=1: z2−a z+bk=0 stable  ⟺  ∣bk∣<1 and a−1<bkd=0:\ |a-bk|<1;\qquad d=1:\ z^2-a\,z+bk=0\ \text{stable}\iff |bk|<1\ \text{and}\ a-1<bk

In words: without delay the loop has a single pole, a−bka-bk, which must lie between −1 and 1. With a one-step delay it has two poles, the roots zz of the quadratic. With a=1.2a=1.2 both lie inside the unit circle exactly when 0.2<bk<10.2<bk<1. Without delay the allowed range is 0.2<bk<2.20.2<bk<2.2, so the delay shrinks the safe range of gains a lot.

import numpy as np

# Synthetic sim-to-real toy (not a real robot). Scalar plant
#   x[t+1] = a*x[t] + b*u[t-d] + w[t],  w ~ N(0, 0.05^2),  x[0] ~ U(-1, 1)
# Policy: u[t] = -k*x[t]. Episode: 60 steps. Step cost min(x^2 + 0.1*u^2, 25);
# if |x| > 5 the episode fails and every remaining step costs 25.
A_TRUE = 1.2
T = 60
SIGMA_W = 0.05
GAINS = np.round(np.arange(0.0, 2.001, 0.01), 2)


def rollout(k, a, b, d, n_ep, seed):
    rng = np.random.default_rng(seed)
    x = rng.uniform(-1.0, 1.0, n_ep)
    w = rng.normal(0.0, SIGMA_W, (T, n_ep))
    u_hist = np.zeros((2, n_ep))  # u[t-1], u[t-2]
    alive = np.ones(n_ep, dtype=bool)
    cost = np.zeros(n_ep)
    for t in range(T):
        u = -k * x
        applied = u if d == 0 else u_hist[0]
        step = np.minimum(x ** 2 + 0.1 * u ** 2, 25.0)
        cost += np.where(alive, step, 25.0)
        x = np.where(alive, a * x + b * applied + w[t], x)
        u_hist[1] = u_hist[0]
        u_hist[0] = u
        alive &= np.abs(x) <= 5.0
    return cost.mean() / T, 1.0 - alive.mean()


def spectral_radius(k, a, b, d):
    if d == 0:
        return abs(a - b * k)
    return max(abs(np.roots([1.0, -a, b * k])))


def tune(models, n_ep, seed):
    # models: list of (a, b, d, weight); pick the gain with the lowest weighted mean cost
    best = None
    for k in GAINS:
        c = sum(wt * rollout(k, a, b, d, n_ep, seed)[0] for a, b, d, wt in models)
        if best is None or c < best[1]:
            best = (k, c)
    return best


SIM = (A_TRUE, 1.0, 0)    # nominal simulator: b = 1, no delay
REAL = (A_TRUE, 1.5, 1)   # "real" plant: 50% stronger actuator, one-step delay

print("1) Gain tuned on the nominal simulator (b=1.0, d=0)")
k_nom, c_sim = tune([SIM + (1.0,)], 200, 1)
c_real, f_real = rollout(k_nom, *REAL, 1000, 2)
print(f"   k_nom = {k_nom:.2f}, sim cost = {c_sim:.4f}")
print(f"   real plant (b=1.5, d=1): cost = {c_real:.3f}, failure rate = {f_real:.3f}")
print(f"   spectral radius sim = {spectral_radius(k_nom, *SIM):.3f}, real = {spectral_radius(k_nom, *REAL):.3f}")

print("2) System identification from 5 real episodes (u = -0.4x + U(-0.3,0.3) excitation)")
rng = np.random.default_rng(3)
X, U = [], []
for ep in range(5):
    x = rng.uniform(-1.0, 1.0)
    u_prev = 0.0
    xs, us = [x], []
    for t in range(T):
        u = -0.4 * x + rng.uniform(-0.3, 0.3)
        x = A_TRUE * x + 1.5 * u_prev + rng.normal(0.0, SIGMA_W)
        u_prev = u
        us.append(u)
        xs.append(x)
    X.append(np.array(xs))
    U.append(np.array(us))
rows_nd, rows_d, ys_nd, ys_d = [], [], [], []
for xs, us in zip(X, U):
    for t in range(1, T):
        rows_nd.append([xs[t], us[t]])
        ys_nd.append(xs[t + 1])
        rows_d.append([xs[t], us[t - 1]])
        ys_d.append(xs[t + 1])
for name, rows, ys, d in [("no-delay model x' = a x + b u[t]  ", rows_nd, ys_nd, 0),
                          ("delay model    x' = a x + b u[t-1]", rows_d, ys_d, 1)]:
    M, y = np.array(rows), np.array(ys)
    theta, *_ = np.linalg.lstsq(M, y, rcond=None)
    resid = np.std(y - M @ theta)
    k_id, c_id = tune([(theta[0], theta[1], d, 1.0)], 200, 1)
    cr, fr = rollout(k_id, *REAL, 1000, 2)
    print(f"   {name}: a = {theta[0]:.3f}, b = {theta[1]:.3f}, residual std = {resid:.4f}")
    print(f"      tuned k = {k_id:.2f}, model cost = {c_id:.4f}, real cost = {cr:.3f}, "
          f"failure = {fr:.3f}, real spectral radius = {spectral_radius(k_id, *REAL):.3f}")

print("3) Gain tuned over randomized simulators (b in 0.5..2.0 log-spaced x d in {0,1})")
b_grid = np.exp(np.linspace(np.log(0.5), np.log(2.0), 5))
models = [(A_TRUE, b, d, 1.0 / 10) for b in b_grid for d in (0, 1)]
k_rob, c_rob = tune(models, 100, 1)
cr, fr = rollout(k_rob, *REAL, 1000, 2)
c_nomsim = rollout(k_rob, *SIM, 1000, 2)[0]
print(f"   b grid = {np.round(b_grid, 3).tolist()}")
print(f"   k_rand = {k_rob:.2f}, mean training cost = {c_rob:.4f}, nominal-sim cost = {c_nomsim:.4f}")
print(f"   real cost = {cr:.3f}, failure = {fr:.3f}, real spectral radius = {spectral_radius(k_rob, *REAL):.3f}")

print("4) Stable gain window on the real plant: 0.2/b < k < 1/b with b=1.5, d=1")
print(f"   window = ({0.2 / 1.5:.4f}, {1.0 / 1.5:.4f}); best real-plant gain by grid:")
k_star, c_star = tune([REAL + (1.0,)], 200, 1)
print(f"   k_real* = {k_star:.2f}, real cost = {rollout(k_star, *REAL, 1000, 2)[0]:.3f}")

The program prints:

1) Gain tuned on the nominal simulator (b=1.0, d=0)
   k_nom = 1.10, sim cost = 0.0086
   real plant (b=1.5, d=1): cost = 20.962, failure rate = 1.000
   spectral radius sim = 0.100, real = 1.285
2) System identification from 5 real episodes (u = -0.4x + U(-0.3,0.3) excitation)
   no-delay model x' = a x + b u[t]  : a = 0.782, b = 0.060, residual std = 0.3169
      tuned k = 0.99, model cost = 0.0174, real cost = 20.050, failure = 1.000, real spectral radius = 1.219
   delay model    x' = a x + b u[t-1]: a = 1.201, b = 1.495, residual std = 0.0465
      tuned k = 0.39, model cost = 0.0272, real cost = 0.029, failure = 0.000, real spectral radius = 0.765
3) Gain tuned over randomized simulators (b in 0.5..2.0 log-spaced x d in {0,1})
   b grid = [0.5, 0.707, 1.0, 1.414, 2.0]
   k_rand = 0.47, mean training cost = 0.0534, nominal-sim cost = 0.0172
   real cost = 0.032, failure = 0.000, real spectral radius = 0.840
4) Stable gain window on the real plant: 0.2/b < k < 1/b with b=1.5, d=1
   window = (0.1333, 0.6667); best real-plant gain by grid:
   k_real* = 0.38, real cost = 0.029

Here is the whole run in one table.

policykcost where it was tunedreal costreal failure ratereal spectral radius
tuned on the simulator1.100.008620.9621.0001.285
identified, no-delay model0.990.017420.0501.0001.219
identified, delay model0.390.02720.0290.0000.765
tuned over randomized simulators0.470.0534 (average)0.0320.0000.840
best gain on the real plant (reference)0.38—0.029——

Part 1: a great simulated score, a total real failure. The gain tuned on the simulator is k=1.10k=1.10, with simulated cost 0.0086. In the simulator its pole is 1.2−1.0×1.10=0.1001.2-1.0\times1.10=0.100, so errors shrink tenfold every step. On the real plant bk=1.5×1.10=1.65bk=1.5\times1.10=1.65. The quadratic z2−1.2z+1.65z^2-1.2z+1.65 has discriminant 1.44−6.6<01.44-6.6<0, so its two roots are complex with modulus 1.65=1.285\sqrt{1.65}=1.285. That is above 1, so the state swings back and forth with growing size. Every real episode fails (failure rate 1.000), and the cost of 20.962 is close to the maximum of 25. Nothing in the simulated score warned about this.

Part 2: system identification, wrong and right. We record 5 real episodes in which the command is u=−0.4xu=-0.4x plus a uniform random wiggle between −0.3 and 0.3. This wiggle is called an excitation signal; it makes the data informative about bb. The records give 5×59=2955\times59=295 regression rows.

First we fit a model with no delay. Least squares returns a=0.782a=0.782 and b=0.060b=0.060, with residual standard deviation 0.3169. A residual is what the model fails to explain, and here it is about six times the true noise of 0.05. The fit finds almost no effect of utu_t on xt+1x_{t+1}, because the real effect arrives one step later. The gain tuned on this model, k=0.99k=0.99, gives bk=1.485bk=1.485 on the real plant, poles of modulus 1.485=1.219\sqrt{1.485}=1.219, and failure in every episode.

Then we fit a model with a one-step delay. It returns a=1.201a=1.201 and b=1.495b=1.495, close to the true 1.2 and 1.5. The residual 0.0465 is close to the true noise 0.05. The tuned gain k=0.39k=0.39 gives modulus 1.5×0.39=0.585=0.765\sqrt{1.5\times0.39}=\sqrt{0.585}=0.765, real cost 0.029 and no failures. The lesson: identification fixes numbers inside the model, but not structure the model leaves out. A residual much larger than the expected noise is the warning sign.

Part 3: train across randomized simulators. Without identifying anything, we tune one gain over ten simulators. The actuator gain bb takes five log-spaced values, 0.5, 0.707, 1.0, 1.414 and 2.0, each with d=0d=0 and d=1d=1, weighted equally. This is a small discrete version of Peng et al.’s objective, with cost in place of reward. The range covers the real plant (1.5 lies between 0.5 and 2, and the delay is included), although 1.5 itself is not one of the grid points.

The chosen gain is k=0.47k=0.47, with average training cost 0.0534. On the real plant it costs 0.032 with no failures; its modulus is 1.5×0.47=0.705=0.840\sqrt{1.5\times0.47}=\sqrt{0.705}=0.840. On the original simulator it costs 0.0172, twice the 0.0086 of the simulator-tuned gain. That is the price of robustness in this toy: a cautious gain gives up some performance where the model is right, in exchange for working where it is wrong.

Part 4: the reference. On the real plant the stable gains are 0.2/1.5<k<1/1.50.2/1.5<k<1/1.5, that is between 0.1333 and 0.6667. The best gain found directly on the real plant is 0.38, with cost 0.029. Both the delay-aware identified gain (0.39) and the randomized gain (0.47) sit inside this window, close to the best real result.

This is a one-number linear toy whose behaviour we can compute exactly. Real robots have many parameters, nonlinear contact and sensors such as cameras. The example shows the logic of the gap and its remedies, not how large either is in practice.

What sim-to-real does not promise

This section lists the main limits of the remedies and of the evidence behind them.

No guarantee. Zhao et al. note that domain randomization is mostly studied by experiment and is hard to explain formally. They also note that most domain adaptation methods assume both domains share the same kind of features. §V Nothing in the sources guarantees that a policy will transfer.

Identification is only as good as the model. Fitting parameters cannot add effects the model lacks, as Part 2 shows. Kober et al. describe how small errors accumulate until simulated and real behaviour diverge. §3.3

Robustness costs something. A policy that must work over a wide range is usually more cautious where the simulator is right. In the toy this doubled the nominal cost. That ratio belongs to the toy, not to robots in general.

Simulated validation cannot see the gap. Without real data, overfitting to the simulator shows up only on the robot. §IV-B, footnote 2 Real testing remains necessary, and it carries its own safety questions; see robot safety and embodied evaluation.

Small real-world samples. Landmark results rest on few real trials: Peng et al. used 10 to 28 real trials per policy, and OpenAI’s Rubik’s cube results 10. Table II Table 6 Their success rates have wide uncertainty.

Terminology varies. Surveys do not use words such as “zero-shot” in one fixed way. Check what a paper means before comparing results.

The toy is a toy. It has one parameter, linear dynamics and exact answers. It cannot show visual gaps, contact, or how many real trials a method needs.

Exercises

These exercises test the main idea, a hand calculation, a counterexample about identification, method choice and reading evidence.

  1. Why can’t a sim-to-real pipeline simply keep a held-out validation set to detect overfitting, as in ordinary supervised learning?

    Answer: Validation data come from the training distribution. Here the training distribution is the simulator and the test is the real world. If no real data are used in training, there are none to validate on. Tobin et al. make this point and still saw 0.3–0.5 cm error in simulation against about 1.5 cm on real images. A held-out simulated set only detects overfitting to particular simulated samples, not to the simulator. In the example, the simulator-tuned gain has simulated cost 0.0086 and fails every real episode.

  2. For the toy with a=1.2a=1.2 and a one-step delay, compute the pole modulus for b=1.5b=1.5 with k=1.10k=1.10 and with k=0.39k=0.39. Which gains are stable for b=1.5b=1.5?

    Answer: The poles solve z2−1.2z+bk=0z^2-1.2z+bk=0. For k=1.10k=1.10: bk=1.65bk=1.65, the discriminant 1.44−6.61.44-6.6 is negative, so the roots are complex with ∣z∣2=bk|z|^2=bk and ∣z∣=1.65=1.285>1|z|=\sqrt{1.65}=1.285>1: unstable. For k=0.39k=0.39: bk=0.585bk=0.585, discriminant 1.44−2.34<01.44-2.34<0, ∣z∣=0.585=0.765<1|z|=\sqrt{0.585}=0.765<1: stable. The stable window is 0.2<bk<10.2<bk<1, so 0.1333<k<0.66670.1333<k<0.6667. All of these match the printed values.

  3. A colleague fits xt+1=a xt+b utx_{t+1}=a\,x_t+b\,u_t to real logs, gets a small bb, and concludes: “The real actuator is weak, so I should raise the gain.” Use the example to show what went wrong.

    Answer: The model leaves out the one-step delay, so utu_t hardly affects xt+1x_{t+1}; its effect arrives a step later. Least squares therefore gives b=0.060b=0.060 and pushes the dynamics into a=0.782a=0.782, with residual 0.3169 against a true noise of 0.05. That large residual is the warning sign. The gain tuned on this model, 0.99, makes the real loop unstable (spectral radius 1.219, failure rate 1.000). Refitting with ut−1u_{t-1} gives a=1.201a=1.201, b=1.495b=1.495, residual 0.0465 and a stable gain. Identification is only as good as the model structure.

  4. For each case, choose system identification, domain randomization, a policy with memory, or adaptation with real data, and justify the choice. (a) A known arm whose payload mass changes every time it picks something up. (b) A camera-based detector where real labelled images are expensive but rendering is cheap. (c) A simulator you can calibrate carefully once, for a self-stabilising task. (d) You already have a few hundred labelled real images.

    Answer: (a) The policy must work for many masses, so randomize mass during training. A policy with memory can also infer the current mass from recent motion. Peng et al.’s LSTM reached 0.89 real success against 0.67 for a feedforward (memoryless) policy trained with the same randomization, on 28 and 12 real trials. (b) Visual domain randomization of textures, lighting and camera pose; Tobin et al. reached about 1.5 cm real error without any real images of the task in training. (c) Careful identification and direct transfer may be enough, since Kober et al. report that self-stabilising tasks often transfer. Still check for unmodelled delays, as in exercise 3. (d) Domain adaptation or fine-tuning: Peng et al. note these methods need real data, and here you have some.

  5. A headline says: “OpenAI’s robot hand solved the Rubik’s cube 60% of the time.” Correct it.

    Answer: In Table 6 of the OpenAI paper, the best policy completed half of a fair scramble in 60% of 10 trials and the full scramble in 20%. Those runs used the Giiker cube, which has built-in sensors that report the face angles. With face angles from vision only, the same policy reached 20% for half and 0% for the full scramble. In these trials the hand started from a solved cube and applied one fixed fair-scramble sequence, which the authors treat as equivalent to solving. Solution sequences in general come from a standard solver (the Kociemba solver), so the learning covered sensing and control, not finding the solution. Ten trials is a small sample.

History and further reading

This section traces a few landmark results, with their numbers and caveats, and suggests what to read next.

An early precursor. Pomerleau’s ALVINN network, in the 1988 NIPS proceedings, learned to steer from images of roads. It was trained on 1200 simulated road images from an artificial road generator. It then drove the CMU NAVLAB test vehicle at 1/2 m/s along a 400 m wooded path in sunny autumn weather. ALVINN The broader story of learning to drive from examples belongs to behavior cloning.

Visual randomization, 2017. Tobin et al. trained an object detector only on simulated images with deliberately unrealistic random textures. On real images it located objects to about 1.5 cm on average. Paired with a motion planner on a Fetch robot, it picked the target object in 38 of 40 trials in clutter. Abstract, §IV-B, §IV-D The authors call it, to their knowledge, the first successful transfer to the real world, for robotic control, of a deep network trained only on simulated RGB images, without pre-training on real images. Abstract Most of their detectors did start from ImageNet weights, but random initialisation worked about as well. §III-B, §IV-C The “first” claim is hedged and narrow; it is not a claim to be the first sim-to-real result of any kind.

Dynamics randomization, 2018. Peng et al. trained a Fetch arm with seven joints to push a puck to a goal. The state had 52 numbers and the action 7. They randomized 95 physical parameters and used about 100 million simulated samples, roughly 8 hours on 100 cores. §IV-A–C, §V Their LSTM policy succeeded 0.91 ± 0.03 of the time in randomized simulation and 0.89 ± 0.06 on the real robot, over 28 real trials. A feedforward policy trained without randomization reached 0.51 ± 0.05 in randomized simulation and 0.0 on the robot, failing all 10 real trials. Table II They did little calibration: the same target trajectory produced clearly different joint motions on the simulated and real arms. §V, Fig. 5

Automatic randomization, 2019. OpenAI trained a robot hand with automatic domain randomization (ADR). ADR starts from a narrow range of simulated conditions and widens it while the policy keeps succeeding. §5 The details are in domain randomization. Two of their tables are easy to mix up, so we keep them apart.

Table 3 is about turning a block to target orientations. An earlier block policy, re-run on the current setup, scored a mean of 4.0 ± 1.7 successes instead of the 18.8 ± 5.4 reported before. The authors suggest the likely cause is that both the physical setup and the simulation had changed. A policy trained with hand-designed randomization scored 42.5 ± 0.7 in simulation but 2.7 ± 1.1 on the robot. The best ADR policy scored 46.7 ± 0.5 in simulation and 32.0 ± 6.4 on the robot. These used 500 simulated and 10 real trials. §8.1.2, Table 3

Table 6 is about the Rubik’s cube. The best policy averaged 26.8 ± 4.9 successes (face rotations plus cube flips) over 10 real trials. It completed half of a fair scramble in 60% of trials and the full scramble in 20%, using the sensor-equipped Giiker cube for face angles. With face angles from vision only, it averaged 12.8 ± 3.4 successes, with 20% half and 0% full. §8.4.1, Table 6 In these trials the hand turned a solved cube into one fixed fair scramble, 43 successes long, which the authors treat as equivalent to solving it. §8.4.1 In general the paper takes solution sequences from the Kociemba solver; the learning handles sensing and control. §2.2

A map of the field. Zhao et al.’s 2020 survey (arXiv version 2, 2021) organises methods into the families used in this article and lists open problems. These include the lack of theory for randomization, combining methods, and incremental-complexity and continual learning. §III, §V Kober et al.’s 2013 survey explains why robot learning is hard, including under-modelling and delays. §3.2–3.3

Where to go next. Read domain randomization for choosing ranges and for ADR. Curriculum learning explains the idea of growing difficulty that ADR uses. Robot dynamics covers the masses and torques that simulators model. Related topics include robot datasets and teleoperation.

Make a prediction, then check

Someone fits the delay-free model x′ = a x + b u to real logs and gets b = 0.060 with residual std 0.317 (noise is known to be about 0.05), and concludes the actuator is weak so the gain should go up. What is the most reasonable reading?

Choose one answer

Learning objectives

  • Explain what the reality gap is made of (parameter error, unmodelled effects, sensing and rendering differences, delays) and why a high score in simulation says nothing about real performance.
  • Compare system identification, domain randomization, memory-based policies and adaptation with real data, choose among them for a given case, and check with closed-loop poles whether a gain is stable on the real plant.

Prerequisites & connections

Explore related knowledge →

References

  1. Sim-to-Real Transfer in Deep Reinforcement Learning for Robotics: a Survey — arXiv v2, scoped
    Wenshuai Zhao; Jorge Peña Queralta; Tomi Westerlund · 2020
  2. Domain Randomization for Transferring Deep Neural Networks from Simulation to the Real World — arXiv v1, scoped
    Josh Tobin; Rachel Fong; Alex Ray; Jonas Schneider; Wojciech Zaremba; Pieter Abbeel · 2017
  3. Sim-to-Real Transfer of Robotic Control with Dynamics Randomization — arXiv v3, scoped
    Xue Bin Peng; Marcin Andrychowicz; Wojciech Zaremba; Pieter Abbeel · 2018
  4. Solving Rubik's Cube with a Robot Hand — arXiv v1, scoped
    OpenAI: Ilge Akkaya; Marcin Andrychowicz; Maciek Chociej; Mateusz Litwin; Bob McGrew; Arthur Petron; Alex Paino; Matthias Plappert; Glenn Powell; Raphael Ribas; Jonas Schneider; Nikolas Tezak; Jerry Tworek; Peter Welinder; Lilian Weng; Qiming Yuan; Wojciech Zaremba; Lei Zhang · 2019
  5. Reinforcement Learning in Robotics: A Survey — IJRR 2013 author copy, scoped
    Jens Kober; J. Andrew Bagnell; Jan Peters · 2013
  6. ALVINN: An Autonomous Land Vehicle in a Neural Network — NIPS 1988 proceedings
    Dean A. Pomerleau · 1988

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Claude · 2026-12-03 · Independent AI check (Claude subagent, not the author; not a human or expert review). No Gemini style pass was applied to this article (gemini-edits-016a.json has no entries for it), so I did the D012 readability pass on the intuition section and section openings myself in both languages before the factual check. Research was done by a separate research subagent (facts.md) and the prose by a writer subagent. I ran example.py with the pinned interpreter /private/tmp/claude-501/-Users-horacedong-Desktop-Github/7f85e552-8489-4a34-a544-f902fa3031c1/scratchpad/np126/bin/python (numpy 1.26.4) and diffed it against example.stdout.txt (identical); the python block in en.mdx and zh.mdx is byte-identical to example.py, and every number in the prose and summary table matches the output. I re-derived the Schur–Jury conditions (labelled as our derivation), the stable window 0.1333 < k < 0.6667, the pole moduli sqrt(1.65) = 1.285, sqrt(1.485) = 1.219, sqrt(0.585) = 0.765, sqrt(0.705) = 0.840, the simulator pole 0.100, 295 = 5 x 59 regression rows, the residual ratio of about six and the 0.0172/0.0086 ratio of two, and checked all exercise answers. I downloaded and read as extracted text the cited versions: Zhao et al. arXiv:2009.13303v2 (§II-C, §III-A–D, §IV-A, §V, §VI), Tobin et al. arXiv:1703.06907v1 (abstract, §I, §II-C, §III-A–B, §IV-B–D, Table II, footnotes 2 and 4), Peng et al. arXiv:1710.06537v3 (abstract, §II-A–B, §IV, §IV-C–E, §V incl. Tables I–III), OpenAI arXiv:1910.07113v1 PDF pp. 3–4 (§2.2), 10–12 (§5–5.3, Algorithms 1–2), 20–23 (§8.1.2 Table 3, §8.2, §8.4.1 Table 6), Kober et al. IJRR author copy pp. 25–26 (§3.2 end, §3.3) and Pomerleau's NIPS 1988 paper pp. 305–309. I confirmed Table 3 (block) and Table 6 (Rubik's cube) are kept apart, that 60%/20% are half/full scramble with the Giiker cube and 20%/0% vision only over 10 trials, that Tobin's 'first' claim keeps its 'to our knowledge' hedge and scope, that Peng's trial counts are stated, that no claim relies on Zhao's zero-shot/one-shot wording, and that nothing is cited from OpenAI §5.4, §6–7, §9 or appendices. I checked en/zh parity section by section, MDX safety, display-equation identity, citation definitions, that every internal link points to a published topic and that unpublished topics are inline code, and that no toy number from the domain-randomization example appears here. Not checked: published venues (IROS 2017, ICRA 2018, IEEE SSCI 2020), sections of the sources outside those listed, and the papers known only through citing works.

  • Re-ran the example with the pinned interpreter (output identical) and re-computed every quoted number, pole modulus, the stable window and the exercise answers.
  • OpenAI Table 3 (block) and Table 6 (Rubik's cube) are kept apart; 60%/20% are half/full scramble with the Giiker cube, 20%/0% vision only, over 10 trials.
  • Tobin's 'first' claim keeps its hedge and scope; Peng's real-trial counts are stated; nothing relies on Zhao's inconsistent zero-shot/one-shot wording.
  • Stability conditions are labelled as our derivation; en and zh match claim by claim; unpublished topics appear only as inline code.

Source locations checked:

  • Sim-to-Real Transfer in Deep Reinforcement Learning for Robotics: a Survey — arXiv v2, scoped · pdftotext of arXiv v2 (8 pp.). p. 1: abstract (five families), §I. p. 2: §I end, §II intro, Fig. 2, §II-A eq. (1), §II-B. p. 3: §II-C transfer learning/domain adaptation definition, §II-D–F, §III intro, §III-A zero-shot (and the 'one-shot' wording), §III-B system identification (temperature, humidity, wear), §III-C start. p. 5: §III-C visual vs dynamics randomization, §III-D domain adaptation (source/target MDP tuple, three method families), §III-E, §III-F simulators. p. 6: Fig. 3, §IV-A (Matas et al.: excessive randomization detrimental — secondary), §IV-B, §IV-C, §V challenges. p. 7: §VI conclusion. Table I (p. 4) skimmed only; scrambled extraction, not cited. NOT read: references beyond spot checks; venue not verified. Checker note (2026-12-03): §II-C p. 3 says 'without or very few target domain data' (not 'labelled'); §V p. 6 lists integration of methods and incremental complexity/continual learning/reward shaping (curriculum learning is mentioned in §IV-B, not §V).
  • Domain Randomization for Transferring Deep Neural Networks from Simulation to the Real World — arXiv v1, scoped · pdftotext of arXiv v1. p. 1: abstract (1.5 cm, 'to our knowledge' first claim), §I (sample needs, system identification time-consuming and error-prone, unmodelled effects, reality gap, hypothesis). p. 2: §I end, §II-A–C. p. 3: §II-C end (iterative learning control; Mordatch, Antonova, Yu, Rajeswaran as summarised), Sadeghi & Levine comparison, §III-A randomized aspects. p. 4: camera box 10×5×10 cm, 0.1 rad, 5% FOV; §III-B model; §IV-A; Table I. p. 5: §IV-B (480 real images, 1.5 cm, sim error 0.3–0.5 cm, footnote 2 no real validation), §IV-C ablation text, Figs 4–5. p. 6: Table II, §IV-D (38/40 grasps, Spam 9/10), §V. NOT read: references pp. 6–8; venue not verified. Checker added (2026-12-03): §III-B p. 4 says most experiments initialised the convolutional layers from ImageNet weights and random initialisation worked as well in most cases; used to qualify the 'no real images' wording.
  • Sim-to-Real Transfer of Robotic Control with Dynamics Randomization — arXiv v3, scoped · pdftotext of arXiv v3. p. 1: abstract, §I, §II-A start. p. 2: §II-A end (adaptation methods need target data), §II-B domain randomization, §II-C, §III. p. 3: return and trajectory likelihood, HER, §IV objective over rho_mu ('exploiting idiosyncrasies'). p. 4: §IV-A task, §IV-B 52-D state / 7-D action, §IV-C list of randomized quantities (95 parameters), §IV-D adaptive policy (implicit SysID via LSTM memory), §IV-E RDPG and omniscient critic. p. 5: Algorithm 1, §IV-F architecture, §V setup (0.002 s sim step, 20 per control step, 100-step episodes), Table I ranges. p. 6: noise 5% of running std, action noise 0.01 rad, 0.2 kg puck, 0.07 m goal, 200-step real episodes, little calibration and Fig. 5, Adam 5e-4, 128 episodes per batch, HER k = 0.8, ~8000 iterations, ~100 million samples, ~8 h on 100 cores, §V-A. p. 7: Table II, §V-B ablation and Table III, §V-C robustness (0.91 ± 0.04 with chips packet), §VI. NOT read: references; venue not verified. Exercise 4 also uses Table II p. 7 row 'FF' (memoryless feedforward policy trained with randomization): 0.67 ± 0.14 real success over 12 trials (sim 0.83 ± 0.04); re-checked by the independent checker on 2026-12-03.
  • Solving Rubik's Cube with a Robot Hand — arXiv v1, scoped · pdftotext of arXiv v1 (51 pp.), PDF page numbers. pp. 1–3: abstract, Figs 1–2, §1, §2.1. p. 4: §2.2 fair scramble, Kociemba solver produces the move sequence ('sensing and control, not finding the solution'). p. 10: §5 intro (manual DR needed tuning and a tight sim–robot loop; meta-learning hypothesis), §5.1. p. 11: §5.1 benefits, thresholds, §5.2 algorithm and entropy H = (1/d) Σ log(φH − φL), boundary sampling, p_b. p. 12: Algorithms 1–2, §5.3, initial φ from calibration (policy) or zero (vision). p. 20: §8.1.2, Table 3 (baseline 18.8 ± 5.4 vs re-run 4.0 ± 1.7; Manual DR 42.5 sim / 2.7 real; ADR XXL 46.7 / 32.0). p. 21: §8.1.2 end, §8.2 and Fig. 16. p. 23: Table 6 (ADR XXL with Giiker 26.8 ± 4.9, 60%/20%; with vision 12.8 ± 3.4, 20%/0%), §8.4.1 text (43 successes = 26 rotations + 17 flips, 10 trials, 1600 timesteps = 128 s). NOT read: §3–4, §5.4, §6–7, §8.1.1, §8.3 tables, §9–11, appendices. Checker added (2026-12-03): p. 23 §8.4.1 says the Table 6 trials start from a solved cube and apply one fixed fair-scramble sequence (from the WCA TNoodle app), treated as equivalent to solving; the Kociemba solver (p. 4 §2.2) is the general source of solution sequences, not of the Table 6 sequence. p. 20 wording on the re-run baseline is 'presumably' (hedge kept).
  • Reinforcement Learning in Robotics: A Survey — IJRR 2013 author copy, scoped · Author copy, PDF pp. 25–26 (printed 25–26) re-read for this topic: end of §3.2 (500 Hz–3 kHz control rates, sensing/actuation delays, Markov violation, adding recent actions to the state) and all of §3.3 (under-modelling errors accumulate; Atkeson 1994 swing-up; self-stabilising tasks transfer well; ball-paddling example; pole balancing transfers poorly; roles of approximate models). Nothing else read for this topic.
  • ALVINN: An Autonomous Land Vehicle in a Neural Network — NIPS 1988 proceedings · NeurIPS proceedings PDF, pp. 305–313, read in full. For this topic: p. 305 abstract ('Training has been conducted using simulated road images'); pp. 307–308 simulated road generator, 1200 snapshots, 40 epochs, ~90% within two units on novel simulated images; pp. 308–309 NAVLAB 1/2 m/s along a 400 m wooded path in sunny fall conditions.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.