Skip to content

Deep reinforcement learning and decision models · Method reference · DRL015 · Model

PlaNet: deep planning network

Learn a compact stochastic latent world model from image trajectories and choose continuous actions through online planning inside that model. PlaNet supplies a distinct model-based control route;

Needs a data type CodeSplash doesn't load yet Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Running this needs images, audio, video, graphs or another data type CodeSplash doesn't load yet.

Availability
Needs a data type CodeSplash doesn't load yet
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Learn a compact stochastic latent world model from image trajectories and choose continuous actions through online planning inside that model. PlaNet supplies a distinct model-based control route; related Dreamer methods are covered elsewhere rather than counted again here.

Question / hypotheses

Can a learned latent dynamics model predict enough reward-relevant future structure to support effective receding-horizon planning? Good image reconstruction alone does not answer this control question, and model likelihood is not a test of optimal policy behavior.

Architecture / computational structure

A recurrent state-space model combines deterministic recurrent state with stochastic latent variables, an observation encoder/decoder, and a reward predictor. Variational learning fits the model; cross-entropy-method planning samples action sequences, scores imagined rewards, refines elites, and executes only the first action.

Assumptions

The latent state and history must summarize relevant partial observability; model data should cover states/actions considered by planning. Multi-step predictive consistency matters more than one-step reconstruction alone. Candidate action bounds and environment resets must match those assumed during training.

Formula / computational definition

A basic model objective is ∑tEq[log⁡p(ot∣st)+log⁡p(rt∣st)]−KL(q(st∣ht,ot)∥p(st∣ht))\sum_t\mathbb E_q[\log p(o_t\mid s_t)+\log p(r_t\mid s_t)]-\mathrm{KL}(q(s_t\mid h_t,o_t)\|p(s_t\mid h_t)), with additional latent-overshooting terms in the method. Planning selects at:t+Ha_{t:t+H} maximizing model-predicted cumulative reward.

Parameters and notation

Learned parameters include encoder/decoder, recurrent transition, stochastic prior/posterior, and reward head. Hyperparameters include deterministic/stochastic state sizes, KL/free-nats settings, overshooting horizon/weight, planning horizon, candidate count, elite count, CEM iterations, action repeat, and learning rate.

Fitting, fine-tuning, and adaptation

Pretrain the world model on compatible trajectories, freeze visual features initially if appropriate, then adapt dynamics and reward components with new task data. Unfreeze the full model only with validation of multi-step predictions. Warm-start planning distributions between steps, but avoid treating old models as valid after major dynamics changes.

How to use and calibrate

Evaluate realized returns, multi-step reward prediction, image/latent uncertainty, and performance at a fixed planning budget. Compare candidate counts and horizons separately from model capacity. Hold out complete trajectories; randomly splitting nearby frames exaggerates generalization.

Example application

Choose continuous actions from camera observations in a simulated physics task. The code performs one CEM elite-selection and distribution-refitting step on candidate action sequences with supplied imagined returns; it is not a learned world model or full planner.

Interpretation / pitfalls

Watch out

Planning can exploit model errors, and excessive horizons compound them. A narrow elite distribution can prematurely collapse search. Latent uncertainty is model-dependent, not guaranteed calibrated environmental uncertainty. Unlike a learned actor policy, online CEM introduces a substantial per-decision computation budget.

Python and R code examples

Scope: computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop. Dependencies/validation: Python with NumPy executed successfully; base R not executed. Targets and supplied network outputs are ordinary arrays here, so this does not validate automatic-differentiation boundaries.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop. · needs numpy

import numpy as np
candidates=np.array([[.1,.2,.3],[-.2,0.,.1],[.5,.4,.3],[-.4,-.2,0.]])
imagined_returns=np.array([1.,.2,1.5,-.3]); elite_count=2
elite=candidates[np.argsort(imagined_returns)[-elite_count:]]
new_mean=elite.mean(axis=0); new_std=np.maximum(elite.std(axis=0,ddof=0),.01)
assert np.all(new_std>0); print(new_mean,new_std,new_mean[0])
R

Component demo, not a trained model — computational component described in the application subsection; not a complete estimator, neural trainer, or environment loop.

candidates <- matrix(c(.1,.2,.3,-.2,0,.1,.5,.4,.3,-.4,-.2,0),4,byrow=TRUE)
imagined_returns <- c(1,.2,1.5,-.3); elite_count <- 2
elite <- candidates[tail(order(imagined_returns),elite_count),,drop=FALSE]
new_mean <- colMeans(elite)
new_std <- pmax(sqrt(colMeans(sweep(elite,2,new_mean,"-")^2)),.01)
stopifnot(all(new_std>0)); print(new_mean); print(new_std); print(new_mean[1])

Sources

From the CodeSplash reference, entry DRL015.