How Well Can Generative Adversarial Networks Learn Densities: A Nonparametric View
Tengyuan Liang
Introduction
Generative Adversarial Networks (GANs) (Goodfellow et al., 2014; Li et al., 2015; Arjovsky et al., 2017; Dziugaite et al., 2015) have stood out as an important unsupervised method for learning and efficient sampling from a complicated, multi-modal target data distribution. Despite its celebrated empirical success in image tasks, there are many theoretical questions to be answered (Liu et al., 2017; Arora and Zhang, 2017; Arora et al., 2017a).
One convenient formulation of the GAN framework (Arjovsky et al., 2017; Li et al., 2015; Dziugaite et al., 2015; Liu et al., 2017) solves the following minimax problem, at the population level,
In plain language, given a target distribution , one seeks for a distribution from a probability distribution generator class , such that it minimizes the loss incurred by the best discriminator function inside the discriminator class . In practice, both the generator class and the discriminator class are represented by neural networks. quantifies the transformed distributions realized by a network with random inputs (either Gaussian or uniform distribution), and represents the functions that are realizable by a certain neural network architecture. We refer the readers to Liu et al. (2017) for other more general formulations of GANs.
Two fundamental yet basic questions that puzzle machine learning theorists are: (1) how well does GAN learn the densities statistically, overlooking the optimization difficulty? (2) how well does the iterative optimization dynamics of solving the minimax problem approximate the optimal solution?
In the statistics literature, density estimation has been a central topic in nonparametric statistics (Nemirovski, 2000; Tsybakov, 2009; Wassermann, 2006). The minimax optimal rate of convergence has been understood fairly well, for a wide range of density function classes quantified by its smoothness. We would like to point out a simple yet convincing connection between two fields: in nonparametric statistics, the model grows in size to accommodate the complexity of the data, which is reminiscent of the model complexity in GANs, and more generally in the deep neural networks.
Note the GAN framework mentioned above is flexible. Define the following metric induced by the function class ,
If contains all Lipschitz- functions, then is the Wasserstein-1 metric (Wasserstein-GAN (Arjovsky et al., 2017)). When represents all functions bounded by , then is the total variation metric (Radon metric). Let be a reproducing kernel Hilbert space (RKHS) and be its kernel. If consists of functions in the closure of the span of the set , then (MMD-GAN (Dziugaite et al., 2015; Li et al., 2015)).
Consider the density function that lies in Sobolev space with smoothness parameter
and the discriminator function class with smoothness . As varies, describes a wide range of nonparametric densities, and provides a rich hierarchy of critic metrics. Let be the sample size, be the dimension.
In contrast, as long as , the GAN estimator with empirical measure only achieves a considerably slower rate
Nonparametric estimation with GAN framework. The GAN framework for nonparametric density estimation enjoys the upper bound
One may wonder whether this rate can be significantly improved by other approaches. We show that for any procedure based on samples, the minimax lower bound under the metric reads
In the case when is large, the exponent in the upper bound and the minimax lower bounds are very close to each other, in the sense that .
In the case when both the generator and discriminator are realized by neural networks. We establish the following results using the insights gained from above.
Networks can learn densities. We make progress on answering how well generative adversarial networks learn nonparametric densities with smoothness parameter , under the Wasserstein metric.
In addition, for all estimators based on samples, the minimax rate cannot be smaller than
Here are constants independent of . Note that by Yarotsky (2017), one can approximate within accuracy by ReLU networks with depth and units for integer . The formal and more general statment can be found in Thm. 3.1.
2 Preliminaries
For integer , define the Sobolev space ()
where is a multi-index and denotes the -weak derivative.
Another equivalent definition of Sobolev space for is through the coefficients of the generalized Fourier series, which is also referred to as the Sobolev ellipsoid.
A nonparametric view of the GAN framework
The following oracle inequality holds for GAN.
Let be any critic function class. Denote as the solution (w.r.t. the empirical estimate ) to GAN with generator and discriminator
Then the following decompositions hold for any distribution ,
Let’s remark on the decompositions. Eqn. (2.1) use as the objective evaluation metric. The first term is the best approximation error within the generator class, even if we have population access to the true measure . The second term is the statistical error, also called the generalization error, due to the fact that we have only finite -samples. Eqn. (2.2) employs a different as the objective metric, while using the mis-matched discriminator class in the GAN procedure. The first term describes the approximation error induced by the generator, the second term corresponds to how well the discriminator serves as a surrogate for the objective metric, and the third term is the statistical error.
Using the above theorem, choose as the critic metric, we need to study the excess loss
We will start with a crude bound when is chosen as the empirical density. It turns out that one can significantly improve this bound through choosing a better “regularized” or “smoothed” version of empirical measure, in the context of learning nonparametric densities. The empirical measure is not optimal because one can leverage the complexity/smoothness of the measure , and the complexity of to improve upon the generalization error.
2 Upper bound for arbitrary density
Take , then
Assuming , one has the standard entropy integral bound,
Plugging in the entropy estimate for various functional classes (Nickl and Pötscher (2007) and reference therein), one can easily derive the following corollary.
It is easy to see that overlooking the distributional information — by simply going through symmetrization and empirical processes theory — can lead to suboptimal result when the true density is smooth. Roughly speaking, the symmetrization approach treats the true density as a highly non-smooth one with (say the empirical density). Next, we will investigate how to improve GAN when the true density lies in Sobolev spaces .
3 Smoothness helps: improved upper bound for Sobolev spaces
Now we show that one can achieve faster rates in the GAN framework for density estimation, simultaneously leveraging the smoothness information in the density and the metric .
Consider the density function class that lies in Sobolev space with smoothness parameter , and the discriminator function class with smoothness ,
Theorem 2.1 tells us the rate of convergence satisfies the following upper bound
this nonparametric upper bound achieves a faster rate than the symmetrization bound which ignores the smoothness of the distribution. Remark in the real applications of GAN, the dimension is rather large (in images usually ), and is fairly small for a strong metric ( in Wasserstein GAN), so this condition is satisfied for any . In summary, we write out the explicit rate of convergence,
Let’s broaden the discussions slightly by considering different base measures beyond the Lebesgue measure, and the generalized Fourier basis. One can think of as the uniform measure on or the product Gaussian measure. An equivalent formulation of the GAN problem that translates learning a distribution to learning the importance score/density ratio function with respect to a base measure , can be viewed as
Assume the generalized Fourier basis are bounded . Consider the density function class with smoothness , and the discriminator function class with smoothness
4 Minimax lower bound
Can the rate obtained by GAN framework be significantly improved by any other procedure? We consider in this section the minimax lower bound for the intrinsic difficulty of nonparametric estimation under the GAN discriminator metric. Here we consider a nonparametric function estimation problem on the Sobolev ellipsoid , which is statistically equivalent to the density estimation problem over the Sobolev space asymptotically (Tsybakov, 2009). A separate lower bound for the density estimation within the smaller Hölder class is proved in Thm. 3.1.
Consider the function class with smoothness and the discriminator function class with smoothness
In the Gaussian sequence model (2.4), for any estimator ,
Let us compare our lower bound with the upper bound in Remark 2.1. When the generator function class is rich enough so that contains the , the upper bound becomes
Remark again, when take as a special case the base measure being uniform on , and are the usual Sobolev spaces. In the case when is large, the exponents in the upper and lower bounds are very close to each other, in the sense that .
How well networks learn densities
In this section, we answer in a quantitative way that when both the generator class and the discriminator class represented by deep ReLU networks are rich enough, one do learn the distribution. One can view our results as establishing rate of convergence and fundamental difficulty for learning the distribution under the GAN framework, for a wide range of densities with different smoothness properties. It builds a more detailed theory upon the seminal work of Goodfellow et al. (2014), where they proved that when sample sizes, generator sizes, and discriminator sizes are all infinite, one learns the distribution.
Let’s remark on the universal approximation property of deep networks first before introducing the result. It is well known that deep neural networks are universal approximators (Hornik et al., 1989). In particular, Yarotsky (2017) constructed a fixed ReLU network architecture, denoted as , that enjoys the following two properties:
It approximates all functions in in the following sense
It has depth at most and at most weights and computation units.
With the above in mind, we are ready to state the following theorem.
The discriminator network class can approximate the Sobolev space , in the sense that ;
The generator network class can approximate the Sobolev space , in the sense that for any true density , ;
The discriminator network class is not overly complex in the sense that . In other words, the weak derivatives are integrable and the function is bounded.
In addition, the minimax lower bound for any estimator based on samples satisfies,
Here are constants independent of .
Note the lower bound here is harder than that in Theorem 2.3 because: (1) the class is in fact Hölder (subset of the Sobolev), , (2) for density estimation directly.
Let us make few remarks on the objective metrics and rates here. When , the objective metric is equivalent to the Wasserstein- metric (Lemma 4.2). Therefore with properly chosen discriminator and generator network GAN enjoys the upper bound , while the minimax lower bound being . Consider the following two scenarios:
When the dimension is very large, for a fixed smoothness parameter , these two rates are very close. In this case, to obtain an -error in Wasserstein metric, GAN requires exponential number of samples (in dimension) , so does any other procedure as indicated by the lower bound.
When the the smoothness parameter scales with the dimension, say for some constant , then GAN only requires a polynomial number of samples . In the large dimension setting when , any other procedure will require at least as well.
Let us comment on the assumptions used in the theorem. We consider the function class realized by ReLU networks. Define and let’s choose .
The assumption A.1 on the discriminator network class can be realized by subsuming a specific fixed architecture (Yarotsky, 2017) as a subclass , where the network has depth , and weights and computational units. Roughly, this means that one may need a deep discriminator network (scales logarithmically with number of samples in depth, and polynomially in number of units) to recover the density in a strong sense such as under the Wasserstein metric.
The assumption A.2 on the generative network class can also be realized if we reformulate the GAN in an importance sampling way: given uniform samples , the generative network outputs a importance/density score realized by function realized by the network. Again, the deep network with depth and weights does the job. Note in practice, the generative network learns a transformation of with as the density, instead of assigning the importance score. We do acknowledge that learning the transformation mapping (represented by the network) from the input random measure to the target measure has computational advantage over the importance sampling approach. However, overlooking the computation, output an importance score is also plausible to learn a distribution theoretically.
The assumption A.3 can be relaxed. In fact, one can prove a variant of the theorem without assumption 3, in the sense
It formalizes the intuition that if we choose a too strict metric as the discriminator ( too rich), even though we are evaluating on a weaker metric (induced by a smaller function space ), there is a price to pay in the rates for choosing the overly complex space as discriminator.
2 Error rates for deeper ReLU discriminator networks
In the GAN formulation, the discriminator class is represented by functions realized by a neural network with a certain architecture. In this section, we will apply our theory to obtain bounds for a wide range of feed-forward multi-layer networks with ReLU activation as the discriminator metric.
Denote as the ReLU activation. Consider the following feed-forward multi-layer network:
There is constant such that for each unit in the network, the vector of weights associated with that unit has .
Mathematically, one can define the function class induced by the network through the recursive definition: , and for any ,
Let’s remark on how our bound improves upon what is known, and when one can improve GAN by using a better estimate than the empirical measure .
Recall the covering number bound (Thm. 14.17) for deeper networks in Anthony and Bartlett (2009), one knows that
More concretely, consider the following two extreme scenarios:
Technical Proofs
For any , we know that due to the optimality of GAN
where we use the following fact and
It is easy to bound the following using similar logic
This matches the best known bound as in Canas and Rosasco (2012) (Section 2.1.1).
Remark in addition that the parametric rate is inevitable, which can be easily seen from the Sudakov minoration,
where based on i.i.d. samples
For any (or equivalently ), we have
For the second term, the following inequality holds
Combining two terms, we have for any (or equivalently ),
And the optimal choice of . Note that this is a more aggressive smoothing scheme than classic nonparametric estimation with smoothness , due to the fact that we are utilizing the smoothness in the evaluation metric at the same time.
The proof uses the standard Fano’s inequality.
Assume that and suppose contains such that:
, for all and .
with and for .
Let’s construct a mixture of hypothesis on the function space , and a subset of discriminator functions in , such that the multiple testing problem among the mixture of hypothesis is hard, and thus the loss induced by the best discriminator among the subset provides a lower bound on the estimation rate. Let’s construct this mixture in the frequency domain. Choose to be determined later, denote the hypothesis class of interest to be
It is easy to verify that because for any , we have
Similarly, let’s consider
where denotes the Hamming distance between and on the hypercube . Now we need to construct a subset over the hypercube such that for any pairs , they are separated in terms of Hamming distance.
The Varshamov-Gilbert bound (Lemma 2.9 in Tsybakov (2009)) does the job. We know that there exist a subset such that ,
Now let’s calculate the probability distance induced by hypothesis and , for all to show that information theoretically, it is hard to distinguish the mixture of hypothesis. The following holds,
If we choose , we know
We outline the key steps of the proof. Due to the approximation property of the network class to , and to , we know that
because . Apply the oracle inequality (2.2), one has
Here the last step we use the following fact
Therefore for any ,
where the last line follows from Theorem 2.2. Combine with the approximation error, we reach
Under the assumption that , then
and . It is easy to verify (1) for some , and each element in the set is a valid density; (2) , as for any multi-index ,
To apply the Fano’s Lemma, let’s first show that the hypothesis are separated in the evaluation metric. Let’s use the same subset claimed by the Varshamov-Gilbert bound
In our case . For the loss function, any
Now let’s show that based i.i.d. data generated from density , it is hard to distinguish the hypothesis. Note that for , we know that . Therefore
Therefore if we choose , we know . Using the Fano’s Lemma, the lower bound for density estimation is of the order , as
Without loss of generality assume the function is differentiable. Then
Observe that . Then . For the other side of the inequality, , hence . ∎
Acknowledgement
The author thanks Sasha Rakhlin for helpful discussions.