Domain randomization: training on many imperfect simulators
领域随机化
How visual and dynamics randomization train a policy on a distribution of simulators instead of one, what published ablations say about what to randomize, how automatic domain randomization widens ranges and measures them with entropy, and a synthetic toy showing why wider is not always better.
domain-randomizationIf you cannot copy reality, vary the copy
Domain randomization means training a robot’s behaviour in many randomly varied versions of a simulator, instead of in one carefully tuned simulator. If the behaviour works across all those versions, the real world may look like just one more version. The method needs no real training data. A 2020 survey reports it as the most widely used way to move a policy from simulation to a real robot. Hypothesis Most widely used
A first example. Tobin et al. wanted a camera-based detector that finds an object on a table for a robot to grasp. They did not try to make realistic images. Instead they rendered scenes with random colours, checker patterns, random lights, random camera positions and random extra objects. No real photo of the table scene was used in training. On real photos the detector still located objects to about 1.5 cm on average. Abstract
A few terms. A simulator is a program that imitates the robot and its world. A policy is the rule that turns what the robot senses into what it does. The reality gap is the difference between the simulator and the real world, the problem covered in sim-to-real transfer. The “domain” in the name means the setting the data come from: simulated or real.
There are two main kinds. Visual randomization varies how the scene looks: textures, lighting, camera position. It is used for perception, such as detecting objects. Dynamics randomization varies how the world moves: masses, friction, motor strength, delays. It is used for control. Visual vs dynamics
Domain randomization is not the same as ordinary image augmentation. Augmentation edits existing images, for example by cropping or changing colours (see visual data augmentation). Domain randomization changes the settings of the program that generates the data, such as where the lights are or how heavy a link is. The two can be combined.
It also differs from system identification, which tries to measure the real parameters so that one simulator matches the robot. Domain randomization accepts an imperfect simulator and spreads training across the uncertainty instead. Introduction Variability in the source domain
This article explains the training goal, what to randomize and how widely, and automatic domain randomization (ADR), which widens ranges by itself. A small synthetic example then shows two traps: randomizing the wrong thing, and randomizing too widely for a policy without memory.
The goal, the choices, and automatic widening
This section writes down what domain randomization optimises, lists what published work randomized, explains why memory matters, and describes ADR.
The training goal
Peng et al. give the goal for randomized dynamics. The simulator gets parameters , such as masses and friction, and the policy is trained to do well on average over a distribution of them. §IV
In words: choose the policy with the highest total reward . The reward is averaged first over trajectories (sequences of states and actions over steps) in one simulator. It is then averaged over simulators whose parameters are drawn from the distribution . A single simulator is the special case where always returns the same .
The distribution is the main design choice. It says which parameters vary and over what range. Everything below is about choosing it.
Visual randomization: what Tobin et al. varied
For every training image, Tobin et al. randomized many aspects of the scene. §III-A
- the number and shape of distractor objects, meaning extra objects that are not the target;
- the position and texture of every object;
- the textures of the table, floor, skybox (the backdrop around the scene) and robot;
- the camera’s position, orientation and field of view;
- the number of lights, and their position, orientation and specular characteristics, which shape the shiny highlights in the image;
- the type and amount of image noise.
Textures were a random colour, a gradient between two random colours, or a checker pattern. So the detector never learned the target’s real colour, only its size and shape. They rendered with MuJoCo’s non-photorealistic renderer. §III-A The camera moved inside a 10 × 5 × 10 cm box around a chosen viewpoint. Its angle shifted by up to 0.1 rad, and its field of view was scaled by up to 5%. Between 0 and 10 distractors were placed on the table. §III-A
Earlier work by Sadeghi and Levine, as Tobin et al. describe it, used about 200 mostly realistic materials. Tobin et al. instead used only unrealistic, procedurally generated textures, which allowed hundreds of thousands of different texturings. §II-C
Dynamics randomization: what Peng et al. varied
Peng et al. trained a robot arm to push a puck and randomized 95 simulator parameters. These were the mass of each link, the damping of each joint, and the puck’s mass, friction and damping. They also included the table height, the position-controller gains, the time between actions, and observation noise. §IV-C Damping is resistance that slows motion; observation noise is random error added to what the policy senses.
Their ranges were wide. Link masses went from 0.25 to 4 times the default and joint damping from 0.2 to 20 times. Puck friction went from 0.1 to 5, and controller gains from 0.5 to 2 times the default. Table I Masses, damping, friction and gains were sampled on a log scale. §V, Table I
In words: draw the logarithm of the parameter uniformly between and . This makes “half as heavy” and “twice as heavy” equally likely, which suits quantities that act as scale factors. For link mass, a value between 0.25 and 0.5 times the default is as likely as one between 2 and 4 times.
Most parameters were drawn once per episode and then held fixed. Two changed at every step. §IV-C The time between actions was plus an exponential random delay, with s and rate between 125 and 1000 per second; itself is drawn once per episode. §V, Table I The mean extra delay is , so between s = 1 ms and s = 8 ms (our arithmetic). Observation noise had a standard deviation of 5% of each feature’s running standard deviation. §V
Why memory matters
A policy without memory sees only the current state. Across a randomized family, the best it can do is be robust: one fixed behaviour that is acceptable for every member. A policy with memory can watch how the robot has just responded and adjust to the member it is actually in. §II-B, §IV-D
Peng et al. used an LSTM, a neural network that carries an internal state from step to step (see LSTM). During training only, they also gave the critic, the part that scores actions, the true parameters . They call this an “omniscient critic”. The policy itself never sees . §IV-E
A one-line model of “too wide”
A small calculation shows why a policy without memory cannot cover any range. It uses the toy plant from the example below. This derivation is ours, not from the sources.
In words: a state that grows by 20% per step on its own is pushed back by a command of strength . The command acts through an actuator gain and arrives steps late, and is small random noise. The policy is the single number .
With a one-step delay and drift , the loop is stable only when (a standard Schur–Jury result; without delay the condition is looser). One fixed must satisfy this for every in the training range.
In words: the smallest actuator gain sets a lower limit on , and the largest sets an upper limit. A valid exists only if the range ratio is below . With the ratio must be below 5. Beyond that, a memoryless policy must fail somewhere in its own training range.
Automatic domain randomization
Hand-designed randomization needs a lot of tuning. In OpenAI’s earlier work it required a tight loop between designing ranges in simulation and testing on the robot. Automatic domain randomization (ADR) automates this and widens the ranges gradually. §5
ADR starts with a distribution concentrated on a single environment. For their policy this was values calibrated on the robot; for their vision model it was no randomization at all. It widens the distribution while the model’s performance stays acceptable. §5.1, §5.3 Because it only generates training data, it can be used with any training algorithm. §5.3
The authors list two benefits over hand-designed ranges. The first is a curriculum: the model masters easy environments before harder ones are added (see curriculum learning). The second is that nobody has to tune the ranges by hand. §5.1
Each environment has randomized parameters . Each parameter is drawn uniformly between a lower bound and an upper bound . §5.2
In words: the left part says every parameter is drawn independently and uniformly from its own range. The right part, the entropy , is the average over parameters of the logarithm of each range’s width. It is measured in nats per dimension (npd), and a larger value means wider ranges. Widths below 1 give negative logarithms, so the entropy can be negative.
The update works one bound at a time. §5.2, Algorithms 1–2
- Pick one parameter and one of its two bounds. Fix that parameter at the bound and draw the others as usual. This is called boundary sampling.
- Run the model and record its performance in a buffer for that bound.
- When the buffer holds enough results, compare their average with two thresholds, a low one and a high one.
- If the average is at or above the high threshold, move the bound outward by a fixed step, which widens the range. If it is at or below the low threshold, move it inward, which narrows the range.
Algorithm 1 writes this update as adding or subtracting a step . We describe its intended effect in words, following §5.1: the distribution grows while performance stays acceptable. §5.1–5.2
Each worker runs this evaluation only with a probability ; otherwise it generates training data from the current distribution. §5.2–5.3 “Acceptable performance” was a range of successes per episode for the policy and a share of accurate predictions for the vision model. §5.1
The authors’ hypothesis is that a very diverse distribution forces a model with memory to learn to adapt during deployment. With limited capacity it cannot memorise a separate solution for every environment, so it learns to adjust instead. They call this emergent meta-learning. §5 They test this idea in a later section, which we did not read.
A toy where wider is not always better
This section runs the toy plant above to show three things. Randomizing the missing factor matters most. A test without failures can hide instability. And an automatic widening loop can drift away from the real system. Everything is an original synthetic toy (numpy only, fixed seeds). It has one parameter and an exactly computable answer, so it is not evidence about any real robot.
The setup uses the plant equation above with Gaussian noise of standard deviation 0.05 and a start uniform between −1 and 1. Each episode has 60 steps. A step costs ; if goes above 5 the episode fails and every remaining step costs 25. Costs are averages per step.
The “real” plant has and a one-step delay. The trainer never sees it. It only sees simulators with randomized and, in some runs, randomized delay (0 or 1). Training picks the gain on a grid of 0.01 from 0 to 1.5 with the lowest average cost over the training simulators. A held-out test family of 2000 random plants, with log-uniform between 0.25 and 4 and random delay, measures how widely each gain works.
import numpy as np
# Synthetic domain-randomization toy (not a real robot). Scalar plant
# x[t+1] = 1.2*x[t] + b*u[t-d] + w[t], w ~ N(0, 0.05^2), x[0] ~ U(-1, 1)
# Static policy u[t] = -k*x[t]. Episode: 60 steps. Step cost min(x^2 + 0.1*u^2, 25);
# |x| > 5 is a failure and every remaining step costs 25.
# Randomized parameters: actuator gain b and delay d (0 or 1 step).
A = 1.2
T = 60
GAINS = np.round(np.arange(0.0, 1.501, 0.01), 2)
def rollout(gains, b, d, n_ep, seed):
gains = np.atleast_1d(np.asarray(gains, dtype=float))[:, None]
rng = np.random.default_rng(seed)
x0 = rng.uniform(-1.0, 1.0, n_ep)
w = rng.normal(0.0, 0.05, (T, n_ep))
x = np.repeat(x0[None, :], gains.shape[0], axis=0)
u_prev = np.zeros_like(x)
alive = np.ones_like(x, dtype=bool)
cost = np.zeros_like(x)
for t in range(T):
u = -gains * x
applied = u if d == 0 else u_prev
cost += np.where(alive, np.minimum(x ** 2 + 0.1 * u ** 2, 25.0), 25.0)
x = np.where(alive, A * x + b * applied + w[t], x)
u_prev = u
alive &= np.abs(x) <= 5.0
per_step = cost / T
return per_step, alive # shapes (gains, episodes)
def train(b_values, d_values, n_ep=40, seed=11):
total = np.zeros(GAINS.size)
for b in b_values:
for d in d_values:
total += rollout(GAINS, b, d, n_ep, seed)[0].mean(axis=1)
total /= len(b_values) * len(d_values)
i = int(np.argmin(total))
return GAINS[i], total[i]
def evaluate(k, b, d, n_ep=500, seed=12):
c, alive = rollout([k], b, d, n_ep, seed)
return c.mean(), 1.0 - alive.mean()
def stable(k, b, d):
if d == 0:
return abs(A - b * k) < 1.0
return max(abs(np.roots([1.0, -A, b * k]))) < 1.0
REAL = (1.5, 1) # the deployment plant, unknown to the trainer
rng = np.random.default_rng(99)
test_b = np.exp(rng.uniform(np.log(0.25), np.log(4.0), 2000))
test_d = rng.integers(0, 2, 2000)
print("1) Width sweep: b log-uniform in [1/w, w] (5 grid points), around nominal b = 1")
print(" w delays k nominal cost real cost real fail stable share of test family")
for w in (1.0, 1.5, 2.0, 3.0, 4.0, 6.0):
b_vals = np.exp(np.linspace(-np.log(w), np.log(w), 5)) if w > 1 else [1.0]
for d_vals, tag in (((0,), "d=0 "), ((0, 1), "d=0,1 ")):
k, _ = train(b_vals, d_vals)
cn = evaluate(k, 1.0, 0)[0]
cr, fr = evaluate(k, *REAL)
share = np.mean([stable(k, b, d) for b, d in zip(test_b, test_d)])
print(f" {w:<5.1f} {tag} {k:.2f} {cn:.4f} {cr:8.3f} {fr:.3f} {share:.3f}")
print("2) Feasibility: with d=1 a static gain is stable only if 0.2/b < k < 1/b")
for lo, hi in ((0.5, 2.0), (0.25, 4.0)):
print(f" b in [{lo}, {hi}]: need k > {0.2 / lo:.3f} and k < {1.0 / hi:.3f} -> "
f"{'feasible' if 0.2 / lo < 1.0 / hi else 'no single static gain'}")
print("3) Automatic domain randomization on b (uniform U(bL, bH)), delays d in {0,1}")
# Boundary sampling: evaluate 20 episodes with b pinned at one bound; widen that bound by
# 0.05 if the success rate >= 0.9, narrow it by 0.05 if <= 0.6. Success: no failure and
# per-step cost < 0.06. After each update the gain is retrained on 3 points of the range.
bL, bH = 1.0, 1.0
k, _ = train([1.0], (0, 1))
rng_adr = np.random.default_rng(5)
log = []
for it in range(300):
side = rng_adr.integers(0, 2)
b_test = bL if side == 0 else bH
d_test = int(rng_adr.integers(0, 2))
c, alive = rollout([k], b_test, d_test, 20, 1000 + it)
succ = np.mean(alive[0] & (c[0] < 0.06))
if succ >= 0.9:
if side == 0:
bL = max(0.05, round(bL - 0.05, 2))
else:
bH = round(bH + 0.05, 2)
elif succ <= 0.6:
if side == 0:
bL = min(round(bL + 0.05, 2), bH)
else:
bH = max(round(bH - 0.05, 2), bL)
k, _ = train(np.linspace(bL, bH, 3), (0, 1), n_ep=20)
if (it + 1) % 50 == 0:
ent = np.log(bH - bL) if bH > bL else float("-inf")
log.append((it + 1, bL, bH, k, ent))
for it, lo, hi, kk, ent in log:
print(f" iter {it:3d}: b range [{lo:.2f}, {hi:.2f}], k = {kk:.2f}, entropy log(bH-bL) = {ent:.3f} nats")
cr, fr = evaluate(k, *REAL)
print(f" final gain on real plant (b=1.5, d=1): cost = {cr:.3f}, failure = {fr:.3f}, "
f"real b inside final range: {bL <= 1.5 <= bH}")
The program prints:
1) Width sweep: b log-uniform in [1/w, w] (5 grid points), around nominal b = 1
w delays k nominal cost real cost real fail stable share of test family
1.0 d=0 1.09 0.0096 20.967 1.000 0.591
1.0 d=0,1 0.61 0.0134 0.083 0.000 0.722
1.5 d=0 1.01 0.0097 20.347 1.000 0.618
1.5 d=0,1 0.55 0.0150 0.047 0.000 0.717
2.0 d=0 0.88 0.0101 18.383 1.000 0.666
2.0 d=0,1 0.47 0.0184 0.033 0.000 0.695
3.0 d=0 0.69 0.0119 1.052 0.000 0.712
3.0 d=0,1 0.58 0.0141 0.059 0.000 0.718
4.0 d=0 0.55 0.0150 0.047 0.000 0.717
4.0 d=0,1 0.52 0.0161 0.040 0.000 0.712
6.0 d=0 0.36 0.0286 0.031 0.000 0.653
6.0 d=0,1 0.37 0.0271 0.030 0.000 0.658
2) Feasibility: with d=1 a static gain is stable only if 0.2/b < k < 1/b
b in [0.5, 2.0]: need k > 0.400 and k < 0.500 -> feasible
b in [0.25, 4.0]: need k > 0.800 and k < 0.250 -> no single static gain
3) Automatic domain randomization on b (uniform U(bL, bH)), delays d in {0,1}
iter 50: b range [0.55, 1.70], k = 0.52, entropy log(bH-bL) = 0.140 nats
iter 100: b range [0.85, 2.25], k = 0.38, entropy log(bH-bL) = 0.336 nats
iter 150: b range [1.15, 2.90], k = 0.29, entropy log(bH-bL) = 0.560 nats
iter 200: b range [1.20, 3.30], k = 0.26, entropy log(bH-bL) = 0.742 nats
iter 250: b range [1.45, 4.15], k = 0.21, entropy log(bH-bL) = 0.993 nats
iter 300: b range [1.65, 4.50], k = 0.19, entropy log(bH-bL) = 1.047 nats
final gain on real plant (b=1.5, d=1): cost = 0.070, failure = 0.000, real b inside final range: False
Part 1: how wide, and wide in what?
Each row trains on five log-spaced values of between and , either without delay or with both delays. “Nominal cost” is the cost on the plain simulator (, no delay).
| w | delays trained | k | nominal cost | real cost | real failure rate | stable share of test family |
|---|---|---|---|---|---|---|
| 1.0 | 0 only | 1.09 | 0.0096 | 20.967 | 1.000 | 0.591 |
| 1.0 | 0 and 1 | 0.61 | 0.0134 | 0.083 | 0.000 | 0.722 |
| 1.5 | 0 only | 1.01 | 0.0097 | 20.347 | 1.000 | 0.618 |
| 1.5 | 0 and 1 | 0.55 | 0.0150 | 0.047 | 0.000 | 0.717 |
| 2.0 | 0 only | 0.88 | 0.0101 | 18.383 | 1.000 | 0.666 |
| 2.0 | 0 and 1 | 0.47 | 0.0184 | 0.033 | 0.000 | 0.695 |
| 3.0 | 0 only | 0.69 | 0.0119 | 1.052 | 0.000 | 0.712 |
| 3.0 | 0 and 1 | 0.58 | 0.0141 | 0.059 | 0.000 | 0.718 |
| 4.0 | 0 only | 0.55 | 0.0150 | 0.047 | 0.000 | 0.717 |
| 4.0 | 0 and 1 | 0.52 | 0.0161 | 0.040 | 0.000 | 0.712 |
| 6.0 | 0 only | 0.36 | 0.0286 | 0.031 | 0.000 | 0.653 |
| 6.0 | 0 and 1 | 0.37 | 0.0271 | 0.030 | 0.000 | 0.658 |
Randomize the missing factor first. The real plant’s delay is what the plain simulator lacks. Adding delay to training, even with no spread in (), already transfers: real cost 0.083 and no failures. Spreading by a factor of 2 without delay still fails every real episode (cost 18.383).
Transfer by accident. Wide ranges without delay can still work on the real plant, because they force a cautious gain. At without delay the gain is 0.55 and the real cost 0.047. That is robustness through caution, not because the delay was modelled. The row is identical to with delays because the chosen gain is the same, and every number depends only on the gain.
No failures is not the same as stable. The row without delay needs care. Its gain is 0.69, and on the real plant . That is above 1, so by the stability condition the delayed loop is unstable. The poles are complex with modulus , so the swings grow by about 1.7% per step. Over 60 steps that is a factor of about (our arithmetic). Starting from , the state does not reach the failure threshold of 5 within the episode, so the failure rate is 0.000. But the cost is 1.052, about 35 times the 0.030 of the best row, and a long enough episode would cross the threshold. A short test that shows no failures can hide a slowly growing instability.
Width has a price. The nominal cost rises from 0.0096 at to 0.0286 and 0.0271 at , about three times higher. Wider training makes the gain more cautious, which costs performance where the simulator is right.
No single gain covers everything. The share of the wide test family that a gain stabilises never goes above 0.722, and it falls again to about 0.65 at . The test family spans from 0.25 to 4, a ratio of 16, far above the limit of 5 from the feasibility condition.
Part 2: feasibility
The second block of output applies the feasibility condition with a delay. For between 0.5 and 2, the gain needs and , which is possible. For between 0.25 and 4, it needs and , which is impossible. No single fixed gain works. This is one reason Peng et al. and OpenAI used policies with memory.
Part 3: a simplified ADR loop
The last block runs our own one-parameter version of ADR on . This is not OpenAI’s implementation. The range starts at the single value . Each iteration picks the lower or upper bound and runs 20 episodes with fixed there and a random delay. An episode counts as a success when it does not fail and its cost per step is below 0.06. If at least 90% succeed, that bound moves outward by 0.05; if 60% or fewer succeed, it moves inward by 0.05. The gain is then retrained on three points of the current range.
| iteration | range of b | k | entropy (nats) |
|---|---|---|---|
| 50 | 0.55 to 1.70 | 0.52 | 0.140 |
| 100 | 0.85 to 2.25 | 0.38 | 0.336 |
| 150 | 1.15 to 2.90 | 0.29 | 0.560 |
| 200 | 1.20 to 3.30 | 0.26 | 0.742 |
| 250 | 1.45 to 4.15 | 0.21 | 0.993 |
| 300 | 1.65 to 4.50 | 0.19 | 1.047 |
With one parameter, the entropy is just the log of the range width: at iteration 50 and at iteration 300. The entropy rises steadily, but the range slides upward. Each widening at the top forces a smaller gain. That gain is too weak at the bottom of the range, where it misses the cost target, so the lower bound retreats.
By iteration 300 the range no longer contains the real value . The final gain 0.19 still works on the real plant, with cost 0.070 and no failures. By our calculation is just above the stability limit of 0.2. The roots of are real, about 0.874 and 0.326, so the plant settles slowly. Its cost is more than twice that of the best gains in Part 1.
The ratio of the final bounds is , well under the feasibility limit of 5, because our success test also demands low cost. The lesson is that entropy measures width, not whether the range still covers the system you will deploy on. This result belongs to our toy and our thresholds, and says nothing about OpenAI’s system, which used memory-based policies and many parameters.
What domain randomization does not guarantee
This section lists the limits that the sources and the toy point to.
No theory of when it works. Zhao et al. note that randomizations are mostly chosen by experiment, and that it is hard to explain formally how and why domain randomization works. That makes it hard to design simulations and ranges. §V
Wider is not automatically better. Zhao et al. report a finding by Matas et al. that too much randomization, too many colours per texture, made a real robot perform significantly worse. We know this only through Zhao et al. §IV-A OpenAI found that fixed wide ranges trained more slowly than ADR (see the evidence section). The toy shows that a policy without memory cannot cover a range that is too wide.
The real system may be outside the range. Nothing guarantees that the real parameters lie inside the training distribution, or that the simulator can express every real effect. An automatic loop can even drift away from the real values, as in Part 3.
Validation in simulation cannot see the gap. Without real data there is no real validation set, so overfitting to the simulator shows up only at deployment. §IV-B, footnote 2 Ablations that decide what to randomize have to be run on the real system. Testing on hardware has its own safety questions; see robot safety and embodied evaluation.
Short tests hide slow failures. A run without failures can still be unstable, as the row shows. Check stability margins where possible, or test for longer.
Small real samples. The ablations in the sources rest on 12 to 28 real trials per setting (Peng et al.) and 10 (OpenAI). Their differences are informative but uncertain.
The toy is a toy. One parameter, linear dynamics, a fixed gain and our own thresholds. It shows mechanisms, not sizes.
Exercises
These exercises cover the core idea, a hand calculation, a counterexample about testing, method choice and reading evidence.
-
What is the difference between domain randomization and system identification? Can they be combined?
Answer: System identification tries to make one simulator match the real system by estimating its parameters; Tobin et al. call it time-consuming and error-prone. Domain randomization keeps the simulator imperfect and trains across a distribution of parameters, hoping the real system is one of them. They combine naturally. Identification can set the centre of the distribution; ADR starts from values calibrated on the robot. Randomization then covers the remaining uncertainty. In the example, a range that includes the delay transfers even with no spread in .
-
Toy plant with and a one-step delay. (a) For between 0.5 and 2.0, which fixed gains are stable for every ? (b) Repeat for between 0.25 and 4.0. (c) Compute the ADR entropy of one parameter with range 0.55 to 1.70, and with range 1.65 to 4.50.
Answer: Stability needs for every . (a) The smallest gives ; the largest gives . So . (b) and : impossible. (c) and nats. The second entropy is larger, but that range does not contain the real .
-
“Our randomized policy never failed in 60-step tests on the real plant, so it is stable.” Use the row without delay to answer.
Answer: That gain is . On the real plant , so the poles have modulus and the state grows slowly. In 60 steps it does not reach the failure threshold (failure rate 0.000), but its cost is 1.052, far above the 0.030–0.083 of the stable rows. A long enough episode would fail. Short tests and success counts can hide slow instability, so check the margin or test longer.
-
You train a camera-based detector with visual randomization and a pushing policy with dynamics randomization. For each, which randomization would you test first by ablation, and what kind of policy would you consider? Use the published evidence.
Answer: Detector: distractors and the number of textures. Removing distractors from training raised real error with distractors from 1.8 to 7.2 cm (Tobin et al., Table II, 20,000 training images). Fewer than 1,000 textures degraded performance (Fig. 5, 10,000 training images). Camera randomization helped less, and image noise barely mattered. Pushing policy: latency and observation noise. Fixing the action time step or removing observation noise cut real success from 0.89 to 0.29 and 0.25 (Peng et al., Table III, 17 and 12 trials). Also consider a policy with memory: the LSTM reached 0.89 against 0.67 for a feedforward policy (Table II, 28 and 12 trials). Run the ablations on the real system, because simulated validation cannot show the gap.
-
“OpenAI showed that higher ADR entropy causes better real-world transfer.” Is that what their block-reorientation table (Table 3) shows?
Answer: Not quite. In Table 3, ADR policies with higher entropy (−0.881 to 0.393 npd) scored higher on the robot (1.4 to 32.0 mean successes), with 10 real trials each. The authors say higher entropy “corresponds to” better transfer. But the small, medium and large policies are snapshots of one ADR run, trained for 0.64, 4.37 and 13.76 days. The XL and XXL runs trained for longer and at a larger scale. So entropy is mixed up with training time and scale. The one pair the authors call fully comparable, ADR (Large) and Manual DR, trained for the same time and scored 13.3 against 2.7 on the robot; but those two differ in the whole randomization scheme, not only in entropy. This is an association inside their setup, not a controlled test of cause. Their controlled comparison of fixed ranges (§8.2) was done in simulation, not on the robot.
Evidence and further reading
This section collects the main published results on what to randomize, with their conditions and sample sizes, and suggests further reading.
Visual randomization (Tobin et al., 2017). The detector, trained only on randomized renders, located eight different objects in 480 real test images with an average error of about 1.5 cm. On simulated images its error was 0.3–0.5 cm, so it still overfitted the simulator somewhat. §IV-B, Table I
Their ablation trained each variant on 20,000 images and measured real error in three conditions: object alone, with distractors, and with occlusion. §IV-C, Table II
| variant | object only (cm) | with distractors (cm) | with occlusion (cm) |
|---|---|---|---|
| full method | 1.3 | 1.8 | 2.4 |
| no distractors in training | 1.5 | 7.2 | 7.4 |
| no camera randomization | 2.0 | 2.4 | 2.9 |
| no image noise | 1.4 | 1.9 | 2.4 |
Distractors in training were critical for coping with real clutter. Image noise made little difference to accuracy, although the authors say it helped training converge. §IV-C With 10,000 training images, performance fell sharply with fewer than 1,000 unique textures. With pre-trained weights, about 5,000 images already gave fairly accurate real detection, improving up to about 50,000. With enough data, training from scratch transferred nearly as well as starting from ImageNet weights. §IV-C, Figs 4–5
Dynamics randomization (Peng et al., 2018). On the real arm, the LSTM policy succeeded 0.89 ± 0.06 of the time (28 trials). A feedforward policy with randomization reached 0.67 ± 0.14 (12 trials). A feedforward policy given the last 8 steps as input reached 0.70 ± 0.10 (20 trials). A feedforward policy without randomization succeeded 0.0 (10 trials). In randomized simulation the LSTM and the 8-step policy were close (0.91 and 0.87), but the LSTM transferred better. §V-A, Table II
Their ablation on the real robot removed one randomization at a time. §V-B, Table III
| training condition | real success | real trials |
|---|---|---|
| all parameters randomized | 0.89 ± 0.06 | 28 |
| fixed action time step | 0.29 ± 0.11 | 17 |
| no observation noise | 0.25 ± 0.12 | 12 |
| fixed link mass | 0.64 ± 0.10 | 22 |
| fixed puck friction | 0.48 ± 0.10 | 27 |
The authors conclude that coping with controller latency and sensor noise is important. §V-B They also attached a packet of chips under the puck, changing how it slides. Success was 0.91 ± 0.04, close to the 0.89 ± 0.06 without it. §V-C
Automatic domain randomization (OpenAI, 2019). In the block-reorientation task, ADR snapshots with entropy −0.881, −0.135 and 0.126 npd scored 1.4, 3.2 and 13.3 mean successes on the robot. Larger runs at 0.305 and 0.393 npd scored 16.0 and 32.0 ± 6.4. A policy with hand-designed randomization, whose entropy is at most −0.348 npd, scored 42.5 in simulation but only 2.7 on the robot. Each real result used 10 trials. The authors read this as higher ADR entropy corresponding to better transfer. §8.1.2, Table 3
They also trained from scratch with fixed ranges taken from ADR snapshots, for the same wall-clock time. These runs learned more slowly than ADR, and the wider the fixed range, the longer training took. The authors suggest that very hard distributions may never be learnable from scratch. This comparison was made in simulation. §8.2, Fig. 16
For the Rubik’s cube, with 10 real trials each, hand-designed randomization (at most −0.569 npd) scored 1.8 mean successes. ADR runs at −0.084, 0.467 and 0.479 npd scored 3.8, 17.8 and 26.8. The best result used the Giiker cube, which has built-in sensors for face angles. §8.4.1, Table 6 The full Rubik’s cube results, including the vision-only numbers, are discussed in sim-to-real transfer.
Further reading. Sim-to-real transfer covers the reality gap and the other remedies, such as system identification and adaptation with real data. Domain adaptation covers methods that do use target data. Generalization and vision robustness discuss why models fail on data unlike their training data. Robotics overview and reinforcement learning give the background.
Make a prediction, then check
Peng et al. ablate on the real arm: all parameters randomized 0.89 success; fixed action time step 0.29; no observation noise 0.25; fixed link mass 0.64. What is the most reasonable conclusion?
Learning objectives
- Distinguish visual from dynamics randomization, write the training objective as an expectation over a parameter distribution, and use published ablations to decide which factors to randomize first (distractors, texture count, latency, observation noise).
- Explain how automatic domain randomization widens ranges with boundary sampling and performance thresholds and how its entropy is computed, and why a wider range, a larger entropy or a short failure-free test does not by itself mean transfer to the real system.
Prerequisites & connections
Explore related knowledge →References
- 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 - Sim-to-Real Transfer of Robotic Control with Dynamics Randomization — arXiv v3, scoped
Xue Bin Peng; Marcin Andrychowicz; Wojciech Zaremba; Pieter Abbeel · 2018 - 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 - Sim-to-Real Transfer in Deep Reinforcement Learning for Robotics: a Survey — arXiv v2, scoped
Wenshuai Zhao; Jorge Peña Queralta; Tomi Westerlund · 2020
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 both tables matches the output. I re-derived the feasibility condition (a-1)/b_min < k < 1/b_max, equivalently b_max/b_min < 1/(a-1) = 5 for a = 1.2 (labelled as our derivation), the w = 3, d = 0 row (bk = 1.5 x 0.69 = 1.035 > 1, complex poles of modulus sqrt(1.035) = 1.0173, 1.0173^60 = 2.81, so unstable despite no failures in 60 steps; cost ratio 1.052/0.030 = 35), the last ADR gain 0.19 (bk = 0.285, real roots of z^2 - 1.2z + 0.285 at 0.874 and 0.326, which the program does not print), the entropies ln 1.15 = 0.140 and ln 2.85 = 1.047, the ratio 4.50/1.65 = 2.7, the mean extra delay 1–8 ms, the nominal-cost ratio of about three, and the exercise answers. I downloaded and read as extracted text Tobin et al. arXiv:1703.06907v1 (§II-C, §III-A–B, §IV-B–C, Table II, Figs 4–5, footnotes 2–4), Peng et al. arXiv:1710.06537v3 (§II-B, §IV, §IV-C–E, §V, Tables I–III), OpenAI arXiv:1910.07113v1 PDF pp. 10–12 (§5–5.3, Algorithms 1–2) and pp. 20–23 (Table 3, §8.2 and Fig. 16, Table 6) and Zhao et al. arXiv:2009.13303v2 (§III-C, §IV-A, §V, §VI). I confirmed that nothing is cited from OpenAI §5.4, §6–7, §9 or appendices, that Matas et al. is marked as known only through Zhao, that Table 3 and Table 6 are kept apart, and that no toy number from the sim-to-real example appears here (the seeds differ). I checked en/zh parity section by section, MDX safety, display-equation identity, citation definitions and that every internal link points to a published topic. Not checked: published venues, sections of the sources outside those listed, and works known only through citing papers.
- Re-ran the example (identical) and re-derived the feasibility condition, the instability of the w = 3, d = 0 row (bk = 1.035, modulus about 1.017, about 2.8x over 60 steps), the poles 0.874/0.326 for the last ADR gain and the entropies.
- Numbers from Tobin Table II, Peng Tables I–III, OpenAI Tables 3 and 6 and §8.2 match the sources, with trial counts and training conditions attached.
- ADR widening/narrowing is described by its intended effect, with a note that Algorithm 1 writes it as adding or subtracting a step; the entropy–transfer link is stated as association, not cause.
- The feasibility formula and the toy ADR are labelled as ours; en and zh match section by section; unpublished topics appear only as inline code.
Source locations checked:
- Domain Randomization for Transferring Deep Neural Networks from Simulation to the Real World — arXiv v1, scoped · pdftotext of arXiv v1. p. 1: abstract, §I (hypothesis, focus on camera images). p. 3: §II-C end (Sadeghi & Levine ~200 mostly realistic materials vs non-realistic procedural textures), §III-A list of randomized aspects, three texture types, colour not available to the detector, MuJoCo renderer. p. 4: 0–10 distractors, camera box 10×5×10 cm, 0.1 rad offset, 5% FOV scaling, §III-B modified VGG-16 (FC 256 and 64), Adam lr ~1e-4, §IV-A, Table I. p. 5: §IV-B (480 images, 1.5 cm, sim error 0.3–0.5 cm, footnote 2), §IV-C ablation list, Fig. 4 (5,000 → ~50,000 samples; random init nearly as good with much data), Fig. 5 (<1,000 textures degrades at 10,000 examples), footnote 3. p. 6: Table II (full 1.3/1.8/2.4; no noise 1.4/1.9/2.4; no camera randomization 2.0/2.4/2.9; no distractors 1.5/7.2/7.4; footnote 4: 20,000 examples each). NOT read: references; venue not verified. Checker added (2026-12-03): §III-A p. 3 wording is 'skybox' and 'specular characteristics of the lights' (kept with plain glosses); §III-B p. 4 ImageNet initialisation for most experiments.
- Sim-to-Real Transfer of Robotic Control with Dynamics Randomization — arXiv v3, scoped · pdftotext of arXiv v3. p. 2: §II-B (DR models discrepancies as source-domain variability; Antonova et al.'s feedforward policies, as summarised). p. 3: §IV objective. p. 4: §IV-C randomized quantities (95 parameters; per-episode vs per-step), §IV-D adaptive policy, §IV-E omniscient critic. p. 5: §V (log vs uniform sampling, Δt ~ Δt0 + Exp(λ), Δt0 = 0.04 s), Table I ranges. p. 6: observation noise 5% of running std, §V-A setup (8-step history for FF + Hist). p. 7: Table II (LSTM 0.91/0.89, 28 trials; FF no Rand 0.51/0.0, 10; FF 0.83/0.67, 12; FF + Hist 0.87/0.70, 20), Table III ablation, §V-C chips packet 0.91 ± 0.04. NOT read: references; venue not verified. Checker added (2026-12-03): §V p. 5 says λ is fixed within each episode while Δt varies every step; the 95 parameters include the action time step and observation noise, so 'simulator parameters' rather than 'physical parameters'.
- Solving Rubik's Cube with a Robot Hand — arXiv v1, scoped · pdftotext of arXiv v1, PDF pages. p. 10: §5 intro (manual tuning, tight loop; meta-learning hypothesis), §5.1 (initial distribution on one environment, expansion, independence from training algorithm), Fig. 10. p. 11: two benefits, thresholds for policy (successes per episode) and vision (percentage meeting targets), §5.2 (λ ∈ R^d, factorised uniform, entropy in nats/dimension, boundary sampling, buffers, t_L < t_H, p_b). p. 12: Algorithm 1 (φ_i ← φ_i ± Δ), Algorithm 2, §5.3 (Redis, workers; φ0 from calibration for policy, zero for vision). p. 20: Table 3 (entropies and real successes; training times 0.64/4.37/13.76 days; Manual DR upper bound). p. 21: §8.2, Fig. 16 (fixed-entropy runs slower; larger entropy slower). p. 23: Table 6 entropies and successes. NOT read: §5.4 randomization list, §6–7, §9 (meta-learning evidence), appendices. Checker added (2026-12-03): p. 20 text after Table 3 (small/medium/large are snapshots of one run, footnote 13; ADR (Large) and Manual DR trained for the same wall-clock time and called fully comparable; XL/XXL trained longer at larger scale) and p. 11 text that the boundary update 'increases'/'decreases' the parameter while §5.1 describes expansion; p. 12 §5.3 that each worker runs Algorithm 1 with probability p_b.
- Sim-to-Real Transfer in Deep Reinforcement Learning for Robotics: a Survey — arXiv v2, scoped · pdftotext of arXiv v2. p. 1: Fig. 1 caption (DR of colours, textures, dynamics). p. 3: §III-C opening. p. 5: §III-C (visual vs dynamics randomization; OpenAI in-hand manipulation parameters as summarised; canonical-image translation), §III-E. p. 6: §IV-A (Matas et al.: excessive randomization detrimental — secondary), §V (DR studied empirically, hard to explain formally). Table I not used.
Related topics