# NIPS 2016 Tutorial: Generative Adversarial Networks

Generative adversarial networks train a generator against a discriminator

Ian Goodfellow · arXiv · 2016-12-31

- **Problem** Markov chain samplers draw samples by repeating a transition step, so they converge slowly and scale poorly to high-dimensional data.
- **Method** GANs pit a generator against a discriminator instead of modelling a density. The generator makes samples in one step, and the discriminator learns to tell them from real ones.
- **Results** Feature matching GANs reached state-of-the-art semi-supervised results on MNIST, SVHN and CIFAR-10 with few labels.

## Why sampling from generative models is hard

Generative models learn a representation of a distribution from training examples, and GANs focus mainly on producing samples. Some models do this with Markov chains, which draw samples by repeatedly applying a transition operator. Convergence can be very slow, and nobody has a clear test for whether a chain has converged. In high-dimensional spaces the chains become less efficient, and Boltzmann machines have not scaled to ImageNet-style problems.

Each extra sampling step adds computational cost, which is the reason GANs were designed to avoid chains.

Variational models face a different trade-off: they often reach very good likelihood while their samples are regarded as lower quality. The authors call that quality judgement a subjective opinion, because no good quantitative measure of sample quality exists. This leaves room for a model that generates in a single step, with no chain and no variational bound.

## A generator and a discriminator play a game

The key idea is to skip an explicit density and train a generator that is judged by a discriminator. The generator plays the counterfeiter and the discriminator plays the police, so the generator must make samples the discriminator can't tell from real ones. Both players are differentiable functions, and each updates only its own parameters.

The discriminator D reads x and uses parameters θ(D), while the generator G reads a latent z and uses parameters θ(G). Because each player's cost depends on the other's parameters, the setup is a game, not a single optimization problem. The solution is a Nash equilibrium, a point where each player's cost is at a local minimum with respect to its own parameters.

The discriminator minimizes a standard cross-entropy cost on real and generated minibatches. \\\[ J^{(D)} = -\\tfrac{1}{2}\\,\\mathbb{E}\_{x\\sim p\_{data}}\\log D(x) - \\tfrac{1}{2}\\,\\mathbb{E}\_{z}\\log\\bigl(1-D(G(z))\\bigr) \\\] Real examples carry label 1 and generated examples carry label 0, so the classifier learns to split the two.

Training the discriminator this way gives an estimate of the ratio p\_data(x)/p\_model(x) at every point x. This ratio estimate is what sets GANs apart from variational autoencoders and Boltzmann machines. The authors note that supervised estimation brings its own failures, overfitting and underfitting, which perfect optimization and enough data could in principle overcome.

## Training schedule, cost choice and the DCGAN architecture

Each training step draws a minibatch of real x values and a minibatch of latent z values from the prior. Both players then take one gradient step at the same time, with Adam as a usual choice of optimizer. The tutorial's author recommends one step per player, which the author found works best in practice as of late 2016.

The simplest variant is zero-sum, so the generator's cost is the negative of the discriminator's cost. That minimax form is mainly useful for theory, since it can be linked to minimizing the Jensen-Shannon divergence. In practice the players are deep networks updated in parameter space, so those convexity-based results don't carry over.

The generator's cost in the minimax form saturates when the discriminator rejects samples with high confidence. So the generator's gradient vanishes exactly when it most needs a signal. The heuristic fix trains the generator to maximize log D(G(z)) instead, which gives much stronger gradients early in learning.

DCGAN uses batch normalization in most layers, but leaves the generator's last layer and the discriminator's first layer unnormalized. The network has no pooling layers, and the generator raises spatial resolution with transposed convolutions that use a stride above 1.

## What the reported results show

DCGAN produced high-resolution images in one pass, where earlier LAPGANs built them over several stages. The paper shows bedroom images generated by a DCGAN trained on the LSUN dataset. These samples show that the model can produce detailed images, but the evidence covers one restricted image domain.

Minibatch features let the discriminator compare an example against minibatches of generated and real samples. Minibatch GANs trained with labels on CIFAR-10 produce samples that are mostly recognizable as specific classes. The same kind of model trained on 128 × 128 ImageNet gives few images recognizable as a specific class. Counting, perspective and global structure then become the most visible defects.

Feature matching GANs turn an n-class classifier into an (n+1)-class discriminator, with the extra class for fake images. The state of the art on MNIST, SVHN and CIFAR-10 is held by feature matching GANs, which reached it across label counts from 20 to 8,000. Those datasets are usually trained with 50,000 or more labels, so the result concerns the few-label regime.

## Mode collapse and unrolled GANs

The authors single out mode collapse as the issue researchers should try hardest to fix. Minibatch features are one attempt, and their performance depends heavily on small implementation details.

Unrolled GANs build a graph of k discriminator learning steps and backpropagate through all of them when computing the generator gradient. Metz et al. found that unrolling for about 10 or fewer steps noticeably reduces the mode dropping problem.

## Limitations

Training a GAN means finding a Nash equilibrium of a game, which is a harder problem than optimizing an objective function. The conclusion names high-dimensional, continuous, non-convex games as the setting where better theory and algorithms are needed.

The generator must be differentiable, so it can't directly produce discrete data such as one-hot words or characters. The authors list three routes: REINFORCE, a concrete or Gumbel-softmax distribution, and sampling continuous values that are decoded to discrete ones.

Models with good likelihood can produce bad samples, and models with good samples can have poor likelihood. GANs are harder to evaluate still, because their likelihood is difficult to estimate. The tutorial is not a comprehensive review, and many papers were left out for relevance and time.

## Paper info

- **Authors**: Ian Goodfellow
- **Venue**: arXiv · Preprint
- **First published**: 2016-12-31
- **Added**: 2026-11-12
- **Updated**: 2017-4-3
- **Version**: v4
- **arXiv**: 1701.00160
- **Category**: cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1701.00160v4) · [PDF ↗](https://arxiv.org/pdf/1701.00160v4)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Ian Goodfellow (2016). NIPS 2016 Tutorial: Generative Adversarial Networks. arXiv:1701.00160v4. https://arxiv.org/abs/1701.00160v4

**BibTeX**

```
@misc{goodfellow2016nips,
  title = {{NIPS 2016 Tutorial: Generative Adversarial Networks}},
  author = {Ian Goodfellow},
  year = {2016},
  eprint = {1701.00160},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1701.00160v4}
}
```

## Other paper commentary

- [Person Transfer GAN to Bridge Domain Gap for Person Re-Identification](https://refivu.com/en/papers/68ab1f6a-e5fc-4ab0-aa97-7c531e651f1d-person-transfer-gan-to-bridge-domain-gap-for.md)
- [Feature Squeezing: Detecting Adversarial Examples in Deep Neural Networks](https://refivu.com/en/papers/12afca27-3173-4d16-a76b-cb72a4fa0438-feature-squeezing-detecting-adversarial-examples-in-deep.md)
- [Towards Principled Methods for Training Generative Adversarial Networks](https://refivu.com/en/papers/b0f4dfa6-159a-4785-ba9c-7a882bcab62f-towards-principled-methods-for-training-generative.md)
- [Diffusion Models: A Comprehensive Survey of Methods and Applications](https://refivu.com/en/papers/88553d75-09f1-48d0-a32d-bbb93fe0b6e8-diffusion-models-a-comprehensive-survey-of-methods-and.md)
- [DreamFusion: Text-to-3D using 2D Diffusion](https://refivu.com/en/papers/8748788c-c1b0-47b9-a624-78c1f27630e6-dreamfusion-text-to-3d-using-2d-diffusion.md)
- [Obfuscated Gradients Give a False Sense of Security: Circumventing Defenses to Adversarial Examples](https://refivu.com/en/papers/6d5ee375-978f-4c78-87e2-0c8e55a1127f-obfuscated-gradients-give-a-false-sense-of-security.md)
- [PaLM 2 Technical Report](https://refivu.com/en/papers/9930c339-e7c2-4330-9ea3-867aad7f3368-palm-2-technical-report.md)
- [Structure-measure: A New Way to Evaluate Foreground Maps](https://refivu.com/en/papers/66f23442-e0d8-4496-ab4e-14cc3ce84c90-structure-measure-a-new-way-to-evaluate-foreground.md)
- [Deep Learning for Anomaly Detection: A Survey](https://refivu.com/en/papers/f19cac5f-c77b-441b-b92c-d53cb0d82935-deep-learning-for-anomaly-detection-a-survey.md)
- [Deep Learning Based Text Classification: A Comprehensive Review](https://refivu.com/en/papers/f32bf8ee-1bca-48a8-92cd-28ac97a169bd-deep-learning-based-text-classification-a-comprehensive.md)
- [Person Re-identification by Local Maximal Occurrence Representation and Metric Learning](https://refivu.com/en/papers/ce1c4e84-0a27-40a3-8d69-3dc923b2cf52-person-re-identification-by-local-maximal-occurrence.md)
- [Active Learning with Statistical Models](https://refivu.com/en/papers/7d04ea81-8e24-4074-8953-6e8f7fe61d84-active-learning-with-statistical-models.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [CIFAR-10](https://refivu.com/en/terms/19035a518d0a-cifar-10)
- [generator](https://refivu.com/en/terms/2935313c9c21-generator)
- [semi-supervised learning](https://refivu.com/en/terms/437382161673-semi-supervised-learning)
- [discriminator](https://refivu.com/en/terms/4e47ae7741de-discriminator)
- [DCGAN](https://refivu.com/en/terms/b3ba26ae70f0-dcgan)
- [mode collapse](https://refivu.com/en/terms/e27d78160694-mode-collapse)
- [Jensen-Shannon divergence](https://refivu.com/en/terms/408b4685369b-jensen-shannon-divergence)
- [GANs](https://refivu.com/en/terms/f248eedc996b-gans)
- [Markov chain](https://refivu.com/en/terms/d4f97a999643-markov-chain)
- [Nash equilibrium](https://refivu.com/en/terms/4b0748e657e3-nash-equilibrium)
- [variational autoencoders](https://refivu.com/en/terms/4e570b65e841-variational-autoencoders)
- [minimax game](https://refivu.com/en/terms/1025986eafbd-minimax-game)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/3bddac01-a39c-4985-8cda-7d40f3279d07-nips-2016-tutorial-generative-adversarial-networks)
