Dream to Control: Learning Behaviors by Latent Imagination

Danijar Hafner, Timothy Lillicrap, Jimmy Ba, Mohammad Norouzi

2019 · ICLR

Dream to Control: Learning Behaviors by Latent Imagination

Problem

Framing

World-model agents from pixels were still short-horizon: they either planned over shallow rollouts or used derivative-free policy search. Dreamer closes this gap by learning an actor-critic entirely inside latent imagination and backpropagating value gradients through the learned dynamics. On 20 visual control tasks, it reaches an average score of 823 after 5×1065 \times 10^6 steps.

Currently Used Methods

Foundational

Proposed Method

Architecture

Dreamer combines an RSSM world model with dense actor and value heads in latent space. The world model uses an image encoder, latent transition and representation models, an image decoder, and a reward predictor; latent stochastic states are 30-dimensional diagonal Gaussians, and actor/value networks use 3 layers of 300 ELU units.

Verified architecture figure: Dreamer learns dynamics from experience, optimizes behavior in imagined latent trajectories with value gradients, then acts in the environment.

Loss / Objective

Behavior learning uses imagined λ\lambda-returns and regresses the value head to them.

Vλ(sτ)=(1λ)n=1H1λn1VNn(sτ)+λH1VNH(sτ)V_{\lambda}(s_{\tau}) = (1 - \lambda) \sum_{n=1}^{H-1} \lambda^{n-1} V_N^{n}(s_{\tau}) + \lambda^{H-1} V_N^{H}(s_{\tau}) VNk(sτ)=Eqϕ,qθ[n=τh1γnτrn+γhτvψ(sh)],h=min(τ+k,t+H)V_N^{k}(s_{\tau}) = \mathbb{E}_{q_\phi, q_\theta} \left[ \sum_{n=\tau}^{h-1} \gamma^{n-\tau} r_n + \gamma^{h-\tau} v_\psi(s_h) \right], \quad h = \min(\tau + k, t + H) maxϕEqθ,qϕ[τ=tt+HVλ(sτ)],minψEqθ,qϕ[τ=tt+H12vψ(sτ)sg(Vλ(sτ))2]\max_{\phi} \mathbb{E}_{q_\theta, q_\phi} \left[ \sum_{\tau=t}^{t+H} V_{\lambda}(s_{\tau}) \right], \qquad \min_{\psi} \mathbb{E}_{q_\theta, q_\phi} \left[ \sum_{\tau=t}^{t+H} \frac{1}{2} \left\| v_\psi(s_{\tau}) - \operatorname{sg}(V_{\lambda}(s_{\tau})) \right\|^2 \right]

Algorithm

The actor samples actions from the imagined latent state, and the value target bootstraps beyond the finite rollout horizon.

aτqϕ(aτsτ),sτqθ(sτsτ1,aτ1) a_{\tau} \sim q_\phi(a_{\tau} \mid s_{\tau}), \qquad s_{\tau} \sim q_\theta(s_{\tau} \mid s_{\tau-1}, a_{\tau-1})

Training Procedure

Evaluation

Datasets

Metrics

Headline results

Verified results plot: imagination-horizon sweep on Cartpole Swingup, Cheetah Run, Quadruped Walk, and Walker Walk comparing Dreamer, no-value ablation, and PlaNet.

Ablations

Method Strengths and Weaknesses

Strengths

Weaknesses

Suggestions from the authors

Links

Prior Papers

Further Papers