Diffusion and flow models are the cutting edge generative AI methods for images, videos, and many other data types. This course offers a comprehensive introduction for students and researchers seeking a deeper understanding of these models. Lectures will teach the core mathematical concepts necessary to understand diffusion models, including stochastic differential equations and the Fokker-Planck equation, and will provide a step-by-step explanation of the components of each model. Labs will accompany each lecture allowing students to gain practical, hands-on experience with the concepts learned in a guided manner. At the end of the class, students will have built a latent diffusion model from scratch – and along the way, will have gained hands-on experience with the mathematical toolbox of stochastic analysis that is useful in many other fields. This course is ideal for those who want to explore the frontiers of generative AI through a mix of theory and practice. We recommend some prior experience with probability theory and deep learning.
Course Notes
The course notes serve as the backbone of the course and provide a self-contained explanation of all material in the class. We strongly recommend using them. You can view the notes by clicking the button below:
To cite these lecture notes, please use:
@misc{flowsanddiffusions2026,
author = {Peter Holderrieth and Ezra Erives},
title = {Introduction to Flow Matching and Diffusion Models},
year = {2026},
url = {https://diffusion.csail.mit.edu/},
eprint = {2506.02070},
archivePrefix = {arXiv}
}
Lectures
| Lecture | Topic | Slides | Recording |
|---|---|---|---|
| 1 |
Flow and Diffusion Models
|
[slides 1] | |
| 2 |
Flow Matching
|
[slides 2] | |
| 3-A |
Score Functions and Score Matching
|
[slides 3] | |
| 3-B |
Classifier-free Guidance
|
[slides 3] | |
| 4 |
Latent Spaces and Neural Network Architectures
|
[slides 4] | |
| 5 |
Discrete Diffusion Models
|
[slides 5] |
Labs
There are 3 labs given as exercises accompanying the class to give you hands-on practical experience. The labs will guide you through building a flow matching and diffusion model from scratch step-by-step. To do the exercises, perform the following steps:- Click on the lab link below to view the lab instructions.
- Download the
.ipynbnotebook from GitHub and open it in your favorite Jupyter notebook environment (one good choice is Google Colab). - Follow the instructions in the lab to complete the exercises.
- Once all questions have been completed, export your notebook to a PDF and submit to Gradescope via Canvas. Please do not clear cell output, as this makes it harder to grade!
Lab 1: Working with ODEs and SDEs
Lab 2: Flow Matching and Score Matching
Lab 3: Diffusion Transformer and VAEs
Stuck? Solutions can be found here.
Instructors
Lectures
Labs
Prerequisites: Linear algebra, multivariate calculus, and basic probability theory. Students should be familiar with Python and have some experience with PyTorch.
Acknowledgements
We would like to thank:- Professor Tommi Jaakkola for advising and sponsoring this class
- Ashay Athalye (Students for Open and Universal Learning) for excellent video editing.
- Lisa Bella, Ellen Reid, and the team at MIT EECS
- Christian Fiedler, Tim Griesbach, Benedikt Geiger, and Albrecht Holderrieth
- Elaine Mello (MIT Open Learning)
- Cameron Diao, Tally Portnoi, Andi Qu, Roger Trullo, Ádám Burián, Zewen Yang, and many others
- The Missing Semester
- Participants in MIT 6.S184 (IAP 2026)
Licensed under CC BY-NC-SA.