Two differentiable generators dominate modern generative modeling. Both pair the generator with a second network — an inference net, or an adversary.
§20.10.3 Variational autoencoders
The variational autoencoder variational autoencoder A deep generative model whose encoder network performs learned approximate inference: the inference net simply defines the ELBO L, and its parameters are trained to increase L — no explicit inference targets needed. Full treatment in §20.10.3. defined in ch. 20 — open in glossary (VAE) pairs the generator (a decoder ) with a learned encoder , and trains both by maximizing the evidence lower bound:
The VAE objective (eq 20.77)
| the reconstruction term — decode the encoded z and score how well it reconstructs x (like any autoencoder) | scalar | |
| pull the encoder's posterior toward the prior p(z)=N(0,I) — a regularizer that keeps the latent space smooth and samplable | scalar |
The whole thing is trainable by gradient descent because the reparametrization trick lets gradients flow through the sample . Training encoder and decoder together forces a smooth, predictable latent coordinate system — the VAE is an excellent manifold learner. Traverse a learned 2-D latent space (fig 20.6):
Training a decoder and an encoder together forces a smooth, predictable latent coordinate system. Sliding z moves along the manifold and the decoded face changes continuously — here z₁ became "rotation" and z₂ became "expression," two disentangled factors the VAE discovered on its own (fig 20.6).
VAEs are elegant, extend to almost any architecture (DRAW, variational RNNs, importance-weighted autoencoders), and give state-of-the-art likelihoods. Their weakness: samples are often blurry — an artifact of maximizing a likelihood lower bound (which, like , spreads mass onto in-between points; fig 3.6), aggravated by the Gaussian output that tends to ignore small-but-crucial features.
§20.10.4 Generative adversarial networks
A generative adversarial network generative adversarial network (gan) A generator g(z) trained against a discriminator d(x) in a minimax game v=E_data log d + E_model log(1−d); at equilibrium samples are indistinguishable and d→½. No inference or Z-gradient needed, but training can fail to converge. defined in ch. 20 — open in glossary (GAN) replaces inference with a game. The generator makes samples; a discriminator discriminator The GAN network d(x) that estimates the probability x is a real training example rather than a generator sample; its adversary is the generator. defined in ch. 20 — open in glossary tries to tell real from fake; each fights the other:
The GAN minimax game (eqs 20.80–20.81)
| the discriminator maximizes v — learns to output d≈1 on real data and d≈0 on generator samples | classifier | |
| the generator minimizes v — learns to fool the discriminator. At equilibrium p_model = p_data and d = ½ everywhere (samples indistinguishable) | generator |
No inference network, no partition-function gradient — just two networks in competition. Play it: the generator chases the data while the discriminator hunts the gap; at convergence the densities coincide and :
The generator moves p_model toward p_data to fool the discriminator; the optimal d(x) = p_data/(p_data+p_model). At the equilibrium the two densities coincide and d ≈ ½ everywhere — samples are indistinguishable. But simultaneous gradient play can orbit an equilibrium (the v=ab inset) instead of converging: GAN training is a saddle-point problem, not a minimization.
That non-convergence — equilibria are saddle points of , not minima of a single loss — is GANs’ central difficulty (the best-performing generator uses a non-saturating heuristic loss instead of ). When it works (DCGAN, LAPGAN, conditional GANs), it produces the sharpest samples of any method — a LAPGAN fooled human judges 40% of the time. The idea descends directly from noise-contrastive estimation (§18.6): “a good model should fool a classifier.” Uniquely, a GAN can place zero probability on the training points yet still trace a convincing data manifold.
§20.10.5 Generative moment matching networks
A third option drops the second network entirely. A generative moment matching network generative moment matching network A differentiable generator trained (without a discriminator) to match the moments of the data via the maximum mean discrepancy cost. defined in ch. 20 — open in glossary trains so the moments of its samples match the data’s — using the maximum mean discrepancy maximum mean discrepancy (mmd) A kernel-based cost measuring the difference in (infinitely many) moments between two distributions; zero iff the distributions are equal. Trains GMMNs. defined in ch. 20 — open in glossary (MMD), a kernel cost that compares infinitely many moments at once and is zero iff the two distributions are equal.
Three generators, three ways to say “match the data”
All three train the same differentiable generator , differing only in the signal that says how well it matches the data. The VAE adds an encoder and maximizes a likelihood lower bound — stable, good likelihood, blurry. The GAN adds an adversary and plays a game — sharp samples, unstable training. The GMMN adds nothing extra but needs large batches to estimate moments. The GAN’s discriminator can be seen as automatically discovering which statistic the generator is matching worst — a learned, adaptive version of the GMMN’s fixed moment set.
Next: giving these generators convolutional structure, and the fully-directed autoregressive models and autoencoder-based samplers.
Check yourself — VAEs, GANs & moment matching
1.What are the two terms of the VAE objective, and what does each do?
2.Why are VAE samples often blurry?
3.In a GAN, what happens at the equilibrium of the minimax game?
4.Why is GAN training prone to non-convergence?
5.How does a generative moment matching network (GMMN) differ from a GAN, and what connects them?