Dream to Control: Learning Behaviors by Latent Imagination

Danijar Hafner, Timothy P. Lillicrap, Jimmy Ba, Mohammad Norouzi

Abstract

Dreamer is a reinforcement learning (RL) agent designed to solve complex, high-dimensional visual tasks by learning entirely within a "latent imagination." By training a world model to compress visual inputs into compact states, Dreamer can simulate thousands of future trajectories to optimize its policy and value functions. This approach achieves state-of-the-art performance on the DeepMind Control Suite with significantly higher data efficiency than traditional model-free methods.

Introduction

Learning behaviors from raw sensory input, such as camera feeds, remains a central challenge in reinforcement learning. While model-free agents have achieved success, they often require millions of interactions with the environment, making them impractical for real-world applications. Model-based RL aims to improve efficiency by learning a "world model" to simulate the environment. However, previous model-based approaches struggled with the computational cost of predicting high-resolution pixels and the difficulty of long-term planning.

Methodology: Learning in Latent Space

Dreamer introduces a framework for learning behaviors purely through latent imagination. The architecture is divided into three distinct phases:

  1. World Model Learning: Dreamer uses a Recurrent State Space Model (RSSM) to encode images into compact latent states. This model learns to predict transitions and rewards without the need for pixel-level reconstruction during policy training.
  2. Latent Imagination: Within the learned latent space, the agent "dreams" hypothetical future trajectories. Because this space is low-dimensional, thousands of scenarios can be simulated in parallel.
  3. Actor-Critic Optimization: Dreamer trains an "Actor" (to choose actions) and a "Critic" (to estimate long-term value) within these dreams. Crucially, it uses analytic gradients—backpropagating through the differentiable world model—to directly optimize the policy for maximum reward.
The Dreamer framework: (Top) Collecting experience, (Middle) Learning latent dynamics, and (Bottom) Learning value and actions through imagination.

Experimental Evaluation

The authors evaluated Dreamer across several benchmarks, most notably the DeepMind Control Suite, which features 20 challenging tasks involving complex physics and contact dynamics.

A visual control task from the DeepMind Control Suite where the agent must learn to control a multi-legged robot.

Key Results

  • Data Efficiency: Dreamer reached an average score of 823 on the Control Suite using only 5 million environment steps. In contrast, the leading model-free agent, D4PG, required 100 million steps to reach a lower score.
  • Performance: Dreamer successfully solved tasks like Acrobot and Hopper, which were previously difficult for model-based agents due to the need for precise, long-term credit assignment.
  • Computational Speed: Training Dreamer took approximately 3 hours on a single GPU, significantly faster than the 24 hours required for D4PG to achieve comparable results.

Discussion and Conclusion

The success of Dreamer highlights the importance of value functions in imagined trajectories. By using a Critic to estimate rewards beyond the imagination horizon, the agent becomes robust to short-term planning limitations. Furthermore, the use of differentiable world models allows for more efficient optimization than traditional trial-and-error.

While Dreamer shows immense promise, its performance is inherently tied to the accuracy of its world model. Future work involves scaling these representations to handle even more visually complex or stochastic environments, potentially bridging the gap to real-world robotic control.

Summary updated

BibTeX
@inproceedings{hafner2020dream,
  author = {Danijar Hafner and Timothy P. Lillicrap and Jimmy Ba and Mohammad Norouzi},
  title = {{Dream to Control: Learning Behaviors by Latent Imagination}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
  url = {https://openreview.net/forum?id=zISkM0D80Y},
}
Figure