Dreamer
9 memberslucid.models.generative.dreamerDreamer family — Hafner et al., 2020.
Hafner, Danijar, et al. "Dream to Control: Learning Behaviors by Latent Imagination." International Conference on Learning Representations, 2020.
Dreamer inherits PlaNet's recurrent state-space model and throws away its planner. Where PlaNet searches over action sequences at every step — thousands of imagined trajectories to choose one action — Dreamer learns a policy, so acting costs a single forward pass.
The trade is that a learned policy needs a learning signal, and the paper's contribution is where that signal comes from. An actor and a critic are trained entirely on trajectories the world model imagines, never on environment interaction. Because the imagined states are produced by a differentiable transition and the actions are reparameterised samples, the gradient of a predicted return flows backwards through the dynamics into the actor:
This is what separates it from a model-free actor-critic, which can only estimate that gradient from scalar rewards it has actually observed. Here the model supplies an analytic path.
The target is an exponentially-weighted average of -step returns — TD() computed inside the imagination:
with each summing discounted imagined rewards and bootstrapping from the critic. The weighting is the usual bias-variance dial: short horizons trust the critic, long ones trust the model, and interpolates. The critic then regresses onto that same quantity, which is why the two networks are trained together but with the target held fixed.
Imagination is short — 15 steps in the paper — because the model's error compounds, and the critic's bootstrap is what lets a short horizon still represent long-term value.
Classes
DreamerConfig1 methodsFrozen configuration for the Dreamer family.
DreamerBehaviorOutput1 methodsWhat the imagination pass produces — the actor's and critic's terms.
DreamerForWorldModeling6 methodsDreamer with its world-model, actor and critic objectives.
DreamerModel10 methodsPlaNet's world model plus a learned actor and critic.
DreamerOutput1 methodsWhat DreamerModel returns after filtering a trajectory.
Functions
dreamer→ DreamerModelConstruct Dreamer's world model, actor and critic — no objectives.
dreamer_discrete→ DreamerModelConstruct Dreamer as the paper configures it for Atari and DMLab.
dreamer_discrete_world_model→ DreamerForWorldModelingConstruct the discrete-control configuration with all three objectives.
dreamer_world_model→ DreamerForWorldModelingConstruct Dreamer with all three of its objectives.