Demystifying MMD GANs

Mikołaj Bińkowski, Danica J. Sutherland, Michael Arbel, Arthur Gretton

Introduction

Generative Adversarial Networks (GANs; Goodfellow et al., 2014) provide a powerful method for general-purpose generative modeling of datasets. Given examples from some distribution, a GAN attempts to learn a generator function, which maps from some fixed noise distribution to samples that attempt to mimic a reference or target distribution. The generator is trained to trick a discriminator, or critic, which tries to distinguish between generated and target samples.

This alternative to standard maximum likelihood approaches for training generative models has brought about a rush of interest over the past several years. Likelihoods do not necessarily correspond well to sample quality (Theis et al., 2016), and GAN-type objectives focus much more on producing plausible samples, as illustrated particularly directly by Danihelka et al. (2017). This class of models has recently led to many impressive examples of image generation (e.g. Huang et al., 2017a; b; Jin et al., 2017; Zhu et al., 2017).

GANs are, however, notoriously tricky to train (Salimans et al., 2016). This might be understood in terms of the discriminator class. Goodfellow et al. (2014) showed that, when the discriminator is trained to optimality among a rich enough function class, the generator network attempts to minimize the Jensen-Shannon divergence between the generator and target distributions. This result has been extended to general ff-divergences by Nowozin et al. (2016). According to Arjovsky & Bottou (2017), however, it is likely that both the GAN and reference probability measures are supported on manifolds within a larger space, as occurs for the set of images in the space of possible pixel values. These manifolds might not intersect at all, or at best might intersect on sets of measure zero. In this case, the Jensen-Shannon divergence is constant, and the KL and reverse-KL divergences are infinite, meaning that they provide no useful gradient for the generator to follow. This helps to explain some of the instability of GAN training.

The lack of sensitivity to distance, meaning that nearby but non-overlapping regions of high probability mass are not considered similar, is a long-recognized problem for KL divergence-based discrepancy measures (e.g. Gneiting & Raftery, 2007, Section 4.2). It is natural to address this problem using Integral Probability Metrics (IPMs; Müller, 1997): these measure the distance between probability measures via the largest discrepancy in expectation over a class of “well behaved” witness functions. Thus, IPMs are able to signal proximity in the probability mass of the generator and reference distributions. (Section 2 describes this framework in more detail.)

Arjovsky et al. (2017) proposed to use the Wasserstein distance between distributions as the discriminator, which is an integral probability metric constructed from the witness class of 1-Lipschitz functions. To implement the Wasserstein critic, Arjovsky et al. originally proposed weight clipping of the discriminator network, to enforce kk-Lipschitz smoothness. Gulrajani et al. (2017) improved on this result by directly constraining the gradient of the discriminator network at points between the generator and reference samples. This new Wasserstein GAN implementation, called WGAN-GP, is more stable and easier to train.

A second integral probability metric used in GAN variants is the maximum mean discrepancy (MMD), for which the witness function class is a unit ball in a reproducing kernel Hilbert space (RKHS). Generative adversarial models based on minimizing the MMD were first considered by Li et al. (2015) and Dziugaite et al. (2015). These works optimized a generator to minimize the MMD with a fixed kernel, either using a generic kernel on image pixels or by modeling autoencoder representations instead of images directly. Sutherland et al. (2017) instead minimized the statistical power of an MMD-based test with a fixed kernel. Such approaches struggle with complex natural images, where pixel distances are of little value, and fixed representations can easily be tricked, as in the adversarial examples of Szegedy et al. (2014).

Adversarial training of the MMD loss is thus an obvious choice to advance these methods. Here the kernel MMD is defined on the output of a convolutional network, which is trained adversarially. Recent notable work has made use of the IPM representation of the MMD to employ the same witness function regularization strategies as Arjovsky et al. (2017) and Gulrajani et al. (2017), effectively corresponding to an additional constraint on the MMD function class. Without such constraints, the convolutional features are unstable and difficult to train (Sutherland et al., 2017). Li et al. (2017b) essentially used the weight clipping strategy of Arjovsky et al., with additional constraints to encourage the kernel distribution embeddings to be injective.When distribution embeddings are injective, the critic is guaranteed to be able to distinguish any two distributions, given an infinite number of samples. In light of the observations by Gulrajani et al., however, we use a gradient constraint on the MMD witness function in the present work (see Sections 2.1 and 2.2).Li et al. also did this in a later revision of their paper, independent of this work. Bellemare et al. (2017)’s method, the Cramér GAN, also used the gradient constraint strategy of Gulrajani et al. in their discriminator network. As we discuss in Section 2.3, the Cramér GAN discriminator is related to the energy distance, which is an instance of the MMD (Sejdinovic et al., 2013), and which can therefore use a gradient constraint on the witness function. Note, however, that there are important differences between the Cramér GAN critic and the energy distance, which make it more akin to the optimization of a scoring rule: we provide further details in Appendix A. Weight clipping and gradient constraints are not the only approaches possible: variance features (Mroueh et al., 2017) and constraints (Mroueh & Sercu, 2017) can work, as can other optimization strategies (Berthelot et al., 2017; Li et al., 2017a).

Given that both the Wasserstein distance and the MMD are integral probability metrics, it is of interest to consider how they differ when used in GAN training. Bellemare et al. (2017) showed that optimizing the empirical Wasserstein distance can lead to biased gradients for the generator, and gave an explicit example where optimizing with these biased gradients leads the optimizer to incorrect parameter values, even in expectation. They then claim that the energy distance does not suffer from these problems. As our main theoretical contribution, we substantially clarify the bias situation in Section 3. First, we show (Theorem 1) that the natural maximum mean discrepancy estimator, including the estimator of energy distance, has unbiased gradients when used “on top” of a fixed deep network representation. The generator gradients obtained from a trained representation, however, will be biased relative to the desired gradients of the optimal critic based on infinitely many samples. This situation is exactly analogous to WGANs: the generator’s gradients with a fixed critic are unbiased, but gradients from a learned critic are biased with respect to the supremum over critics.

MMD GANs, though, do have some advantages over Wasserstein GANs. Certainly we would not expect the MMD on its own to perform well on raw image data, since these data lie on a low dimensional manifold embedded in a higher dimensional pixel space. Once the images are mapped through appropriately trained convolutional layers, however, they can follow a much simpler distribution with broader support across the mapped domain: a phenomenon also observed in autoencoders (Bengio et al., 2013). In this setting, the MMD with characteristic kernels (Sriperumbudur et al., 2010) shows strong discriminative performance between distributions. To achieve comparable performance, a WGAN without the advantage of a kernel on the transformed space requires many more convolutional filters in the critic. In our experiments (Section 5), we find that MMD GANs achieve the same generator performance as WGAN-GPs with smaller discriminator networks, resulting in GANs with fewer parameters and computationally faster training. Thus, the MMD GAN discriminator can be understood as a hybrid model that plays to the strengths of both the initial convolutional mappings and the kernel layer that sits on top.

Losses and witness functions

We begin with a review of the MMD and relate it to the loss functions used by other GAN variants. Through its interpretation as an integral probability metric, we show that the gradient penalty of Gulrajani et al. (2017) applies to the MMD GAN.

The particular witness function class F\mathcal{F} determines the probability metric.We assume throughout that if f∈Ff\in\mathcal{F}, we also have −f∈F-f\in\mathcal{F}, so that D⁡F\operatorname{\mathcal{D}}_{\mathcal{F}} is symmetric. For example, the Wasserstein-1 metric is defined using the 1-Lipschitz functions, the total variation by functions with absolute value bounded by 1, and the Kolmogorov metric using the functions of bounded variation 11. For more on this family of distances, see e.g. Sriperumbudur et al. (2009b).

The maximum mean discrepancy (MMD) is defined as the IPM (2.1) with F\mathcal{F} the unit ball in H\mathcal{H},

The witness function f∗f^{*} that attains the supremum has a straightforward expression (Gretton et al., 2012, Section 2.3),

and an unbiased estimator of the squared MMD is (Gretton et al., 2012, Lemma 6)

Both the kernel and its derivatives decay exponentially, however, causing significant problems in high dimensions, and especially when used in gradient-based representation learning. The rational quadratic kernel

2 Witness function and gradient penalties

The MMD has been a popular choice for the role of a critic in a GAN. This idea was proposed simultaneously by Dziugaite et al. (2015) and Li et al. (2015), with numerous recent follow-up works (Sutherland et al., 2017; Liu, 2017; Li et al., 2017b; Bellemare et al., 2017). As a key strategy in these recent works, the MMD of (1) is not computed directly on the samples; rather, the samples first pass through a mapping function hh, generally a convolutional network. Note that we can think of this either as the MMD with kernel kk on features h(x)h(x), or simply as the MMD with kernel κ(x,y)=k(h(x),h(y))\kappa(x,y)=k(h(x),h(y)). The challenge is to learn the features hh so as to maximize the MMD, without causing the critic to collapse to a trivial answer early in training.

Bearing in mind that the MMD is an integral probability metric, strategies developed for training the Wasserstein GAN critic can be directly adopted for training the MMD critic. Li et al. (2017b) employed the weight clipping approach of Arjovsky et al. (2017), though they motivated it using different considerations. Gulrajani et al. (2017) found a number of issues with weight clipping, however: it oversimplifies the loss functions given standard architectures, the gradient decays exponentially as we move up the network, and it seems to require the use of slower optimizers such as RMSProp rather than standard approaches such as Adam (Kingma & Ba, 2015).

3 The energy distance and associated MMD

Liu (2017) and Bellemare et al. (2017, Section 4) proposed to use the energy distance as the critic in an adversarial network. The energy distance (Székely & Rizzo, 2004; Lyons, 2013) is a measure of divergence between two probability measures, defined as

Sejdinovic et al. (2013, Lemma 12) showed that the energy distance is an instance of the maximum mean discrepancy, where the corresponding distance-induced kernel family for the distance (2.3) is

To apply the regularization strategy of Gulrajani et al. (2017) in training the critic of an adversarial network, we need to compute the form taken by the witness function (2.1) given the kernel (2.3). Bearing in mind that

where the second term of the above expression is constant, and substituting into (2.1), we have

This is in agreement with Bellemare et al.’s function f∗f^{*} (their page 5), via a different argument (though note that the function g∗g^{*} in their footnote 4 is missing the constant terms).

We now turn to the divergence implemented by the critic in Bellemare et al.’s Algorithm 1, which is somewhat different from the energy distance (2.3). The Cramér GAN witness function is defined as

which is regularized using Gulrajani et al.’s gradient constraint. The expected surrogate loss associated with this witness function, and used for the Cramér critic, is

Nevertheless, good empirical performance has been obtained in practice for the Cramér critic, both by Bellemare et al. (2017) and in our experiments of Section 5. Our Appendix A provides some insight into this behavior by considering the Cramér critic’s relationship to the score function associated with the energy distance.

4 Other related models

Many other GAN variants fall into the framework of IPMs (e.g. Mroueh et al., 2017; Mroueh & Sercu, 2017; Berthelot et al., 2017). Notably, although Goodfellow et al. (2014) motivated GANs as estimating the Jensen-Shannon divergence, they can also be viewed as minimizing the IPM defined by the classifier family (Arora et al., 2017; Liu et al., 2017), thus motivating applying the gradient penalty to original GANs (Fedus et al., 2018). Liu et al. (2017) in particular study properties of these distances.

Gradient bias

The issue of biased gradients in GANs was brought to prominence by Bellemare et al. (2017, Section 3), who showed bias in the gradients of the empirical Wasserstein distance for finite sample sizes, and demonstrated cases where this bias could lead to serious problems in stochastic gradient descent, even in expectation. They then claimed that the energy distance used in the Cramér GAN critic does not suffer from these problems. We will now both formalize and clarify these results.

is differentiable at (ψ,θ)(\psi,\theta), and moreover

Thus for μ\mu-almost all (ψ,θ)(\psi,\theta),

This result is shown in Appendix C, specifically as Corollary 3 to Theorem 5, which is a quite general result about interchanging expectations and derivatives of functions of deep networks. The proof is more complex than a typical proof that derivatives and integrals can be exchanged, due to the non-differentiability of ReLU-like functions used in deep networks.

But this unbiasedness result is not the whole story. In WGANs, the generator attempts to minimize the loss function

based on an estimate W⁡^(X,Y)\hat{\operatorname{\mathcal{W}}}(\mathbf{X},\mathbf{Y}): first critic parameters θ\theta are estimated on a “training set” Xtr\mathbf{X}^{\mathit{tr}}, Ytr\mathbf{Y}^{\mathit{tr}}, i.e. all points seen in the optimization process thus far, and then the distance is estimated on the remaining “test set” Xte\mathbf{X}^{\mathit{te}}, Yte\mathbf{Y}^{\mathit{te}}, i.e. the current minibatch, as

The situation with MMD GANs, including energy distance-based GANs, is exactly analogous. We have (1): for almost all particular critic representations hθh_{\theta}, the estimator of MMD⁡2\operatorname{\mathit{MMD}}^{2} is unbiased. But the population divergence the generator attempts to minimize is actually

a distance previously studied by Sriperumbudur et al. (2009a) as well as Li et al. (2017b). An MMD GAN’s effective estimator of η^\hat{\eta} is also biased by Theorem 2 (see particularly Section B.5); by Theorem 4, its gradients are also almost certainly biased.

In both cases, the bias vanishes as the selection of θ\theta becomes better; in particular, no bias is introduced by the use of a fixed (and potentially small) minibatch size, but rather by the optimization procedure for θ\theta and the total number of samples seen in training the discriminator.

Evaluation metrics

One challenge in comparing GAN models, as we will do in the next section, is that quantitative comparisons are difficult. Some insight can be gained by visually examining samples, but we also consider the following approaches to evaluate GAN methods.

FID

The Fréchet Inception Distance, proposed by Heusel et al. (2017), avoids some of the problems of Inception by measuring the similarity of the samples’ representations in the Inception architecture (at the pool3 layer, of dimension 20482048) to those of samples from the target distribution. The FID fits a Gaussian distribution to the hidden activations for each distribution and then computes the Fréchet distance, also known as the Wasserstein-2 distance, between those Gaussians. Heusel et al. show that unlike the Inception score, the FID worsens monotonically as various types of artifacts are added to CelebA images – though in our Appendix E we found the Inception score to be more monotonic than did Heusel et al., so this property may not be very robust to small changes in evaluation methods. Note also that the estimator of FID is biased;This is easily seen when the true FID is : here the estimator may be positive, but can never be negative. Note also that in fact no unbiased estimator of the FID exists; see Section D.3. we will discuss this issue shortly.

KID

We propose a metric similar to the FID, the Kernel Inception Distance, to be the squared MMD between Inception representations. We use a polynomial kernel, k(x,y)=(1dxTy+1)3k(x,y)=\left(\frac{1}{d}x^{\mathsf{T}}y+1\right)^{3} where dd is the representation dimension, to avoid correlations with the objective of MMD GANs as well as to avoid tuning any kernel parameters.kk is the default polynomial kernel in scikit-learn (Pedregosa et al., 2011). This can also be viewed as an MMD directly on input images with the kernel K(x,y)=k(ϕ(x),ϕ(y))K(x,y)=k(\phi(x),\phi(y)), with ϕ\phi the function mapping images to Inception representations. Compared to the FID, the KID has several advantages. First, it does not assume a parametric form for the distribution of activations. This is particularly sensible since the representations have ReLU activations, and therefore are not only never negative, but do not even have a density: about 2% of components in Inception representations are typically exactly zero. With the cubic kernel we use here, the KID compares skewness as well as the mean and variance. Also, unlike the FID, the KID has a simple unbiased estimator.Because the computation of the MMD estimator scales like O(n2d)O(n^{2}d), we recommend using a relatively small nn and averaging over several estimates; this is closely related to the block estimator of Zaremba et al. (2013). The FID estimator, for comparison, takes time O(nd2+d3)O(nd^{2}+d^{3}), and is substantially slower for d=2048d=2048. It also shares the behavior of the FID as artifacts are added to images (Appendix E).

Figure 1 demonstrates the empirical bias of the FID and the unbiasedness of the KID by comparing the CIFAR-10 train and test sets. The KID (Figure 1(a)) converges quickly to its presumed true value of 0; even for very small nn, simple Monte Carlo estimates of the variance provide a reasonable measure of uncertainty. By contrast, the FID estimate (Figure 1(b)) does not behave so nicely: at n=2 000n=2\,000, when the KID estimator is essentially always 0, the FID estimator is still quite large. Even at n=10 000n=10\,000, the full size of the CIFAR test set, the FID still seems to be decreasing from its estimate of about 8.1 towards zero, showing the strong persistence of bias. This highlights that FID scores can only be compared to one another with the same value of nn.

For models on MNIST, we replace the Inception featurization with features from a LeNet-like convolutional classifiergithub.com/tensorflow/models/blob/master/tutorials/image/mnist/convolutional.py (LeCun et al., 1998), but otherwise compute the scores in the same way.

We also considered the diagnostic test of Arora & Zhang (2017), which estimates the approximate number of “distinct” images produced by a GAN. The amount of subjectivity in what constitutes a duplicate image, however, makes it hard to reliably compare models based on this diagnostic. Comparisons likely need to be performed both with a certain notion of duplication in mind and by a user who does not know which models are being compared, to avoid subconscious biases; we leave further exploration of this intriguing procedure to future work.

1 Learning rate adaptation

In supervised deep learning, it is common practice to dynamically reduce the learning rate of an optimizer when it has stopped improving the metric on a validation set. So far, this does not seem to be common in GAN-type models, so that learning rate schedules must be tuned by hand. We propose instead using an adaptive scheme, based on comparing the KID score for samples from a previous iteration to that from the current iteration.

Experiments

We compare the quality of samples generated by MMD GAN using various kernels with samples obtained by WGAN-GP (Gulrajani et al., 2017) and Cramér GAN (Bellemare et al., 2017) on four standard benchmark datasets: the MNIST dataset of 28×2828\times 28 handwritten digitsyann.lecun.com/exdb/mnist/, the CIFAR-10 dataset of 32×3232\times 32 photos (Krizhevsky, 2009), the LSUN dataset of bedroom pictures resized to 64×6464\times 64 (Yu et al., 2015), and the CelebA dataset of celebrity face images resized and cropped to 160×160160\times 160 (Liu et al., 2015).

For most experiments, except for those with the CelebA dataset, we used the DCGAN architecture (Radford et al., 2016) for both generator and critic. For MMD losses, we used only 16 top-layer neurons in the critic; more did not seem to improve performance, except for the distance kernel for which 256 neurons in the top layer was advantageous. As Bellemare et al. (2017) advised to use at least 256-dimensional critic output, this enabled exact comparison between Cramér GAN and energy distance MMD, which are directly related (Section 2.3). For the generator we used the standard number of convolutional filters (64 in the second-to-last layer); for the critic, we compared networks with 16 and 64 filters in the first convolutional layer.In the DCGAN architecture the number of filers doubles in each consecutive layer, so an ff-filter critic has ff, 2f2f, 4f4f and 8f8f convolutional filters in layers 1-4, respectively.

For the higher-resolution model for the CelebA dataset, we used a 5-layer DCGAN critic and a 10-layer ResNet generatorAs in Gulrajani et al. (2017), we use a linear layer, 4 residual blocks and one convolutional layer., with 64 convolutional filters in the last/first layer. This allows us to compare the performance of MMD GANs with a more complex architecture.

We evaluate several MMD GAN kernel functions in our experiments.Because these higher-resolution experiments were slower to run, for CelebA we trained MMD GAN with only one type of kernel. The simplest is the linear kernel: kdot(x,y)=⟨x,y⟩k^{\mathit{dot}}(x,y)=\langle x,y\rangle, whose MMD corresponds to the distance between means (this is somewhat similar to the feature matching idea of Salimans et al., 2016). We also use the exponentiated quadratic (2.1) and rational quadratic (2.1) functions, with mixtures of lengthscales,

where Σ={2,5,10,20,40,80}\Sigma=\{2,5,10,20,40,80\}, A={.2,.5,1,2,5}\mathcal{A}=\{.2,.5,1,2,5\}. For the latter, however, we found it advantageous to add a linear kernel to the mixture, resulting in the mixed RQ-dot kernel krq∗=krq+kdotk^{\mathit{rq}*}=k^{\mathit{rq}}+k^{\mathit{dot}}. Lastly we use the distance-induced kernel kρ1,0distk^{\mathit{dist}}_{\rho_{1},0} of (2.3), using the Euclidean distance ρ1\rho_{1} so that the MMD is the energy distance.We also found it helpful to add an activation penalty to the critic representation network in certain MMD models. Otherwise the representations hθh_{\theta} sometimes chose very large values, which for most kernels does not change the theoretical loss (defined only in terms of distances) but leads to floating-point precision issues. We use a combined L2L^{2} penalty on activations across all critic layers, with a factor of 11 for rq∗\mathit{rq}{}* and 0.00010.0001 for dist\mathit{dist}. We also considered Cramér GANs, with the surrogate critic (2.3), and WGAN-GPs.

Each model was trained with a batch size of 64, and 5 discriminator updates per generator update. For CIFAR-10, LSUN and CelebA we trained for 150 000150\,000 generator updates, while for MNIST we used 50 00050\,000. The initial learning rate was set to 10−410^{-4} and followed the adaptive scheme described in Section 4.1, with KID compared between the current model and the model 20 00020\,000 generator steps earlier (5 0005\,000 for MNIST), every 2 0002\,000 steps (500500 for MNIST). After 3 consecutive failures to improve, the learning rate was halved. This approach allowed us to avoid manually picking a different learning rate for each of the considered models.

We scaled the gradient penalty by 11, instead of the 1010 recommended by Gulrajani et al. (2017) and Bellemare et al. (2017); we found this to usually work slightly better with MMD models. With the distance kernel, however, we scale the penalty by 1010 to allow direct comparison with Cramér GAN.

Quantitative scores are estimated based on 25 00025\,000 generator samples (100 000100\,000 for MNIST), and compared to 25 00025\,000 dataset elements (for LSUN and CelebA) or the standard test set (10 00010\,000 images held out from training for MNIST and CIFAR-10). Inception and FID scores were computed using 10 bootstrap resamplings of the given images; the KID score was estimated based on 100 repetitions of sampling 1 0001\,000 elements without replacement.

Code for our models is available at github.com/mbinkowski/MMD-GAN.

All of the models achieved good results, measured both visually and in quantitative scores; full results are in Appendix F. Figure 2, however, shows the evolution of our quantitative criteria throughout the training process for several models. This shows that the linear kernel dot and rbf kernel rbf are clearly worse than the other models at the beginning of the training process, but both improve eventually. rbf, however, never fully catches up with the other models. There is also some evidence that dist, and perhaps WGAN-GP, converge more slowly than rq and Cramér GAN. Given their otherwise similar properties, we thus recommend the use of rq kernels over rbf in MMD GANs and limit experiments for other datasets to rq and dist kernels.

CIFAR-10

Full results are shown in Appendix F. Small-critic MMD GAN models approximately match large-critic WGAN-GP models, at substantially reduced computational cost.

LSUN Bedrooms

Table 1 presents scores for models trained on the LSUN Bedrooms dataset; samples from most of these models are shown in Figure 3. Comparing the models’ Inception scores with the one achieved by the test set makes clear that this measure is not meaningful for this dataset – not surprisingly, given the drastic difference in domain from ImageNet class labels.

In terms of KID and FID, MMD GANs outperform Cramér and WGAN-GP for each critic size. Although results with the smaller critic are worse than with the large one for each considered model, small-critic MMD GANs still produce reasonably good samples, which certainly is not the case for WGAN-GP. Although a small-critic Cramér GAN produces relatively good samples, the separate objects in these pictures often seem less sharp than the MMD rq* samples. With a large critic, both Cramér GAN and MMD rq* give good quality samples, many of which are hardly distinguishable from the test set by eye.

CelebA

Scores for the CelebA dataset are shown in Table 2; MMD GAN with rq* kernel outperforms both WGAN-GP and Cramér GAN in KID and FID. Samples in Figure 4 show that for each of the models there are many visually pleasing pictures among the generated ones, yet unrealistic images are more common for WGAN-GP and Cramér.

These results illustrate the benefits of using the MMD on deep convolutional feaures as a GAN critic. In this hybrid system, the initial convolutional layers map the generator and reference image distributions to a simpler representation, which is well suited to comparison via the MMD. The MMD in turn employs an infinite dimensional feature space to compare the outputs of these convolutional layers. By comparison, WGAN-GP requires a larger discriminator network to achieve similar performance. It is interesting to consider the question of kernel choice: the distance kernel and RQ kernel are both characteristic (Sriperumbudur et al., 2010), and neither suffers from the fast decay of the exponentiated quadratic kernel, yet the RQ kernel performs slightly better in our experiments. The relative merits of different kernel families for GAN training will be an interesting topic for further study.

References

Appendix A Score functions, divergences, and the Cramér GAN

Bearing in mind the definition of the divergence (A), it is easy to see (Gneiting & Raftery, 2007, eq. 22) that the energy distance (2.3) arises from the score function

Appendix B Bias of generalized IPM estimators

We will now show that all estimators of IPM-like distances and their gradients are biased. Section B.1 defines a slight generalization of IPMs, used to analyze MMD GANs in the same framework as WGANs, and a class of estimators that are a natural model for the estimator used in GAN models. Section B.2 both shows that not only are this form of estimators invariably biased in nontrivial cases, and moreover no unbiased estimator can possibly exist; Section B.3 then demonstrates that any estimator with non-constant bias yields a biased gradient estimator. Sections B.4 and B.5 demonstrate specific examples of this bias for the Wasserstein and maximized-MMD distances.

We will first define a slight generalization of IPMs: we will use this added generality to help analyze MMD GANs in Section B.5.

These estimators are defined by three components: the choice of relative sizes of the train-test split, the selection procedure for f^Xtr,Ytr\hat{f}_{\mathbf{X}^{\mathit{tr}},\mathbf{Y}^{\mathit{tr}}}, and the estimator J^\hat{J}. The most obvious selection procedure is

though of course one could use regularization or other techniques to select a different f∈Ff\in\mathcal{F}, and in practice one will use an approximate optimizer. Lopez-Paz & Oquab (2017) used an estimator of exactly this form in a two-sample testing setting.

As noted in Section 3, this training/test split is a reasonable match for the GAN training process. As we optimize a WGAN-type model, we compute the loss (or its gradients) on a minibatch, while the current parameters of the critic are based only on data seen in previous iterations. We can view the current minibatch as Xte,Yte\mathbf{X}^{\mathit{te}},\mathbf{Y}^{\mathit{te}}, all previously-seen data as Xtr,Ytr\mathbf{X}^{\mathit{tr}},\mathbf{Y}^{\mathit{tr}}, and the current critic function as f^Xtr,Ytr\hat{f}_{\mathbf{X}^{\mathit{tr}},\mathbf{Y}^{\mathit{tr}}}. Thus, at least in the first pass over the training set, WGAN-type approaches exactly fit the data-splitting form of Definition 2; in later passes, the difference from this setup should be relatively small unless the model is substantially overfitting.

B.2 Estimator bias

We first show, in Theorem 2, that data-splitting estimators are biased downwards. Although this provides substantial intuition about the situation in GANs, it leaves open the question of whether some other unbiased estimator might exist; Theorem 3 shows that this is not the case.

Consider a data-splitting estimator (Definition 2) of the generalized IPM D⁡\operatorname{\mathcal{D}} (Definition 1) based on an unbiased estimator J^\hat{J} of JJ: for any fixed f∈Ff\in\mathcal{F},

Then either the selection procedure is almost surely perfect,

or else the estimator has a downward bias:

Since Xtr,Ytr\mathbf{X}^{\mathit{tr}},\mathbf{Y}^{\mathit{tr}} are independent of Xte\mathbf{X}^{\mathit{te}}, Yte\mathbf{Y}^{\mathit{te}},

Define the suboptimality of f^Xtr,Ytr\hat{f}_{\mathbf{X}^{\mathit{tr}},\mathbf{Y}^{\mathit{tr}}} as

Theorem 2 makes clear that as f^Xtr,Ytr\hat{f}_{\mathbf{X}^{\mathit{tr}},\mathbf{Y}^{\mathit{tr}}} converges to its optimum, the bias of D⁡^\hat{\operatorname{\mathcal{D}}} should vanish (as in Bellemare et al., 2017, Theorem 3). Moreover, in the GAN setting the minibatch size only directly determines Xte,Yte\mathbf{X}^{\mathit{te}},\mathbf{Y}^{\mathit{te}}, which do not contribute to this bias; bias is due rather to the training procedure and the number of samples seen through the training process. As long as f^Xtr,Ytr\hat{f}_{\mathbf{X}^{\mathit{tr}},\mathbf{Y}^{\mathit{tr}}} is not optimal, however, the estimator will remain biased.

Thus R(α)R(\alpha) is a polynomial in α\alpha of degree at most mm.

where (13) used our general assumption about IPMs that if f∈Ff\in\mathcal{F}, we also have −f∈F-f\in\mathcal{F}. But R(α)R(\alpha) is not a polynomial with any finite degree. Thus no such unbiased estimator D⁡^\hat{\operatorname{\mathcal{D}}} exists. ∎

Note that the proof of Theorem 3 does not readily extend to generalized IPMs, and so does not tell us whether an unbiased estimator of the MMD GAN objective (3) can exist. Also, attempting to apply the same argument to squared IPMs would give the square of (14), which is a quadratic function in α\alpha. Thus tells us that although no unbiased estimator for a squared IPM can exist with only m=1m=1 sample point, one can exist for m≥2m\geq 2, as indeed (1) does for the squared MMD.

B.3 Gradient estimator bias

We will now show that biased estimators, except for estimators with a constant bias, must also have biased gradients.

Consider an estimator D⁡^(ψ)\hat{\operatorname{\mathcal{D}}}(\psi) of D⁡(ψ)\operatorname{\mathcal{D}}(\psi). Theorem 4 shows that when D⁡^(ψ)\hat{\operatorname{\mathcal{D}}}(\psi) and D⁡(ψ)\operatorname{\mathcal{D}}(\psi) are differentiable, the gradient ∇ψD⁡^(ψ)\nabla_{\psi}\hat{\operatorname{\mathcal{D}}}(\psi) is an unbiased estimator for ∇ψD⁡(ψ)\nabla_{\psi}\operatorname{\mathcal{D}}(\psi) only if the bias of D⁡^(ψ)\hat{\operatorname{\mathcal{D}}}(\psi) doesn’t depend on ψ\psi. This is exceedingly unlikely to happen for the biased estimator D⁡^(W)\hat{\operatorname{\mathcal{D}}}(W) defined in Theorem 2, and indeed Theorem 3 shows cannot happen for any IPM estimator.

Then, for each connected component of Ψ\Psi,

where the constant can vary only across distinct connected components.

Let ψ1\psi_{1} and ψ2\psi_{2} be an arbitrary pair of parameter values in Ψ\Psi, connected by some smooth path r:→Ψr:\to\Psi with r(0)=ψ1r(0)=\psi_{1}, r(1)=ψ2r(1)=\psi_{2}. For example, if Ψ\Psi is convex, then paths of the form r(t)=tψ1+(1−t)ψ2r(t)=t\psi_{1}+(1-t)\psi_{2} are sufficient. Using Fubini’s theorem and standard results about path integrals, we have that

B.4 WGANs

Theorems 2 and 3 hold for the original WGANs, whose critic functions are exactly LL-Lipschitz, considering F\mathcal{F} as the set of LL-Lipschitz functions so that D⁡F\operatorname{\mathcal{D}}_{\mathcal{F}} is LL times the Wasserstein distance. They also hold for either WGANs or WGAN-GPs with F\mathcal{F} the actual set of functions attainable by the critic architecture, so that D⁡\operatorname{\mathcal{D}} is the “neural network distance” of Arora et al. (2017) or the “adversarial divergence” of Liu et al. (2017).

B.5 Maximal MMD estimator

As mtr,ntr→∞m^{\mathit{tr}},n^{\mathit{tr}}\to\infty, as for Wasserstein it should be the case that η^→η\hat{\eta}\to\eta. This is shown for certain kernels, along with the rate of convergence, by Sriperumbudur et al. (2009a, Section 4).

It should also be clear that in nontrivial situations, this bias is not constant, and hence gradients are biased by Theorem 4.

The MMD GAN estimator of η\eta, if the optimum is achieved, uses

Appendix C Proof of unbiased gradients

We now proceed to prove Theorem 1 as a corollary to the Theorem 5, our main result about exchanging gradients and expectations of deep networks.

Exchanging the gradient and the expectation can often be guaranteed using a standard result in measure theory (see 1), as a corollary of the Dominated Convergence theorem (2). This result, however, requires the property 1.(ii): for almost all inputs XX, the mapping is differentiable on the entirety of a neighborhood around θ\theta. This order of quantifiers is important: it allows the use of the mean value theorem to control the average rate of change of the function, and the result then follows from 2.

We define the feed-forward network that factorizes according the graph GG and with functions fif_{i} recursively:

where hπ(i)h^{\pi(i)} is the concatenation of the vectors hjh^{j} for j∈π(i)j\in\pi(i). The functions fif_{i} can be of two types:

Non-linear: These fif_{i} have no learnable weights. fif_{i} can potentially be non-differentiable, such as max pooling, ReLU, and so on. Some conditions on fif_{i} will be required (see Assumption D); the usual functions used in practice satisfy these conditions.

C.2 Assumptions

We will need the following assumptions at various points, where α≥1\alpha\geq 1:

The function K⁡\operatorname{\mathit{K}} is continuously differentiable, and satisfies the following growth conditions where C0C_{0} and C1C_{1} are constants:

(Lipschitz nonlinear layers) For each i∈Ci\in C, fif_{i} is MM-Lipschitz.

Note that Assumption B is satisfied by the function K(U)=UK(U)=U, used in Corollaries 1 and 2, with α=1\alpha=1. It is also satisfied by the top-level functions of an MMD GAN with each of the kernels we consider in this work; see Corollary 3.

Assumptions C and D are satisfied by the vast majority of deep networks used in practice.

For example, if fif_{i} computes the ReLU activation function on two inputs, then we have Ki=4K_{i}=4, with each D⁡ik\operatorname{\mathcal{D}}_{i}^{k} corresponding to a quadrant of the real plane (see Figure 5(a)). These quadrants might each be defined by Si,k=2S_{i,k}=2 inequalities of the form Gi,k,1(Y)>0G_{i,k,1}(Y)>0 and Gi,k,2(Y)>0G_{i,k,2}(Y)>0, where Gi,k,s(Y)=±Y1G_{i,k,s}(Y)=\pm Y_{1} and Gi,k,s(Y)=±Y2G_{i,k,s}(Y)=\pm Y_{2} are analytic. Moreover, on each of these domains fif_{i} coincides with an analytic function:

Another example is when fif_{i} computes max-pooling on two inputs. In that case we have Ki=2K_{i}=2, and each domain D⁡ik\operatorname{\mathcal{D}}_{i}^{k} corresponds to a half plane (see Figure 5(b) ). Each domain is defined by one inequality Gi,k,1(Y)>0G_{i,k,1}(Y)>0 with Gi,1,1(Y)=Y1−Y2G_{i,1,1}(Y)=Y_{1}-Y_{2} and Gi,2,1(Y)=Y2−Y1G_{i,2,1}(Y)=Y_{2}-Y_{1}. Again, Gi,k,1G_{i,k,1} are analytic functions and fif_{i} coincides with an analytic function on each of the domains:

Other activation functions, such as the ELU (Clevert et al., 2016), are piecewise-analytic and also satisfy Assumptions C and D.

C.3 Main results

We first state the main result, which implies Theorem 1 via Corollaries 3, 1 and 2. The proof depends on various intermediate results which will be established afterwards.

converges point-wise to and is bounded by the integrable function 2F(X)2F(X). Therefore by the dominated convergence theorem (2) it follows that

By linearity, we only need the following two results:

The first follows immediately from Theorem 5, using the function K⁡(U)=U\operatorname{\mathit{K}}(U)=U (which clearly satisfies Assumption B for α=1\alpha=1). The latter does as well by considering that the augmented network h(θ,ψ)(Z)=Dθ(Gψ(Z))h_{(\theta,\psi)}(Z)=D_{\theta}(G_{\psi}(Z)) still satisifes the conditions of Theorem 5. ∎

Thus, by linearity, gradients of all the loss functions given in Goodfellow et al. (2014, Section 3) are unbiased.

The log⁡\log function is real analytic and (1/γ1/\gamma)-Lipschitz on (γ,1−γ)(\gamma,1-\gamma). The claim therefore follows from Theorem 5, using the networks log⁡∘Dθ\log\circ D_{\theta}, log⁡∘[x↦(1−x)]∘Dθ∘Gψ\log\circ[x\mapsto(1-x)]\circ D_{\theta}\circ G_{\psi}, and log⁡∘Dθ∘Gψ\log\circ D_{\theta}\circ G_{\psi} with K(U)=UK(U)=U. ∎

The following assumption about a kernel kk implies Assumption B when used as a top-level function K⁡\operatorname{\mathit{K}}:

Suppose kk is a kernel such that there are constants C0C_{0}, C1C_{1} where

Consider the following augmented networks:

satisfies Assumption B. Thus Theorem 5 applies to each of h(1)h^{(1)}, h(2)h^{(2)}, and h(3)h^{(3)}. Considering the form of MMD⁡u2\operatorname{\mathit{MMD}}_{u}^{2} (1), the result follows by linearity and the fact that MMD⁡u2\operatorname{\mathit{MMD}}_{u}^{2} is unbiased (Gretton et al., 2012, Lemma 6). ∎

Each of the kernels considered in this paper satisfies Assumption E with α\alpha at most 2:

kdot(x,y)=⟨x,y⟩k^{\mathit{dot}}(x,y)=\langle x,y\rangle works with α=2\alpha=2, C0=1C_{0}=1, C1=1C_{1}=1.

kσrbfk^{\mathit{rbf}}_{\sigma} of (2.1) works with α=2\alpha=2, C0=1C_{0}=1, C1=2σ−2C_{1}=\sqrt{2}\sigma^{-2}.

kα′rqk^{\mathit{rq}}_{\alpha^{\prime}} of (2.1) works with α=2\alpha=2, C0=1C_{0}=1, C1=2C_{1}=\sqrt{2}.

kρβ,0distk^{\mathit{dist}}_{\rho_{\beta},0} of (2.3), using ρβ(x,y)=∥x−y∥β\rho_{\beta}(x,y)=\lVert x-y\rVert^{\beta} with 1≤β≤21\leq\beta\leq 2, works with α=β\alpha=\beta, C0=3C_{0}=3, C1=4βC_{1}=4\beta.

Since the existence of a moment implies the existence of all lower-order moments by Jensen’s inequality, this finalizes the proof of Theorem 1.

C.4 Bounds on network growth

The following lemmas were used in the proof of Theorem 5. We start by stating a result on the growth and Lipschitz properties of the network.

Under Assumption C, there exist continuous functions θ↦b(θ),a(θ)\theta\mapsto b(\theta),a(\theta) and (θ,θ′)↦(α(θ,θ′),β(θ,θ′))(\theta,\theta^{\prime})\mapsto(\alpha(\theta,\theta^{\prime}),\beta(\theta,\theta^{\prime})) such that:

where aπ(i)(θ)a_{\pi(i)}(\theta), bπ(i)(θ)b_{\pi(i)}(\theta), απ(i)(θ,θ′)\alpha_{\pi(i)}(\theta,\theta^{\prime}) and βπ(i)(θ,θ′)\beta_{\pi(i)}(\theta,\theta^{\prime}) are continuous functions. If ii is a linear layer then:

with ai(θ)=∥gi∥∥Wi∥aπ(i)(θ)a_{i}(\theta)=\|g_{i}\|\|W^{i}\|a_{\pi(i)}(\theta) and bi(θ)=∥gi∥∥Wi∥bπ(i)(θ)b_{i}(\theta)=\|g_{i}\|\|W^{i}\|b_{\pi(i)}(\theta). Moreover, we have that:

When ii is not a linear layer, then by Assumption C fif_{i} is MM-Lipschitz. Thus we can directly get the needed functions by recursion: αi=Mαπ(i)\alpha_{i}=M\alpha_{\pi(i)}, βi=Mβπ(i)\beta_{i}=M\beta_{\pi(i)}, ai=Maπ(i)a_{i}=Ma_{\pi(i)} and bi=Mbπ(i)b_{i}=Mb_{\pi(i)}. ∎

We will first prove the following inequality:

Let tt be in $anddefinethefunctionand define the functionf$ by

Then f(0)=K⁡(V)f(0)=\operatorname{\mathit{K}}(V) and f(1)=K⁡(U)f(1)=\operatorname{\mathit{K}}(U). Moreover, ff is differentiable and its derivative is given by:

The conclusion follows using the mean value theorem. Now choosing U=hθ′(X)U=h_{\theta^{\prime}}(X) and V=hθ(X)V=h_{\theta}(X) one gets the following:

Under Assumption C, it follows by Lemma 1 that:

The functions aa, bb, α\alpha, β\beta defined in Lemma 1 are continuous, and hence all bounded on the ball B(θ,RB(\theta,R); choose D>0D>0 to be a bound on all of these functions. It follows after some algebra that

Set F(X)=C1(Dα(R+1)α−1(1+∥X∥)α+D(1+∥X∥))F(X)=C_{1}(D^{\alpha}(R+1)^{\alpha-1}(1+\|X\|)^{\alpha}+D(1+\|X\|)). Since α≥1\alpha\geq 1, t↦(1+t1/α)αt\mapsto(1+t^{1/\alpha})^{\alpha} is concave on t≥0t\geq 0, and so we have that

Recall the definition of a differential: gg is the differential of ff at θ0\theta_{0} if

The result directly follows from the sequential characterization of limits. ∎

C.5 Critical parameters have zero measure

The last result required for the proof of Theorem 5 is 3. We will first need some additional notation.

For a given node ii, we will use the following sets of indices to denote “paths” through the network’s computational graph:

Note that ∂i⊆¬i\partial i\subseteq\neg i, and that ¬i=∂i∪¬π(i)\neg i=\partial i\cup\neg\pi(i).

If a(i)a(i) is the set of ancestors of node ii, we define a backward trajectory starting from node ii as an element qq of the form:

where kjk_{j} are integers in [Kj][K_{j}]. We call T(i)T(i) the set of such trajectories for node ii.

For p∈Pp\in P of the form p=(i,k,s)p=(i,k,s), the set of parameters for which we lie on the boundary of pp is

We also denote by ∂Sp\partial S^{p} the boundary of the set SpS^{p}. If QQ is a subset of PP, we use the following notation for convenience:

This is the set of parameters θ\theta where the network is not differentiable for a non-negligible set of datasets XX.

We are now ready to state and prove the remaining result.

By Lemma 4, we have that μ(ΘX)=0\mu(\Theta_{X})=0; therefore ν(Q)=0\nu(Q)=0 and hence ν(D)=0\nu(D)=0. On the other hand, we use again Fubini’s theorem for ν(D)\nu(D) to write:

We first show that ΘX⊆∂SP\Theta_{X}\subseteq\partial S^{P}, which was defined by (C.5).

Let θ0\theta_{0} be in ΘX\Theta_{X}. By Assumption D, it follows that θ0∈SP\theta_{0}\in S^{P}. Assume for the sake of contradiction that θ0∉∂SP\theta_{0}\notin\partial S^{P}. Then applying Lemma 5 to the output layer, i=Li=L, implies that there is a real analytic function f(θ)f(\theta) which agrees with hθh_{\theta} on all θ∈B(θ0,η)\theta\in B(\theta_{0},\eta) for some η>0\eta>0. Therefore the network is differentiable at θ0\theta_{0}, contradicting the fact that θ0∈ΘX\theta_{0}\in\Theta_{X}. Thus ΘX⊆∂SP\Theta_{X}\subseteq\partial S^{P}.

Lemma 6 then establishes that μ(∂SP)=0\mu(\partial S^{P})=0, and hence μ(ΘX)=0\mu(\Theta_{X})=0. ∎

If θ∉S∂i\theta\notin S^{\partial i}, then there is some sufficiently small η′>0\eta^{\prime}>0 such that B(θ,η′)B(\theta,\eta^{\prime}) does not intersect S∂iS^{\partial i}. Therefore, by Assumption D, there is some k∈[Ki]k\in[K_{i}] such that hθ′i=fik(hθ′π(i))h_{\theta^{\prime}}^{i}=f_{i}^{k}(h_{\theta^{\prime}}^{\pi(i)}) for all θ′∈B(θ,η′)\theta^{\prime}\in B(\theta,\eta^{\prime}), where fikf_{i}^{k} is one of the real analytic functions defining fif_{i}. By (90) we then have

Otherwise, θ∈S∂i\theta\in S^{\partial i}. Then, noting that by assumption θ∉∂S∂i\theta\notin\partial S^{\partial i}, it follows that for small enough η′>0\eta^{\prime}>0, we have B(θ,η′)⊆S∂iB(\theta,\eta^{\prime})\subseteq S^{\partial i}. Denote by AA the set of index triples p∈∂ip\in\partial i such that θ∈Sp\theta\in S^{p}; AA is nonempty since θ∈S∂i\theta\in S^{\partial i}. Therefore θ∈⋂p∈ASp\theta\in\bigcap_{p\in A}S^{p}, and θ∉⋃p∈AcSp\theta\notin\bigcup_{p\in A^{c}}S^{p}. We will show that for η′\eta^{\prime} small enough, B(θ,η′)⊆⋂p∈ASpB(\theta,\eta^{\prime})\subseteq\bigcap_{p\in A}S^{p}. Assume for the sake of contradiction that there exists a sequence of (parameter, index-triple) pairs (θn,pn)(\theta_{n},p_{n}) such that pn∈Acp_{n}\in A^{c}, θn∈Spn\theta_{n}\in S^{p_{n}}, and θn→θ\theta_{n}\to\theta. pnp_{n} is drawn from a finite set and thus has a constant subsequence, so we can assume without loss of generality that pn=p0p_{n}=p_{0} for some p0∈Acp_{0}\in A^{c}. Since Sp0S^{p_{0}} is a closed set by continuity of the network and Gp0G_{p_{0}}, it follows that θ∈Sp0\theta\in S^{p_{0}} by taking the limit. This contradicts the fact that θ∉⋃p∈AcSp\theta\notin\bigcup_{p\in A^{c}}S^{p}. Hence, for η′\eta^{\prime} small enough, B(θ,η′)⊆⋂p∈ASpB(\theta,\eta^{\prime})\subseteq\bigcap_{p\in A}S^{p}. Again, by Assumption D there is a k∈[Ki]k\in[K_{i}] satisfying (C.5).

We will proceed by recursion. For i=0i=0 we trivially have ∂S¬0=∅\partial S^{\neg 0}=\emptyset, thus μ(∂S¬0)=0\mu(\partial S^{\neg 0})=0. Thus assume that

For s=(p,q)s=(p,q), the pair of an index triple p∈∂ip\in\partial i and a trajectory q∈T(i)q\in T(i), define the set

where fqf^{q} is the real analytic function defined in Lemma 5 which locally agrees with hθπ(i)h^{\pi(i)}_{\theta}.

We will now prove that for any θ\theta in ∂S∂i∖∂S¬π(i)\partial S^{\partial i}\setminus\partial S^{\neg\pi(i)}, there exists s∈∂i×T(i)s\in\partial i\times T(i) such that θ∈Ms\theta\in\mathcal{M}_{s} and μ(Ms)=0\mu(\mathcal{M}_{s})=0. We proceed by contradiction.

We have shown that ∂S∂i∖∂S¬π(i)⊆⋃s∈AMs\partial S^{\partial i}\setminus\partial S^{\neg\pi(i)}\subseteq\bigcup_{s\in A}\mathcal{M}_{s}, where the sets Ms\mathcal{M}_{s} have zero Lebesgue measure and A⊆P×⋃j=0LT(j)A\subseteq P\times\bigcup_{j=0}^{L}T(j) is finite. This implies:

Using the recursion assumption μ(∂S¬π(i))=0\mu(\partial S^{\neg\pi(i)})=0, one concludes that μ(∂S¬i)=0\mu(\partial S^{\neg i})=0. Hence for the last node LL, recalling that ¬L=P\neg L=P one gets μ(∂SP)=0\mu(\partial S^{P})=0. ∎

Then either μ(M)=0\mu(\mathcal{M})=0 or FF is identically zero.

This result is shown e.g. as Proposition 0 of Mityagin (2015). ∎

Appendix D FID estimator bias

We now further study the bias behavior of the FID estimator (Heusel et al., 2017) mentioned in Section 4.

This is motivated because it coincides with the Fréchet (Wasserstein-2) distance between normal distributions. Although the Inception coding layers to which the FID is applied are not normally distributed, the FID remains a well-defined pseudometric between arbitrary distributions whose first two moments exist.

Note that Sections D.1 and D.2 only apply to this plug-in estimator of the FID; it remains conceivable that there would be some other estimator for the FID which is unbiased. Section D.3 shows that this is not the case: there is no unbiased estimator of the FID.

We will first show that the estimator can behave poorly even with very simple distributions.

where W⁡\operatorname{\mathcal{W}} is the Wishart distribution. Then we have

Thus the expected estimator for one-dimensional normals becomes

where the inequality follows because 1m2<1m\frac{1}{m^{2}}<\frac{1}{m} and dm<1d_{m}<1 for all m≥2m\geq 2. Thus we have the undesirable situation

D.2 Empirical example with high-dimensional censored normals

The example of Section D.1, though indicative in that the estimator can behave poorly even with very simple distributions, is somewhat removed from the situations in which we actually apply the FID. Thus we now empirically consider a more realistic setup.

First, as noted previously, the hidden codes of an Inception coding network are not well-modeled by a normal distribution. They are, however, reasonably good fits to a censored normal distribution ReLU⁡(X)\operatorname{ReLU}(X), where X∼N(μ,Σ)X\sim\mathcal{N}(\mu,\Sigma) and ReLU⁡(X)i=max⁡(0,Xi)\operatorname{ReLU}(X)_{i}=\max(0,X_{i}). Using results of Rosenbaum (1961), it is straightforward to derive the mean and variance of ReLU⁡(X)\operatorname{ReLU}(X) (Sutherland, 2018), and hence to find the population value of FID⁡(ReLU⁡(X),ReLU⁡(Y))\operatorname{\mathit{FID}}(\operatorname{ReLU}(X),\operatorname{ReLU}(Y)).

Let d=2048d=2048, matching the Inception coding layer, and consider

This example thus gives a case where, for the dimension and sample sizes at which we actually apply the FID and for somewhat-realistic distributions, comparing two models based on their FID estimates will not only not reliably give the right ordering – with relatively close true values and high dimensions, this is not too surprising – but, more distressingly, will reliably give the wrong answer, with misleadingly small variance. This emphasizes that unbiased estimators, like the natural KID estimator, are important for model comparison.

D.3 Non-existence of an unbiased estimator

We can also show, using the reasoning of Bickel & Lehmann (1969) that we also employed in Theorem 3, that there is no estimator of the FID which is unbiased for all distributions.

This function R(α)R(\alpha) is therefore a polynomial in α\alpha of degree at most nn.

But let’s consider the following one-dimensional case:

Unfortunately, this type of analysis can tell us nothing about whether there exists an estimator which is unbiased on normal distributions. Given that the distributions used for the FID in practice are clearly not normal, however, a practical unbiased estimator of the FID is impossible.

Appendix E Comparison of evaluation metrics’ resilience to noise

We replicate here the experiments of Heusel et al.’s Appendix 1, which examines the behavior of the Inception and FID scores as images are increasingly “disturbed,” and additionally consider the KID. As the “disturbance level” α\alpha is increased, images are altered more from the reference distribution. Figures 6, 7, 8, 9, 10 and 11 show the FID, KID, and negative (for comparability) Inception score for both CelebA (left) and CIFAR-10 (right); each score is scaled to $$ to be plotted on one axis, with minimal and maximal values shown in the legend.

Note that Heusel et al. compared means and variances computed on 50 00050\,000 random disturbed CelebA images to those computed on the full 200 000200\,000 dataset; we instead use the standard train-test split, computing the disturbances on the 160 000160\,000-element training set and comparing to the 20 00020\,000-element test set. In this (very slightly) different setting, we find the Inception score to be monotonic with increasing noise on more of the disturbance types than did Heusel et al. (2017). We also found similar behavior on the CIFAR-10 dataset, again comparing the noised training set (size 50 00050\,000) to the test set (size 10 00010\,000). This perhaps means that the claimed non-monotonicity of the Inception score is quite sensitive to the exact experimental setting; further investigation into this phenomenon would be intriguing for future work.

Appendix F Samples and detailed results for MNIST and CIFAR-10

After training for 50 00050\,000 generator iterations, all variants achieved reasonable results. Among MMD models, only the distance kernel saw an improvement with more neurons in the top layer. Table 3 shows the quantitative measures, computed on the basis of a LeNet model. All have achieved KIDs of essentially zero, and FIDs around the same as that of the test set, with Inception scores slightly lower. Model samples are shown in Figure 12.

Examining samples during training, we observed that rbf more frequently produces extremely “blurry” outputs, which can persist for a substantial amount of time before eventually resolving. This makes sense, given the very fast gradient decay of the rbf kernel: when generator samples are extremely far away from the reference samples, slight improvements yield very little reward for the generator, and so bad samples can stay bad for a long time.

CIFAR-10

Scores for various models trained on CIFAR-10 are shown in Table 4. The scores for rq with a small critic network approximately match those of WGAN-GP with a large critic network, at substantially reduced computational cost. With a small critic, WGAN-GP, Cramér GAN and the distance kernel all performed very poorly. Samples from these models are presented in Figure 13.