Overcoming Exploration in Reinforcement Learning with Demonstrations

Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, Pieter AbbeelarXiv 2017

TL;DR

This paper introduces a method to solve complex, long-horizon robotics tasks with sparse rewards by combining Reinforcement Learning (RL) with a small set of human demonstrations. By integrating Hindsight Experience Replay (HER) with a filtered behavior cloning loss and demonstration-based resets, the authors successfully trained a simulated robot arm to stack up to six blocks—a feat previously unreachable by standard RL or imitation learning alone.

What Problem Does This Paper Address?

Reinforcement Learning excels when rewards are frequent, but many real-world robotics tasks are naturally "sparse": you only get a reward when the task is fully complete (e.g., a tower is built). In these environments, an agent using random exploration is like a person trying to find a needle in a haystack while blindfolded; the odds of accidentally stumbling upon a reward signal are infinitesimally small, especially as the task length (horizon) increases.

While "reward shaping" (giving small rewards for getting closer to the goal) is a common fix, it often leads to sub-optimal "local optima" where the robot learns to cheat the reward function rather than solve the task. This paper tackles the exploration bottleneck by using a handful of demonstrations to guide the agent toward high-reward regions without sacrificing the autonomy and optimality of RL.

Methods

The authors build their approach on Deep Deterministic Policy Gradients (DDPG) and Hindsight Experience Replay (HER). They introduce three key mechanisms to leverage demonstrations:

  1. Demonstration Replay Buffer: Expert transitions are stored in a dedicated buffer. During training, every minibatch contains a mix of self-generated experience and expert data, ensuring the agent is constantly reminded of successful behaviors.
  2. Behavior Cloning (BC) Loss with Q-Filter: The agent minimizes a standard BC loss (copying the expert) but with a crucial twist: the Q-Filter. The BC loss is only applied if the critic ($Q$-function) determines the expert's action is better than the agent's current predicted action. This allows the agent to learn from the expert early on but eventually surpass them if it finds a better way to solve the task.
  3. Resets to Demonstration States: For extremely long-horizon tasks, the authors occasionally reset the simulation to a random state sampled from a successful demonstration. This "curriculum-like" approach ensures the agent spends more time practicing difficult late-stage maneuvers (like placing the final block on a tall tower) rather than just failing at the beginning of every episode.

Datasets

The experiments were conducted in the MuJoCo physics simulator using a model of a 7-DOF Fetch Robotics arm with a parallel gripper.

  • Tasks: Pushing, Sliding, Pick-and-Place, and multi-step Block Stacking (2 to 6 blocks).
  • Demonstrations: 100 human demonstrations per task were collected using a virtual reality (HTC Vive) teleoperation interface. Notably, the demonstrations were not always optimal; for the "sliding" task, only 7% of the recorded demos were actually successful, yet the agent still learned effectively.

Key Insights and Ideas

  • The Grasping Bottleneck: Standard HER fails on tasks like "Pick-and-Place" because the probability of a robot randomly grasping a block is nearly zero. Without that first successful grasp, HER has no "successes" to re-label. Demonstrations provide the necessary "spark" to get the learning process started.
  • Surpassing the Expert: By using the Q-Filter, the agent isn't tethered to the demonstrator's performance. If a human was shaky or inefficient, the RL objective allows the agent to refine those movements into a smoother, more optimal policy.
  • Resets as a Curriculum: Resetting to demonstration states acts as an automated curriculum. It allows the agent to solve the "end" of a hard task first, gradually learning the full sequence as it becomes more competent.

Key Results

The proposed method significantly outperformed baselines across all tested tasks:

  • Speedup: On the "Pushing" task, the method achieved a 4x speedup over HER. On "Sliding," it was 2x faster.
  • Capability: The method solved the "Pick-and-Place" task, which the HER baseline could not solve at all.
  • Complexity: The agent successfully learned to stack 6 blocks, a complex multi-step task involving intricate contact physics.
Baseline comparisons on Pushing, Sliding, and Pick-and-Place tasks. The red line (Ours) reaches high success rates much faster than HER (blue) or BC (purple).
A sequence of frames showing the learned policy successfully stacking a tower of 6 blocks.

Limitations and Future Work

  • Sample Efficiency: While faster than standard RL, the method still requires millions of timesteps (roughly 6 hours of real-world time for Pick-and-Place), which is still high for many physical robot applications.
  • State Resets: The "Resets to Demonstration States" feature requires the ability to set the environment to an arbitrary state. This is easy in simulation but very difficult on a physical robot without specialized hardware or manual intervention.
  • Demonstration Requirement: The method relies on having at least some successful demonstrations. If a task is so hard that even a human cannot perform it via teleoperation, this method cannot be applied.

Future work aims to improve sample efficiency further to enable training directly on physical hardware, bypassing the "sim-to-real" gap entirely.

Summary updated

BibTeX
@misc{nair2017overcoming,
  author = {Ashvin Nair and Bob McGrew and Marcin Andrychowicz and Wojciech Zaremba and Pieter Abbeel},
  title = {{Overcoming Exploration in Reinforcement Learning with Demonstrations}},
  year = {2017},
  eprint = {1709.10089},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1709.10089},
}
Figure