Reinforcement Learning with Prototypical Representations

Denis Yarats, Rob Fergus, Alessandro Lazaric, Lerrel Pinto

Abstract

Learning effective representations in image-based environments is crucial for sample efficient Reinforcement Learning (RL). Unfortunately, in RL, representation learning is confounded with the exploratory experience of the agent -- learning a useful representation requires diverse data, while effective exploration is only possible with coherent representations. Furthermore, we would like to learn representations that not only generalize across tasks but also accelerate downstream exploration for efficient task-specific training. To address these challenges we propose Proto-RL, a self-supervised framework that ties representation learning with exploration through prototypical representations. These prototypes simultaneously serve as a summarization of the exploratory experience of an agent as well as a basis for representing observations. We pre-train these task-agnostic representations and prototypes on environments without downstream task information. This enables state-of-the-art downstream RL on a set of difficult continuous control tasks.

Introduction

Learning to act from raw pixels is notoriously difficult. In image-based RL, researchers face a "chicken-and-egg" problem: to learn a good representation of the world, an agent needs to explore diverse areas; however, to explore effectively, the agent already needs a good representation to distinguish between "new" and "seen" states. Additionally, learning from rewards alone is slow, especially when rewards are sparse. Most RL representations are also task-specific, requiring agents to relearn visual features from scratch if the goal changes.

Proto-RL addresses these challenges by creating a task-agnostic encoder that can be trained once and then used to solve many different tasks in the same environment.

The Proto-RL Framework

Proto-RL introduces a two-phase approach to decouple representation learning from task-specific policy optimization.

Phase 1: Task-Agnostic Pre-training

In this phase, the agent explores the environment without any external rewards, using a self-supervised objective inspired by the SwAV algorithm.

  • Prototypical Representations: The model learns an encoder mapping images to a latent space. It maintains a set of prototypes (representative vectors) that act as a basis for the environment.
  • Sinkhorn-Knopp Clustering: To ensure prototypes cover the state space evenly, a clustering process forces equal partitioning of data across prototypes.
  • Maximum Entropy Exploration: The agent is driven by an intrinsic reward based on the entropy of state visitation. Instead of comparing new states to a noisy random buffer, Proto-RL compares them to a rebalanced candidate set sampled from prototype-defined clusters, stabilizing the exploration signal.

Phase 2: Downstream Task Learning

Once pre-trained, the encoder and prototypes are frozen. The agent is then trained on a specific task with external rewards. Because the encoder already understands the environment's geometry, the agent learns the specific policy much faster than starting from raw pixels.

Experimental Results

The authors evaluated Proto-RL on the DeepMind Control Suite and a custom U-maze Pointmass navigation task.

Proto-RL performance on the U-maze Pointmass task, showing superior exploration and final episode return compared to baselines.

Key findings include:

  • Superior Exploration: Proto-RL achieves significantly higher state-visitation entropy than baselines like Curiosity or APT.
  • Outperforming Supervised RL: On 6 out of 8 DMControl tasks, Proto-RL with a frozen encoder outperformed DrQ, a state-of-the-art supervised RL algorithm.
  • Multi-Task Generalization: The same frozen representation solved four different tasks in the Walker domain (Run, Walk, Flip Forward, Flip Backward) efficiently.
  • Efficiency in Sparse Rewards: Proto-RL discovered goal locations in complex mazes (like the U-maze) in just 200k steps, while other methods failed even after 1 million steps.

Conclusion

Proto-RL demonstrates that "prototypes" can effectively summarize an environment's state space, enabling efficient, task-agnostic pre-training. This pushes RL toward the "pre-train then fine-tune" paradigm, showing that goal-independent learning can significantly accelerate downstream task performance. Future work may explore fine-tuning encoders during downstream phases or applying these methods to physical robots in more complex, non-stationary environments.

Summary updated

BibTeX
@inproceedings{yarats2021reinforcement,
  author = {Denis Yarats and Rob Fergus and Alessandro Lazaric and Lerrel Pinto},
  title = {{Reinforcement Learning with Prototypical Representations}},
  booktitle = {SSL-RL @ ICLR},
  year = {2021},
  url = {https://openreview.net/forum?id=NVd9b1sFO0R},
}
Figure