Learning Latent Dynamics for Planning from Pixels

Danijar Hafner, Timothy P. Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, James Davidson

In reinforcement learning (RL), "model-free" agents learn by trial and error, often requiring millions of interactions to master a task. "Model-based" agents are theoretically more efficient because they learn the "rules" of the environment (the dynamics), allowing them to "imagine" the consequences of their actions before taking them.

However, learning these dynamics from high-dimensional inputs like pixels is notoriously difficult. Small errors in predicting the next frame accumulate quickly, leading the agent's "imagination" to drift into nonsense. Previous attempts at planning from pixels were often limited to very simple tasks or required dense, constant reward signals to stay on track.

To address this, researchers introduced PlaNet (Deep Planning Network), a model-based RL agent that learns to solve complex control tasks directly from images. By learning a "world model" in a compact latent space and using a novel multi-step training objective called "latent overshooting," PlaNet achieves performance comparable to top model-free algorithms while using up to 200x less environment interaction.

Core Methodology

PlaNet introduces two key technical innovations to make model-based planning from pixels robust:

  1. Recurrent State Space Model (RSSM): Most dynamics models are either purely deterministic (like standard RNNs) or purely stochastic (like State Space Models). The authors argue that robust planning requires both. Deterministic components allow the model to remember information over long periods, while stochastic components allow it to represent multiple possible futures—crucial for dealing with the uncertainty inherent in pixel observations.
  2. Latent Overshooting: Standard models are trained to predict just one step ahead. PlaNet uses "latent overshooting," which forces the model to remain accurate over multiple steps into the future. Crucially, this happens entirely within the compact latent space. By comparing multi-step "imagined" predictions to actual future states (encoded from real observations), the model learns to be consistent over long horizons without the massive computational cost of generating actual images for every imagined step.

For decision-making, PlaNet uses Model Predictive Control (MPC). At every step, it uses the Cross Entropy Method (CEM) to search for the best sequence of future actions within its learned latent model, executes the first action, and then repeats the process.

Evaluated Environments

The researchers evaluated PlaNet on six diverse continuous control tasks from the DeepMind Control Suite. All tasks were performed using only $64 \times 64$ pixel images as input.

DeepMind Control Suite Tasks Evaluated
  • Cartpole Swingup: Requires long-term planning and handling partial observability (the cart can move off-screen).
  • Reacher: A sparse reward task.
  • Cheetah Run: Features high-dimensional state and action spaces.
  • Finger Spin: Involves complex contact dynamics.
  • Cup Catch: A very sparse reward task (reward only given when the ball is caught).
  • Walker Walk: Requires balance and predicting ground interactions.

Key Insights and Results

  • Data Efficiency is King: The most striking insight is how little data PlaNet needs. It typically requires only 1,000 to 2,000 episodes to solve tasks that take model-free agents 100,000+ episodes. It often reaches the same performance level as model-free algorithms (like D4PG) using 1/200th of the experience. This suggests that learning a world model is a much more efficient way to extract information from environment interactions than learning a direct policy.
  • Planning is Cheaper in Latent Space: By planning in a compact vector space rather than pixel space, PlaNet can evaluate thousands of action sequences in milliseconds. It doesn't need to "see" the future; it just needs to "feel" the rewards in its latent representation.
  • Strong Performance and Robustness: PlaNet significantly outperformed the model-free A3C algorithm on all tasks. On the "Cheetah Run" task, it surpassed the state-of-the-art D4PG algorithm by 26%. Furthermore, PlaNet successfully solved the "Cup Catch" and "Reacher" tasks despite their sparse rewards, proving that the learned latent dynamics are rich enough to guide the agent even when the "signal" from the environment is infrequent.
  • Multi-Task Learning: The authors showed that a single PlaNet agent could learn to solve all six tasks simultaneously, demonstrating the generality of the learned latent representations.

Limitations and Future Work

  • Fixed Action Repeat: The agent currently uses a fixed number of frames for each action. The authors suggest that learning "temporal abstraction" (deciding how long an action should last) is a key next step.
  • Planning Horizon: The agent's "lookahead" is limited. For tasks requiring extremely long-term reasoning, the authors suggest integrating a value function (a way to estimate long-term reward beyond the planning horizon).
  • Computational Search: While fast, the CEM planning algorithm is a derivative-free search. Moving toward gradient-based planning within the latent model could further improve efficiency and performance.

Summary updated

BibTeX
@inproceedings{hafner2019learning,
  author = {Danijar Hafner and Timothy P. Lillicrap and Ian Fischer and Ruben Villegas and David Ha and Honglak Lee and James Davidson},
  title = {{Learning Latent Dynamics for Planning from Pixels}},
  booktitle = {International Conference on Machine Learning},
  year = {2019},
  url = {https://openreview.net/forum?id=rk4rAcb_WB},
}
Figure