Learning Latent Dynamics for Planning from Pixels

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

Abstract

Planning has been very successful for control tasks with known environment dynamics. To leverage planning in unknown environments, the agent needs to learn the dynamics from interactions with the world. However, learning dynamics models that are accurate enough for planning has been a long-standing challenge, especially in image-based domains. We propose the Deep Planning Network (PlaNet), a purely model-based agent that learns the environment dynamics from images and chooses actions through fast online planning in latent space. To achieve high performance, the dynamics model must accurately predict the rewards ahead for multiple time steps. We approach this using a latent dynamics model with both deterministic and stochastic transition components. Moreover, we propose a multi-step variational inference objective that we name latent overshooting. Using only pixel observations, our agent solves continuous control tasks with contact dynamics, partial observability, and sparse rewards, which exceed the difficulty of tasks that were previously solved by planning with learned models. PlaNet uses substantially fewer episodes and reaches final performance close to and sometimes higher than strong model-free algorithms.

Introduction

Reinforcement Learning (RL) has achieved significant milestones, yet model-free methods—which map observations directly to actions—remain notoriously data-inefficient, often requiring millions of frames for relatively simple tasks. Model-based RL offers a theoretically more efficient alternative by learning a "world model" to predict future outcomes. However, learning accurate dynamics from high-dimensional pixel inputs is difficult due to accumulating prediction errors, high computational costs of image generation, and the need to balance stochasticity with deterministic memory.

The Deep Planning Network (PlaNet)

PlaNet addresses these challenges through three primary innovations:

  1. Recurrent State Space Model (RSSM): PlaNet utilizes a hybrid transition model. A deterministic component (similar to an RNN) maintains long-term memory, while a stochastic component represents the inherent uncertainty of future states.
  2. Latent Overshooting: To prevent error accumulation, the authors introduce a multi-step variational objective. This forces the model to maintain consistency across multiple latent steps without the overhead of generating intermediate images during training.
  3. Latent Space Planning: Action selection is performed via the Cross Entropy Method (CEM) searching within the compact latent space. By avoiding pixel-level reconstruction during planning, the agent can evaluate thousands of potential action sequences in milliseconds.

Experimental Setup

The agent was evaluated on six challenging continuous control tasks from the DeepMind Control Suite, using only $64 \times 64$ pixel observations.

The six continuous control tasks from the DeepMind Control Suite used to evaluate PlaNet.

These tasks include:

  • Cartpole Swingup: Tests long-term planning and memory.
  • Reacher: Features sparse rewards.
  • Cheetah Run: High-dimensional state and action spaces.
  • Finger Spin: Involves complex contact dynamics.
  • Ball-in-Cup: Highly sparse rewards (binary success).
  • Walker Walk: Requires balance and collision prediction.

Key Results and Insights

PlaNet demonstrates remarkable data efficiency, reaching the performance levels of the model-free D4PG algorithm with approximately 200x fewer episodes. In the "Cheetah Run" task, PlaNet surpassed the final performance of D4PG by 26%.

Crucially, the hybrid RSSM architecture proved essential; purely stochastic models failed to retain history, while purely deterministic models were easily exploited by the planner. Furthermore, a single PlaNet agent successfully learned all six tasks simultaneously without explicit task labels, inferring the environment directly from the image stream.

Limitations and Future Work

While highly effective, PlaNet currently relies on a fixed planning horizon (12 steps), which may limit performance on tasks requiring extreme long-term reasoning. Additionally, the reliance on image reconstruction can be inefficient in visually noisy environments where many pixels are task-irrelevant. Future research may explore temporal abstraction—learning when to take new actions—and methods to ignore task-irrelevant visual details.

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