skip to content

Search

← From Noise to Image

Part I — Before Diffusion (2006–2020)

The Adversarial Game

The GAN minimax objective, its JS-divergence interpretation, and the failure mode called mode collapse.

2014 15 min read 2 papers

It is June 2014. Generative models can approximate a data distribution and sample from it, but every existing recipe pays for that ability with an intractable sum, a Markov chain, or an approximate posterior. A paper out of the Université de Montréal proposes training two networks against each other instead of training one network to fit a likelihood — a generator producing samples, a discriminator judging them — and the resulting adversarial game becomes, for the next seven years, the dominant way to make a neural network produce a convincing image.

Where We Were

By 2014 the field had two established families for learning a distribution over images, and both carried a structural tax. Undirected graphical models — restricted Boltzmann machines and the deep belief nets built by stacking them (engine room, Chapter 1 covers their layer-wise pretraining) — represent probability as the product of unnormalized potential functions divided by a partition function, a global sum over every possible configuration of the model’s variables. That partition function, and its gradient, is intractable for anything but the smallest models; fitting one in practice means running Markov chain Monte Carlo and hoping the chain mixes well enough to be useful, a hope that gets harder to sustain as the model grows.

Directed latent-variable models sidestepped the partition function but ran into a different wall: the posterior over latent variables, needed to fit the model by maximum likelihood, is itself intractable for anything but the simplest priors and likelihoods. The variational autoencoder, published six months earlier, addressed this by learning an approximate posterior and optimizing a tractable lower bound on the likelihood instead of the likelihood itself — the ELBO, whose derivation is owned by Chapter 2. The VAE worked, and it needed no Markov chain, but the bound it optimized was a bound, not the true likelihood, and in practice its samples came out characteristically blurry — the cost of an explicit, tractable density.

Two ways to make a density computable, then a way to skip it Deep belief nets and the VAE each made a different piece of the likelihood tractable. The GAN, five months later, stopped trying to compute one at all. Grey monospace text names the paper's own limitation or mechanism. 2006 Deep belief nets layer-wise pretraining needs Markov chain sampling restricted Boltzmann stack 2013 VAE tractable lower bound approximate posterior only blurry samples, no MCMC 2014 GAN no explicit density no Markov chain either adversarial minimax game a density, made computable at a cost no density represented at all Both earlier families spent their effort making a probability computable. June 2014's question was blunter: what if nothing computed one?
Both earlier families spent their effort making a probability computable. June 2014's question was blunter: what if nothing computed one? PNG ↓

Both families, in other words, spent their effort making an explicit probability computable — by approximating a partition function, or by bounding a likelihood — and both paid for that explicitness with either sampling difficulty or approximation error. The question the next paper asked was blunter: what if the model never represented a probability density at all, and was judged only on whether the samples it produced were any good?

The Breakthrough

Generative Adversarial Networks (Goodfellow et al., 2014) frames generative modeling as a two-player game rather than a density-fitting problem. A generator network GG maps noise zz, drawn from a simple fixed prior, to a point in data space, trying to produce samples indistinguishable from real data. A discriminator network DD looks at a sample — real or generated — and outputs the probability that it came from the real data rather than from GG. The two are trained simultaneously: DD is pushed to get better at telling real from fake, and GG is pushed to get better at fooling DD. The paper’s own analogy is counterfeiting: the generator is a team of forgers, the discriminator is the police trying to spot the forgeries, and competition between the two drives the forgeries toward indistinguishable from genuine currency.

Neither network needs to represent a probability density anywhere. GG is a differentiable function — in the original paper, a multilayer perceptron — with no tractable expression for the density of the samples it produces; it is defined entirely by the transformation it applies to noise. DD is a second multilayer perceptron trained as an ordinary binary classifier. Both are trained purely by backpropagation, with no Markov chain during training and no approximate inference network needed to invert the generator. Sampling, at the end, is one forward pass through GG.

Two networks, one adversarial loop, no density anywhere The generator never sees real data directly. Every signal it gets first passes through the discriminator it is trying to fool. Dashed plum edges are the two gradient updates the same forward pass produces each step. Noise z drawn from a fixed prior uniform or Gaussian, p_z Generator G maps noise to a sample multilayer perceptron, 2014 Generated sample G(z) no tractable density one forward pass Real data x drawn from p_data MNIST, TFD, CIFAR-10 Discriminator D outputs P(sample is real) MLP + maxout, dropout gradient updates G, non-saturating loss updates D real or generated data the generator the discriminator, the only judge in the system
The generator never sees real data directly. Every signal it gets first passes through the discriminator it is trying to fool. PNG ↓

Training alternates rather than solving the game exactly at each step: optimizing DD to convergence inside every generator update would be computationally prohibitive and, on a finite dataset, would overfit. The paper’s Algorithm 1 instead runs kk gradient-ascent steps on DD for every one gradient-descent step on GG — the authors used k=1k=1, the cheapest option — updating both with ordinary minibatch stochastic gradient descent with momentum. A second practical adjustment mattered as much as the algorithm itself: early in training, when GG is still poor, DD rejects generated samples with high confidence, and the generator’s intended loss saturates and stops providing a useful gradient. Rather than have GG minimize that saturating term, the authors trained it to maximize a differently-shaped objective with the same fixed point but a much stronger gradient early on — the “non-saturating” heuristic loss used by nearly every GAN trained since.

The 2014 experiments used multilayer perceptrons for the generator — a mix of rectifier and sigmoid units — and a discriminator built from maxout units with dropout applied during training, across three datasets: MNIST, the Toronto Face Database, and CIFAR-10. Because the model has no tractable likelihood, the authors evaluated it by fitting a Gaussian Parzen window to generated samples and reporting the log-likelihood of the test set under that window — a noisy but standard proxy at the time. The adversarial net scored a mean log-likelihood of 225 ± 2 on MNIST and 2057 ± 26 on the Toronto Face Database, ahead of a deep belief net (138 ± 2 / 1909 ± 66) and a deep generative stochastic network (214 ± 1.1 / 1890 ± 29), and within range of a stacked contractive autoencoder (121 ± 1.6 / 2110 ± 50, the best TFD score in the comparison). The code — implemented in Theano, the Python library that could already compile the same numerical graph to either a CPU or a GPU backend — was released publicly alongside the paper.

The paper’s own discussion of the framework’s disadvantages named the failure mode that would define the next several years of GAN research, without yet solving it. Because GG is only ever updated through gradients flowing back from DD, and never sees real data directly, nothing forces it to cover the full diversity of pdatap_{\mathrm{data}}. The authors called the extreme case the “Helvetica scenario”: GG collapses many different values of zz onto the same output xx, sacrificing diversity for a sample that reliably fools the current discriminator — much as the negative-phase chains in a Boltzmann machine can go stale if not refreshed often enough during learning. This is mode collapse, and the paper flags it as an open synchronization problem between GG and DD rather than a solved one; Chapter 4 covers the training-stabilization work — DCGAN, WGAN, WGAN-GP — that spent the following three years attacking it directly.

Five months later, a short follow-up showed how easily the framework generalized. Conditional Generative Adversarial Nets (Mirza and Osindero, 2014) extended the game by feeding auxiliary information yy — a class label, in the simplest case — into both networks: the generator now maps zz conditioned on yy, and the discriminator judges xx conditioned on yy. On MNIST, conditioning on the one-hot class label let the generator produce digits of a chosen class on demand, at the cost of a lower Parzen-window score (132 ± 1.8) than the unconditional model, which the authors reported candidly as a proof of concept rather than a state-of-the-art result. A second experiment conditioned generation on image features from a pretrained convolutional network to generate word-vector tags for photographs from the MIR Flickr 25,000 dataset — an early demonstration that the same mechanism could bridge two different modalities, years before that idea became central to text-to-image generation (covered from Chapter 7 onward).

The Mathematics

The generator and discriminator play a two-player minimax game over a single value function:

min⁡Gmax⁡DV(D,G)=Ex∼pdata(x)[log⁡D(x)]+Ez∼pz(z)[log⁡(1−D(G(z)))]\min_G \max_D V(D, G) = \mathbb{E}_{x \sim p_{\mathrm{data}}(x)}\big[\log D(x)\big] + \mathbb{E}_{z \sim p_z(z)}\big[\log\big(1 - D(G(z))\big)\big]
SymbolMeaning
D(x)D(x)discriminator’s output — estimated probability that xx is real
G(z)G(z)generator’s output — a sample produced from noise zz
pdata(x)p_{\mathrm{data}}(x)the true data distribution
pz(z)p_z(z)the fixed noise prior, e.g. uniform or Gaussian
E\mathbb{E}expectation, i.e. an average over the given distribution

Holding GG fixed, the value function has a closed-form optimal discriminator:

DG∗(x)=pdata(x)pdata(x)+pg(x)D^{*}_{G}(x) = \frac{p_{\mathrm{data}}(x)}{p_{\mathrm{data}}(x) + p_g(x)}

Substituting DG∗D^{*}_G back into VV and simplifying gives a criterion, C(G)=max⁡DV(D,G)C(G) = \max_D V(D,G), whose global minimum the paper proves occurs exactly when pg=pdatap_g = p_{\mathrm{data}}, with value −log⁡4-\log 4. Rewriting that criterion in terms of the Kullback–Leibler divergence and recognizing the Jensen–Shannon divergence inside it gives the result the field still cites:

C(G)=−log⁡4+2⋅JSD(pdata ∥ pg)C(G) = -\log 4 + 2 \cdot \mathrm{JSD}\big(p_{\mathrm{data}} \,\|\, p_g\big)
SymbolMeaning
C(G)C(G)the value of the game once DD has been optimized for the current GG
JSD(⋅ ∥ ⋅)\mathrm{JSD}(\cdot \,\|\, \cdot)Jensen–Shannon divergence between two distributions
pdatap_{\mathrm{data}}the true data distribution
pgp_gthe distribution induced by the current generator

In practice, the training signal for GG swaps to the non-saturating form as soon as DD is confident, replacing min⁡Glog⁡(1−D(G(z)))\min_G \log(1-D(G(z))) with max⁡Glog⁡D(G(z))\max_G \log D(G(z)) — the same fixed point, a steeper gradient when GG is weak. The conditional variant folds an auxiliary variable yy into every term of the same game:

min⁡Gmax⁡DV(D,G)=Ex∼pdata(x)[log⁡D(x∣y)]+Ez∼pz(z)[log⁡(1−D(G(z∣y)))]\min_G \max_D V(D, G) = \mathbb{E}_{x \sim p_{\mathrm{data}}(x)}\big[\log D(x \mid y)\big] + \mathbb{E}_{z \sim p_z(z)}\big[\log\big(1 - D(G(z \mid y))\big)\big]
SymbolMeaning
yythe conditioning variable — a class label or other auxiliary information
D(x∣y)D(x \mid y)discriminator’s probability that xx is real, given yy
G(z∣y)G(z \mid y)generator’s output given noise zz and condition yy
pdata(x)p_{\mathrm{data}}(x), pz(z)p_z(z)the data distribution and noise prior, as above
E\mathbb{E}expectation over the given distribution

What It Enabled

The GAN paper itself was explicit about where its framework sat relative to the alternatives, and its own comparison — reproduced here in condensed form — is worth keeping because it names the trade-off precisely:

OperationDeep directed graphical modelsDeep undirected graphical modelsAdversarial nets
Inference during trainingNeeded, approximateNeeded, MCMC-basedNot needed
SamplingNo difficultiesRequires a Markov chainNo difficulties
Evaluating p(x)p(x)Intractable, approximatedIntractable, approximatedNot explicitly represented
Model design constraintNearly all models incur difficultyCareful design neededAny differentiable function permitted

Set against the VAE specifically, the trade is sharper still: the VAE keeps an explicit, tractable (bounded) density and pays for it with blur; the GAN drops the density entirely and, freed from ever having to reconstruct or bound a likelihood, produced qualitatively sharper samples from the start — at the cost of an unstable training procedure and no way to measure how well it was actually covering the true distribution.

VAE (Chapter 2)GAN (this chapter)
DensityExplicit, via a tractable lower bound (ELBO)Implicit — never computed
Training signalReconstruction plus KL regularizer, single networkAdversarial minimax game, two networks
Sample sharpness (2013–2014)Characteristically blurryComparatively sharp, but unstable to train
Known failure modeOverly smooth, low-detail samplesMode collapse, non-convergence
Likelihood evaluationDirect (bound)Only approximate, e.g. Parzen windows

The theoretical result — that the adversarial game minimizes the Jensen–Shannon divergence at its equilibrium — turned out to describe an equilibrium that ordinary gradient descent on two competing networks rarely reaches exactly, and the following three years of GAN research were substantially about closing that gap between theory and practice. Convolutional architectures replaced the original multilayer perceptrons with DCGAN in November 2015; alternative divergences replaced Jensen–Shannon with the Wasserstein distance in January 2017, followed by a gradient-penalty variant in March 2017 to fix a remaining instability — all covered in Chapter 4. Once training was tamed, scale and fidelity became the frontier: progressive growing in October 2017, then BigGAN in September 2018, then the style-based generator line — StyleGAN, StyleGAN2, and StyleGAN3 — running from December 2018 through June 2021, all in Chapter 6. The conditional mechanism from this chapter became the entry point for text-conditioned generation, first with stacked and attention-based text-to-image GANs in Chapter 7, and the same adversarial idea was carried into the temporal domain by video GANs from 2016 onward, taught in Video Generation, Chapter 2. Judging any of this progress required a better metric than a Parzen window; the Fréchet Inception Distance, introduced in 2017, is covered in Chapter 21. The adversarial approach held the state of the art in raw image fidelity through the rest of the 2010s, until a 2021 paper made the explicit claim that diffusion models — the subject of Chapter 8 — had overtaken it, a turning point covered in Chapter 10.

One minimax game, three years of scale, one loss to diffusion Architecture and objective fixes let GANs grow from bedroom photos to megapixel faces. A 2021 paper is where this lineage stops leading. Grey monospace text names the concrete change, or where this book covers the branch. GAN, 2014 adversarial minimax game Goodfellow et al. DCGAN, 2015 all-convolutional recipe reliable convergence WGAN, 2017 Earth-Mover distance loss tracks sample quality ProGAN, 2017 grows resolution gradually progressive growing BigGAN, 2018 large batch, large model class-conditional scale StyleGAN family style-based generator line style-based, three versions Diffusion overtakes 2021 paper claims the lead Chapter 10, guidance CGAN, 2014 generator conditioned on y class-conditional digits Text to image GANs conditioned on a caption Chapter 7 Video GAN, 2016 same game, added time video-generation, Chapter 2 the origin descendants that still work the branch that lost the lead
Architecture and objective fixes let GANs grow from bedroom photos to megapixel faces. A 2021 paper is where this lineage stops leading. PNG ↓

Key Papers

PaperAuthorsYearLinkWhy it matters
Generative Adversarial NetworksGoodfellow et al.2014arXiv:1406.2661Introduces the adversarial minimax game — a generator and discriminator trained against each other with no explicit density and no Markov chain — and proves its equilibrium minimizes the Jensen–Shannon divergence
Conditional Generative Adversarial NetsMirza and Osindero2014arXiv:1411.1784Extends the adversarial game with an auxiliary conditioning variable fed to both networks, the mechanism every later text-to-image and class-conditional GAN builds on

PM Lens

Papers referenced