Goal-Conditioned Reinforcement Learning from Sub-Optimal Data on Metric Spaces

Alfredo Reichlin, Miguel Vasco, Hang Yin, Danica Kragić · DOI

Abstract

We study the problem of learning optimal behavior from sub-optimal datasets for goal-conditioned offline reinforcement learning under sparse rewards, invertible actions and deterministic transitions. To mitigate the effects of distribution shift, we propose MetricRL, a method that combines metric learning for value function approximation with weighted imitation learning for policy estimation. MetricRL avoids conservative or behavior-cloning constraints, enabling effective learning even in severely sub-optimal regimes. We introduce distance monotonicity as a key property linking metric representations to optimality and design an objective that explicitly promotes it. Empirically, MetricRL consistently outperforms prior state-of-the-art goal-conditioned RL methods in recovering near-optimal behavior from sub-optimal offline data.

Introduction

Offline reinforcement learning (RL) aims to train agents using static, pre-collected datasets without further environment interaction. This paradigm is notoriously difficult due to distribution shift: if an agent attempts an action not well-represented in the dataset, traditional algorithms often over-estimate the value of that action, leading to catastrophic failure.

Most current methods rely on "conservative" updates, constraining the agent to stay close to the behaviors seen in the data. However, if the data was collected by a random or mediocre agent, these constraints prevent the agent from ever achieving optimality. MetricRL addresses this by shifting the focus from standard value estimation to metric learning, allowing for optimal behavior recovery even from severely sub-optimal data.

Methods: MetricRL and Distance Monotonicity

MetricRL bypasses the unstable value-estimation updates of traditional offline RL by mapping states into a metric space where Euclidean distances reflect the "steps-to-goal."

1. Distance Monotonicity (DM)

The core theoretical contribution is the concept of DM. Rather than learning a perfect isometry (where distances exactly match environment steps), MetricRL aims to preserve the order of distances. If state A is closer to the goal than state B in the environment, it must remain closer in the embedding space. This property is sufficient to recover an optimal policy.

2. Metric Learning Objective

The framework trains an encoder to map states into a Euclidean space using a contrastive-style loss. One term forces adjacent states in the dataset to be exactly one unit apart in the embedding, while a second "repulsive" term pushes non-adjacent states away from each other. Once the embedding is learned, the "Value" of a state is defined simply by its Euclidean distance to the goal representation.

3. Policy Estimation

To learn the policy, MetricRL uses a weighted imitation learning objective. This allows the agent to select actions that move it closer in the metric space without using the "max" operator found in Bellman equations—the primary source of overestimation in offline RL.

MetricRL learns a metric space where Euclidean distances between state representations relate to the value function, enabling optimal path recovery.

Experimental Evaluation

The authors evaluated MetricRL on several challenging benchmarks, including Maze2D (continuous navigation), Reach (7-DoF robotic arm), and Minigrid (logical grid-world tasks).

Robustness to Data Quality

A key finding is MetricRL's resilience to sub-optimal data. While baselines like QRL and GoFAR see their performance collapse as the average reward of the training dataset drops, MetricRL maintains near-perfect performance even when trained on entirely random data. This is largely due to the method's ability to understand environment topology; it correctly identifies that two points separated by a wall are "far" in terms of path distance, even if they are physically close.

MetricRL maintains high average reward even when the training dataset has very low expected rewards, significantly outperforming baselines.

Discussion and Limitations

MetricRL demonstrates superior sample efficiency and robustness by bypassing the Bellman equation. However, the current framework has specific constraints:

  • Reversibility: Because Euclidean distance is symmetric, the method assumes actions are reversible (i.e., no "one-way streets").
  • Determinism: The current implementation assumes deterministic transitions.

Future work involves extending the "Distance Monotonicity" concept to quasimetrics to handle non-reversible actions and exploring applications in stochastic environments.

Summary updated

BibTeX
@misc{reichlin2024goal,
  author = {Alfredo Reichlin and Miguel Vasco and Hang Yin and Danica Kragić},
  title = {{Goal-Conditioned Reinforcement Learning from Sub-Optimal Data on Metric Spaces}},
  year = {2024},
  eprint = {2402.10820},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.10820},
}
Figure