TL;DR
This paper reveals a critical flaw in the standard "Discriminator Guidance" technique for diffusion models: training the discriminator with cross-entropy loss can actually worsen sample quality, especially when the discriminator overfits. The authors propose a new, theoretically grounded loss function that directly optimizes for better sample generation, leading to improved results across various datasets.
What Problem Does This Paper Address?
Diffusion models are powerful generative tools, but generating high-quality samples can be computationally expensive. "Discriminator Guidance" (DG) is a post-training refinement technique that uses a discriminator to guide a pre-trained diffusion model towards the true data distribution more efficiently. The idea is to train a discriminator to distinguish between real and generated data at different diffusion steps, and then use its learned gradient to correct the diffusion process. However, the paper points out a fundamental mismatch: the standard DG approach trains the discriminator using cross-entropy (CE) loss, which aims to make the discriminator accurately estimate the density ratio between real and generated data. The problem is that the gradient of this density ratio is what's actually used for refinement, and minimizing CE doesn't guarantee a good gradient. In fact, the authors show that this can lead to worse results, particularly when the discriminator overfits to the training data.
Methods
The core contribution of this paper is a new training objective for the discriminator in the DG framework. Instead of solely relying on cross-entropy, they propose incorporating a term that directly minimizes the mean squared error (MSE) between the true score function and the refined score function (which includes the discriminator's gradient). This is framed as minimizing the "gradient matching loss" (LMSE).
The proposed loss function combines the standard cross-entropy loss with this new gradient matching loss: $L_{train}(\phi) = L_{CE}(\phi) + \gamma L_{LMSE}(\phi)$, where $\gamma$ is a hyperparameter balancing the two terms. This new objective is theoretically shown to directly minimize the KL divergence between the refined and target distributions, unlike the standard CE loss.
Datasets
The paper evaluates their proposed method on the following datasets:
- CIFAR-10
- FFHQ
- AFHQv2
Key Insights and Ideas
- Cross-entropy is not always optimal for discriminator guidance: The paper provides theoretical proof (Theorem 1) that minimizing cross-entropy for the discriminator can lead to arbitrarily poor refinement, even with a well-trained discriminator.
- Overfitting is a major culprit: Theorem 2 demonstrates that discriminator overfitting, a common scenario, directly leads to a deterioration of the refined distribution's quality in terms of KL divergence.
- Gradient matters more than density ratio estimation: The key insight is that for refinement, the gradient of the density ratio is crucial, not just the accurate estimation of the ratio itself. The proposed LMSE loss directly targets this gradient.
- MSE loss leads to better gradient estimation: Visualizations and experiments show that training with the proposed MSE-based loss results in a more accurate estimation of the score gradient compared to cross-entropy.
Key Results
- Improved Sample Quality: The proposed method consistently outperforms the standard Discriminator Guidance (EDM+DG) method in terms of FID scores across CIFAR-10, FFHQ, and AFHQv2 datasets. For example, on CIFAR-10, their method achieves an FID of 1.91 compared to 1.94 for EDM+DG.
- More Stable Refinement: The paper shows that their method is more robust to dataset size variations and less prone to overfitting issues that plague the standard CE-based DG.
- Qualitative Improvements: Visualizations of generated samples (Figures 7, 10, 11, 12) show that samples generated by their method are closer to the original EDM model's samples and less likely to exhibit class changes or artifacts compared to EDM+DG.
Limitations and Future Work
- Computational Overhead: The proposed LMSE loss requires computing both the true score and the discriminator's gradient, leading to increased computational cost and memory requirements compared to the CE loss.
- Hyperparameter Tuning: The balance between the CE and LMSE losses ($\gamma$) needs to be tuned, and higher $\gamma$ values can increase sensitivity to the number of training samples.
- Theoretical vs. Practical: While theoretically optimal, the paper acknowledges that real-world constraints like finite data, model capacity, and training instability can limit the practical effectiveness of discriminator guidance.
- Future Work: The paper suggests that further research into optimizing the discriminator's training and exploring more efficient ways to capture the gradient information could lead to even better results.
Summary updated