QuaRL: Quantization for Fast and Environmentally Sustainable Reinforcement Learning

Srivatsan Krishnan, Maximilian Lam, Sharad Chitlangia, Zishen Wan, Gabriel Barth-Maron, 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

Deep Reinforcement Learning (DRL) has achieved stunning successes, from mastering Go to controlling complex robots. However, it has a "dirty secret": it is incredibly resource-intensive. Training state-of-the-art models often requires thousands of CPUs and GPUs running for days or weeks, leading to massive energy consumption and a significant carbon footprint.

The standard way to speed up RL is through distributed training, where multiple "actors" explore an environment and send their experiences to a central "learner." While this saves time, it actually increases the total energy cost. The authors of QuaRL ask a critical question: How can we make RL training faster and more environmentally sustainable without hurting the agent's ability to learn?

Methods: The ActorQ Paradigm

The authors introduce ActorQ, a system designed for the popular actor-learner distributed training paradigm. The key innovation is the strategic use of quantization—reducing the precision of the neural network's weights and activations (e.g., from 32-bit floating point to 8-bit integers).

Comparison of standard distributed RL architecture (left) and the proposed ActorQ system (right).
  • Quantized Actors: In ActorQ, the actors use 8-bit (int8) versions of the policy to perform inference (choosing actions). This speeds up the "experience collection" phase, which is often the primary bottleneck.
  • Full-Precision Learner: To ensure the model still converges to a high-quality solution, the central learner continues to perform its gradient calculations and model updates in full 32-bit (fp32) precision.
  • Quantized Communication: ActorQ also quantizes the policy weights before they are broadcast from the learner back to the actors, reducing the communication overhead—a major win for distributed systems.

Key Insights and Ideas

  • RL is Robust to Noise: One of the most significant findings is that RL policies don't just tolerate quantization; in some cases, they thrive on it. The errors introduced by 8-bit quantization act as a form of stochastic noise, which can actually encourage better exploration in the environment, leading to faster convergence than full-precision models.
  • The Feedback Loop Advantage: Unlike supervised learning, where quantization errors can accumulate and ruin accuracy, RL's inherent feedback loop allows the agent to "self-correct." If an actor makes a slightly suboptimal move due to quantization, the resulting state is just another piece of data for the learner to process.
  • Inference is the Bottleneck: The authors identified that in distributed RL, the majority of time is spent on actor policy inference. By targeting this specific component for quantization, they achieved massive end-to-end gains with minimal architectural changes.

Results and Discussion

The researchers evaluated ActorQ across a diverse set of standard RL benchmarks, including the DeepMind Control Suite, OpenAI Gym, and the Atari Arcade Learning Environment.

Breakdown of carbon emissions (left) and runtime (right) comparing int8 (ActorQ) and fp32 (Standard) training.
  • Speedups: ActorQ demonstrated end-to-end training speedups between 1.5x and 5.41x across various tasks.
  • Sustainability: The system achieved carbon emission improvements between 1.9x and 3.76x. For example, in the Walker Stand task, carbon emissions dropped from 0.67 kg of CO2 to just 0.178 kg.
  • Performance Parity: In almost every test case, the 8-bit quantized training reached the same (or higher) mean return as the 32-bit baseline, often reaching the target reward level much faster in "wall-clock" time.
  • Communication Efficiency: Quantizing the policy for broadcast reduced the memory footprint of model transfers by 4x, which is vital for scaling RL to even larger distributed clusters.

Conclusion

While ActorQ is a major step forward, the authors acknowledge areas for growth, such as quantizing the learner's gradient calculations for even further energy savings. By proving that "less is more," QuaRL paves the way for a future where high-performance AI doesn't have to come at a high environmental cost.

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{krishnan2021quarl,
  author = {Srivatsan Krishnan and Maximilian Lam and Sharad Chitlangia and Zishen Wan and Gabriel Barth-Maron and Aleksandra Faust and Vijay Janapa Reddi},
  title = {{QuaRL: Quantization for Fast and Environmentally Sustainable Reinforcement Learning}},
  year = {2021},
  eprint = {1910.01055},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1910.01055},
}
Figure