In the world of Generative Adversarial Networks (GANs), the discriminator is typically treated as temporary scaffolding—a "teacher" that helps the generator learn, only to be discarded once training is complete. But what if that teacher still has valuable secrets to share?
In their ICLR 2019 paper, "Discriminator Rejection Sampling," Samaneh Azadi and colleagues (including GAN pioneer Ian Goodfellow) argue that the discriminator contains crucial information even after training ends. By utilizing the discriminator as a post-training filter, they demonstrate a significant improvement in the quality of generated images without needing to retrain the generator model.
TL;DR
Discriminator Rejection Sampling (DRS) is a post-processing technique that uses a trained GAN's discriminator to filter out low-quality samples produced by the generator. By treating the discriminator as a guide for rejection sampling, the authors achieved a massive jump in ImageNet performance, boosting the Inception Score of a baseline model from 62.36 to 76.08.
The Problem: Imperfect Equilibriums
Despite their massive success in image synthesis, GANs rarely learn the true data distribution perfectly. Theoretical proofs suggest that at the "Nash Equilibrium," the generator should perfectly match the real data, and the discriminator should be entirely unable to tell real from fake (outputting a constant 0.5 probability).
In practice, this equilibrium is never truly reached. Generators often suffer from "mode collapse" or produce unrealistic samples that don't quite fit the training data. Meanwhile, the discriminator usually remains quite capable of spotting these flaws. The authors asked a simple but profound question: If the discriminator still knows which samples are bad, why not just listen to it during the sampling phase?
Methods: Discriminator Rejection Sampling
The core idea is to apply Rejection Sampling to the generator's output.
The Theory
In classic rejection sampling, you aim to sample from a hard-to-reach target distribution $p_d$ (the real data) using a proposal distribution $p_g$ (the generator). If you know the density ratio $p_d(x)/p_g(x)$, you can probabilistically accept or reject samples to perfectly recover $p_d$.
The authors leverage a key mathematical property of GANs: the optimal discriminator's output is directly related to this density ratio. Specifically, the ratio is equal to the exponent of the discriminator's logit (the raw value before the final sigmoid activation function).
The Practical Algorithm (DRS)
Moving from theory to real-world datasets requires several clever engineering tweaks to make the sampling efficient and accurate.
- KeepTraining: The authors found that continuing to train the discriminator for a few extra steps—while keeping the generator frozen—helps it provide a much more accurate "quality signal."
- Burn-In: To perform rejection sampling, you need to know the maximum possible density ratio ($M$). Since this cannot be calculated analytically for complex networks, DRS uses a "burn-in" phase of 10,000 samples to empirically estimate $M$.
- The $\gamma$ Hyperparameter: In high-dimensional spaces like images, strict rejection sampling can become incredibly inefficient, potentially rejecting 99.9% of samples. The authors introduced a parameter $\gamma$ to shift the acceptance probability, allowing a practical trade-off between sample quality and sampling speed.
Experiments and Results
The authors evaluated DRS on two main fronts: a synthetic toy dataset and a large-scale image dataset.
1. Mixture of 25 Gaussians
This synthetic dataset was used to visualize how DRS helps the generator recover missing modes and better fit the target distribution. Standard GANs often struggle here, producing noisy samples that smear across the distinct Gaussian modes.
By applying DRS, the percentage of "high-quality" samples generated increased from 70% to 90%, all while maintaining the same number of recovered modes (24.8 out of 25). DRS effectively trims away the noisy, low-probability samples between the modes.
2. ImageNet Synthesis
For the gold standard of image synthesis, they used the Self-Attention GAN (SAGAN) as their base architecture. The results on ImageNet were particularly striking. The authors first created an "Improved-SAGAN" baseline, then applied DRS to it:
| Model | Inception Score (IS) ↑ | Frechet Inception Distance (FID) ↓ |
|---|---|---|
| Original SAGAN | 52.52 | 18.65 |
| Improved-SAGAN (Baseline) | 62.36 | 14.79 |
| Improved-SAGAN + DRS | 76.08 | 13.57 |
DRS doesn't just make images look superficially better; it helps the generator's output distribution more closely match the statistical properties of the real world, as evidenced by the significant FID improvement.
Limitations and Future Work
- Sampling Efficiency: Rejection sampling is inherently slower than direct sampling. If the generator is very far from the target distribution, the system might have to generate hundreds of images just to "accept" one.
- The "Human" Critic: The authors suggest that in an ideal world, the "critic" used for rejection sampling could be a human or a better proxy for the human visual system, rather than relying solely on the GAN's own discriminator.
- Broader Applications: While this paper focuses on GANs, the authors note that rejection sampling could potentially be applied to improve other generative frameworks, such as Variational Autoencoders (VAEs).
By shifting the focus from how we train to how we sample, DRS provides a practical, "bolt-on" method to squeeze substantially more performance out of existing generative models.
Summary updated