Paper commentary
World Models
Agents can learn to act inside a compact world model of their environment
- Problem Model-free RL agents usually stay small because credit assignment makes large networks slow to train. Large recurrent models can learn rich features, but training them directly on reward is too hard.
- Method World Models splits the agent in two. A VAE compresses each frame, an MDN-RNN predicts the next latent vector, and a small linear controller is trained by evolution on rewards.
- Results The full model scores 906 ± 21 over 100 CarRacing-v0 trials. A policy trained only inside the dream survives about 1100 time steps in the real VizDoom Take Cover environment.
Why train the controller through a learned model?
The question is whether an agent can act well from raw pixels when most of its capacity sits in a model of the environment rather than in the policy that chooses actions. Model-free methods usually rely on small networks, because the credit assignment problem makes a large network slow to reach a good policy during training. The proposed split keeps the large network in a world model that is trained without reward information, and leaves the reward-driven search to a small controller.
Since the world model learns from observations alone, it compresses each frame and predicts how the frames change, and only the controller sees the reward. The search then runs over a small parameter space, which is the reason the authors give for using evolutionary optimization on the controller instead of gradient-based credit assignment.
Vision, memory and controller
The V component is a Variational Autoencoder that maps each observed frame to a low-dimensional latent vector z. Training combines a reconstruction loss with a KL term against a Gaussian prior, and the prior caps how much information each code can carry while keeping the codes robust to unrealistic vectors produced by M.
The M component is an RNN whose output is a mixture of Gaussians over the next latent vector, so it models a distribution over possible futures rather than one deterministic prediction. It conditions on the current action, the current latent code and the hidden state, that is P(z_{t+1}|a_t, z_t, h_t). The recurrent core is an LSTM, and the mixture uses five Gaussians with a diagonal covariance, so the correlation parameter is not modelled.
A mixture is used because environments with random discrete events, such as a monster deciding whether to shoot, are poorly described by a single diagonal Gaussian. During sampling, a temperature parameter tau scales the model's uncertainty, which gives a single knob for how stochastic the simulated environment is.
The controller is a single linear layer that maps the concatenated latent code and hidden state to an action at each step. \[a_t = W_c [z_t\, h_t] + b_c\] In the Car Racing setup this controller has 867 parameters, while the Take Cover controller has 1,088. At run time the rollout encodes each observation, asks the controller for an action, steps the environment, and then advances the recurrent state with the action and latent code.
Candidate parameters are scored by running rollouts in parallel on one multi-core machine.
CarRacing-v0 results
The V model is trained on 10,000 rollouts from a random policy, and each frame is encoded into a 32-dimensional latent vector. The M model is then trained on the encoded latent vectors together with the recorded random actions. Each model needed less than an hour of computation on a single GPU. The parameter counts are 4,348,547 for the VAE, 422,368 for the MDN-RNN and 867 for the controller.
When the controller sees only z and not the hidden state, it reaches 632 ± 251 over 100 random trials. Its driving wobbles and it misses sharper corners. Adding a hidden layer of 40 tanh units, which raises the controller to 1443 parameters, improves this to 788 ± 141, still short of solving the task.
Giving the controller both z and the RNN hidden state h gives 906 ± 21 over 100 random trials, which the authors take as solving the task and as a new best result among the compared methods. In the same table, the continuous A3C result is 591 ± 45, the discrete A3C result is 652 ± 10, DQN is 343 ± 18, and the leaderboard entry is 838 ± 11.
Those baseline numbers come from prior work and the leaderboard, so the comparison depends on the scoring protocol they report rather than on runs made under this paper's setup. The best agent reached an average of 900.46 over 1024 random rollouts after 1800 generations, with a population of 64 agents each run 16 times with different seeds.
The authors contrast this with Deep RL pipelines that add edge detection or stack recent frames, since their world model takes a stream of raw RGB frames and learns the spatio-temporal features itself.
Training the controller inside the dream
The second experiment asks whether an agent trained entirely inside its own world model can transfer its policy back to the real environment. The M model here also predicts the done flag d_t, which lets the latent model work as a gym-style environment, and the V encoder is not used during the dream.
In VizDoom: Take Cover the reward is survival, each rollout is capped at 2100 time steps, and the task counts as solved at an average of 750 time steps over 100 consecutive rollouts. The Take Cover models are the VAE with 4,446,915 parameters and a latent size of 64, the MDN-RNN with 1,678,785 parameters, and the controller with 1,088.
After training, the controller learns to move around the dream and avoid fireballs generated by the M model, and reaches about 900 time steps in the virtual environment. The authors make the dream harder than the real game by raising the temperature during sampling, which adds unpredictable fireball motion and occasional deaths.
The appendix DoomRNN experiment uses tau = 1.15 in the virtual environment, and its best agent averages 959 over 1024 random rollouts. That appendix run uses only the latent model, and the actual VizDoom game was used only to collect random training data.
Transfer to the actual VizDoom game
The policy trained inside the dream is then run on the original VizDoom scenario. It survives about 1100 time steps over 100 consecutive trials, against a required 750 time steps.
The V model misses some details of the real frames, such as the exact number of monsters, but the policy still navigates the real environment. The authors argue that a policy able to survive the noisier dream should do well in the cleaner real environment.
Temperature controls the gap between dream and reality
The temperature sweep trains the controller at several tau values inside the virtual environment and then evaluates it on the actual environment over 100 random rollouts. At tau = 0.10 the virtual score is 2086 ± 140 but the actual score is 193 ± 58, and at tau = 0.50 the values are 2060 ± 277 virtual and 196 ± 50 actual. At tau = 1.00 the virtual score is 1145 ± 690 and the actual score is 868 ± 511, and at tau = 1.15 they are 918 ± 546 and 1092 ± 556.
At tau = 1.30 the virtual score is 732 ± 269 and the actual score is 753 ± 139, with a random policy at 210 ± 108 and the Gym leader at 820 ± 58 as reference rows.
The authors read the sweep as showing that higher temperature makes it harder for the controller to find adversarial policies, while too high a temperature leaves the dream too difficult to learn anything. The best actual score occurs at tau = 1.15, and tau = 1.30 gives a lower score with a lower variance of returns, which the authors describe as a less risky strategy.
At tau = 0.1 the monsters in the dream never shoot fireballs because of mode collapse, so the policy looks strong in the dream but underperforms even a random policy in the real game.
Limitations
The controller can find an adversarial policy that scores well inside the learned model, usually by visiting states far from the training distribution where the model is wrong. The world model is only an approximate probabilistic model and can generate trajectories that break the laws of the actual environment, so the controller can exploit it even where no such exploit exists in the real game.
The MDN-RNN was chosen to make exploitation harder, and the authors tie the remaining trade-off to the temperature between realism and exploitability.
The MDN-RNN may not store all the recorded information in its weights, and neural networks trained with backpropagation may suffer from catastrophic forgetting. The V model is unsupervised and can spend capacity on details that do not matter for the task, such as brick tile patterns in Doom, while failing to reproduce road tiles that matter for driving in Car Racing.
The authors state that the tasks in these experiments are relatively simple, and only CarRacing-v0 and VizDoom Take Cover are tested. They state that one pass of the iterative training procedure was enough for these simple tasks, while harder tasks would need the controller to explore actively, which they leave as a research direction.
Paper info
- Authors
- Ha, David, Schmidhuber, Jürgen
- Venue
- arXiv · Preprint
- First published
- 2018-3-27
- Added
- 2026-11-12
- Updated
- 2018-5-9
- Version
- v4
- arXiv
- 1803.10122
- DOI
- 10.5281/zenodo.1207631
- Category
- cs.LG · stat.ML
- Original paper terms
- CC BY 4.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Ha, David, Schmidhuber, Jürgen (2018). World Models. arXiv:1803.10122v4. https://doi.org/10.5281/zenodo.1207631
BibTeX
@article{david2018world,
title = {{World Models}},
author = {Ha, David and Schmidhuber, Jürgen},
year = {2018},
eprint = {1803.10122},
archivePrefix = {arXiv},
doi = {10.5281/zenodo.1207631},
url = {https://arxiv.org/abs/1803.10122v4}
}