On the Effectiveness of Least Squares Generative Adversarial Networks

Xudong Mao, Qing Li, Haoran Xie, Raymond Y. K. Lau, Zhen Wang, Stephen Paul Smolley

TL;DR

LSGANs (Least Squares Generative Adversarial Networks) replace the standard sigmoid cross-entropy loss with a least squares objective function. This simple change effectively minimizes the Pearson $\chi^2$ divergence, providing smoother gradients that pull fake samples toward the real data manifold, resulting in higher-quality images and significantly more stable training.

What Problem Does This Paper Address?

Generative Adversarial Networks (GANs) are powerful but notoriously difficult to train. The original GAN formulation uses a sigmoid cross-entropy loss for the discriminator. The authors identify a fundamental flaw in this approach: vanishing gradients.

When a generator produces a "fake" sample that the discriminator successfully classifies as "real" (even if it's still far from the actual data distribution), the sigmoid loss function saturates. As shown in the figure below, the gradient for these samples becomes nearly zero, meaning the generator receives no signal to improve them further. This leads to poor image quality and the dreaded "mode collapse," where the generator only produces a limited variety of outputs.

Comparison of decision boundaries: Sigmoid (b) vs. Least Squares (c). The least squares loss continues to penalize samples far from the boundary, providing a gradient to pull them closer to real data.

Methods

The core innovation is the Least Squares loss. Instead of asking the discriminator to classify samples as 0 or 1, LSGANs ask it to perform a regression-like task.

  • Discriminator Objective: Minimize the squared difference between the discriminator's output and target labels ($b$ for real data, $a$ for fake data).
  • Generator Objective: Minimize the squared difference between the discriminator's output for fake data and a target value $c$ (the value the generator wants the discriminator to believe).

The authors prove that by setting specific values for these parameters (e.g., $a=-1, b=1, c=0$), the LSGAN objective becomes equivalent to minimizing the Pearson $\chi^2$ divergence between the real and generated data distributions. This is a departure from standard GANs, which minimize the Jensen-Shannon divergence.

Datasets

The authors evaluated LSGANs on a wide variety of standard and custom benchmarks:

  • Standard Vision Datasets: LSUN (bedroom and various scenes), ImageNet, CIFAR-10, and MNIST.
  • Cat Dataset: A specific dataset for high-resolution cat face generation.
  • Synthetic Datasets: A 2D mixture of eight Gaussians to test mode collapse.
  • New Benchmarks: Two synthetic digit datasets with "small variability" (rendered using standard fonts with minimal shifts/rotations). These were designed to be "difficult" because a discriminator can easily distinguish real from fake, leading to faster saturation in regular GANs.

Key Insights and Ideas

  • Distance Matters: Unlike sigmoid cross-entropy, which only cares about which side of the decision boundary a sample falls on, the least squares loss penalizes samples based on their distance from the boundary. This forces the generator to move samples toward the real data manifold even if they are already "correctly" classified as real by a weak discriminator.
  • Pearson $\chi^2$ Divergence: The theoretical link to Pearson $\chi^2$ divergence is crucial. This divergence does not have the "zero-forcing" property of the KL divergence used in other models, making LSGANs less prone to mode collapse.
  • Stability without Complexity: LSGANs achieve stability comparable to more complex methods like WGAN-GP (Wasserstein GAN with Gradient Penalty) but with much lower computational overhead.

Key Results

  • Superior Image Quality: Qualitative results show that LSGANs produce sharper images with finer details (like hair textures in cats) compared to standard non-saturating GANs (NS-GANs).
LSGANs (c) generate sharper bedroom images with more exquisite textures compared to NS-GANs (b).
  • Quantitative Gains: Using the Fréchet Inception Distance (FID), LSGANs outperformed NS-GANs across all tested datasets and beat WGAN-GP on three out of four datasets.
  • Training Speed: On the LSUN-bedroom dataset, LSGANs reached an optimal FID score in about 1,100 minutes, whereas WGAN-GP required 4,600 minutes to reach a similar level of quality.
  • Robustness: In a stability test on Gaussian mixtures, LSGANs successfully learned all modes in 95 out of 100 runs, while regular GANs failed (collapsed) 99 times out of 100.

Limitations and Future Work

While LSGANs significantly improve stability, the authors note that the generator is still being pulled toward a decision boundary rather than directly toward the real data manifold. They suggest that future research could explore methods to pull generated samples toward the real data points more directly. Additionally, while LSGANs are more stable, they aren't bulletproof; the authors still recommend manually monitoring image quality during training and saving checkpoints frequently.

Summary updated

BibTeX
@article{mao2017effectiveness,
  author = {Xudong Mao and Qing Li and Haoran Xie and Raymond Y. K. Lau and Zhen Wang and Stephen Paul Smolley},
  title = {{On the Effectiveness of Least Squares Generative Adversarial Networks}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2017},
  doi = {10.1109/tpami.2018.2872043},
}
Figure