Search

Search papers and lessons

Diffusion for World Modeling: Visual Details Matter in Atari (DIAMOND)

Eloi Alonso, Adam Jelley, Vincent Micheli et al. · 2024

DIAMOND trains an Atari agent entirely inside a diffusion world model, and keeps visual detail that discrete-latent world models lose, reaching a mean human-normalised score of 1.46 on Atari 100k.

On this page

  • Colour = topic mix
  • Calculus
  • Probability
  • Reinforcement learning
  • Architectures
  • Generative models
  • Linear algebra
  • Sign in to see your progress

TL;DR

Most learned world models compress each frame into a few discrete codes, and the compression can throw away small details that matter for a decision, such as a distant enemy or a ball near a brick. DIAMOND replaces the discrete model with a diffusion model that predicts the next frame directly as an image. An agent is trained entirely inside that model, and on the 26-game Atari 100k benchmark it reaches a mean human-normalised score of 1.46, the best result for agents trained only in a world model at the time of the paper.

Where you'll see it: model-based reinforcement learning on pixel inputs, and as a playable neural game engine trained from recorded gameplay.

The problem

A world model is a learned simulator. The agent can practise inside it instead of inside the real environment, which saves experience. Recent world models, such as IRIS and DreamerV3, model the environment as a sequence of discrete latent variables. Discretising the latent space limits how far errors compound over long rollouts, which is a real benefit.

The cost is information loss. A fixed number of discrete codes per frame may not hold every visual detail. The paper's example is driving: a traffic light or a pedestrian far away can change the right action, and a model that smooths it away can mislead the agent. Adding more discrete codes reduces the loss but costs more computation.

Diffusion models had by 2024 become the dominant method for high-resolution image generation. They model a continuous image directly and are easy to condition on past frames and actions. The question the paper asks is whether a diffusion model can serve as a world model, and what has to change to make it stable over long horizons.

Key idea

DIAMOND (DIffusion As a Model Of eNvironment Dreams) uses a conditional diffusion model as the environment's next-frame predictor. Given a short history of past frames and actions, it generates the next frame by denoising noise into an image. The policy then acts in the generated frames, and the reward and episode-end signals come from a separate small model.

The paper makes three design choices that matter. It uses the EDM formulation of diffusion instead of the DDPM formulation that most people would reach for first. It uses only a few denoising steps per frame. And it conditions the model on past frames by stacking them as input channels. The paper's analysis argues that the first choice is what makes the second one work.

flowchart LR
  H[Past frames and actions] --> D[Diffusion world model, 3 denoising steps]
  N[Noise] --> D
  D --> F[Next frame]
  F --> H
  F --> R[Reward and termination model]
  R --> A[Actor-critic policy]
  A -->|action| H

The method

Diffusion formulation

The paper writes the model as a denoiser Dθ\mathbf{D}_\theta that receives a noisy next frame xt+1τ\mathbf{x}^\tau_{t+1}, the noise level τ\tau, past observations x≤t0\mathbf{x}^0_{\leq t} and past actions a≤ta_{\leq t}. It is trained to recover the clean next frame xt+10\mathbf{x}^0_{t+1}. The perturbation kernel adds Gaussian noise with standard deviation σ(τ)\sigma(\tau) and leaves the signal unchanged, so the drift is zero and the process is the variance-exploding kind used in EDM.

The denoiser is parameterised with the EDM preconditioning:

Dθ(x,y)=cskip(τ) x+cout(τ) Fθ(cin(τ) x,y),cskip(τ)=σdata2σdata2+σ(τ)2.\mathbf{D}_\theta(\mathbf{x}, y) = c_{\text{skip}}(\tau)\,\mathbf{x} + c_{\text{out}}(\tau)\,\mathbf{F}_\theta\big(c_{\text{in}}(\tau)\,\mathbf{x}, y\big), \qquad c_{\text{skip}}(\tau) = \frac{\sigma_{\text{data}}^2}{\sigma_{\text{data}}^2 + \sigma(\tau)^2}.

Here σdata\sigma_{\text{data}} is the standard deviation of the data, yy bundles the noise-level embedding with the conditioning, and cinc_{\text{in}}, coutc_{\text{out}} keep the network's inputs and outputs at unit variance. The training objective, after substituting the parameterisation, is a regression of Fθ\mathbf{F}_\theta onto a target that mixes signal and noise depending on σ(τ)\sigma(\tau). The paper says this target stays informative at both extremes of the noise schedule. The noise levels are sampled from a log-normal distribution that concentrates training on medium-noise levels.

The network is a standard 2D U-Net. Past observations are concatenated to the noisy frame along the channel axis, and actions enter through adaptive group normalisation in the residual blocks. The sampler is Euler's method, which the paper found effective without the extra evaluations of higher-order samplers.

Reinforcement learning in imagination

A separate reward and termination model RψR_\psi uses convolutional and LSTM layers to handle partial observability. The actor-critic has a shared CNN-LSTM trunk with a policy head and a value head. The policy is trained with REINFORCE using a learned value baseline, and the value function is trained with a Bellman error on λ\lambda-returns.

The training loop alternates three steps. The agent collects real experience with the current policy. The world model is retrained on all data collected so far. The agent is then trained with reinforcement learning on rollouts generated by the world model. The agent never learns from the real environment except through the collected data.

Sampling cost

The paper uses 3 function evaluations per frame. The reason is that each evaluation is a full pass through the U-Net, so the number of steps sets the cost of every imagined frame. A world model that needs many denoising steps can make agent training too slow, so the choice of solver and step count is part of the method, not an implementation detail.

Results

Atari 100k

The Atari 100k benchmark gives an agent 100k actions per game, about two hours of play, before evaluation. DIAMOND was trained from scratch on each of the 26 games with 5 random seeds. Each run used about 12 GB of GPU memory and took about 2.9 days on an RTX 4090. The paper reports 1.03 GPU-years in total.

The paper's Table 1 gives returns for each game and the aggregate metrics. DIAMOND's mean human-normalised score is 1.459, against 1.266 for STORM, 1.097 for DreamerV3, 1.046 for IRIS and 0.956 for TWM. Its interquartile mean is 0.641, tied in bold with STORM at 0.636. DIAMOND is superhuman on 11 games.

The score is defined per game as

HNS=agent return−random returnhuman return−random return.\text{HNS} = \frac{\text{agent return} - \text{random return}}{\text{human return} - \text{random return}}.

Table 1 is not uniformly in DIAMOND's favour. On BankHeist, Hero, Frostbite and UpNDown, other methods score well above DIAMOND. The mean is pulled up by large gains on games such as Asterix, Breakout and RoadRunner, where the paper argues fine visual detail matters.

Why the diffusion choice matters

Figure 3 compares imagined trajectories from a DDPM-based world model and an EDM-based one, with the number of denoising steps decreasing. Trajectories are imagined for up to 1000 timesteps. The DDPM model quickly drifts out of distribution, and the drift is faster with fewer steps. The EDM model stays stable even with a single denoising step.

The paper explains the difference. DDPM predicts the noise, and when the noise dominates the input, this target makes the network learn something close to the identity function, which gives a poor estimate of the score at the start of sampling. EDM's target instead asks for the clean image when the noise is large, so it gives a usable estimate even in that regime.

Denoising steps and visual quality

The paper uses 3 steps, not 1. In Breakout, one step is enough because the transitions are close to deterministic. In Boxing, the opponent's movement is unpredictable, and a single step averages over the possible outcomes and produces a blurry image. Three steps drive the sample towards one mode and produce a crisp frame.

Comparison with IRIS

Both IRIS and DIAMOND were trained on the same static dataset of 100k frames collected with expert policies, at 64×6464 \times 64 resolution. IRIS uses a discrete autoencoder and an autoregressive transformer and needs 16 function evaluations per frame. DIAMOND needs 3. The paper reports inconsistencies in IRIS's imagined frames, such as enemies that turn into rewards between frames, and does not report these in DIAMOND's frames. The paper also says DIAMOND has far fewer parameters than IRIS.

Counter-Strike

The paper's later section trains only the world model, not an agent, on 87 hours of Counter-Strike: Global Offensive gameplay on the Dust II map. To make this feasible, the resolution is reduced to 56×3056 \times 30, and a second, smaller diffusion model upsamples the output to 280×150280 \times 150. The dynamics model has 4M parameters on Atari and the CS:GO model has 381M, including 51M for the upsampler. The combined model trained for 12 days on an RTX 4090 and runs at 10 Hz on an RTX 3090. People can play inside it with keyboard and mouse. The paper reports that the model stays stable for hundreds of timesteps, but drifts in less visited parts of the map, forgets the state when the view is blocked, and allows repeated mid-air jumps.

Why it mattered

The paper showed that diffusion can be a practical world model, not only an image generator, and that the choice of diffusion parameterisation is central to the result. It also gave a concrete argument for continuous visual models over discrete latents in settings where visual detail matters. The released code and playable models made the work easy to inspect.

The paper is also open about its limits. The main evaluation is on discrete-action environments, and the paper notes that continuous control is untested. Memory comes from stacking a fixed number of past frames, so the model cannot remember events much further back. The authors suggest an autoregressive transformer over time, and they report an initial cross-attention experiment in the appendix that did not beat frame stacking. The reward model is kept separate from the diffusion model, and the paper leaves merging them to future work.

Reading guide

Read these lessons in order before the paper's sections.

  1. Section 1, Introduction. Needs World Model and Model-Based Reinforcement Learning. The contrast with discrete latents is only clear once you know what a world model is for.
  2. Section 2.1, Reinforcement learning and world models. Needs Reinforcement Learning, Partially Observable Markov Decision Process and Actor-Critic Methods.
  3. Section 2.2, Score-based diffusion models. Needs Diffusion Model, Score Matching and Stochastic Differential Equation. The paper also relies on Denoising Diffusion Probabilistic Models (DDPM) as the formulation it argues against.
  4. Section 2.3, Diffusion for world modeling. Needs Diffusion Model and the conditional form of the same objective. Read it alongside World Model.
  5. Section 3.1, Practical choice of diffusion paradigm. Needs U-Net, Euler Method and Score Matching for the preconditioning argument.
  6. Section 3.2, Reinforcement learning in imagination. Needs Long Short-Term Memory, Actor-Critic Methods, Policy Gradient and Temporal-Difference Learning for the value and λ\lambda-return losses.
  7. Section 4, Atari 100k. Needs the aggregate-score definitions only. The comparison to IRIS is in Section 5.3.
  8. Section 5.1, Choice of diffusion framework. Needs Denoising Diffusion Probabilistic Models (DDPM) to follow the argument against it.

Check yourself

QuestionRecall: what are the two stated reasons the paper gives for preferring a diffusion world model over a discrete-latent one?Show answer

The paper argues that discrete latents may lose visual details that matter for reinforcement learning, which is the information-loss problem. It also argues that diffusion models are easy to condition on past frames and actions and can model complex multimodal distributions. Both properties suit a world model, since conditioning helps the model follow the agent's actions and multimodality gives more varied training scenarios.

QuestionComputation: an agent's return in Breakout is 132.5, the random return is 1.7 and the human return is 30.5. What is its human-normalised score?Show answer

HNS=(132.5−1.7)/(30.5−1.7)=130.8/28.8≈4.54\text{HNS} = (132.5 - 1.7) / (30.5 - 1.7) = 130.8 / 28.8 \approx 4.54. The agent scores about 4.5 times the gap between random play and the human score, so it is well above the human baseline on this game.

QuestionWhy: why does the paper report that DDPM-based world models degrade faster as the number of denoising steps falls?Show answer

DDPM trains the network to predict the noise. When the noise dominates the input, the best prediction of the noise is close to the noisy input itself, so the network learns something close to the identity. That gives a poor estimate of the score at the start of sampling, and the error compounds over many autoregressive steps. With fewer steps each step has less room to correct the error. EDM trains the network to predict the clean image at high noise, which gives a usable estimate even with one step.

QuestionApplied scenario: you are building a world model for a driving simulator where a distant pedestrian must be seen. Using this paper, which design would you start from, and what would you measure first?Show answer

Start from a continuous diffusion model with EDM-style preconditioning, conditioned on a short history of frames and actions, and use a small number of denoising steps. Measure first whether the distant pedestrian survives in the imagined frames, because the paper's argument is that losing such details is what discrete latents do. Also measure drift over long rollouts, since the paper's stability result depends on the parameterisation and not only on the step count.

Sources

Read the full paper

Eloi Alonso, Adam Jelley, Vincent Micheli et al., 2024. arXiv:2405.12399