Note Wisdom
These annotated study notes break down the first lecture of Stanford’s CME 296 course, explaining diffusion model intuition, DDPM math, loss derivation, and DDIM speedup techniques, with commentary on confusing sections for student review.
Institution: Stanford
Original Course: Stanford CME296 Diffusion & Large Vision Models | Spring 2026 | Lecture 1 - Diffusion
Instructor Bio: This session is co-taught by **Afshine Amidi** and **Shervine Amidi**, adjunct faculty at Stanford University’s Institute for Computational and Mathematical Engineering (ICME). Afshine Amidi received his engineering degree from École Centrale Paris and a Master of Science in Operations Research from the Massachusetts Institute of Technology, where he studied under Prof. Dimitris Bertsimas and was awarded the Jean Gaillard Scholarship and MIT Dean’s Fellowship. He has held roles at Amazon and McKinsey & Company, leading AI and business strategy projects, and co-authors widely used technical learning guides on machine learning and algorithms. Shervine Amidi holds B.S. and M.S. degrees in engineering from École Centrale Paris, as well as an M.S. in Computational and Mathematical Engineering from Stanford University. He has conducted computer vision research at the Stanford Vision Lab and the École Centrale Paris Visual Computing Center. Currently a Senior Machine Learning Engineer at Netflix, he previously worked at Google DeepMind on the Gemini team, Google Assistant, and Uber Data Science. He has served as a teaching assistant for Stanford’s core CS courses and has been an adjunct lecturer at the university since 2021.
Course Description: As the inaugural session of the course, this lecture establishes the foundational context of generative computer vision and motivates the development of diffusion probabilistic models. It covers the core formulation of Denoising Diffusion Probabilistic Models (DDPM), the formal derivation of the Evidence Lower Bound (ELBO) objective, the standard forward and reverse diffusion inference process, and accelerated sampling methods via Denoising Diffusion Implicit Models (DDIM).
This set of notes covers the inaugural lecture of Stanford’s CME 296, a course dedicated entirely to diffusion models and large vision systems, co-taught by twin brothers Afshin and Shervin. The pair follow nearly identical career trajectories: both earned their undergraduate degrees at Centrale Paris in France, then moved to the U.S. for graduate study—Afshin at MIT, Shervin in Stanford’s ICME department. After holding roles at Uber and Google, both now work at Netflix.
They open the lecture by framing just how dramatically image generation has advanced since 2014—back then, models could only produce low-resolution black-and-white images of digits and faces. Today, tools like ChatGPT generate crisp, high-fidelity color images. The entire course is built around unpacking how these systems work, and diffusion is the foundational paradigm they tackle first.
The course is built around two core goals. First, to break down the underlying paradigms that enable modern image generation. Second, to walk through how these models are trained and evaluated in real-world settings.
The instructors are upfront about the course’s prerequisites—no sugarcoating. Students will get the most out of the material if they have a baseline familiarity across four areas: linear algebra (vectors, matrices, gradients, divergence of vector fields), probability theory (Bayes’ rule, conditional and marginal probabilities, expectation, covariance, Gaussian distributions), differential equations (both ordinary and stochastic), and core machine learning concepts (training loops, inference, and basic neural network mechanics). They emphasize that mastery is not required going in, and key concepts will be reviewed intuitively throughout the semester. Still, even passing familiarity will make the mathematical portions far easier to follow.
They also warn that the field itself is deeply technical. Research papers are dense with formulas, and notation conventions vary wildly from one paper to the next. The class strikes a deliberate balance: it does not shy away from math entirely, but focuses on what key formulas do and why they exist, rather than drilling into every line of every proof. Intuition, they stress, is the priority.
On the logistics side, the class meets every Friday from 3:30 to 5:20 PM, is worth two units, and can be taken for credit or as a listener. All lectures are recorded and posted by Saturday evening. There is no assigned homework, but there are two in-person pen-and-paper exams: a midterm and a final. Exams focus on core formulas and conceptual intuition, not step-by-step derivations. The format matches their other popular course, CME 295 on large language models, and a sample exam is posted on the course website to help students calibrate their expectations.
Slides are published the Thursday evening before each lecture so students can print them and take annotations in class. There is also a four-page cheat sheet compiling all core formulas and concepts, which they promise will feel far more coherent by the end of the course. Official announcements are posted on Canvas, and class discussion runs on the Ed platform.
All modern image generation approaches share one fundamental design choice: they start from random noise, then gradually refine that noise into a clean, coherent image.
The instructors break down three core reasons for this design. First, noise is trivial to generate—you simply sample from a standard Gaussian distribution, which is computationally almost free. Second, different initial noise seeds produce different output images, which is how generation systems create diverse outputs. If you always started from an identical blank canvas, you would always get the exact same image (assuming no other randomness in the process). A student asks exactly this question early in the lecture, and the instructors confirm that initial noise is the primary source of variation. Third, Gaussian distributions have exceptionally clean mathematical properties that simplify nearly every derivation that follows.
They use a sculpting analogy to ground the intuition. Think of a block of raw marble as noisy, unshaped material. A sculptor starts with that unformed block and carves away excess material to reveal the final statue. Diffusion works the same way, but operates in pixel space.
Before diving into the math, they establish how images are represented in this framework. Every image is treated as a high-dimensional vector: there are height × width pixels, each with three color channels (red, green, blue), so total dimensionality equals pixel count × 3. All the x terms in the formulas (x₀, xₜ, and so on) refer to these image vectors. Noise is also a vector of the same size, sampled from a standard normal distribution—a zero-mean vector with an identity covariance matrix, also called an isotropic Gaussian, meaning variance is identical in every direction.
The entire diffusion framework revolves around two linked processes. The forward process (usually denoted Q) takes a clean training image and adds small amounts of Gaussian noise step by step until the image is completely degraded into pure noise. The reverse process—the learned model, parameterized by θ—does the opposite: it takes a noisy image and predicts how to remove a small amount of noise, step by step, until a clean image emerges. The landmark paper that first made this approach work reliably for images is DDPM, and it is the focus of most of this lecture.
For the first three lectures, they only cover unconditional generation. That means there is no text prompt or other input guiding the output—the goal is simply to sample new images that match the distribution of the training set.
The forward process is defined step by step. At each timestep t, you take the image from the previous step xₜ₋₁, scale it down by a factor of √(1-βₜ), then add scaled Gaussian noise √βₜ · ε. The sequence of β values is called the noise schedule, and it increases gradually from near 0 to 1 across all T steps. Early steps add very little noise, so the model learns fine-grained details. Later steps add much more noise, so the model learns overall shape and high-level structure.
This specific formulation is called variance preserving, because the total variance of the image stays roughly constant from one step to the next.
One of the most useful practical tricks from the entire lecture: you do not have to apply noise step by step to get from a clean image x₀ to a noisy image xₜ. Because every step adds independent Gaussian noise, you can collapse all those steps into a single closed-form formula. They reparameterize with αₜ = 1 - βₜ, then define ᾱₜ as the product of all α values from step 1 to t. Then xₜ = √ᾱₜ · x₀ + √(1-ᾱₜ) · ε, where ε is just one sample of standard Gaussian noise. This is a massive optimization for training—you can generate any noisy version of an image in one line of code, with no loops required.
The harder part is deriving the loss function for training the reverse model. The ideal goal would be to maximize the likelihood of the training data under the model. But computing that directly would require summing over every possible trajectory from noise back to a clean image, which is completely intractable for high-dimensional images.
Instead, the field uses a standard workaround: maximize a lower bound on the likelihood, called the ELBO (evidence lower bound). The instructors walk through the high-level derivation: you introduce the known forward process Q into the equation, apply Jensen’s inequality (since the logarithm is a concave function), and end up with an expression built from KL divergence terms between the forward process posterior and the learned reverse process.
The key insight that makes this tractable: the forward process posterior Q(xₜ₋₁ | xₜ, x₀) can be computed exactly using Bayes’ rule, because the forward process is Markovian—each step only depends on the one before it—and all distributions are Gaussian. If we assume the learned reverse process is also Gaussian (which the instructors call a reasonable assumption), then the KL divergence between two Gaussians simplifies all the way down to a simple L₂ distance between two noise vectors.
The final DDPM loss is surprisingly straightforward. For each training example, you sample a clean image x₀, a random timestep t, and random noise ε. You create the noisy image xₜ using the closed-form formula above. Then you train the model to predict the noise ε that was added. The loss is just the mean squared error between the true noise and the model’s predicted noise. The model also takes the timestep t as input, so it knows how much noise is present and can calibrate its prediction accordingly.
Training simply involves backpropagating this loss repeatedly. Inference runs in reverse: start with pure noise x_T, then step from T down to 0, each time using the model to predict the noise and subtract a portion of it, plus a small amount of added noise to match the forward process variance.
Standard DDPM has one major practical downside: you have to run the model T times to generate one image, and T is usually around 1000 steps. That is orders of magnitude slower than older generation methods like GANs or VAEs, which only need a single forward pass. For context, if a single forward pass takes 100ms, 1000 steps adds up to minutes per image.
The second half of the lecture covers methods to speed this up. The first naive idea is simply to skip steps—jump from step T to T-10 to T-20, and so on. But this does not work well with standard DDPM, because each step injects its own stochastic noise term. Skipping steps amplifies that randomness and degrades output quality quickly.
The solution they walk through is DDIM, short for Denoising Diffusion Implicit Models. The core idea is to redefine the family of forward processes so that the reverse generation process becomes deterministic. All randomness is pushed to the very start: you sample one initial noise vector x_T, and every subsequent step is a deterministic function of the previous step. No extra noise is added at each denoising step.
The “implicit” in the name refers to this design: the probabilistic part of the process is implicit in the initial sample, not visible between steps. The instructors show that you can construct this family of forward processes such that the marginal distributions Q(xₜ | x₀) exactly match those from DDPM. That means you can use the same trained DDPM model with a DDIM sampler, with no retraining required.
With a deterministic reverse process, you can skip steps much more aggressively without quality collapsing. Typical real-world speedups fall between 10x and 50x. There is still a tradeoff: the more steps you skip, the lower the image quality, measured by metrics like FID. But you can get 20x faster generation with only a small quality penalty, which is almost always worthwhile for practical applications.
By the instructors’ own admission, this is easily the most math-dense lecture of the entire eight-lecture series, so do not feel discouraged if parts of it feel overwhelming.
The ELBO derivation is the biggest area where steps are skipped. They walk through the high-level strategy—introduce Q, apply Jensen’s inequality, decompose into KL divergences—but they gloss over most of the intermediate algebra. They explicitly state that full derivations will not be tested on exams, so you only need to understand the intuition and the final loss formula. Still, it can feel like a lot of leaps if you are seeing this material for the first time.
One point that felt slightly under-justified: the assumption that the reverse process is Gaussian. The instructors call it a “fair” approximation because the forward step is approximately Gaussian, but they do not dive into why that approximation holds well enough to work reliably in practice. It is one of those ideas validated more by empirical results than by elegant theory, at least in this lecture.
The DDIM forward process family (parameterized by σ) is also introduced very quickly. It is not immediately obvious how you design that family to both match the DDPM marginals and become fully deterministic when σ=0. The lecture focuses far more on the intuition and end result than on the construction details.
Overall, this lecture lays all the groundwork for diffusion as a generation paradigm. The forward/reverse process dynamic, the noise schedule, and the simplification of the loss to noise prediction are all ideas that will come up again and again as the class moves into score matching, flow matching, conditioning, and model architectures. Diffusion is not the only generation method they will cover, but it is the most central one, and getting comfortable with the basic notation now will pay off for the rest of the course.
Content Disclaimer: This article is for general reference only and does not constitute professional R&D guidance, production process advice or quality certification. All material performance data has specific test premises; readers should verify parameters against actual equipment and working conditions.
All contents below are exclusive to the paid Word file, NOT available on this web page

