techlist.io

Openai Gym

9 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-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.

OpenAI2018-02-251 min readCurated summary

Multi-Goal Reinforcement Learning: Challenging robotics environments and request for research

This technical report introduces a suite of challenging continuous control benchmarks for robotics, built on existing hardware and integrated with OpenAI Gym. It also argues for further research into reinforcement learning (RL) methods, especially multi-goal RL and Hindsight Experience Replay. ## Robotics Benchmark Suite - The tasks use a Fetch robotic arm for pushing, sliding, and pick-and-place. - They use a Shadow Dexterous Hand for in-hand object manipulation. - Every task has sparse binary rewards, so the agent receives feedback only on success or failure. - The tasks follow a Multi-Goal RL framework, in which the agent receives an additional input specifying what it should accomplish. ## Research Directions - The second part of the report proposes concrete ideas for improving RL algorithms. - Most of these ideas relate to multi-goal RL and Hindsight Experience Replay, a technique that relabels failed attempts with the goals they actually achieved so the agent can learn from them.

OpenAI2018-02-253 min readCurated summary

Ingredients for robotics research

# Ingredients for robotics research OpenAI's robotics team released eight simulated robotics environments for Gym, built on the MuJoCo physics simulator, along with a Baselines implementation of Hindsight Experience Replay (HER). The environments are substantially harder than the existing MuJoCo continuous control tasks and use realistic models of real robots, and HER makes it possible to learn them from sparse rewards alone. The post also lists a set of open research directions for extending HER. ## Environments - Eight tasks in total: four using the Fetch research platform and four using the ShadowHand robot. - Tasks are goal-based, such as sliding a puck to a target position or rotating a block to a desired orientation. - The default reward is sparse: -1 until the goal is reached (within a tolerance), then 0. A dense-reward variant is also included, but the authors recommend the sparse version as more realistic for robotics. - The environments were used to train models that work on physical robots. ## Hindsight Experience Replay - Standard RL algorithms learn little from failed attempts when every reward is the same constant (-1). - HER relabels failed episodes by treating the goal the agent actually achieved as if it were the intended goal, which gives a useful learning signal. - Replaying these relabeled experiences with goals chosen after the episode ends is what gives the method its name. - HER works with any off-policy algorithm, such as DDPG (written as "DDPG + HER"). ## Results - On the new tasks, DDPG + HER substantially outperforms vanilla DDPG, which mostly fails to learn. - DDPG + HER with sparse rewards performs best. It learns a successful policy on HandManipulateBlockRotateXYZ from sparse rewards alone. - DDPG + HER with dense rewards learns but reaches lower performance, a trend the authors report as generally true across environments. - Full results are in the accompanying technical report. ## Open Research Directions The authors propose several extensions: - **Automatic hindsight goal creation:** learning the goal-substitution strategy instead of hard-coding it. - **Unbiased HER:** goal substitution distorts the experience distribution, which could be corrected with importance sampling. - **HER + hierarchical RL:** applying substitution to a higher-level policy's actions or subgoals. - **Richer value functions:** conditioning on inputs such as discount factor or success threshold. - **Faster information propagation:** alternatives to target networks, which slow training. - **HER + multi-step returns:** difficult today because the relabeled experience is highly off-policy. - **On-policy HER:** combining HER with stable on-policy algorithms like PPO, possibly via importance sampling. - **RL with very frequent actions:** designing algorithms that keep their performance as the action frequency increases. - **Combining HER with recent RL advances:** such as prioritized experience replay, distributional RL, entropy regularization, or reverse curriculum generation. ## Using the Environments - Goal-based environments use a `gym.spaces.Dict` observation space with three keys: `desired_goal`, `achieved_goal`, and `observation`. - The reward function is exposed, so rewards can be recomputed for substituted goals, which HER-style algorithms require. - Existing Gym-compatible algorithms such as Baselines can use these environments after flattening the dict observation with `gym.wrappers.FlattenDictWrapper`.

OpenAI2018-01-304 min readCurated summary

Requests for Research 2.0

OpenAI released a second batch of seven unsolved research problems in January 2018, meant as an entry point for newcomers and a way for practitioners to sharpen their skills. Two warmup problems have known solutions, and the rest are open-ended and difficulty-rated, with many requiring new ideas. The problems span sequence modeling, multi-agent reinforcement learning, distributed training, transfer learning, efficient attention, data augmentation, regularization in RL, and automated theorem proving. ## Warmup Problems - **Learning XOR with an LSTM:** Train an LSTM to output the parity of a bit sequence after reading it one bit at a time. Test on 100,000 random binary strings of fixed length 50, then on strings whose lengths are drawn uniformly from 1 to 50, and explain any difference in results. - **Snake as a Gym environment:** Implement the classic Snake game as a Gym environment and train a reinforcement learning policy that can win it. ## Multi-Agent Self-Play in a Snake Environment - The "Slitherin'" problem asks for a multiplayer Snake environment inspired by slither.io, with a large field, randomly appearing fruit that grows snakes, and deaths from collisions with other snakes, oneself, or walls. - Start with two snakes and scale up. The game ends when all snakes die. - Train with self-play, which tends to be unstable in a way similar to GANs. Possible fixes include training the current policy against a distribution of past policies. - Analyze whether agents learn to pursue food and avoid collisions, and whether they learn aggressive tactics like trapping or ganging up on opponents. ## Distributed RL and Parameter Averaging - Study how parameter averaging schemes affect sample complexity and communication cost. - Averaging gradients from every worker on every update is the simplest approach. Alternatives include letting workers update independently and averaging parameters infrequently, or using EASGD to pull parameters partly together at each update. - Independent workers may hold different parameters at any moment, which could improve exploration. ## Transfer Learning Through Generative Models - Train good policies for 11 Atari games and generate 10,000 trajectories of 1,000 steps per game. - Fit a generative model, such as a Transformer, on trajectories from 10 games, then fine-tune it on the 11th. - Measure how large the model must be for pre-training to help, and how the benefit changes when the 11th game's data is reduced by 10x and 100x. ## Linear Attention Transformers - Replace softmax attention with linear attention, which can be run as an RNN with fast weights. This would make RL rollouts over very long contexts practical. - The goal is to match the bits-per-character or bits-per-word of a standard Transformer on a language modeling task, using a linear-attention model with different hyperparameters and a similar parameter count. - The authors suggest linear attention may need much higher-dimensional key and value vectors, and that this may prove impossible. ## Learned Data Augmentation - Train a VAE on the inputs, then augment each training point by encoding it, adding a small Gaussian perturbation in latent space, and decoding it back. - The hope is that this captures nonlinear transformations such as viewpoint or lighting changes, and approximates the transformations under which labels are invariant. ## Regularization in Reinforcement Learning - Empirically test and qualitatively explain how regularizers like dropout, batch normalization, and L2 affect RL algorithms such as policy gradients and Q-learning, where they have historically helped little. - RL practitioners use much smaller models than supervised learning does, and larger models often perform worse, possibly because they overfit to recent experience. ## Automated Olympiad Inequality Proving - Build a dataset of olympiad inequality problems and write a program that solves a large share of them. - Machine learning may or may not help, but a learned policy could reduce the search branching factor.

OpenAI2017-05-143 min readCurated summary

Roboschool

# Roboschool: Open-Source Robot Simulation for OpenAI Gym OpenAI released Roboschool, an open-source robot simulation package integrated with OpenAI Gym. It offers free alternatives to eight MuJoCo environments, re-tuned for more realistic motion, along with new challenging tasks and support for training multiple agents in the same environment. Built on the permissively licensed Bullet Physics Engine, it removes the paid-license barrier that MuJoCo imposed on researchers. ## Free Alternative to MuJoCo - The MuJoCo dependency required a paid license, a common complaint among Gym users, though MuJoCo later added free student licenses. - Roboschool is built on the Bullet Physics Engine, an open-source library also used by simulators such as Gazebo and V-REP. - Twelve environments ship with the package, including ported MuJoCo tasks modified for more realistic behavior and new challenges. - Trained policies for these environments are available in the `agent_zoo` folder, and a `demo_race` script lets three robots race each other. ## Interactive and Robust Locomotion - Earlier Gym walking tasks only required moving forward, so learned policies often settled into a single cyclic gait, left most of the state space unexplored, and fell over after small pushes. - **HumanoidFlagrun** requires the 3D humanoid to run toward a flag whose position changes randomly, teaching it to slow down and turn. - **HumanoidFlagrunHarder** adds more difficulty: episodes start with the robot upright or lying down, the robot may fall and must get back up, and white cubes are constantly thrown at it to knock it off course. - The resulting policies are less fast and natural-looking than the regular humanoid's walk, but they recover from many disturbances and steer well. Because the policy is a multilayer perceptron with no internal state, the authors suspect the agent sometimes uses its arms to store information. ## Multiplayer Training - Roboschool supports running and training multiple agents in one environment, starting with a multiplayer Pong environment. - Setups include self-play (one agent playing both sides), two agents trained with the same algorithm, or two agents trained with different algorithms. - Training both players simultaneously with policy gradient methods caused oscillation: each agent learned a counter-strategy, then overfit to it, and neither improved after hours of training. - The authors note that adversarial learning is difficult, much like GANs, but it can produce sophisticated strategies in simple environments and a natural curriculum, making it a worthwhile research problem. ## Related Work - Other community projects have built Gym environments on open-source physics simulators. One fork replaced MuJoCo with the DART simulator and showed that policies transfer between MuJoCo and DART.

OpenAI2016-12-044 min readCurated summary

Universe

# Universe: A Platform for Training AI on General Computer Tasks OpenAI's Universe is a software platform for measuring and training AI agents across the full range of tasks a human can perform on a computer. Instead of relying on special APIs or access to program internals, Universe lets an agent view screen pixels and operate a virtual keyboard and mouse, the same way a person does. The release includes roughly a thousand environments, from Flash games and browser tasks to commercial games, with the goal of building a single agent that can quickly master unfamiliar tasks, a step toward general intelligence. ## Motivation: Narrow AI and the Lack of Transferable Experience - Existing systems such as AlphaGo achieve superhuman performance in one domain but cannot apply that knowledge elsewhere. - Standard RL training starts agents from scratch and relies on tens of millions of random trials, so experience does not carry over between tasks. - Progress toward general intelligence requires agents to train on a wide variety of tasks so they can build reusable world knowledge and problem-solving strategies. ## Universe Infrastructure - Each environment runs inside a Docker container that exposes a VNC server for pixels and keyboard/mouse input, plus a WebSocket server that sends rewards and auxiliary information and accepts control messages. - The `universe` Python library acts as a VNC client and wraps each environment as a standard Gym environment, so any program can be turned into one without access to its source code. - Performance target: a single Python process drives 20 environments in parallel at 60 frames per second. A batch-oriented VNC client written in Go and loaded as a shared library keeps frame transfer efficient, reaching about 100ms latency, mostly from server-side encoding. - Debugging and demonstrations are simple: an observer can attach a VNC client to watch training, and human demonstrations can be recorded by saving VNC traffic. These demonstrations can seed agents through behavioral cloning before RL fine-tuning. ## Environment Types - **Atari games:** Run asynchronously over the network, so agents must handle realistic lag (about 20ms observation and 10ms action lag on a cloud LAN, higher over the public internet). - **Flash games:** About 1,000 are included (100 with reward functions), distributed with rightsholder consent. Selenium launches Chrome and clicks through menus automatically. - **Reward extraction:** Since game memory formats vary widely, rewards are read from on-screen scores using a convolutional neural network OCR model. Off-the-shelf OCR like Tesseract struggled with game fonts and animated backgrounds. - **Browser tasks:** Mini World of Bits is an 80-environment benchmark, analogous to MNIST, ranging from clicking a button to replying to an email. Realistic flight-booking tasks use cached site recordings to avoid live bookings. ## Validation Experiments - **Pong:** The agent learned to reach a score of +17 (out of 21) in about an hour, while humans on the same version averaged -11, showing that the variable latency still allows precise, fast reactions. - **Racing Flash games:** RL worked after standard techniques such as reward normalization. - **Browser tasks:** Some tasks with hard exploration problems were solved through behavioral cloning from human demonstrations. - **slither.io:** Agents controlled 32 environments at 5 frames per second. Average reaction time was about 150ms over the public internet, compared with roughly 250ms for humans. ## Running Universe - Install Docker and the `universe` library, then start a runtime such as `universe.flashgames`, which exposes VNC on port 5900 and WebSocket on port 15900. - The Gym interface is used the same way as in other Gym environments, with `env.reset()`, `env.step()`, and `env.render()`. - For large-scale use, an allocator service provisions runtimes on a Kubernetes cluster on demand. ## Future Plans and Community Involvement - A transfer learning benchmark was planned, to measure whether agents actually improve at general problem solving. - The authors compared the project to ImageNet, whose error rate fell from 28% in 2010 to 3% in 2016. They hope Universe can follow a similar path of rapid progress. - Planned contributions include granting permission for games and apps, training agents on Universe tasks, integrating new environments with forthcoming tools, and contributing human demonstrations. - Partners include EA, Valve, Microsoft, NVIDIA, and many independent game studios. Microsoft's Project Malmo team was also planning an integration. ## Practical Takeaway Universe makes it possible to train and evaluate one agent across a broad set of real computer programs using only pixels and input events. Researchers who want to test general problem-solving ability, rather than narrow game performance, can start with the Docker runtimes and the Gym interface.

OpenAI2016-04-263 min readCurated summary

OpenAI Gym Beta

# OpenAI Gym Beta: A Shared Toolkit for Reinforcement Learning Research OpenAI has released the public beta of OpenAI Gym, an open toolkit for developing and comparing reinforcement learning (RL) algorithms. It pairs a growing suite of environments, ranging from simple control tasks to Atari games and simulated robots, with a site for comparing and reproducing results. The authors built it to speed up their own research and hope it becomes equally useful to the wider community. ## Why RL Needs Better Infrastructure - RL covers any problem involving a sequence of decisions, such as robot locomotion, pricing and inventory management, video games, and board games. It has also been applied to supervised problems with sequential or structured outputs. - Recent deep RL systems, including DeepMind's Atari work, BRETT, and AlphaGo, make few assumptions about their environments, so they transfer across settings. Earlier RL methods required heavy problem-specific engineering. - Two obstacles slow progress: - **Weak benchmarks:** Supervised learning advanced through large labeled datasets like ImageNet. RL lacks an equivalent, and existing open-source environment collections are narrow and often hard to set up. - **Inconsistent environments:** Small differences in reward functions or action sets can change a task's difficulty dramatically, which makes published results hard to reproduce or compare. ## The Environment Suite - **Classic control and toy text:** Small-scale tasks from the RL literature, intended as a starting point. - **Algorithmic:** Tasks such as adding multi-digit numbers or reversing sequences, learned purely from examples. Difficulty scales with sequence length. - **Atari:** Classic games through an easy-to-install integration of the Arcade Learning Environment. - **Board games:** Go on 9x9 and 19x19 boards against a fixed Pachi opponent. Multi-player support is planned. - **2D and 3D robots:** Simulated control tasks built on the MuJoCo physics engine, including environments from a UC Berkeley benchmark. MuJoCo is proprietary but offers free trial licenses. Each environment carries a version number, such as Hopper-v0. Any change to an environment produces a new version, so results on a given version stay comparable over time. ## Evaluation Without Leaderboards - Users can upload results, but OpenAI chose not to build traditional leaderboards, since raw scores can be gamed through overfitting or hand-crafted solutions. - Instead, a curated list highlights contributions that show something interesting about algorithmic capability. The long-term goal is for this curation to be community-led. - Partners supporting the launch include NVIDIA (technical Q&A), Nervana (a DQN agent implementation), and AWS (US$250 credit vouchers for promising, resource-constrained researchers). ## Getting Involved - Work through the tutorial, or reproduce an existing result. - During the beta, feedback is requested on making the tool better for research. Contributors can push the state of the art on each environment, reproduce published results, or build new environments. Community chat is open.