Introduction
Reinforcement learning (RL) agents frequently struggle with "overfitting" to their specific training environments. A policy that masters a task under one set of visual conditions—such as a specific background color—often fails catastrophically when those conditions change slightly. In robotics, this discrepancy is known as the reality gap, where policies trained in clean, simulated environments fail to generalize to the messy, unpredictable real world.
The standard approach to bridge this gap is Domain Randomization (DR). By randomizing visual features like colors, textures, and lighting during training, researchers hope the agent will learn a policy that is invariant to these changes. However, DR is often inefficient, requiring the agent to explore vast numbers of variations that do not affect the underlying task logic. Furthermore, it can lead to high-variance policies that perform inconsistently across different domains.
Methodology: Learning Invariant Representations
This paper proposes a regularization-based alternative to standard DR. Instead of forcing the agent to "see everything," the authors suggest forcing the agent's internal representations to be identical across different visual variations of the same state.
Feature-Level Regularization
The core of the method involves adding a penalty to the standard RL loss function. While the agent is trained primarily on a "reference" environment, the loss function is augmented to minimize the distance between the feature vector of a state $s$ and the feature vector of its visually randomized counterpart $\phi(s)$:
$$\mathcal{L} = \mathcal{L}_{RL} + \lambda \cdot \text{Distance}(f(s), f(\phi(s)))$$
Here, $f$ represents the feature extractor (the last hidden layer of the neural network), and $\lambda$ is a hyperparameter controlling the strength of the regularization. A key insight of this work is that regularizing the last hidden layer is more effective than regularizing the final action output. This allows the agent to build a stable "map" of the environment that ignores visual noise while remaining free to optimize its policy for the task at hand.
Theoretical Grounding
The authors link this approach to Lipschitz continuity. By minimizing the difference between representations of randomized states, they effectively lower the Lipschitz constant of the policy. This provides a theoretical "speed limit" on how much an agent's behavior can change in response to visual perturbations, ensuring more stable performance across diverse domains.
Experimental Results
The researchers evaluated the proposed method against standard DR and baseline agents on benchmarks including Visual Cartpole and CarRacing-v0.
Efficiency and Robustness
In the Cartpole environment, the regularized agent learned significantly faster than the randomized agent. As the "randomization space" (the variety of possible colors) grew larger, the performance of standard DR dropped significantly, whereas the regularized agent remained stable.
The results in the CarRacing-v0 task were even more pronounced. While standard DR and common techniques like Weight Decay or Dropout failed to produce successful policies in large randomization spaces, the regularized agent achieved an average return of 553. In contrast, the normal agent scored only 60, and the standard randomized agent often yielded negative scores.
Latent Space Analysis
Visualizations using t-SNE plots confirmed the mechanism of action: standard DR agents tend to cluster different colors into distinct regions of their latent space, effectively trying to learn a different sub-policy for every color. The regularized agent, however, maps all visual variations of the same underlying state to the same point in its latent space, achieving true visual invariance.
Discussion and Future Work
While the proposed regularization significantly improves interpolation—generalizing to variations within the training range—the authors note that extrapolation to colors far outside the training distribution remains a challenge. Additionally, this work focuses exclusively on visual randomization. Future research is needed to address dynamics randomization (e.g., changes in gravity or friction), where agents must adapt their behavior rather than ignore the changes. Testing these methods in high-fidelity 3D simulations and on real-world robotic hardware remains the next major milestone for robust reinforcement learning.
Summary updated