Quantized Reinforcement Learning (QUARL)

Srivatsan Krishnan, Sharad Chitlangia, Maximilian Lam, Zishen Wan, Aleksandra Faust, Vijay Janapa Reddi

Abstract

Deep reinforcement learning continues to show tremendous potential in achieving task-level autonomy, however, its computational and energy demands remain prohibitively high. In this paper, we tackle this problem by applying quantization to reinforcement learning. To that end, we introduce a novel Reinforcement Learning (RL) training paradigm, ActorQ, to speed up actor-learner distributed RL training. ActorQ leverages 8-bit quantized actors to speed up data collection without affecting learning convergence. Our quantized distributed RL training system, ActorQ, demonstrates end-to-end speedups between 1.5x and 5.41x, and faster convergence over full precision training on a range of tasks (Deepmind Control Suite) and different RL algorithms (D4PG, DQN). Furthermore, we compare the carbon emissions (Kgs of CO2) of ActorQ versus standard reinforcement learning algorithms on various tasks. Across various settings, we show that ActorQ enables more environmentally friendly reinforcement learning by achieving carbon emission improvements between 1.9x and 3.76x compared to training RL-agents in full-precision.

Introduction

Reinforcement Learning (RL) has demonstrated remarkable success in mastering complex domains ranging from robotics to strategic games. However, the computational cost of training these agents is substantial. Large-scale distributed training, while effective for reducing wall-clock time, requires massive clusters of GPUs and CPUs, leading to high energy consumption and a significant carbon footprint.

The primary bottlenecks in distributed RL training are inference latency and communication overhead. In a typical actor-learner setup, actors spend a significant portion of their time performing inference to decide on actions. When done in full 32-bit precision (fp32) on CPUs, this process is slow. Additionally, the learner must frequently broadcast updated model weights to all actors, creating a communication bottleneck that scales with the number of actors and model size.

The ActorQ Paradigm

To address these challenges, we propose ActorQ, a distributed RL training paradigm that utilizes a hybrid precision strategy. Unlike standard distributed RL where all components operate in fp32, ActorQ selectively applies quantization to the actors.

Comparison of standard distributed RL architecture (left) and the proposed ActorQ architecture (right).

As shown in the architecture comparison, the Learner remains in full precision (fp32) to ensure gradient accuracy and stable convergence. However, before the Learner broadcasts the model to the Actors, a Quantizer block converts the weights to 8-bit integers (int8). The Actors then perform environment rollouts using this lightweight model. This approach provides two main benefits:

  1. Reduced Inference Latency: 8-bit operations are significantly faster on most hardware.
  2. Reduced Communication Overhead: The broadcast payload is reduced by 4x, accelerating the data transfer between the Learner and Actors.

Experimental Evaluation

We evaluated ActorQ across several standard RL benchmarks, including the DeepMind Control Suite, OpenAI Gym (Atari), and PyBullet. We tested the system using both D4PG (for continuous control) and DQN (for discrete tasks).

Our findings indicate that RL policies are remarkably resilient to quantization. Even when reduced to 8-bit precision, agents achieved performance levels comparable to their full-precision counterparts. In some instances, the noise introduced by quantization even aided exploration, leading to faster convergence.

Results and Sustainability

ActorQ achieved significant improvements in both training speed and environmental impact. End-to-end training speedups ranged from 1.5x to 5.41x. More importantly, the system demonstrated a substantial reduction in carbon emissions.

Breakdown of carbon emissions and runtime for int8 vs fp32 training.

As illustrated in the breakdown, the transition to int8 precision for actors drastically reduces the carbon footprint and runtime associated with the "Actors" and "Broadcast" components. Overall, ActorQ achieved carbon emission improvements between 1.9x and 3.76x across various tasks.

Conclusion

ActorQ demonstrates that quantization is a powerful tool for making reinforcement learning more efficient and sustainable. By shrinking the precision of actor models, we can achieve significant speedups and energy savings without sacrificing agent performance. Future work will explore the potential for quantizing the learner itself and leveraging specialized hardware for even lower-precision operations.

Summary updated

Abstract

Deep reinforcement learning continues to show tremendous potential in achieving task-level autonomy, however, its computational and energy demands remain prohibitively high. In this paper, we tackle this problem by applying quantization to reinforcement learning. To that end, we introduce a novel Reinforcement Learning (RL) training paradigm, \textit{ActorQ}, to speed up actor-learner distributed RL training. \textit{ActorQ} leverages 8-bit quantized actors to speed up data collection without affecting learning convergence. Our quantized distributed RL training system, \textit{ActorQ}, demonstrates end-to-end speedups \blue{between 1.5 $\times$ and 5.41$\times$}, and faster convergence over full precision training on a range of tasks (Deepmind Control Suite) and different RL algorithms (D4PG, DQN). Furthermore, we compare the carbon emissions (Kgs of CO2) of \textit{ActorQ} versus standard reinforcement learning \blue{algorithms} on various tasks. Across various settings, we show that \textit{ActorQ} enables more environmentally friendly reinforcement learning by achieving \blue{carbon emission improvements between 1.9$\times$ and 3.76$\times$} compared to training RL-agents in full-precision. We believe that this is the first of many future works on enabling computationally energy-efficient and sustainable reinforcement learning. The source code is available here for the public to use: \url{https://github.com/harvard-edge/QuaRL}.
BibTeX
@misc{krishnan2021quantized,
  author = {Srivatsan Krishnan and Sharad Chitlangia and Maximilian Lam and Zishen Wan and Aleksandra Faust and Vijay Janapa Reddi},
  title = {{Quantized Reinforcement Learning (QUARL)}},
  year = {2021},
  eprint = {1910.01055},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.01055},
}
Figure