Courses
- Main course — Stanford CS236, Fall 2023: Stefano Ermon, Deep Generative Models. Course homepage · Syllabus with slides · Lecture playlist · Course notes. The standard graduate course on the families of generative models: autoregressive models, variational autoencoders, normalizing flows, adversarial networks, energy-based models, score-based and diffusion models, evaluation, and discrete latent variables. Its notes cover the first half of the course.
- Main course — MIT 6.S184, IAP 2026: Peter Holderrieth, Introduction to Flow Matching and Diffusion Models. Course homepage · Lecture notes · PDF · Lecture playlist · Labs with solutions. A short, self-contained course on modern diffusion and flow models through differential equations: flow matching, score matching, guidance, latent spaces and architectures, and discrete diffusion. Its notes (arXiv version) are the best single text for chapters 8–12. The IAP 2025 version adds guest lectures on robotics and protein design.
- Supplement — MIT 6.S978, Fall 2024: Kaiming He, Deep Generative Models. Course page with slides and readings. Lectures on VAEs, autoregressive models, adversarial networks, and diffusion, and reading sessions on tokenizers, flow matching, discrete diffusion, and applications. No recordings.
- Supplement — UC Berkeley CS294-158, Spring 2024: Pieter Abbeel, Wilson Yan, Kevin Frans, and Philipp Wu, Deep Unsupervised Learning. Course page with slides · Lecture playlist · Homework. Recorded lectures on each family of models and on video generation, compression, multimodal models, and applications in science; its four homeworks implement autoregressive, latent-variable, adversarial, and diffusion models.
- Supplement — Stanford CME 296, Spring 2026: Afshine and Shervine Amidi, Diffusion and Large Vision Models. Course homepage · Lecture playlist. A practical course on current image and video generators: diffusion, score matching, flow matching, latent spaces and guidance, architectures, training, and evaluation.
The order below follows the chapters of this module. Each block lists the material to cover and its primary lectures; further reading and exercises provide additional depth. Blocks 1–13 form the main plan; 14–15 are optional extensions. Timing is flexible.
Slide links are the courses’ original files; four CS236 lectures are available only as PowerPoint files. Several prerequisites come from earlier modules: the evidence lower bound, Markov chain Monte Carlo, and Langevin-type samplers from AI chapter 10; mixtures, EM, and kernel density estimates from ML; autoencoders, contrastive image–text models, U-Nets, and vision transformers from DL; and autoregressive transformers, tokenization, sampling, and preference optimization from NLP and LLMs. The corresponding introductory lectures serve as review.
Topic list
- 1. Foundations of generative modeling
- 2. Autoregressive models
- 3. Variational autoencoders
- 4. Normalizing flows
- 5. Generative adversarial networks
- 6. Energy-based models and score matching
- 7. Denoising diffusion models
- 8. Diffusion SDEs and fast sampling
- 9. Flow matching
- 10. Guidance and conditional generation
- 11. Latent diffusion and large-scale generation
- 12. Discrete tokens and multimodal generation
- 13. Evaluating generative models
- 14. Generative models for science and control — optional
- 15. The theory of diffusion models — optional
Reference books used below
- PML2: Kevin Murphy, Probabilistic Machine Learning: Advanced Topics (MIT Press, 2023). Free draft; part IV, chapters 20–26, covers every family of generative models with consistent notation.
- UDL: Simon Prince, Understanding Deep Learning (MIT Press, 2023). Free; chapters 14–18 on unsupervised learning, adversarial networks, normalizing flows, variational autoencoders, and diffusion models, with notebooks.
- 6.S184 notes: Holderrieth and Erives, An Introduction to Flow Matching and Diffusion Models (2026). Free; flow and diffusion models, flow matching, score matching, guidance, architectures, and discrete diffusion.
- PDM: Lai, Song, Kim, Mitsufuji, and Ermon, The Principles of Diffusion Models (2025). Free; a monograph that unifies the variational, score-based, and flow-based views of diffusion and covers guidance and fast solvers.
- FMGC: Lipman et al., Flow Matching Guide and Code (2024). Free; flow matching in continuous, discrete, and Riemannian settings with a PyTorch library.
1. Foundations of generative modeling {#1-foundations-of-generative-modeling}
Topics: What a generative model is for: density estimation, sampling, and representation; the data manifold and the curse of dimensionality; maximum likelihood as minimizing the forward KL divergence; forward and reverse KL, mode covering and mode seeking; f-divergences and integral probability metrics, including maximum mean discrepancy and the Wasserstein distance; explicit, approximate, and implicit models; the trade-offs among sample quality, diversity, likelihood, and speed.
- CS236 lecture 1: Introduction. Slides · PPTX · Video
- CS236 lecture 2: Background. Slides · PDF · Video
- CS236 lecture 4: Maximum likelihood learning. Slides · PDF · Video
- 6.S978 lecture 1: Introduction. Slides · PDF
- PML2 chapter 20: Generative models, an overview.
Further reading: CS236 notes, introduction; Goodfellow, NIPS 2016 tutorial: generative adversarial networks, section 2, for a taxonomy of models by how they use likelihood; Bond-Taylor et al., Deep generative modelling: a comparative review (2022).
2. Autoregressive models {#2-autoregressive-models}
Topics: The chain rule for images and audio; fully visible belief networks and NADE; masked autoencoders for distribution estimation (MADE); PixelRNN and PixelCNN, masked convolutions and the blind spot, gated and conditional PixelCNN; discretized logistic mixtures; WaveNet and dilated causal convolutions; transformers over pixels; orderings; exact likelihood in bits per dimension; the cost of sequential sampling.
- CS236 lecture 3: Autoregressive models. Slides · PDF · Video · Notes
- CS294-158 lecture 2: Autoregressive models. Video
- 6.S978 lecture 3: Autoregressive models. Slides · PDF
- PML2 chapter 22: Autoregressive models.
Further reading: Germain et al., MADE (2015); van den Oord, Kalchbrenner, and Kavukcuoglu, Pixel recurrent neural networks (2016); van den Oord et al., WaveNet (2016); Salimans et al., PixelCNN++ (2017). CS294-158 homework 1 implements autoregressive models of images.
3. Variational autoencoders {#3-variational-autoencoders}
Topics: Latent-variable models and the intractable marginal likelihood; the evidence lower bound and amortized inference; the reparameterization trick and its variance; Gaussian and Bernoulli decoders; posterior collapse and KL annealing; the rate–distortion view and β-VAE; importance-weighted bounds; conditional VAEs; hierarchical VAEs.
- CS236 lectures 5–6: Variational autoencoders. Slides 5 · PDF · Video 5 · Slides 6 · PDF · Video 6 · Notes
- 6.S978 lecture 2: Variational autoencoders. Slides · PDF
- CS294-158 lecture 4: Latent variable models. Video
- UDL chapter 17: Variational autoencoders; PML2 chapter 21.
Further reading: Kingma and Welling, An introduction to variational autoencoders (2019); Burda, Grosse, and Salakhutdinov, Importance weighted autoencoders (2016); Alemi et al., Fixing a broken ELBO (2018); Vahdat and Kautz, NVAE (2020). CS294-158 homework 2 trains VAEs on images.
4. Normalizing flows {#4-normalizing-flows}
Topics: The change-of-variables formula; triangular Jacobians; coupling layers in NICE, RealNVP, and Glow; autoregressive flows, MAF and IAF, and their duality; spline flows; residual and continuous-time flows, neural ODEs, and trace estimation; dequantization; what invertibility costs.
- CS236 lectures 7–8: Normalizing flows. Slides 7 · PDF · Video 7 · Slides 8 · PDF · Video 8 · Notes
- CS294-158 lecture 3: Flow models. Video
- UDL chapter 16: Normalizing flows; PML2 chapter 23.
Further reading: Papamakarios et al., Normalizing flows for probabilistic modeling and inference (2021); Dinh, Sohl-Dickstein, and Bengio, Density estimation using Real NVP (2017); Chen et al., Neural ordinary differential equations (2018); Lilian Weng, Flow-based deep generative models.
5. Generative adversarial networks {#5-generative-adversarial-networks}
Topics: The minimax game and the optimal discriminator; the Jensen–Shannon divergence; the non-saturating loss; training dynamics, oscillation, and mode collapse; f-GANs; Wasserstein GANs, weight clipping, and gradient penalties; spectral normalization; DCGAN, progressive growing, StyleGAN, and BigGAN; conditional and image-to-image GANs; GAN inversion; adversarial losses inside other models.
- CS236 lectures 9–10: Generative adversarial networks. Slides 9 · PDF · Video 9 · Slides 10 · PDF · Video 10 · Notes
- 6.S978 lecture 4: Generative adversarial networks. Slides · PDF
- CS294-158 lecture 5: GANs and implicit models. Video
- UDL chapter 15: Generative adversarial networks; PML2 chapter 26.
Further reading: Goodfellow et al., Generative adversarial nets (2014); Arjovsky, Chintala, and Bottou, Wasserstein GAN (2017); Mescheder, Geiger, and Nowozin, Which training methods for GANs do actually converge? (2018); Karras, Laine, and Aila, StyleGAN (2019). CS294-158 homework 3 trains adversarial networks.
6. Energy-based models and score matching {#6-energy-based-models-and-score-matching}
Topics: Energy functions and the partition function; the maximum-likelihood gradient and its negative phase; Langevin dynamics and contrastive divergence; noise-contrastive estimation; the score function and the Fisher divergence; score matching, sliced score matching, and denoising score matching; Tweedie’s formula; the failure of Langevin sampling in low-density regions; noise-conditional score networks and annealed Langevin dynamics.
- CS236 lectures 11–12: Energy-based models. Slides 11 · PDF · Video 11 · Slides 12 · PDF · Video 12
- CS236 lectures 13–14: Score-based models (the syllabus lists lecture 14 as energy-based models). Slides 13 · PPTX · Video 13 · Slides 14 · PPTX · Video 14
- 6.S184 lecture 3, first part: Score functions and score matching. Slides · PDF · Video
- Yang Song, Generative modeling by estimating gradients of the data distribution. Blog post
- PML2 chapter 24: Energy-based models.
Further reading: Song and Kingma, How to train your energy-based models (2021); Hyvärinen, Estimation of non-normalized statistical models by score matching (2005); Vincent, A connection between score matching and denoising autoencoders (2011); Song and Ermon, Generative modeling by estimating gradients of the data distribution (2019).
7. Denoising diffusion models {#7-denoising-diffusion-models}
Topics: The forward noising process and its closed form; the reverse process as a hierarchical latent-variable model; the evidence lower bound and its decomposition; predicting the noise, the data, or the velocity; the simplified loss and its link to denoising score matching; noise schedules and signal-to-noise weighting; ancestral sampling; DDIM and deterministic sampling; U-Net denoisers with time conditioning.
- CS236 lecture 16: Score-based diffusion models. Slides · PPTX · Video
- 6.S978 lecture 5: Energy-based models, score matching, and diffusion models. Slides · PDF
- CS294-158 lecture 6: Diffusion models. Video
- CME 296 lecture 1: Diffusion. Video
- UDL chapter 18: Diffusion models; PML2 chapter 25.
Further reading: Ho, Jain, and Abbeel, Denoising diffusion probabilistic models (2020); Song, Meng, and Ermon, Denoising diffusion implicit models (2021); Kingma et al., Variational diffusion models (2021); Luo, Understanding diffusion models: a unified perspective (2022); Lilian Weng, What are diffusion models?. CS294-158 homework 4 trains a diffusion model.
8. Diffusion SDEs and fast sampling {#8-diffusion-sdes-and-fast-sampling}
Topics: Stochastic differential equations and their Euler–Maruyama discretization; variance-preserving and variance-exploding processes; the Fokker–Planck equation; reverse-time SDEs; the probability-flow ODE and exact likelihoods; numerical solvers, Heun’s method, and exponential integrators; the design space of noise levels, preconditioning, and time steps; distillation, consistency models, and few-step generation.
- 6.S184 lecture 1: Flow and diffusion models. Slides · PDF · Video
- 6.S184 notes chapters 2 and 4: Flow and diffusion models; score functions and score matching.
- CME 296 lecture 2: Score matching. Video
- 6.S978 guest lecture: Yang Song, consistency models. Slides · PDF
- PDM: the chapters on the score SDE and on fast sampling.
Further reading: Song et al., Score-based generative modeling through stochastic differential equations (2021); Karras et al., Elucidating the design space of diffusion-based generative models (2022); Lu et al., DPM-Solver (2022); Song et al., Consistency models (2023).
9. Flow matching {#9-flow-matching}
Topics: Flows as solutions of ordinary differential equations; the continuity equation; probability paths and conditional paths; the conditional flow matching loss and why it has the same gradient as the marginal one; Gaussian paths and their relation to diffusion; rectified flows and straightening; stochastic interpolants; couplings from optimal transport; sampling with few steps.
- 6.S184 lecture 2: Flow matching. Slides · PDF · Video
- 6.S184 notes chapter 3: Flow matching.
- CME 296 lecture 3: Flow matching. Video
- FMGC sections 1–4.
Further reading: Lipman et al., Flow matching for generative modeling (2023); Liu, Gong, and Liu, Flow straight and fast (2023); Albergo and Vanden-Eijnden, Building normalizing flows with stochastic interpolants (2023); Tong et al., Improving and generalizing flow-based generative models with minibatch optimal transport (2024). The 6.S184 labs implement flow matching and score matching from scratch.
10. Guidance and conditional generation {#10-guidance-and-conditional-generation}
Topics: Conditional generative models; classifier guidance; classifier-free guidance and its geometry; the trade-off between fidelity and diversity; negative prompts; solving inverse problems with a diffusion prior: inpainting, super-resolution, and posterior sampling; editing by partial noising and inversion; adding control signals; fine-tuning for personalization; aligning generators with rewards and preferences.
- 6.S184 lecture 3, second part: Classifier-free guidance. Slides · PDF · Video
- 6.S184 notes chapter 5: Guidance.
- CME 296 lecture 4: Latent space and guidance. Video
- Sander Dieleman, Guidance: a cheat code for diffusion models and The geometry of diffusion guidance. Post 1 · Post 2
Further reading: Dhariwal and Nichol, Diffusion models beat GANs on image synthesis (2021); Ho and Salimans, Classifier-free diffusion guidance (2022); Chung et al., Diffusion posterior sampling for general noisy inverse problems (2023); Zhang, Rao, and Agrawala, Adding conditional control to text-to-image diffusion models (2023).
11. Latent diffusion and large-scale generation {#11-latent-diffusion-and-large-scale-generation}
Topics: Why generate in a latent space; autoencoders for latent diffusion and their losses; text conditioning with frozen text encoders and cross-attention; U-Nets and diffusion transformers; rectified-flow transformers at scale; resolution, noise schedules, and data; video generation with spatiotemporal latents; the cost of training and sampling; distillation for deployment.
- 6.S184 lecture 4: Latent spaces and neural network architectures. Slides · PDF · Video
- 6.S184 notes chapter 6: Building large-scale image or video generators.
- CME 296 lectures 5–6: Architectures, model training. Video 5 · Video 6
- CS294-158 lecture 9: Video generation. Video
Further reading: Rombach et al., High-resolution image synthesis with latent diffusion models (2022); Peebles and Xie, Scalable diffusion models with transformers (2023); Esser et al., Scaling rectified flow transformers for high-resolution image synthesis (2024); Sander Dieleman, Generative modelling in latent space.
12. Discrete tokens and multimodal generation {#12-discrete-tokens-and-multimodal-generation}
Topics: Discrete latent variables, the Gumbel-softmax relaxation, and the straight-through estimator; vector quantization, VQ-VAE, and VQGAN; residual and finite scalar quantization; neural audio codecs; autoregressive transformers over image and audio tokens; masked generative transformers; discrete diffusion, masked diffusion, and diffusion language models; vision–language models and unified models that generate several modalities.
- CS236 lecture 17: Discrete latent variable models. Slides · PDF · Video
- CS236 lecture 18: Diffusion models for discrete data (Aaron Lou). Slides · PDF · Video
- 6.S184 lecture 5: Discrete diffusion models. Slides · PDF · Video
- CS294-158 lecture 12a: Multimodal models. Video
Further reading: van den Oord, Vinyals, and Kavukcuoglu, Neural discrete representation learning (2017); Esser, Rombach, and Ommer, Taming transformers for high-resolution image synthesis (2021); Chang et al., MaskGIT (2022); Sahoo et al., Simple and effective masked diffusion language models (2024); Sander Dieleman, Diffusion language models.
13. Evaluating generative models {#13-evaluating-generative-models}
Topics: Likelihood and bits per dimension, and why good likelihoods and good samples can disagree; the Inception score; the Fréchet inception distance, its bias, and the choice of feature space; kernel inception distance; precision and recall for distributions; text–image alignment scores; human preference studies; memorization, data copying, and extracting training data.
- CS236 lecture 15: Evaluation of generative models. Slides · PDF · Video
- CME 296 lecture 7: Evaluation. Video
Further reading: Theis, van den Oord, and Bethge, A note on the evaluation of generative models (2016); Heusel et al., GANs trained by a two time-scale update rule converge to a local Nash equilibrium (2017), which introduced FID; Kynkäänniemi et al., Improved precision and recall metric for assessing generative models (2019); Stein et al., Exposing flaws of generative model evaluation metrics and their unfair treatment of diffusion models (2023); Carlini et al., Extracting training data from diffusion models (2023).
14. Generative models for science and control — optional {#14-generative-models-for-science-and-control-optional}
Topics: Generative models as priors and samplers outside media: diffusion policies for robot control and planning; protein structure generation and design; molecules and docking; weather and climate ensembles; equivariance to rotations and translations; conditioning on physical constraints; how such models are validated.
- 6.S184 (IAP 2025) lecture 5: Generative robotics. Video
- 6.S184 (IAP 2025) lecture 6: Generative protein design. Slides · PDF · Video
- CS294-158 lecture 13a: AI for science (John Ingraham). Video
Further reading: Chi et al., Diffusion policy (2023); Janner et al., Planning with diffusion for flexible behavior synthesis (2022); Watson et al., De novo design of protein structure and function with RFdiffusion (2023); Price et al., Probabilistic weather forecasting with machine learning (2025).
15. The theory of diffusion models — optional {#15-the-theory-of-diffusion-models-optional}
Topics: Convergence of diffusion sampling given an accurate score; the role of score error and discretization; why the optimal denoiser memorizes the training set and why trained networks generalize; inductive biases of convolutional denoisers; diffusion as spectral autoregression; Schrödinger bridges and connections to optimal transport.
- PDM: the chapters that relate the variational, score, and flow views and that analyze sampling.
- UT Austin IFML, Fall 2025: Sanjay Shakkottai, Diffusion models for generative AI. Course page · Lecture playlist A mathematical course on Langevin dynamics, functional inequalities, and the analysis of diffusion samplers.
- Sander Dieleman, Diffusion is spectral autoregression. Blog post
Further reading: Chen et al., Sampling is as easy as learning the score (2023); Kadkhodaie et al., Generalization in diffusion models arises from geometry-adaptive harmonic representations (2024); Kamb and Ganguli, An analytic theory of creativity in convolutional diffusion models (2025); De Bortoli et al., Diffusion Schrödinger bridge with applications to score-based generative modeling (2021).
Exercises and local references
- The four CS294-158 homeworks implement autoregressive models, VAEs, adversarial networks, and diffusion models on images, with starter code and tests.
- The three 6.S184 labs build flow and diffusion models from simulating SDEs through flow matching, score matching, and a conditional image generator with classifier-free guidance.
- Jakub Tomczak’s code for Deep Generative Modeling gives short, self-contained notebooks for each family of models.
- Foundations supplies the KL divergence, entropy, and the change of variables; ML supplies mixtures, EM, and kernel density estimates; DL supplies autoencoders, U-Nets, vision transformers, and contrastive image–text learning; AI supplies variational inference and Markov chain Monte Carlo; NLP and LLMs supplies autoregressive transformers, tokenizers, sampling, and preference optimization.
Connections to later modules
Reinforcement learning uses generative models as policies and world models, and fine-tuning a diffusion model against a reward is a reinforcement-learning problem developed in RL. Watermarking, provenance, deepfakes, the misuse of generators, and the memorization of copyrighted or private data are taken up in Safety and Frontier. The families of generative models, their training objectives, samplers, guidance, architectures, and evaluation remain in this module.