Generative Adversarial Networks

Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, Yoshua Bengio

Introduction

The promise of deep learning is to discover rich, hierarchical models that represent probability distributions over the kinds of data encountered in artificial intelligence applications, such as natural images, audio waveforms containing speech, and symbols in natural language corpora. So far, the most striking successes in deep learning have involved discriminative models, usually those that map a high-dimensional, rich sensory input to a class label . These striking successes have primarily been based on the backpropagation and dropout algorithms, using piecewise linear units which have a particularly well-behaved gradient . Deep generative models have had less of an impact, due to the difficulty of approximating many intractable probabilistic computations that arise in maximum likelihood estimation and related strategies, and due to difficulty of leveraging the benefits of piecewise linear units in the generative context. We propose a new generative model estimation procedure that sidesteps these difficulties. All code and hyperparameters available at http://www.github.com/goodfeli/adversarial

In the proposed adversarial nets framework, the generative model is pitted against an adversary: a discriminative model that learns to determine whether a sample is from the model distribution or the data distribution. The generative model can be thought of as analogous to a team of counterfeiters, trying to produce fake currency and use it without detection, while the discriminative model is analogous to the police, trying to detect the counterfeit currency. Competition in this game drives both teams to improve their methods until the counterfeits are indistiguishable from the genuine articles.

This framework can yield specific training algorithms for many kinds of model and optimization algorithm. In this article, we explore the special case when the generative model generates samples by passing random noise through a multilayer perceptron, and the discriminative model is also a multilayer perceptron. We refer to this special case as adversarial nets. In this case, we can train both models using only the highly successful backpropagation and dropout algorithms and sample from the generative model using only forward propagation. No approximate inference or Markov chains are necessary.

Related work

An alternative to directed graphical models with latent variables are undirected graphical models with latent variables, such as restricted Boltzmann machines (RBMs) , deep Boltzmann machines (DBMs) and their numerous variants. The interactions within such models are represented as the product of unnormalized potential functions, normalized by a global summation/integration over all states of the random variables. This quantity (the partition function) and its gradient are intractable for all but the most trivial instances, although they can be estimated by Markov chain Monte Carlo (MCMC) methods. Mixing poses a significant problem for learning algorithms that rely on MCMC .

Deep belief networks (DBNs) are hybrid models containing a single undirected layer and several directed layers. While a fast approximate layer-wise training criterion exists, DBNs incur the computational difficulties associated with both undirected and directed models.

Alternative criteria that do not approximate or bound the log-likelihood have also been proposed, such as score matching and noise-contrastive estimation (NCE) . Both of these require the learned probability density to be analytically specified up to a normalization constant. Note that in many interesting generative models with several layers of latent variables (such as DBNs and DBMs), it is not even possible to derive a tractable unnormalized probability density. Some models such as denoising auto-encoders and contractive autoencoders have learning rules very similar to score matching applied to RBMs. In NCE, as in this work, a discriminative training criterion is employed to fit a generative model. However, rather than fitting a separate discriminative model, the generative model itself is used to discriminate generated data from samples a fixed noise distribution. Because NCE uses a fixed noise distribution, learning slows dramatically after the model has learned even an approximately correct distribution over a small subset of the observed variables.

Finally, some techniques do not involve defining a probability distribution explicitly, but rather train a generative machine to draw samples from the desired distribution. This approach has the advantage that such machines can be designed to be trained by back-propagation. Prominent recent work in this area includes the generative stochastic network (GSN) framework , which extends generalized denoising auto-encoders : both can be seen as defining a parameterized Markov chain, i.e., one learns the parameters of a machine that performs one step of a generative Markov chain. Compared to GSNs, the adversarial nets framework does not require a Markov chain for sampling. Because adversarial nets do not require feedback loops during generation, they are better able to leverage piecewise linear units , which improve the performance of backpropagation but have problems with unbounded activation when used ina feedback loop. More recent examples of training a generative machine by back-propagating into it include recent work on auto-encoding variational Bayes and stochastic backpropagation .

Adversarial nets

The adversarial modeling framework is most straightforward to apply when the models are both multilayer perceptrons. To learn the generator’s distribution pgp_{g} over data x\bm{x}, we define a prior on input noise variables pz(z)p_{\bm{z}}(\bm{z}), then represent a mapping to data space as G(z;θg)G(\bm{z};\theta_{g}), where GG is a differentiable function represented by a multilayer perceptron with parameters θg\theta_{g}. We also define a second multilayer perceptron D(x;θd)D(\bm{x};\theta_{d}) that outputs a single scalar. D(x)D(\bm{x}) represents the probability that x\bm{x} came from the data rather than pgp_{g}. We train DD to maximize the probability of assigning the correct label to both training examples and samples from GG. We simultaneously train GG to minimize log⁡(1−D(G(z)))\log(1-D(G(\bm{z}))):

In other words, DD and GG play the following two-player minimax game with value function V(G,D)V(G,D):

In the next section, we present a theoretical analysis of adversarial nets, essentially showing that the training criterion allows one to recover the data generating distribution as GG and DD are given enough capacity, i.e., in the non-parametric limit. See Figure 1 for a less formal, more pedagogical explanation of the approach. In practice, we must implement the game using an iterative, numerical approach. Optimizing DD to completion in the inner loop of training is computationally prohibitive, and on finite datasets would result in overfitting. Instead, we alternate between kk steps of optimizing DD and one step of optimizing GG. This results in DD being maintained near its optimal solution, so long as GG changes slowly enough. This strategy is analogous to the way that SML/PCD training maintains samples from a Markov chain from one learning step to the next in order to avoid burning in a Markov chain as part of the inner loop of learning. The procedure is formally presented in Algorithm 1.

In practice, equation 1 may not provide sufficient gradient for GG to learn well. Early in learning, when GG is poor, DD can reject samples with high confidence because they are clearly different from the training data. In this case, log⁡(1−D(G(z)))\log(1-D(G(\bm{z}))) saturates. Rather than training GG to minimize log⁡(1−D(G(z)))\log(1-D(G(\bm{z}))) we can train GG to maximize log⁡D(G(z))\log D(G(\bm{z})). This objective function results in the same fixed point of the dynamics of GG and DD but provides much stronger gradients early in learning.

Theoretical Results

The generator GG implicitly defines a probability distribution pgp_{g} as the distribution of the samples G(z)G(\bm{z}) obtained when z∼pz\bm{z}\sim p_{\bm{z}}. Therefore, we would like Algorithm 1 to converge to a good estimator of pdatap_{\text{data}}, if given enough capacity and training time. The results of this section are done in a non-parametric setting, e.g. we represent a model with infinite capacity by studying convergence in the space of probability density functions.

We will show in section 4.1 that this minimax game has a global optimum for pg=pdatap_{g}=p_{\text{data}}. We will then show in section 4.2 that Algorithm 1 optimizes Eq 1, thus obtaining the desired result.

We first consider the optimal discriminator DD for any given generator GG.

For GG fixed, the optimal discriminator DD is

The training criterion for the discriminator D, given any generator GG, is to maximize the quantity V(G,D)V(G,D)

Note that the training objective for DD can be interpreted as maximizing the log-likelihood for estimating the conditional probability P(Y=y∣x)P(Y=y|\bm{x}), where YY indicates whether x\bm{x} comes from pdatap_{\text{data}} (with y=1y=1) or from pgp_{g} (with y=0y=0). The minimax game in Eq. 1 can now be reformulated as:

The global minimum of the virtual training criterion C(G)C(G) is achieved if and only if pg=pdatap_{g}=p_{\text{data}}. At that point, C(G)C(G) achieves the value −log⁡4-\log 4.

For pg=pdatap_{g}=p_{\text{data}}, DG∗(x)=12D^{*}_{G}(\bm{x})=\frac{1}{2}, (consider Eq. 2). Hence, by inspecting Eq. 4.1 at DG∗(x)=12D^{*}_{G}(\bm{x})=\frac{1}{2}, we find C(G)=log⁡12+log⁡12=−log⁡4C(G)=\log\frac{1}{2}+\log\frac{1}{2}=-\log 4. To see that this is the best possible value of C(G)C(G), reached only for pg=pdatap_{g}=p_{\text{data}}, observe that

and that by subtracting this expression from C(G)=V(DG∗,G)C(G)=V(D_{G}^{*},G), we obtain:

where KL is the Kullback–Leibler divergence. We recognize in the previous expression the Jensen–Shannon divergence between the model’s distribution and the data generating process:

Since the Jensen–Shannon divergence between two distributions is always non-negative and zero only when they are equal, we have shown that C∗=−log⁡(4)C^{*}=-\log(4) is the global minimum of C(G)C(G) and that the only solution is pg=pdatap_{g}=p_{\text{data}}, i.e., the generative model perfectly replicating the data generating process. ∎

2 Convergence of Algorithm 1

If GG and DD have enough capacity, and at each step of Algorithm 1, the discriminator is allowed to reach its optimum given GG, and pgp_{g} is updated so as to improve the criterion

then pgp_{g} converges to pdatap_{\text{data}}

Consider V(G,D)=U(pg,D)V(G,D)=U(p_{g},D) as a function of pgp_{g} as done in the above criterion. Note that U(pg,D)U(p_{g},D) is convex in pgp_{g}. The subderivatives of a supremum of convex functions include the derivative of the function at the point where the maximum is attained. In other words, if f(x)=sup⁡α∈Afα(x)f(x)=\sup_{\alpha\in\cal{A}}f_{\alpha}(x) and fα(x)f_{\alpha}(x) is convex in xx for every α\alpha, then ∂fβ(x)∈∂f\partial f_{\beta}(x)\in\partial f if β=arg⁡sup⁡α∈Afα(x)\beta=\arg\sup_{\alpha\in\cal{A}}f_{\alpha}(x). This is equivalent to computing a gradient descent update for pgp_{g} at the optimal DD given the corresponding GG. sup⁡DU(pg,D)\sup_{D}U(p_{g},D) is convex in pgp_{g} with a unique global optima as proven in Thm 1, therefore with sufficiently small updates of pgp_{g}, pgp_{g} converges to pxp_{x}, concluding the proof. ∎

In practice, adversarial nets represent a limited family of pgp_{g} distributions via the function G(z;θg)G(\bm{z};\theta_{g}), and we optimize θg\theta_{g} rather than pgp_{g} itself. Using a multilayer perceptron to define GG introduces multiple critical points in parameter space. However, the excellent performance of multilayer perceptrons in practice suggests that they are a reasonable model to use despite their lack of theoretical guarantees.

Experiments

We trained adversarial nets an a range of datasets including MNIST, the Toronto Face Database (TFD) , and CIFAR-10 . The generator nets used a mixture of rectifier linear activations and sigmoid activations, while the discriminator net used maxout activations. Dropout was applied in training the discriminator net. While our theoretical framework permits the use of dropout and other noise at intermediate layers of the generator, we used noise as the input to only the bottommost layer of the generator network.

We estimate probability of the test set data under pgp_{g} by fitting a Gaussian Parzen window to the samples generated with GG and reporting the log-likelihood under this distribution. The σ\sigma parameter of the Gaussians was obtained by cross validation on the validation set. This procedure was introduced in Breuleux et al. and used for various generative models for which the exact likelihood is not tractable . Results are reported in Table 1. This method of estimating the likelihood has somewhat high variance and does not perform well in high dimensional spaces but it is the best method available to our knowledge. Advances in generative models that can sample but not estimate likelihood directly motivate further research into how to evaluate such models.

In Figures 2 and 3 we show samples drawn from the generator net after training. While we make no claim that these samples are better than samples generated by existing methods, we believe that these samples are at least competitive with the better generative models in the literature and highlight the potential of the adversarial framework.

Advantages and disadvantages

This new framework comes with advantages and disadvantages relative to previous modeling frameworks. The disadvantages are primarily that there is no explicit representation of pg(x)p_{g}(\bm{x}), and that DD must be synchronized well with GG during training (in particular, GG must not be trained too much without updating DD, in order to avoid “the Helvetica scenario” in which GG collapses too many values of z\mathbf{z} to the same value of x\mathbf{x} to have enough diversity to model pdatap_{\text{data}}), much as the negative chains of a Boltzmann machine must be kept up to date between learning steps. The advantages are that Markov chains are never needed, only backprop is used to obtain gradients, no inference is needed during learning, and a wide variety of functions can be incorporated into the model. Table 2 summarizes the comparison of generative adversarial nets with other generative modeling approaches.

The aforementioned advantages are primarily computational. Adversarial models may also gain some statistical advantage from the generator network not being updated directly with data examples, but only with gradients flowing through the discriminator. This means that components of the input are not copied directly into the generator’s parameters. Another advantage of adversarial networks is that they can represent very sharp, even degenerate distributions, while methods based on Markov chains require that the distribution be somewhat blurry in order for the chains to be able to mix between modes.

Conclusions and future work

This framework admits many straightforward extensions:

A conditional generative model p(x∣c)p(\bm{x}\mid\bm{c}) can be obtained by adding c\bm{c} as input to both GG and DD.

Learned approximate inference can be performed by training an auxiliary network to predict z\bm{z} given x\bm{x}. This is similar to the inference net trained by the wake-sleep algorithm but with the advantage that the inference net may be trained for a fixed generator net after the generator net has finished training.

One can approximately model all conditionals p(xS∣xS̸)p(\bm{x}_{S}\mid\bm{x}_{\not S}) where SS is a subset of the indices of x\bm{x} by training a family of conditional models that share parameters. Essentially, one can use adversarial nets to implement a stochastic extension of the deterministic MP-DBM .

Semi-supervised learning: features from the discriminator or inference net could improve performance of classifiers when limited labeled data is available.

Efficiency improvements: training could be accelerated greatly by divising better methods for coordinating GG and DD or determining better distributions to sample z\mathbf{z} from during training.

This paper has demonstrated the viability of the adversarial modeling framework, suggesting that these research directions could prove useful.

We would like to acknowledge Patrice Marcotte, Olivier Delalleau, Kyunghyun Cho, Guillaume Alain and Jason Yosinski for helpful discussions. Yann Dauphin shared his Parzen window evaluation code with us. We would like to thank the developers of Pylearn2 and Theano , particularly Frédéric Bastien who rushed a Theano feature specifically to benefit this project. Arnaud Bergeron provided much-needed support with LaTeX typesetting. We would also like to thank CIFAR, and Canada Research Chairs for funding, and Compute Canada, and Calcul Québec for providing computational resources. Ian Goodfellow is supported by the 2013 Google Fellowship in Deep Learning. Finally, we would like to thank Les Trois Brasseurs for stimulating our creativity.

References