Theoretical guarantees for sampling and inference in generative models with latent diffusions
Belinda Tzen, Maxim Raginsky
Introduction and informal summary of results
Recently there has been much interest in using continuous-time processes to analyze discrete-time algorithms and probabilistic models (Wibisono et al., 2016; Li et al., 2017; Mandt et al., 2017; Chen et al., 2018; Yang et al., 2018). In particular, diffusion processes have been examined as a way towards a better understanding of first- and second-order optimization methods, as they afford an analysis of behavior over non-convex landscapes using a rich array of techniques from the mathematical physics literature (Li et al., 2017; Raginsky et al., 2017; Zhang et al., 2017). Gradient flows and diffusions have also found a role in the analysis of deep neural nets, where they are interpreted as describing the limiting case of infinitely many layers, with each layer being ‘infinitesimally thin’ (e.g., Chen et al. (2018); Li et al. (2018)). As in the case of optimization, continuous-time frameworks enable the use of a different set of tools for studying standard questions of relevance, such as sampling and inference, i.e., forward and backward passes through the network.
In this work, we consider a class of generative models where the latent object is a -dimensional diffusion and the observable object is a random element of some space :
where (1.1a) is a -dimensional Itô diffusion process whose drift is a member of some parametric function class, such as multilayer feedforward neural nets, and (1.1b) prescribes an observation model for generating conditionally on . To the best of our knowledge, generative models of this form were first considered by Movellan et al. (2002) as a noisy continuous-time counterpart of recurrent neural nets. More recently, Hashimoto et al. (2016) and Ryder et al. (2018) investigated the use of discrete-time recurrent neural nets to approximate the population dynamics of biological systems that are classically modeled by diffusions. It is natural to view (1.1) as a continuum limit of deep generative models introduced by Rezende et al. (2014) — in fact, as we explain in Section 4, one can simulate a model of the above form using a deep generative model with a random number of layers. Alternatively, one can think of (1.1) as a neural stochastic differential equation, in analogy to the neural ODE framework of Chen et al. (2018).
There are three main questions that are natural to ask concerning the usefulness of such models: How expressive can they be? How might one sample from such a diffusion process? How might one perform inference on it? As our first contribution, we provide a unified view of sampling and inference through the lens of stochastic control. In particular, by adding a control to the drift of some reference diffusion, one can obtain a desired distribution at , and the minimal-cost control that yields exact sampling is given by the so-called Föllmer drift (Föllmer, 1985; Dai Pra, 1991; Lehec, 2013; Eldan and Lee, 2018). Complementarily, we show that any control added to the drift in (1.1a) leads to a variational upper bound on the log-likelihood of a given tuple of observations . Variational inference then reduces to minimizing the expected control cost over a tractable class of controls. While we provide a unifying viewpoint that captures both sampling and inference, we emphasize that this is a synthesis of a number of existing results, and serves as a conceptual underpinning and motivation for our subsequent analysis. Specifically, after establishing that diffusion-based generative models can be effectively worked with, we explore their expressive power vis-à-vis neural nets: We show that, if the target density of can be efficiently approximated using a neural net, then the corresponding Föllmer drift can also be efficiently approximated by a neural net, such that the terminal law of the diffusion with this approximate drift is -close to the target density in Kullback–Leibler divergence. Finally, we investigate unbiased simulation methods for generative models with underlying diffusion processes and provide bounds on the variance of the resulting estimators.
To arrive at the unified perspective of sampling and inference, we begin by formulating a stochastic control problem that captures all of our desiderata: sampling from a target probability law at terminal time ; a set of tractable controls that might be used to take it there; and an appropriate notion of cost with that captures both the ‘control effort’ and the terminal cost that quantifies the discrepancy between the final probability law and the target measure .
Our first result, stated in Theorem 2.1, is an explicit characterization of the value function of this control problem, which has a free-energy interpretation and can be understood from an information-theoretic viewpoint: the Kullback–Leibler divergence between the law of the path of the uncontrolled diffusion and that of the path of the controlled diffusion is the expected total work done by the control. The negative free energy with respect to the uncontrolled process is a lower bound on that of the controlled process after accounting for the work done, and equality is achieved by the optimal control. As pointed out above, this result is a synthesis of a number of existing results, and its main purpose is to motivate the use of controlled diffusions in probabilistic generative modeling.
Finally, we discuss the issue of unbiased simulation with the goal of estimating expected values of functions of . The standard Euler–Maruyama scheme (Graham and Talay, 2013, Chap. 7) is straightforward, but produces a biased estimator. Typically, one uses Monte Carlo sampling to reduce the variance; if the estimator is biased, then the variance will be reduced by a factor of for some , instead of the optimal reduction by the factor of , for Monte Carlo runs. One way to obtain an unbiased estimator is to employ a random discretization of the time interval $$, where the sampling times are generated by a point process on the real line. Unbiased simulation schemes of this type have been proposed and analyzed by Bally and Kohatsu-Higa (2015), Andersson and Kohatsu-Higa (2017), and Henry-Labordère et al. (2017). Our final result, Theorem 4.1, builds on the latter work and presents an unbiased, finite-variance simulation scheme. Conceptually, the simulation scheme can be thought of as a deep latent Gaussian model in the sense of Rezende et al. (2014), but with a random number of layers. Unfortunately, the variance of the resulting estimator can exhibit exponential dependence on dimension. We show why this is the case via an analysis of the moment-generating function of the point process used to generate the random mesh and propose alternatives to reduce the variance.
2 Notation
Exact sampling and variational inference: a unified stochastic control viewpoint
Before addressing the specific questions posed in the Introduction, we aim to demonstrate that both sampling and variational inference in generative models of the form (1.1) can be viewed through the lens of stochastic control. We give a brief description of the relevant ideas in Appendix A; the book by Fleming and Rishel (1975) is an excellent and readable reference.
Let be a probability space with a complete and right-continuous filtration , and let be a standard -dimensional Brownian motion adapted to . Consider the Itô diffusion process
and we say that a control is optimal if for all and . The following theorem is, essentially, a synthesis of the results of Pavon (1989) and Dai Pra (1991):
Consider the control problem (2.4). The value function is given by
where is the transition density (2.2) of the uncontrolled process.
This result, proved in Appendix A, also admits an information-theoretic interpretation. Let denote the probability law of the path of the uncontrolled diffusion process (2.1) and let denote the corresponding object for the controlled diffusion (2.3). Since and differ from each other by a change of drift, the probability measures and are mutually absolutely continuous, and the Radon–Nikodym derivative is given by the Girsanov formula (Protter, 2005)
where , with and denoting the th coordinates of and respectively. From (2.8), we can calculate the Kullback–Leibler divergence between and :
Therefore, by Theorem 2.1, for any control , we can write
with equality if and only if . An inequality of this form holds more generally for real-valued measurable functions of the entire path (Boué and Dupuis, 1998).
We will now demonstrate how both the problem of sampling and the problem of variational inference can be addressed via the above theorem.
2 Exact sampling: the Föllmer drift
Recall that, in the context of exact sampling, the objective is to construct a diffusion process , such that has a given target distribution . We will consider the case when is absolutely continuous with respect to the standard Gaussian measure and let denote the Radon–Nikodym derivative . This problem goes back to a paper of Schrödinger (1931); for rigorous treatments, see, e.g., Jamison (1975), Föllmer (1985), Dai Pra (1991), Lehec (2013), Eldan and Lee (2018). The derivation we give below is not new (see, e.g., Dai Pra (1991, Thm. 3.1)), but the route we take is somewhat different in that we make the stochastic control aspect more explicit.
We take and in (2.1). Then the diffusion process is simply the standard -dimensional Brownian motion , which has the Gaussian transition density
Now consider the control problem (2.4) with . By Theorem 2.1, the value function is given by , and can be computed explicitly. For , we have
where denotes the Euclidean heat semigroup (1.2). Hence, , and the optimal diffusion process has the drift . Following Lehec (2013) and Eldan and Lee (2018), we will refer to as the Föllmer drift in the sequel.
Moreover, using the entropy inequality (2.10), we can show that the Föllmer drift is optimal in the following strong sense: Consider any control with and with the property that . For any such control,
while clearly . Therefore, it follows from (2.10) that, for any such control ,
with equality if and only if . Thus, the Föllmer drift has the minimal ‘energy’ among all admissible controls that induce the distribution at , and this energy is precisely the Kullback–Leibler divergence between and the standard Gaussian measure (Dai Pra, 1991; Lehec, 2013; Eldan and Lee, 2018).
3 Variational inference
We now turn to the problem of variational inference. We are given an -tuple of observations , and wish to upper-bound the negative log-likelihood
where and is the diffusion process (1.1).
We take in (2.1) and consider the control problem (2.4) with for some fixed . Then, by Theorem 2.1, any control gives rise to an upper bound on :
Expressiveness
Now that we have shown that generative models of the form (1.1) allow for both sampling and variational inference, we turn to the analysis of their expressiveness. Specifically, our objective is to show that, by working with a suitable structured class of drifts , we can achieve approximate sampling from a rich class of distributions at the terminal time .
Let be the target probability measure for . We assume that is absolutely continuous with respect to and let denote the Radon–Nikodym derivative . From Section 2.2 we know that the diffusion process governed by the Itô SDE
with the Föllmer drift has the property that , and, moreover, it is optimal in the sense that it minimizes the ‘energy’ among all adapted drifts that result in distribution at time . The main result of this section is as follows: If the Radon–Nikodym derivative can be approximated efficiently by multilayer feedforward neural nets, then, for any , there exists a drift that can be implemented exactly by a neural net whose parameters do not depend on time or space, and the terminal law of the diffusion process
is an -approximation to in the KL-divergence: . Moreover, the size of the neural net that implements the approximate Föllmer drift can be estimated explicitly in terms of the size of a suitable approximating neural net for .
We begin by imposing some assumptions on . The first assumption is needed to guarantee enough regularity for the Föllmer drift:
The function is differentiable, both and are -Lipschitz, and there exists a constant , such that everywhere.
We assume that the activation function is differentiable and universal, in the sense that any univariate Lipschitz function which is nonconstant on a bounded interval can be approximated arbitrarily well by an element of :
We also make the following assumption regarding approximability of by neural nets:
Typical results on neural net approximation are concerned with approximating a given function uniformly on a given compact set. By contrast, Assumption 3.3 requires uniform approximability of both and its gradient on a compact set by some neural net and its gradient . Such simultaneous approximation guarantees can also be found in the literature, see, e.g., Hornik et al. (1990); Yukich et al. (1995); Li (1996). See Safran and Shamir (2017) for a discussion of various trade-offs between depth and width (maximum number of neurons per layer) in neural net approximation.
We are now in a position to state the main result of this section:
with the drift , then satisfies .
Let and . The Girsanov formula gives
where the interchange of the integral and the expectation follows from Fubini’s theorem because both and are bounded by Lemma B.1 in Appendix B and (3.7). We now proceed to estimate the integrand. For each ,
where by (3.6). To estimate , we first observe that, since the Föllmer drift is bounded in norm by by Lemma B.1, we have
(Bubeck et al., 2018, Lemma 3.8). Therefore,
Choosing large enough to guarantee and putting everything together, we obtain . Therefore, by the data processing inequality.
Unbiased simulation
In particular, for each ,
where is some constant that depends on and on the starting point (Graham and Talay, 2013). Recently, several authors (Bally and Kohatsu-Higa, 2015; Andersson and Kohatsu-Higa, 2017; Henry-Labordère et al., 2017) have studied unbiased simulation of SDEs using Euler–Maruyama schemes with random partitions, where the partition breakpoints are generated by a Poisson point process on the real line. In this section, we build on this line of work and present a scheme for unbiased simulation in the context of generative models of the form (1.1) that uses random partitions generated by arbitrary renewal processes (Kallenberg, 2002, Chap. 9) with sufficiently well-behaved densities of interrenewal times. Our analysis closely follows that of Henry-Labordère et al. (2017), but we provide a more refined analysis of the variance of the resulting estimators.
We first describe the simulation procedure. In what follows, we will drop the index from the drift to keep the notation clean. Let be i.i.d. nonnegative random variables with an absolutely continuous distribution whose support contains the interval for some . Let and denote the cdf and the pdf of . Let and
Define a process with as the Euler–Maruyama scheme (4.1) on the random partition of $$, and let
This process can be interpreted as a deep generative model in the sense of Rezende et al. (2014), but with a random number of layers. Specifically, let be independent of , and define recursively by taking and
where denotes equality of probability distributions. We are now ready to state our main result on unbiased simulation (see Appendix E for the proof):
Suppose that the drift is uniformly bounded, Lipschitz in , and -Hölder in , i.e., for some constants and ,
where , , and is the moment-generating function of .
For example, the type of drift used in the construction of Section 3 has the property (4.3). The key implication of Theorem 4.1 is that the variance of the estimator is controlled by the moment-generating function of , and is therefore related to the tail behavior of the sums . In some cases, one can calculate in closed form. For instance, if we take for some , then the estimator (4.2) reduces to the one introduced by Henry-Labordère et al. (2017). Since and for , (4.4) holds with and ; moreover, with
Thus, grows like , as already observed by Henry-Labordère et al. (2017). One way to reduce the variance is to choose the ’s with lighter tails. To see this, we need estimates of ; the following lemma provides a computable upper bound:
Let denote the moment-generating function of . Then
As an example, suppose are i.i.d. samples from the uniform distribution on for some . Then
and it is a matter of straightforward but lengthy algebra to show that for all satisfying
Using this in (4.6) yields the estimate . The density of a random variable clearly satisfies (4.4). Thus, applying Theorem 4.1 to the estimator (4.2) with , we see that its variance scales quasipolynomially in , i.e., . However, choosing ’s with lighter tails will generally lead to larger values of , i.e., a deeper generative model will be needed.
Appendix A The proof of Theorem 2.1
We first need some background on controlled diffusion processes, see, e.g., Fleming and Rishel (1975). As in Section 2, let be the set of controls, where each defines a controlled diffusion governed by the Itô SDE
where is the (time-varying) generator of the diffusion (2.1):
The PDE (A.2) is called the Bellman equation associated to the control problem (A.1).
In fact, the control (A.4) is optimal among a much wider class of adapted controls, i.e., all stochastic processes adapted to the filtration . The class defined above consists of so-called Markov controls, where is a deterministic function of and . In that case, the controlled diffusion is a Markov process.
We now turn to the proof of Theorem 2.1. The first step is to use the logarithmic transformation due to Fleming (1978); see also Fleming and Sheu (1985); Sheu (1991). Consider the function . By the Feynman–Kac formula (Kallenberg, 2002, Thm. 24.1), this function is a solution of the Cauchy problem
It is a matter of simple calculus to verify that solves the Cauchy problem
Moreover, using the variational representation
where the optimizer is given by , it is readily verified that (A.6) is the Bellman equation (A.2) associated to the control problem (2.4). Hence, by the verification theorem, is the value function we seek, and the optimal control is given by .
Since solves (A.5), the transition density of is given by (2.7) by a result of Jamison (1975) and Dai Pra (1991).
Appendix B Regularity properties of f𝑓f and the Föllmer drift
We first show that Assumption 3.1 holds for Gibbs measures
Likewise, the Lipschitz continuity of follows from the Lipschitz continuity of : since , we have
Finally, suppose that is also bounded from above, for some . Then everywhere, where because both and are probability measures.
We will also need the following simple lemma:
Under Assumption 3.1, the Föllmer drift is bounded in norm by and is Lipschitz with Lipschitz constant , where is the maximum of the Lipschitz constants of and .
Appendix C Uniform approximation of the heat semigroup by a finite sum
In this appendix, we prove the following result, which is used in the proof of Theorem 3.2:
We gather some preliminaries first. We recall the definition of the Orlicz exponential norm of order (Giné and Nickl, 2016, Sec. 2.3): for a real-valued random variable ,
The norm dominates the norm : . A simple application of Markov’s inequality leads to the following tail bound:
Let , where . Then .
This implies that (Giné and Nickl, 2016, Eq. (2.25)). Taking and using the triangle inequality, we obtain
where by Jensen’s inequality. ∎
Let , , be a collection of (possibly dependent) random variables with finite norms. Then we have the following maximal inequality:
which is a random variable under standard regularity assumptions on , such as separability. The expected supremum is controlled by the covering numbers of . The covering numbers of with respect to a probability measure on are defined by
The Koltchinskii–Pollard -entropy of is given by
where the supremum is over all probability measures supported on finitely many points of . Then we have the following bound on the expectation of (Theorem 3.54 and Eq. (3.177) in Giné and Nickl (2016)):
Let be a class of functions containing , such that
Let be i.i.d. copies of a random element of with probability law , such that . Then
We also have the following generalization of Talagrand’s concentration inequality to unbounded classes of functions, due to Adamczak (2008) (see also Sec. 2.3 in Koltchinskii (2011)):
Let be a class of real-valued functions on with envelope . Then there exists an absolute constant , such that, for any ,
With these preliminaries out of the way, we have the following result:
with probability at least .
Thus we can estimate the covering numbers of by
where , and therefore
where we have used the triangle inequality for , as well as the maximal inequality (C.3). Using the estimates (C.5), (C.6), and (C.7) in Adamczak’s inequality, we obtain (C.4). ∎
We are now ready to prove Theorem C.1. The proof is via the probabilistic method. Let and be given, and choose
We will show that , which will imply that there exists at least one realization of verifying the statement of the theorem.
By Lemma C.1, satisfies , and therefore satisfies by the maximal inequality (C.3). Consequently, it follows from (C.2) that
Moreover, since the function and all of its partial derivatives are -Lipschitz, Lemma C.4 (with ) and the union bound give . Therefore, .
Appendix D The proof of Theorem 3.2: uniform approximation of the Föllmer drift by a neural net
These approximations suffice for our purposes. However, if one uses the ReLU activation function , then both multiplication and reciprocals can be -approximated by neural nets with size and depth polylogarithmic in (Yarotsky, 2017; Telgarsky, 2017).
which is a -layer neural net with size . Indeed, using the polarization identity , we have
For approximating the reciprocal, consider the univarite function
which is -Lipschitz and constant outside of the interval . The existence of the function with the stated properties follows immediately from Assumption 3.2. ∎
can be computed by a neural net of size , such that
where we have used the fact that . Without loss of generality, we may assume that . Then, for any and ,
where we have used Lemma B.1 to bound . In other words, approximates to accuracy uniformly on . It remains to approximate by a neural net to accuracy .
To that end, we first represent as a composition of several elementary operations and then approximate each step by a neural net. Specifically, the computation of can be represented as a computation graph with the following structure:
Compute .
Compute .
Given and , is computed by a neural net with activation function , of size and depth . Therefore, by the cheap gradient principle (Lemma D.1), can be computed by a neural net of size , where the activation function of each neuron is an element of the set . Next, since takes values in , by Lemma D.2 the reciprocal can be computed to accuracy by a -layer neural net with activation function and of size
Let denote the resulting approximation. Then, since and , by Lemma D.2 the product can be approximated to accuracy by a -layer neural net with activation function and with at most
neurons. The overall accuracy of approximation is
Appendix E Proof of Theorem 4.1
We follow the strategy of Henry-Labordère et al. (2017) and construct a sequence of unbiased estimators, such that , where . By a standard approximation argument, we can assume that is bounded and Lipschitz.
Let and , for . For each , let
where . We will show that for all and that the sequence is uniformly integrable. Then it will follow from the dominated convergence theorem that
is also an unbiased estimator. Observe that the estimator defined in (C.2) differs from : instead of , we have . Just as in Henry-Labordère et al. (2017), the term proportional to serves as a control variate to ensure that has finite variance. Indeed, since , it is easy to see that
and therefore .
This process has the infinitesimal generator
Then, by Dynkin’s formula (Kallenberg, 2002, Lemma 19.21), for any ,
and using this in (E.3), we obtain the formula
In particular, since by the Feynman–Kac formula, we have
where since is a martingale.
Using Eq. (E.5) with and , we have
Recalling that is independent of the Brownian motion and , we have
where the last equality follows from the fact that if and only if .
Moreover, if we change the initial condition from to , then it follows from (E.9) that, conditionally on , whenever ,
Substituting (E.10) into (E.8) and using the fact that the event is equivalent to , we have . Repeating this procedure, we have
We claim that the sequence is uniformly integrable. To see this, first observe that, for each , . Then the uniform integrability follows from the boundedness of , , , and from Lemma E.2 in Section E.3. Therefore, taking the limit as , we obtain
where the second equality follows from the dominated convergence theorem.
E.2 Variance
Let . For , let denote the increments of . Since , we have
Using this and (4.4), we can upper-bound as follows:
Let . Then, since , where is independent of , we have
E.3 Auxiliary lemmas
The next lemma is used to show that the sequence is uniformly integrable:
For each , define the -simplex
with and . Consider the partial sums . Since the ’s are i.i.d., the conditional joint density of given is equal to
where we have set . Then a calculation similar to the one in Appendix B of Andersson and Kohatsu-Higa (2017) leads to
where is the Lebesgue measure on and
Appendix F Proof of Lemma 4.1
For each , let . Then and for . Moreover, is a renewal process with renewal times and i.i.d. interrenewal times with pdf . The moment-generating function of can be upper-bounded as follows (Glynn and Whitt, 1994):
Using Markov’s inequality and the fact that the ’s are i.i.d., we can further estimate
Substituting these estimates into (F.1) and optimizing over , we get (4.6).
Acknowledgments
The authors would like to thank Matus Telgarsky for many enlightening discussions. This work was supported in part by the NSF CAREER award CCF-1254041, in part by the Center for Science of Information (CSoI), an NSF Science and Technology Center, under grant agreement CCF-0939370, in part by the Center for Advanced Electronics through Machine Learning (CAEML) I/UCRC award no. CNS-16-24811, and in part by the Office of Naval Research under grant no. N00014-12-1-0998.