Offline Reinforcement Learning with Pseudometric Learning

Robert Dadashi, Shideh Rezaeifar, Nino Vieillard, Léonard Hussenot, Olivier Pietquin, Matthieu Geist

Introduction

Offline Reinforcement Learning (RL) aims to train agents using a fixed dataset of logged transitions without any further interaction with the environment. While promising for real-world applications where data collection is expensive or dangerous, offline RL faces a major hurdle: extrapolation error. When an agent evaluates an action not present in the dataset, it often assigns it an overly optimistic value. This leads to a "delusional" policy that performs poorly in practice.

To mitigate this, researchers typically constrain the agent's policy to stay "close" to the training data. However, defining "closeness" is challenging. Standard Euclidean distance is often inadequate because two states might look similar in raw coordinates but lead to completely different outcomes. To address this, the authors introduce PLOFF, an algorithm that learns a task-specific distance measure (a pseudometric) to keep the agent safely grounded in known transitions while respecting the environment's underlying dynamics.

Methods: Learning a Task-Aware Distance

The core of PLOFF is learning a pseudometric based on the concept of bisimulation. In this framework, two state-action pairs are considered functionally "close" if they yield similar immediate rewards and transition to states that remain "close" under future random actions.

The PLOFF Algorithm

The approach is divided into two main phases:

  1. Pseudometric Learning: The authors utilize Siamese neural networks to learn a representation space where the Euclidean distance between points matches the task-relevant distance.
  2. A network $\Phi(s, a)$ maps state-action pairs into this representation space.
  3. A secondary network $\Psi(s)$ tracks "bootstrapped" future distances to ensure the metric remains consistent over time.
Architecture details of pseudometric learning. Two pairs of Siamese networks Φ and Ψ are concurrently optimized.
  1. Actor-Critic Training: PLOFF modifies a standard RL algorithm (TD3) by incorporating a "lookup bonus." For any action the agent considers, it calculates the distance to the nearest neighbor in the original dataset using the learned pseudometric. If the action is too "far" from known data, it is heavily penalized or filtered out.

Evaluation and Results

The authors evaluated PLOFF on the D4RL benchmark, focusing on two challenging continuous control domains:

  • MuJoCo Locomotion: Standard tasks like HalfCheetah, Hopper, and Walker2d, using datasets ranging from random to expert levels.
  • Adroit Hand Manipulation: Highly complex tasks involving a robotic hand nailing a hammer, opening a door, or spinning a pen. These are notoriously difficult due to massive state spaces and sparse data.
Visualization of the environments considered. From left to right: Door, Hammer, Pen, Relocate, HalfCheetah, Hopper, Walker2d.

PLOFF demonstrated state-of-the-art performance on the Adroit manipulation tasks, outperforming major baselines like CQL and BCQ. On average, it achieved a score of 45.0, compared to 40.3 for the next best method. In the MuJoCo locomotion tasks, PLOFF remained highly competitive, performing second only to CQL.

Key Insights

  • Task-Aware Geometry: Unlike generic distance measures, the learned pseudometric respects the environment's rules. It conflates states that are functionally identical for the task while separating those that lead to different outcomes.
  • Stability over Optimality: Learning a metric is inherently more stable than learning an optimal policy. Metric learning minimizes a positive distance error, making it less prone to the divergence and overestimation "death spirals" common in offline RL.
  • The "Lookup" Advantage: Instead of trying to explicitly model the complex, multi-modal distribution of the behavior policy, PLOFF simply asks: "Is this action functionally similar to something I've seen before?"

Limitations and Future Work

While highly effective, PLOFF has a few limitations. The current theoretical proof for the metric's convergence assumes a deterministic environment; extending this to stochastic settings remains an open challenge. Additionally, because the metric relies heavily on reward signals, it may struggle in environments with extremely sparse rewards. Finally, pre-computing $k$-nearest neighbors for millions of transitions introduces computational overhead, suggesting that scaling to even larger datasets might require approximate nearest-neighbor search methods.

Summary updated

BibTeX
@inproceedings{dadashi2021offline,
  author = {Robert Dadashi and Shideh Rezaeifar and Nino Vieillard and Léonard Hussenot and Olivier Pietquin and Matthieu Geist},
  title = {{Offline Reinforcement Learning with Pseudometric Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=rUPVXJDrbTi},
}
Figure