[Paper Review] Contrastive Learning as Goal-Conditioned Reinforcement Learning
The paper recasts contrastive representation learning as a goal-conditioned RL algorithm, learning state-action and future-state representations whose inner product corresponds to a Q-function, and showing strong performance across goal-conditioned tasks, including image-based and offline settings.
In reinforcement learning (RL), it is easier to solve a task if given a good representation. While deep RL should automatically acquire such good representations, prior work often finds that learning representations in an end-to-end fashion is unstable and instead equip RL algorithms with additional representation learning parts (e.g., auxiliary losses, data augmentation). How can we design RL algorithms that directly acquire good representations? In this paper, instead of adding representation learning parts to an existing RL algorithm, we show (contrastive) representation learning methods can be cast as RL algorithms in their own right. To do this, we build upon prior work and apply contrastive representation learning to action-labeled trajectories, in such a way that the (inner product of) learned representations exactly corresponds to a goal-conditioned value function. We use this idea to reinterpret a prior RL method as performing contrastive learning, and then use the idea to propose a much simpler method that achieves similar performance. Across a range of goal-conditioned RL tasks, we demonstrate that contrastive RL methods achieve higher success rates than prior non-contrastive methods, including in the offline RL setting. We also show that contrastive RL outperforms prior methods on image-based tasks, without using data augmentation or auxiliary objectives.
Motivation & Objective
- Motivate representation learning in RL by designing algorithms that acquire good representations directly, without auxiliary perception losses or data augmentation.
- Propose a contrastive learning framework that treats action-labeled trajectories and future states as input pairs to learn a value-function-like objective.
- Show that the learned representations’ inner product corresponds to a goal-conditioned value function under a specific reward formulation.
- Demonstrate empirically that contrastive RL achieves higher success rates than prior non-contrastive methods across multiple goal-conditioned tasks, including offline settings.
Proposed method
- Define goal-conditioned RL with a reward r_g(s,a) as the probability of reaching the goal in the next step, tying Rewards to discounted state occupancy measures.
- Use contrastive learning to train a critic f(u,v) with u=(s,a) and v=future_state, where positive samples come from the discounted occupancy measure and negatives from random state-action pairs.
- Parameterize the critic as an inner product f(s,a,s_g)=phi(s,a)^T psi(s_g).
- Optimize with an InfoNCE-type objective that encourages high similarity for (s,a) with next-goal-like futures and low similarity with unrelated futures.
- Derive that the optimal critic is proportional to the goal-conditioned Q-function (up to a constant), enabling policy improvement without separate RL components.
- Present an alternating algorithm (Contrastive RL, NCE) that fits the critic via contrastive learning, updates the goal-conditioned policy, and collects data.
Experimental results
Research questions
- RQ1Can contrastive representation learning be used to directly learn a goal-conditioned value function without relying on TD learning or extra representation objectives?
- RQ2Does the resulting Contrastive RL (NCE) framework outperform prior non-contrastive goal-conditioned RL methods on state- and image-based tasks, including offline RL?
- RQ3Is C-learning interpretable as a special case of contrastive RL, and can generalizing to a family of contrastive RL methods yield improved performance?
- RQ4Can contrastive RL handle partial observability and moving cameras effectively, and how does it fare in offline RL benchmarks like AntMaze?
Key findings
- Contrastive RL methods achieve higher success rates than prior non-contrastive methods on a broad suite of goal-conditioned tasks, including challenging image-based tasks.
- The approach outperforms baselines that rely on data augmentation or auxiliary representation objectives, even without such tricks.
- C-learning is shown to be a special case of contrastive RL, and broader families of contrastive RL (e.g., CPC, NCE+C-learning) can yield improved performance.
- Contrastive RL demonstrates robustness to partial observability and moving cameras, indicating applicability to realistic robotics settings.
- In offline RL benchmarks, contrastive RL can outperform prior methods on benchmark goal-reaching tasks, sometimes substantially.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.