Minimax Optimal Online Imitation Learning via Replay Estimation

Gokul Swamy, Nived Rajaraman, Matt Peng, Sanjiban Choudhury, Drew Bagnell, Steven Wu, Jiantao Jiao, Kannan Ramchandran

Imitation Learning (IL) aims to teach an agent how to mimic an expert's behavior given a set of demonstrations. While having an infinite amount of expert data makes this straightforward, real-world scenarios often involve a strictly limited number of demonstrations. This paper tackles a fundamental challenge in online IL: how to efficiently and robustly mimic an expert when you only have a handful of demonstrations but retain full access to a simulator. To solve this, the authors introduce Replay Estimation (RE), a technique that achieves minimax optimal performance by "smoothing" noisy expert data through simulation.

The Challenge: Finite Samples in Imitation Learning

In online imitation learning, a learner tries to match an expert's behavior given a fixed dataset and a simulator. Two common strategies exist, but both exhibit significant flaws in the "finite sample" regime (when data is scarce):

  1. Behavioral Cloning (BC): This approach treats IL as simple supervised learning. However, it suffers from "covariate shift"—small errors made early in a trajectory compound quadratically over time ($H^2$, where $H$ is the horizon), eventually leading the agent far off-track into states it has never seen.
  2. Moment Matching (MM): This strategy attempts to make the learner's state-visitation distribution match the expert's. While it handles compounding errors better than BC, it is highly sensitive to statistical noise. If a small expert dataset contains a "chance occurrence" due to stochastic environment dynamics, a standard MM algorithm might force the learner to perform dangerous or erratic maneuvers just to match that noisy empirical distribution.

Replay Estimation: Bridging the Gap

The authors seek an algorithm that is robust to covariate shift like MM, but doesn't overfit to the noise of small datasets like BC. Their core innovation is Replay Estimation (RE).

Instead of strictly matching the empirical distribution seen in the limited dataset, RE uses the simulator to estimate what the true expert distribution would look like.

Replay Estimation Mechanism
  • The Replay Mechanism: If the learner is in a state where the expert's action is known (or can be accurately predicted), it "replays" that action in the stochastic simulator multiple times. This effectively "stitches together" new trajectories that are consistent with the expert, marginalizing out the noise of the environment's transitions and smoothing the variance.
  • Soft Membership Oracle ($\mathcal{M}$): To decide when to "replay" versus when to trust the empirical data, the authors introduce a membership oracle. This oracle outputs a confidence score between 0 and 1, representing how accurately the current Behavioral Cloning policy reflects the expert at that specific state.
  • Prefix Weights: Because trajectories are sequential, the algorithm uses "prefix weights"—the product of membership scores along a path—to ensure the replayed data remains grounded in the expert's likely distribution.

To implement this practically, the authors propose several ways to build these oracles, including Random Network Distillation (RND) and Ensemble Disagreement (measuring how much a group of BC models disagree on an action).

Theoretical Guarantees: Minimax Optimality

A major contribution of this work is its theoretical rigor. The authors prove that RE achieves a performance gap of $\tilde{O}(\min(H^{3/2}/N_{exp}, H/\sqrt{N_{exp}}))$.

Tabular Sample Complexity

This represents the best possible theoretical rate, outperforming both standard BC and MM in the worst case. RE effectively inherits the superior low-data performance of moment-matching while maintaining the stability of BC as more data becomes available, achieving the "best of both worlds."

Empirical Results

The researchers evaluated their approach on continuous control tasks from the PyBullet suite, specifically focusing on the low-data regime (using as few as 6 to 20 expert trajectories).

  • Superior Performance: On a Walker task with only 12 trajectories, all RE variants nearly matched expert performance, while standard Moment Matching failed to make significant progress.
  • Robustness to Noise: In environments with added dynamics noise, RE maintained high performance. In contrast, MM's performance degraded significantly because it attempted to match a noisy empirical distribution.
  • Solving Covariate Shift: RE significantly outperformed BC on tasks where the initial state was perturbed, proving that it successfully addresses the compounding error problem that plagues simple supervised learning.

Limitations and Future Work

While highly effective, Replay Estimation has a few practical limitations:

  • Simulator Requirements: RE requires a simulator that allows for "replays," which might be difficult in physical systems where you cannot easily reset to a specific state or where the dynamics model is unknown.
  • Computational Overhead: Running multiple rollouts during the data-augmentation phase adds computational cost.
  • Oracle Sensitivity: The performance of RE is tied to the quality of the membership oracle. Designing oracles that work reliably in extremely high-dimensional or pixel-based environments remains an open challenge.

Summary updated

BibTeX
@inproceedings{swamy2022minimax,
  author = {Gokul Swamy and Nived Rajaraman and Matt Peng and Sanjiban Choudhury and Drew Bagnell and Steven Wu and Jiantao Jiao and Kannan Ramchandran},
  title = {{Minimax Optimal Online Imitation Learning via Replay Estimation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=1mFfKXYMg5a},
}
Figure