Diffusion and Generative Models
Models that learn to produce new samples like their training data; diffusion models do it by learning to remove noise step by step.
Needs a step first: 50
A generative model learns a probability distribution over data so it can draw new examples; a diffusion model fixes a forward process that gradually adds Gaussian noise until an image is pure noise: . A network is trained, with a simple squared-error loss, to predict the noise that was added. To generate, start from random noise and repeatedly subtract the predicted noise, a little at a time, until a picture appears. The maths combines the multivariate normal, Bayesian reasoning about the reverse step, and KL divergence; other generative models, including language models, sample one token at a time instead.
Where it shows up: Diffusion is the method behind most image, video and audio generators.
How to hold it: In your head
See a diffusion model as learning to predict the noise that was added, so generating means starting from pure noise and removing a little at a time.
What knowing it looks like
- Compute a noised sample from , and a noise draw, and recover from a perfect noise prediction.
- Write the training loss of a denoising diffusion model and say what the network's input and target are.
- Explain step by step how sampling turns pure noise into an image.
Test yourself
In one dimension, a data point is . At step , , and the noise drawn is . Compute . What is the distribution of given ? If the network predicts exactly, how do you recover from ?
Show the worked answer
Needs a step first: 50
Learn it with an AI
Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.
Be my maths tutor. I'm learning "Diffusion and Generative Models" (Frontier tier): Models that learn to produce new samples like their training data; diffusion models do it by learning to remove noise step by step. I already know: Training Deep Networks, The Multivariate Normal, Bayesian Inference. Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away. Finish by testing me with this: In one dimension, a data point is $x_0 = 2$. At step $t$, $\bar\alpha_t = 0.64$, and the noise drawn is $\varepsilon = -0.5$. Compute $x_t$. What is the distribution of $x_t$ given $x_0 = 2$? If the network predicts $\hat\varepsilon = -0.5$ exactly, how do you recover $x_0$ from $x_t$? Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.
Needs first
- Training Deep NetworksThe practical craft that makes deep networks learn: sensible initialisation, normalisation, learning-rate schedules, minibatches and watching validation loss.Frontier · Machine Learning
- The Multivariate NormalThe bell curve in many dimensions, set by a mean vector and a covariance matrix, with elliptical contours.Undergraduate II · Probability & Statistics
- Bayesian InferenceTreating an unknown parameter as uncertain: give it a prior distribution and update it with data by Bayes' theorem.Undergraduate II · Probability & Statistics
Leads to
This is the end of a path.
On the way to
Recommended
- Neural Networks: Zero to HeroAndrej Karpathy · VideosFree lectures that build backpropagation, a language model and a small GPT from scratch in Python, explaining every line.
- Understanding Deep LearningSimon J. D. Prince (MIT Press) · BookA clear, well-illustrated 2023 textbook covering networks, training, transformers, diffusion models and reinforcement learning, free as a PDF with Python notebooks.
- 动手学深度学习阿斯顿·张、李沐等 · Book · 中文The Chinese edition of Dive into Deep Learning: a free textbook in which every model, from linear regression to transformers, runs as code beside the maths.
- 跟李沐学AI李沐 · Videos · 中文Mu Li's own Bilibili channel: the video course for Dive into Deep Learning and paragraph-by-paragraph readings of key papers, including the Transformer paper.