Primal Wasserstein Imitation Learning

Robert Dadashi, Léonard Hussenot, Matthieu Geist, Olivier Pietquin

TL;DR

Primal Wasserstein Imitation Learning (PWIL) is a conceptually simple, non-adversarial imitation learning algorithm that matches an agent's behavior to an expert's using the "Earth Mover’s" distance. By utilizing the primal form of the Wasserstein distance rather than the common adversarial (dual) approach, PWIL avoids the instability of minimax optimization. Remarkably, it can train a complex Humanoid agent to run using just a single expert demonstration.

The Challenge of Imitation Learning

Reinforcement Learning (RL) is a powerful paradigm, but it relies heavily on well-defined reward functions, which are notoriously difficult to hand-engineer for complex tasks. Imitation Learning (IL) bypasses this issue by learning directly from expert demonstrations.

The two traditional pillars of IL are:

  1. Behavioral Cloning (BC): A simple supervised learning approach that often fails when the agent drifts slightly off-track, a problem known as covariate shift.
  2. Inverse Reinforcement Learning (IRL): Methods that attempt to recover a reward function first. Modern versions, like Generative Adversarial Imitation Learning (GAIL), use an adversarial framework similar to GANs, where a "discriminator" tries to distinguish between expert and agent behavior.

However, adversarial methods are notoriously difficult to train. They are highly sensitive to hyperparameters, prone to training instability, and require a massive amount of environment interaction to converge. PWIL aims to provide the stability and sample efficiency that these adversarial methods lack.

The PWIL Approach

The core idea behind PWIL is to minimize the Wasserstein distance (also known as the Earth Mover's Distance) between the state-action distributions of the expert and the agent.

  • The "Earth Mover" Analogy: Imagine the expert's demonstrations are "holes" in the ground and the agent's actions are "piles of dirt." The Wasserstein distance represents the minimum amount of work needed to move all the dirt into the holes.
  • Primal vs. Dual: Most previous work in this area used the dual formulation of this distance, which inevitably leads back to unstable adversarial training. PWIL breaks from this tradition by using the primal formulation.
  • Greedy Coupling: To make this work in an online RL setting—where the agent's future actions are unknown—the authors introduce a "Greedy Coupling" strategy. At each timestep, the agent receives a reward based on how close its current state-action pair is to the "closest available" expert pair. Once an expert transition is "filled" by the agent's dirt, it is removed from the available set via a "pop-out" mechanism.
  • Offline Reward: Unlike GAIL, where the reward function changes constantly as the discriminator learns, PWIL’s reward is derived once from the expert data and remains stationary. This makes the RL optimization process significantly smoother.

Key Insights and Methodology

  • Stability through Simplicity: By bypassing the minimax optimization of GAN-style training, PWIL requires significantly less fine-tuning. It relies on only two main hyperparameters for reward scaling.
  • Greedy is Good Enough: The paper proves that a greedy, step-by-step approximation of the optimal transport plan (the "dirt moving" strategy) is an empirically tight upper bound on the true Wasserstein distance.
  • The Importance of the Metric: Because the Wasserstein distance depends on a distance metric, the authors found that standardizing the Euclidean distance (weighting dimensions by the inverse of the expert's standard deviation) is critical for strong performance.
  • Support vs. Distribution: Ablation studies revealed that simply rewarding the agent for being near any expert state (support matching) isn't enough; the agent must match the distribution (frequency) of those states to truly recover expert behavior.

Key Results

PWIL was evaluated on standard MuJoCo locomotion tasks (Ant, HalfCheetah, Hopper, Humanoid, Reacher, Walker2d) as well as a complex pixel-based door opening task.

Learning curves on MuJoCo tasks comparing PWIL, DAC, and BC.
  • Sample Efficiency: In low-data regimes (1 to 11 demonstrations), PWIL consistently outperformed or matched Discriminator Actor-Critic (DAC), a state-of-the-art adversarial method.
  • Humanoid Breakthrough: PWIL is the first method to successfully make the complex Humanoid agent run using only a single, subsampled expert demonstration.
Performance on the Humanoid task across 1, 4, and 11 expert demonstrations.
  • Visual Generalization: In the door-opening task, PWIL successfully learned from human pixels by using a self-supervised embedding (Temporal Cycle-Consistency) to define the distance metric, proving it can work even when a natural state-space metric isn't obvious.

Limitations and Future Work

While highly effective, PWIL does have limitations. It relies heavily on the choice of the distance metric; while standardized Euclidean works well for locomotion, more complex tasks might require learning better metrics. Additionally, computing the greedy coupling involves searching through expert demonstrations at every step. While manageable for standard datasets, very large expert datasets might require more efficient approximate nearest-neighbor searches. Finally, this study focused on the 1-Wasserstein distance, leaving the exploration of higher-order Wasserstein distances as a promising avenue for future research.

Summary updated

BibTeX
@inproceedings{dadashi2021primal,
  author = {Robert Dadashi and Léonard Hussenot and Matthieu Geist and Olivier Pietquin},
  title = {{Primal Wasserstein Imitation Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=r34-Ew1DLe5},
}
Figure