chapter 12 / frontier · estimated time 120-150 min
The difficulty of generating images: learning $p(\text{image})$ directly is too hard (the adversarial game of GANs is unstable—Chapter 0's history lesson covered its rise and fall). Diffusion models break "generation" into a long chain of tiny denoising steps. The forward process (fixed, parameter-free) gradually drowns the data in Gaussian noise. It has an elegant closed form—the noised result at any time $t$ can be computed in a single step:
$$x_t = \sqrt{\bar\alpha_t}\, x_0 + \sqrt{1-\bar\alpha_t}\,\varepsilon, \qquad \varepsilon \sim \mathcal{N}(0, I)$$$\bar\alpha_t$ decreases monotonically from 1 (no noise) to ≈0 (pure noise). The reverse process is the part that gets learned: train a network $\varepsilon_\theta(x_t, t)$ that looks at the noised image and guesses "what noise was originally mixed in":
$$L = \mathbb{E}_{x_0, \varepsilon, t}\, \big\| \varepsilon - \varepsilon_\theta(x_t, t) \big\|^2$$Look closely at this loss—it is exactly the MSE regression of Chapter 1. The entire magic of image generation has, as its training objective, just "a regression problem that predicts noise": at sampling time you start from pure noise, and each step uses the predicted noise to step back a little; after 50 steps the noise becomes an image. Two finishing touches:
A 16×16-pixel cat (a return to this course's pixel-art through-line) travels between noise and image according to the closed form above. Required experiments: ① Click "play in reverse" to watch the full trajectory—note the order in which structure appears: first the large color-block outline, then the eyes and nose—denoising is a coarse-to-fine spectral process, which is why diffusion models compose so well; ② Drag to around t=45—the human eye can no longer recognize anything, yet √ᾱ still has a residual value, so information-theoretically x₀ is not entirely dead; ③ Resample the noise and play again—the same x₀ paired with different ε walks a different trajectory: during training the model sees exactly these infinitely many (x_t, ε) pairs.
Honest disclaimer: what is shown here is the forward formula played backward (what the training data pairs look like); real sampling starts from pure noise and is navigated step by step by the ε_θ network—the direction is the same, but the trajectory is decided by the model.
Running 50 denoising steps in a 1024×1024 pixel space, with one U-Net/DiT forward pass per step, is too expensive. Latent Diffusion (Stable Diffusion's real name) first uses a VAE to compress the image 48× into a latent space, diffuses there, and finally decodes back to pixels. This course's name, "Latent Space Lab," is now fully redeemed: the semantic space of word vectors in Chapter 5, the embedding space of retrieval in Chapter 10, the diffusion latent space here—deep learning's unified worldview is "map the raw data into a semantically effective low-dimensional space, and do all computation there." Architecturally, the U-Net backbone has already been replaced by DiT (Diffusion Transformer, which cuts the noised latent image into patches treated as tokens—another victory for the Chapter 6 architecture); Sora-class video models do the same thing on spatiotemporal patches.
The mechanism by which GPT-4o/Claude/Gemini "see" an image takes only one sentence to assemble from earlier chapters: a ViT (Chapter 4) cuts the image into patches and encodes them into a sequence of vectors, a projection layer aligns them to the LLM's embedding space, and the image tokens are concatenated with the text tokens to enter the same Transformer (Chapter 6). Three routes, ordered by depth of fusion:
When Sora was released, OpenAI's framing that "video generation models are world simulators" sparked the most nourishing debate in the field. The pro side: to generate "a glass falling" correctly, the model must implicitly master gravity, collision, and refraction—compressing video equals compressing physics (the ultimate extension of the compression view in Chapter 7). The con side (the LeCun camp): generating pixels is learning what "looks plausible," not what is "physically correct"—the evidence being systematic failures like glasses clipping through objects and proliferating fingers; a true world model should predict in an abstract representation space (the JEPA route), not in pixel space. The pragmatists: regardless of whose philosophy wins, video models are already providing training data and policy priors for robots (the world-model → embodied-intelligence pipeline is taking shape). This debate is worth tracking because it is essentially asking: can predicting the next frame / next word ever lead to understanding?—the very question you have been pondering since Chapter 7.
The convergence of the entire course's evaluation thread. Before reading any "SOTA" claim, run it through four filters:
The main thread of the course is now complete; we close with three curves still unfolding (all foreshadowed in earlier chapters):
The far-right end of the Chapter 0 timeline was left blank. Having finished this course, you now possess all the technical foundation needed to read—and to help write—that blank space. The final chapter (Chapter 13, hands-on) will twist all the course's threads into a single end-to-end project you can run yourself.