techlist.io

Ppo

13 posts

OpenAI2024-07-234 min readCurated summary

Improving Model Safety Behavior with Rule-Based Rewards

# Improving Model Safety Behavior with Rule-Based Rewards OpenAI introduces Rule-Based Rewards (RBRs), a method that aligns models to behave safely without collecting large amounts of human feedback. RBRs use clear, step-by-step rules scored by a fixed grader model and feed those scores into the standard RLHF pipeline as an additional reward signal. The authors report that RBR-trained models match the safety of human-feedback-trained models, overrefuse less, and keep capability benchmark scores intact, while remaining cheap to update when safety policies change. ## Why Human Feedback Falls Short for Safety - Standard RLHF relies on human feedback to train a reward model that signals desirable behavior. - Collecting human feedback for routine, repetitive safety cases is inefficient. - When safety policies change, previously collected feedback can become outdated and require new data collection. ## How Rule-Based Rewards Work - Developers define **propositions**, simple true/false statements about a response, such as "Response is judgmental towards the user," "Response contains a short apology and inability to comply," "Response answers the user's request in a non-refusing manner," and "Response is maximally helpful for the user." - Propositions are combined into **rules** that encode what an ideal response looks like for a given scenario. For example, a refusal should contain a brief apology and state an inability to comply. - A fixed grader language model scores each response against these rules. - A linear model, with weights learned from a small dataset of prompts labeled with ideal response types and desired and undesired completions, converts the rule scores into a reward. - This RBR reward is combined with a helpful-only reward model and used as an additional signal in PPO to train the model. ## Three Response Categories - **Hard refusals** apply to requests such as criminal hate speech, advice for violent crimes, and extremism. The ideal response is a brief apology and a statement of inability to comply, without verbosity or judgmental language. - **Soft refusals** apply to requests involving self-harm. The ideal response is a more empathetic apology that acknowledges the user's emotional state while still declining. - **Comply** applies to benign requests, where the model should answer helpfully. ## Results - RBR-trained models reach safety performance comparable to models trained with human feedback. - They reduce overrefusal of safe requests without degrading common capability benchmarks. - They require far less human data, making training faster and cheaper. - Rules can be updated by editing or adding them, without extensive retraining. - Evaluation tracks a trade-off curve: usefulness (share of safe prompts correctly complied with) against safety (share of unsafe prompts correctly refused). Helpfulness-only baselines are more useful but less safe, while human-feedback baselines are very safe but less useful. RBR aims for the top-right corner, where both are high. ## Limitations and Ethical Considerations - RBRs work best for tasks with clear, straightforward rules and are harder to apply to subjective qualities such as essay quality. - The authors suggest combining RBRs with human feedback. RBRs enforce specific guidelines, such as avoiding slang or following the Model Spec, while human feedback handles nuanced aspects like coherence and writing style. - The RBR term is designed to enforce safety without dominating the overall reward more than necessary. - Shifting safety checks from humans to AI can reduce human oversight and may amplify biases if the grader model is biased. Careful rule design and a mix of RBRs and human feedback are recommended to mitigate these risks. ## Future Directions The authors see RBRs as applicable beyond safety, for example to shaping a model's personality or response format for a specific application. Planned work includes ablation studies of RBR components, using synthetic data for rule development, and human evaluations across more domains.

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.

OpenAI2019-04-143 min readCurated summary

OpenAI Five defeats Dota 2 world champions

# OpenAI Five Becomes the First AI to Beat Esports World Champions OpenAI Five defeated OG, the reigning Dota 2 world champions, in two consecutive games at the Finals, marking the first time an AI has beaten world champions in an esports game and the first time it has done so on livestream. The post argues that the key to this milestone was scale rather than new algorithms, and that the same system could be turned from a competitor into a cooperative teammate with relatively little effort. ## Why Dota Was a Hard Target - The team chose Dota because it seemed beyond existing deep reinforcement learning methods, expecting to need ideas like hierarchical RL. - The main missing ingredient turned out to be scale. Their system, Rapid, ran PPO at unprecedented size, and they reached world-class play without hitting fundamental performance limits. - RL's data appetite remains a limitation. Rapid also trained a robotic hand in simulation to reorient a block, but reducing the required experience is a major open challenge. ## Compute and Training Scale - The Finals version beat The International 2018 version with a 99.9% winrate, though this figure is measured on the current patch, which favors the newer agent. - Compute increased 8x. The model consumed 800 petaflop/s-days and about 45,000 years of self-play over 10 realtime months, up from roughly 10,000 years over 1.5 months. - Since most compute was already devoted to a single model, the team scaled by training for longer rather than adding resources. ## Continuous Training and Transfer - The model has trained continuously since June 2018 through changes in model size and game rules, including major patches and new features. - The team built "surgery" tooling to transfer trained parameters across substantial architecture changes, addressing an open problem in RL. ## Expanding the Hero Pool - Going from 5 to 18 heroes caused little slowdown in training. Pools of up to 25 heroes reached about 5k MMR but did not reach pro level in time. - Hypotheses for the slowdown include limited model capacity, matchmaking issues with a larger pool, and the difficulty new heroes face catching up to mastered ones. - The Finals version uses 17 heroes, with Lich removed due to significant ability changes in patch 7.20. ## Cooperative Play - Although trained only by playing against copies of itself, the model generalized zero-shot to controlling a subset of heroes alongside or against humans. - Testers reported feeling supported by their bot teammates and found the experience enjoyable. ## Public Arena and Next Steps - OpenAI Five Arena lets the public play against the bot in competitive and cooperative modes from April 18 to April 21, 2019, with results posted to a public leaderboard. This tests how exploitable the system is. - A more technical analysis will follow the Arena results, and the team plans to keep using Dota 2 as a research environment for learning from less data and for human-AI cooperation. **Conclusion:** The post presents OpenAI Five's win as evidence that scaling existing RL methods can reach expert performance in complex environments, while data efficiency and robust human-AI cooperation remain open problems.

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

OpenAI2018-11-073 min readCurated summary

Spinning Up in Deep RL

# Spinning Up in Deep RL: An Open Educational Resource for Learning Deep Reinforcement Learning OpenAI released Spinning Up in Deep RL, an educational package designed to help newcomers become skilled practitioners of deep reinforcement learning. The argument is that deep RL is harder to break into than deep learning, yet it will play a central role in powerful AI systems, so accessible guidance is needed. The package combines clear code, documentation, curated papers, and exercises, and it is integrated into OpenAI's Scholars and Fellows programs. ## What the Package Includes - A short introduction to RL terminology, algorithm families, and basic theory - An essay on how to grow into an RL research role - A curated list of important papers organized by topic - A well-documented repository of short, standalone implementations of Vanilla Policy Gradient (VPG), Trust Region Policy Optimization (TRPO), Proximal Policy Optimization (PPO), Deep Deterministic Policy Gradient (DDPG), Twin Delayed DDPG (TD3), and Soft Actor-Critic (SAC) - A set of warm-up exercises ## Code Design Philosophy - The implementations are minimal and annotated, meant to show how theory maps directly to code - Abstraction layers common in deep RL libraries are deliberately avoided - Clarity is prioritized over modularity, so code reuse across algorithms is limited to logging and parallelization utilities - Each implementation is supported by background material and pseudocode on a corresponding readthedocs page - Algorithms run on Gym environments from the Classic Control, Box2D, and MuJoCo suites. For example, `python -m spinup.run ppo --env CartPole-v1 --exp_name hello_world` launches a training run ## Support Plan - **High-bandwidth period (first three weeks):** Rapid fixes for bugs, installation problems, and documentation ambiguities - **Major review (April 2019):** A broader assessment of the package based on community feedback, with announced plans for future changes - **Continuous public updates:** Changes made while working with Scholars and Fellows are pushed to the public repository immediately ## Education Initiative and Workshops - The project is part of OpenAI's education effort, which aims to build a global community working on AGI's challenges, in line with the OpenAI Charter - A workshop at OpenAI San Francisco on February 2, 2019 combined 3 hours of lectures with 5 hours of semi-structured project work, with technical staff support - Applicants were expected to have software engineering experience and some ML tinkering, though formal ML training was not required - The first external partnership is with UC Berkeley's Center for Human-Compatible AI (CHAI) for a similar early-2019 workshop ## Practical Takeaway For anyone wanting to learn deep RL, the post recommends running the algorithms directly to build intuition, then reading the annotated code alongside the theory and pseudocode. The package is designed for self-study, with minimal abstraction so learners can see exactly how each algorithm works.

OpenAI2018-07-034 min readCurated summary

Learning Montezuma’s Revenge from a single demonstration

# Learning Montezuma's Revenge from a Single Demonstration OpenAI trained an agent to score 74,500 on Montezuma's Revenge from a single human demonstration, a result better than any previously published. The method starts each reinforcement learning episode from a state in the demonstration and gradually moves the starting point back to the beginning of the game, optimizing the game score directly with PPO. This turns one hard exploration problem into a curriculum of short, easier subtasks. ## Why Exploration Is the Bottleneck - Model-free methods like policy gradients and Q-learning explore by taking random actions, which only works when rewards are frequent enough. - Games like Montezuma's Revenge require long, precise action sequences before any reward appears. If each of N actions has a fixed probability, the expected time to the first reward grows exponentially in N. - Getting the first key, for example, requires a chain of steps (down ladders, down a rope, jump a skull, climb a ladder), so the overall probability is far smaller than any single step's. ## Curriculum Built from Demonstration States - Each episode starts from a recorded demonstration state. Early in training, the agent starts near the end of the demonstration, where the remaining task is short. - Once the agent matches or beats the demonstrator's score on the remaining segment in at least 20% of rollouts, the starting point moves earlier in time. - This continues until the agent plays from the true start of the game without using the demonstration. - Because each stage is only slightly harder than the last, the agent's chance of success stays high, and the required exploration scales linearly rather than exponentially with the length of the action sequence. - The authors note that earlier work had proposed resetting to demonstration states, but the gradual backward curriculum was essential to getting a benefit from the demonstration. ## Comparison with Imitation Approaches - Prior DeepMind work imitated demonstrations, either by reproducing states from a YouTube video or by combining Q-learning with a likelihood term on demonstrated actions. - Those methods need less environment control, but this approach requires resetting the environment to arbitrary states and access to full game states from the demonstration. - Optimizing the game score directly avoids overfitting to a possibly suboptimal demonstration and allows the agent to discover strategies the demonstrator did not use. The authors also suggest this could help in multiplayer settings where opponents differ from the demonstrator. ## Remaining Challenges - **Generalization:** The agent rarely reproduces the exact demonstrated states because of frameskip differences and action randomness, so it must generalize to near-identical states. This works well for Montezuma's Revenge but much less well for Gravitar and Pitfall, which likely need better vision. - **Exploration–exploitation balance:** The PPO entropy coefficient, learning rate, and reward scaling required careful tuning. Gravitar and Pitfall never found workable hyperparameters for the full curriculum, and some runs for Montezuma's Revenge failed to converge. - **Robustness:** The trained policy does not yet generalize as well as a human. With sticky actions (repeat probability 0.25) it averages 10,000 points, and with random actions (probability 0.01) it averages 8,400. Humans also degrade under such perturbations, but less so. These perturbed scores still exceed previously published results. - **Start-state variation:** Starting with 0 to 30 random no-ops did not significantly hurt performance, with most rollouts reaching the demonstration's final score. ## Takeaway Decomposing a long-horizon sparse-reward problem into a curriculum of subtasks, seeded by demonstration states and optimized for the true reward, can solve tasks that pure random exploration cannot. The authors hope future RL algorithms will be more robust to noise and hyperparameter choices.

OpenAI2018-06-213 min readCurated summary

Retro Contest: Results

# OpenAI Retro Contest Results: Fast Learning and Generalization in Sonic The first OpenAI Retro Contest, which challenged participants to build reinforcement learning agents that generalize from prior experience, concluded with top results coming from tuned or extended versions of existing algorithms like PPO and Rainbow rather than contest-specific tricks. The best score reached 4,692 against a theoretical maximum of 10,000, which the author takes as evidence that the Sonic benchmark is a meaningful problem for the community to keep working on. The results also show that the winning approaches are general machine learning methods, so the benchmark cannot easily be gamed. ## Contest Scale and Evaluation Design - 923 teams registered over two months, and 229 submitted solutions to the leaderboard. - Automated systems ran 4,448 evaluations, about 20 submissions per team. - The public leaderboard used five low-quality levels built with a level editor. Because contestants saw scores and videos, they could overfit to it. - To prevent this, the final evaluation used 11 custom levels made by skilled level designers. The latest submission from each of the top 10 entrants was tested, with each agent run three times per level using different random seeds to reduce noise. - The ranking shifted only modestly in the final evaluation. ## Winning Approaches **Dharmaraja (1st, score 4,692)** - A variant of joint PPO with three main changes: RGB images instead of grayscale, a slightly larger action space with more common button combinations, and an augmented reward that favors visiting new states, judged by a perceptual hash of the screen. - Attempts that did not help included DeepMimic, YOLO-based object detection, and Sonic-specific heuristics. **Mistake (2nd, score 4,446)** - Built on the Rainbow baseline, with a tuned n-step value for n-step Q-learning, an extra CNN layer that slowed training but improved results, and a lower DQN target update interval. - Joint training with Rainbow reduced performance. The agent trained from scratch and timed out at 12 hours, which is why its learning curves end early. **Aborg (3rd, score 4,430)** - A solo effort building on joint PPO, adding more training levels from the Game Boy Advance and Master System Sonic games, a different network architecture, and hyperparameters tuned for fast fine-tuning. - The first 150K fine-tuning timesteps were unstable, so a learning rate adjustment fixed the performance drops. - Optimizers, MobileNetV2, and color images did not help. Dharmaraja and Aborg fine-tuned from a pre-trained network with PPO, while Mistake trained from scratch with Rainbow DQN. ## Awards for Write-ups and Community Support - **Best Write-up Prize** went to Dylan Djian, Oleg Mürk, and Felix Yu for essays describing the approaches they tried. - **Best Supporting Material** went to Tristan Sokol for tutorials, scripts, and a trajectory visualization tool that helped other contestants. ## Lessons and Next Steps - Several top solutions used transfer learning by fine-tuning from training levels, which the authors had expected. - Some top entries were simply well-tuned baseline algorithms, which underscores how much hyperparameters matter in RL, especially for Rainbow DQN. - Contests can challenge prevailing assumptions because many approaches get tried, but this one mostly confirmed what OpenAI already knew worked. - A second round is planned for a few months later, with the authors hoping more unconventional approaches will succeed.

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-173 min readCurated summary

Evolved Policy Gradients

# Evolved Policy Gradients: Learning the Loss Function Instead of the Policy OpenAI's Evolved Policy Gradients (EPG) is an experimental metalearning method that evolves the loss function used by learning agents rather than a policy or a reward function. Once evolved, the learned loss lets agents learn quickly on novel tasks and generalize beyond their training distribution, such as walking to a target on the opposite side of an arena from anything seen in training. EPG can also train agents faster than PPO, though the learned losses are currently narrow and do not transfer to very different kinds of tasks. ## Encoding Prior Knowledge as a Loss - Most RL agents start from a blank slate and depend entirely on external rewards, which is why they learn simple skills far more slowly than humans. - EPG instead encodes prior knowledge as a learned loss function, parameterized as a temporal-convolutional neural network, that tells the agent what counts as making progress. - The method is related to earlier work on evolving reward functions, but it goes further by evolving a complete loss, so the loss must effectively encode an RL algorithm internally. ## Two-Loop Optimization - **Inner loop:** An agent learns a task from scratch using stochastic gradient descent, optimizing its policy against the loss proposed by the outer loop. Tasks come from a family, such as "move gripper to target location [x, y]." - **Outer loop:** Evolution Strategies (ES) evaluate the returns achieved after inner-loop learning and adjust the loss parameters to produce higher returns. - Because ES optimizes final trained-policy performance rather than short-term returns, and the loss can adapt to the environment and the agent's history, the approach offers advantages over standard RL losses. ## Why Learn a Loss Instead of a Policy - Recurrent meta-learned policies tend to overfit the tasks they were trained on, and learned policy initializations offer limited help with exploration. - Loss functions are expected to generalize better across substantially different tasks, as hand-designed losses like PPO's already do across Atari and robotics. ## Generalization Experiment - Researchers evolved an EPG loss so that simulated "ants" learned to walk to random targets on the right half of an arena. - With the loss frozen, the ants were given targets on the left half. They learned to walk left, a case outside the training distribution. - RL², a baseline metalearning method that directly learns an adaptive policy, succeeded on the right-side targets but kept walking right when given left-side targets, which suggests it overfit to its training tasks. ## Limitations - An EPG loss is currently effective only for one small family of tasks at a time. It is unlikely to work on a very different task, such as Space Invaders. - Standard RL losses are general enough to learn a wide range of skills, so EPG trades generality for performance. - Metalearning methods that both outperform standard RL and retain its generality remain a long-term goal.

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.

OpenAI2017-09-133 min readCurated summary

Learning to model other minds

# Learning with Opponent-Learning Awareness OpenAI and the University of Oxford introduced LOLA, an algorithm that lets reinforcement learning agents account for the fact that other agents are learning at the same time. Instead of treating other learners as part of a static environment, a LOLA agent shapes how its opponents update their policies, which allows self-interested agents to discover cooperative strategies such as tit-for-tat in the iterated prisoner's dilemma. The authors present it as a small step toward agents that model other minds. ## Motivation: Learning Without a Theory of Mind - Humans collaborate well because they reason about how their actions will change others' future behavior and often find win-win arrangements. - Standard deep multi-agent RL lacks this capacity. A state-of-the-art agent treats another learning agent as no different from a tree in the environment. - Methods such as Independent PPO tend to converge on selfish behavior that ignores other agents' objectives. ## How LOLA Works - Each LOLA agent, "Alice," models how another agent's ("Bob's") parameter update depends on Alice's policy, and how Bob's update in turn affects Alice's expected future reward. - Alice optimizes her return after one anticipated learning step of Bob, differentiating through that step to shape Bob's update in a direction that benefits her. - The key term is a second-order correction. Its left-hand side captures how Alice's return depends on Bob's policy change, and its right-hand side captures how Bob's learning step depends on Alice's policy. Multiplying the two measures how Alice can steer Bob's learning toward higher rewards for herself. - With access to the true gradients and Hessians, the terms can be computed exactly. In practice, the second-order term is estimated from samples using the policy gradient theorem, which makes LOLA applicable to general deep RL settings. - LOLA requires access to the other agents' policies. LOLA-OM (opponent modeling) instead fits a model of the opponent from observed trajectories, predicting its parameters from its actions. The authors plan to extend this to infer opponents' architectures and rewards. ## Results - **Iterated prisoner's dilemma and coin game:** LOLA agents discover reciprocal strategies, while Independent PPO learns selfish behavior. - **Coin game:** Two agents, red and blue, collect coins. Any agent earns a point for collecting a coin, but collecting a coin of the other agent's color costs that agent 2 points. If both agents greedily collect every coin, both average zero. LOLA agents learn to mostly collect coins of their own color, earning high scores. - Both LOLA and LOLA-OM collect more coins and score substantially higher than the baselines. ## Limitations - LOLA performs best with large batch sizes and full roll-outs for variance reduction, which makes it memory- and compute-intensive. - Under opponent modeling, LOLA can be unstable, which the authors plan to address in future work.

OpenAI2017-08-022 min readCurated summary

Gathering human feedback

# Summary of "Gathering Human Feedback" (RL-Teacher) OpenAI released RL-Teacher, an open-source system for training AI agents with occasional human feedback instead of hand-crafted reward functions. The technique is aimed at safer AI systems and at reinforcement learning tasks where rewards are difficult to specify. The entire system is under 1,000 lines of Python, excluding the example agents. ## Core Components - **Reward predictor:** A module that can be plugged into any agent. It learns to predict which actions a human would approve of. - **Example agent:** An agent that learns from a reward function produced by the reward predictor. RL-Teacher includes three pre-integrated algorithms, including OpenAI Baselines PPO. - **Web app:** An interface where humans give feedback. This feedback is the data used to train the reward predictor. ## Running an Experiment - The web server must be set up first. An experiment is then launched with `rl_teacher/teach.py`, using the `human` feedback mode, 175 pretraining labels, the `Reacher-v1` environment, and a run name. - Human raters give feedback through the web interface, which can run locally (not recommended) or on a separate machine. - Full documentation is in the project's GitHub repository. OpenAI invites researchers and engineers to experiment with the tool and share their results.

OpenAI2017-07-193 min readCurated summary

Proximal Policy Optimization

# Proximal Policy Optimization: A Simpler, Robust Policy Gradient Method OpenAI introduces Proximal Policy Optimization (PPO), a new family of reinforcement learning algorithms that matches or beats state-of-the-art methods while being far simpler to implement and tune. The post argues that PPO strikes a practical balance between ease of implementation, sample efficiency, and ease of tuning, and reports that it has become OpenAI's default RL algorithm as a result. ## The Problems with Policy Gradient Methods - Policy gradient methods underpin many deep RL successes, including video games, 3D locomotion, and Go. - They are highly sensitive to the step size: too small and learning is painfully slow, too large and noise overwhelms the signal or performance collapses. - They often have poor sample efficiency, needing millions or billions of timesteps to learn simple tasks. ## Earlier Fixes: TRPO and ACER - TRPO and ACER constrain or otherwise optimize the size of each policy update to address these issues. - ACER is considerably more complex than PPO, requiring off-policy corrections and a replay buffer, while only marginally outperforming PPO on Atari. - TRPO works well for continuous control but is hard to combine with architectures that share parameters between the policy and value function, or that use auxiliary losses, which are common in vision-heavy domains like Atari. ## The PPO Objective - Supervised learning is predictable, whereas RL algorithms have many interacting parts that are hard to debug and require heavy tuning. - PPO computes each update to minimize the cost function while keeping the new policy close to the previous one. - An earlier PPO variant used an adaptive KL penalty to control policy change. The new version replaces this with a clipped surrogate objective built from the probability ratio between the new and old policies, multiplied by the estimated advantage, with a clipping hyperparameter ε typically set to 0.1 or 0.2. - This objective approximates a trust region update while remaining compatible with stochastic gradient descent. It removes the KL penalty and the need for adaptive update schedules. - In tests, PPO performed best on continuous control tasks and nearly matched ACER on Atari. ## Demonstration: Controllable Robots - Interactive agents trained with PPO were shown in Roboschool, where a user set new target positions for a robot via keyboard. - Although the input sequences differed from the training distribution, the agent generalized to them. ## Released Implementations - OpenAI Baselines now includes scalable, parallel implementations of PPO and TRPO that use MPI for data passing, written in Python 3 and TensorFlow. - Pre-trained policies for the robots are available in the Roboschool agent zoo. - A later update added PPO2, a GPU-enabled implementation that runs about 3x faster than the original PPO baseline on Atari. - The update also added ACER, which uses a replay buffer to perform multiple gradient updates per sample and a Q-function approximator trained with the Retrace algorithm. ## Conclusion PPO offers a practical default for policy gradient reinforcement learning: it is simpler than TRPO and ACER, performs comparably or better across continuous control and Atari, and is easier to tune. Its open-source implementations in Baselines make it straightforward to adopt.