Domain randomization

On this page 7

Domain randomization is a simulation technique that deliberately varies the parameters of a virtual environment during training, such as textures, lighting, masses, friction and sensor noise, so that a learned model treats the real world as just another variation. In robotics simulation it is one of the most widely used tools for transferring perception models and control policies from a simulator to physical robots.

The idea reverses the usual goal of simulation. Instead of trying to build one perfectly realistic virtual world, engineers build a distribution of plausible worlds wide enough that reality falls inside it. A model that succeeds across that whole distribution has learned to rely on features that stay constant, such as object shape and contact geometry, rather than on quirks of a single simulator.

How domain randomization works

At the start of every training episode, or even every simulation step, the training loop samples new values for a chosen set of parameters from predefined ranges, usually uniform or log-uniform distributions. The robot or vision model then trains on data produced under those sampled conditions. Over millions of samples, the model is pushed toward behavior that is invariant to the randomized factors.

Randomization is applied in two broad families. Visual randomization changes what cameras see and serves perception models, while dynamics randomization changes how the simulated world responds to forces and serves control policies. Most robot learning projects use both, together with randomized sensor noise and timing.

FamilyWhat is variedMain beneficiary
Visual randomizationTextures, colors, lighting, camera pose, distractor objectsObject detection, segmentation, pose estimation
Dynamics randomizationMass, inertia, friction, damping, motor strengthLocomotion and manipulation policies
Sensor randomizationNoise, bias, dropout, latency, resolutionState estimation and closed-loop control
Scene randomizationObject placement, terrain shape, clutterTask generalization and robustness
Families of domain randomization

Typical parameters and ranges

Choosing ranges is the core engineering decision in domain randomization. Ranges are normally set around a measured nominal value, widened where the real value is uncertain or changes during operation. The values below are typical starting points rather than universal rules; the right ranges depend on the robot, its sensors and the task.

ParameterIllustrative rangeWhy it is randomized
Link and payload massAbout ±10 to ±30 % of nominalUnknown payloads, manufacturing variation
Ground or contact frictionRoughly 0.3 to 1.5 coefficientDifferent floors, materials, wear
Motor strength or gainAbout ±10 to ±20 %Temperature, battery voltage, motor variation
Control latencyZero to a few tens of millisecondsCommunication and computation delays
Sensor noiseScaled to datasheet noise or largerImperfect encoders, IMUs and cameras
Lighting intensity and directionWide, from dim to strongly lit scenesChanging factory and outdoor illumination
Commonly randomized parameters with illustrative ranges

A useful rule is to randomize every parameter that cannot be measured precisely or that changes in service, while keeping well-known quantities, such as link lengths from CAD, close to their true values. Randomizing quantities that are actually known only makes the learning problem harder without improving transfer.

The timing of resampling matters as well. Resampling once per episode suits parameters that stay constant during a task, such as payload mass, while resampling during an episode models effects that fluctuate, such as sensor noise or intermittent communication delays. Mixing both levels makes a policy robust to slow drift and sudden disturbances at the same time.

Uniform, structured and adaptive randomization

Domain randomization has evolved from simple uniform sampling toward methods that shape the distribution during training. The variants differ in how much engineering effort they require and how efficiently they use simulated experience.

VariantHow ranges are chosenStrengthWeakness
Uniform randomizationFixed ranges set by engineersSimple and transparentRanges may be too narrow or too wide
Structured randomizationVariation follows realistic scene rulesProduces plausible, useful dataNeeds domain knowledge to design
Automatic randomizationRanges expand as the policy succeedsBuilds a natural curriculumMore complex training infrastructure
Data-driven randomizationRanges fitted to real-world measurementsFocuses effort on realistic conditionsRequires real data collection
Variants of domain randomization

Automatic domain randomization starts with narrow ranges and widens each one only when performance at its boundary is good enough. This avoids overwhelming an untrained policy with extreme conditions and often produces policies that tolerate far wider variation than engineers would have specified by hand.

Domain randomization within the simulation toolchain

Domain randomization is a technique, not a product, and it is implemented on top of a robot simulator. Tools such as Gazebo and Isaac Sim provide physics engines, sensor models and scripting interfaces through which parameters can be resampled; GPU-accelerated simulators make it practical to run thousands of randomized environments in parallel.

It also differs from a digital twin. A digital twin aims to mirror one specific physical system as closely as possible, often synchronized with live data. Domain randomization intentionally moves away from any single replica to cover a family of possible systems. The two can complement each other: a calibrated digital twin supplies the nominal values around which randomization is applied.

Pitfalls and limits

Domain randomization is powerful but not a substitute for a reasonable simulator. If an effect is not modeled at all, randomizing other parameters cannot teach the model to handle it.

  • Excessively wide ranges lead to conservative policies that move slowly or grip too hard, sacrificing performance for robustness.
  • Unrealistic combinations, such as very light objects with very high friction, waste training time on worlds that never occur.
  • Missing physics, for example cable drag or deformable contact, remains a gap regardless of randomization.
  • Longer training time is the price of robustness, since the model must master many variations instead of one.
  • Weak evaluation on the same randomized distribution hides failures; validation should use held-out conditions and real tests.

The simple explanation

Domain randomization is like training for a sport in every kind of weather. An athlete who has practiced in rain, wind, heat and cold is not surprised on match day, whatever the conditions turn out to be.

In robot simulation, engineers keep changing colors, lighting, weights and slipperiness while the robot learns. Because the robot never sees the same virtual world twice, it learns what really matters and copes much better when it meets the real world.

How it is used in practice

A logistics company needs a vision model that detects cardboard boxes on pallets for a depalletizing robot, but labeling thousands of real images would take weeks. Engineers instead render boxes in a simulator with randomized sizes, tape patterns, printed labels, lighting, camera height and background clutter, generating hundreds of thousands of automatically labeled images.

The model trained only on these synthetic images detects real boxes reliably on the first day of testing, with most errors on glossy shrink-wrapped pallets. The team adds randomized specular reflections to the renderer and fine-tunes on a few hundred real images, after which the robot handles mixed pallets without manual labeling at scale.