Overview
Imitation Learning (IL) typically operates under a strong assumption: the "expert" demonstrations provided to the agent are optimal. In real-world scenarios, however, this is rarely the case. Human demonstrators get tired, make sub-optimal choices, or simply fail at the task. Standard algorithms like Generative Adversarial Imitation Learning (GAIL) attempt to match the expert's behavior exactly, which inadvertently forces the agent to imitate the mistakes along with the desired skills.
To address this, researchers have introduced Weighted GAIL (WGAIL), a novel method that allows agents to learn from imperfect demonstrations without requiring any human-labeled confidence scores. By mathematically linking the discriminator and the agent's policy, WGAIL automatically identifies and down-weights poor demonstrations, enabling the agent to eventually outperform its imperfect teachers.
The Problem with Perfect Imitation
Previous attempts to fix the "imperfect expert" problem (such as 2IWIL or IC-GAIL) required an oracle—either a human evaluator or a pre-trained model—to provide confidence scores or rankings for every demonstration. This process is expensive, time-consuming, and often impractical for complex tasks.
The core question WGAIL seeks to answer is: Can an agent figure out which parts of a demonstration are "bad" on its own, using only the information it gathers during training?
Weighted GAIL (WGAIL): A Self-Correcting Mechanism
The authors propose a dynamic weighting mechanism that entirely bypasses the need for external labels. The WGAIL framework is built on four key pillars:
- The Weighted Objective: The standard GAIL objective function is modified by adding a weight $w(s, a)$ to the expert's state-action pairs.
- Theoretical Link: Through rigorous mathematical derivation involving f-divergences and advantage functions, the authors prove that weighting demonstrations is equivalent to imitating a "new," improved policy $\tilde{\pi}$ that is theoretically guaranteed to be better than the original imperfect expert.
- Automatic Weight Estimation: WGAIL derives a closed-form solution to estimate these weights using two internal components of the GAIL framework:
- The Discriminator ($D_\psi$): Distinguishes between agent and expert behavior.
- The Agent Policy ($\pi_\theta$): Represents the agent's current understanding of the task.
- Dynamic Importance Weighting: Training alternates between estimating weights for the demonstrations and updating the policy. As the agent improves, its ability to identify "bad" expert moves also improves, creating a virtuous cycle of self-correction.
Key Insights
- The Discriminator as a Quality Gauge: In standard GAIL, the discriminator merely flags whether a state-action pair "looks like an expert." In WGAIL, if the discriminator flags a move as "non-expert" but the agent's policy is highly confident in that move, the system re-evaluates and adjusts the weight of that demonstration.
- Beyond the Teacher: By using importance weighting, the agent isn't just copying; it performs a form of "policy improvement" on the demonstration set. This allows the agent to achieve higher rewards than the average reward of the demonstrations it was given.
- Unsupervised Curriculum: The method naturally creates a learning curriculum. Early in training, it might trust all demonstrations equally. As it learns the "regular patterns" of success, it begins to ignore the noisy mistakes of the sub-optimal expert.
Experimental Results
The authors evaluated WGAIL on two standard reinforcement learning benchmarks: MuJoCo (continuous control tasks) and Atari (high-dimensional discrete action spaces). Imperfect data was generated by saving checkpoints from partially trained agents.
MuJoCo Superiority and Robustness
In the Ant-v2 "Stage 2" task, WGAIL achieved a score of 182.00, significantly outperforming standard GAIL (113.58) and the Behavioral Cloning baseline (135.75). Furthermore, WGAIL proved highly robust to noise. When tested with different ratios of optimal versus sub-optimal demonstrations, WGAIL maintained strong performance even when only 25% of the demonstrations were truly optimal—a threshold where standard GAIL's performance plummeted.
Visual Proof
Visualizations of the learned weights in the HalfCheetah task confirmed the algorithm's intuition. "Bad" states—such as when the cheetah was falling or in a poor posture—were assigned weights near 0.00. Conversely, "good" running states received weights as high as 3.13. As seen in the trajectory maps above, WGAIL successfully navigates toward higher-reward regions (the bright centers) much more effectively than standard GAIL.
Limitations and Future Work
While WGAIL represents a significant step forward, the authors note a few limitations:
- Atari Performance: WGAIL showed improvements in Atari games like Q*bert, but the gains were more modest compared to MuJoCo. GAN-based imitation learning still broadly struggles with the high-dimensional complexity of Atari environments.
- Discriminator Overpowering: Early in training, the discriminator can sometimes "overwhelm" the policy. The authors suggest using "early stopping" for weight estimation during initial stages to maintain system balance.
- Upper Limits: A performance gap remains between these GAN-based methods and true "expert-level" performance in complex environments. While weighting imperfect demonstrations helps significantly, it does not entirely solve the fundamental sample efficiency issues inherent to adversarial learning.
Summary updated