Domain

Generative Models

How generative models are built and trained: latent-variable models and the ELBO, normalizing flows, diffusion and score-based models, and flow matching.

5 notebooks5 demos
Preview the recommended route
First notebookVariational Autoencoders

Start here. Make one prediction, then note what carries over to the next notebook.

x_tε_θdenoisex_0
Open first notebook
QuestionWhat carries over from Variational Autoencoders into Diffusion, Score-Based Models & Flow Matching?
PredictionBefore opening the first demo, predict which quantity changes first.
Demos5 interactive demos in this domain
Before moving onSay in one sentence how the idea works before going to the next notebook.
LearnerWhich notebook should I read first?

Read the first notebook, make one prediction in its demo, then go on to the next.

Open the first notebook

Recommended route

Read these in order: each notebook comes after the notebooks in this domain that it builds on, and the label beside it gives its level. A prerequisite with no page here yet is marked as outside reading. A notebook is left out of the route only when a prerequisite has neither a page here nor a named outside reading; the full list below marks it.

  1. 01
    Variational Autoencoders

    A latent-variable model trained by maximizing the evidence lower bound (ELBO). The bound falls short of the log-likelihood by the KL divergence from the encoder to the true posterior, so the encoder learns approximate inference, not just compression.

    Advanced20 mincodedemoafter Maximum Likelihood, Bayesian Inference, KL Divergence (Relative Entropy)
  2. 02
    Diffusion, Score-Based Models & Flow Matching

    How diffusion models generate: a fixed forward process adds Gaussian noise, a network learns to predict that noise, and a sampler runs the process in reverse.

    Advanced25 mincodedemoafter Maximum Likelihood, Variational Autoencoders

    Diffusion, Score-Based Models & Flow Matching builds directly on Variational Autoencoders.

  3. 03
    Normalizing Flows: Tractable Density via Invertible Transforms

    Invertible maps that turn a simple density into a richer one: exact log-likelihood from the change-of-variables formula, and layer designs that keep the Jacobian determinant cheap.

    Advanced22 mincodedemoafter Maximum Likelihood, Variational Autoencoders
  4. 04
    Flow Matching & Rectified Flows

    Flow matching trains a velocity field by regression: on the straight path x_t = (1-t)x0 + t x1 the label is x1 - x0, and the learned field is the average label E[x1 - x0 | x_t].

    Advanced34 mincodedemoafter Diffusion, Score-Based Models & Flow Matching, Normalizing Flows: Tractable Density via Invertible Transforms

    Flow Matching & Rectified Flows builds directly on Normalizing Flows.

  5. 05
    Score Matching & Score-Based Generative Models

    Learn the score, the gradient of log p(x), without the normalizing constant. Denoising score matching turns this into regression on the added noise, which is how diffusion models are trained.

    Advanced21 mincodedemoafter Maximum Likelihood, Diffusion, Score-Based Models & Flow Matching

All notebooks

Every published notebook in this domain.