VivaPrep
← Jaber Notes

Jaber Notes · 16 of 16

Generative Models

VAE (ELBO), GAN (WGAN, mode collapse), normalizing flows, diffusion.

How models generate: the VAE ELBO and reparameterization trick, the GAN minimax objective and its instabilities (WGAN, gradient penalty), normalizing flows, and diffusion models through to Stable Diffusion.

Models that learn to generate new data — not just classify existing data. Full derivations of the ELBO, GAN minimax, and the diffusion forward/reverse process.

Table of contents

  1. Taxonomy of generative models
  2. Variational Autoencoders (VAE)
  3. Generative Adversarial Networks (GAN)
  4. Normalizing flows (overview)
  5. Diffusion models
  6. Evaluation of generative models
  7. Comparison and when to use what

1. Taxonomy of generative models

A generative model learns the data distribution p(x)p(\mathbf{x}) and can sample from it.

ModelLearnsSamplingLikelihood
Autoregressive (GPT, PixelCNN)p(x)=ip(xix<i)p(\mathbf{x}) = \prod_i p(x_i|x_{<i})Sequential, slowExact
VAELatent variable p(x,z)p(\mathbf{x},\mathbf{z})One decoder pass, fastLower bound (ELBO)
GANImplicit (generator + discriminator)One generator pass, fastNot tractable
Normalizing flowBijective transformationOne pass + JacobianExact
DiffusionIterative denoisingMany denoising stepsLower bound (VLB)

2. Variational Autoencoders (VAE)

2.1 Latent variable model

The VAE (Kingma & Welling, 2013) defines a joint model:

pθ(x,z)=pθ(xz)p(z),p_\theta(\mathbf{x}, \mathbf{z}) = p_\theta(\mathbf{x}|\mathbf{z})\, p(\mathbf{z}),

with prior p(z)=N(0,I)p(\mathbf{z}) = \mathcal{N}(\mathbf{0}, \mathbf{I}).

Marginal likelihood (what we want to maximize):

pθ(x)=pθ(xz)p(z)dz.p_\theta(\mathbf{x}) = \int p_\theta(\mathbf{x}|\mathbf{z})\, p(\mathbf{z})\, d\mathbf{z}.

This integral is intractable for deep decoder networks.

2.2 Variational inference and ELBO derivation

Introduce an encoder (recognition model) qϕ(zx)q_\phi(\mathbf{z}|\mathbf{x}) to approximate the intractable posterior pθ(zx)p_\theta(\mathbf{z}|\mathbf{x}).

KL decomposition:

logpθ(x)=Eqϕ(zx) ⁣[logpθ(x,z)qϕ(zx)]+DKL(qϕ(zx)pθ(zx)).\log p_\theta(\mathbf{x}) = \mathbb{E}_{q_\phi(\mathbf{z}|\mathbf{x})}\!\left[\log \frac{p_\theta(\mathbf{x},\mathbf{z})}{q_\phi(\mathbf{z}|\mathbf{x})}\right] + D_\text{KL}(q_\phi(\mathbf{z}|\mathbf{x}) \| p_\theta(\mathbf{z}|\mathbf{x})).

Since DKL0D_\text{KL} \geq 0:

logpθ(x)Eqϕ(zx) ⁣[logpθ(xz)]DKL(qϕ(zx)p(z))ELBO(θ,ϕ;x).\log p_\theta(\mathbf{x}) \geq \underbrace{\mathbb{E}_{q_\phi(\mathbf{z}|\mathbf{x})}\!\left[\log p_\theta(\mathbf{x}|\mathbf{z})\right] - D_\text{KL}(q_\phi(\mathbf{z}|\mathbf{x}) \| p(\mathbf{z}))}_{\text{ELBO}(\theta, \phi; \mathbf{x})}.

ELBO = Evidence Lower BOund. Maximizing ELBO ≡ maximizing marginal likelihood while minimizing KL to prior.

2.3 Decomposition of the ELBO

L(θ,ϕ;x)=Eqϕ(zx)[logpθ(xz)]reconstruction termDKL(qϕ(zx)p(z))regularization term.\mathcal{L}(\theta, \phi; \mathbf{x}) = \underbrace{\mathbb{E}_{q_\phi(\mathbf{z}|\mathbf{x})}[\log p_\theta(\mathbf{x}|\mathbf{z})]}_\text{reconstruction term} - \underbrace{D_\text{KL}(q_\phi(\mathbf{z}|\mathbf{x}) \| p(\mathbf{z}))}_\text{regularization term}.
  • Reconstruction: how well the decoder reconstructs x\mathbf{x} from the latent code z\mathbf{z}.
  • KL regularization: how close the encoder distribution is to the prior. Prevents the encoder from using a wildly non-standard latent space. Encourages a smooth, regular latent space useful for generation.

2.4 Gaussian encoder and closed-form KL

Encoder: qϕ(zx)=N(μϕ(x),diag(σϕ2(x)))q_\phi(\mathbf{z}|\mathbf{x}) = \mathcal{N}(\boldsymbol{\mu}_\phi(\mathbf{x}), \text{diag}(\boldsymbol{\sigma}^2_\phi(\mathbf{x}))).

Prior: p(z)=N(0,I)p(\mathbf{z}) = \mathcal{N}(\mathbf{0}, \mathbf{I}).

Closed-form KL (for Gaussian):

DKL(qϕp)=12j=1d(1+logσj2μj2σj2).D_\text{KL}(q_\phi \| p) = -\frac{1}{2}\sum_{j=1}^d \left(1 + \log \sigma_j^2 - \mu_j^2 - \sigma_j^2\right).

Only the reconstruction term requires sampling; KL is computed analytically.

2.5 Reparameterization trick

The reconstruction term requires taking gradients through a sampling operation zqϕ(zx)\mathbf{z} \sim q_\phi(\mathbf{z}|\mathbf{x}), which is non-differentiable.

Trick: reparameterize as:

z=μϕ(x)+σϕ(x)ε,εN(0,I).\mathbf{z} = \boldsymbol{\mu}_\phi(\mathbf{x}) + \boldsymbol{\sigma}_\phi(\mathbf{x}) \odot \boldsymbol{\varepsilon}, \quad \boldsymbol{\varepsilon} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}).

Now z\mathbf{z} is a deterministic function of μϕ,σϕ\boldsymbol{\mu}_\phi, \boldsymbol{\sigma}_\phi, and independent noise ε\boldsymbol{\varepsilon}. Gradients w.r.t. ϕ\phi flow through μϕ\boldsymbol{\mu}_\phi and σϕ\boldsymbol{\sigma}_\phi.

2.6 VAE architecture and training

import torch
import torch.nn as nn
import torch.nn.functional as F

class VAE(nn.Module):
    def __init__(self, input_dim=784, latent_dim=20):
        super().__init__()
        self.enc_fc1 = nn.Linear(input_dim, 400)
        self.enc_mu  = nn.Linear(400, latent_dim)
        self.enc_logvar = nn.Linear(400, latent_dim)
        self.dec_fc1 = nn.Linear(latent_dim, 400)
        self.dec_out = nn.Linear(400, input_dim)

    def encode(self, x):
        h = F.relu(self.enc_fc1(x))
        return self.enc_mu(h), self.enc_logvar(h)

    def reparameterize(self, mu, logvar):
        std = torch.exp(0.5 * logvar)
        eps = torch.randn_like(std)
        return mu + eps * std

    def decode(self, z):
        h = F.relu(self.dec_fc1(z))
        return torch.sigmoid(self.dec_out(h))

    def forward(self, x):
        mu, logvar = self.encode(x)
        z = self.reparameterize(mu, logvar)
        return self.decode(z), mu, logvar

def vae_loss(recon_x, x, mu, logvar, beta=1.0):
    recon = F.binary_cross_entropy(recon_x, x, reduction='sum')
    kl = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())
    return recon + beta * kl

2.7 β\beta-VAE and disentanglement

Lβ=E[logp(xz)]βDKL(qϕp),β>1.\mathcal{L}_\beta = \mathbb{E}[\log p(\mathbf{x}|\mathbf{z})] - \beta D_\text{KL}(q_\phi \| p), \quad \beta > 1.

Higher β\beta forces more independent, disentangled latent dimensions. Each latent dimension captures one factor of variation.

2.8 VAE for generation

Sample zN(0,I)\mathbf{z} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}), then decode x=Decθ(z)\mathbf{x} = \text{Dec}_\theta(\mathbf{z}). The smooth latent space enables interpolation between data points.


3. Generative Adversarial Networks (GAN)

3.1 The idea (Goodfellow et al., 2014)

Frame generation as a two-player minimax game:

  • Generator GθG_\theta: maps noise zp(z)\mathbf{z} \sim p(\mathbf{z}) to fake samples Gθ(z)pdataG_\theta(\mathbf{z}) \approx p_\text{data}.
  • Discriminator DϕD_\phi: outputs probability that input is real vs. fake.

Each tries to beat the other:

  • DD tries to distinguish real from fake.
  • GG tries to fool DD.

3.2 Minimax objective (derivation)

minGmaxDV(D,G)=Expdata ⁣[logD(x)]+Ezp(z) ⁣[log(1D(G(z)))].\min_G \max_D V(D, G) = \mathbb{E}_{\mathbf{x}\sim p_\text{data}}\![\log D(\mathbf{x})] + \mathbb{E}_{\mathbf{z}\sim p(\mathbf{z})}\![\log(1 - D(G(\mathbf{z})))].

Optimal discriminator (for fixed GG): minimize V-V over DD:

DG(x)=pdata(x)pdata(x)+pG(x).D^*_G(\mathbf{x}) = \frac{p_\text{data}(\mathbf{x})}{p_\text{data}(\mathbf{x}) + p_G(\mathbf{x})}.

Substitute DGD^*_G back into VV:

V(DG,G)=Expdata ⁣[logpdata(x)pdata(x)+pG(x)]+ExpG ⁣[logpG(x)pdata(x)+pG(x)].V(D^*_G, G) = \mathbb{E}_{\mathbf{x}\sim p_\text{data}}\!\left[\log\frac{p_\text{data}(\mathbf{x})}{p_\text{data}(\mathbf{x}) + p_G(\mathbf{x})}\right] + \mathbb{E}_{\mathbf{x}\sim p_G}\!\left[\log\frac{p_G(\mathbf{x})}{p_\text{data}(\mathbf{x}) + p_G(\mathbf{x})}\right].

This equals log4+2DJS(pdatapG)-\log 4 + 2 \cdot D_\text{JS}(p_\text{data} \| p_G), where DJSD_\text{JS} is the Jensen-Shannon divergence.

Global minimum: V(DG,G)=log4V(D^*_G, G^*) = -\log 4 when pG=pdatap_G = p_\text{data} (generator perfectly matches data).

3.3 Training algorithm

for each training iteration:
  1. Sample real batch: x ~ p_data
  2. Sample noise: z ~ p(z), generate fakes: x_fake = G(z)
  3. Update D:  maximize log D(x) + log(1 - D(G(z)))
                (or: minimize BCE on real=1, fake=0)
  4. Update G:  minimize log(1 - D(G(z)))
                (in practice: maximize log D(G(z)) — avoids vanishing gradients early)

Non-saturating GAN loss for generator:

LG=Ez[logD(G(z))].\mathcal{L}_G = -\mathbb{E}_\mathbf{z}[\log D(G(\mathbf{z}))].

3.4 Training instabilities

Mode collapse: GG maps all inputs to a few modes (ignores noise). Discriminator learns to reject those modes → GG shifts to other modes. Never covers full distribution.

Training instability (oscillation): DD and GG take turns outcompeting each other without converging.

Gradient vanishing in DD: if DD is too good, log(1D(G(z)))0\log(1-D(G(\mathbf{z}))) \approx 0 → no gradient for GG.

3.5 Wasserstein GAN (WGAN)

Replace JS divergence with Earth Mover's (Wasserstein-1) distance:

W(pr,pg)=supfL1Expr[f(x)]Expg[f(x)].W(p_r, p_g) = \sup_{\|f\|_L \leq 1} \mathbb{E}_{\mathbf{x}\sim p_r}[f(\mathbf{x})] - \mathbb{E}_{\mathbf{x}\sim p_g}[f(\mathbf{x})].

Critic DD (no longer a probabilistic discriminator) approximates this distance with Lipschitz constraint.

WGAN objective:

minGmaxD:DL1E[D(x)]E[D(G(z))].\min_G \max_{D:\|D\|_L \leq 1} \mathbb{E}[D(\mathbf{x})] - \mathbb{E}[D(G(\mathbf{z}))].

Benefits:

  • Meaningful loss (correlates with sample quality, unlike JS divergence).
  • More stable training; mode collapse less severe.

Enforcing Lipschitz: weight clipping (original WGAN) or gradient penalty (WGAN-GP): penalize (D1)2(\|\nabla D\| - 1)^2 at interpolated samples.

3.6 Conditional GAN (cGAN)

Condition both GG and DD on class label y\mathbf{y}:

minGmaxDV(D,G)=E[logD(xy)]+E[log(1D(G(zy)))].\min_G \max_D V(D,G) = \mathbb{E}[\log D(\mathbf{x}|\mathbf{y})] + \mathbb{E}[\log(1-D(G(\mathbf{z}|\mathbf{y})))].

Enables class-conditional generation, image-to-image translation (pix2pix), text-to-image (early methods).

3.7 StyleGAN (brief)

Progressive growing: train at low resolution first, gradually increase. Stable training of high-resolution generators.

Style-based generator: separate style (appearance) from content. Inject style via AdaIN (Adaptive Instance Normalization) at each resolution level.


4. Normalizing flows (overview)

4.1 Idea

Learn a bijective, differentiable function fθ:xzf_\theta: \mathbf{x} \to \mathbf{z} between data space and a simple latent space (zN(0,I)\mathbf{z} \sim \mathcal{N}(\mathbf{0},\mathbf{I})).

Exact likelihood via change-of-variables:

logp(x)=logpz(fθ(x))+logdetfθx.\log p(\mathbf{x}) = \log p_\mathbf{z}(f_\theta(\mathbf{x})) + \log\left|\det\frac{\partial f_\theta}{\partial \mathbf{x}}\right|.

The log-determinant of the Jacobian accounts for volume change.

Challenge: the Jacobian determinant is O(d3)O(d^3) in general. Flows design architectures where the Jacobian is triangular or block-diagonal → O(d)O(d) determinant.

4.2 Coupling layers (RealNVP, Glow)

Split x\mathbf{x} into [x1,x2][\mathbf{x}_1, \mathbf{x}_2]. Coupling layer:

z1=x1,z2=x2exp(s(x1))+t(x1),\mathbf{z}_1 = \mathbf{x}_1, \quad \mathbf{z}_2 = \mathbf{x}_2 \odot \exp(s(\mathbf{x}_1)) + t(\mathbf{x}_1),

where s,ts, t are arbitrary networks. Jacobian is triangular → det=exp(s(x1))\det = \exp(\sum s(\mathbf{x}_1)). Invertible: x2=(z2t(x1))/exp(s(x1))\mathbf{x}_2 = (\mathbf{z}_2 - t(\mathbf{x}_1)) / \exp(s(\mathbf{x}_1)).

Glow (Kingma & Dhariwal, 2018) applies flows to image generation with learnable permutations and achieved high-quality faces.


5. Diffusion models

5.1 Overview

Diffusion models (DDPM, Ho et al., 2020; score matching, Song & Ermon, 2019) are currently the dominant generative model for images, audio, and video.

Idea: learn to reverse a gradual noising process. Add noise to data step by step until it becomes pure Gaussian noise; train a neural network to reverse each noising step.

5.2 Forward process (adding noise)

Define a Markov chain that gradually adds Gaussian noise over TT steps:

q(xtxt1)=N(xt;1βtxt1,βtI),q(\mathbf{x}_t | \mathbf{x}_{t-1}) = \mathcal{N}(\mathbf{x}_t; \sqrt{1-\beta_t}\,\mathbf{x}_{t-1},\, \beta_t\mathbf{I}),

where βt(0,1)\beta_t \in (0,1) is the noise schedule (small at first, increases).

Define αt=1βt\alpha_t = 1 - \beta_t, αˉt=s=1tαs\bar\alpha_t = \prod_{s=1}^t \alpha_s.

Key property — forward in one step:

q(xtx0)=N(xt;αˉtx0,(1αˉt)I).q(\mathbf{x}_t | \mathbf{x}_0) = \mathcal{N}(\mathbf{x}_t;\, \sqrt{\bar\alpha_t}\,\mathbf{x}_0,\, (1-\bar\alpha_t)\mathbf{I}).

So:

xt=αˉtx0+1αˉtε,εN(0,I).\mathbf{x}_t = \sqrt{\bar\alpha_t}\,\mathbf{x}_0 + \sqrt{1-\bar\alpha_t}\,\boldsymbol{\varepsilon}, \quad \boldsymbol{\varepsilon}\sim\mathcal{N}(\mathbf{0},\mathbf{I}).

As tTt \to T and αˉT0\bar\alpha_T \to 0: xTN(0,I)\mathbf{x}_T \approx \mathcal{N}(\mathbf{0},\mathbf{I}) (pure noise).

5.3 Reverse process (denoising)

The reverse process pθ(xt1xt)p_\theta(\mathbf{x}_{t-1}|\mathbf{x}_t) is also Gaussian (for small βt\beta_t):

pθ(xt1xt)=N(xt1;μθ(xt,t),σt2I).p_\theta(\mathbf{x}_{t-1}|\mathbf{x}_t) = \mathcal{N}(\mathbf{x}_{t-1};\, \boldsymbol{\mu}_\theta(\mathbf{x}_t, t),\, \sigma_t^2\mathbf{I}).

A neural network ϵθ(xt,t)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) predicts the noise ε\boldsymbol{\varepsilon} that was added at step tt. Then:

μθ(xt,t)=1αt(xtβt1αˉtϵθ(xt,t)).\boldsymbol{\mu}_\theta(\mathbf{x}_t, t) = \frac{1}{\sqrt{\alpha_t}}\left(\mathbf{x}_t - \frac{\beta_t}{\sqrt{1-\bar\alpha_t}}\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t)\right).

5.4 Training objective (simplified)

The variational lower bound (VLB) simplifies to:

Lsimple=Et,x0,ε ⁣[εϵθ(αˉtx0+1αˉtεxt,t)2].\mathcal{L}_\text{simple} = \mathbb{E}_{t, \mathbf{x}_0, \boldsymbol{\varepsilon}}\!\left[\|\boldsymbol{\varepsilon} - \boldsymbol{\epsilon}_\theta(\underbrace{\sqrt{\bar\alpha_t}\mathbf{x}_0 + \sqrt{1-\bar\alpha_t}\boldsymbol{\varepsilon}}_{\mathbf{x}_t}, t)\|^2\right].

Training algorithm:

for each training step:
  1. Sample x_0 ~ q(x_0)  (real data)
  2. Sample t ~ Uniform({1,...,T})
  3. Sample ε ~ N(0, I)
  4. x_t = sqrt(ᾱ_t) * x_0 + sqrt(1-ᾱ_t) * ε
  5. Loss = ||ε - ε_θ(x_t, t)||²
  6. Gradient step on θ

Remarkably simple: the model just learns to predict the noise given a noisy image and a time step.

5.5 Sampling (reverse diffusion)

Start from xTN(0,I)\mathbf{x}_T \sim \mathcal{N}(\mathbf{0},\mathbf{I}) and iteratively denoise:

for t = T, T-1, ..., 1:
  z ~ N(0,I)  if t > 1, else z = 0
  x_{t-1} = (1/sqrt(α_t)) * (x_t - β_t/sqrt(1-ᾱ_t) * ε_θ(x_t, t)) + σ_t * z

This requires TT (typically 1000) forward passes through ϵθ\boldsymbol{\epsilon}_\theta → slow generation.

5.6 DDIM (Denoising Diffusion Implicit Models)

Song et al. (2020): derive a non-Markovian sampling process with the same marginals as DDPM but with fewer steps (10–100 instead of 1000):

xt1=αˉt1(xt1αˉtϵθαˉt)x^0+1αˉt1σt2ϵθ+σtε.\mathbf{x}_{t-1} = \sqrt{\bar\alpha_{t-1}}\underbrace{\left(\frac{\mathbf{x}_t - \sqrt{1-\bar\alpha_t}\boldsymbol{\epsilon}_\theta}{\sqrt{\bar\alpha_t}}\right)}_{\hat{\mathbf{x}}_0} + \sqrt{1-\bar\alpha_{t-1} - \sigma_t^2}\,\boldsymbol{\epsilon}_\theta + \sigma_t\boldsymbol{\varepsilon}.

With σt=0\sigma_t = 0: deterministic sampling (DDIM). Enables 10–50 step generation.

5.7 Latent diffusion models (LDM / Stable Diffusion)

Problem: running diffusion in pixel space is expensive (high-dimensional x\mathbf{x}).

Rombach et al. (2022): encode images into a low-dimensional latent space with a pretrained VAE, run diffusion there:

  1. Encode: z0=E(x0)\mathbf{z}_0 = \mathcal{E}(\mathbf{x}_0) (8×\sim 8\times spatial compression).
  2. Add noise to z0\mathbf{z}_0 in forward process.
  3. Train diffusion model ϵθ\boldsymbol{\epsilon}_\theta on latent space.
  4. Decode: x^0=D(z^0)\hat{\mathbf{x}}_0 = \mathcal{D}(\hat{\mathbf{z}}_0).

Much cheaper (smaller latent space) while maintaining image quality.

5.8 Classifier-free guidance (CFG)

Condition the diffusion model on a text prompt (or class) c\mathbf{c}. Train with and without conditioning (randomly drop c\mathbf{c} with probability 0.1):

ϵ^=(1+w)ϵθ(xt,c)wϵθ(xt,).\hat{\boldsymbol{\epsilon}} = (1+w)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, \mathbf{c}) - w\,\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, \varnothing).

Guidance scale w>0w > 0 amplifies the conditional signal. Higher ww → more prompt-aligned but less diverse.

5.9 Score matching connection

The noise-prediction model ϵθ(xt,t)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) is related to the score function (gradient of log density):

xtlogq(xt)ϵθ(xt,t)1αˉt.\nabla_{\mathbf{x}_t}\log q(\mathbf{x}_t) \approx -\frac{\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t)}{\sqrt{1-\bar\alpha_t}}.

Score-based generative models (Song & Ermon) and DDPM are equivalent formulations.


6. Evaluation of generative models

6.1 Fréchet Inception Distance (FID)

Compute Inception-v3 features of real (mr,Σr\mathbf{m}_r, \boldsymbol{\Sigma}_r) and generated (mg,Σg\mathbf{m}_g, \boldsymbol{\Sigma}_g) samples:

FID=mrmg2+tr(Σr+Σg2(ΣrΣg)1/2).\text{FID} = \|\mathbf{m}_r - \mathbf{m}_g\|^2 + \text{tr}(\boldsymbol{\Sigma}_r + \boldsymbol{\Sigma}_g - 2(\boldsymbol{\Sigma}_r\boldsymbol{\Sigma}_g)^{1/2}).

Lower FID = more realistic and diverse samples. Standard metric for image generation.

6.2 Inception Score (IS)

IS(G)=exp ⁣(ExpG[DKL(p(yx)p(y))]).\text{IS}(G) = \exp\!\left(\mathbb{E}_{\mathbf{x}\sim p_G}[D_\text{KL}(p(y|\mathbf{x}) \| p(y))]\right).

High IS = samples are clearly classifiable AND diverse. Doesn't compare to real data distribution (FID is preferred).

6.3 Precision and Recall

Precision: fraction of generated samples that are realistic (near real data manifold). Recall: fraction of real data manifold covered by generated samples.

High precision + low recall: mode coverage poor (generated images look real but limited variety). High recall + low precision: diverse but unrealistic samples.


7. Comparison and when to use what

ModelQualityDiversitySpeed (sampling)LikelihoodTraining
AutoregressiveHighHighSlow (sequential)ExactStable
VAEMediumHighVery fastLower boundStable
GANVery highVaries (mode collapse)Very fastNoneUnstable
Normalizing flowHighHighFast (1 pass)ExactModerate
DiffusionSOTAHighSlow (many steps)Lower boundVery stable

Current state (2026):

  • Images: Diffusion (Stable Diffusion, DALL-E 3, Imagen).
  • Text: Autoregressive (GPT-4, LLaMA, Gemini).
  • Audio: Diffusion + autoregressive (AudioLM, MusicGen).
  • Video: Diffusion (Sora, Stable Video Diffusion).
  • Fast generation needed: GAN still competitive. Flow Matching (continuous normalizing flows) emerging as faster alternative to diffusion.

*File: notes/16_generative_models.md — all DL notes complete.*