Video understanding, tracking, generation, and world models · World models and dynamic 3D · VID062 · Model
Dreamer
Learns a latent dynamics model from agent experience and improves behavior by imagining trajectories in that model.
In CodeSplash
Documented in the Academy only. There's no Set up button.
- Availability
- Explained here
- 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
Learns a latent dynamics model from agent experience and improves behavior by imagining trajectories in that model. It connects video representation learning to control, but actions and rewards make the full system different from passive unsupervised video modeling.
Question / objective
Predict, control or reconstruct dynamic visual scenes under an explicit observation/action/camera model. This is a learning or inference objective, not a test of a statistical null hypothesis.
Method type and supervision
model · World models and dynamic 3D. Mixed: passive video learning, interaction-conditioned learning, or scene fitting from calibrated observations.
Architecture / computational structure
Recurrent state-space observation/reward model plus actor and value models trained through latent imagination.
Assumptions
Inputs must satisfy the temporal, modality and annotation protocol described below. Model errors compound during imagination, and optimization can exploit unrealistic predicted rewards. Simulator performance does not establish safe transfer to an unfamiliar physical system.
Formula / computational definition
summarizes state inference and prediction; policy/value learning optimizes predicted returns along imagined latent trajectories.
Parameters and notation
Learned/estimated quantities: Learned quantities depend on the system: dynamics/representation weights or scene-specific geometry, motion, appearance and opacity; planning actions are optimized inputs. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: Deterministic/stochastic state sizes, imagination horizon, KL balance, reward model, policy update and action representation matter.
Fitting, fine-tuning, and adaptation
Adapt the world model to new transitions and recalibrate policy learning separately. Monitor model exploitation; actor improvement on imagined returns must be checked in the real evaluation environment. Use a separate adaptation validation split, monitor the target metric and retention of previously useful behavior, and save the exact preprocessing and training configuration.
How to use and calibrate
Fix the input protocol and target before fitting; choose design settings on held-out source videos, then freeze the evaluation procedure. Measure environment return over multiple seeds, sample efficiency and model/policy ablations; test prediction errors relevant to control.
Example application
Learn a visual-control policy with fewer direct environment interactions.
Interpretation / pitfalls
Watch out
An optimized training objective or a favorable example does not establish generalization. Measure environment return over multiple seeds, sample efficiency and model/policy ablations; test prediction errors relevant to control. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.
Python and R code examples
Component: Score a short imagined latent rollout with discounted rewards. Dependencies: NumPy in Python; base R in R; run the shared setup above. Python component: executed successfully. R component: unexecuted. No complete model training or pretrained inference was executed.
Full implementation route — Python: Reproduce the original paper's world-model and actor-critic version; later Dreamer versions require separate configurations. R: Demonstrate latent rollouts and discounted returns in R; bridge the recurrent state-space and policy learners for full experiments.
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.
Component demo, not a trained model — Score a short imagined latent rollout with discounted rewards.
Shared setup for this chapter
import numpy as np
def softmax(x):
z = np.asarray(x, dtype=float)
e = np.exp(z - z.max())
return e / e.sum()
state = 0.; actions = [1.,1.,-1.]; rewards = []
for action in actions:
state = .9*state+action
rewards.append(-abs(state-2.))
discount = .95
imagined_return = sum(discount**t*r for t,r in enumerate(rewards))
print("imagined rewards",rewards,"return",imagined_return)
Component demo, not a trained model — Score a short imagined latent rollout with discounted rewards.
Shared setup for this chapter
softmax <- function(x) {
e <- exp(x - max(x))
e / sum(e)
}
state <- 0; actions <- c(1,1,-1); rewards <- numeric(3)
for(i in seq_along(actions)) {state <- .9*state+actions[i];rewards[i] <- -abs(state-2)}
discount <- .95
print(rewards); print(sum(discount^(0:2)*rewards))
Sources
- Source 1arxiv.org
From the CodeSplash reference, entry VID062.