Abstract
Reinforcement learning (RL) has demonstrated remarkable success in learning complex behaviors within simulated environments. However, transitioning these policies to physical systems remains a significant challenge due to the "reality gap." Domain randomization (DR) is a popular technique to bridge this gap by training policies across a distribution of simulated environments. Despite its success, the effectiveness of DR is highly sensitive to the choice of randomization parameters, which are typically hand-tuned through trial and error. This paper proposes a bilevel optimization framework that treats the selection of these parameters as an objective to be optimized using real-world feedback. Our results demonstrate that optimizing the distribution of simulated environments significantly outperforms standard hand-tuned distributions in robotic locomotion tasks, offering a principled approach to sim-to-real transfer.
Introduction
Reinforcement Learning (RL) excels in controlled, simulated settings where data is abundant and risks are low. Yet, when these policies are deployed on physical robots, they often fail because the simulation cannot perfectly capture the nuances of real-world physics—a phenomenon known as the reality gap.
Domain Randomization (DR) attempts to solve this by introducing variability into the simulation. By varying physical properties such as mass, friction, and gravity during training, the goal is to produce a policy robust enough to generalize to the real world. However, a major bottleneck persists: researchers must manually define the ranges for these variations. Choosing a range that is too narrow leads to overfitting to the simulation, while a range that is too broad can make the learning task impossible or result in overly conservative behavior. This paper addresses the lack of a principled methodology for automatically determining the optimal distribution parameters ($\phi$) to maximize real-world performance.
Methodology: A Bilevel Optimization Approach
The core contribution of this work is the formalization of domain randomization as a bilevel optimization problem. This structure allows the system to "learn how to learn" by iteratively refining the training environment based on the agent's performance in the target domain.
The Inner Loop: Policy Training
In the inner loop, the system focuses on the simulation. Given a distribution of environments defined by parameters $\phi$, a policy $\pi_\theta$ is trained using standard RL techniques. In this study, the authors utilize Proximal Policy Optimization (PPO) to solve the control task within the randomized simulation.
The Outer Loop: Parameter Optimization
The outer loop evaluates the resulting policy in the target environment (the "real world"). The performance score obtained in this environment serves as the objective function for updating the distribution parameters $\phi$. Because the relationship between the randomization parameters and the final policy performance is complex and non-differentiable, the authors employ the Cross Entropy Method (CEM). CEM is a gradient-free stochastic optimizer well-suited for searching the parameter space of $\phi$ to find values that yield the most robust policies.
Experimental Setup
To validate the framework efficiently, the authors utilized a sim-to-sim transfer setup, which serves as a proxy for real-world deployment.
- Source Environment (Simulation): The Dart physics simulator was used for training.
- Target Environment ("Real World"): The Mujoco physics simulator acted as the target domain.
- Tasks: The framework was tested on two standard OpenAI Gym-style locomotion tasks: Hopper (involving 9 randomized parameters) and Walker (involving 15 randomized parameters).
- Randomized Parameters: The optimization covered link masses, damping coefficients, and the gravity constant.
Key Insights
Performance Over Distribution Matching
Traditional approaches to sim-to-real often attempt to make the simulation's state distribution match the real world's state distribution. This paper argues for a more direct approach: optimizing for the performance of the policy in the target environment. By using real-world data as a guide rather than just a final test, the system can identify which types of simulation diversity are most beneficial for robustness.
The Limits of Human Intuition
The study reveals that human intuition is often a poor judge of the "diversity" a neural network requires. Even when starting from "reasonable" default parameters, the optimization process discovered distributions that were significantly more effective than those chosen by experts. This suggests that the relationship between environmental variance and policy robustness is non-intuitive and best handled by automated optimization.
Results
The optimized domain randomization parameters led to substantial performance gains over the initial hand-tuned baselines:
- Hopper: Optimized policies achieved an average performance increase of 102% over the baseline, with a minimum improvement of 28% across all trials.
- Walker: Optimized policies performed 80% higher on average, with a minimum improvement of 19%.
- Consistency: These results were consistent across five different random seeds, proving that the bilevel optimization reliably finds superior values for $\phi$ compared to manual tuning.
Limitations and Future Work
While promising, the bilevel optimization approach is computationally expensive, as it requires training a full policy in the inner loop for every iteration of the outer loop. Future research could focus on improving sample efficiency, perhaps through off-policy RL to reuse data across iterations.
Additionally, this study utilized simple diagonal Gaussian distributions for randomization. Moving toward more complex models, such as Variational Autoencoders (VAEs) or Autoregressive Flows, could allow the system to capture intricate dependencies between physical parameters—such as the correlation between mass and friction—further narrowing the reality gap. Finally, while the sim-to-sim results are compelling, validating this approach on physical hardware remains the ultimate frontier for this research.
Summary updated