techlist.io

Procgen

2 posts

OpenAI2019-12-023 min readCurated summary

Procgen Benchmark

# Procgen Benchmark: Measuring Generalization in Reinforcement Learning OpenAI's Procgen Benchmark is a suite of 16 procedurally generated environments built to measure how quickly reinforcement learning agents learn skills that generalize to unseen levels. The authors argue that classic benchmarks like the Arcade Learning Environment reward memorizing specific trajectories rather than robust learning, and that a diverse collection of environments is needed to evaluate generalization directly. Their experiments show that agents overfit heavily to small training sets in nearly every environment, and that many need around 10,000 levels or more to close the generalization gap. ## Limits of Existing Benchmarks - Agents in several environments have been shown to overfit even to very large training sets. - The Arcade Learning Environment has long been a gold standard, but its low emphasis on generalization makes it hard to tell whether agents learn a relevant skill or memorize trajectories. - CoinRun was designed to separate training and test levels through procedural generation, but it is a single environment and cannot represent the full range of RL challenges. - Environments like Dota and StarCraft are complex but are slow to iterate on, and using several of them at once is difficult. ## Design Goals of Procgen The benchmark is built around experimental convenience, high diversity within each environment, and high diversity across environments. Each environment follows four design principles: - **High diversity:** Level generation logic has maximal freedom within basic design constraints, so the resulting level distributions pose meaningful generalization challenges. - **Fast evaluation:** Difficulty is calibrated so baseline agents make significant progress after 200M timesteps, and the environments run at thousands of steps per second on a single CPU core. - **Tunable difficulty:** Each environment offers easy and hard settings. Results are reported on hard, while easy requires roughly one-eighth of the training resources. - **Visual recognition and motor control:** Games mimic the style of Atari and Gym Retro titles, so strong performance depends on identifying key visual assets and producing appropriate low-level motor responses. Using the benchmark is simple for both humans and AI agents. Installation is done with `pip install procgen`, and environments such as `procgen:procgen-coinrun-v0` can be created through Gym. ## Generalization Experiments - The team trained agents with Proximal Policy Optimization for 200M timesteps on training sets ranging from 100 to 100,000 levels, then measured performance on unseen test levels. - Agents strongly overfit to small training sets in almost all environments, and some needed up to 10,000 levels to close the generalization gap. - Past a certain threshold, training performance improved as the training set grew. The authors attribute this to an implicit curriculum created by diverse levels, which helps agents learn to generalize even across levels they have already seen. This contrasts with supervised learning, where training performance usually falls as datasets grow. ## Deterministic Level Ablation - When test-time level sequences were randomized instead of fixed, agents appeared to make progress over the first several levels in most games. - Test performance showed that agents had learned almost nothing about the underlying level distribution. - The authors conclude that training on a fixed sequence of levels hides a serious flaw, and that diverse level distributions are essential for training and evaluating RL agents. ## Looking Ahead The authors expect insights from the benchmark to carry over to more complex settings and plan to use these environments to build more capable and efficient agents. For anyone evaluating RL methods, the practical takeaway is to test on held-out levels drawn from a diverse distribution, not on a fixed sequence of training levels.

OpenAI2018-12-053 min readCurated summary

Quantifying generalization in reinforcement learning

# Quantifying Generalization in Reinforcement Learning OpenAI introduces CoinRun, a procedurally generated platformer environment that measures how well reinforcement learning agents transfer their experience to unseen levels. The authors show that RL agents overfit heavily to their training levels, even when trained on thousands of them, and that common supervised-learning regularization techniques can meaningfully reduce this gap. CoinRun gives the research community a simple, quantifiable benchmark for evaluating generalization. ## The Generalization Problem - RL agents can solve complex tasks but struggle to transfer skills to new environments. - Benchmarks typically test agents on the same environments they trained on, which is comparable to evaluating on the training set in supervised learning. - Earlier benchmarks (the Sonic benchmark, procedurally generated gridworld mazes, and the General Video Game AI framework) showed similar overfitting. Sonic agents performed well on training levels but poorly on test levels without fine-tuning, maze agents memorized large numbers of training levels, and GVG-AI agents failed on difficulty settings they had not seen during training. ## CoinRun Environment Design - Levels are procedurally generated, giving agents a large, easily quantifiable supply of training data. - The goal is to collect a single coin at the end of each level while avoiding stationary and non-stationary obstacles. - Touching an obstacle causes immediate death. The only reward is a fixed positive constant for collecting the coin. - Episodes end on death, coin collection, or after 1000 time steps. - The environment is deliberately simpler than Sonic but still challenging for state-of-the-art algorithms. ## Measuring Overfitting - Nine agents were trained with Proximal Policy Optimization for 256M timesteps, each on a different number of levels: eight fixed sets ranging from 100 to 16,000 levels, and one on an unrestricted set where it never saw the same level twice (roughly 2 million distinct levels). - Each agent used a 3-layer convolutional architecture called Nature-CNN. Performance was averaged over 10,000 test episodes on unseen levels. - Substantial overfitting appeared with fewer than 4,000 training levels and persisted even at 16,000. - Agents trained on the unrestricted set performed best. - The IMPALA-CNN architecture generalized noticeably better than Nature-CNN across all training set sizes. ## Regularization Techniques Experiments used a fixed set of 500 levels, which the authors recommend as a shared benchmark: - **Dropout and L2 regularization:** Both reduced the generalization gap, with L2 having the larger effect. - **Data augmentation and batch normalization:** A modified Cutout augmentation and batch normalization both significantly improved generalization. - **Environmental stochasticity:** Training with stochastic environments improved generalization more than any of the other techniques. - The authors note that RL policies are often trained without these supervised-learning methods, but in this setting they helped, indicating that earlier policies were overfitting to particular MDPs. ## Additional Environments - **CoinRun-Platforms:** A variant where several coins are scattered across platforms in a larger, fixed-size level. Agents must explore more and sometimes retrace their steps. Trained with 2B timesteps using the IMPALA-CNN followed by an LSTM. - **RandomMazes:** A simple maze navigation environment that also uses an LSTM, since memory is needed. - Both environments showed strong overfitting under the baseline setup. RandomMazes was especially severe, with a large generalization gap remaining even at 20,000 training levels. ## Future Directions The authors suggest several research questions: - How environment complexity relates to the number of training levels needed for good generalization - Whether different recurrent architectures generalize better in these environments - How to combine multiple regularization methods effectively