v9.1.1
Menu

Chapter 1: Introduction to Generative Models

Week 1

Understand the landscape of generative modeling: how machines learn to create new data, the fundamental difference between generative and discriminative approaches, and why diffusion models have emerged as the state-of-the-art framework for high-fidelity generation.

Topics
6
Demo
1
Videos
3
Min read
41

Chapter Overview

Generative models are at the heart of modern AI's creative capabilities. From photorealistic image synthesis to drug molecule design, these models learn the underlying distribution of data and generate novel samples that are statistically indistinguishable from real observations.

This chapter builds the conceptual foundation you need before diving into diffusion models specifically. We start with the fundamental distinction between generative and discriminative modeling, then survey the major families of generative models that have been developed over the past decade. You will learn how likelihood-based training works, why latent variables are essential for modeling complex data, and how researchers evaluate the quality and diversity of generated samples.

By the end of this chapter, you will understand:

  • Generative vs Discriminative: Why modeling P(x)P(x) is fundamentally harder than P(y∣x)P(y|x)
  • Model Taxonomy: The strengths and weaknesses of GANs, VAEs, Normalizing Flows, and Autoregressive models
  • Likelihood Training: Maximum likelihood estimation, tractable and intractable densities, and the ELBO
  • Latent Variables: How hidden representations enable complex generation through simple priors
  • Evaluation Metrics: FID, IS, precision/recall, and why measuring generative quality is an open problem
  • The Case for Diffusion: Why diffusion models solve the key problems that plagued earlier approaches

Chapter Roadmap

Click any topic to jump in

Explainer videoInteractive demo
1
Generative vs Discriminative

The fundamental split — modeling data distributions vs learning decision boundaries.

Discriminative Models: Learning P(y|x)Generative Models: Learning P(x)Joint vs Conditional DistributionsWhen to Use Each Approach
The generative landscape
2
Taxonomy

GANs, VAEs, flows, autoregressive, diffusion — the landscape of generative approaches.

Generative Adversarial Networks (GANs)Variational Autoencoders (VAEs)Normalizing FlowsAutoregressive Models
Two approaches to generation

Direct likelihood vs latent variables

3
Likelihood-Based

Normalizing flows and autoregressive models — directly maximizing log-likelihood.

Maximum Likelihood Estimation (MLE)Tractable vs Intractable LikelihoodsThe Evidence Lower Bound (ELBO)
4
Latent Variable

VAEs and the ELBO — learning compressed representations through variational inference.

Latent Variables and the Generative ProcessThe Inference ProblemEncoder-Decoder Framework
Measuring and motivating

Evaluation and why diffusion wins

5
Evaluation

FID, IS, precision/recall — measuring quality and diversity of generated samples.

Frechet Inception Distance (FID)Inception Score (IS)Precision and Recall for Generative ModelsPerceptual Quality vs Distribution Matching
6
Why Diffusion?

Training stability, mode coverage, sample quality — why diffusion surpassed GANs and VAEs.

The Core Idea: Gradual DenoisingAdvantages Over GANsAdvantages Over VAEsThe Flexibility of the Diffusion Framework

Topics

6 topics in this chapter

Suppose you want a machine that does more than sort photos into 'cat' and 'dog' --- you want it to invent a brand-new cat that has never existed. That single wish exposes the deepest divide in machine learning. A classifier only needs to know where the boundary between cats and dogs lies; it never has to understand what a cat truly is. A model that can dream up new cats must learn the entire visual world of cats: every pose, fur pattern, and lighting condition. This chapter opens the diffusion study plan by making that divide precise. Discriminative models learn the conditional P(y∣x)P(y \mid x) --- given an input, which label? Generative models learn the data distribution P(x)P(x) itself --- what does plausible data look like? The distinction decides what a model can do, how it is trained, and how much data it needs. It is also strictly ordered: knowing P(x)P(x) lets you recover P(y∣x)P(y \mid x) by Bayes' rule, but a classifier can never be run backwards to synthesise data. We build this idea first because every generative family in the coming topics is one answer to the same question: how do you actually learn P(x)P(x)?

Definition

A discriminative model estimates the conditional distribution P(y∣x)P(y \mid x), mapping an input directly to a label or value. A generative model estimates the full data distribution P(x)P(x), or the joint P(x,y)P(x, y), so it can assign a likelihood to any point and draw new samples from it. Generative modeling is the strictly harder, more general task.

In this topic

  1. 1Discriminative Models: Learning P(y|x)
  2. 2Generative Models: Learning P(x)
  3. 3Joint vs Conditional Distributions
  4. 4When to Use Each Approach
1 of 4
Discriminative Models: Learning P(y|x)

P(y∣x)=P(x∣y)P(y)P(x)P(y \mid x) = \frac{P(x \mid y) P(y)}{P(x)}

A discriminative model directly estimates the conditional probability of label yy given input xx. The formula is Bayes' rule: P(x∣y)P(x \mid y) is the class-conditional likelihood, P(y)P(y) the prior over labels, and P(x)P(x) the evidence --- but a discriminative model skips all three and models P(y∣x)P(y \mid x) directly, learning only the decision boundary that separates classes. Logistic regression, SVMs, and classification CNNs are examples. They train easily and reach high accuracy because they ignore within-class structure, but they fail on inputs far from the training distribution: with no model of P(x)P(x), they cannot tell a novel input from a familiar one and still return a confident label.

Mathematical Intuition

Discriminative models project high-dimensional input onto a decision surface. The conditional P(y∣x)P(y|x) discards all information about the data manifold itself — it only needs the boundary where class posteriors cross 0.50.5. Statistically, this means fewer parameters to estimate and faster convergence rates, since the model ignores within-class variance entirely.

Example:

A CNN classifies images as cat or dog. Does it need to understand what cats look like in general, or just what distinguishes cats from dogs?

2 of 4
Generative Models: Learning P(x)

P(x)=∫P(x∣z)P(z) dzP(x) = \int P(x \mid z) P(z) \, dz

A generative model learns the full joint probability distribution P(x)P(x) of the data. Once learned, it can generate new samples by drawing from this distribution. The formula above shows the latent variable formulation: the data distribution is expressed as a marginalization over latent variables zz. Learning P(x)P(x) is fundamentally harder because the model must capture all variation in the data --- every texture, every pose, every lighting condition --- not just the features that distinguish classes.

Mathematical Intuition

Learning P(x)P(x) requires estimating density in the full ambient space, which is exponentially harder due to the curse of dimensionality. The integral P(x)=∫P(x∣z)P(z) dzP(x) = \int P(x|z)P(z)\,dz marginalizes over latent factors, and tractability depends on whether this integral has closed form. When it does not, variational bounds or MCMC become necessary — the starting point for diffusion models.

Example:

If you have a generative model that has learned the distribution of face images, what tasks can it perform beyond generation?

3 of 4
Joint vs Conditional Distributions

P(x,y)=P(x∣y)P(y)=P(y∣x)P(x)P(x, y) = P(x \mid y) P(y) = P(y \mid x) P(x)

The joint distribution P(x,y)P(x, y) contains complete information about both the data and labels. Generative models that learn P(x,y)P(x, y) can derive both P(x)P(x) (by marginalization) and P(y∣x)P(y|x) (by conditioning). Conditional distributions capture only part of the picture. The chain rule of probability connects them: knowing any two of {P(x,y),P(x∣y),P(y),P(y∣x),P(x)}\{P(x,y), P(x|y), P(y), P(y|x), P(x)\} lets you derive the others. This is why generative models are more powerful but harder to train --- they must learn more information.

Mathematical Intuition

The chain rule P(x,y)=P(y∣x)P(x)=P(x∣y)P(y)P(x,y) = P(y|x)P(x) = P(x|y)P(y) reveals an information hierarchy: the joint contains strictly more information than any conditional. Bayes' theorem converts between conditionals, but requires the marginal P(x)P(x) — which is exactly the intractable quantity in generative modeling. This asymmetry is why generative models are universal but harder to train.

Example:

Given a dataset of handwritten digits with labels, compare what a generative vs discriminative model learns.

4 of 4
When to Use Each Approach

Use discriminative models when you have labeled data and only need predictions: classification, regression, ranking. They are more data-efficient for supervised tasks because they focus capacity on the decision boundary.

Use generative models when you need to: create new data (images, text, molecules), understand data structure, detect outliers, handle missing data, or perform semi-supervised learning. Generative models also enable data augmentation, privacy-preserving synthetic data, and creative applications.

In practice, the lines are blurring. Modern systems like CLIP combine discriminative and generative objectives, and diffusion models can be conditioned on text to bridge generation and classification.

Mathematical Intuition

From an information-theoretic view, discriminative models compress data into log⁡∣Y∣\log|\mathcal{Y}| bits (the label), while generative models must represent the full entropy H(X)H(X) of the data distribution. When H(X)≫log⁡∣Y∣H(X) \gg \log|\mathcal{Y}|, the discriminative model is vastly more efficient for classification — but it cannot reconstruct, generate, or detect anomalies.

Example:

A hospital wants to (a) diagnose diseases from X-rays, and (b) generate synthetic X-rays for training. Which approach for each?

Theory Exercise

Problem:

Prove that if you have a perfect generative model P(x,y)P(x, y), you can always derive a perfect discriminative model P(y∣x)P(y|x), but the reverse is not true. What does this imply about the relative difficulty of generative vs discriminative learning?

Hints:
  • Use the definition of conditional probability: P(y|x) = P(x,y) / P(x)
  • Consider what information is lost when you only learn P(y|x)
  • Think about whether P(y|x) alone lets you sample new data points x