Reinforcement learning (RL) agents are notorious for their ability to memorize specific environments rather than learning generalizable skills. In supervised learning, models are strictly evaluated on unseen test data, but RL agents have historically been trained and tested on the exact same environments (e.g., specific Atari levels). This practice masks a critical flaw: an agent might "solve" a game by memorizing a sequence of actions rather than understanding the underlying mechanics. When placed in a slightly modified version of the same game, these agents often fail catastrophically.
To address this blind spot, researchers introduced CoinRun, a procedurally generated benchmark designed specifically to quantify generalization in RL. By evaluating agents on unseen levels, the study reveals that RL agents overfit far more easily than previously assumed, and demonstrates how standard supervised learning techniques can help close this generalization gap.
The CoinRun Benchmark
To distinguish between memorization and true generalization, the researchers utilized procedural generation. Instead of a fixed set of levels, CoinRun generates platformer levels algorithmically from random seeds. The agent's goal is simple: navigate obstacles and reach a coin at the end of the level.
This procedural approach allows for the creation of distinct training sets (e.g., 1,000 fixed levels) and test sets (completely unseen levels from the same distribution). The paper also introduces variations like CoinRun-Platforms (requiring exploration across non-linear maps) and RandomMazes (testing memory in partially observed grids).
Evaluating Generalization
Using CoinRun, the authors tested various interventions to see what helps agents generalize to unseen levels:
- Architectures: Comparing the standard 3-layer "Nature-CNN" against a deeper, residual "IMPALA-CNN."
- Regularization: Applying L2 regularization, Dropout, and Batch Normalization.
- Data Augmentation: Using a modified "Cutout" technique where random rectangular regions of the input are masked with random colors.
- Stochasticity: Injecting randomness via $\epsilon$-greedy action selection or increasing the entropy bonus in Proximal Policy Optimization (PPO).
Key Findings and the Scale of Overfitting
The most striking insight from the study is the sheer volume of environments an agent must experience before it stops memorizing and starts generalizing.
- The Generalization Gap: When trained on only 100 levels, agents solved nearly 100% of the training levels but only about 65% of the unseen test levels. Noticeable overfitting persisted until the training set exceeded 4,000 unique levels. The gap only fully closed when the training set was effectively unbounded.
- Architecture as a Regularizer: Deeper, residual networks (IMPALA-CNN) significantly outperformed shallower networks in generalization, even when both achieved similar performance on the training set.
- Supervised Tricks Work in RL: Techniques like Dropout and L2 regularization, long proven in supervised learning, were shown to be highly effective in RL. For instance, applying L2 regularization (weight $10^{-4}$) and Dropout (probability $0.1$) noticeably reduced the generalization gap.
- The Role of Stochasticity: Adding randomness to the policy or environment forces the agent to learn robust features rather than brittle, timing-based sequences.
Limitations and Future Directions
While the study proves that regularization and deeper architectures improve generalization, these benefits come with trade-offs, such as slower initial training times and diminishing returns as networks grow larger. Furthermore, in environments requiring memory (like RandomMazes), a significant generalization gap remained even after 20,000 training levels, highlighting the difficulty of generalizing with recurrent architectures like LSTMs.
Finally, while procedural generation effectively measures in-distribution generalization, it does not solve out-of-distribution generalization. Future research must explore how agents can adapt to entirely new mechanics or visual styles not present in their training distributions.
Summary updated