techlist.io

Gym Retro

2 posts

OpenAI2018-05-243 min readCurated summary

Gym Retro

# Gym Retro: A Platform for Generalization Research Across Games OpenAI is releasing the full version of Gym Retro, a reinforcement learning research platform that expands its public game library from roughly 100 titles to over 1,000 across several emulators. The release also includes the integration tool used to add new games. The authors argue that most RL research has focused on solving single tasks, and that a large, varied game collection makes it possible to study generalization between games that share concepts but differ in appearance. The post also shows that simple score-based rewards can lead agents to exploit games rather than complete them, and that current algorithms struggle with sparse rewards and long-horizon planning. ## Scope of the Release - The library grows from about 70 Atari and 30 Sega games to more than 1,000 titles. - Supported consoles include the Sega Genesis, Sega Master System, NES, SNES, and Game Boy, with preliminary support for the Game Gear, Game Boy Color, Game Boy Advance, and NEC TurboGrafx. - Some integrations in the `data/experimental` folder are in beta, and the authors ask for bug reports. - The new code lives on a branch and will not be merged until the ongoing Retro Contest ends, so contestants' code does not break. ## Motivation: From Single Tasks to Generalization - The Retro Contest and its technical report focus on generalizing across levels of one game (Sonic the Hedgehog). - The full dataset extends this to generalization across different games, which is a substantially harder problem. - The authors hope solutions developed by Retro Contest participants can scale to the full dataset. ## Integration Tool - Given a game's ROM, the tool creates save states, locates memory addresses, and defines scenarios that RL agents can solve. - It records and plays back movie files that store only the starting state and button inputs, not every frame. This keeps files small. - Movie files help visualize agent behavior and can store human demonstrations as training data. - An integrator's guide accompanies the tool for developers adding new games. ## Reward Farming - Agents often learn to maximize in-game score instead of completing the intended objective. In Cheese Cat-Astrophe and Blades of Vengeance, agents became trapped in loops that rapidly accumulated points. - Simple reward functions, such as maximizing score, can produce unintended behavior, a phenomenon the authors have discussed before. - Algorithms like PPO perform well on games with dense rewards, where points come frequently and difficulty lies mainly in reaction time. Gradius is an example, since points come from each enemy shot and dodging is handled frame by frame. - Existing algorithms struggle with sparse rewards or tasks that require planning several seconds ahead. Many games in the dataset fall into this category, so tackling the full dataset will likely require new techniques.

OpenAI2018-04-043 min readCurated summary

Retro Contest

# OpenAI's Retro Contest: Testing RL Generalization on Unseen Game Levels OpenAI launched the Retro Contest to measure whether reinforcement learning algorithms can generalize from prior experience rather than memorize a single environment. Contestants train on known Sonic the Hedgehog levels and are evaluated on custom levels they have never seen. Baseline results show that current RL algorithms fall well short of human performance, even with transfer learning, which nearly doubled PPO's score in the authors' experiments. The post also introduces Gym Retro, a platform for turning classic games into RL environments. ## Why Conventional RL Evaluation Falls Short - Typical RL research tests algorithms in the same environment used for training. - This setup rewards memorization and favors algorithms with many hyperparameters that can be tuned to a specific task. - The contest instead evaluates agents on previously unseen levels, which measures generalization. ## Contest Design and Baseline Results - The contest runs from April 5 to June 5, 2018. - Contestants receive a training set of Sonic the Hedgehog levels, while the test set consists of custom levels created for the contest. - At test time, agents get about 18 hours of gameplay (1 million timesteps) per never-before-seen level. Existing algorithms perform far below humans even with this budget. - Baselines include Rainbow DQN, PPO, and JERK, a simple random-action search optimized for Sonic that replays its top-scoring action sequences. - Pre-training PPO on the training levels and fine-tuning on the test levels nearly doubled its performance, making it stronger than the other baselines. The authors note this shows transfer learning can have a large and reliable effect. - Humans still substantially outperform all algorithms. Humans trained for about two hours and played each test level for one hour, compared with 18 hours for the algorithms. - The technical report "Gotta Learn Fast" describes the benchmark in detail, and the retro-baselines repository shows how to run the algorithms on the contest tasks. ## Sonic Recordings Dataset - The team released recordings of humans completing the contest's Sonic levels. - These recordings can be used to start agents from random points along each level, which exposes them to areas they would rarely reach from the beginning. - Researchers can also use the recordings to train agents from demonstrations. ## Gym Retro - Gym Retro wraps classic video games as RL environments. The beta includes 30 SEGA Genesis games and 62 Atari 2600 games from the Arcade Learning Environment. - Genesis games suit transfer learning because levels share physics and object appearances while differing in layout and items. They are also more complex than Atari games, with over 500 times the RAM and a wider range of control inputs. - Environments are defined through JSON files rather than C++ code, which makes adding new games easier than in the Retro Learning Environment. - Compared with Universe, Gym Retro runs environments synchronously, can run faster than real time, and detects game state from memory rather than screen-based detection, which the authors found unreliable.