SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\mathcal {O} _ {j} := \max  _ {i} \mathcal {N} \left(\varphi \left(x _ {i} ^ {\text {t r a i n}}\right) \mid \varphi \left(x _ {j} ^ {\text {g e n}}\right); \hat {\sigma} _ {j} ^ {2} I\right) > \delta . \tag {4}
$$
The quantity  $\mathcal{O}_j$  is appealing because it is efficient to compute, and the distribution of  $\{\mathcal{O}_j\}$  allows us to quantify what is a "large" value for  $\delta$  and identify the generated samples that are the most-likely copies of the training set. In §4.1.3, we explore this method to assess sample novelty.
Overfitting. Intuitively, a generative model is overfitting when it is more likely to generate samples closer to the train set than to the (unseen) test set. Thus, overfitting for deep generative models can be precisely defined using the standard tools for likelihood estimation.
Definition 3.2. Given samples  $\mathcal{D}_{gen} = \{\mathbf{x}^{gen}\}_{i=1}^{n}$  from a generative model  $G$  trained on  $\mathcal{D}_{train}$  and unseen test samples  $\mathcal{D}_{test}$ . We say that  $G$  is overfitting if  $\log p_{\hat{\sigma}}(\mathcal{D}_{test}|\mathcal{D}_{gen}) < \log p_{\hat{\sigma}}(\mathcal{D}_{train}|\mathcal{D}_{gen})$ , i.e. if:
$$
G e n e r a l i z a t i o n F L D := F L D \left(\mathcal {D} _ {\text {t r a i n}}, \mathcal {D} _ {\text {g e n}}\right) - F L D \left(\mathcal {D} _ {\text {t e s t}}, \mathcal {D} _ {\text {g e n}}\right) <   0 \tag {5}
$$
For FLD, this effect is particularly noticeable due to the MoG being fit to the training set. In fact, samples that are too close to the train set relative to the test set have two effects: they worsen the density estimation of the MoG (increasing  $\mathrm{FLD}(\mathcal{D}_{\mathrm{test}},\mathcal{D}_{\mathrm{gen}})$  and assign higher likelihood to the train set (lowering  $\mathrm{FLD}(\mathcal{D}_{\mathrm{train}},\mathcal{D}_{\mathrm{gen}})$ ). In section 4.1.3 and Tab. 1 experiments we empirically validate the overfitting behavior of popular generative models using our above definition and also visualize samples that are most overfit.
Evaluating individual sample fidelity. While FLD focuses on estimating the density learned by the generative model, it is also possible to estimate the density of the data and use that to evaluate the likelihood of the generated samples<sup>5</sup>. In particular, instead of centering the Gaussians at the generated samples, we can instead center them at the test set. Then, after fitting this MoG to the train set, we compute the likelihood it assigns to generated samples and use that as a measure of sample quality. More formally:
$$
\mathcal {Q} _ {j} := \mathcal {N} \left(\varphi \left(\mathbf {x} _ {j} ^ {\text {g e n}}\right) \mid \varphi \left(\mathcal {D} _ {\text {t e s t}}\right); \Sigma\right). \tag {6}
$$
As is the case for  $\mathcal{O}_j$ ,  $\mathcal{Q}_j$  is easy to compute once the Mog is fit and can be used to rank and potentially filter out poor fidelity samples.
We investigate the application of FLD on generative models that span a broad category of model families, including popular GAN and diffusion models. For datasets, we evaluate a variety of popular
This is somewhat analogous to the difference between Recall and Precision [Sajjadi et al., 2018, Kynkänniemi et al., 2019] where FLD can be seen as a smoother version of these metrics.
Figure 5: Starting from a set of SOTA samples produced by PFGM++, we replace each sample with a transformed copy. Left: Effect of nearly imperceptible transformations on FLD and FID (with corresponding values for various models as reference). Right: Effect of large transformations on FLD and FID.
natural image benchmarks in CIFAR10 [Krizhevsky et al., 2014], FFHQ [Karras et al., 2019] and ImageNet [Deng et al., 2009]. Through our experiments, we seek to validate the correlation between FLD and sample fidelity, diversity, and novelty.
Stein et al. [2023] find that the DINOv2 feature space allows for a more comprehensive evaluation of generative models (relative to Inception-V3) and correlates better with human judgement. As such, for our experiments, unless indicated otherwise, we map samples to the DINOv2 feature space [Oquab et al., 2023]. We do so even for other metrics (e.g. FID, Precision, Recall, etc.) which have typically used other feature spaces (comparisons with vanilla FID are provided in Appendix §C).
4.1 Trichotomic evaluation of FLD
We now experimentally validate FLD's ability to evaluate the samples of generative models along the three axes of fidelity, diversity and novelty.
4.1.1 Sample Fidelity
We evaluate the effect of 2 types of transformations on FLD and plot the results in Fig. 5. The first consists of minor, almost imperceptible transformations (very minor gaussian blur, posterizing and converting to a high quality JPG) that are problematic for FID. As described in [Parmar et al., 2022] small changes to images such as compression or the wrong form of anti-aliasing increase FID substantially despite yielding essentially indistinguishable samples. These transformations affect FLD but noticeably less than FID. This phenomenon occurs even when we use DINoV2 for both FLD and FID (though the effect is more drastic using the original Inception-V3 feature space, see Appendix §C).
Specifically, when all the samples are transformed, FID rates the imperceptibly transformed samples PFGM++ samples as worse than those produced by StyleGAN-XL (or even worse than StyleGAN2-ada). On the other hand, while the imperceptible transforms yield slightly worse FLD values (in part due to the feature space being sensitive to them), the FLD values are barely changed for the "Posterize" and "Light Blur" transforms and only somewhat worse for "JPG 90". The second type of transformations are larger transformations that affect the structure of the image (e.g. cropping, rotation, etc.) and have a significant negative impact on both FLD and FID.
4.1.2 Sample Diversity
We consider two experiments on CIFAR10 to evaluate the effect of mode coverage and diversity on FLD. For the first, we vary the number of classes included in the set of generated samples for various conditional generative models. For the second, instead of the original  $n$  generated samples, we look at a set comprised of  $\frac{n}{k}$  samples from the original set combined with  $(k - 1)$  approximate copies of each of those samples (i.e. for a total of  $n$  samples). In both cases, we find a strong and consistent relationship (across all models) indicating that both sample diversity and mode coverage are important to get good FLD values and report our findings in Fig. 6.
4.1.3 Sample Novelty
We now study the effect of data copying on CIFAR10 on evaluation metrics for generative models. As overfitting can be more subtle than direct copying of the training set, we also consider transformed
Figure 6: Left: FLD for various models as we increase the number of classes included in the generated samples. Right: FLD as the set of generated samples includes increasing amounts of copies of itself.
Figure 7: Comparison of various overfitting metrics when  $\mathcal{D}_{\mathrm{gen}}$  consists of a combination of transformed generated samples and transformed copies of the train set.
copies of the train set. For each transform in Fig. 7, we start with PFGM++ samples that have had the transform applied and gradually replace them with transformed copies of the training set. As such, sample fidelity/diversity in this "pseudo-generated" set remains roughly constant while overfitting increases.
We then evaluate this set of samples using a variety of metrics designed to detect overfitting. For FLD, we look at the generalization gap  $\mathrm{FLD}(\mathcal{D}_{\mathrm{train}},\mathcal{D}_{\mathrm{gen}}) - \mathrm{FLD}(\mathcal{D}_{\mathrm{test}},\mathcal{D}_{\mathrm{gen}})$ . For FID, we consider the difference  $\mathrm{FID}_{\mathrm{train}} - \mathrm{FID}_{\mathrm{test}}$  (where  $\mathrm{FID}_{\mathrm{test}}$  is FID using the test set). We use the same amount of samples (10k) for both as FID is biased.  $C_T$  [Meehan et al., 2020] is the result of a Mann-Whitney test on the distribution of distances between generated and train samples compared to the distribution of distances between train samples and test samples (negative implies overfit, positive implies underfit). The  $\mathrm{AuthPct}\in [0,100]$  is derived from authenticity described in [Alaa et al., 2022] and is simply the percentage of generated samples deemed authentic by their metric.
We find that FLD is the only metric consistently capable of detecting overfitting for all transforms (though the effect is less pronounced for large transforms). The generalization gap of FID oscillates though generally trends in the right direction. However, the magnitude of the gap is small (considering that the FID values using DINOv2 are considerably larger, e.g. the difference between StyleGAN2-ADA and StyleGAN-XL is  $>60$ ). AuthPct trends in the right direction but seems to only be able to detect a subset of the memorized samples (as it detects none of the sample sets as overfit). Finally,  $C_T$  is capable of detecting overfitting for all but the largest transforms (though it does require a significant proportion of copied samples).
4.1.4 Interaction effects
We now examine the relative effect of these three axes of evaluation on FLD. For fidelity, we use an increasing blur intensity. For diversity, we take a subset of the generated samples and replace the rest of the sample with copies of this subset. For novelty, we replace generated samples with copies of the training set. Then, in Fig. 8, starting from high quality generated samples, we vary each combination of the 2 axes and observe the effect on FLD through a heatmap.
In summary, Fig. 8 indicates that for FLD, fidelity matters more than diversity which matters more than novelty (with the notable exception of all samples being copied resulting in very high FLD). We argue this ordering is very much aligned with the potential usefulness of a generative model. If samples have poor fidelity, then regardless of their diversity and novelty, they will not be useful. With poor diversity but good fidelity and novelty, removing duplicates yields a useful generative model.
Figure 8: Heatmap of FLD values for all pairs of the three axes of generalization.
Finally, if the model generates copies of the training set, it can still be useful as long as it generates novel samples as well.
4.2 Comparison of Evaluation of State-of-the-Art Models
Using samples provided by [Stein et al., 2023], we perform a large-scale evaluation of various generative models in Tab. 1 using different metrics on CIFAR10, FFHQ and ImageNet. We find that FLD yields a similar model ranking as FID with some exceptions (for example MHGAN vs BigGAN-Deep on CIFAR10). In addition, we observe that modern generative models are overfitting in a benign way on CIFAR, i.e., there is a noticeable gap between train and test FLD even though the test FLD is reasonably low (indicating good generalization).
Dataset	Model	FLD	FID	Gen Gap FLD	CT	AuthPct	Precision	Recall
CIFAR10	ACGAN-Mod	24.22	1143.07	0.10	26.11	72.09	0.76	0.00
LOGAN	18.94	753.34	0.18	55.66	84.10	0.63	0.13
BigGAN-Deep	9.28	203.90	-0.05	55.70	88.10	0.50	0.26
MHGAN	8.84	231.38	-0.01	47.87	86.69	0.55	0.26
StyleGAN2-ada	6.86	178.64	-0.09	45.31	86.40	0.54	0.33
iDDPM-DDIM	5.63	128.57	-0.33	39.65	84.60	0.57	0.55
StyleGAN-XL	5.58	109.42	-0.23	36.79	85.29	0.57	0.13
PFGMPP	4.58	80.47	-0.35	32.79	83.54	0.60	0.62
FFHQ256	Efficient-VDVAE	9.40	465.34	-0.10	32.22	86.48	0.66	0.07
Projected-GAN	8.61	339.72	0.05	36.77	93.46	0.40	0.11
StyleGAN2-ADA	7.24	296.93	-0.08	27.47	90.95	0.49	0.06
Unleashing	7.23	287.38	-0.06	38.98	90.01	0.57	0.19
InsGen	6.20	249.91	-0.08	26.06	89.74	0.52	0.12
StyleGAN-XL	5.94	155.88	-0.04	39.41	88.17	0.56	0.30
StyleSwin	5.77	200.80	-0.29	32.19	87.68	0.60	0.20
StyleNAT	4.69	156.38	-0.12	29.38	86.35	0.62	0.30
LDM	4.63	162.45	-0.23	28.28	84.84	0.66	0.34
ImageNet256	RQ-Transformer	11.55	212.99	-0.53	125.48	86.10	0.39	0.55
StyleGAN-XL	8.46	150.27	-0.40	98.69	84.10	0.43	0.26
GigaGAN	8.34	156.40	-0.42	98.78	82.48	0.47	0.32
Mask-GIT	6.74	144.23	-0.63	78.97	80.02	0.48	0.44
LDM	3.41	82.42	-0.74	33.63	69.23	0.63	0.45
DiT-XL-2	1.98	62.42	-0.99	22.57	65.79	0.69	0.55
Table 1: Summary of performance metrics for various generative models.
4.3 Applications of FLD
Identifying memorized samples. As discussed in 3.2, we sort the samples generated by various models trained on CIFAR10 according to their respective  $\mathcal{O}_j$  and plot samples for different percentiles. As demonstrated in Fig. 9, all models produce a non-negligible amount of very near copies (especially a specific car of which there are multiple copies in the train set). For PFGM++ and StyleGAN-XL near copies exist even at the 1st percentile of  $\mathcal{O}_j$  (roughly in line with the findings of [Carlini et al., 2023, Stein et al., 2023]).
Figure 9: Ranked generated samples for different models from CIFAR10 according to  $\mathcal{O}_j$ . The left sample is generated, the right one is the nearest sample in the train set (using distances in DINOv2 feature space).
Figure 10: Ranked generated samples for different models from CIFAR10 according to  $\mathcal{Q}_j$ .
Evaluating individual sample fidelity. We repeat the process looking instead at the  $\mathcal{Q}_j$  of the models. From Fig. 10, the progression in fidelity of generative models is quite striking with older models such as LOGAN and ACGAN-Mod producing implausible images for all but their best samples. For recent, SOTA generative models, the top half of samples in terms of  $\mathcal{Q}_j$  are generally of high quality. However, the bottom half has many examples of poor quality samples that would easily be identified by most humans as being fake. Consequently, even if the ranking is not perfect, filtering generated samples using  $\mathcal{Q}_j$  could potentially be beneficial for downstream applications.
We introduce FLD, a new holistic evaluation metric for deep generative models. FLD is easy to compute, broadly applicable to all generative models, and evaluates generation quality, diversity, and generalization. Moreover, we show that, unlike previous approaches, FLD provides more explainable insights into the overfitting and memorization behavior of trained generative models. We empirically demonstrate both on synthetic and real-world datasets that FLD can diagnose important failure modes such as memorization/overfitting, informing practitioners on the potential limitations of generative models that generate photo-realistic images. While we focused on the domain of natural images, a fertile direction for future work is to extend FLD to other data modalities such as text, audio, or time series and also evaluate conditional generative models.
The authors acknowledge the material support of NVIDIA in the form of computational resources. AJB was generously supported by an IVADO Ph.D. fellowship. Finally, the authors would like to thank Quentin Bertrand, David Dobre, and Alexia Jolicoeur-Martineau for helpful feedback on drafts of this work.
L. Theis, A. v. d. Oord, and M. Bethge. A note on the evaluation of generative models. arXiv preprint arXiv:1511.01844, 2015. 1, 3
G. van den Burg and C. Williams. On memorization in probabilistic deep generative models. NeurIPS, 34, 2021. 3
R. Webster, J. Rabin, L. Simon, and F. Jurie. Detecting overfitting of deep generative networks via latent recovery. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019. 3
Y. Wu, Y. Burda, R. Salakhutdinov, and R. Grosse. On the quantitative analysis of decoder-based generative models. arXiv preprint arXiv:1611.04273, 2016. 3
Z. Wu, K. E. Johnston, F. H. Arnold, and K. K. Yang. Protein sequence design with deep generative models. Current Opinion in Chemical Biology, 65, 2021. 1
Q. Xu, G. Huang, Y. Yuan, C. Guo, Y. Sun, F. Wu, and K. Weinberger. An empirical study on evaluation metrics of generative adversarial networks. arXiv preprint arXiv:1806.07755, 2018. 2, 3
Y. Yazici, C.-S. Foo, S. Winkler, K.-H. Yap, and V. Chandrasekhar. Empirical analysis of overfitting and mode drop in gan training. In 2020 IEEE International Conference on Image Processing (ICIP). IEEE, 2020. 2, 3
A.1 Number of samples
From Fig. 11, FLD appears to be reliable even when using less reference set samples (similarly to KID Binkowski et al. [2018]). This is of particular importance for applications in low data regimes or even conditional generation (e.g. the test set of CIFAR10 only contains 1k images for each class). On the other hand, FID highly recommends a minimum of 10k Heusel et al. [2017]. Generally however, the whole training set is used as the value is still biased at 10k and a noticeably lower score can be obtained by using more samples.
As for generated samples, for FID, most papers use 50k as it gives a lower FID than with 10k. We find that using 10k samples for FLD is sufficient for robust evaluation. This is benefit is particularly important given the computational complexity of sampling from modern diffusion models (for example, generating 50k samples often takes hours).
Figure 11: FLD, FID and KID for various sizes of the test set (here, for FID/KID, we use the test set as reference set). Both FLD and KID appear to be relatively consistent, even for smaller test set sizes, while FID is clearly biased.
A.2 Computational Complexity of FLD
We include the plot of computation time of our score relative to other metrics and find that while it scales linearly with the number of train samples at a faster rate than many metrics, it is still roughly within the same order of magnitude to other metrics and insignificant compared to sample generation time.
Figure 12: Time taken (on 1xRTX8000) for different metrics as we vary the number of train samples. We solely include the time to compute the metric value once the samples have been generated and mapped to the appropriate feature space (as these two steps are necessary for each metric and are significantly more computationally expensive than the metric computation).
A.3 Synthetic Experiments
We include a synthetic 2D experiment analyzing how FLD/FID varies as the generated samples go from underfit to overfit. Specifically, we generate 3000 points from the Two Moons dataset using scikit-learn [Pedregosa et al., 2011] with a noise value of 0.1. The first 2000 points are used as
the training set and the last 1000 as test set. We fit a KDE to the train set using bandwidth values varying from  $10^{-4}$  to 10 and sample 1000 points as generated samples before computing our score. As expected, FLD decreases initially as the samples begin to match the distribution. However, unlike Test FID, as the samples begin getting too close to the train samples, FLD increases, punishing the model for overfitting.
Figure 13: FLD vs. FID for samples from a KDE centered at the train points. As we decrease the bandwidth of the KDE, the generated samples go from A) (underfit e.g. low fidelity resulting in high FID/FLD) to B) (just right, the samples match the distribution but are not overfit to the train samples, yielding low FID/FLD) to C) (overfit, the samples are almost identical to the training samples, yielding low FID but high FLD).
B Additional Sample Evaluations
Below, we provide additional results of sample evaluations for FFHQ and ImageNet using both  $\mathcal{O}_j$  and  $\mathcal{Q}_j$ .
Figure 14: Ranked generated samples for different models on ImageNet according to  $\mathcal{O}_j$ . The left sample is generated, the right one is the nearest sample in the train set (using distances in DINOv2 feature space).
Figure 15: Ranked generated samples for different models on FFHQ according to  $\mathcal{Q}_j$ .
Figure 16: Ranked generated samples for different models on ImageNet according to  $\mathcal{Q}_j$ .
C Inception Results
As per the recommendation of Stein et al. [2023], we have updated our experiments to use the DINOv2 feature space instead of Inception-V3. We include below some of the same experimental results with all metrics using the Inception-V3 feature space.
Figure 17: Starting from a set of SOTA samples produced by PFGM++, we replace each sample with a transformed copy. Left: Effect of nearly imperceptible transformations on FLD and FID (with corresponding values for various models as reference). Right: Effect of large transformations on FLD and FID.
Figure 18: Comparison of various overfitting metrics when  $\mathcal{D}_{\mathrm{gen}}$  consists of a combination of transformed generated samples and transformed copies of the train set.
Dataset	Model	FLD	FID	Gen Gap FLD	CT	AuthPct	Precision	Recall
CIFAR10	ACGAN-Mod	9.85	35.45	0.31	48.38	94.50	0.49	0.14
LOGAN	6.07	17.90	0.32	42.03	92.72	0.53	0.52
MHGAN	1.63	4.23	0.20	8.89	89.39	0.64	0.52
BigGAN-Deep	1.53	3.88	0.14	5.48	87.35	0.65	0.51
StyleGAN2-ada	1.13	2.52	-0.02	6.54	87.71	0.64	0.55
iDDPM-DDIM	1.03	3.30	-0.03	4.00	87.31	0.68	0.58
StyleGAN-XL	0.85	1.88	0.13	1.80	86.30	0.67	0.41
PFGMPP	0.79	1.81	0.06	4.19	87.09	0.68	0.61
FFHQ256	Efficient-VDVAE	3.73	34.70	-0.82	2.75	85.75	0.73	0.10
Unleashing	1.62	8.92	-0.51	7.31	87.94	0.66	0.46
Projected-GAN	1.08	4.27	-0.59	3.47	88.14	0.65	0.47
LDM	1.00	8.00	-0.60	5.07	87.95	0.70	0.40
StyleGAN2-ADA	0.98	5.27	-0.69	-1.16	86.26	0.69	0.35
StyleGAN-XL	0.92	2.19	-0.56	4.42	88.55	0.66	0.51
StyleNAT	0.86	2.04	-0.80	3.10	87.57	0.67	0.54
InsGen	0.75	3.37	-0.53	0.70	85.83	0.68	0.45
StyleSwin	0.67	2.85	-0.50	3.46	87.62	0.69	0.47
ImageNet256	RQ-Transformer	2.79	9.41	-1.18	8.26	81.78	0.63	0.56
GigaGAN	0.04	3.83	-1.48	-9.10	72.48	0.75	0.45
StyleGAN-XL	-0.04	2.51	-1.51	-3.52	72.47	0.72	0.45
Mask-GIT	-0.34	5.36	-1.95	-9.13	68.31	0.78	0.46
DiT-XL-2	-0.50	2.53	-1.94	-10.79	66.00	0.76	0.56
LDM	-0.92	3.95	-1.95	-21.52	63.85	0.80	0.47
Table 2: Summary of performance metrics for various generative models using Inception-V3 features. Interestingly, many models obtain a better NLL than the train set on ImageNet. We hypothesize that this is due to Inception-V3 being trained on ImageNet, resulting in noticeably different activations for the train set.
D Method Details
D.1 Algorithm for MoG
Algorithm 1 Fitting MoGs for FLD
Inputs:  $\mathcal{D}_{\mathrm{train}}$ $\mathcal{D}_{\mathrm{gen}}$ $\varphi ,\alpha$    
Train. Fit MoG on  $\mathcal{D}_{\mathrm{train}}$  with  $\mu = \varphi (\mathcal{D}_{\mathrm{gen}})$    
1:  $\sigma^2 = 1$  {// Initialize all bandwidths  $\sigma_j^2 = 1\}$    
2:  $\mathbb{H} = d(\varphi (\mathcal{D}_{\mathrm{train}}),\varphi (\mathcal{D}_{\mathrm{gen}}))$  {// Pre-compute distance matrix.}   
3: while  $\sigma^2$  not converged do   
4:  $\mathcal{L} = -\log p_{\sigma}(\varphi (\hat{\mathcal{D}}_{\mathrm{train}})|\varphi (\mathcal{D}_{\mathrm{gen}}))$    
5:  $\sigma^2\gets \sigma^2 -\alpha \nabla_{\sigma^2}\mathcal{L}$  {// Gradient descent on NLL}   
6: end while   
7: return  $\sigma$  {// Return Trained MoG}
D.2 Optimization
Even with the simplifying assumption of a diagonal covariance matrix, to solve Eq. 2 we still need to learn one parameter per Gaussian (of which there are 10000). As the likelihood of a train sample is the result of the log of the sum of individual Gaussians, the  $\sigma_{j}$  cannot be optimized independently. Thus, we turn to full batch gradient descent using the Adam optimizer with the following hyperparameters:
- 10000 generated samples
- 50 epochs
-  ${lr} = {0.5}$
- Initial value for the variance vector: 0
We modified the original version of Eq. 2 to include a per sample term  $\mathcal{L}_i$  intended to provide a minimum amount of likelihood to each train sample. In practice, we set  $\mathcal{L}_i$  to be equivalent to the likelihood of the point  $\varphi(x_{\text{train}}^i)$  relative to a Gaussian with identity covariance existing at distance  $0.9||\varphi(x_{\text{train}}^i)||_2^2$  from  $\varphi(x_{\text{train}}^i)$ . We find this helps the optimization process recover low variances in the edge cases where most of the generated samples are copied. Otherwise, non-copied train samples have an exponentially small likelihood assigned to them.