Introduction
Reinforcement Learning (RL) has achieved massive success in games and robotics, but it suffers from a severe "data hunger" problem. While humans can learn to play a video game in minutes, deep RL agents often require millions of frames. This gap is especially wide when agents learn from high-dimensional pixels rather than low-dimensional states (like joint angles or coordinates).
The challenge lies in the "noise" of pixels—background details, lighting, and textures that are irrelevant to the task. Previous attempts to solve this involved building complex "World Models" to predict the future or using autoencoders to reconstruct images. However, these methods are computationally heavy and often focus on reconstructing irrelevant pixel-level details rather than capturing the high-level semantic features needed for control.
CURL (Contrastive Unsupervised Representations for Reinforcement Learning) introduces a simple yet powerful framework that integrates contrastive learning as an auxiliary task for off-policy RL. By teaching agents to recognize that two different "views" (augmentations) of the same image represent the same state, CURL enables agents to learn from raw pixels with nearly the same sample efficiency as if they had access to the underlying physical state.
Methods
CURL takes a minimalist approach to representation learning in RL. It treats an observation as a "query" and a transformed version of that same observation as a "positive key."
The framework operates on four main principles:
- Data Augmentation: The core technique relies on stochastic random crops. An image is cropped in two different ways to create two distinct versions of the same scene.
- Contrastive Objective: CURL employs the InfoNCE loss. It trains a "Query Encoder" and a "Key Encoder" to ensure that embeddings of the two crops from the same image are more similar to each other than to crops from other images in the same minibatch.
- Momentum Encoding: Borrowing from the MoCo (Momentum Contrast) architecture, the Key Encoder is not updated via standard gradients. Instead, its weights are a moving average of the Query Encoder’s weights, providing a stable target for the contrastive task.
- Joint Training: The Query Encoder is shared between the contrastive task and the RL agent (e.g., SAC for continuous control or Rainbow DQN for discrete games). The encoder receives gradients from both the RL reward signal and the unsupervised contrastive signal simultaneously.
Key Insights
- Discrimination over Reconstruction: CURL demonstrates that it is more efficient to learn to distinguish between states (contrastive learning) than to re-create them (reconstruction). This allows the model to ignore pixel-level noise that doesn't affect decision-making.
- The Power of Random Crops: Simple random cropping was found to be the most effective augmentation, forcing the encoder to learn spatial invariance—understanding that an object is the same regardless of its exact position in the frame.
- Bilinear Inner Product: Unlike many computer vision models that use cosine similarity, CURL uses a learned bilinear inner product ($q^T W k$) to measure similarity, which significantly outperforms simpler dot products in the RL context.
- Minimal Overhead: Designed to be "plug-and-play," CURL adds very little computational complexity to standard RL algorithms, making it much easier to implement than complex world models.
Datasets and Key Results
The authors evaluated CURL on two major benchmarks: the DeepMind Control Suite (DMControl) (16 continuous control tasks) and Atari 2600 Games (26 diverse discrete games evaluated at the 100k step benchmark).
- DMControl: On the 100k step benchmark, CURL achieved 1.9x higher median performance than Dreamer, a leading model-based method. Remarkably, CURL was the first pixel-based algorithm to nearly match the performance of agents trained on actual physical state features.
- Atari: On the Atari100k benchmark, CURL outperformed "Efficient Rainbow" on 19 out of 26 games, showing a 1.2x median improvement. It even achieved superhuman performance on games like JamesBond and Krull with very limited data.
- Sample Efficiency: Across many environments, CURL reached the same performance level as prior methods using 4x to 5x less data.
Limitations and Future Work
While highly effective, CURL relies heavily on random crops. This might not be sufficient for environments where color or fine-grained texture is the primary cue for success. Furthermore, the current framework focuses on off-policy RL (SAC and Rainbow); exploring how CURL interacts with on-policy algorithms (like PPO) remains a promising future direction. Finally, while CURL captures spatial features well, explicitly incorporating temporal contrastive learning (matching states across time) could further improve performance in complex, partially observable environments.
Summary updated