<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>A stochastic version of Stein variational gradient descent for efficient sampling</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>01/01/2020</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10294790</idno>
					<idno type="doi">10.2140/camcos.2020.15.37</idno>
					<title level='j'>Communications in Applied Mathematics and Computational Science</title>
<idno>1559-3940</idno>
<biblScope unit="volume">15</biblScope>
<biblScope unit="issue">1</biblScope>					

					<author>Lei Li</author><author>Yingzhou Li</author><author>Jian-Guo Liu</author><author>Zibu Liu</author><author>Jianfeng Lu</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[We propose in this work RBM-SVGD, a stochastic version of the Stein variational gradient descent (SVGD) method for efficiently sampling from a given probability measure, which is thus useful for Bayesian inference. The method is to apply the random batch method (RBM) for interacting particle systems proposed by Jin et al. to the interacting particle systems in SVGD. While keeping the behaviors of SVGD, it reduces the computational cost, especially when the interacting kernel has long range. We prove that the one marginal distribution of the particles generated by this method converges to the one marginal of the interacting particle systems under Wasserstein-2 distance on fixed time interval [0, T ]. Numerical examples verify the efficiency of this new version of SVGD.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">Introduction</head><p>The empirical measure with samples from some probability measure (which might be known up to a multiplicative factor) has many applications in Bayesian inference <ref type="bibr">[5; 3]</ref> and data assimilation <ref type="bibr">[17]</ref>. A class of widely used sampling methods is the Markov chain Monte Carlo (MCMC) methods, where the trajectory of a particle is given by some constructed Markov chain with the desired distribution invariant. The trajectory of the particle is clearly stochastic, and the Monte Carlo methods take effect slowly for small number of samples. Unlike MCMC, the Stein variational gradient method (proposed by <ref type="bibr">Liu and</ref> Wang in <ref type="bibr">[20]</ref>) belongs to particlebased variational inference sampling methods (see also <ref type="bibr">[22; 9]</ref>). These methods update particles by solving optimization problems, and each iteration is expected to make progress. As a nonparametric variational inference method, SVGD gives a deterministic way to generate points that approximate the desired probability distribution by solving an ODE system. Suppose that we are interested in some target probability distribution with density &#960;(x) &#8733; exp(-V (x)) (x &#8712; &#8235;&#1938;&#8236; d ). In SVGD, one sets V = -log &#960;, chooses some symmetric positive definite kernel (x, y), 38 LEI LI, YINGZHOU LI, JIAN-GUO LIU, ZIBU LIU AND JIANFENG LU and solves the following ODE system for given initial points {X i (0)} N i=1 <ref type="bibr">[20; 19]</ref>:</p><p>(X i , X j )&#8711;V (X j ), i = 1, . . . , N , (</p><p>where N is the number of particles for the sampling purpose. The subindex "y" in &#8711; y means that the gradient is taken with respect to the second variable in ( &#8226; , &#8226; ); i.e., &#8711; y (X i , X j ) := &#8711; y (x, y)| (x,y)=(X i ,X j ) . When t is large enough, the empirical measure constructed using {X i (t)} N i=1 is expected to be close to &#960;, i.e.,</p><p>1</p><p>Below, in Section 2, we will explain why this is expected to be true. Theoretic understanding of (1-1) is limited. For example, the convergence of the particle system (1-1) is still open. Recently, there have been a few attempts at understanding the limiting mean field PDE <ref type="bibr">[19; 21]</ref>. In particular, Lu et al. <ref type="bibr">[21]</ref> showed the convergence of the mean field PDE to the desired measure &#960;.</p><p>In practice, SVGD seems to perform quite well, better compared with some typical Monte Carlo methods in some examples <ref type="bibr">[19; 10]</ref>. It provides consistent estimation for generic distributions as Monte Carlo methods do, but with fewer samples. SVGD seems to be more efficient than some Monte Carlo methods in the particle level for approximating the desired measure, when the number of particles is small. Interestingly, it reduces to the maximum a posterior (MAP) method when N = 1 <ref type="bibr">[20]</ref>.</p><p>Though (1-1) behaves well when the particle number N is not very big, one sometimes still needs an efficient algorithm to simulate (1-1). For example, when the dimension of the problem is not very high, in a typical MCMC method, the number of particles is several millions, or N &#8776; 10 6 , while in SVGD, one may have N &#8776; 10 3 . Simulating (1-1) needs O(N 2 ) work to compute the interactions for each iteration, especially for interaction kernels that are not superlocalized or particles that are not sparse. In fact, for such situations, to compute the interaction force for one particle, one must consider all the other N -1 particles to have enough accuracy. There are N particles, so one must consider O(N 2 ) interactions, which yields the O(N 2 ) complexity for one iteration. Though N &#8776; 10 2 -10 3 is not large, the O(N 2 ) complexity makes the cost of SVGD for these cases comparable with MCMC with larger number of particles. Hence, it is highly motivated to develop a cheap version of SVGD.</p><p>In this work, we propose RBM-SVGD, a stochastic version of SVGD for sampling from a given probability measure. The idea is very natural: we apply the random batch method in <ref type="bibr">[16]</ref> to the interacting particle system (1-1). Note that in the random batch method, the "batch" refers to the set for computing the interaction forces, not to be confused with the "batch" of samples for computing gradient as in stochastic gradient descent (SGD). Of course, if V is the loss function corresponding to many samples, or the probability density in Bayesian inference corresponding to many observed data, the data-mini-batch idea can be used to compute &#8711;V in SVGD as well <ref type="bibr">[20]</ref>. With the random batch idea for computing interaction, the complexity for each iteration now is only O(N ). Moreover, it inherits the advantages of SVGD (i.e., efficient for sampling when the number of particles is not large) since the random batch method is designed to approximate the particle system directly. In fact, we will prove that the one marginal of the random batch method converges to the one marginal of the interacting particle systems under Wasserstein-2 distance on a fixed time interval [0, T ]. Note that the behavior of randomness in RBM-SVGD is different from that in MCMC. In MCMC, the randomness is required to ensure that the desired probability is invariant under the transition. The randomness in RBM-SVGD is simply due to the batch for computing the interaction forces, which is mainly for speeding up the computation. Though this randomness is not essential for sampling from the invariant measure, it may have other benefits. For example, it may lead to better ergodic properties for the particle system.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">Mathematical background of SVGD</head><p>We now give a brief introduction to the SVGD proposed in <ref type="bibr">[20]</ref> and provide some discussions. The derivation here is a continuous counterpart of that in <ref type="bibr">[20]</ref>.</p><p>Assume that random variable X &#8712; &#8235;&#1938;&#8236; d has density p 0 (x). Consider some mapping -: &#8235;&#1938;&#8236; d &#8594; &#8235;&#1938;&#8236; d , and we denote the distribution of -(X ) by p := -# p 0 , which is called the push-forward of p 0 under -. The goal is to make -# p 0 closer to &#960;(x) in some sense. The way to measure the closeness of measures in <ref type="bibr">[20]</ref> is taken to be the Kullback-Leibler (KL) divergence, which is also known as the relative entropy, defined by</p><p>where d&#181; d&#957; is the well known Radon-Nikodym derivative. In <ref type="bibr">[20,</ref><ref type="bibr">Theorem 3.1]</ref>, it is shown that the Gateaux differential of -&#8594; G(-) := KL( p &#960;) is given by</p><p>where S q associated with a probability density q is called the Stein operator given by</p><p>In fact, using the formula</p><p>(2-5)</p><p>The quantity &#948;G &#948;-, &#966; can be understood as the directional derivative of G( &#8226; ) in the direction given by &#966;. The paring in the second term above is in L 2 &#8235;&#1938;(&#8236; d ) sense.</p><p>Based on this calculation, we now consider a continuously varying family of mappings&#964; with &#964; &#8805; 0 and</p><p>Here, "&#8226;" means composition, i.e., for any given x, d d&#964;&#964; (x) = &#966; &#964; (&#964; (x)). In this sense x &#8594; X (&#964; ; x) :=&#964; (x) is the trajectory of x under this mapping; x can be viewed as the so-called Lagrangian coordinate as in fluid mechanics while &#966; &#964; is the flow field. We denote p &#964; := (&#964; ) # p 0 .</p><p>(2-6)</p><p>The idea is then to choose &#966; &#964; such that the functional &#964; &#8594; G(&#964; ) decays as fast as possible. Note that to optimize the direction, we must require the field to have bounded magnitude &#966; &#964; H &#8804; 1, where H is some subspace of the functions defined on &#8235;&#1938;&#8236; d . The optimized curve &#964; &#8594;&#964; is a constant-speed curve (in some manifold).</p><p>Hence, the problem is reduced to the optimization problem</p><p>It is observed in <ref type="bibr">[20]</ref> that this optimization problem can be solved by a convenient closed formula if H is the so-called (vector) reproducing kernel Hilbert space (RKHS) <ref type="bibr">[1; 2]</ref>. A (scalar) RKHS is a Hilbert space, denoted by &#5108;, consisting of functions defined on some space (in our case = &#8235;&#1938;&#8236; d ) such that the evaluation function f &#8594; E x ( f ) := f (x) is continuous for all x &#8712; . There thus exists k x &#8712; &#5108; such that E x ( f ) = f, k x &#5108; . Then the kernel (x, y) := k x , k y &#5108; is symmetric and positive definite, meaning that n i=1 n j=1 (x i , x j )c i c j &#8805; 0 for any x i &#8712; and c i &#8712; &#8235;.&#1938;&#8236; Reversely, given any positive definite kernel, one can construct a RKHS consisting of functions f (x) of the form f (x) = (x, y)&#968;(y) d&#181;(y) where &#181; is some suitably given measure on . For example, if &#181; is the counting measure, choosing &#968;(y) = &#8734; j=1 a j 1 x j (y) (a j &#8712; &#8235;)&#1938;&#8236; can recover the form of RKHS in <ref type="bibr">[20]</ref>. All such constructions yield isomorphic RKHS as guaranteed by the Moore-Aronszajn theorem <ref type="bibr">[1]</ref>. Now, consider a given &#181; and H = &#5108; d to be the vector RKHS:</p><p>The inner product is defined as</p><p>This inner product therefore induces a norm f H = &#8730; f, f H . Clearly, H consists of functions with &#8226; H to be finite. The optimization problem (2-7) can be solved by the Lagrange multiplier method</p><p>where dy means Lebesgue measure and &#966;(x) = &#8235;&#1938;&#8236; d (x, y)&#968;(y) d&#181;(y). Using </p><p>where S * &#960; is given by</p><p>(2-10)</p><p>The ODE flow</p><p>gives the constant-speed optimal curve, so that the velocity is the unit vector in H along the gradient of G. Reparametrizing the curve t = t (&#964; ) so that d&#964; dt = 2&#955; and denoting &#961; t := p &#964; (t) , then</p><p>Clearly, the curve oft is not changed by this reparametrization. Using (2-4), one finds that &#961; satisfies the equation</p><p>Here, * f (x) := (x, y) f (y) dy. It is easy to see that exp(-V ) is invariant under this PDE. According to the explanation here, the right-hand side gives the optimal decreasing direction of KL divergence if the transport flow is measured by RKHS. Hence, one expects it to be the negation of gradient of KL divergence in the manifold of probability densities with metric defined through RKHS. Indeed, Liu made the first attempt to justify this in <ref type="bibr">[19, &#167;3.4]</ref>.</p><p>The above theory has a little trouble for empirical measures because the KL divergence is simply infinity. For empirical measure, &#8711;&#961; must be in the distributional sense. The good thing for RKHS is that we can move the gradient from &#8711;&#961; onto the kernel (x, y) so that the flow <ref type="bibr">(2)</ref><ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref><ref type="bibr">(7)</ref><ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref> becomes (1-1), which makes perfect sense. In fact, if (1-1) holds, the empirical measure is a measure solution to <ref type="bibr">(2)</ref><ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref><ref type="bibr">(7)</ref><ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref><ref type="bibr">(12)</ref> (by testing on smooth function &#981;) [21, Proposition 2.5]. Hence, the ODE system is justified in this level, and one expects that (1-1) will give an approximation for the desired density. The numerical tests in <ref type="bibr">[20]</ref> indeed justify this expectation. In this sense, the ODE system is formally a gradient flow of KL divergence, though the KL divergence functional is infinity for empirical measures.</p><p>Typical examples of (x, y) include (x, y) = (&#945;x &#8226; y + 1) m , Gaussian kernel (x, y) = e -|x-y| 2 /(2&#963; 2 ) for &#8235;&#1938;&#8236; d , and (x, y) = (sin a(xy))/(&#960;(xy)) for 1D space &#8235;.&#1938;&#8236; By Bochner's theorem <ref type="bibr">[25]</ref>, if a function K has a positive Fourier transform, then</p><p>is a positive definite kernel. With this kernel, (1-1) becomes</p><p>as used in <ref type="bibr">[21]</ref>. Both Gaussians and 1/|x| &#945; with &#945; &#8712; (0, d) have positive Fourier transforms. The difference is that the Gaussian has a short range of interaction while the latter has a long range of interaction. One can smoothen 1/|x| &#945; out by mollifying with Gaussian kernels, resulting in positive definite smooth kernels but with long-range interaction. Choosing localized kernels like Gaussians may have some issues in very high-dimensional spaces <ref type="bibr">[12; 10]</ref>. Due to its simplicity, when the dimension is not very high, we choose Gaussian kernels in Section 4. As a further comment, one may consider other metrics to gauge the closeness of probability measures, such as Wasserstein distances. Also, one can consider other norms for &#966; and get gradient flows in different spaces. These variants have been explored by some authors already <ref type="bibr">[18; 8]</ref>. In general, computing the Frech&#233;t derivatives in closed form for these variants seems not that easy.</p><p>Remark. If we optimize (2-7) for &#966; in L 2 &#8235;&#1938;(&#8236; d ; &#8235;&#1938;&#8236; d ) spaces, the flow is then given by</p><p>The corresponding PDE is</p><p>. This is in fact the case when we choose (x, y) = &#948;(xy). This PDE, however, will not make sense for empirical measures since &#961;&#8711;&#961; is hard to justify (clearly, the equivalent ODE system has the same trouble). By using RKHS, the derivative on &#8711;&#961; can be moved onto the kernel and then the ODE system makes sense.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">The new sampling algorithm: RBM-SVGD</head><p>In this section, we introduce the "random batch" or "mini-batch" idea, which has already appeared in many places, and recall the random batch method for simulating interacting particle systems in <ref type="bibr">[16]</ref>. By applying the random batch method to (1-1), we obtain a new algorithm, called RBM-SVGD. The proof that RBM-SVGD is close to SVGD on finite time interval is given in Section 3.2. (g(z j ; &#969;), y j ),</p><p>where (z j , y j ) M j=1 are some given data set, g( &#8226; ; &#969;) is a model that takes z j as an input and gives some prediction to y j , and ( &#8226; , &#8226; ) is some function to gauge the discrepancy between g(z j ; &#969;) and y j . Hence, the problem is to find &#969; such that the discrepancy is small enough. Often ( &#8226; , &#8226; ) is a neural network so that computing the gradient is not easy. Hence, if one aims to find the minimizer using gradient descent, the computation cost is high. The idea of "mini-batch" or "random batch" is to choose a small random subset &#958; of {1, 2, . . . , N }, and consider the unbiased random estimate</p><p>with B = |&#958; |, the size of &#958; . Using this unbiased estimation L &#958; to replace the original true gradient &#8711; L &#958; &#8776; &#8711; L, one can form the so-called stochastic gradient descent (SGD) <ref type="bibr">[4; 6]</ref>. Using a similar idea for Langevin dynamics, Welling and Teh obtained a Markov chain Monte Carlo method, called the stochastic gradient Langevin dynamics (SGLD), useful for Bayesian inference <ref type="bibr">[29]</ref>.</p><p>for m in 1 : N T do Divide {1, 2, . . . , pn} into n batches randomly.</p><p>for each batch &#5103; q do Update X i (i &#8712; &#5103; q ) by solving the equation for t &#8712; [t m-1 , t m ):</p><p>(3-4)</p><p>end for end for Algorithm 1. Random batch method without replacement.</p><p>Consider in general the interacting particle system of the form</p><p>Here, F(x, y) does not have to be symmetric, and also F(x, x) is not necessarily zero. It is desirable to develop some cheap random approximation to the interacting forces so that the one-step O(N 2 ) complexity can be reduced. One idea is to use the "random batch" idea, but how to develop the concrete "random batch" algorithm depends on the concrete applications. Regarding the interacting particle systems, Jin et al. proposed some random grouping approach to achieve this goal in <ref type="bibr">[16]</ref>.</p><p>Here, we adopt the random batch method in <ref type="bibr">[16]</ref> to  and then obtain a stochastic version method for the SVGD ODE system (1-1). For this reason, we explain the random batch method a little bit. Choose a time step &#951;. We define time grid points t m = m&#951;.</p><p>(3-3)</p><p>At t m , one divides the particles into groups randomly, and each group is called a "batch", and then turns on interactions inside batches only. As indicated in <ref type="bibr">[16]</ref>, the random division of the particles into n batches takes O(N ) operations (one can for example use random permutation). Depending on whether one does batches without or with replacement, one can have different versions (see Algorithms 1 and 2). For the ODEs in the algorithms, one can apply any suitable ODE solver. For example, one can use the forward Euler discretization if F is smooth like Gaussian kernels. If K is singular, one may take p = 2 and apply the splitting strategy in <ref type="bibr">[16]</ref>.</p><p>For the SVGD ODE system (1-1), the kernel F takes the form</p><p>Applying the random batch method to this special kernel and using any suitable ODE solvers, we get a class of sampling algorithms, which we will call RBM-SVGD. In for m in 1 : N T * (N / p) do Pick a set &#5103; of size p randomly. Update X i (i &#8712; &#5103;) by solving the following with pseudotime s &#8712; [s m-1 , s m ):</p><p>(3-5)</p><p>end for Algorithm 2. Random batch method with replacement.</p><p>for k in 0 : N T -1 do Divide {1, 2, . . . , pn} into n batches randomly.</p><p>for each batch &#5103; q do For all i &#8712; &#5103; q ,</p><p>where</p><p>end for end for Algorithm 3. RBM-SVGD.</p><p>this work, we will focus on the ones without replacement. The one with forward Euler discretization (with possible variant step size) is shown in Algorithm 3. Clearly, the complexity is O( pN ) for each iteration.</p><p>Here, N T is the number of iterations and {&#951; k } is the sequence of time steps, which play the same role as learning rate in SGD <ref type="bibr">[4; 6]</ref>. For some applications, one may simply set &#951; k = &#951; 1 to be a constant and get relatively good results. However, in many high-dimensional problems, choosing &#951; k to be constant may yield divergent sequences <ref type="bibr">[23]</ref>. One may decrease &#951; k to obtain convergent data sequences. For example, one may simply choose &#951; k = 1/k as in SGD. Another frequently used strategy is the AdaGrad approach <ref type="bibr">[11; 28]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2.">Theoretic results</head><p>. We now give convergence analysis regarding the timecontinuous version of RBM-SVGD on torus &#8235;&#1940;&#8236; d (i.e., choosing the particular force (3-6) for Algorithm 1 and X i &#8712; &#8235;&#1940;&#8236; d ). The analysis in this section justifies the expectation that RBM-SVGD should give similar performance as the original SVGD, as confirmed by the numerical experiments in Section 4.</p><p>By "torus", we mean the domain is equipped with periodic boundary conditions. The derivation of SVGD clearly stays unchanged for the torus. The reason we consider a torus is that (1-1) is challenging to analyze in &#8235;&#1938;&#8236; d because of the nonlocal effect of the external force. On the torus, all functions are smooth and bounded. Moreover, using bounded domains with periodic boundary condition can always approximate the problem in &#8235;&#1938;&#8236; d in practice.</p><p>Consider the random force for z = (x 1 , . . . , x N ) &#8712; &#8235;&#1940;&#8236; N d defined by</p><p>where &#5103; is the random batch that contains i in the random batch method. Correspondingly, the exact force is given by</p><p>Define the "noise" by</p><p>We have the following consistency result regarding the random batch.</p><p>Lemma 1. For given z = (x 1 , . . . , x N ) &#8712; &#8235;&#1940;&#8236; N d (or &#8235;&#1938;&#8236; N d ), it holds that</p><p>Moreover, the second moment is given by</p><p>where</p><p>(3-12)</p><p>The proof is similar to that in <ref type="bibr">[16]</ref>, but we also attach it in Appendix A for convenience.</p><p>We recall that the Wasserstein-2 distance is given by [26]</p><p>where (&#181;, &#957;) is called the transport plan, consisting of all the joint distributions whose marginal distributions are &#181; and &#957;, respectively: i.e., for any Borel set We now state the convergence result for the time-continuous version of RBM-SVGD, where we recall that F(x, y) given by <ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref>. We use X to denote the process generated by the random algorithm while X is the process by (1-1). The particles are exchangeable if the initial values are sampled i.i.d. from the same distribution. Hence, the distributions of X i are the same, and we call this one-particle distribution the one marginal distribution, which is a probability measure in &#8235;&#1940;&#8236; d or &#8235;&#1938;&#8236; d . We denote it by &#181; (1)  N for convenience. Similarly, we introduce the one marginal distribution for the particles generated by the random algorithm, denoted by &#956;(1)</p><p>N .</p><p>Theorem 2. Assume V and K are smooth on torus &#8235;&#1940;&#8236; d . The initial data X 0 i are drawn independently from the same initial distribution. Given T &gt; 0, there exists C(T ) &gt; 0, such that</p><p>Consequently, the one marginals &#181; (1)  N and &#956;(1) N are close under Wasserstein-2 distance:</p><p>Proof. In the proof below, the constant C will represent a general constant independent of N and p, but its concrete meaning can change for every occurrence.</p><p>Consider the corresponding two processes and t &#8712; [t m-1 , t m ]:</p><p>and</p><p>Taking the difference and dotting with X i -X i , one has</p><p>where</p><p>Hence, introducing</p><p>Due to the smoothness of K and V on the torus, we easily find</p><p>where C is independent of N . Note that &#5103; is not independent of X j (t) for t &gt; t m-1 , so to continue we must consider conditional expectation. Let &#5106; m-1 be the &#963;algebra generated by X i (&#964; ), X i (&#964; ) for &#964; &#8804; t m-1 (including the initial data drawn independently) and the random division of the batches at t m-1 . Then <ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref><ref type="bibr">(7)</ref><ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref><ref type="bibr">(12)</ref><ref type="bibr">(13)</ref><ref type="bibr">(14)</ref> directly implies almost surely that</p><p>Thus, defining the error process</p><p>Note that</p><p>The inside of the parentheses can be estimated as</p><p>The first term on the right-hand side then becomes u(t m-1 ) by Lemma 1. By <ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref><ref type="bibr">(7)</ref><ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref><ref type="bibr">(12)</ref><ref type="bibr">(13)</ref><ref type="bibr">(14)</ref><ref type="bibr">(15)</ref><ref type="bibr">(16)</ref>, it is clear that</p><p>Hence,</p><p>where C is independent of N . Since u(t m-1 ) &#8804; Cu(t) + C&#951; 2 by (3-18), then</p><p>Letting Z = (X 1 , . . . , X N ), one sees easily that I 2 = &#967; i (Z (t)). Then, we find</p><p>In J 2 , Y i (t m-1 ) is independent of the random batch division at t m-1 . Then, Lemma 1 tells us that &#8235;&#1925;&#8236;J 2 = 0.</p><p>Using <ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref><ref type="bibr">(7)</ref><ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref><ref type="bibr">(12)</ref><ref type="bibr">(13)</ref><ref type="bibr">(14)</ref>, we have</p><p>where C is related to the infinity norm of the variance of &#967; i (t). This is the main term in the local truncation error. Just as we did for I 1 ,</p><p>this is controlled by C u(t m-1 ) + C&#951;. Hence,</p><p>Using the fact that u(t m-1 ) &#8804; u(t) + C&#951;, one eventually has that</p><p>Applying Gr&#246;nwall's inequality, we find</p><p>The last claim for W 2 distance follows from the definition of W 2 .</p><p>Note that the one marginal &#181; (1)  N (t) is the distribution of X i (t) for any i, which is deterministic. This should be distinguished from the empirical measure &#181; N = (1/N ) i &#948;(x -X i (t)) which is random. As can be seen from the proof, the main contribution in the local truncation error comes from the variance of the noise &#967; i .</p><p>As can be seen, the error bound is given by the square root of variance of the random force times &#8730; &#951; = &#8730; T /N T with N T being the number of steps. Hence, the result is a type of law of large number convergence result (see <ref type="bibr">[16]</ref> for more details). The bigness of the variance on one hand depends on the batch size as 1/( p -1) -1/(N -1), while on the other hand depends on the bigness of the interaction. As long as the variance is bounded, the convergence of random batch method is ensured.</p><p>One crucial part is that the bigness of the variance depends on the bigness of the interaction, instead of the range of the interaction. This means that the random batch version of the algorithm is particularly useful when the interaction has long range or when the particles are not sparse. In fact, if the interaction has short range and the particles are sparse, one can use some data structure like cell-list <ref type="bibr">[13,</ref> Appendix F] to reduce the computation of the interactions from O(N 2 ) to O(N ). However, when the interaction has long range or is not sparse (like the case in the example in Section 4.2), those data structures cannot be used any more, and RBM-SVGD becomes useful: it can still reduce the cost from O(N 2 ) to O(N ).</p><p>As another observation, according to <ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref><ref type="bibr">(7)</ref><ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref> and <ref type="bibr">(3)</ref><ref type="bibr">(4)</ref><ref type="bibr">(5)</ref><ref type="bibr">(6)</ref><ref type="bibr">(7)</ref><ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref><ref type="bibr">(12)</ref>, the bigness of the variance depends on the bigness of the interaction kernel. As long as the variance stays controlled, the convergence of RBM-SVGD to SVGD is guaranteed. In this sense, the range of the interaction kernel is not sensitive to RBM-SVGD, so it can intrinsically be used for kernels that have long range. The choice of kernels clearly affects the performance of SVGD, but it seems not so significant for RBM-SVGD to approximate SVGD. In other words, we expect RBM-SVGD to work well when the kernel is chosen such that SVGD behaves well. In fact, our experience in Section 4 confirmed this.</p><p>Remark. We believe the error bound in Theorem 2 can be made independent of T due to the intrinsic structure of SVGD discussed above in Section 2. Then RBM-SVGD can be used as the efficient sampling algorithm from the desired distribution &#960; . Such long time estimates are often established by some contracting properties of the ODE flows, so one may want to find the intrinsic converging structure of (1-1). However, rigorously establishing such results seems nontrivial due to the nonlocal effects of the external forces (&#8711;V terms).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">Numerical experiments</head><p>We consider some test examples in <ref type="bibr">[19]</ref> to validate RBM-SVGD algorithm and compare with the original SVGD algorithm. In particular, in a toy example for 1D Gaussian mixture, RBM-SVGD is proved to be effective in the sense that the particle system converges to the expected distribution with less running time than the original SVGD method. A more practical example, namely Bayesian logistic regression, is also considered to verify the effectiveness of RBM-SVGD on large data sets in high dimension. Competitive prediction accuracy is presented by RBM-SVGD, and less time is needed. Hence, RBM-SVGD seems to be a more efficient method.</p><p>All numerical results in this section are implemented with Matlab R2018a and performed on a machine with Intel Xeon CPU E5-1650v2 at 3.50 GHz with 64 GB memory.</p><p>4.1. 1D Gaussian mixture. As a first example, we use the Gaussian mixture probability in <ref type="bibr">[20]</ref> for RBM-SVGD. The initial distribution is &#5114;(-10, 1), Gaussian with mean -10 and variance 1. The target density is given by the Gaussian mixture</p><p>The kernel for the RKHS is the Gaussian kernel where h is the bandwidth parameter. For a fair comparison with the numerical results in <ref type="bibr">[20]</ref>, we first reproduce their results using N = 100 particles and dynamic bandwidth parameter h = med 2 /(2 log N ), where med is the median of the pairwise distance between the current points. Since dynamic bandwidth is infeasible for RBM-SVGD, we produce the results with fixed bandwidth h = 2 for the comparison between SVGD and RBM-SVGD. The RBM-SVGD uses Algorithm 3 with initial step size 0.2 and the following step sizes generated from AdaGrad. Different batch sizes are tested to demonstrate the efficiency of RBM-SVGD. Numerical results are illustrated in Figure <ref type="figure">1</ref> with the same initial random positions of particles following an &#5114;(-10, 1) distribution.</p><p>As stated in <ref type="bibr">[20]</ref>, the difficulty lies in the strong disagreement between the initial density function and the target density &#960;(x). According to the first and second rows in Figure <ref type="figure">1</ref>, SVGD with and without the fixed bandwidth parameter capture the target density efficiently and the corresponding convergence behaviors are similar to each other. Reading from the last column of Figure <ref type="figure">1</ref>, we observe that RBM-SVGD inherits the advantage of SVGD in the sense that it can conquer the challenge and also show compelling result with SVGD. When the batch size is small, e.g., p = 2 or p = 5, the estimated densities differ from that of SVGD, and according to our experience, the estimated densities are not very stable across several executions while, in theory, RBM-SVGD runs N / p times faster than SVGD. Hence, RBM-SVGD with p = 5 at the 500-th iteration costs the same as 50 iterations of SVGD. According to Figure <ref type="figure">1</ref>, RBM-SVGD(2) at the 500-th iteration significantly outperforms the 50-th iteration of SVGD. As we increase the batch size, as in the last two rows of Figure <ref type="figure">1</ref>, more stable and similar behavior to SVGD is observed.</p><p>Provided the good performance of RBM-SVGD, we also check the sampling power and its computational cost. We conduct the following simulations with N = 256 particles for 500 iterations with the Gaussian kernel (4-2). For RBM-SVGD, we use fixed bandwidth h = 2 whereas SVGD uses the aforementioned dynamic bandwidth strategy. When we apply SVGD or RBM-SVGD with different batch sizes, the same initial random positions of particles is used. For a given test function h(x), we compute the estimated expectation h = (1/N ) N i=1 h(X i (T )) and the sampling accuracy is measured via the minimum square error (MSE) over 100 random initializations following the same distribution as before:</p><p>where &#8235;&#1925;&#8236; X &#8764;&#960; h(X ) denotes the underlying truth. Three test functions are explored, h 1 (x) = x, h 2 (x) = x 2 , and h 3 (x) = cos 2x, with their corresponding true expectations being 2 3 , 5, and (cos 4)/e 2 . The reported run time is also averaged over 100 random initializations.</p><p>Figure <ref type="figure">2</ref> shows the MSE against different batch sizes for h 1 (x), h 2 (x), and h 3 (x), respectively. The results of RBM-SVGD with different batch sizes are connected by lines, whereas the results of SVGD are the isolated points with batch size p = 256. In general, the estimations of h 1 (x) and h 2 (x) are better than that of h 3 (x), which agrees with the difficulty of the problems. Table <ref type="table">1</ref> shows the averaged run time of RBM-SVGD and SVGD for different batch sizes under two different implementations in Matlab. RBM-SVGD is faster than SVGD for all choices of batch size. With respect to the two implementations in Matlab, for the first block row, within each batch, a matrix operation is adopted in computing the kernel matrix  whereas for the second block row, the kernel matrix is computed row by row. Matlab naturally is more favorable in the first implementation, which hence achieves fastest run time for all different batch sizes. For other programming languages, e.g., C++, Fortran, etc., the speedup of the second block row is excepted, which is close to ideal case as we predicted earlier.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2.">Double banana.</head><p>In this section, we will compare RBM-SVGD with MCMC, specifically Metropolis-Hastings (MH) <ref type="bibr">[15]</ref>. The algorithmic detail of Metropolis-Hastings is available in Appendix B. The performance of RBM-SVGD and MH on a Bayesian inference task is compared to illustrate the advantage of RBM-SVGD. When the number of particles is not very large and desired accuracy is not high, RBM-SVGD can be more efficient.</p><p>We run MH and RBM-SVGD on a Bayesian inference task which is exactly the experiment in <ref type="bibr">[10]</ref>. In this inference problem, our unknown parameter x is in &#8235;&#1938;&#8236; 2 . The observational data y is a real number which is determined by the forward map &#5106;(x) and the observational noise, i.e., y = &#5106;(x) + &#958; , where the forward map is a scalar logarithmic Rosenbrock function <ref type="bibr">[24]</ref> &#5106;(x) = log((1 -x 1 ) 2 + 100(x 2 -x 2 1 ) 2 ) for x = (x 1 , x 2 ) and the Gaussian noise &#958; satisfies &#958; &#8764; &#5114;(0, &#963; 2 ) for &#963; = 0.3. The relationship between parameter x and observation y implies that the likelihood function is p(y | x) = &#5114;(F(x), &#963; 2 ). Finally, we set the prior distribution for x to be Gaussian, i.e., &#960; 0 (x) = &#5114;(0, &#964; 2 I 2 ), where I 2 is the identity matrix and &#964; will be specified later. Thus, the unnormalized posterior density is given by</p><p>N = 512 particles are sampled in RBM-SVGD, and the maximum iteration number is 800. Different batch sizes are tested for performance, and the bandwidth parameter is fixed to be h = 0.1. To make MH comparable with RBM-SVGD regarding the number of sampling points, we viewed MH as a method with batch size 1, so the total number of iterations we performed for MH was N &#8226; 200. We apply burn-in technique by only considering the second-half iterations. To reduce correlation, only 1 sample is drawn from every 100 iterations. Therefore, a total number of N samples are selected from MH, which agrees with the number of particles we employ in RBM-SVGD. According to the performance test in Appendix B, we compare RBM-SVGD with MH by choosing &#964; = 5 &#8226; 10 -3 , which is tested to be convergent and presents the best visual performance among different choices of &#964; . For both RBM-SVGD and MH, the initial points are sampled from a Gaussian distribution &#5114;(0, 0.4 2 ). The target distribution is double banana with centers near (0, 0.5) and (0, -0.5). Hence, we adopt two test functions as</p><p>)). In Figure <ref type="figure">3</ref>, we plotted the position of each particle after RBM-SVGD iteration or MH together with the contour map of the target distribution. From the picture we can tell that both MH and RBM-SVGD can recover the shape of the target density and produce persuasive samplings. Although RBM-SVGD slightly harmed the aggregation of particles around the true distribution (which also paid off with a much shorter running time) compared to the original SVGD (RBM-SVGD with batch size = 512), it can still provide a convincing sampling by almost recovering the shape of the target density. In Table <ref type="table">2</ref>, we give further quantitative comparison. All numbers in the table are averaged over 100 different initializations. The run time for any RBM-SVGD with different batch sizes is faster than that of MH, and RBM-SVGD with batch size 2 is more than 20&#215; faster while, regarding the MSE for both h 1 and h 2 , RBM-SVGD is much better than MH for h 1 and better than MH for h 2 . Hence, we conclude, for this example, SVGD outperforms MH both in run time and accuracy. RBM-SVGD further significantly reduces the run time of regular SVGD without loss of accuracy.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.">Bayesian logistic regression.</head><p>In this experiment, we apply RBM-SVGD to conduct Bayesian logistic regression for binary classification for the Covertype data set with 581012 data points and 54 features <ref type="bibr">[14]</ref>. Under the same setting as Gershman <ref type="bibr">[14; 20]</ref>, the regression weights w of dimension 54 are assigned with a Gaussian prior p 0 (&#969; | &#945;) = &#5114;(w, &#945; -1 ), and the variance satisfies p 0  (&#945;, 1, 0.01), where represents the density of Gamma distribution. The inference is applied on posterior p(x | D) with x = [w, log &#945;] of dimension 55. The kernel K ( &#8226; ) is taken again to be the same Gaussian kernel as (4-2).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Metropolis-Hastings</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>RBM-SVGD</head><p>Since the problem is in high dimension, we adopt N = 512 particles in this experiment, which also create more space for the selection of batch sizes. The training is done on 80% of the data set, and the other 20% is used as the test data set. For particle system (1-1), the computation of -&#8711;V = &#8711; log p(x) is expensive. Hence, we use the same strategy as mentioned in [20, &#167;3.2], i.e., using data-mini-batch 1 of the data to form a stochastic approximation of p(x) with the data-mini-batch size being 100. Since &#8711; log p depends only on x as in Algorithm 3, 1 To avoid confusion with our batch of particles, we call it data-mini-batch instead.  As shown in Figure <ref type="figure">4</ref>, RBM-SVGD is almost as efficient as SVGD even for small batch sizes. When p = 2, the test accuracy converges to a value slightly off that of SVGD. RBM-SVGD with p = 4 converges to the same accuracy as SVGD but at a slower convergent rate. For RBM-SVGD with batch size greater than 4, we observe similar convergence behavior as that of SVGD. The run time of RBM-SVGD, as shown in Table <ref type="table">3</ref>, is lower than that of SVGD, where the run time of 6000 iterations is reported. Comparing to the similar run time table for the 1D Gaussian mixture example (Table <ref type="table">1</ref>), the acceleration of RBM-SVGD is not as significant as before. This is due to the linear but expensive evaluation of &#8711; log p, where RBM-SVGD and SVGD spend the same amount of time in the evaluation each iteration. Although the evaluation of &#8711; log p is expensive, it is linear in N . As N increases, the advantage of RBM-SVGD would be more significant. In Table <ref type="table">4</ref>, we list the mean and standard deviation of RBM-SVGD with p = 2 and p = 8 and SVGD of different iterations. Based on the statistics, we conclude that RBM-SVGD and SVGD are of similar prediction power and RBM-SVGD is efficient also in high-dimensional particle systems as well.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.">Conclusion</head><p>We have applied the random batch method for interacting particle systems to SVGD, resulting in RBM-SVGD, which turns out to be a cheap sampling algorithm and inherits the efficiency of the original SVGD algorithm. Theory and numerical experiments have validated the algorithm, and hence, it can potentially have many applications, like Bayesian inference. Moreover, as a hybrid strategy, one may increase the batch size as time goes on to increase the accuracy, or apply some variance reduction approach. Given the prior and target distribution as in (4-3), we first test the performance of MH among different values of parameter &#964; , which represents the variance of the proposal distribution.</p><p>Figure <ref type="figure">5</ref> illustrates the samples together with the contour map of target distribution for &#964; = 5 &#8226; 10 -1 , 5 &#8226; 10 -2 , 5 &#8226; 10 -3 , 5 &#8226; 10 -4 . Clearly, the best performance was attained when &#964; = 5 &#8226; 10 -3 . For &#964; greater than 5 &#8226; 10 -3 , samples are still wandering around the true distribution without accumulating due to a high variance, whereas for smaller &#964; , samples are merely aggregating around the "lower" banana rather than the "upper" banana. This phenomenon can be explained by the small variance of proposal distribution, which confines the particles around upper banana.</p><p>Moreover, a convergence diagnosis for MCMC was also conducted by computing the auto-correlation <ref type="bibr">[7]</ref>. A lower auto-correlation always implies better convergence because a higher auto-correlation indicates that effective sampling size is smaller and more iteration is necessary <ref type="bibr">[27]</ref>. Figure <ref type="figure">6</ref>  </p></div></body>
		</text>
</TEI>
