Introduction
Adversarial Imitation Learning (AIL), exemplified by frameworks like Generative Adversarial Imitation Learning (GAIL), has long been a dominant approach for teaching agents complex behaviors from expert demonstrations. These methods typically frame imitation as a minimax game: a discriminator attempts to distinguish between expert and agent transitions, while the agent (the generator) attempts to fool the discriminator. However, AIL often suffers from instability and poor sample efficiency, particularly in high-dimensional continuous control tasks. This paper introduces Policy Contrastive Imitation Learning (PCIL), a novel framework that addresses these shortcomings by replacing the standard binary-classifier discriminator with a structured contrastive representation space.
The Representation Gap in AIL
The core challenge identified in this work is the "representation gap." Standard AIL discriminators are trained solely to solve a binary classification problem (Expert vs. Agent). Because the objective only requires finding a separating hyperplane, the resulting embedding space often lacks semantic smoothness. In such a disjointed space, two expert transitions might be mapped further apart than an expert and an agent transition. This leads to erratic, non-monotonic reward signals that make reinforcement learning unstable and difficult to converge.
Methodology: Policy-Based Contrastive Learning
PCIL moves away from binary classification in favor of an embedding space learned via a contrastive loss (InfoNCE). The method structures the representation space by "pushing" expert transitions together and "pulling" agent transitions away.
1. Contrastive Objective and Anchoring
Unlike standard self-supervised learning, which often relies on data augmentation to create "positive" pairs, PCIL utilizes policy identity. For any given "anchor" (a state-action pair from the expert), the model is trained to:
- Minimize distance to other expert transitions (positives).
- Maximize distance to transitions generated by the current agent policy (negatives).
This approach forces the encoder to identify the underlying features that define "expert-ness" rather than just temporal proximity or visual similarity.
2. Cosine-Similarity Reward
Instead of using the raw output of a classifier, PCIL defines the agent's reward as the cosine similarity between its current state-action embedding and the centroid (average embedding) of the expert data. This provides a bounded, smooth, and dense reward signal. The authors demonstrate that this similarity correlates much more strongly with actual environment rewards than the signals produced by traditional AIL discriminators.
3. Theoretical Foundation
The authors provide a theoretical grounding for PCIL, showing it can be reduced to the Apprenticeship Learning framework. Specifically, they prove that minimizing the PCIL contrastive objective serves as a proxy for minimizing the Total Variation (TV) divergence between the expert and agent state-action distributions.
Experimental Results
The authors evaluated PCIL on 10 MuJoCo tasks from the DeepMind Control (DMC) Suite, ranging from basic tasks like Cartpole to high-dimensional challenges like Quadruped Run and Hopper Hop. Each agent was trained using only 10 expert demonstrations.
Performance and Efficiency
PCIL achieved state-of-the-art performance, outperforming major baselines such as Discriminator Actor-Critic (DAC) and Primal Wasserstein Imitation Learning (PWIL). On difficult tasks like Cheetah Run, PCIL not only reached higher asymptotic performance but did so with significantly greater sample efficiency than existing AIL methods.
The Importance of Smoothness
Through t-SNE visualizations, the authors confirmed that PCIL successfully clusters expert data into a tight, cohesive group. Ablation studies further highlighted that both the contrastive encoder and the similarity-based reward are essential; replacing the similarity reward with a standard GAIL-style reward on top of the PCIL embeddings resulted in a total failure of the agent to learn, proving that the smoothness of the reward signal is a critical factor in the success of the algorithm.
Discussion and Insights
A key insight of the paper is the failure of generic contrastive methods, such as Time-Contrastive Networks (TCN), in the context of imitation. TCNs pull temporally close frames together, but in complex control, the difference between a successful movement and a failure can be subtle (e.g., a slight misalignment of a limb). PCIL’s policy-based anchoring is more effective because it specifically penalizes the agent's deviations from the expert distribution, regardless of temporal proximity.
Furthermore, the PCIL objective represents a "strictly stronger constraint" than binary classification. While a classifier only needs to find a boundary, PCIL enforces a structured, pairwise distance constraint across all triplets of data, leading to a more robust and informative representation.
Conclusion and Future Work
Policy Contrastive Imitation Learning offers a significant step forward in making adversarial imitation more stable and efficient. By leveraging contrastive representations to create a smooth reward landscape, PCIL overcomes the limitations of traditional binary discriminators.
Future research directions include:
- Dynamic Anchoring: Exploring a curriculum of "negatives" by anchoring against agent policies from various stages of training.
- Imitation from Observations: Adapting the framework for settings where expert actions are unknown, allowing for learning from raw video data.
- Multi-modal Demonstrations: Refining the loss function to better handle diverse or multi-modal expert behaviors.
Summary updated