# OpenAI Gym

Gym standardizes reinforcement learning environments behind one shared interface

Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang and 1 more · arXiv · 2016-6-5

- **Problem** Reinforcement learning results are hard to compare across papers, because there are no shared benchmarks with fixed tasks. Existing suites are scattered and checking generalization is costly.
- **Method** OpenAI Gym packages tasks as environments that all expose the same reset and step calls. Agents stay ordinary user code, and each environment is versioned so results stay comparable.
- **Results** The paper presents the toolkit and its design decisions, and reports no measured agent performance. Users share results and code on public scoreboards.

## Why RL results are hard to compare

Deep reinforcement learning has made general methods such as policy gradients and Q-learning look promising on hard problems. Progress like this depends on shared benchmarks against which algorithms can be checked. Several benchmarks already exist, among them the Arcade Learning Environment for Atari 2600 games and the RLLab suite for continuous control.

OpenAI Gym aims to merge the strongest features of these earlier collections into one convenient package.

A benchmark score only means something if the task behind it stays fixed. In supervised learning a hidden test set guards against overfitting, but RL has no equally simple check. Measuring generalization in RL would mean running user code on many unseen environments, which is computationally expensive. So the Gym authors lean on shared code and written reports instead of a hidden test set.

A website hosts scoreboards for every environment, showing results that users submit. Users are encouraged to link their source code and give instructions for reproducing their results.

## The episode loop behind the interface

The key idea is to standardize only the environment side, so every task exposes the same reset and step calls while the agent stays ordinary user code. Gym focuses on episodic reinforcement learning, in which the start state of each episode is drawn from a distribution and the episode ends at a terminal state. The goal in this setting is to maximize expected total reward per episode, and to do so in as few episodes as possible.

The code example runs one episode of 100 timesteps. Calling env.reset() samples a state and returns the first observation, and each env.step(action) returns the next observation, a reward, a done flag and an info object. The loop ends when done is True, which marks the terminal state, as in the final call where done99 is True.

Gym defines no agent class and prescribes no agent interface, so the agent object in the snippet is only for demonstration. This leaves room for two styles: an online learner that updates from the observation, reward and done flag at each step, and a batch learner that receives only observations while rewards are collected separately. Because only the environment is abstracted, the environment side stays the same whichever style the user picks.

## Measuring learning on two axes

Sample complexity can be measured by counting the episodes needed before average performance exceeds a threshold. That threshold is set per environment, for example at 90% of the maximum performance of a very heavily trained agent.

Final performance on its own is a weak signal, because arbitrary amounts of computation can raise it. So a final score can say more about the computation spent than about the quality of the algorithm. Reporting sample complexity next to it separates how well an algorithm learns from how much it was allowed to spend.

## Keeping results comparable over time

Environments are versioned, so any change to an environment comes with a higher version number. Results obtained before and after a change would otherwise be incomparable, and the version number keeps them apart. For example, the initial CartPole task is named Cartpole-v0, and a changed version would be named Cartpole-v1.

Without a hidden test set, one can't tell whether a method overfit to the tasks it was tested on, for instance through parameter tuning. Gym asks users to publish a Writeup describing the algorithm and its parameters, with a link to the code. With the source available, a reader can judge whether a result reflects the method or the particular tasks.

The scoreboards were inspired by Kaggle, but their aim is to share code and ideas rather than to run a contest. The authors treat the scoreboards as a benchmark for comparing methods, which is why they favour peer review over competition.

## Monitoring and the shipped tasks

By default each environment is instrumented with a Monitor. The Monitor records every time step and every reset, and it can record video periodically. The data it collects is enough to produce learning curves, and the videos and curve data can be posted to the Gym website.

At the initial beta release the catalogue covered classic control and toy text, algorithmic tasks, Atari games, board games and 2D and 3D robots. The Atari tasks use the Arcade Learning Environment and can take screen images or RAM as input. The Go tasks are played on 9x9 and 19x19 boards, with the Pachi engine as the opponent. The robot tasks run on the MuJoCo physics engine, and some are adapted from RLLab.

Later additions include environments built on the Box2D physics engine and on the Doom game engine through VizDoom.

## Open directions and limits

The authors name three planned extensions: a multi-agent setting, curriculum and transfer learning, and real-world operation. Curriculum and transfer tasks would be ordered sequences of increasingly difficult problems, solved one after another. Real-world operation would connect the Gym API to robotic hardware.

Gym leaves the agent side open, so each user has to build the agent interface. This whitepaper describes design choices and reports no measured agent performance on the tasks.

## Paper info

- **Authors**: Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, Wojciech Zaremba
- **Venue**: arXiv · Preprint
- **First published**: 2016-6-5
- **Added**: 2026-11-11
- **Updated**: 2016-6-5
- **Version**: v1
- **arXiv**: 1606.01540
- **Category**: cs.LG · cs.AI
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1606.01540v1) · [PDF ↗](https://arxiv.org/pdf/1606.01540v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, Wojciech Zaremba (2016). OpenAI Gym. arXiv:1606.01540v1. https://arxiv.org/abs/1606.01540v1

**BibTeX**

```
@misc{brockman2016openai,
  title = {{OpenAI Gym}},
  author = {Greg Brockman and Vicki Cheung and Ludwig Pettersson and Jonas Schneider and John Schulman and Jie Tang and Wojciech Zaremba},
  year = {2016},
  eprint = {1606.01540},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.01540v1}
}
```

## Other paper commentary

- [Evaluation: from precision, recall and F-measure to ROC, informedness, markedness and correlation](https://refivu.com/en/papers/8d51315a-ef79-4c4f-a429-17bee5b397f4-evaluation-from-precision-recall-and-f-measure-to.md)
- [Puzzling-Bench: Evaluating Language Models on 23,777 Human-Written Puzzles with Community-Verified Answers](https://refivu.com/en/papers/1b9641d7-d6fa-4ead-8f16-7134498580d3-puzzling-bench-evaluating-language-models-on-23-777.md)
- [Refusal Is Not Scored: A Coverage Limit in Content-Based Bias Evaluation](https://refivu.com/en/papers/d282d82d-de6e-498c-898b-66902724ac0d-refusal-is-not-scored-a-coverage-limit-in.md)
- [ProMiSE: Protein Multi-State Evaluation Benchmark in Biological Contexts](https://refivu.com/en/papers/e163e455-fb04-4bd6-8669-b48b49fec9e9-promise-protein-multi-state-evaluation-benchmark-in.md)
- [OWE-Bench: A long-horizon benchmark for measuring real-world engineering](https://refivu.com/en/papers/7bf5dadf-998c-4908-8782-37501a593ad5-owe-bench-a-long-horizon-benchmark-for-measuring.md)
- [Diagnostic Accuracy Is Not Deployment Value: Decision-Aligned Reliability Evaluation for Foundation MLIPs in Materials Discovery](https://refivu.com/en/papers/1fbe0ca2-cd2b-42b0-94f7-4e5e37ccbb85-diagnostic-accuracy-is-not-deployment-value-decision-aligned.md)
- [OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields](https://refivu.com/en/papers/5a0057d5-5ad8-405d-b3a0-1ddc3220df6c-openpose-realtime-multi-person-2d-pose-estimation-using.md)
- [DETRs Beat YOLOs on Real-time Object Detection](https://refivu.com/en/papers/2872fb04-6c8b-4f48-a976-80e6dd5be309-detrs-beat-yolos-on-real-time-object-detection.md)
- [BPR: Bayesian Personalized Ranking from Implicit Feedback](https://refivu.com/en/papers/e3d177de-9c9b-45b7-bcb5-9ef28bee1dbb-bpr-bayesian-personalized-ranking-from-implicit-feedback.md)
- [Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)](https://refivu.com/en/papers/22cdac80-1bc9-4b93-8cf1-9d62eff18d48-fast-and-accurate-deep-network-learning-by-exponential.md)
- [Prototypical Networks for Few-shot Learning](https://refivu.com/en/papers/04a3b578-d356-4e26-95c4-7e6362f71054-prototypical-networks-for-few-shot-learning.md)
- [Explanation in Artificial Intelligence: Insights from the Social Sciences](https://refivu.com/en/papers/97a0e87f-2056-41e6-ba4d-00a7f2aa4ab0-explanation-in-artificial-intelligence-insights-from-the.md)

## Terms in this paper

- [reinforcement learning](https://refivu.com/en/terms/6c51042515d2-reinforcement-learning)
- [MuJoCo](https://refivu.com/en/terms/3bbbe9014268-mujoco)
- [OpenAI Gym](https://refivu.com/en/terms/282eddeda3d8-openai-gym)
- [partially observable Markov decision process](https://refivu.com/en/terms/4e32d4575cd4-partially-observable-markov-decision-process)
- [Arcade Learning Environment](https://refivu.com/en/terms/e4eb3fb7dbe7-arcade-learning-environment)
- [benchmark](https://refivu.com/en/terms/83ba7f0a7ab9-benchmark)
- [sample complexity](https://refivu.com/en/terms/feb942fc9510-sample-complexity)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/0be35f1c-219a-4606-a9f9-894f5c111448-openai-gym)
