Deep Generative Modeling on Limited Data with Regularization by Nontransferable Pre-trained Models

Yong Zhong   Hongtao Liu1   Xiaodong Liu  Fan Bao  Weiran Shen   Chongxuan Li2 
Gaoling School of AI, Renmin University of China, Beijing, China
Beijing Key Lab of Big Data Management and Analysis Methods, Beijing, China
Department of Computer Science Technology, Tsinghua University, Beijing, China
{yongzhong, ht6, xiaodong.liu}@ruc.edu.cn, bf19@mails.tsinghua.edu.cn,
{shenweiran, chongxuanli}@ruc.edu.cn
Equal contribution.Correspondence to Weiran Shen and Chongxuan Li.
1footnotemark: 1
2footnotemark: 2
Abstract

Deep generative models (DGMs) are data-eager. Essentially, it is because learning a complex model on limited data suffers from a large variance and easily overfits. Inspired by the bias-variance dilemma, we propose regularized deep generative model (Reg-DGM), which leverages a nontransferable pre-trained model to reduce the variance of generative modeling with limited data. Formally, Reg-DGM optimizes a weighted sum of a certain divergence between the data distribution and the DGM and the expectation of an energy function defined by the pre-trained model w.r.t. the DGM. Theoretically, we characterize the existence and uniqueness of the global minimum of Reg-DGM in the nonparametric setting and rigorously prove the statistical benefits of Reg-DGM w.r.t. the mean squared error and the expected risk in a simple yet representative Gaussian-fitting example. Empirically, it is quite flexible to specify the DGM and the pre-trained model in Reg-DGM. In particular, with a ResNet-18 classifier pre-trained on ImageNet and a data-dependent energy function, Reg-DGM consistently improves the generation performance of strong DGMs including StyleGAN2 and ADA on several benchmarks with limited data and achieves competitive results to the state-of-the-art methods.

1 Introduction

Deep generative models (DGMs) Kingma and Welling (2013); Goodfellow et al. (2014); Sohl-Dickstein et al. (2015); Van den Oord et al. (2016); Dinh et al. (2016); Hinton and Salakhutdinov (2006) employ neural networks to capture the underlying distribution of high-dimensional data and find applications in various learning tasks Kingma et al. (2014); Zhu et al. (2017); Hoogeboom et al. (2019); Razavi et al. (2019); Karras et al. (2020a); Ramesh et al. (2021, 2022); Ho et al. (2022). Such models are often data-eager  Li et al. (2021); Wang et al. (2018a); Karras et al. (2020a) due to the complex function classes. Recent work Wang et al. (2018a); Karras et al. (2020a) found that the classical variants of generative adversarial networks (GAN) Goodfellow et al. (2014); Karras et al. (2019, 2020b) produce poor samples with limited data. In principle, the problem is shared by other DGMs (e.g., Kingma and Welling (2013); Van Den Oord et al. (2017); Razavi et al. (2019)), and improving the sample efficiency is a common challenge.

The root cause of the problem is that learning a model in a complex class on limited data suffers from a large variance and easily overfits the training data Karras et al. (2020a); Mohri et al. (2018); Murphy (2012). To relieve the problem, previous work either employed sophisticated data augmentation strategies Karras et al. (2020a); Jiang et al. (2021), or designed new losses for the discriminator in GAN Cui et al. (2021); Yang et al. (2021), or transferred a pre-trained DGM Wang et al. (2018a); Noguchi and Harada (2019); Mo et al. (2020). In this paper, inspired by the bias-variance dilemma, we propose a complementary framework, regularized deep generative model (Reg-DGM), which leverages a pre-trained model to reduce the variance of training a DGM with limited data. The paper is organized as follows.

In Sec. 2, we formulate the objective function of Reg-DGM as the sum of a certain divergence between the data distribution and model distribution, and a regularization term weighted by a hyperparameter. The regularization term can be understood as the negative expected log-likelihood of an energy-based model, whose energy function is defined by a pre-trained model, w.r.t. the DGM. Intuitively, with an appropriate value of the weighting hyperparameter, Reg-DGM balances between the data distribution and the pre-trained model to achieve a better bias-variance trade-off with limited data.

In Sec. 3, we characterize the optimization behavior and statistical benefits of Reg-DGM in theory. On one hand, under mild regularity conditions, we prove the existence and uniqueness of the global minimum of the regularized optimization problem with the KL and JS divergence in the nonparametric setting. Besides, we show that the global minimum is in the form of a reweighted data distribution whose weights are determined by the pre-trained model. On the other hand, we construct a simple yet prototypical Gaussian-fitting example to compare the maximum likelihood estimation (MLE), the pre-trained model, and our approach under two common measures: the mean squared error and the expected risk. Our approach is provably the best under both measures, which quantifies the motivation of Reg-DGM and provides insights into the excellent performance of Reg-DGM in practice.

In Sec. 4, we specify the two components in Reg-DGM. On one hand, we employ strong variants of GAN Karras et al. (2020b, a) as the base DGM for broader interests. On the other hand, we consider a nontransferable setting where the pre-trained model does not necessarily have the same architecture or the same model formulation as the base DGM, or does not even have to be a generative model. Indeed, we adopt a feature extractor trained for classification by default, and the corresponding energy function is defined as the expected mean squared error between the features of the generated samples and training data. Notably, such a model cannot be directly used in the fine-tuning approaches Wang et al. (2018b); Mo et al. (2020).

In Sec. 5, we present experiments on several benchmarks, including the FFHQ Karras et al. (2019), LSUN CAT Yu et al. (2015), and CIFAR-10 Krizhevsky et al. (2009) datasets. We compare Reg-DGM with a large family of methods, including the base DGMs Karras et al. (2020b, a), the transfer-based approaches Wang et al. (2018b); Mo et al. (2020), the augmentation-based methods Karras et al. (2020a); Jiang et al. (2021); Zhao et al. (2020a) and others Cui et al. (2021); Yang et al. (2021). With a classifier pre-trained on ImageNet, Reg-DGM consistently improves the generation performance of strong DGMs Karras et al. (2020b, a) on several benchmarks with limited data and achieves competitive results to the state-of-the-art methods. Our results demonstrate that Reg-DGM can achieve a good bias-variance trade-off in practice, which agrees with our intuition and theory.

In Sec. 6, we present more related work. In Sec. 7, we conclude the paper and discuss limitations as well as potential future work.

2 Method

The goal of (deep) generative modeling is to learn an (implicit or explicit) model distribution over the sample space from a training set of size . The elements in are assumed drawn i.i.d. according to an unknown data distribution , where is the set of all valid distributions over . A general formulation for generative models is to minimize a certain divergence between the two distributions as follows:

(1)

where is some function class such as neural networks in deep generative models Kingma and Welling (2013); Goodfellow et al. (2014); Sohl-Dickstein et al. (2015); Van den Oord et al. (2016); Dinh et al. (2016); Hinton and Salakhutdinov (2006). The objective in Eq. (1) is often estimated over the training set because is unknown.

We consider a challenging problem in this paper: learning a deep generative model (DGM) with limited data Karras et al. (2020a). Complementary to existing augmentation-based methods Karras et al. (2020a); Jiang et al. (2021), we propose to leverage an external model pre-trained on a related and potentially large dataset (e.g., ImageNet Deng et al. (2009)) to reduce the variance of the DGMs on limited data (e.g., CIFAR-10 Krizhevsky et al. (2009)). A classical way to leverage the pre-trained models is fine-tuning Wang et al. (2018b); Mo et al. (2020), which (partially) uses the pre-trained model to initialize the generative model and hence restricts the model families of both and .

In contrast, we focus on a nontransferable setting, where the pre-trained model does not necessarily have the same architecture or the same model formulation as or does not even have to be a generative model. In particular, we can employ a pre-trained model in an arbitrary form as long as we can define a real-valued function satisfying mild regularity conditions 111We assume that and Assumption 3.1 holds.. Given the function, we simply optimize a weighted sum of a statistical divergence as in the original DGM and the expectation of the function under the model distribution as follows:

(2)

where is the weighting hyperparameter balancing the two terms. Similarly to the base DGM, Eq. (2) can be estimated over the training set , as presented in Sec. 4. We refer to our approach as regularized deep generative model (Reg-DGM) when consists of neural networks.

Notably, we could employ a more general functional of and as the regularization term while we focus on the specific one in Eq. (2) for two reasons. On one hand, we can treat as an energy function LeCun et al. (2006), which defines a probability distribution . Therefore, the regularization term in Eq. (2) can be explained as the expected negative log-likelihood of :

(3)

where means equality up to an additive constant irrelevant to the optimization of . Intuitively, the regularization term encourages to produce “good” samples in the eye of an energy-based model defined by the pre-trained models. On the other hand, with such a regularization term, Reg-DGM enjoys nice convergence properties in the nonparametric setting and provable statistical benefits in a representative Gaussian-fitting example, as detailed in Sec. 3.

3 Analyses

Before going into details of the implementation, we first investigate some natural and fundamental problems about optimization and statistical benefits of our approach:

  1. In the nonparametric setting, whether a global optimum exists for the problem (2)? If it exists, is it unique and how does it balance the pre-trained model and the data?

  2. Why and when is our approach provably better than the original divergence minimization as well as the pre-trained model w.r.t. common measures in statistics and learning theory?

For clarity, we only present the assumptions and main results in this section and refer the readers to Appendix A for complete proof of all results.

3.1 Optimization Analyses in the Nonparametric Setting

Similarly to the original GAN Goodfellow et al. (2014), we first analyze the optimization of Eq. (2) in the nonparametric setting, i.e. . Our results rely on the following regularity conditions.

Assumption 3.1.

1. is a nonempty compact set. 2. is continuous and bounded.

Remark.

The regularity conditions in Assumption 3.1 are mild in the sense:

  1. The sample space is often a subset of a -dimensional Euclidean space. Then, is compact if and only if is bounded and closed, which holds for extensive datasets in various types including images, videos, audios, and texts.

  2. In this paper, is defined by compositing a neural network and a continuous real-valued function. Then is continuous and bounded on if the neural network has bounded weights and uses continuous activation functions including ReLU Nair and Hinton (2010), Tanh and Sigmoid.

Data distribution
(a) Data distribution
Energy function
(b) Energy function
Varying
(c) Varying (KLD)
Varying
(d) Varying (JSD)
Figure 1: Illustration of the optimization analyses. (a) The density of the data distribution. (b) The energy function defined by the pre-trained model. (c) The global minimum of problem (2) with the KL divergence (KLD) and different values of . (d) The global minimum of problem (2) with the JS divergence (JSD) and different values of . See more details in Appendix B.1.

Built upon the classical recipe of the calculus of variations and properties of the KL divergence in the topology of weak convergence, we establish our theory on the existence and uniqueness of the global minimum of problem (2) with the KL and JS divergence.222We consider the two divergences because they are employed in the two representative DGMs: VAE and GAN. The results are formally characterized in the following Theorem 3.2 and Theorem 3.3 respectively.

Theorem 3.2.

Under Assumption 3.1, for any , there exists a unique global minimum of the problem in Eq. (2) with the KL divergence. Further, the global minimum is in the form of , where .

Theorem 3.3.

Under Assumption 3.1, for any , there exists a unique global minimum of the problem in Eq. (2) with the JS divergence. Further, the global minimum is in the form of , where .

As shown in Theorem 3.2 and Theorem 3.3, the global minimum is in the form of reweighted data distribution and the weights are negatively correlated to the energy function defined by the pre-trained model. Qualitatively, the global minimum assigns high density for a sample if it has high density under the data distribution (i.e. ) and low value of the energy function (i.e., ) (see Fig. 1 for an illustration). Naturally, as , the denominator of tends to a constant and , which recovers the solution of pure divergence minimization in Eq. (1).

Notably, the weights in Theorem 3.2 and Theorem 3.3 are different because of the different divergences. In particular, the effect of the pretrained model is enlarged by the exponential term in Theorem 3.3 using JSD. Fig. 1 (c) and (d) show that with the same value of , the weighting coefficients of JSD are distributed in a larger range than KLD.

We also analyze the convergence of Reg-DGM trained by (stochastic) gradient descent upon the convergence theory for deep learning Allen-Zhu et al. (2019). In particular, we show that under standard and verifiable smoothness assumptions, with a high probability, Reg-DGM with a sufficiently wide ReLU CNN converges to a global optimum (of the empirical risk) trained by GD and converges to a local minimum trained by SGD. The assumptions and results are formally presented in Appendix A.3.

3.2 Statistical Benefits When the Sample Size Is Small

In the rest of the section, we analyze when and why our approach is statistically preferable given a small sample size. On one hand, the solution of pure divergence minimization typically has a low bias while can be of large variance especially when the sample size is small. On the other hand, we can also treat the pre-trained model as a baseline estimator since it defines an energy-based model. The pre-trained model may have a large bias but it is of zero variance. In comparison, our approach conjoins the two worlds with the additional flexibility of choosing and thus can achieve a better bias-variance trade-off than the two baselines. To formalize the idea, we conduct a simple yet prototypical Gaussian-fitting example as follows.

Example 3.4 (Gaussian-fitting example).

The data distribution is a (univariate) Gaussian with density function , where is known and is the parameter to be estimated. A training sample is drawn i.i.d. according to . The hypothesis class for is . The regularization term in Eq. (2) is , where , i.e., the pre-trained model defines a distribution where follows .

For simplicity, we consider the maximum likelihood estimation (MLE) (i.e. using the KL divergence in Eq.(1)333The analyses can be extended to the JS divergence case.) as the baseline, and its solution for Example 3.4 is given by the sample mean Bishop and Nasrabadi (2006):

(4)

The pre-trained model is another meaningful baseline for our approach. Clearly, it has a bias of and a zero variance. The following Lemma 3.5 characterizes the solution of our approach.

Lemma 3.5.

In the Gaussian-fitting example 3.4, the solution of our approach based on MLE is

(5)

The solutions of all estimators in the Gaussian-fitting example quantify the intuition of why our approach is preferable: the MLE has a bias of zero while a potentially large variance; the pre-trained model has a variance of zero while a potentially large bias. In contrast, our approach balances the bias and variance by the hyperparameter . Below, we show that our approach is provably better than the baselines if is properly selected under common measures in statistics and learning theory.

We first compare all estimators in terms of the mean squared error (MSE). The MSE of an estimator w.r.t. an unknown parameter is defined as: which can be decomposed as the sum of the variance of the estimator and the squared bias of the estimator. Namely,  Bishop and Nasrabadi (2006). As shown in Theorem 3.6, our approach provides a better bias-variance trade-off than both the MLE and the pre-trained model if is within an appropriate range.

Theorem 3.6.

Let be the normalized weight of the regularization term. In the Gaussian-fitting example 3.4, if 444Note that always holds., then the following inequality holds:

(6)

The optimal value of is . The corresponding is and the corresponding MSE of our approach is .

Varying
(a) Varying
Varying
(b) Varying
Varying
(c) Varying
Figure 2: MSE in the Gaussian-fitting example to validate Theorem 3.6. (a) The effect of the sample size . The gap between ours and MLE gets large when becomes small. (b) The effect of the bias of the pre-trained model. In both (a) and (b), the hyperparameter is optimal. (c) The effect of given a fixed and . See more details in Appendix B.1. Best view in color.

We plot the MSE in Fig. 2 for a clear and straightforward comparison of the estimators. We also evaluate all estimators in terms of the expected risk, which is a commonly used measure in statistical learning theory. In a density estimation task for , the expected risk of a hypothesis , which depends on the training sample , is . We can show that the expectation of the expected risk w.r.t. coincides with the corresponding MSE in the Gaussian-fitting example and directly obtain the following Corollary 3.6.1 from Theorem 3.6.

Corollary 3.6.1.

In the Gaussian-fitting example 3.4, if satisfies the same condition as in Theorem 3.6, then the following inequality holds:

(7)

Limitations and insights of the Gaussian Example. In the Gaussian-fitting example, the hypothesis class is simple and the MSE and expected risk have analytic forms. Given the fact that the generalization analysis in deep learning is still largely open Belkin (2021); Bartlett et al. (2021) and therefore currently it lacks the tools to generalize our Corollary 3.6.1 to the context of deep learning. Despite the simpleness, the analyses inspire a data-dependent energy function presented in Sec. 4 and provide insights into the excellent performance of Reg-DGM in Sec. 5. We believe that our attempt to solve this problem with insights from a bias-variance trade-off perspective is meaningful and can benefit this area because existing methods in this area are mainly empirical.

4 Implementation

In the section, we specify the formulation of the base model, the pre-trained model, and the energy function. The readers can refer to Appendix B.2 and the source code for more details.

4.1 Base Models

Although Reg-DGM applies to other models like variational auto-encoders (VAE) Kingma and Welling (2013); Van Den Oord et al. (2017); Razavi et al. (2019), we focus on generative adversarial networks (GAN) Goodfellow et al. (2014), which is most representative and widely used in the scenarios with limited data.

GAN optimizes an estimate of the JS divergence via a minimax formulation as follows:

(8)

where is a generator that defines and is a discriminator that estimates the JS divergence by discriminating samples. Both and are parameterized by neural networks and Eq. (8) is estimated by the Monte Carlo method over mini-batches sampled from the training set. For a broader interest, we adopt three strong variants, StyleGAN2 Karras et al. (2020b) and ADA Karras et al. (2020a), as the base DGMs.

4.2 Pre-trained models and Energy Functions

We consider a nontransferable setting where the pre-trained model does not necessarily have the same architecture or the same formulation as or does not even have to be a generative model. In particular, we investigate two prototypical cases and design the corresponding regularization term. Recall that we treat the regularization term as the energy function of an EBM in Eq. (3).

In the first case, the pre-trained model outputs the log density of a pre-trained DGM (e.g., VAE), then a natural choice of the energy function is

(9)

which encourages to produce samples of high likelihood in the eye of the pre-trained DGM.

In the second case, the pre-trained model is a feature extractor (of output dimension ) trained for other tasks (e.g., classification) instead of generation. The energy function is defined by the expected mean squared error between the features of a generated sample and a training sample as follows:

(10)

which forces to produce samples whose features are similar to the features of the training data in expectation. Note that both the convergence analyses in a non-parametric setting as in Theorem 3.3 and the non-convex optimization setting as in Appendix A.3 allows a data-dependent energy as presented in Eq. (10). The expectation is estimated by the Monte Carlo method of a single sample for efficiency by default and increasing the number of samples won’t affect the performance significantly (see results in Appendix C.4). Throughout the experiment, we focus on the second case by default. Note that such models are nontransferable in the fine-tuning manner Hinton et al. (2006). Nevertheless, Reg-DGM is still competitive with the transfer-based approaches Wang et al. (2018b); Mo et al. (2020) as shown in Tab. 1.

Choice of the energy function. We mention that there are many alternative energy functions can be employed in Reg-DGM. Intuitively, as suggested in Theorem 3.6, Reg-DGM benefits if the EBM is close to the target distribution . Therefore, if is pretrained on a dataset of much richer semantics (e.g., ImageNet) than (e.g., images of faces), the it is crucial to involve training data in the energy like Eq. (10) to making the EBM closer to . We provide additional results of the feature matching regularization Salimans et al. (2016) and entropy regularization Grandvalet and Bengio (2004), which are worse than Eq. (10) either qualitatively or quantitatively. See details in Appendix C.4.

Currently, both evaluating DGMs empirically and quantifying the generalization of a deep model theoretically are largely open problems. Therefore, it lacks principled tools to compare the energy functions and pretrained models. Nevertheless, we evaluate Eq. (10) with strong baselines Karras et al. (2020a) and different datasets in Table 1. Further, we also perform a comprehensive study of with different backbones, different pretrained datasets, different layers and random weights without training in Appendix C.4. We observe a consistent improvement over the baseline using Eq. (10) and therefore it is relatively safe to say our implementation provides a promising option in a new setting.

Method FFHQ LSUN CAT CIFAR-
k k k k k
Transfer Wang et al. (2018a)
Freeze-D Mo et al. (2020)
DA Zhao et al. (2020a)
InsGen Yang et al. (2021)
GenCo Cui et al. (2021)
DA + GenCo Cui et al. (2021)
ADA + bCR Zhao et al. (2020b)
 Tseng et al. (2021)
ADA +  Tseng et al. (2021)
APA Jiang et al. (2021)
StyleGAN2 Karras et al. (2020b)
Reg-StyleGAN2 (ours)
ADA Karras et al. (2020a)
Reg-ADA (ours)
ADA + APA  Jiang et al. (2021)
Reg-ADA-APA (ours)
Table 1: Following the direct competitor Karras et al. (2020a), we report the median FID on FFHQ and LSUN CAT and the mean FID on CIFAR-10 out of 3 runs for a fair comparison. indicates that the results are taken from corresponding references and indicates that the results are taken from Karras et al. (2020a). Otherwise, the results are reproduced by us upon the official implementation of Karras et al. (2020a) and  Jiang et al. (2021). indicates that the backbone used by the corresponding method is BigGAN Brock et al. (2018) instead of StyleGAN2 Karras et al. (2020b).

5 Experiments

We evaluate Reg-DGM on several benchmarks with limited data Karras et al. (2020a), including the FFHQ Karras et al. (2019), LSUN CAT Yu et al. (2015), and CIFAR-10 Krizhevsky et al. (2009) datasets. We present the main results and analyses in the section and refer the readers to Appendix B.2 for experimental details and Appendix C for additional results. We submit the source code in the supplementary material and we will release it after the blind review. Throughout the section, we refer to our approach as the name of the base DGM with the prefix “Reg-”. For instance, “Reg-ADA” denotes our approach with ADA Karras et al. (2020a) as the base DGM.

5.1 Benchmark Results with Limited Data

We employ StyleGAN2 Karras et al. (2020b) and ADA Karras et al. (2020a) as the base DGM and a ResNet-18 He et al. (2015) classifier trained on ImageNet Deng et al. (2009) as the pre-trained model. The associated energy function is defined in Eq. (10).

Quantitatively, we compare Reg-DGM with a large family of methods, including the base DGMs Karras et al. (2020b, a), the transfer-based approach Wang et al. (2018b); Mo et al. (2020), the augmentation-based methods Karras et al. (2020a); Jiang et al. (2021) and others Cui et al. (2021); Yang et al. (2021). Following the most direct and strong competitor Karras et al. (2020a), we report the median FID Heusel et al. (2017) on FFHQ and LSUN CAT, and the mean FID on CIFAR-10 out of 3 runs for a fair comparison in Tab. 1. For completeness, we also report the mean FID with the standard deviation on FFHQ and LSUN CAT in Appendix C.2.

As shown in Tab. 1, both Reg-StyleGAN2 and Reg-ADA consistently outperform the corresponding base DGM in five settings, demonstrating that Reg-DGM can achieve a good bias-variance trade-off in practice, which agrees with our intuition and theory. Besides, the superior performance of Reg-ADA over ADA shows that our contribution is orthogonal to the augmentation-based approaches and we believe the results can be further improved upon Jiang et al. (2021). Notably, the improvement of Reg-DGM over the base DGM is more substantial when the sample size gets smaller. This is as expected because as suggested in Theorem 3.6, the ratio between and decreases as increases given a fixed pre-trained model and the optimal (see Fig. 2 (a)). A similar argument holds under the measure of the expected risk according to Corollary 3.6.1.

We mention that the methods based on fine-tuning Wang et al. (2018a); Mo et al. (2020) in Tab. 1 employ a GAN pre-trained on CelebA-HQ Karras et al. (2017), which is also a face dataset of the same resolution as FFHQ. In comparison, our approach is built upon a classifier pertained on ImageNet. As highlighted in Wang et al. (2018a), the density of the pre-trained dataset is more important than the diversity. Nevertheless, Reg-DGM is competitive with these strong baselines while enjoying the flexibility of choosing the pre-trained model and dataset. Further, we directly adopt the same pre-trained model across all datasets including CIFAR-10, where it takes additional efforts to get a suitable pre-trained model to fine-tune. Based on the results, it is safe to emphasize the complementary role of Reg-DGM to the approaches based on fine-tuning.

Qualitatively, we show the samples generated from the base DGMs Karras et al. (2019, 2020a) and our Reg-DGM on FFHQ-k and Obama- in Fig. 3. It can be seen that with the regularization, our approach can produce faces of a normal shape. For completeness, we attempt to get samples from the EBM defined by the pre-trained model via Langevin dynamics but cannot get a reasonable result. See more details in Sec. 5.2. We present more sampling results in Appendix C.3.

We plot the learning curves of our Reg-DGM and the base DGM on all datasets in Appendix C.1 and perform an ablation study on the architecture of the classifier and the form of the energy function in Appendix C.4.

Obama-100 (FID
(a) Obama-100 (FID )
FFHQ-
(b) FFHQ-k (FID )
Figure 3: Samples from the Reg-ADA, truncated () as in Karras et al. (2020a).

5.2 Sensitivity Analysis of the Weighting Hyperparameter

As suggested in Theorem 3.6 and Corollary 3.6.1, the value of the weighting hyperparameter is crucial for the performance of Reg-DGM and there is an appropriate range of such that Reg-DGM is more preferable than the base model.

We empirically validate the argument on FFHQ-k with StyleGAN2 as the base model in Tab. 2. It can be seen that affects the performance significantly. Notably, although it is nearly impossible to get the optimal via grid search, there is a range of (e.g. in Tab. 2) such that Reg-DGM outperforms the base DGM, which agrees with our theoretical analyses. Besides, Reg-DGM is not too sensitive when the value of is around the optimum. For instance, the gap between the results of and in Tab. 2 is much smaller than their gain compared to the baseline.

The performance of Reg-DGM deteriorates with a large lambda in Tab. 2 as expected. Theorem 3.6 shows that Reg-DGM is preferable if and only if the value of lambda is in a proper interval. Intuitively, a very large lambda means that we almost ignore the training data, which should lead to inferior performance.

6 Related Work

Values of (baseline)
FID
Table 2: Sensitivity analysis of on FFHQ-k with StyleGAN2 Karras et al. (2020b) as the base DGM (corresponds to ). There is a large range of such that Reg-DGM outperforms the baseline.

Fine-tuning approaches. A milestone of deep learning is that a deep generative model fine-tuned for classification outperforms the classical SVM on recognizing the hand-writing digits Hinton et al. (2006). Since then, the idea of fine-tuning has a significant impact Devlin et al. (2018); He et al. (2020) including generative models with limited data Wang et al. (2018b); Mo et al. (2020); Wang et al. (2020); Li et al. (2020); Ojha et al. (2021). However, an inherent restriction of fine-tuning is that the pre-trained model and target model should partially share a common structure. Thus, it may take additional efforts to find a suitable pre-trained model to fine-tune. In comparison, Reg-DGM provides an alternative way to make it possible to exploit a pre-trained classifier to help generative modeling. Notably, the latter is often thought of as much harder than the former.

Other generative adversarial networks with limited data. To relieve the overfitting problem of the discriminator, DA  Zhao et al. (2020a), ADA Karras et al. (2020a) and APA Jiang et al. (2021) design sophisticated data augmentation strategies. GenCo Cui et al. (2021) designs a co-training framework that introduces multiple complimentary discriminators. InsGen Yang et al. (2021) improves the data efficiency of GAN via an instance discrimination loss Wu et al. (2018). We believe that Reg-DGM is orthogonal to these methods based on our results in Tab. 1.

Regularization in probabilistic models. Extensive regularization approaches have been developed in traditional Bayesian inference Zhu et al. (2014) and probabilistic modeling Chang et al. (2007); Liang et al. (2009); Ganchev et al. (2010). Among them, posterior regularization (PR) Ganchev et al. (2010) is representative. PR encodes the human knowledge about the task as linear constraints of the latent representations in generative models for better inference performance. Such methods have been extended to deep generative models Hu et al. (2018); Du et al. (2018); Shu et al. (2018); Xu et al. (2019) for a similar reason. Technically, PR-based methods regularize the latent space via handcrafted or jointly trained constraints. In comparison, our approach regularizes the data space via a pre-trained model in the perspective of the bias-variance dilemma. Besides, PR-based methods are suitable for structured prediction tasks instead of generative modeling with limited data, which is the main focus of this paper.

7 Conclusions and Discussions

In this paper, we propose regularized deep generative model (Reg-DGM), which leverages a pre-trained model for regularization to reduce the variance of deep generative modeling with limited data. The regularization is defined by the negative expected log-likelihood of an energy-based model, whose energy function is defined by the pre-trained model. Theoretically, we characterize the existence and uniqueness of the global minimum of Reg-DGM in the nonparametric setting and rigorously prove that Reg-DGM can achieve a better bias-variance trade-off in a simple yet representative Gaussian-fitting example. Empirically, with a classifier pre-trained on ImageNet and a data-dependent energy function, Reg-DGM consistently improves the generation performance of strong DGMs on several benchmarks and achieves competitive results to the state-of-the-art methods.

An interesting future work is to analyze the generalization behaviour of Reg-DGM in general and inspire new energy functions. Currently, the generalization analysis of deep learning is still largely open Zhang et al. (2021); Bartlett et al. (2021); Belkin (2021), and there lacks a tool to formalize our intuition on the bias-variance trade-off in general.

Social Impact: This work presents a framework to train deep generative models on small data. By improving the data efficiency, it can potentially benefit real-world applications like medicine analysis and automatic drive. However, this work can have negative consequences in the form of “DeepFakes”, as existing GANs. It is worth noting that this work may exacerbate such issues by improving the data efficiency of GANs. How to detect “DeepFakes” is an active research area in machine learning, which aims to relieve the problem.

Acknowledgement

We thank Guoqiang Wu for helpful discussions about the generalization analysis. This work was supported by NSF of China (NO. 62076145); Beijing Outstanding Young Scientist Program (NO. BJJWZYJH012019100020098); Major Innovation & Planning Interdisciplinary Platform for the “Double-First Class" Initiative, Renmin University of China; the Fundamental Research Funds for the Central Universities, and the Research Funds of Renmin University of China (22XNKJ13). Part of the computing resources supporting this work, totaled 720 A100 GPU hours, were provided by High-Flyer AI. (Hangzhou High-Flyer AI Fundamental Research Co., Ltd.).

References

  • [1] G. Ajjanagadde, A. Makur, J. Klusowski, S. Xu, et al. (2017) Lecture notes on information theory. Lab. Inf. Decis. Syst., Massachusetts Inst. Technol., Cambridge, MA, USA, Tech. Rep. Cited by: §A.1.
  • [2] Z. Allen-Zhu, Y. Li, and Z. Song (2019) A convergence theory for deep learning via over-parameterization. In International Conference on Machine Learning, pp. 242–252. Cited by: §A.3, Theorem A.1, §3.1, footnote 5.
  • [3] P. L. Bartlett, A. Montanari, and A. Rakhlin (2021) Deep learning: a statistical viewpoint. Acta numerica 30, pp. 87–201. Cited by: §3.2, §7.
  • [4] M. Belkin (2021) Fit without fear: remarkable mathematical phenomena of deep learning through the prism of interpolation. Acta Numerica 30, pp. 203–248. Cited by: §3.2, §7.
  • [5] P. Billingsley (2013) Convergence of probability measures. John Wiley & Sons. Cited by: §A.2.
  • [6] C. M. Bishop and N. M. Nasrabadi (2006) Pattern recognition and machine learning. Vol. 4, Springer. Cited by: §A.4, §3.2, §3.2.
  • [7] A. Brock, J. Donahue, and K. Simonyan (2018) Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096. Cited by: Table 1.
  • [8] Q. Cao, L. Shen, W. Xie, O. M. Parkhi, and A. Zisserman (2018) Vggface2: a dataset for recognising faces across pose and age. In 2018 13th IEEE international conference on automatic face & gesture recognition (FG 2018), pp. 67–74. Cited by: §C.4.
  • [9] M. Chang, L. Ratinov, and D. Roth (2007) Guiding semi-supervision with constraint-driven learning. In Proceedings of the 45th annual meeting of the association of computational linguistics, pp. 280–287. Cited by: §6.
  • [10] K. Cui, J. Huang, Z. Luo, G. Zhang, F. Zhan, and S. Lu (2021) GenCo: generative co-training for generative adversarial networks with limited data. arXiv preprint arXiv:2110.01254. Cited by: §1, §1, Table 1, §5.1, §6.
  • [11] J. Deng, W. Dong, R. Socher, L. Li, K. Li, and L. Fei-Fei (2009) Imagenet: a large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Cited by: §2, §5.1.
  • [12] J. Devlin, M. Chang, K. Lee, and K. Toutanova (2018) Bert: pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805. Cited by: §6.
  • [13] L. Dinh, J. Sohl-Dickstein, and S. Bengio (2016) Density estimation using real nvp. arXiv preprint arXiv:1605.08803. Cited by: §1, §2.
  • [14] C. Du, K. Xu, C. Li, J. Zhu, and B. Zhang (2018) Learning implicit generative models by teaching explicit ones. arXiv preprint arXiv:1807.03870. Cited by: §6.
  • [15] K. Ganchev, J. Graça, J. Gillenwater, and B. Taskar (2010) Posterior regularization for structured latent variable models. The Journal of Machine Learning Research 11, pp. 2001–2049. Cited by: §6.
  • [16] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio (2014) Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680. Cited by: §1, §2, §3.1, §4.1.
  • [17] Y. Grandvalet and Y. Bengio (2004) Semi-supervised learning by entropy minimization. Advances in neural information processing systems 17. Cited by: §C.4, §4.2.
  • [18] K. He, H. Fan, Y. Wu, S. Xie, and R. Girshick (2020) Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9729–9738. Cited by: §6.
  • [19] K. He, X. Zhang, S. Ren, and J. Sun (2015) Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385. Cited by: §5.1.
  • [20] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter (2017) Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems 30. Cited by: §B.2, §5.1.
  • [21] G. E. Hinton, S. Osindero, and Y. Teh (2006) A fast learning algorithm for deep belief nets. Neural computation 18 (7), pp. 1527–1554. Cited by: §4.2, §6.
  • [22] G. E. Hinton and R. R. Salakhutdinov (2006) Reducing the dimensionality of data with neural networks. science 313 (5786), pp. 504–507. Cited by: §1, §2.
  • [23] J. Ho, T. Salimans, A. Gritsenko, W. Chan, M. Norouzi, and D. J. Fleet (2022) Video diffusion models. arXiv preprint arXiv:2204.03458. Cited by: §1.
  • [24] E. Hoogeboom, J. Peters, R. Van Den Berg, and M. Welling (2019) Integer discrete flows and lossless compression. Advances in Neural Information Processing Systems 32. Cited by: §1.
  • [25] Z. Hu, Z. Yang, R. R. Salakhutdinov, L. Qin, X. Liang, H. Dong, and E. P. Xing (2018) Deep generative models with learnable knowledge constraints. Advances in Neural Information Processing Systems 31. Cited by: §6.
  • [26] L. Jiang, B. Dai, W. Wu, and C. C. Loy (2021) Deceive d: adaptive pseudo augmentation for gan training with limited data. Advances in Neural Information Processing Systems 34. Cited by: Table 3, §1, §1, §2, Table 1, §5.1, §5.1, §6.
  • [27] T. Karras, T. Aila, S. Laine, and J. Lehtinen (2017) Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196. Cited by: §5.1.
  • [28] T. Karras, M. Aittala, J. Hellsten, S. Laine, J. Lehtinen, and T. Aila (2020) Training generative adversarial networks with limited data. Advances in Neural Information Processing Systems 33, pp. 12104–12114. Cited by: §B.2, §B.2, §B.2, §B.2, Table 3, §C.3, Table 4, §1, §1, §1, §1, §2, §4.1, §4.2, Table 1, Figure 3, §5.1, §5.1, §5.1, §5, §6.
  • [29] T. Karras, S. Laine, and T. Aila (2019) A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4401–4410. Cited by: §B.2, §1, §1, §5.1, §5.
  • [30] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila (2020) Analyzing and improving the image quality of stylegan. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8110–8119. Cited by: §B.2, Table 3, Table 4, Table 5, §1, §1, §1, §4.1, Table 1, §5.1, §5.1, Table 2.
  • [31] D. P. Kingma and M. Welling (2013) Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114. Cited by: §1, §2, §4.1.
  • [32] D. P. Kingma, S. Mohamed, D. J. Rezende, and M. Welling (2014) Semi-supervised learning with deep generative models. In Advances in neural information processing systems, pp. 3581–3589. Cited by: §1.
  • [33] A. Krizhevsky, G. Hinton, et al. (2009) Learning multiple layers of features from tiny images. Cited by: §B.2, §1, §2, §5.
  • [34] Y. LeCun, S. Chopra, R. Hadsell, M. Ranzato, and F. Huang (2006) A tutorial on energy-based learning. Predicting structured data 1 (0). Cited by: §2.
  • [35] C. Li, K. Xu, J. Zhu, J. Liu, and B. Zhang (2021) Triple generative adversarial networks. IEEE Transactions on Pattern Analysis and Machine Intelligence. Cited by: §1.
  • [36] Y. Li, R. Zhang, J. Lu, and E. Shechtman (2020) Few-shot image generation with elastic weight consolidation. arXiv preprint arXiv:2012.02780. Cited by: §6.
  • [37] P. Liang, M. I. Jordan, and D. Klein (2009) Learning from measurements in exponential families. In Proceedings of the 26th annual international conference on machine learning, pp. 641–648. Cited by: §6.
  • [38] S. Mo, M. Cho, and J. Shin (2020) Freeze the discriminator: a simple baseline for fine-tuning gans. arXiv preprint arXiv:2002.10964. Cited by: §1, §1, §1, §2, §4.2, Table 1, §5.1, §5.1, §6.
  • [39] M. Mohri, A. Rostamizadeh, and A. Talwalkar (2018) Foundations of machine learning. MIT press. Cited by: §1.
  • [40] K. P. Murphy (2012) Machine learning: a probabilistic perspective. MIT press. Cited by: §1.
  • [41] V. Nair and G. E. Hinton (2010) Rectified linear units improve restricted boltzmann machines. In Icml, Cited by: item 2.
  • [42] A. Noguchi and T. Harada (2019) Image generation from small datasets via batch statistics adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2750–2758. Cited by: §1.
  • [43] U. Ojha, Y. Li, J. Lu, A. A. Efros, Y. J. Lee, E. Shechtman, and R. Zhang (2021) Few-shot image generation via cross-domain correspondence. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10743–10752. Cited by: §6.
  • [44] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, et al. (2021) Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748–8763. Cited by: §C.4.
  • [45] A. Ramesh, P. Dhariwal, A. Nichol, C. Chu, and M. Chen (2022) Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125. Cited by: §1.
  • [46] A. Ramesh, M. Pavlov, G. Goh, S. Gray, C. Voss, A. Radford, M. Chen, and I. Sutskever (2021) Zero-shot text-to-image generation. In International Conference on Machine Learning, pp. 8821–8831. Cited by: §1.
  • [47] A. Razavi, A. Van den Oord, and O. Vinyals (2019) Generating diverse high-fidelity images with vq-vae-2. Advances in neural information processing systems 32. Cited by: §1, §4.1.
  • [48] T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Radford, and X. Chen (2016) Improved techniques for training gans. In Advances in neural information processing systems, pp. 2234–2242. Cited by: §C.4, §4.2.
  • [49] F. Schroff, D. Kalenichenko, and J. Philbin (2015) Facenet: a unified embedding for face recognition and clustering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 815–823. Cited by: §C.4.
  • [50] R. Shu, H. H. Bui, S. Zhao, M. J. Kochenderfer, and S. Ermon (2018) Amortized inference regularization. Advances in Neural Information Processing Systems 31. Cited by: §6.
  • [51] J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Ganguli (2015) Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. Cited by: §1, §2.
  • [52] H. Tseng, L. Jiang, C. Liu, M. Yang, and W. Yang (2021) Regularizing generative adversarial networks under limited data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7921–7931. Cited by: Table 1.
  • [53] A. Van den Oord, N. Kalchbrenner, L. Espeholt, O. Vinyals, A. Graves, et al. (2016) Conditional image generation with pixelcnn decoders. Advances in neural information processing systems 29. Cited by: §1, §2.
  • [54] A. Van Den Oord, O. Vinyals, et al. (2017) Neural discrete representation learning. Advances in neural information processing systems 30. Cited by: §1, §4.1.
  • [55] O. Van Gaans (2003) Probability measures on metric spaces. Lecture notes. Cited by: §A.1.
  • [56] Y. Wang, A. Gonzalez-Garcia, D. Berga, L. Herranz, F. S. Khan, and J. v. d. Weijer (2020) Minegan: effective knowledge transfer from gans to target domains with few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9332–9341. Cited by: §6.
  • [57] Y. Wang, C. Wu, L. Herranz, J. van de Weijer, A. Gonzalez-Garcia, and B. Raducanu (2018) Transferring gans: generating images from limited data. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 218–234. Cited by: §1, §1, Table 1, §5.1.
  • [58] Y. Wang, C. Wu, L. Herranz, J. van de Weijer, A. Gonzalez-Garcia, and B. Raducanu (2018) Transferring gans: generating images from limited data. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 218–234. Cited by: §1, §1, §2, §4.2, §5.1, §6.
  • [59] Z. Wu, Y. Xiong, S. X. Yu, and D. Lin (2018) Unsupervised feature learning via non-parametric instance discrimination. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3733–3742. Cited by: §6.
  • [60] T. Xu, C. Li, J. Zhu, and B. Zhang (2019) Multi-objects generation with amortized structural regularization. Advances in Neural Information Processing Systems 32. Cited by: §6.
  • [61] C. Yang, Y. Shen, Y. Xu, and B. Zhou (2021) Data-efficient instance generation from instance discrimination. Advances in Neural Information Processing Systems 34. Cited by: §1, §1, Table 1, §5.1, §6.
  • [62] F. Yu, A. Seff, Y. Zhang, S. Song, T. Funkhouser, and J. Xiao (2015) Lsun: construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365. Cited by: §B.2, §1, §5.
  • [63] C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals (2021) Understanding deep learning (still) requires rethinking generalization. Communications of the ACM 64 (3), pp. 107–115. Cited by: §7.
  • [64] S. Zhao, Z. Liu, J. Lin, J. Zhu, and S. Han (2020) Differentiable augmentation for data-efficient gan training. Advances in Neural Information Processing Systems 33, pp. 7559–7570. Cited by: §1, Table 1, §6.
  • [65] Z. Zhao, S. Singh, H. Lee, Z. Zhang, A. Odena, and H. Zhang (2020) Improved consistency regularization for gans. arXiv preprint arXiv:2002.04724. Cited by: Table 1.
  • [66] J. Zhu, N. Chen, and E. P. Xing (2014) Bayesian inference with posterior regularization and applications to infinite latent svms. The Journal of Machine Learning Research 15 (1), pp. 1799–1847. Cited by: §6.
  • [67] J. Zhu, T. Park, P. Isola, and A. A. Efros (2017) Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 2223–2232. Cited by: §1.

Appendix A Proofs

a.1 Proof of Theorem 3.2

Proof.

Ignoring some constant irrelevant to the optimization, we rewrite the optimization problem of our approach with the KL divergence as follows:

(11)

For clarity, we denote the functional in problem (11) to be optimized as

According to Assumption 3.1 that is a nonempty compact set, the feasible area characterized by the constraints (i.e., ) is compact in the topology of weak convergence by the Prokhorov’s Theorem (See Corollary 6.8 in [55]). By Theorem 3.6 in [1], KL divergence is lower semi-continuous in the topology of weak convergence. According to Assumption 3.2 that is continuous and bounded on , the regularization term is continuous in the topology of weak convergence. Therefore, by the extreme value theorem, the global minimum of exists in the feasible area.

Note that the optimization problem (11) is convex. To obtain a necessary condition for the global minima, we get the Lagrangian with the equality constraint:

(12)

where . Note that for simplicity, we do not include the inequality constraint, which will be verified shortly. It is easy to check the constraint qualifications for problem (11). By the calculus of variations, a necessary condition for a global minimum of problem (11) is

(13)

which implies that

(14)

We define . According to Assumption 3.1 that is bounded on , we have . We define a function as

(15)

It is easy to see is monotonically decreasing and there is at most one such that , which finishes the proof together with the existence of the global minimum. ∎

a.2 Proof of Theorem 3.3

Proof.

The proof here shares the same spirit of Theorem 3.5. Ignoring some constant irrelevant to the optimization, we rewrite the optimization problem of our approach with the JS divergence as follows:

(16)

For clarity, we denote the functional in problem (11) to be optimized as

(17)
(18)

Similarly to the proof of Theorem 3.3, the global minimum of exists in the feasible area due to Assumption 3.1 and the fact that the JS divergence is lower semi-continuous in the topology of weak convergence.

Notably, the optimization problem (16) is convex due to the convexity of the JS divergence [5]. To obtain a necessary condition for the global minima, we get the Lagrangian with the equality constraint:

(19)

where . Similarly to the proof of Theorem 3.3, a necessary condition for a global minimum of problem (11) is

(20)

which implies that

(21)

Similarly to the proof in Theorem 3.2, there is at most one such that , which finishes the proof together with the existence of the global minimum. ∎

a.3 Convergence with Neural Networks Trained by (Stochastic) Gradient Descent

We establish the convergence of Reg-DGM with over-parameterized neural networks trained by (stochastic) gradient descent upon the general framework [2].

Theorem A.1.

(General convergence guarantee [2]) For an arbitrary Lipschitz-smooth loss function , with probability at least , a ReLU convolutional neural network with width and depth trained by gradient descent with an appropriate learning rate satisfy the following.555See additional assumptions on regularity of the data in [2].

  • If is non-convex, and -gradient dominant, then GD finds -error minimizer in iterations as long as .

  • If is non-convex, then SGD finds a point with in iterations as long as .

We assume the following standard smoothness conditions, which can be verified in practice with bounded data and weights.

Assumption A.2.

(Smoothness conditions)

  1. such that

  2. such that .

  3. such that .

  4. .

We consider the general density estimation setting where . Note that 1. and 2. in Assumption A.2 directly imply that is -Lipschitz. Formally, given a set of samples , Reg-DGM optimizes

If is independent from the training data , then the overall loss function is also -Lipschitz and Theorem A.1 directly applies. Otherwise, we can show that the data-dependent regularization used in our experiments is also Lipschitz-smooth. By the linearity of expectation, we have

(22)
(23)

We define , which is Lipschitz-smooth:

Therefore, Theorem A.1 applies to Reg-DGM with the data dependent energy defined in Sec. 4 of the main text.

a.4 Proof of Lemma 3.5

Proof.

In the Gaussian fitting example, the optimization problem can be written as

(24)
(25)
(26)

where the first equality holds by the definition and properties of Gaussian [6] and the second equality holds by omitting a constant irrelevant to the optimization. It is easy to solve the above quadratic programming problem analytically:

(27)

where . is obtained by an affine transformation of a Gaussian random variable and thus is also Gaussian distributed as follows:

(28)

a.5 Proof of Theorem 3.6

Proof.

In the Gaussian-fitting example, we have

(29)

and

(30)

According to the bias-variance decomposition of the MSE, we have

(31)

and

(32)

Let be the normalized weight of the regularization term. Then, we can rewrite as

(33)

To satisfy , we have

(34)

The pre-trained model is another meaningful baseline, which has a bias of and a zero variance. Its MSE is given by

(35)

To satisfy , we have

(36)

We now computes the optimal . It is easy to see that the quadratic programming problem in Eq.(33) achieves its minimum at with the corresponding . The minimum value is , which completes the proof. ∎

a.6 Proof of Corollary 3.6.1

Proof.

In the Gaussian-fitting example, the expected risk for a hypothesis is

(37)
(38)
(39)

which completes the proof together with Theorem 3.6. ∎

Appendix B Experimental Details

Our implementation is built upon some publicly available code. Below, we include the links and please refer to the licenses therein.

b.1 Toy data

In the toy example for optimization analyses, the data follows a uniform distribution over . The energy function is defined as . The optimal is estimated by numerical integration.

In the experiments for the Gaussian-fitting example, we set , , and by default.

b.2 GAN with Limited Data

Datasets. In our experiments, we use FFHQ [29], which consists of human face images of resolution , LSUN CAT [62], which consists of 200,000 cat face images of resolution , and CIFAR-10 [33], which consists of natural images of resolution . Specifically, we split training subsets of size k and k on FFHQ and LSUN CAT in the same way as [28]. In all experiments, we do not use x-flips to amplify training data except for combining with APA.

Metrics. To quantitatively evaluate the experimental results, we choose the Fréchet inception distance (FID) [20] as our metric. We compute the FID between generated images and all real images instead of training subsets [20]. Following [28], we report the medium FID on FFHQ and LSUN CAT and the mean FID with standard deviation on CIFAR- out of 3 runs . We record the best FID during training in each run as in [28].

Base DGM. In particular, the lighter-weight StyleGAN2 as the backbone for FFHQ and LSUN CAT and the tuning StyleGAN2 as the backbone for CIFAR-10 following [28]. Compared to the official StyleGAN2, the lighter-weight StyleGAN2 have the same performance and less computing cost on the FFHQ and LSUN CAT and the tuning StyleGAN2 is more suitable for CIFAR-10 [28]. Our implementation is based on the official code of ADA 666https://github.com/NVlabs/stylegan2-ada-pytorch.

Pre-trained model. We choose the ResNet-18 777https://pytorch.org/vision/stable/models.html trained on the ImageNet dataset as the pre-trained model. We normalize both the real and fake images based on the mean and standard deviation of training data and then feed them into the classifier. We extract the features of the last fully connected layer in the pre-trained model, which is frozen during training of generative models. On CIFAR-10, we interpolate 888https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html both the fake and real images to a resolution of after normalization.

Hyperparameters. Some parameters are shown in Tab. 3. The weight parameter controls the strength of our regularization term. We choose the weighting hyperparameter by performing grid search over according to FID following prior work [30, 28]. Other parameters remain the same settings as [28].

Computing amount. All experiments are completed on 8 NVIDIA 2080Ti GPUs. It takes days hours minutes to run our method with ADA on FFHQ or LSUN CAT and days hours minutes on CIFAR-10 at a time.

Parameter FFHQ-k FFHQ-k LSUN CAT-k LSUN CAT-k CIFAR-10
Base DGM StyleGAN2 [30] StyleGAN2 [30] StyleGAN2 [30] StyleGAN2 [30] StyleGAN2 [30]
Number of GPUs
Training length M M M M M
Minibatch size
Base DGM ADA [28] ADA [28] ADA [28] ADA [28] ADA [28]
Number of GPUs
Training length M M M M M
Minibatch size
Base DGM ADA+APA [26] ADA+APA [26] ADA+APA [26] ADA+APA [26] ADA+APA [26]
Number of GPUs
Training length M M M M M
Minibatch size
Table 3: Hyperparameters in the experiments of GAN. Reg-DGM shares the same hyperparameters as the base DGM if not specified. All models converge with the corresponding training length.

Appendix C Additional Results

c.1 Learning Curves

We show the learning curves of GANs on FFHQ, LSUN CAT and CIFAR-10 in Fig.4, Fig.5 and Fig.6 respectively. Reg-DGM consistently improves both baselines in all settings and the improvements increase as the number of the training data decreases. Moreover, the curves of Reg-DGM generally have a smaller fluctuation, which is consistent with our theory that the regularization reduces the variance of the baselines. One exception is Fig.6 (a), which shows that Reg-DGM is more unstable than the baseline, which is caused by a bad random initialization. We mention that the instability of Reg-ADA in Fig. 4 (b) is due to that of ADA.

StyleGAN2 and Reg-StyleGAN2
(a) StyleGAN2 and Reg-StyleGAN2
ADA and Reg-ADA
(b) ADA and Reg-ADA
Figure 4: Learning Curves on FFHQ.
StyleGAN2 and Reg-StyleGAN2
(a) StyleGAN2 and Reg-StyleGAN2
ADA and Reg-ADA
(b) ADA and Reg-ADA
Figure 5: Learning Curves on LSUN CAT.
StyleGAN2 and Reg-StyleGAN2
(a) StyleGAN2 and Reg-StyleGAN2
ADA and Reg-ADA
(b) ADA and Reg-ADA
Figure 6: Learning Curves on CIFAR-10.

c.2 Standard Deviation on FFHQ and LSUN CAT

As shown in Tab.4, we also provide the mean FID and standard deviation on FFHQ and LSUN CAT. Reg-DGM can reduce the mean FID significantly (compared to the measurement variance) and achieve a similar if not smaller standard deviation.

Method FFHQ LSUN CAT
k k k k
StyleGAN2 [30]
Reg-StyleGAN2 (ours)
ADA [28]
Reg-ADA (ours)
Table 4: The mean FID and standard deviation on FFHQ and LSUN CAT which is a supplement to reported medium FID.

c.3 More Samples of GAN

Fig.7 and Fig.8 respectively show the samples randomly generated by models with best FID trained on FFHQ-5k and CIFAR-10, using slight truncation as in [28]. Our regularization can help base DGMs achieve better or comparable image quality.

StyleGAN2 (FID
(a) StyleGAN2 (FID )
Reg-StyleGAN2 (FID
(b) Reg-StyleGAN2 (FID )
ADA (FID
(c) ADA (FID )
Reg-ADA (FID
(d) Reg-ADA (FID )
Figure 7: Samples generated for FFHQ-k, truncated ().
StyleGAN2 (FID
(a) StyleGAN2 (FID )
Reg-StyleGAN2 (FID
(b) Reg-StyleGAN2 (FID )
ADA (FID
(c) ADA (FID )
Reg-ADA (FID
(d) Reg-ADA (FID )
Figure 8: Samples generated for CIFAR-10, truncated ().

c.4 Ablation of Classifier and Results under More Evaluation Metrics

In this section, to better understand the influence of classifiers on our method, we try to use pre-trained classifiers with different regularization terms, layers, and backbones. We retain the same experimental setting as in Tab.3.

Regularization form. We first investigate the feature matching objective [48] as an alternative regularization terms. Formally, it computes the square of the -norm between expected features of real and fake samples from one layer of an feature extractor , which can be represented as follows:

(40)

Note that the feature matching objective cannot be rewritten as the expectation over and thus cannot be understood as an energy function. As before, we adopt the last fully-connected layer of ResNet-18, and the results of StyleGAN2 regularized by Eq. (40) are shown in Tab. 5. Feature matching can greatly reduce FID of StyleGAN2 while it cannot improve the visual quality of the samples, as shown in Fig. 9.

Then, we evaluate the entropy-minimization regularization [17] as follows:

(41)

where outputs the logits for the prediction distribution. As shown in Table 6, the entropy regularization achieves slightly worse FID results than the baseline within a small search space of , showing the importance of the data dependency in the energy function.

Method FFHQ LSUN CAT
k k k k
StyleGAN2 [30]
Reg-StyleGAN2 (ours)
Table 5: The media FID on FFHQ and LSUN CAT with feature matching as the regularization. is simply set as the same values in Tab.3.
FID
Table 6: FID on FFHQ-k for the entropy-minimization regularization.
Samples generated for FFHQ-
Figure 9: Samples generated for FFHQ-k using feature matching (FID ), untruncated.

Layers in . To explore the different layers of a pre-trained model, we retrain GANs separately using the first convolution layer of ResNet-18 and the last layers of four modules in ResNet-18. As shown in Tab.7, our method with features of diverse single layers can all improve the baseline StyleGAN2, and the last layer of ResNet-18 is most beneficial for our regularization strategy.

Layer index (Baseline) (by default)
FID
Table 7: Results with different layers on FFHQ-k. The “ layer” represent the last layer (i.e., our default setting). Note that layers are all indexed by the function named_modules in Pytorch. is simply set as the same values from Tab.3.

Backbone of . We employ ResNet-50 and ResNet-101 as the feature extractor to explore the effect of different backbones on Reg-DGM. Tab.8 shows the results on FFHQ-k. Even using the default without tuning, Reg-DGM with ResNet-50 and ResNet-101 can achieve a similar FID to that of our default setting and outperform the baseline. We believe that Reg-DGM with ResNet-50 and ResNet-101 can get better results if we finely search the hyperparameter .

Backbone (Baseline) ResNet-18 ResNet-50 ResNet-101
FID
Table 8: Results with different backbones on FFHQ-k. is simply set as the same values from Tab.3.

Monte Carlo estimate of . We evaluate Reg-StyleGAN2 with 8, 16, 32, and 64 (the default batch size) samples to estimate the energy function in Eq. (10) of the main text, as shown in Table 9. We do observe a significant improvement by increasing the number of samples. For instance, when , the estimate with 64 samples achieves an FID of 38.10, which is similar to 37.77 of the single sample estimate. Intuitively, the features of faces are likely concentrated in a small area of the feature space of , which is discriminative to other classes of natural images like cars, making the variance negligible to the training process of the generative model.

MC 1 (by default) 8 16 32 64
Table 9: FID on FFHQ-k for different number of samples in MC.

Changing the training data of . We trained Reg-DGM with the image encoder of the CLIP model [44] (an architecture very similar to ResNet-50), which is pre-trained on large-scale noisy text-image pairs instead of ImageNet, and with the face classifier Inception-ResNet-v1999https://github.com/timesler/facenet-pytorch of FaceNet [49], which is pre-trained on the large-scale face dataset VGGFace2 [8]. Their FID and KID results are shown in Tab. 10 and Tab.11, separately. Without heavily tuning the hyperparameter, Reg-DGM shows consistent improvement over the two baselines under both FID and KID metrics. The results with the CLIP model and the FaceNet model eliminate the potential bias caused by the ImageNet pre-trained .

Method FID KID
StyleGAN2
Reg-StyleGAN2
ADA
Reg-ADA
Table 10: Results on FFHQ-k using a pre-trained CLIP with the ResNet50 image encoder.
Method FID KID
StyleGAN2
Reg-StyleGAN2
ADA
Reg-ADA
Table 11: Results on FFHQ-k using a pre-trained FaceNet with the face classifier Inception-ResNet-v1.

More evaluation metrics. For a comprehensive comparison of Reg-DGM and baselines, we also evaluate the models under KID in Table 12. The conclusion remains the same as FID. Namlely, Reg-DGM consistently improves baselines in all settings.

Method FFHQ LSUN CAT CIFAR-
k k k k k
StyleGAN
Reg-StyleGAN2 (ours)
ADA
Reg-ADA (ours)
Table 12: KID on FFHQ, LSUN-CAT, and CIFAR-.

Results with samples. We present experiments on FFHQ- to compare Reg-DGM with the two most direct competitors StyleGAN2 and ADA. We randomly select 100 images for training. The results are shown in Table 13. Again, Reg-DGM consistently improves StyleGAN2 and ADA. For instance, Reg-ADA achieves an FID of 63.53, which is better than the of ADA.

Method FID
StyleGAN2
Reg-StyleGAN2
ADA
Reg-ADA
Table 13: FID on FFHQ-.