f-GAN: Training Generative Neural Samplers using Variational Divergence Minimization

Sebastian Nowozin, Botond Cseke, Ryota Tomioka

Introduction

Probabilistic generative models describe a probability distribution over a given domain X\mathcal{X}, for example a distribution over natural language sentences, natural images, or recorded waveforms.

Given a generative model QQ from a class Q\mathcal{Q} of possible models we are generally interested in performing one or multiple of the following operations:

Sampling. Produce a sample from QQ. By inspecting samples or calculating a function on a set of samples we can obtain important insight into the distribution or solve decision problems.

Estimation. Given a set of iid samples {x1,x2,,xn}\{x_{1},x_{2},\dots,x_{n}\} from an unknown true distribution PP, find QQQ\in\mathcal{Q} that best describes the true distribution.

Point-wise likelihood evaluation. Given a sample xx, evaluate the likelihood Q(x)Q(x).

Generative-adversarial networks (GAN) in the form proposed by are an expressive class of generative models that allow exact sampling and approximate estimation. The model used in GAN is simply a feedforward neural network which receives as input a vector of random numbers, sampled, for example, from a uniform distribution. This random input is passed through each layer in the network and the final layer produces the desired output, for example, an image. Clearly, sampling from a GAN model is efficient because only one forward pass through the network is needed to produce one exact sample.

Such probabilistic feedforward neural network models were first considered in and , here we call these models generative neural samplers. GAN is also of this type, as is the decoder model of a variational autoencoder .

In the original GAN paper the authors show that it is possible to estimate neural samplers by approximate minimization of the symmetric Jensen-Shannon divergence,

where DKLD_{KL} denotes the Kullback-Leibler divergence. The key technique used in the GAN training is that of introducing a second “discriminator” neural networks which is optimized simultaneously. Because DJS(PQ)D_{\textrm{JS}}(P\|Q) is a proper divergence measure between distributions this implies that the true distribution PP can be approximated well in case there are sufficient training samples and the model class Q\mathcal{Q} is rich enough to represent PP.

In this work we show that the principle of GANs is more general and we can extend the variational divergence estimation framework proposed by Nguyen et al. to recover the GAN training objective and generalize it to arbitrary ff-divergences.

More concretely, we make the following contributions over the state-of-the-art:

We derive the GAN training objectives for all ff-divergences and provide as example additional divergence functions, including the Kullback-Leibler and Pearson divergences.

We simplify the saddle-point optimization procedure of Goodfellow et al. and provide a theoretical justification.

We provide experimental insight into which divergence function is suitable for estimating generative neural samplers for natural images.

Method

We first review the divergence estimation framework of Nguyen et al. which is based on ff-divergences. We then extend this framework from divergence estimation to model estimation.

Statistical divergences such as the well-known Kullback-Leibler divergence measure the difference between two given probability distributions. A large class of different divergences are the so called ff-divergences , also known as the Ali-Silvey distances . Given two distributions PP and QQ that possess, respectively, an absolutely continuous density function pp and qq with respect to a base measure dx\textrm{d}x defined on the domain X\mathcal{X}, we define the ff-divergence,

2 Variational Estimation of f𝑓f-divergences

Nguyen et al. derive a general variational method to estimate ff-divergences given only samples from PP and QQ. We will extend their method from merely estimating a divergence for a fixed model to estimating model parameters. We call this new method variational divergence minimization (VDM) and show that the generative-adversarial training is a special case of this more general VDM framework.

For completeness, we first provide a self-contained derivation of Nguyen et al’s divergence estimation procedure. Every convex, lower-semicontinuous function ff has a convex conjugate function ff^{*}, also known as Fenchel conjugate . This function is defined as

The function ff^{*} is again convex and lower-semicontinuous and the pair (f,f)(f,f^{*}) is dual to another in the sense that f=ff^{**}=f. Therefore, we can also represent ff as f(u)=suptdomf{tuf(t)}f(u)=\sup_{t\in\textrm{dom}_{f^{*}}}\left\{tu-f^{*}(t)\right\}. Nguyen et al. leverage the above variational representation of ff in the definition of the ff-divergence to obtain a lower bound on the divergence,

By taking the variation of the lower bound in (4) w.r.t. TT, we find that under mild conditions on ff , the bound is tight for

where ff^{\prime} denotes the first order derivative of ff. This condition can serve as a guiding principle for choosing ff and designing the class of functions T\mathcal{T}. For example, the popular reverse Kullback-Leibler divergence corresponds to f(u)=log(u)f(u)=-\log(u) resulting in T(x)=q(x)/p(x)T^{\ast}(x)=-q(x)/p(x), see Table 5.

We list common ff-divergences in Table 5 and provide their Fenchel conjugates ff^{*} and the domains domf\textrm{dom}_{f^{*}} in Table 6. We provide plots of the generator functions and their conjugates in the supplementary materials.

3 Variational Divergence Minimization (VDM)

We now use the variational lower bound (4) on the ff-divergence Df(PQ)D_{f}(P\|Q) in order to estimate a generative model QQ given a true distribution PP.

To this end, we follow the generative-adversarial approach and use two neural networks, QQ and TT. QQ is our generative model, taking as input a random vector and outputting a sample of interest. We parametrize QQ through a vector θ\theta and write QθQ_{\theta}. TT is our variational function, taking as input a sample and returning a scalar. We parametrize TT using a vector ω\omega and write TωT_{\omega}.

We can learn a generative model QθQ_{\theta} by finding a saddle-point of the following ff-GAN objective function, where we minimize with respect to θ\theta and maximize with respect to ω\omega,

4 Representation for the Variational Function

To apply the variational objective (6) for different ff-divergences, we need to respect the domain domf\textrm{dom}_{f^{*}} of the conjugate functions ff^{*}. To this end, we assume that variational function TωT_{\omega} is represented in the form Tω(x)=gf(Vω(x))T_{\omega}(x)=g_{f}(V_{\omega}(x)) and rewrite the saddle objective (6) as follows:

as a special instance of (7) by identifying each terms in the expectations of (7) and (8). In particular, choosing the last nonlinearity in the discriminator as the sigmoid Dω(x)=1/(1+eVω(x))D_{\omega}(x)=1/(1+e^{-V_{\omega}(x)}), corresponds to output activation function is gf(v)=log(1+ev)g_{f}(v)=-\log(1+e^{-v}); see Table 6.

5 Example: Univariate Mixture of Gaussians

To demonstrate the properties of the different ff-divergences and to validate the variational divergence estimation framework we perform an experiment similar to the one of .

Setup. We approximate a mixture of Gaussians by learning a Gaussian distribution. We represent our model QθQ_{\theta} using a linear function which receives a random zN(0,1)z\sim\mathcal{N}(0,1) and outputs Gθ(z)=μ+σzG_{\theta}(z)=\mu+\sigma z, where θ=(μ,σ)\theta=(\mu,\sigma) are the two scalar parameters to be learned. For the variational function TωT_{\omega} we use a neural network with two hidden layers having 6464 units each and tanh activations. We optimise the objective F(ω,θ)F(\omega,\theta) by using the single-step gradient method presented in Section 3. In each step we sample batches of size 10241024 each for both p(x)p(x) and p(z)p(z) and we use a step-size of η=0.01\eta=0.01 for updating both ω\omega and θ\theta. We compare the results to the best fit provided by the exact optimization of Df(PQθ)D_{f}(P\|Q_{\theta}) w.r.t. θ\theta, which is feasible in this case by solving the required integrals in (2) numerically. We use (ω^,θ^)(\hat{\omega},\hat{\theta}) (learned) and θ\theta^{\ast} (best fit) to distinguish the parameters sets used in these two approaches.

Results. The left side of Table 3 shows the optimal divergence and objective values Df(PQθ)D_{f}(P\rvert\lvert Q_{{\theta}^{\ast}}) and F(ω^,θ^)F(\hat{\omega},\hat{\theta}) as well as the resulting means and standard deviations. Note that the results are in line with the lower bound property, that is, we have Df(PQθ)F(ω^,θ^)D_{f}(P\rvert\lvert Q_{{\theta}^{\ast}})\geq F(\hat{\omega},\hat{\theta}). There is a good correspondence between the gap in objectives and the difference between the fitted means and standard deviations. The right side of Table 3 shows the results of the following experiment: (1) we train TωT_{\omega} and QθQ_{\theta} using a particular divergence, then (2) we estimate the divergence and re-train TωT_{\omega} while keeping QθQ_{\theta} fixed. As expected, QθQ_{\theta} performs best on the divergence it was trained with. Further details showing detailed plots of the fitted Gaussians and the optimal variational functions are presented in the supplementary materials.

In summary, the above results demonstrate that when the generative model is misspecified and does not contain the true distribution, the divergence function used for estimation has a strong influence on which model is learned.

Algorithms for Variational Divergence Minimization (VDM)

We now discuss numerical methods to find saddle points of the objective (6). To this end, we distinguish two methods; first, the alternating method originally proposed by Goodfellow et al. , and second, a more direct single-step optimization procedure.

In our variational framework, the alternating gradient method can be described as a double-loop method; the internal loop tightens the lower bound on the divergence, whereas the outer loop improves the generator model. While the motivation for this method is plausible, in practice the choice taking a single step in the inner loop is popular. Goodfellow et al. provide a local convergence guarantee.

Motivated by the success of the alternating gradient method with a single inner step, we propose a simpler algorithm shown in Algorithm 1. The algorithm differs from the original one in that there is no inner loop and the gradients with respect to ω\omega and θ\theta are computed in a single back-propagation.

Here we show that Algorithm 1 geometrically converges to a saddle point (θ,ω)(\theta^{\ast},\omega^{\ast}) if there is a neighborhood around the saddle point in which FF is strongly convex in θ\theta and strongly concave in ω\omega. These conditions are similar to the assumptions made in and can be formalized as follows:

These assumptions are necessary except for the “strong” part in order to define the type of saddle points that are valid solutions of our variational framework. Note that although there could be many saddle points that arise from the structure of deep networks , they do not qualify as the solution of our variational framework under these assumptions.

For convenience, let’s define πt=(θt,ωt)\pi^{t}=(\theta^{t},\omega^{t}). Now the convergence of Algorithm 1 can be stated as follows (the proof is given in the supplementary material):

Suppose that there is a saddle point π=(θ,ω)\pi^{\ast}=(\theta^{\ast},\omega^{\ast}) with a neighborhood that satisfies conditions (9). Moreover, we define J(π)=12F(π)22J(\pi)=\frac{1}{2}\|\nabla F(\pi)\|_{2}^{2} and assume that in the above neighborhood, FF is sufficiently smooth so that there is a constant L>0L>0 such that J(π)J(π)2Lππ2\|\nabla J(\pi^{\prime})-\nabla J(\pi)\|_{2}\leq L\|\pi^{\prime}-\pi\|_{2} for any π,π\pi,\pi^{\prime} in the neighborhood of π\pi^{\ast}. Then using the step-size η=δ/L\eta=\delta/L in Algorithm 1, we have

That is, the squared norm of the gradient F(π)\nabla F(\pi) decreases geometrically.

2 Practical Considerations

Here we discuss principled extensions of the heuristic proposed in and real/fake statistics discussed by Larsen and Sønderbyhttp://torch.ch/blog/2015/11/13/gan.html. Furthermore we discuss practical advice that slightly deviate from the principled viewpoint.

thereby maximizing the generator output. This is not only intuitively correct but we can show that the stationary point is preserved by this change using the same argument as in ; we found this useful also for other divergences.

Larsen and Sønderby recommended monitoring real and fake statistics, which are defined as the true positive and true negative rates of the variational function viewing it as a binary classifier. Since our output activation gfg_{f} are all monotone, we can derive similar statistics for any ff-divergence by only changing the decision threshold. Due to the link between the density ratio and the variational function (5), the threshold lies at f(1)f^{\prime}(1) (see Table 6). That is, we can interpret the output of the variational function as classifying the input xx as a true sample if the variational function Tω(x)T_{\omega}(x) is larger than f(1)f^{\prime}(1), and classifying it as a sample from the generator otherwise.

We found Adam and gradient clipping to be useful especially in the large scale experiment on the LSUN dataset.

Experiments

We now train generative neural samplers based on VDM on the MNIST and LSUN datasets.

We use the MNIST training data set (60,000 samples, 28-by-28 pixel images) to train the generator and variational function model proposed in for various ff-divergences. With zUniform100(1,1)z\sim\textrm{Uniform}_{100}(-1,1) as input, the generator model has two linear layers each followed by batch normalization and ReLU activation and a final linear layer followed by the sigmoid function. The variational function Vω(x)V_{\omega}(x) has three linear layers with exponential linear unit in between. The final activation is specific to each divergence and listed in Table 6. As in we use Adam with a learning rate of α=0.0002\alpha=0.0002 and update weight β=0.5\beta=0.5. We use a batchsize of 4096, sampled from the training set without replacement, and train each model for one hour. We also compare against variational autoencoders with 20 latent dimensions.

Results and Discussion. We evaluate the performance using the kernel density estimation (Parzen window) approach used in . To this end, we sample 16k images from the model and estimate a Parzen window estimator using an isotropic Gaussian kernel bandwidth using three fold cross validation. The final density model is used to evaluate the average log-likelihood on the MNIST test set (10k samples). We show the results in Table 4, and some samples from our models in Figure 2.

The use of the KDE approach to log-likelihood estimation has known deficiencies . In particular, for the dimensionality used in MNIST (d=784d=784) the number of model samples required to obtain accurate log-likelihood estimates is infeasibly large. We found a large variability (up to 50 nats) between multiple repetitions. As such the results are not entirely conclusive. We also trained the same KDE estimator on the MNIST training set, achieving a significantly higher holdout likelihood. However, it is reassuring to see that the model trained for the Kullback-Leibler divergence indeed achieves a high holdout likelihood compared to the GAN model.

Through the DCGAN work the generative-adversarial approach has shown real promise in generating natural looking images. Here we use the same architecture as as in and replace the GAN objective with our more general ff-GAN objective.

We use the large scale LSUN database of natural images of different categories. To illustrate the different behaviors of different divergences we train the same model on the classroom category of images, containing 168,103 images of classroom environments, rescaled and center-cropped to 96-by-96 pixels.

Setup. We use the generator architecture and training settings proposed in DCGAN . The model receives zUniformdrand(1,1)z\in{\rm Uniform}_{d_{\rm rand}}(-1,1) and feeds it through one linear layer and three deconvolution layers with batch normalization and ReLU activation in between. The variational function is the same as the discriminator architecture in and follows the structure of a convolutional neural network with batch normalization, exponential linear units and one final linear layer.

Results. Figure 3 shows 16 random samples from neural samplers trained using GAN, KL, and squared Hellinger divergences. All three divergences produce equally realistic samples. Note that the difference in the learned distribution QθQ_{\theta} arise only when the generator model is not rich enough.

Related Work

We now discuss how our approach relates to existing work. Building generative models of real world distributions is a fundamental goal of machine learning and much related work exists. We only discuss work that applies to neural network models.

Mixture density networks are neural networks which directly regress the parameters of a finite parametric mixture model. When combined with a recurrent neural network this yields impressive generative models of handwritten text .

NADE and RNADE perform a factorization of the output using a predefined and somewhat arbitrary ordering of output dimensions. The resulting model samples one variable at a time conditioning on the entire history of past variables. These models provide tractable likelihood evaluations and compelling results but it is unclear how to select the factorization order in many applications .

Diffusion probabilistic models define a target distribution as a result of a learned diffusion process which starts at a trivial known distribution. The learned model provides exact samples and approximate log-likelihood evaluations.

Noise contrastive estimation (NCE) is a method that estimates the parameters of unnormalized probabilistic models by performing non-linear logistic regression to discriminate the data from artificially generated noise. NCE can be viewed as a special case of GAN where the discriminator is constrained to a specific form that depends on the model (logistic regression classifier) and the generator (kept fixed) is providing the artificially generated noise (see supplementary material).

The generative neural sampler models of and did not provide satisfactory learning methods; used importance sampling and expectation maximization. The main difference to GAN and to our work really is in the learning objective, which is effective and computationally inexpensive.

Variational auto-encoders (VAE) are pairs of probabilistic encoder and decoder models which map a sample to a latent representation and back, trained using a variational Bayesian learning objective. The advantage of VAEs is in the encoder model which allows efficient inference from observation to latent representation and overall they are a compelling alternative to ff-GANs and recent work has studied combinations of the two approaches

In a generalisation of the GAN objective is proposed by using an alternative Jensen-Shannon divergence that mimics an interpolation between the KL and the reverse KL divergence and has Jensen-Shannon as its mid-point. It can be shown that with π\pi close to and 11 it leads to a behavior similar the objectives resulting from the KL and reverse KL divergences (see supplementary material).

Discussion

Generative neural samplers offer a powerful way to represent complex distributions without limiting factorizing assumptions. However, while the purely generative neural samplers as used in this paper are interesting their use is limited because after training they cannot be conditioned on observed data and thus are unable to provide inferences.

We believe that in the future the true benefits of neural samplers for representing uncertainty will be found in discriminative models and our presented methods extend readily to this case by providing additional inputs to both the generator and variational function as in the conditional GAN model .

Acknowledgements. We thank Ferenc Huszár for discussions on the generative-adversarial approach.

References

Appendix A Introduction

We provide additional material to support the content presented in the paper. The text is structured as follows. In Section B we present an extended list of f-divergences, corresponding generator functions and their convex conjugates. In Section C we provide the proof of Theorem 2 from Section 3. In Section D we discuss the differences between current (to our knowledge) GAN optimisation algorithms. Section E provides a proof of concept of our approach by fitting a Gaussian to a mixture of Gaussians using various divergence measures. Finally, in Section F we present the details of the network architectures used in Section 4 of the main text.

Appendix B f𝑓f-divergences and Generator-Conjugate Pairs

Table 6 lists the convex conjugate functions f(t)f^{\ast}(t) of the generator functions f(u)f(u) in Table 5, their domains, as well as the activation functions gfg_{f} we use in the last layers of the generator networks to obtain a correct mapping of the network outputs into the domains of the conjugate functions.

The panels of Figure 4 show the generator functions and the corresponding convex conjugate functions for a variety of f-divergences.

Appendix C Proof of Theorem 1

In this section we present the proof of Theorem 2 from Section 3 of the main text. For completeness, we reiterate the conditions and the theorem.

We assume that FF is strongly convex in θ\theta and strongly concave in ω\omega such that

These assumptions are necessary except for the “strong” part in order to define the type of saddle points that are valid solutions of our variational framework.

We define πt=(θt,ωt)\pi^{t}=(\theta^{t},\omega^{t}) and use the notation

With this notation, Algorithm 1 in the main text can be written as

Given the above assumptions and notation, in Section 3 of the main text we formulate the following theorem.

Suppose that there is a saddle point π=(θ,ω)\pi^{\ast}=(\theta^{\ast},\omega^{\ast}) with a neighborhood that satisfies conditions (11) and (12). Moreover we define J(π)=12F(π)22J(\pi)=\frac{1}{2}\|\nabla F(\pi)\|_{2}^{2} and assume that in the above neighborhood, FF is sufficiently smooth so that there is a constant L>0L>0 and

for any π,π\pi,\pi^{\prime} in the neighborhood of π\pi^{\ast}. Then using the step-size η=δ/L\eta=\delta/L in Algorithm 1, we have

where LL is the smoothness parameter of JJ. That is, the squared norm of the gradient F(π)\nabla F(\pi) decreases geometrically.

First, note that the gradient of JJ can be written as

In other words, Algorithm 1 decreases JJ by an amount proportional to the squared norm of F(π)\nabla F(\pi).

Now combining the smoothness (13) with Algorithm 1, we get

Appendix D Related Algorithms

Due to recent interest in GAN type models, there have been attempts to derive other divergence measures and algorithms. In particular, an alternative Jensen-Shannon divergence has been derived in and a heuristic algorithm that behaves similarly to the one resulting from this new divergence has been proposed in .

In this section we summarise (some of) the current algorithms and show how they are related. Note that some algorithms use heuristics that do not correspond to saddle point optimisation, that is, in the corresponding maximization and minimization steps they optimise alternative objectives that do not add up to a coherent joint objective. We include a short discussion of because it can be viewed as a special case of GAN.

To illustrate how the discussed algorithms work, we define the objective function

where we introduce two scalar parameters, α\alpha and β\beta, to help us highlight the differences between the algorithms shown in Table 7.

NCE is a method that estimates the parameters of an unnormalised model p(x;ω)p(x;\omega) by performing non-linear logistic regression to discriminate between the model and artificially generated noise. To achieve this NCE casts the estimation problem as a ML estimation in a binary classification model where the data is augmented with artificially generated data. The “true” data items are labeled as positives while the artificially generated data items are labeled as negatives. The discriminant function is defined as Dω(x)=p(x;ω)/(p(x;ω)+q(x))D_{\omega}(x)=p(x;\omega)/(p(x;\omega)+q(x)) where q(x)q(x) denotes the distribution of the artificially generated data, typically a Gaussian parameterised by the empirical mean and covariance of the true data. ML estimation in this binary classification model results in an objective that has the form (15) with α=1\alpha=1 amd β=0\beta=0, where the expectations are taken w.r.t. the empirical distribution of augmented data. As a result, NCE can be viewed as a special case of GAN where the generator is fixed and we only have maximise the objective w.r.t. the parameters of the discriminator. Another slight difference is that in this case the data distribution is learned through the discriminator not the generator, however, the method has many conceptual similarities to GAN.

GAN-1 and GAN-2

The first algorithm (GAN-1) proposed in performs a stochastic gradient ascent-descent on the objective with α=1\alpha=1 and β=0\beta=0, however, the authors point out that in practice it is more advantageous to minimise ExQθ[logDω(x)]-E_{x\sim Q_{\rm\theta}}[\log D_{\omega}(x)] instead of ExQθ[log(1Dω(x))]E_{x\sim Q_{\rm\theta}}[\log(1-D_{\omega}(x))], we denote this by GAN-2. This is motivated by the observation that in the early stages of training when QθQ_{\theta} is not sufficiently well fitted, DωD_{\omega} can saturate fast leading to weak gradients in ExQθ[log(1Dω(x))]E_{x\sim Q_{\rm\theta}}[\log(1-D_{\omega}(x))]. The ExQθ[logDω(x)]-E_{x\sim Q_{\rm\theta}}[\log D_{\omega}(x)] term, however, can provide stronger gradients and leads to the same fixed point. This heuristic can be viewed as using α=1,β=0\alpha=1,\beta=0 in the maximisation step and α=0,β=1\alpha=0,\beta=1 in the minimisation step A somewhat similar observation regarding the artificially generated data is made in : in order to have meaningful training one should choose the artificially generated data to be close the the true data, hence the choice of an ML multivariate Gaussian..

GAN-3

In a further heuristic for the minimisation step is proposed. Formally, it can be viewed as a combination of the minimisation steps in GAN-1 and GAN-2. In the proposed algorithm, the maximisation step is performed similarly (α=1,β=0\alpha=1,\beta=0), but the minimisation is done using α=1\alpha=1 and β=1\beta=1. This choice is motivated by KL optimality arguments. The author makes the observation that the optimal discriminator is given by

and thus, close to optimality, the minimisation of ExQθ[log(1Dω(x))]ExQθ[logDω(x)]E_{x\sim Q_{\theta}}[\log(1-D_{\omega}(x))]-E_{x\sim Q_{\theta}}[\log D_{\omega}(x)] corresponds to the minimisation of the reverse KL divergence ExQθ[log(qθ(x)/p(x))]E_{x\sim Q_{\theta}}[\log(q_{\theta}(x)/p(x))]. This approach can be viewed as choosing α=1\alpha=1 and β=1\beta=1 in the minimisation step.

Remarks on the Weighted Jensen-Shannon Divergence in [16]

The GAN/variational objective corresponding to alternative Jensen-Shannon divergence measure proposed in (see Jensen-Shannon-weighted in Table 1) is

Note that we have the Tω(x)=logDω(x)T_{\omega}(x)=\log D_{\omega}(x) correspondence. According to the definition of the variational objective, when TωT_{\omega} is close to optimal then in the minimisation step the objective function is close to the chosen divergence. In this case the optimal discriminator is

The objective in (17) vanishes when π{0,1}\pi\in\{0,1\}, however, when π\pi is only is close to and 11, it can behave similarly to the KL and reverse KL objectives, respectively. Overall, the connection between GAN-3 and the optimisation of (17) can only be considered as approximate. To obtain an exact KL or reverse KL behavior one can use the corresponding variational objectives. For a simple illustration of how these divergences behave see Section 2.5 and Section E below.

Appendix E Details of the Univariate Example

We follow up on the example in Section 2.5 of the main text by presenting further details about the quality and behavior of the approximations resulting from using various divergence measures. For completeness, we reiterate the setup and then we present further results.

Setup. We approximate a mixture of Gaussian The plots on Figure 5 correspond to p(x)=(1w)N(x;m1,v1)+wN(x;m2,v2)p(x)=(1-w)N(x;m_{1},v_{1})+wN(x;m_{2},v_{2}) with w=0.67,m1=1,v1=0.0625,m2=2,v2=2w=0.67,m_{1}=-1,v_{1}=0.0625,m_{2}=2,v_{2}=2. by learning a Gaussian distribution. The model QθQ_{\theta} is represented by a linear function which receives a random zN(0,1)z\sim\mathcal{N}(0,1) and outputs

where θ=(μ,σ)\theta=(\mu,\sigma) are the parameters to be learned. For the variational function TωT_{\omega} we use the neural network

We optimise the objective F(ω,θ)F(\omega,\theta) by using the single-step gradient method presented in Section 3.1 of the main text . In each step we sample batches of size 10241024 each for both p(x)p(x) and p(z)p(z) and we use a step-size of 0.010.01 for updating both ω\omega and θ\theta. We compare the results to the best fit provided by the exact optimisation of Df(PQθ)D_{f}(P\|Q_{\theta}) w.r.t. θ\theta, which is feasible in this case by solving the required integrals numerically. We use (ω^,θ^)(\hat{\omega},\hat{\theta}) (learned) and θ\theta^{\ast} (best fit) to distinguish the parameters sets used in these two approaches.

Results. The panels in Figure 5 shows the density function of the data distribution as well as the Gaussian approximations corresponding to a few ff-divergences form Table 5. As expected, the KL approximation covers the data distribution by fitting its mean and variance while KL-rev has more of a mode-seeking behavior . The fit corresponding to the Jensen-Shannon divergence is somewhere between KL and KL-rev. All Gaussian approximations resulting from neural network training are close to the ones obtained by direct optimisation of the divergence (learned vs. best fit).

In the right–bottom panel of Figure 5 we compare the variational functions Tω^T_{\hat{\omega}} and TT^{\ast}. The latter is defined as T(x)=f(p(x)/qθ(x))T^{\ast}(x)=f^{\prime}(p(x)/q_{{\theta}^{\ast}}(x)), see main text. The objective value corresponding to TT^{\ast} is the true divergence Df(PQθ)D_{f}(P\rvert\lvert Q_{{\theta}^{\ast}}). In the majority of the cases our Tω^T_{\hat{\omega}} is close to TT^{\ast} in the area of interest. The discrepancies around the tails are due to the fact that (1) the class of functions resulting from the tanh\rm tanh activation function has limited capability representing the tails, and (2) in the Gaussian case there is a lack of data in the tails. These limitations, however, do not have a significant effect on the learned parameters.

Appendix F Details of the Experiments

In this section we present the technical setup as well as the architectures we used in the experiments described in Section 4.

We use the deep learning framework Chainer , version 1.8.1, running on CUDA 7.5 with CuDNN v5 on NVIDIA GTX TITAN X.

F.2 MNIST Setup

All weights are initialized at a weight scale of 0.050.05, as in .

where ELU is the exponential linear unit . All weights are initialized at a weight scale of 0.0050.005, one order of magnitude smaller than in .

For the variational autoencoders , we used the example implementation included with Chainer . We trained for 100 epochs with 20 latent dimensions.

F.3 LSUN Natural Images

where all Deconv operations use a kernel size of four and a stride of two.