Paper commentary
Improved Training of Wasserstein GANs
Gradient penalty stabilizes Wasserstein GAN training
- Problem Weight clipping in WGAN limits the critic, so it learns overly simple functions and its gradients explode or vanish. Clipping sets a threshold that must be tuned carefully, and deep critics often still fail to converge.
- Method WGAN-GP keeps the critic's architecture and adds a penalty on its gradient norm instead of clipping weights. The penalty is evaluated on random points between real and generated samples.
- Results At threshold 5.0, 147 of 200 random architectures trained with WGAN-GP alone, while the standard GAN succeeded on none.
Where weight clipping gets stuck
WGAN was built to make GAN training more reliable by swapping the standard value function for one based on the Wasserstein distance. That value function only behaves well when the critic is 1-Lipschitz, and the original authors enforce this by clipping every critic weight into a compact interval. Clipping is blunt, though: the clipped set is only a subset of the k-Lipschitz functions, and the value of k depends on the clipping constant and the architecture.
Other constraints fail in similar ways, since L2 norm clipping, weight normalization and weight decay showed similar problems in the authors' trials.
The first symptom is capacity underuse. The authors trained clipped critics to optimality on toy distributions, holding the generator at the real data plus unit-variance Gaussian noise. The optimal critic should have unit gradient norm almost everywhere, yet the clipped networks, which try to reach their maximum gradient norm, end up learning very simple functions.
As a result, the critic ignores higher moments of the data and settles for crude approximations of the optimal function.
The second symptom is exploding or vanishing gradients, which come from the interaction between the weight constraint and the cost function. On Swiss Roll, the authors used 12-layer ReLU MLPs for both generator and critic, without batch normalization, and varied the clipping threshold over 10−1, 10−2 and 10−3. For each threshold the gradient norm grew or decayed exponentially as the layers moved back, so a good threshold has to be tuned carefully.
Batch normalization softens these effects, but very deep WGAN critics still often failed to converge even with it.
The gradient penalty idea
The key idea is to stop limiting the weights and limit the critic's slope instead. A differentiable function is 1-Lipschitz exactly when its gradients have norm at most 1 everywhere, so the authors penalize the gradient norm of the critic output with respect to its input. Checking that condition everywhere is intractable, so the constraint becomes a soft penalty evaluated on random samples.
The penalty is added to the original critic loss, so the critic architecture itself doesn't change.
The sampling distribution is where the choice of points matters most. The authors sample points uniformly along straight lines between a real sample and a generated sample. This choice rests on the optimal critic, which has straight lines of gradient norm 1 joining coupled real and generated points. Enforcing unit norm along those lines, rather than everywhere, seemed enough in their experiments.
Formally, the critic minimizes the following loss, where the first two terms are the original WGAN critic loss and the last term is the penalty. \[ L = \mathbb{E}_{\tilde{x}\sim P_g}[D(\tilde{x})] - \mathbb{E}_{x\sim P_r}[D(x)] + \lambda\,\mathbb{E}_{\hat{x}\sim P_{\hat{x}}}\big[(\|\nabla_{\hat{x}} D(\hat{x})\|_2 - 1)^2\big] \] The penalty is zero when the gradient norm at each sampled point is exactly 1, and it grows with the squared gap from 1.
The authors use λ = 10 in all experiments, which they found to work across architectures from toy tasks to large ImageNet CNNs.
One critic and generator update
Each critic step starts with a batch of real samples and a batch of latent noise passed through the generator. For each example, the code draws a number ε from U[0,1] and forms x̂ as ε times the real sample plus (1 − ε) times the generated sample. The per-example loss is the critic score of the generated sample minus that of the real sample, plus λ times the squared gap between the gradient norm at x̂ and 1.
The critic parameters are then updated with Adam on the batch average.
The critic is updated ncritic times for each generator update, and the algorithm's default is ncritic = 5. The defaults also set λ = 10 and α = 0.0001 for Adam. The generator then takes one Adam step that raises the critic's score on generated samples.
Batch normalization has to go from the critic, because the penalty is computed for each input separately while batch normalization mixes a whole batch. The authors recommend layer normalization instead, since it normalizes within each example. In the LSUN experiments, the critic's batch normalization was replaced with layer normalization.
The penalty is two-sided, pulling the gradient norm towards 1 from both sides rather than only capping it at 1. The authors found this slightly better in early observations, but they didn't investigate it fully.
Toy checks on capacity and gradients
The capacity check trains critics to optimality on toy data, with the generator fixed at real data plus Gaussian noise. So the clipping constraint, rather than the critic's architecture, appears to cap what the critic learns.
The gradient check uses Swiss Roll with 12-layer ReLU MLPs and no batch normalization. With clipping, the gradient norm grew or decayed exponentially for each of the three thresholds, whereas the authors found their method gives more stable gradients that neither vanish nor explode. This matters because stable gradients allow training of more complicated networks, which the next sections test.
The toy checks therefore show the two failure modes, and the later experiments test whether training improves in practice.
Training 200 random architectures
The authors start from DCGAN and change nonlinearity, depth, batch normalization and filter count to random values from a fixed set. They sampled 200 architectures and trained each on 32×32 ImageNet with both WGAN-GP and the standard GAN objective. A run counts as a success when its Inception score is above a chosen minimum score.
At minimum score 5.0, 147 architectures trained only with WGAN-GP, and 42 succeeded under both methods. The standard GAN alone succeeded on none of them at that threshold, so the gap runs in one direction. The gap depends on the threshold: at 7.0, WGAN-GP alone succeeded on 104 architectures, and at 9.0 every architecture failed under both methods.
For reference, the standard DCGAN scored 7.24. The set is designed to show where the method works, so these success counts describe that set and not the whole space of useful architectures.
Six architectures on LSUN bedrooms
Beyond the DCGAN baseline, the authors chose six architectures to test, among them a model with no normalization and a 101-layer ResNet generator and discriminator. Each architecture was trained with four GAN methods: WGAN-GP, WGAN with weight clipping, DCGAN and Least-Squares GAN.
Every model ran for 200K iterations, with each method's recommended optimizer settings, except LSGAN, where learning rates were searched. Only WGAN-GP succeeded with one shared set of hyperparameters across all these architectures. For the other methods, some architectures were unstable or suffered mode collapse.
Speed and sample quality on CIFAR-10
To check speed, the authors trained WGAN with clipping and WGAN-GP on CIFAR-10 and tracked Inception score over training. One WGAN-GP run used RMSProp, the same optimizer and learning rate as the clipped WGAN, so the optimizer was held fixed for that comparison. With the same optimizer, WGAN-GP converged faster and to a better score than clipping.
Switching to Adam improved the score further.
Compared with DCGAN, the penalty converged more slowly in wall-clock time, but the authors say its score was more stable at convergence. The authors say that for equivalent architectures the method matches the standard GAN objective, and the added stability lets them search a wider set of architectures. That search produced a WGAN-GP ResNet with an unsupervised CIFAR-10 Inception score of 7.86±.07, which the authors describe as a new state of the art.
With labels, the same architecture scored 8.42±.10, and it outperformed every other published model except SGAN, which scored 8.59±.12.
A character-level GAN with a continuous generator
Discrete text is hard for GANs, because the generator must produce one-hot vectors, a set that sits inside a continuous simplex. The KL divergences between discrete and continuous distributions are infinite, so the JS divergence saturates and a discriminator can reject every sample off the one-hot vectors. The authors argue that WGAN still works here, since its Wasserstein distance stays well defined and continuous on the simplex.
The generator is a 1D CNN that maps a latent vector to 32 one-hot character vectors through convolutions. It applies a softmax at the output and uses no sampling step, so the critic receives the softmax outputs directly. When decoding, the authors take the argmax of each output vector.
The samples, truncated to 32 characters, show frequent spelling errors. The authors attribute the errors to each character being output independently, yet the samples still pick up much of the statistics of language.
Critic loss as a quality signal and overfitting check
On LSUN bedrooms, the negative critic loss converges as the generator reduces the Wasserstein distance.
To test overfitting, the authors trained large unregularized WGANs on a random 1000-image MNIST subset. For both WGAN and WGAN-GP, the training and validation losses diverge, which suggests the critic overfits and gives an inaccurate estimate. In WGAN-GP, the training loss keeps rising while the validation loss drops. This check measures overfitting in the critic against the loss the network minimizes, while an earlier check estimated the generator's log-likelihood.
Limitations
The architecture set was chosen to show where the method works, so it isn't an unbiased sample of useful architectures. Whether the penalty works for language beyond a toy model remains unclear, according to the authors. Adapting the penalty to the standard GAN objective is left as future work.
The two-sided penalty was chosen from early observations, and the one-sided version was not investigated fully. The method needs normalization that doesn't mix examples, so batch normalization is removed from the critic.
Paper info
- Authors
- Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, Aaron Courville
- Venue
- arXiv · Preprint
- First published
- 2017-3-31
- Added
- 2026-11-6
- Updated
- 2017-12-25
- Version
- v3
- arXiv
- 1704.00028
- Category
- cs.LG · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
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
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, Aaron Courville (2017). Improved Training of Wasserstein GANs. arXiv:1704.00028v3. https://arxiv.org/abs/1704.00028v3
BibTeX
@misc{gulrajani2017improved,
title = {{Improved Training of Wasserstein GANs}},
author = {Ishaan Gulrajani and Faruk Ahmed and Martin Arjovsky and Vincent Dumoulin and Aaron Courville},
year = {2017},
eprint = {1704.00028},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1704.00028v3}
}