Toward a Generalization Metric for Deep Generative Models

Hoang Thanh-Tung, Truyen Tran

TL;DR

Common evaluation metrics for deep generative models—such as Inception Score, Precision-Recall, and Neural Net Divergence (NND)—fail to properly test for generalization and can be fooled by simple memorization. The authors expose these vulnerabilities through worst-case analyses, introduce a fix to NND to prevent "fake diversity" from noise, and propose a Minimum Description Length (MDL) inspired metric based on generator path velocity to penalize memorization.

What Problem Does This Paper Address?

Evaluating Deep Generative Models (DGMs) is notoriously hard. Classical statistical divergences like KL divergence or Wasserstein distance suffer from the curse of dimensionality and require an exponential number of samples. Modern practical metrics (Inception Score, FID, Precision-Recall, and NND) reduce sample complexity to polynomial scale, but at the cost of discriminative power.

Specifically, can these metrics distinguish between a generator that truly learns the underlying data distribution and one that merely memorizes training samples? The authors demonstrate that popular metrics cannot reliably detect overfitting, meaning models optimized for standard benchmark scores may simply be memorizing small subsets of data.

Methods

The paper evaluates and addresses these shortcomings through several theoretical and methodological contributions:

  1. Worst-Case Vulnerability Analysis ($D^*$): The authors define $D^*$ as the minimal subset of the training set required to match or beat the score of the full training set against unseen test data. The smaller $|D^*|$, the easier a metric is fooled by memorization.
  2. Fixed-Sample NND: Neural Net Divergence (NND) trains an adversarial discriminator network to separate real from generated data. The authors show that continuous noise sampling creates "fake diversity," allowing a tiny memorized dataset plus noise to fool NND. They fix this by evaluating on a fixed-size, polynomial-budget sample set $D_g$, stripping away artificial diversity.
  3. MDL-Inspired Generalization Metric: Rooted in the Minimum Description Length (MDL) principle, the authors propose: $$f_{\text{gen}}(G) = \alpha f(D_{\text{train}}, D_g) + \text{COMP}(G)$$ where $f$ is a divergence (e.g., fixed NND) and $\text{COMP}(G)$ estimates the generator's parametric complexity.

  4. Complexity via Interpolation Speed: Memorizing models create piecewise-constant manifolds that jump abruptly between training points. Along a constant-speed latent interpolation path, this causes generator speed $\|\partial G(z(t))/\partial t\|_F$ to spike. The authors quantify $\text{COMP}(G)$ as the expected maximum speed $s_{\text{max}}$ along random latent paths.

  5. Constant Speed Regularizer: To prevent rapid jumping between modes, the authors introduce a regularizer penalizing the variance of the generator's velocity during latent interpolation: $$\mathcal{L}_G^{\text{const}} = \mathcal{L}_G + \lambda\, \mathbb{E}_{z_i, z_j \sim p_z, t \in [0, 1]} \left[\left(\left\|\frac{\partial G(z(t))}{\partial t}\right\| - \bar{s}\right)^2\right]$$

Datasets

  • MNIST: Used for all empirical evaluations ($|D_{\text{train}}| = 60{,}000$, $|D_{\text{test}}| = 10{,}000$). No new image datasets or external benchmarks were created.

Key Insights and Ideas

  • $k$-nn Precision-Recall has an extreme failure mode ($|D^*_{\text{knn}}| = 2$): A generator memorizing just the two most distant data points in the training set can achieve a precision and recall of 1.0 because the resulting bounding spheres cover virtually the entire data manifold.
  • Inception Score ($|D^*_{\text{IS}}| = C$): Requires memorizing only one representative point per class (e.g., 10 points for MNIST, 1000 for ImageNet) to achieve near-optimal score.
  • $k$-means Precision-Recall ($|D^*_{\text{kmeans}}| = k$): Requires memorizing only $k$ cluster centroids.
  • Noise creates illusory generalization: In continuous sampling regimes, adding white noise ($\epsilon = 1.0$) to a memorized set of just 1,000 MNIST images produced lower (better) NND scores than a clean set of 60,000 real images. Fixing the evaluation sample size eliminates this loophole.
  • Interpolation velocity unmasks memorization: Even when two models traverse identical path lengths between points, memorizing networks exhibit massive velocity spikes in the transition regions between memorized clusters.

Key Results

  • NND Noise Vulnerability: When training a 3-layer MLP discriminator on MNIST, a noisy memorized subset of size 1,000 scored lower NND than 60,000 clean training points; sets of 10,000 and 60,000 noisy samples were indistinguishable.
  • Metric Failure on Bad GANs: $k$-nn PR assigned a recall of 1.0 to a heavily collapsed GAN trained with a high learning rate ($10^{-3}$).
  • Comparison of Regularizers:
  • $k$-means PR assigned the highest precision/recall to GAN-R1, despite GAN-R1 suffering from severe training-set memorization and collapsing after epoch 400.
  • Using fixed NND, GAN-0GP and WGAN-0GP consistently outperformed gradient penalty (1GP) and R1 models.
  • WGAN-1GP augmented with the proposed constant speed regularizer matched WGAN-0GP's low NND while significantly improving interpolation smoothness.

Limitations and Future Work

  • Small-Scale / Synthetic Domains: Experiments were restricted to MNIST and simple multi-layer perceptrons (MLPs). The authors note that for natural image benchmarks (e.g., ImageNet), computing path velocity directly in pixel space may fail, requiring velocity estimation in deep feature representations.
  • Hyperparameter Dependency: The proposed MDL generalization metric depends on a weighting factor $\alpha$ to balance data fit and generator complexity.
  • Computational Overhead: Computing the expected maximum path velocity across latent interpolations requires numerical integration and multiple backward passes through the generator.

Summary updated

BibTeX
@inproceedings{thanhtung2020toward,
  author = {Hoang Thanh-Tung and Truyen Tran},
  title = {{Toward a Generalization Metric for Deep Generative Models}},
  booktitle = {ICBINB @ NeurIPS},
  year = {2020},
  url = {https://openreview.net/forum?id=dYmOJh7_TjX},
}
Figure