Memory Based Trajectory-conditioned Policies for Learning from Sparse Rewards

Yijie Guo, Jongwook Choi, Marcin Moczulski, Shengyu Feng, Samy Bengio, Mohammad Norouzi, Honglak LeeNeurIPS 2020

This paper, presented at NeurIPS 2020, introduces a novel approach to one of the most persistent "boss levels" in Reinforcement Learning (RL): sparse rewards.

TL;DR

The authors propose Diverse Trajectory-conditioned Self-Imitation Learning (DTSIL), a method that maintains a memory buffer of diverse past experiences and trains a policy to "imitate" these trajectories to reach novel states. By focusing on diversity rather than just high rewards, the agent avoids getting stuck in local optima and achieves state-of-the-art results on notoriously difficult Atari games like Montezuma’s Revenge and Pitfall.

The Challenge of Sparse Rewards

In standard RL, an agent learns by trial and error. This works well when rewards are frequent (like points in Pong). However, in "sparse reward" environments, an agent might wander for thousands of steps before seeing a single positive signal.

Two major issues arise here:

  1. Catastrophic Forgetting: Gradient-based agents often "forget" a successful path if they don't encounter it frequently.
  2. Myopic Behavior: Existing memory-based methods often over-exploit the first "good" path they find. In a game like Montezuma's Revenge, if an agent finds a path to a small, quick reward, it might stop exploring the path that leads to the massive reward at the end of the level. This is a "local optimum" trap.
Myopic vs Optimal paths in Montezuma's Revenge

Methods: Introducing DTSIL

To overcome these hurdles, the authors introduce DTSIL, which shifts the focus from "imitate the best" to "imitate the diverse."

DTSIL Architecture and Trajectory Buffer
  • Diverse Trajectory Buffer: Instead of only saving high-reward paths, the agent saves trajectories that end in diverse regions of the state space. It uses a clustering mechanism to keep the buffer compact, replacing old paths only if a new one reaches the same area more efficiently.
  • Trajectory-Conditioned Policy: Most agents are "goal-conditioned" (e.g., "go to the door"). DTSIL agents are "trajectory-conditioned." The policy is given an entire sequence of states as a "demonstration" to follow.
  • The Architecture: The team used a sequence-to-sequence (seq2seq) model with an attention mechanism. Think of it like neural machine translation: the model "translates" a sequence of desired states into a sequence of actions. The attention mechanism allows the agent to figure out which part of the demonstration it should be following at any given moment, providing flexibility if the environment is stochastic (unpredictable).
  • Hybrid Training: The agent is trained using a mix of Proximal Policy Optimization (PPO) for reinforcement learning and a supervised learning objective (similar to Behavior Cloning) to help it stay on track with the demonstrations.

Key Insights and Ideas

  • Diversity is a Proxy for Exploration: By forcing the agent to remember how to get to everywhere it has been, rather than just the best places, the agent naturally pushes the "frontier" of exploration further.
  • Paths are Better than Goals: In complex environments, knowing the destination isn't enough; you need the map. Providing the full trajectory gives the agent much denser information to learn from.
  • Soft-Alignment via Attention: Using an attention mechanism was a clever move. It means the agent doesn't have to follow a past trajectory perfectly frame-by-frame. If a "sticky action" (Atari's version of randomness) knocks the agent off course, the attention mechanism helps it "re-sync" with the demonstration.

Key Results

The researchers evaluated DTSIL across several challenging domains, including a custom Apple-Gold grid-world, the Gibson 3D navigation dataset, and the Surreal Robotics Suite. The results on the Atari "Hard Exploration" set are particularly striking because the agent achieved these scores without using human demonstrations or the ability to "reset" the game to arbitrary states (a common "cheat" in other high-performing RL papers).

  • Montezuma’s Revenge: Achieved a score of 22,616, significantly outperforming previous state-of-the-art methods like PPO+CoEX (11,618) and RND (10,070) under a 5-billion frame budget.
  • Pitfall: While many standard RL algorithms score a flat 0 on Pitfall, DTSIL achieved a score of 12,446.
  • Generalization: In the Apple-Gold maze, the hierarchical version of DTSIL was able to generalize its exploration strategy to entirely new maze layouts it hadn't seen during training.

Limitations and Future Work

While powerful, DTSIL has a few hurdles:

  • State Representation: The method performs best when it has access to a high-level state embedding (like the agent's x,y coordinates). While the authors showed it can work with learned representations, the performance is more robust when the "map" is clear.
  • Memory Overhead: Maintaining a large buffer of trajectories and running a seq2seq model with attention is computationally more expensive than a simple feed-forward policy.
  • Safety: Like most exploration-heavy RL, the agent has no concept of "danger" and will repeatedly "die" in the environment to find new states, which isn't ideal for real-world robotics without a simulator.

The authors suggest that future work could involve improving how the agent selects which trajectories to follow and refining the state representation learning to make the system entirely end-to-end from raw pixels.

Summary updated

BibTeX
@inproceedings{guo2020memory,
  author = {Yijie Guo and Jongwook Choi and Marcin Moczulski and Shengyu Feng and Samy Bengio and Mohammad Norouzi and Honglak Lee},
  title = {{Memory Based Trajectory-conditioned Policies for Learning from Sparse Rewards}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=WSfhf3TmUn3},
}
Figure