CS 486/686 Dissecting Diffusion and World Models
Lecture 24
From noise to video to an interactive world
Image → video → interactive computer
image generate pixels
→
video add time
→
world model add actions + feedback
Part I
Image generation
Learn a path from noise to data.
Start with noise and an image
\(z_{\text{noise}}\)
→
\(z_{\text{data}}\)
Generation learns how to travel from the left endpoint to the right.
Connect them with a pathinteractive
\(z_t=(1-t)z_{\text{noise}}+t z_{\text{data}}\)
Velocity is the slope of the path
\[
z_t=(1-t)z_{\text{noise}}+t z_{\text{data}}
\]
↓ differentiate with respect to \(t\)
\[
v^\star=\frac{dz_t}{dt}=z_{\text{data}}-z_{\text{noise}}
\]
Generation follows those arrows repeatedly
sample noise \(z_0\)
predict velocity \(v_\theta(z_t,t,c)\)
update + repeat \(z_{t+\Delta t}\)
Many small moves turn an easy random sample into a structured output.
Each velocity prediction advances the sample
predicted velocity
noise
data
one path through latent space
the corresponding output becomes cleaner
Part II
Video generation
Generate many consistent frames—not just one image.
An image is a one-frame video
image [C, H, W]
→
video [C, 1, H, W]
Add one axis: time.
Video adds time
same object
smooth motion
consistent scene
Five seconds is about 80 frames
\[
5\ \text{seconds}\times16\ \text{frames/second}\approx80\ \text{frames}
\]
Five seconds already means 96 million values
\[
80\times480\times832\times3=95{,}846{,}400
\]
80 frames × 480 × 832 pixels × RGB
Compress first; run the expensive transformer in a smaller space.
Case study
Wan2.1-T2V-1.3B
An open text-to-video model built from a video VAE, a DiT, and a text encoder.
Wan’s default clip has 81 frames
frame 0 \(t=0\)
80 intervals \(80/16=5\) seconds
frame 80 \(t=5\)
81 RGB frames
→
21 latent time steps
Other supported lengths follow \(4k+1\), such as 33, 49, or 81 frames.
The Wan-VAE compresses the video
RGB video [3, 81, 480, 832]
encoder →
continuous latent [16, 21, 60, 104]
decoder →
reconstructed video [3, 81, 480, 832]
time 81 → 21 ≈ ÷4
height 480 → 60 ÷8
width 832 → 104 ÷8
channels 3 → 16 expand
Team Wan et al., “Wan: Open and Advanced Large-Scale Video Generative Models,” 2025 ; example provenance .
A latent video is a nested array
16 channels
different learned features
→
21 time steps
inside every channel
→
−.3 .8 .1 …
.6 −.2 .4 …
⋮ ⋮ ⋮ ⋱
60 × 104 matrix
of real numbers
\([16,21,60,104]\quad=\quad z[\text{channel},\text{time},\text{row},\text{column}]\)
Patchify the latent—just like an image encoder
RGB video
[3, 81, 480, 832]
≈ 97 million values
→Wan-VAE
latent grid
[16, 21, 60, 104]
continuous features
→1×2×2 patches
patch sequence
[32,760, 64]
\(21\times30\times52\) patches
→linear projection
DiT tokens
[32,760, 1536]
transformer input
One token begins as \(16\) channels × \(1\) time step × \(2\times2\) spatial cells \(=64\) values.
Prompt in; video out
prompt → umT5 hidden states
↓
latent noise \(z_0\)
→
Wan DiT predict velocity
→
updated latent repeat until clean ↺
decode once
clean latent \([16,21,60,104]\)
→
Wan-VAE cheap decoder
→
RGB video 81 frames
Text conditions the DiT—not the VAE decoder.
A Wan block mixes video, text, and time
video self-attention mix space + time
text cross-attention read umT5 states
feed-forward network transform each token
× 30 blocks
The timestep modulates each block, telling it how noisy the current latent is.
Train the DiT to predict velocity
real video VAE → \(z_{\text{data}}\)
add noise choose \(t\), build \(z_t\)
Wan DiT predict \(v_\theta(z_t,t,c)\)
target slope \(z_{\text{data}}-z_{\text{noise}}\)
\[
\mathcal L=\left\lVert v_\theta(z_t,t,c)-(z_{\text{data}}-z_{\text{noise}})\right\rVert_2^2
\]
Train the DiT. Keep umT5 and the Wan-VAE fixed.
The generated resultrecorded model output
Prompt
A small blue robot writes E = mc² on a blackboard in a sunlit university classroom, then turns toward the camera and waves, fixed camera, coherent motion, clean cinematic lighting.
Generated with Wan2.1-T2V-1.3B ; reproducibility record .
Part III
From video generation to world modeling
A fixed video cannot react. A world model observes actions and generates what happens next.
A video generation model is not a world model
video generator
prompt once
fixed clip
world model
observe each action
predict → feed back ↺
A generated video is static. You cannot interact with it like a video game.
NeuralOS predicts the next screen
current screen
double-click Home →
neural network
→
next screen
\((\text{screen history},\ \text{action})\rightarrow\text{next screen}\)
A new action generates a new frameinteractive
Click an action. The model generates the next screen—there is no autoplay.
current frame
new action double-click Home →
generated frame
new action click × →
generated frame
Next word prediction → next frame prediction
words so far “the robot”
→
next word “waves”
append prediction to “so far”
screens so far + action desktop + double-click
→
next frame file manager
append prediction to “so far”
Wan can be adapted to predict what happens next
Why reuse Wan? Video pretraining has already learned useful priors about appearance, motion, and dynamics.
history + new action frames, mouse, keyboard
→
Wan backbone adapt the pretrained DiT
→
next frame or chunk generated response
feed the generated result back into history
NeuralOS uses a different backbone. The shared formulation is repeated next-frame prediction.
Zhao et al., “minWM,” 2026 ; He et al., “Matrix-Game 2.0,” 2025 .
Before you go: deadlines and office hour
Office hour today
4–5 PM
MC 4021 · this classroom
Assignment 3
Tue Aug 4 · 11:59 PM
Waterloo time
CS 686 final project
Wed Aug 5 · 11:59 PM
Report + code submission
Final exam—and good luck
Saturday Aug 8
7:30–10:00 PM
PAC 5
Bring
Non-programmable calculator
One double-sided letter-size notes sheet
This is our last class. Good luck!