Improved Training of Wasserstein GANs (WGAN-GP)

WGAN-GP banner Kaggle

  • Paper: Improved Training of Wasserstein GANs
  • Authors: Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, Aaron Courville
  • Lab, year: MILA (University of Montreal) and NYU’s Courant Institute, 2017 (NIPS 2017, now NeurIPS)
  • Video: YouTube Short coming on 6 Dec 2026 on Backprop Daily

Summary

A GAN trains two networks against each other: a generator that makes fake samples and a critic that tells real from fake. The Wasserstein GAN (WGAN) made this game easier to train, but its theory needs the critic to be 1-Lipschitz (its output may not change faster than its input). WGAN enforced this by clipping every critic weight into a small range such as [-0.01, 0.01] (Section 2).

This paper shows that weight clipping causes problems: the critic learns overly simple functions, and its gradients can explode or vanish unless the clipping range is tuned carefully (Section 3). It replaces clipping with a gradient penalty: a loss term that pushes the norm of the critic’s gradient towards 1 at points between real and generated samples (Section 4).

With this change, WGAN-GP trained many GAN architectures with one set of default settings, including a 101-layer ResNet, and reached a then state-of-the-art unsupervised Inception score of 7.86 on CIFAR-10 (Sections 5.2 and 5.4).

What Problem Does It Solve

Picture a referee who scores how real a painting looks. To keep the scores fair, an old rule tied the referee’s hands so tightly that they could only give very crude scores. The painter got little useful advice and often stopped improving.

The gradient penalty replaces the rope with a gentle rule: “your score may not jump too fast as the painting changes”, checked on paintings halfway between real and fake ones. The referee can now give detailed feedback, and many more painter designs learn well.

Core Idea

  • Problems with clipping: critics trained with weight clipping ignore the finer structure of the data and model very simple functions (Section 3.1, Figure 1a). Their gradients grow or shrink exponentially through deep networks unless the clipping value is just right (Section 3.2, Figure 1b), and the weights pile up at the two ends of the clipping range (Figure 1b).
  • Why a gradient penalty: a differentiable function is 1-Lipschitz exactly when its gradient norm is at most 1 everywhere, so the paper penalises the critic’s gradient norm directly (Section 4).
  • The loss: critic loss = D(fake) − D(real) + λ · (‖∇D(x̂)‖₂ − 1)², with λ = 10 (Section 4, Eq. 3).
  • Where to check: x̂ is a random point on the straight line between a real and a generated sample, because the optimal critic has gradient norm 1 along such lines (Section 4, Proposition 1).

Key Method Details

  • Default settings (Algorithm 1): λ = 10, 5 critic steps per generator step, Adam with learning rate 1e-4, β1 = 0, β2 = 0.9.
  • No batch normalization in the critic: the penalty is per sample, and batch norm mixes samples in a batch. The paper recommends layer normalization instead (Section 4).
  • Two-sided penalty: the gradient norm is pushed towards 1, not just kept below 1. In 174 random architectures, the two-sided penalty gave the higher Inception score 100 times and the one-sided penalty 77 times; the paper notes this is not statistically significant (Appendix C).
  • Training many architectures: of 200 random architectures trained on 32×32 ImageNet, at an Inception-score threshold of 3.0, 88 trained only with WGAN-GP and 1 only with the standard GAN (Section 5.1, Table 2).
  • Against clipping: on CIFAR-10, WGAN-GP converged faster and to a better Inception score than weight clipping (Section 5.3, Figure 3).
  • Results: Inception score 7.86 unsupervised and 8.42 with labels on CIFAR-10 (Table 3); 128×128 LSUN bedroom samples from a deep ResNet (Section 5.4); a character-level language model with a continuous generator (Section 5.5).
  • Meaningful loss: the critic’s loss still tracks training progress, and it can show when the critic overfits (Section 5.6).

Simplifications in This Notebook

  • Toy data: a 2D ring of 8 Gaussians (radius 2, standard deviation 0.02) instead of images.
  • Tiny networks: generator and critic are MLPs with two hidden layers of 128 units, the same for both methods. The generator’s output layer is linear.
  • Short training: 3,000 generator iterations, batch size 256, one seed. WGAN-GP uses the paper’s defaults; the clipped WGAN uses RMSProp with learning rate 5e-5 and clipping at 0.01.
  • No image metric: instead of the Inception score, the notebook counts generated samples within 0.5 of each mode’s center.

What the Notebook Result Shows

  • Critic, as in the paper: the WGAN-GP critic’s gradient norm at the interpolated points ended at 0.9650 (target 1, penalty 0.3865), and its weights spread over [-0.9845, 1.0440]. The clipped critic had 45.6% of its weights at the ±0.01 limit, and its gradient norm over the 2D grid averaged only 0.0005.
  • Flat clipped-WGAN loss: its Wasserstein estimate stayed between -0.0012 and -0.0000 all run (final -0.0001), so its loss curve tells you almost nothing.
  • Samples, not as in the paper: both generators reached all 8 modes, but the clipped WGAN put 60.7% of its samples near a mode (rising steadily to 61% at iteration 3000), while WGAN-GP put only 21.9% there and swung between 6% and 26% during training. In this run, WGAN-GP did not produce better samples than weight clipping.

Influence

OpenAlex lists about 12,700 citations (12,712 when checked on 3 December 2026). The authors released their code at igul222/improved_wgan_training (Section 1 footnote).


Resources

File Description
README.md This overview — a 5-minute read covering the paper’s summary, core idea, key method details, influence, and a plain-English explanation of the problem it solves
solution.ipynb From-scratch PyTorch gradient penalty, compared with weight-clipping WGAN on a 2D ring of 8 Gaussians
CODE_ARCHITECTURE.md Section-by-section breakdown of the notebook — what each cell does, data flow, tensor shapes, and key design decisions
TALK.md Press coverage, Q&A (answers from the paper), citations, and common misconceptions about the paper

Table of contents