Latent reweighting, an almost free improvement for GANs

Thibaut Issenhuth, Ugo Tanielian, David Picard, Jérémie Mary

Abstract

Standard formulations of GANs, where a continuous function deforms a connected latent space, have been shown to be misspecified when fitting different classes of images. In particular, the generator will necessarily sample some low-quality images in between the classes. Rather than modifying the architecture, we introduce an additional network to predict latent importance weights and two associated sampling methods to avoid the poorest samples. This approach provides a way to inject disconnectedness into any GAN architecture and avoids the computational cost of pixel-space methods by operating directly in the latent space. We demonstrate the effectiveness of our method on several datasets, both synthetic and high-dimensional.

Introduction: The "No GAN's Land" Problem

Generative Adversarial Networks (GANs) typically map a continuous latent space (e.g., a Gaussian distribution) to a complex image manifold. However, real-world data is often disconnected—for instance, a dataset containing both "churches" and "forests." Because the generator function is continuous, it is mathematically forced to "bridge" these disconnected groups. This results in "zombie" images: low-quality, unrealistic samples that exist in the awkward gaps between real data categories, a phenomenon known as "no GAN’s land."

Existing solutions often involve expensive architectural changes or post-processing techniques like Rejection Sampling (RS) that operate in high-dimensional pixel space. These pixel-space methods are computationally heavy and often unreliable due to the "curse of dimensionality" in high-dimensional image manifolds, where density-ratio estimation becomes unstable.

Methodology: Latent Importance Reweighting

The authors propose training a small, additional neural network ($w^\phi$) to predict latent importance weights. Instead of evaluating final pixels, this network analyzes the latent vector $z$ to determine the likelihood of it producing a high-quality image. This provides a principled way to reduce the Wasserstein distance to the target distribution by essentially "pruning" the generator's output distribution post-hoc.

Training and Sampling

  1. Adversarial Learning: The importance weight network is trained adversarially against a discriminator to redistribute the "mass" of the latent space.
  2. LatentRS (Rejection Sampling): Once $w^\phi$ is trained, a latent vector $z$ is sampled and accepted with a probability proportional to its weight. This effectively "clips" away the low-quality regions of the latent space.
  3. LatentGA (Gradient Ascent): Alternatively, a latent vector $z$ can be refined by nudging it in the direction of the gradient of its importance weight before passing it to the generator.
Overview of LatentRS and LatentGA: LatentRS filters poor samples based on predicted importance weights, while LatentGA refines samples via gradient ascent.

The combination of these methods—LatentRS+GA—yields the best results by first rejecting the poorest samples and then refining the survivors.

Experimental Results

The method was evaluated on synthetic 2D datasets (Swiss Roll, 25 Gaussians), standard benchmarks (MNIST, FashionMNIST), and high-dimensional natural images (CelebA at 128x128 using ProGAN, and LSUN Church at 256x256 using StyleGAN2).

Performance and Efficiency

  • Speed: On the CelebA dataset, LatentRS takes only 4.5ms per image, compared to 49ms for Sampling-Importance-Resampling (SIR) and 67.6ms for Discriminator Optimal Transport (DOT). This represents a 10-15x speedup over pixel-space alternatives because rejection happens before the generator's heavy lifting.
  • Quality: On LSUN Church, LatentRS+GA improved the FID of a pre-trained StyleGAN2 from 6.91 to 6.27 and increased Precision from 55.6 to 72.6, outperforming more complex competitors.
  • Pareto Front: The approach defines a new Pareto front for GAN post-processing, offering the best trade-off between computational time and image precision.

Conclusion

Latent reweighting offers a principled, efficient way to improve pre-trained GANs. By moving the filtering logic to the low-dimensional latent space, the method avoids the computational pitfalls of pixel-space processing while providing a significant boost in image quality. While it cannot recover modes the generator failed to learn entirely (mode collapse), it serves as a highly effective "almost free" patch for existing generative models.

Summary updated

BibTeX
@inproceedings{issenhuth2022latent,
  author = {Thibaut Issenhuth and Ugo Tanielian and David Picard and Jérémie Mary},
  title = {{Latent reweighting, an almost free improvement for GANs}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2022},
  url = {https://openreview.net/forum?id=0wqVwk2y_jB},
}
Figure