# Least Squares Generative Adversarial Networks

Least squares loss stabilizes GAN training and yields higher quality images

Xudong Mao, Qing Li, Haoran Xie, Raymond Y. K. Lau, Zhen Wang, Stephen Paul Smolley · arXiv · 2016-11-13

- **Problem** Regular GANs use a sigmoid cross entropy loss in the discriminator. Once generated samples are classified as real, this loss gives almost no error, so the generator gets little signal to move them toward the real data.
- **Method** LSGANs swap the sigmoid loss for a least squares loss in the discriminator.
- **Results** On LSUN bedroom, LSGANs without batch normalization in G, trained with Adam, produced relatively good images in 5 of 10 runs. Regular GANs never learned successfully in that setting.

## Where the sigmoid loss stalls the generator

When the generator is trained to make the discriminator label these samples as real, the sigmoid loss returns almost no error, because the samples are already classified correctly. The generator therefore gets little signal to move them closer to the real data.

Figure 1 illustrates this with a one-dimensional toy setting. Panel (b) shows the sigmoid decision boundary, where fake samples for updating G yield very small errors, and panel (c) shows the least squares boundary, which penalizes the same samples and moves the generator's output toward the boundary.

## Least squares objective for the discriminator

The objectives use an a-b coding scheme, in which a is the label for fake data and b is the label for real data. The discriminator is trained with squared errors that push D(x) on real samples toward b and D(G(z)) on generated samples toward a, averaged over the real and fake distributions. The generator is trained to move D(G(z)) toward c, which the authors define as the value the generator wants the discriminator to believe for fake data.

Because the discriminator parameters are fixed during the generator update, the decision boundary stays put. The least squares term then pulls generated samples toward that boundary, and the authors argue that a boundary crossing the real data manifold pulls the generated samples toward the real data manifold.

## Connection to the Pearson χ2 divergence

The original GAN objective is known to minimize the Jensen-Shannon divergence. The authors extend the analysis to the least squares objective, using a generator loss in which both real and fake terms are pulled toward c. For a fixed G, the optimal discriminator is a weighted average of b and a, with weights given by the real density pd and the generator density pg.

Substituting it into the generator loss and collecting terms gives a single integral over the sum of the two densities, normalized by pd plus pg.

When b minus c equals 1 and b minus a equals 2, the expression reduces to the Pearson χ2 divergence between pd plus pg and 2pg. Minimizing the least squares objective therefore minimizes this divergence under those two conditions. The identity is conditional on those differences between a, b and c. It is not stated for other choices of these labels.

## Choosing the a, b and c labels

Two ways of setting a, b and c are given. One sets a to -1, b to 1 and c to 0. The other sets c equal to b, which means the generator aims for the same value as real data, and is paired with a 0-1 binary coding. The authors report similar performance for the two settings and select the 0-1 version, Equation 9, to train the models in the following sections.

The 0-1 setting has b minus c equal to 0, which does not satisfy the condition b minus c equals 1 required for the Pearson χ2 identity. The chosen setting is therefore justified by the experiments, not by that divergence argument.

## Two model architectures

Figure 3 lists the layers, with a 1024-dimensional z fed to a fully connected layer and BN after most convolutional layers. ReLU activations are used in the generator and LeakyReLU in the discriminator, following DCGANs.

For tasks with many classes, the authors observed that training an unconditional GAN on multiple classes did not produce readable characters, because multiple classes appear in the input but the output is a single class.

## Scene image results

The scene experiments use LSUN, with Bedroom, Church, Dining, Kitchen and Conference datasets. Bedroom has 3,033,042 samples and Church has 126,227, with one category each. Training uses a learning rate of 0.001 for scenes and 0.0002 for Chinese characters, with β1 set to 0.5 for the Adam optimizer following DCGANs.

On LSUN bedroom, the LSGAN images are compared with DCGAN and EBGAN samples in Figure 5. The authors judge the LSGAN images to be of better quality than the two baselines. Figure 6 shows LSGAN samples for church, dining room, kitchen and conference room scenes. The comparison is visual, and the text reports no quantitative image score for these scene results.

## Stability with and without batch normalization

Following Arjovsky et al., the authors remove batch normalization from the generator (BN G) or from both networks (BN GD) and train with Adam or RMSProp, on LSUN bedroom for both LSGANs and regular GANs. The four settings are BN G with Adam, BN G with RMSProp, BN GD with Adam and BN GD with RMSProp, and each is compared between the two loss functions.

For BN G with Adam, the authors ran 10 tests, and 5 of them produced relatively good images with LSGANs. Regular GANs never learned successfully in this setting and suffered from a severe degree of mode collapse. For BN GD with RMSProp, LSGANs produced higher quality images than regular GANs, which showed a slight degree of mode collapse.

BN G with RMSProp and BN GD with Adam gave similar results for both losses. The authors also conclude that RMSProp is more stable than Adam, because regular GANs learned the data distribution with BN G and RMSProp but failed with Adam.

A second test uses a 2D mixture of 8 Gaussians with a simple architecture of three fully connected layers in each network. Regular GANs collapse to a single valid mode starting at step 15k, while LSGANs learn the full Gaussian mixture.

## Handwritten Chinese characters

The conditional LSGAN is trained on HWDB1.0, a handwritten Chinese character dataset with 1,246,991 samples and 3740 classes. The authors report that the generated characters are readable.

## Limitations

The stability evidence for BN G with Adam is a set of 10 runs in one setting, and the Gaussian mixture test uses one simple architecture on a 2D dataset. The scene comparisons are visual, and the text does not give a quantitative score for them.

Experiments cover five LSUN scene datasets and HWDB1.0, and the authors name ImageNet as a future target. They also state that designing a method that pulls generated samples directly toward the real data is worth investigating.

## Paper info

- **Authors**: Xudong Mao, Qing Li, Haoran Xie, Raymond Y. K. Lau, Zhen Wang, Stephen Paul Smolley
- **Venue**: arXiv · Preprint
- **First published**: 2016-11-13
- **Added**: 2026-11-11
- **Updated**: 2017-4-5
- **Version**: v3
- **arXiv**: 1611.04076
- **Category**: cs.CV
- **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/1611.04076v3) · [PDF ↗](https://arxiv.org/pdf/1611.04076v3)

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

Xudong Mao, Qing Li, Haoran Xie, Raymond Y. K. Lau, Zhen Wang, Stephen Paul Smolley (2016). Least Squares Generative Adversarial Networks. arXiv:1611.04076v3. https://arxiv.org/abs/1611.04076v3

**BibTeX**

```
@misc{mao2016least,
  title = {{Least Squares Generative Adversarial Networks}},
  author = {Xudong Mao and Qing Li and Haoran Xie and Raymond Y. K. Lau and Zhen Wang and Stephen Paul Smolley},
  year = {2016},
  eprint = {1611.04076},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.04076v3}
}
```

## Other paper commentary

- [Progressive Growing of GANs for Improved Quality, Stability, and Variation](https://refivu.com/en/papers/8be12dd7-41d4-4ddd-8e8c-ec44b2d70443-progressive-growing-of-gans-for-improved-quality-stability.md)
- [Hierarchical Text-Conditional Image Generation with CLIP Latents](https://refivu.com/en/papers/a54e72c7-9aba-4f0a-b093-9f8704564243-hierarchical-text-conditional-image-generation-with-clip.md)
- [GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium](https://refivu.com/en/papers/e19fb2a4-2e7f-47ba-9ba7-ba5660b1efb6-gans-trained-by-a-two-time-scale-update.md)
- [Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network](https://refivu.com/en/papers/5a2dbd66-c794-464b-9d10-02f19eeb20e7-photo-realistic-single-image-super-resolution-using-a.md)
- [Explaining and Harnessing Adversarial Examples](https://refivu.com/en/papers/37bc09da-a299-4ed8-8384-7f87f7409fd4-explaining-and-harnessing-adversarial-examples.md)
- [Large Scale GAN Training for High Fidelity Natural Image Synthesis](https://refivu.com/en/papers/93f6ad29-8cca-4630-9a3b-d12f9ad91854-large-scale-gan-training-for-high-fidelity-natural.md)
- [Distance-IoU Loss: Faster and Better Learning for Bounding Box Regression](https://refivu.com/en/papers/d05dc1a3-dfd0-4eb2-bd4f-2b74602bcc42-distance-iou-loss-faster-and-better-learning-for.md)
- [Sampling-based Algorithms for Optimal Motion Planning](https://refivu.com/en/papers/2b978089-0325-43ce-9ea7-844028c8dd64-sampling-based-algorithms-for-optimal-motion-planning.md)
- [YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information](https://refivu.com/en/papers/11ec3a37-5335-4563-b8f6-6949e50f3a4f-yolov9-learning-what-you-want-to-learn-using.md)
- [Multimodal Machine Learning: A Survey and Taxonomy](https://refivu.com/en/papers/2148fea3-852f-4876-ab29-675f2c95c8d9-multimodal-machine-learning-a-survey-and-taxonomy.md)
- [Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition](https://refivu.com/en/papers/bbd98e39-133a-4c51-b43b-84aa4583b3aa-spatial-temporal-graph-convolutional-networks-for-skeleton.md)
- [Stacked Hourglass Networks for Human Pose Estimation](https://refivu.com/en/papers/5578e324-2c80-4bb0-90a0-e90427560e5f-stacked-hourglass-networks-for-human-pose-estimation.md)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/de7adb03-4a8a-4e01-93e9-d9d8b2434300-least-squares-generative-adversarial-networks)
