Table of Contents
Fetching ...

rlpyt: A Research Code Base for Deep Reinforcement Learning in PyTorch

Adam Stooke, Pieter Abbeel

TL;DR

rlpyt addresses the fragmentation in deep RL codebases by unifying DQN, policy-gradient, and Q-value policy-gradient methods under a single, modular PyTorch framework designed for high-throughput, small- to mid-scale research. It provides a robust parallel infrastructure with configurable sampling and optimization (including synchronous/mAMP- and asynchronous modes on CPU/GPU), a recurrent-capable data flow, and a new namedarraytuple data structure to manage multi-modal inputs. The paper demonstrates learning performance on Mujoco and Atari, including reproducing R2D2-style results, and outlines detailed implementation and usage notes, OpenAI Gym integration, and launch utilities. Collectively, rlpy t reduces reimplementation effort, speeds experimentation, and serves as a versatile platform for current and near-future RL research, with planned expansions into meta-learning, model-based, and multi-agent directions.

Abstract

Since the recent advent of deep reinforcement learning for game play and simulated robotic control, a multitude of new algorithms have flourished. Most are model-free algorithms which can be categorized into three families: deep Q-learning, policy gradients, and Q-value policy gradients. These have developed along separate lines of research, such that few, if any, code bases incorporate all three kinds. Yet these algorithms share a great depth of common deep reinforcement learning machinery. We are pleased to share rlpyt, which implements all three algorithm families on top of a shared, optimized infrastructure, in a single repository. It contains modular implementations of many common deep RL algorithms in Python using PyTorch, a leading deep learning library. rlpyt is designed as a high-throughput code base for small- to medium-scale research in deep RL. This white paper summarizes its features, algorithms implemented, and relation to prior work, and concludes with detailed implementation and usage notes. rlpyt is available at https://github.com/astooke/rlpyt.

rlpyt: A Research Code Base for Deep Reinforcement Learning in PyTorch

TL;DR

rlpyt addresses the fragmentation in deep RL codebases by unifying DQN, policy-gradient, and Q-value policy-gradient methods under a single, modular PyTorch framework designed for high-throughput, small- to mid-scale research. It provides a robust parallel infrastructure with configurable sampling and optimization (including synchronous/mAMP- and asynchronous modes on CPU/GPU), a recurrent-capable data flow, and a new namedarraytuple data structure to manage multi-modal inputs. The paper demonstrates learning performance on Mujoco and Atari, including reproducing R2D2-style results, and outlines detailed implementation and usage notes, OpenAI Gym integration, and launch utilities. Collectively, rlpy t reduces reimplementation effort, speeds experimentation, and serves as a versatile platform for current and near-future RL research, with planned expansions into meta-learning, model-based, and multi-agent directions.

Abstract

Since the recent advent of deep reinforcement learning for game play and simulated robotic control, a multitude of new algorithms have flourished. Most are model-free algorithms which can be categorized into three families: deep Q-learning, policy gradients, and Q-value policy gradients. These have developed along separate lines of research, such that few, if any, code bases incorporate all three kinds. Yet these algorithms share a great depth of common deep reinforcement learning machinery. We are pleased to share rlpyt, which implements all three algorithm families on top of a shared, optimized infrastructure, in a single repository. It contains modular implementations of many common deep RL algorithms in Python using PyTorch, a leading deep learning library. rlpyt is designed as a high-throughput code base for small- to medium-scale research in deep RL. This white paper summarizes its features, algorithms implemented, and relation to prior work, and concludes with detailed implementation and usage notes. rlpyt is available at https://github.com/astooke/rlpyt.

Paper Structure

This paper contains 20 sections, 8 figures.

Figures (8)

  • Figure 1: Environment interaction sampling schemes. (left) Serial: agent and environments execute within one Python process. (center) Parallel-CPU: agent and environments execute on CPU in parallel worker processes. (right) Parallel-GPU: environments execute on CPU in parallel workers processes, agent executes in central process, enabling batched action-selection.
  • Figure 2: Synchronous multi-process reinforcement learning. Each python process runs a copy of the full sampler-algorithm stack, with synchronization enforced implicitly during backpropagation in PyTorch’s DistribuedDataParallel class. Both GPU (NCCL backend) and CPU (gloo backend) modes are supported.
  • Figure 3: Asynchronous sampling/optimization mode. Separate python processes run optimization and sampling via a shared-memory replay buffer under read-write lock. Memory copier processes write from the sampler batch buffer (a double buffer) to the replay buffer, freeing the sampler to proceed immediately from batch to batch of collection.
  • Figure 4: Continuous control in Mujoco by RL algorithms--DDPG (settings from td3), TD3, SAC, and PPO; 4 random seeds each.
  • Figure 5: Policy gradient algorithms--A2C (feed-forward), A2C-LSTM (1-frame observation), A2C-2GPU (synchronous mode), PPO; 2 random seeds each.
  • ...and 3 more figures