Rethinking Goal-Conditioned Supervised Learning and Its Connection to Offline RL

Rui Yang, Yiming Lu, Wenzhe Li, Hao Sun, Meng Fang, Yali Du, Xiu Li, Lei Han, Chongjie Zhang

TL;DR

This paper introduces Weighted Goal-Conditioned Supervised Learning (WGCSL), an algorithm that transforms simple imitation-based learning into a powerful tool for offline reinforcement learning. By applying a novel three-part weighting scheme to self-generated or offline experiences, the authors provide a theoretically grounded method that achieves monotonic policy improvement and outperforms state-of-the-art offline RL baselines across diverse robotic tasks.

What Problem Does This Paper Address?

Goal-conditioned reinforcement learning (GCRL) aims to train agents that can reach any arbitrary goal state. While online methods like Hindsight Experience Replay (HER) are effective, they require expensive and sometimes dangerous real-world interaction. This makes Offline GCRL—learning from a static, pre-collected dataset—highly desirable.

The current baseline for simple goal-conditioned learning is Goal-Conditioned Supervised Learning (GCSL). GCSL is stable and easy to implement because it treats RL as an iterative imitation learning problem: "look at where you ended up, and pretend that was your goal all along."

However, GCSL has a major flaw in offline settings: it treats all successful trajectories equally. If the dataset contains a long, circuitous path to a goal and a short, direct one, GCSL will average them, resulting in a suboptimal, "detouring" policy. It also struggles with multi-modality, where an agent gets confused by seeing multiple different valid ways to reach the same goal.

Comparison of achieved goals between GCSL and WGCSL. GCSL (blue) learns suboptimal, curved paths by averaging trajectories, while WGCSL (orange) learns direct, optimal paths.

Methods

The authors propose WGCSL, which enhances the standard supervised learning objective with a compound weight $w_{t,i}$ consisting of three distinct components:

  1. Discounted Relabeling Weight (DRW): Uses a discount factor $\gamma^{i-t}$ based on how far in the future the goal was reached. This encourages the agent to prefer shorter paths to the goal.
  2. Goal-conditioned Exponential Advantage Weight (GEAW): Borrowing from advantage-weighted regression, this weights actions by $\exp(A(s, a, g))$. Actions that lead to higher expected returns than the average behavior get more weight, effectively "filtering" the offline data for high-quality transitions.
  3. Best-Advantage Weight (BAW): To solve the multi-modality problem, this weight acts as a non-linear filter that prioritizes the "best" ways to reach a goal found in the data, preventing the policy from collapsing into a mean of several different strategies.
The WGCSL learning framework, illustrating the offline dataset sampling, goal relabeling, and weighted supervised learning steps.

The algorithm follows an iterative loop: sample a mini-batch from the offline data, relabel goals using future states, update a value function to estimate advantages, and finally update the policy using the weighted supervised objective.

Datasets

The authors introduced a comprehensive benchmark for offline GCRL consisting of 10 environments:

  • Point-based: PointReach and PointRooms (navigating 2D spaces).
  • Simulated Robots: Reacher, Sawyer (Reach, Door), and Fetch (Reach, Push, Slide, Pick).
  • Complex Manipulation: HandReach (controlling a 24-DoF anthropomorphic hand).

For each task, they evaluated two types of datasets:

  • Expert: Data collected by a trained RL agent (high quality but narrow coverage).
  • Random: Data collected by a uniform random policy (low quality but high coverage).

Key Insights and Ideas

  • The SL-RL Connection: The paper provides a formal theoretical bridge showing that GCSL is actually optimizing a lower bound of the RL objective. By adding the DRW weight, WGCSL optimizes a tighter lower bound.
  • Monotonic Improvement: Theoretically, the authors prove that WGCSL generates monotonically improved policies regardless of the behavior policy used to collect the data. This is a strong guarantee for offline stability.
  • The Power of Random Data: A surprising finding was that in some tasks (like Reacher or FetchReach), WGCSL performed better on random datasets than on expert ones. This is because random data provides better "coverage" of the state space, allowing the relabeling mechanism to find more diverse paths to goals.
  • Robustness to Value Overestimation: Unlike standard off-policy RL (like DDPG), which often fails in offline settings due to "exploding" Q-values on out-of-distribution actions, WGCSL is much more stable because its policy update is grounded in supervised imitation of actions that actually exist in the dataset.

Key Results

  • Superior Performance: WGCSL consistently outperformed GCSL and heavy-duty offline RL baselines like Conservative Q-Learning (CQL) and BCQ.
  • HandReach Success: In the highly complex HandReach task, WGCSL achieved a success rate significantly higher than all other baselines, which mostly failed to learn anything useful from the offline data.
  • Efficiency: WGCSL is computationally efficient. While it requires training a value function (unlike GCSL), it is much faster than "conservative" methods like Actionable Models (AM) that require sampling many actions to regularize the Q-function.

Limitations and Future Work

  • Value Function Dependency: While WGCSL is more stable than Q-learning, it still relies on an estimated advantage function. If the value function is poorly learned, the weights will be noisy.
  • Sparse Rewards: The method is designed for sparse, binary rewards. While this covers many goal-reaching tasks, extending it to complex, shaped reward functions remains an open question.
  • Hyperparameter Sensitivity: The "Best-Advantage Weight" involves a percentile threshold $N$ that needs to be scheduled or tuned, adding some complexity to the training process.

The authors suggest that future work could explore even more stable ways to learn the value function in fully offline, high-dimensional settings to further push the boundaries of what can be learned without environment interaction.

Summary updated

BibTeX
@inproceedings{yang2022rethinking,
  author = {Rui Yang and Yiming Lu and Wenzhe Li and Hao Sun and Meng Fang and Yali Du and Xiu Li and Lei Han and Chongjie Zhang},
  title = {{Rethinking Goal-Conditioned Supervised Learning and Its Connection to Offline RL}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=KJztlfGPdwW},
}
Figure