Vibe Engines
YouTube
Paper Breakdowns  /  GANs
Paper 23~8 min readNeurIPS 2014
Paper Breakdown

GANs,
explained.

Teaching a machine to recognize a cat is one thing. Teaching it to imagine a new cat that never existed is another entirely. In 2014, a single, almost mischievous idea cracked it open: pit two networks against each other — a forger and a fraud detective — and let their arms race do the teaching. Neither is ever told what a good image looks like. They discover it by trying to beat each other.

The delta

What changes against the VAE: the loss function is learned

Rung 1's blurriness comes from a hand-written loss — a per-pixel comparison that does not know what makes an image look real, so it rewards the average. This rung's change is to stop writing the loss and train a network to be the loss.

Two networks play a game. A generator maps noise to images; a discriminator tries to tell its output from real data. The generator's objective is to fool the discriminator, and the discriminator's is not to be fooled, so as the generator improves the critic sharpens, and the target keeps moving. Nothing here computes a likelihood or a pixel distance at all.

The consequence, stated in rung 1's units, is sharpness. There is no averaging of plausible outputs, because a blurred image is trivially identifiable as fake and the discriminator punishes it hard — the generator is pushed toward images that live on the data manifold rather than toward the mean of several. That was a large, visible jump in sample quality, and it is why this family dominated image generation for years despite everything in the next block.

01

The generation problem

Discriminative models — "is this a cat or a dog?" — had a clear training signal: a label to match. Generative models face a harder question with no obvious signal. To create a realistic face, the model must capture the entire probability distribution of faces. But how do you write a loss for "looks like a plausible human"? Pixel-by-pixel error famously produces blurry averages, not crisp, convincing images.

Before GANs, generative models leaned on tractable-but-limited math or heavy approximations, and their samples looked it. The field needed a training signal for realism that didn't require anyone to hand-define what "realistic" means. GANs supplied exactly that — by learning the critic.

02

The adversarial idea

The paper's analogy is perfect: a counterfeiter and a detective. The counterfeiter prints fake money and tries to pass it; the detective inspects bills and tries to spot fakes. Each pushes the other to improve. As the detective sharpens, the counterfeiter must forge better; as the forgeries improve, the detective must look closer. Run this arms race long enough and the fakes become indistinguishable from real currency.

GANs make both roles neural networks and let them co-train. Nobody hands the forger a rule for "realistic." The realism signal comes entirely from a second network that is simultaneously learning to detect fakes. The critic is not fixed — it's an adversary that evolves.

03

The two players

The Generator (G) takes a vector of random noise and transforms it into a sample — say, an image. The noise is its source of variety; different noise vectors should yield different outputs. The Discriminator (D) takes a sample and outputs a probability: how likely is this real rather than generated?

The forger vs. the detective
Generator Gnoise → fake sample
vs
Discriminator Dsample → real? fake?

Their goals are exactly opposed. G wants D to label its fakes as real; D wants to correctly flag them as fake. This direct opposition is the engine of learning — one network's success is the other's failure, so both are relentlessly pressured to improve.

04

The minimax game

Formally, it's a two-player minimax game with one value function they fight over:

minG maxD  𝔼x∼data[log D(x)] + 𝔼z∼noise[log(1 − D(G(z)))]

Read it as a tug of war. D wants to maximize this: push D(x) toward 1 for real data and D(G(z)) toward 0 for fakes. G wants to minimize it: make D(G(z)) close to 1 so the fakes are believed. The theoretical sweet spot — the equilibrium — is when G's samples perfectly match the real data distribution and D is reduced to a coin flip, outputting 0.5 everywhere because it genuinely can't tell.

This isn't just intuition — it's a closed form. For any fixed generator, the best possible discriminator is exactly the likelihood ratio, and plugging it back in pins down the game's value at its lowest point when the two distributions coincide:

−log 4 ≈ −1.386 is the number a perfectly-fooled game settles on — you can compute it below.

Worth knowing

In practice, the log(1 − D(G(z))) term gives the generator weak gradients early on when its fakes are obvious. A common fix is the "non-saturating" trick: train G to maximize log D(G(z)) instead — same intent, stronger learning signal.

05

Training the duel

Training alternates. Freeze G and update D: show it a batch of real samples and a batch of G's fakes, and improve its ability to tell them apart. Then freeze D and update G: generate fakes, run them through D, and nudge G's weights so D is more fooled. Repeat, back and forth, for many rounds.

The elegant part is where G's gradient comes from: it flows through the discriminator. G never sees a real image directly or gets told "make this pixel darker." It only receives the signal "D would find this more convincing if you changed in this direction." Realism is taught entirely by an adversary — a genuinely new kind of training signal.

06

Where the duel goes wrong

Because two networks optimize in opposition, GAN training is a balancing act, not a smooth descent. If D gets too good too fast, it rejects everything and G's gradients vanish; if G finds a cheap exploit, D can't keep up. Training can oscillate forever instead of converging.

The signature failure is mode collapse: G discovers one (or a few) outputs that reliably fool D and produces only those — one flawless face, endlessly — ignoring the rest of the data's diversity. It "wins" the game while failing the actual goal. Taming these pathologies spawned a whole research industry (DCGAN, WGAN, spectral normalization, and more).

07

The limits

Beyond instability and mode collapse, vanilla GANs offer no clean number to track — there's no single loss that reliably says "getting better," which makes them hard to monitor and tune. And there's no built-in likelihood, so you can't ask a GAN how probable a given real image is under its model.

For high-fidelity image generation, diffusion models ultimately overtook GANs: they train with a stable regression loss, don't collapse, and cover the data distribution more faithfully — at the cost of slow, multi-step sampling. GANs' single-pass speed keeps them relevant where latency matters, but they are no longer the default for state-of-the-art quality.

08

Why it still matters

GANs proved machines could generate, convincingly, and they defined the modern generative era's ambitions — photorealistic faces (StyleGAN), image-to-image translation (pix2pix, CycleGAN), super-resolution, and the whole cultural moment of "deepfakes." For years, GAN was almost synonymous with AI image generation.

Their deepest contribution is conceptual: adversarial training. The idea that you can learn by pitting networks against each other — one proposing, one critiquing — echoes far beyond images, into robustness research, domain adaptation, and the reward-model critics of RLHF. GANs may have been overtaken for image quality, but adversarial thinking is now part of the field's DNA.

Read next

Contrast with DDPM, the diffusion model that dethroned GANs for image quality by trading the adversarial game for stable, iterative denoising.

Since then

What the authors admit, and what happened next

The instability is intrinsic and acknowledged. The training target is a saddle point of a two-player game, not the minimum of a function — so there is no loss curve that reliably goes down and no reliable signal that training is progressing or finished. Practitioners learned to judge by looking at samples, which is a real statement about the state of the art.

Mode collapse is the second failure and it follows from the objective rather than from a bug: fooling the discriminator does not require covering the data distribution, so a generator that finds one convincing output and produces variations of it is doing well by its own loss while ignoring most of the data. And because no likelihood is computed, there is no principled way to evaluate the result — the metrics the field settled on are proxies with known pathologies, which made progress hard to measure.

How it held up: it lost the main event. Rung 4 matched and exceeded it on quality while training stably and covering the distribution, and the family stopped being the default. What survived is the adversarial loss as a component: it is still the best available tool for "make this look real rather than plausible on average", which is why it appears inside the decoder of the autoencoder at rung 7 and in super-resolution. The idea of a learned loss outlived the architecture that introduced it.

SOLVE IT YOURSELF

Find the equilibrium — and catch mode collapse

The minimax game has a closed-form answer, and you can compute it over a tiny 4-mode "image" distribution. This builds the optimal discriminator D* for three generators — a bad one, the perfect one, and a mode-collapsed one — and evaluates the game. Watch the matched generator drive D* to 0.5 everywhere and the value to exactly −log 4 (the theorem), while the collapsed generator gets caught red-handed: D* = 1 on every mode it abandoned. Change the distributions and re-run.

YOUR TASK

Write the body of value. Everything else in the file is already written; this is the function the paper is about. Press ▶ Run to check it against the 5 assertions below — they start red.

WHAT IT HAS TO SATISFY — 5 ASSERTIONS
  1. The optimal discriminator is the data likelihood ratio
  2. A perfect generator makes D a coin flip everywhere
  3. The equilibrium value equals -log 4
  4. A matched generator gives the discriminator its worst (lowest) value
  5. Mode collapse is caught: D* = 1 on an abandoned mode
CPython · WebAssembly
Check yourself

5 questions on this paper

Answer each one out loud before you open it. Recalling an answer is what makes it stick; recognising one you have just read is not. Your score is kept on this device.

What is a GAN?

Show answer

A GAN (Generative Adversarial Network, Goodfellow et al., 2014) is a generative model made of two neural networks trained against each other: a generator that creates fake data from random noise, and a discriminator that tries to tell real data from the generator's fakes. As they compete, the generator learns to produce increasingly realistic samples.

How does GAN training work?

Show answer

Training alternates between the two networks. The discriminator is shown real and fake examples and learns to classify them correctly. The generator is then updated to fool the discriminator — to make fakes the discriminator labels as real. This back-and-forth is a minimax game: the generator minimizes what the discriminator maximizes, and at the ideal equilibrium the fakes are indistinguishable from real data.

What is mode collapse?

Show answer

Mode collapse is a common GAN failure where the generator produces only a few types of output — for example, one convincing face over and over — instead of the full diversity of the training data. It happens because the generator can win the game by fooling the discriminator with a narrow set of very realistic samples, ignoring the rest of the distribution.

Why are GANs hard to train?

Show answer

GANs optimize two networks in opposition, so training is a delicate balancing act rather than simple loss minimization. If one network overpowers the other — a discriminator that is too good, or a generator that collapses — learning stalls or oscillates. This instability, plus mode collapse and no single clean loss to watch, makes GANs notoriously finicky compared to models trained with a straightforward objective.

How do GANs compare to diffusion models?

Show answer

GANs generate an image in a single fast forward pass but train through an unstable adversarial game and can suffer mode collapse. Diffusion models (like DDPM) generate gradually over many denoising steps with a stable regression loss, giving more diverse, high-fidelity samples. For high-quality image generation, diffusion has largely superseded GANs, though GANs remain useful where fast, single-pass generation matters.

Where this sits

Generating pixels

Ten papers from the first latent-variable generator to video and real-time 3D. The diffusion half is strictly cumulative — each rung removes a cost the last one paid.

  1. 1VAE2014
  2. 2GANs2014
  3. 3VQ-VAE2017
  4. 4DDPM2020
  5. 5DDIM2021
  6. 6Classifier-Free Guidance2021
  7. 7Latent Diffusion2022
  8. 8Sora2024
  9. 9NeRF2020
  10. 103D Gaussian Splatting2023

All 110 papers, in 19 ladders →

Finished this one? 0 / 110 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns