Abstract
Generative models are invaluable in many fields of science because of their ability to capture high-dimensional and complicated distributions, such as photo-realistic images, protein structures, and connectomes. How do we evaluate the samples these models generate? This work aims to provide an accessible entry point to understanding popular sample-based statistical distances, requiring only foundational knowledge in mathematics and statistics. We focus on four commonly used notions of statistical distances representing different methodologies: Using low-dimensional projections (Sliced-Wasserstein; SW), obtaining a distance using classifiers (Classifier Two-Sample Tests; C2ST), using embeddings through kernels (Maximum Mean Discrepancy; MMD), or neural networks (Fréchet Inception Distance; FID). We highlight the intuition behind each distance and explain their merits, scalability, complexity, and pitfalls. To demonstrate how these distances are used in practice, we evaluate generative models from different scientific domains, namely a model of decision-making and a model generating medical images. We showcase that distinct distances can give different results on similar data. Through this guide, we aim to help researchers to use, interpret, and evaluate statistical distances for generative models in science.
Introduction
Generative models, including Generative Adversarial Networks (GANs), Variational Autoencoders (VAEs), and Diffusion models, have become essential tools in scientific research. They enable the simulation of complex phenomena, from protein folding to neuroimaging data. However, a significant challenge remains: how do we rigorously evaluate the quality of the samples these models produce? In many scientific contexts, the "true" likelihood of the data is unknown, rendering traditional metrics like log-likelihood inapplicable.
Researchers must instead rely on sample-based statistical distances. These metrics compare a set of observed "true" data points ($X_{true}$) against a set of generated samples ($X_{gen}$). While widely adopted in machine learning, these distances are often treated as "black boxes" in scientific applications. This guide demystifies four prominent methodologies, providing a roadmap for their selection and interpretation.
Methodologies for Distribution Comparison
The paper evaluates four primary approaches to measuring the distance between two distributions:
- Sliced-Wasserstein (SW): To overcome the "curse of dimensionality," SW projects high-dimensional data onto numerous random 1D lines. It computes the Wasserstein distance (Earth Mover's Distance) on these projections, offering a computationally efficient $O(N \log N)$ solution.
- Classifier Two-Sample Tests (C2ST): This intuitive method involves training a classifier to distinguish between real and generated samples. The classifier's accuracy serves as the metric: 0.5 indicates indistinguishable distributions, while 1.0 indicates perfect separability.
- Maximum Mean Discrepancy (MMD): MMD utilizes the "kernel trick" to embed data into a Reproducing Kernel Hilbert Space (RKHS). It measures the distance between the mean embeddings of the two distributions. Its effectiveness is highly sensitive to the choice of kernel (e.g., Gaussian bandwidth).
- Fréchet Inception Distance (FID): Primarily used for images, FID uses a pre-trained network (InceptionV3) to extract features. It assumes these features follow a Gaussian distribution and calculates the Fréchet distance between the real and generated feature distributions.
Empirical Evaluation and Practical Insights
The authors validated these metrics using synthetic benchmarks and real-world scientific datasets, including primate decision-making times and the ChestX-ray14 dataset. Several critical insights emerged:
- Statistical Proximity vs. Perceptual Quality: In medical imaging, Stable Diffusion (SD) produced sharper images than Progressive GANs (PGGAN). However, because real X-rays contain inherent noise and artifacts, metrics correctly identified PGGAN samples as statistically "closer" to the ground truth, despite SD's higher visual appeal.
- The FID Sample Bias: FID is notoriously biased at low sample sizes. Stable estimates typically require at least 2,048 samples, a threshold that may be difficult to reach in some scientific domains.
- C2ST Sensitivity: While powerful, C2ST can be overly sensitive in high dimensions. A classifier might achieve 1.0 accuracy based on a single, scientifically irrelevant feature, making it difficult to rank models that are both reasonably accurate.
- Metric Inconsistency: Evaluation on ImageNet revealed that different metrics often rank models differently. For instance, FID might favor one model while SW or MMD favors another, highlighting the danger of relying on a single metric.
Conclusion and Recommendations
There is no "one-size-fits-all" statistical distance. The choice of metric should be informed by the data's dimensionality, the available sample size, and the specific scientific goals. For instance, FID's reliance on InceptionV3 (trained on natural images) necessitates the use of domain-specific embeddings (e.g., CheXzero) for specialized data like medical X-rays.
The authors recommend a multi-metric approach to gain a holistic understanding of model performance. Future research should continue to explore domain-specific embeddings and emerging metrics like Mauve or topology-based distances to better capture the nuances of complex scientific data.
Summary updated