Pretraining Representations for Data-Efficient Reinforcement Learning

Max Schwarzer, Nitarshan Rajkumar, Michael Noukhovitch, Ankesh Anand, Laurent Charlin, R. Devon Hjelm, Philip Bachman, Aaron C. Courville

Introduction

Deep reinforcement learning (RL) is notoriously data-hungry. Most RL agents learn tabula rasa—from scratch—meaning they have no prior knowledge of physics, dynamics, or their environment. Consequently, they require millions of interactions to learn basic tasks, suffering from severe sample inefficiency compared to humans.

While researchers have recently explored "unsupervised pretraining" (allowing an agent to explore an environment without rewards to learn how it works), these methods typically require massive amounts of online interaction, often hundreds of millions of steps. This is highly impractical for real-world systems like robotics, where data collection is slow, expensive, and potentially unsafe.

This paper tackles the challenge of offline representation pretraining: learning powerful, reusable priors about an environment using only a small, fixed dataset of unlabelled, mixed-quality offline data. The authors introduce SGI, a method that pretrains an agent's visual representations on small offline datasets using a mix of self-supervised objectives before finetuning on a target task.

The SGI Framework

The authors propose SGI (SPR, Goal-conditioned RL, and Inverse modeling), a multi-task self-supervised learning framework. SGI pretrains a shared convolutional encoder using three distinct reward-free objectives to capture different aspects of the environment's dynamics.

Overview of the SGI pretraining framework and task-specific finetuning.
  1. Self-Predictive Representations (SPR): A forward dynamics model that predicts the latent representations of future states.
  2. Inverse Dynamics Modeling: A classification task where the model looks at two consecutive states ($s_t$ and $s_{t+1}$) and predicts which action the agent took to transition between them.
  3. Goal-Conditioned RL: An unsupervised RL task where the agent learns to reach synthetic "goals" (randomly sampled and noise-injected latent state representations) using hindsight experience replay.

After pretraining on offline data, the agent is finetuned on the target task using standard RL rewards. Crucially, standard finetuning often destroys pretrained weights. To prevent this catastrophic forgetting, the authors drastically reduce the learning rate of the pretrained encoder during the finetuning phase, protecting the learned representations from early, noisy RL gradients.

Experimental Setup

The method is evaluated on the Atari 100k benchmark (26 games), where agents are limited to 100,000 environment steps (roughly two hours of human gameplay). This serves as a standard testbed for data-efficient RL.

To simulate real-world scenarios where offline data quality varies, the authors created four custom pretraining datasets ranging from 3M to 6M transitions:

  • Random: Generated by a purely random policy.
  • Exploratory: Generated by a weak curiosity-driven agent.
  • Weak: Early training checkpoints from a standard DQN agent.
  • Mixed: A realistic blend of medium and low-quality data from various DQN training checkpoints.

Key Findings

  • State-of-the-Art Efficiency: The best SGI configuration (SGI-M/L: Mixed data, Large ResNet) achieved a 0.753 median Human-Normalized Score (HNS) on Atari 100k. This approaches human-level sample efficiency and significantly outperforms training from scratch (0.343 median HNS).
  • Beating Massive-Scale Methods: SGI outperforms prior offline pretraining methods like ATC. More impressively, SGI matches or beats unsupervised exploration methods like APT and VISR, despite using 40x to 80x less pretraining data (6M offline steps vs. 250M online steps).
  • Multiple Objectives Prevent Collapse: Forward dynamics modeling (SPR) alone is prone to "representational collapse," where the network maps everything to the same latent vector. Adding Inverse Dynamics acts as a natural regularizer, forcing representations to remain diverse because the network must differentiate states to guess the action taken between them.
  • Unlocking Large Networks: In low-data RL, large networks (like ResNets) typically overfit and perform worse than shallow networks. SGI pretraining reverses this trend; once pretrained, larger models scale robustly and significantly outperform smaller ones.
  • Data Quality Matters, but Perfection Isn't Required: Pretraining on the "Mixed" dataset yielded the best results, but even purely Random data provided a noticeable boost over training from scratch. The data just needs to engage with the environment's dynamics.

Limitations and Future Work

The authors note an interesting anomaly regarding the paradox of collapse versus performance: while adding the SPR objective pulls representations slightly toward collapse (reducing representational diversity), it consistently improves downstream RL performance. Understanding exactly why less diverse representations sometimes yield better RL policies remains an open question.

Additionally, the method relies heavily on specialized learning rate schedules during finetuning. Future work could explore more robust ways to adapt pretrained representations without requiring manual learning rate tuning.

Summary updated

BibTeX
@inproceedings{schwarzer2021pretraining,
  author = {Max Schwarzer and Nitarshan Rajkumar and Michael Noukhovitch and Ankesh Anand and Laurent Charlin and R. Devon Hjelm and Philip Bachman and Aaron C. Courville},
  title = {{Pretraining Representations for Data-Efficient Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
}
Figure