DL0153 Sim-to-Real Transfer

What is sim-to-real transfer in robot learning, and how do domain randomization, system identification, and visual domain adaptation each close a different part of the reality gap?

Answer

Sim-to-real transfer is training a control policy in a physics simulator, where data is fast, safe, and infinitely resettable, and then deploying it on hardware that obeys different physics and produces different pixels. The reality gap is the mismatch between the simulated MDP and the real one, and it decomposes into at least three channels: dynamics parameters that are simply mistuned (mass, friction, joint damping, motor gains), unmodeled effects that the simulator has no term for (cable drag, gear backlash, control latency, deformable contact), and the observation gap between rendered and captured images. The three classic techniques are not competitors; each attacks a different channel. Domain randomization trains one policy over a distribution of simulators so the real robot behaves like just another sample from that distribution, system identification measures the real robot and moves the simulator’s parameters onto it, and visual domain adaptation leaves dynamics alone and instead makes sim and real images look identical to the encoder. Production pipelines for legged locomotion and dexterous manipulation compose them: identify what you can measure, randomize what you cannot, adapt the residual online with a history-conditioned policy.

(1) The Gap Is Not One Number: dynamics, unmodeled effects, and observations fail independently, so a policy can transfer perfectly in torque space and still collapse because the real camera has motion blur.
(2) Domain Randomization Widens The Simulator: sampling \xi \sim p(\xi) each episode buys robustness without any real data, provided the true parameters lie inside the support.
(3) System Identification Shrinks The Gap Itself: fitting \xi to logged real trajectories gives a sharper simulator and a higher-performance policy, but only for effects the simulator can represent.
(4) Visual Domain Adaptation Works In Pixel Space: feature alignment, randomized-to-canonical translation, or image-to-image GANs remove appearance shift that no amount of physics tuning touches.
(5) Support Coverage Is The Binding Constraint: if \xi_{\mathrm{real}} falls outside the randomization support, the policy has literally never trained on the real robot’s physics and no amount of averaging helps.
(6) Online Adaptation Recovers The Lost Performance: conditioning on a short history of states and actions lets the policy infer the latent parameters at run time, which is why teacher-student distillation and rapid motor adaptation beat blind robustness.

Two-panel conceptual diagram. Left panel shows a dynamics parameter space with axes friction coefficient and payload mass, a blue dot for the simulator nominal parameters, a red star for the real robot parameters, a large shaded rectangle marking the randomization support that contains the star, and a dashed arrow from the nominal point to the star labeled system identification. Right panel shows a visual feature space with a tight cluster of sim render points and a separate cluster of real camera image points, a large tilted ellipse marking the spread produced by visual randomization that envelops both clusters, and a curved arrow mapping the real cluster onto the sim cluster labeled domain adaptation.

Figure 1: The same gap, two spaces and two directions of correction. In parameter space randomization inflates the simulator’s support until it contains the real robot, while system identification translates the nominal point onto it. In feature space randomization spreads the sim distribution until it envelops the real look, while adaptation pulls real observations back onto the canonical sim appearance.

The mechanisms differ in what they need and what they cost. Domain randomization needs zero real data: you pick ranges for mass, friction, terrain roughness, motor strength, sensor noise, latency, and texture, then resample every episode so the policy cannot memorize one dynamics model. Its price is conservatism, because a memoryless policy maximizing expected return over a wide p(\xi) converges to behavior that is safe for the average simulator and optimal for none, which is why Automatic Domain Randomization grows the ranges only as fast as the policy can absorb them. System identification runs in the opposite direction: excite the hardware, log (s_t, a_t, s_{t+1}), and minimize prediction residuals to recover \hat{\xi}. It buys back performance and shrinks the randomization ranges you still need, but it can only fit parameters the simulator exposes, so backlash or a compliant tendon that has no corresponding term stays invisible no matter how good the fit is. Visual domain adaptation is orthogonal to both: RCAN-style translation maps heavily randomized or real images to one canonical rendering before the policy sees them, GraspGAN-style translation pushes sim images toward realism, and feature-level alignment penalizes the discrepancy between sim and real encoder activations. The standard modern recipe is a pipeline: identify → randomize the residual uncertainty → train a privileged teacher with access to \xi → distill into a student that reads only onboard history → deploy.

Mathematical Formulation:
\Delta(\pi) = J_{\mathrm{real}}(\pi) - J_{\mathrm{sim}}(\pi)
\pi_{\mathrm{DR}} = \arg\max_{\pi} E_{\xi \sim p(\xi)} [ J_{\xi}(\pi) ]
\xi_{\mathrm{real}} \in \mathrm{supp}(p(\xi))
\hat{\xi} = \arg\min_{\xi} \sum_{t=1}^{T} \| e_t(\xi) \|^2
e_t(\xi) = s_{t+1} - f_{\xi}(s_t, a_t)
\min_{g} \; d( g(o_{\mathrm{sim}}), g(o_{\mathrm{real}}) )

Where:

  • J_{\mathrm{real}} and J_{\mathrm{sim}} are the expected returns of policy \pi on hardware and in simulation, and \Delta(\pi) is the reality gap measured in task performance rather than in physics units.
  • \xi is the vector of simulator parameters (masses, friction coefficients, motor gains, latencies, texture and lighting seeds) and J_{\xi} is the return in the simulator instantiated with \xi.
  • p(\xi) is the randomization distribution; the support condition is the precondition for transfer, since a policy trained on p(\xi) has no guarantee at all for parameters outside \mathrm{supp}(p(\xi)).
  • \hat{\xi} is the identified parameter estimate, f_{\xi} the simulator’s one-step transition model, and e_t the one-step prediction residual against a logged real transition from state s_t under action a_t.
  • t \in \{1, \ldots, T\} indexes the real excitation trajectory; residual that cannot be driven to zero by any \xi is unmodeled physics, and it is exactly what must be randomized or adapted away instead.
  • g is the visual encoder, o_{\mathrm{sim}} and o_{\mathrm{real}} are observations from the two domains, and d is a distribution distance such as an adversarial discriminator loss or a maximum mean discrepancy.
Line chart of task success rate versus randomization half-width as a fraction of the nominal parameter value. The sim-domain success curve starts near 0.97 at zero width and decays gently to about 0.73 at full width. The real-world success curve starts near zero, rises steeply once the support begins to contain the true parameters around a width of 0.3, peaks near 0.89 around 0.45, then declines to about 0.39 at full width. A dotted vertical line marks where the real parameter enters the support and a shaded band marks the practical operating range.

Figure 2: Randomization width has an inverted-U effect on real-world success while sim success decays monotonically, so sim reward is an actively misleading model-selection signal. Too narrow and \xi_{\mathrm{real}} sits outside the support; too wide and the policy averages over incompatible dynamics. System identification moves the useful band left by removing uncertainty you no longer need to cover.

PropertyDomain randomizationSystem identificationVisual domain adaptation
Gap channel it closesUnknown dynamics and appearance, covered by breadthMistuned but representable dynamics parametersObservation shift between rendered and captured images
Real data requiredNone, only sensible rangesExcitation trajectories on the target robotUnlabeled real images, no reward or actions needed
Main costSample complexity plus a conservative policyHardware time, and it must be redone per unit and as parts wearA second generative or adversarial model to train and maintain
Dominant failure modeSupport misses the true parameters, or breadth destroys performanceOverfits to one robot and cannot fit unmodeled effectsTranslation hallucinates or drops task-critical detail; dynamics untouched
Best fitContact-rich locomotion and manipulation across a fleetHigh-precision tasks on one well-instrumented platformImage-based grasping and navigation with cheap renderers

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *