Introduction
Generative Adversarial Networks (GANs) have revolutionized generative modeling by framing the problem as a minimax game between a generator ($G$) and a discriminator ($D$). Traditionally, once training is complete, the discriminator is discarded, and the generator is used in isolation to produce samples. However, this standard practice overlooks the valuable information encoded within the discriminator. Generators often suffer from mode collapse or produce artifacts, while the discriminator has learned to distinguish these flaws from real data.
This paper, presented at AAAI 2020, introduces Collaborative Sampling, a novel framework where the discriminator is retained at test time to actively guide the generator. By leveraging the discriminator's gradients, the system iteratively refines generated samples, moving them closer to the real data distribution.
The Collaborative Sampling Framework
The core idea of collaborative sampling is to treat the discriminator as a map rather than a simple binary judge. The discriminator effectively learns the density ratio between the real and generated data distributions. Its gradients, therefore, point toward regions of higher data density.
The process is divided into two main stages:
- Propose: The generator produces an initial sample from a latent code $z$.
- Refine: The discriminator evaluates the sample and provides gradients. These gradients are used to iteratively update the sample's internal representation to maximize the discriminator's "realness" score.
Refinement at the Intermediate Layer
A key technical contribution is the choice of where to apply these updates. Updating the initial latent code $z$ is often too restrictive to fix complex artifacts, while updating the final image pixels directly can be computationally expensive and prone to high-frequency noise. The authors propose refining at an intermediate layer of the generator. This "sweet spot" provides enough flexibility to correct semantic errors (e.g., facial features) while maintaining the structural coherence of the generator's output.
Enhancing the Refinement Process
To ensure the discriminator provides reliable guidance, the authors introduce two additional techniques:
- Discriminator Shaping: Standard discriminators can overfit to specific generator flaws, resulting in a "jagged" loss landscape. By fine-tuning the discriminator on refined samples post-training, the landscape is smoothed, making gradient-based refinement more effective.
- Brier Score Diagnosis: The Brier Score is used as a diagnostic tool to assess whether a discriminator is well-calibrated and "smart" enough to provide useful gradients for sampling.
Experimental Evaluation
The authors evaluated collaborative sampling across synthetic 2D mixtures, standard image benchmarks (CIFAR-10, CelebA, ImageNet), and Image-to-Image translation tasks.
Mode Collapse Recovery
On a synthetic mixture of eight Gaussians, a standard GAN typically collapses to only a few modes. Collaborative sampling demonstrated the ability to "rescue" the model, successfully recovering all eight modes by nudging samples from low-density regions toward the missing clusters.
Quantitative and Qualitative Performance
Collaborative sampling consistently outperforms baselines like standard generation and rejection sampling. In terms of Fréchet Inception Distance (FID) and Inception Score (IS), the method shows significant gains. For instance, on CIFAR-10, the collaborative approach achieves higher sample quality earlier in the training process and maintains a lead over other sampling techniques.
Qualitatively, the refinement process visibly removes artifacts in CelebA face generation and improves the realism of textures in CycleGAN Horse-to-Zebra translations without affecting the background—a task where traditional rejection sampling is inapplicable.
Conclusion
Collaborative sampling shifts the GAN paradigm from a "generate-and-discard" approach to a cooperative one. By utilizing the discriminator at test time, the method significantly improves both the quality and diversity of generated samples. While the iterative nature of the refinement process introduces additional computational overhead, the resulting gains in realism and the ability to mitigate mode collapse make it a powerful tool for enhancing pre-trained generative models.
Summary updated