Variance reduction for Random Coordinate DescentLangevin Monte Carlo
Abstract
Sampling from a logconcave distribution function is one core problem that has wide applications in Bayesian statistics and machine learning. While most gradient free methods have slow convergence rate, the Langevin Monte Carlo (LMC) that provides fast convergence requires the computation of gradients. In practice one uses finitedifferencing approximations as surrogates, and the method is expensive in highdimensions.
A natural strategy to reduce computational cost in each iteration is to utilize random gradient approximations, such as random coordinate descent (RCD) or simultaneous perturbation stochastic approximation (SPSA). We show by a counterexample that blindly applying RCD does not achieve the goal in the most general setting. The high variance induced by the randomness means a larger number of iterations are needed, and this balances out the saving in each iteration.
We then introduce a new variance reduction approach, termed Randomized Coordinates Averaging Descent (RCAD), and incorporate it with both overdamped and underdamped LMC. The methods are termed RCADOLMC and RCADULMC respectively. The methods still sit in the random gradient approximation framework, and thus the computational cost in each iteration is low. However, by employing RCAD, the variance is reduced, so the methods converge within the same number of iterations as the classical overdamped and underdamped LMC Dalalyan and Karagulyan (2019); Cheng et al. (2018); Dalalyan and RiouDurand (2018). This leads to a computational saving overall.
1 Introduction
Monte Carlo Sampling is one of the core problems in Bayesian statistics, data assimilation Reich (2011), and machine learning Andrieu et al. (2003), with wide applications in atmospheric science Fabian (1981), petroleum engineering Nagarajan et al. (2007), remote sensing Li and Newton (2019) and epidemiology Li et al. (2020) in the form of inverse problems Martin et al. (2012), volume computation Vempala (2010), and bandit optimization Russo et al. (2018).
Let be a convex function that is gradient Lipschitz and strongly convex in . Define the target probability density function , then is a logconcave function. To sample from the probability distribution induced by amounts to finding an (or a list of ) that can be regarded as i.i.d. (independent and identically distributed) drawn from the distribution.
There is vast literature on sampling, and proposed methods fall into a few different categories. Markov chain Monte Carlo (MCMC) Roberts and Rosenthal (2004) composes a big class of methods, including MetropolisHasting based MCMC (MHMCMC) Metropolis et al. (1953); Hastings (1970), Gibbs samplers (Geman and Geman, 1984; Casella and George, 1992), Hamiltonian Monte Carlo (Neal, 1993; Duane et al., 1987), Langevin dynamics based methods J. et al. (1978) (including both the overdamped Langevin Parisi (1981); Roberts and Tweedie (1996); Dalalyan (2017) and underdamped Langevin Chen et al. (2014); Ma et al. (2015) Monte Carlo), and some kind of combination (such as MALA) Roberts and Tweedie (1996); Roberts and Stramer (2002); Dwivedi et al. (2018); BouRabee et al. (2010). Importance sampling and sequential Monte Carlo Geweke (1989); Neal (2001); Del Moral et al. (2006) framework and ensemble type methods Reich (2011); GarbunoInigo et al. (2020); Iglesias et al. (2013); Ding and Li (2019a, b); Ding et al. (2020) are also popular.
Different MCMC methods are implemented differently, but they share the essence, that is to develop a Markovian transition kernel whose invariant measure is the target distribution, so that after many rounds of iteration, the invariant measure is achieved. If the design of the transition kernel does not involve or sense the local behavior of , the convergence is slow Hobert and Robert (2004); Hobert et al. (2001); Roberts and Tweedit (1996); Mengersen and Tweedie (1996).
The Langevin Monte Carlo methods, both the overdamped or underdamped, can be viewed as special kinds of MCMC that involve the computation of . The idea is to find stochastic differential equations (SDEs) whose equilibriumintime is the target distribution. These SDEs are typically driven by , and the Overdamped or Underdamped Langevin Monte Carlo (O/ULMC) can be viewed as the discreteintime (such as EulerMaruyama discretization) version of the Langevin dynamics (SDEs). Since leads the dynamics, fast converge is expected Dalalyan and Karagulyan (2019); Cheng et al. (2018); Dalalyan and RiouDurand (2018).
However, is typically not available. In particular, if is obtained from inverse problems with an underlying governing differential equation describing the dynamics, as seen in the remote sensing and epidemiology examples above, the explicit formula for is unknown. When this happens, one usually needs to compute all partial derivatives, one by one, either by employing automatic differentiation Baydin et al. (2018), or by surrogating with the finitedifference approximations for every direction . This leads to a cost that is roughly times the number of required iterations. In high dimension, , the numerical cost is high. Therefore, how to sample with a small number of finite differencing approximations with a cost relaxed on , becomes rather crucial.
There are methods proposed to achieve gradientfree property, such as Importance Sampling (IS), Ensemble Kalman methods, random walks methods, and various finite difference approximations to surrogate the gradient. However, IS Geweke (1989); Doucet et al. (2001a, b) has high variance of the weight terms and it leads to wasteful sampling; ensemble Kalman methods Evensen (2006); Bergemann and Reich (2010); Reich (2011); GarbunoInigo et al. (2020) usually require Gaussianity assumption Ding and Li (2019a, b); random walk methods such that Metropolized random walk (MRW) Mengersen and Tweedie (1996); Roberts and Tweedie (1996); Roberts and Tweedit (1996), Ball Walk Lovász and Simonovits (1990); Dyer et al. (1991); Lovász and Simonovits (1993) and the Hitandrun algorithm Bélisle et al. (1993); Kannan et al. (1995); Lovász and Vempala (2006) cannot guarantee fast convergence Vempala (2005); and to our best knowledge, modification of LMC with derivatives replaced by its finite difference approximation Meeds et al. (2015) or Kernel Hilbert space Strathmann et al. (2015) are not yet equipped with theoretical nonasymptotic analysis.
1.1 Contribution
We work under the O/ULMC framework, and we look for methods that produce i.i.d. samples with only a small number of gradient computation. To this end, the contribution of the paper is twofolded.
We first examine a natural strategy to reduce the cost by adopting randomized coordinate descent (RCD) Nesterov (2012); Wright (2015), a random directional gradient approximation. This method replaces finite difference approximations in directions, by in a randomly selected direction. Presumably this reduces the cost in each iteration by folds, and hopefully the total cost. However, in this article we will show that this is not the case in the general setting. We will provide a counterexample: the high variance induced by the random direction selection process brings up the numerical error, and thus more iterations are needed to achieve the preset error tolerance. This in the end leads to no improvement in terms of the computational cost.
We then propose a variance reduction method to improve the application of RCD to LMC. We call the method Randomized Coordinates Averaging Descent Overdamped/Underdamped LMC (or RCADO/ULMC). The methods start with a fully accurate gradient (up to a discretization error) in the first round of iteration, and in the subsequent iterations they only update the gradient evaluation in one randomly selected direction. Since the methods preserve some information about the gradient along the evolution, the variance is reduced. We prove the new methods converge as fast as the classical O/ULMC Dalalyan and Karagulyan (2019); Cheng et al. (2018); Dalalyan and RiouDurand (2018), meaning the preset error tolerance is achieved in the same number of iterations. But since they require only directional derivative per iteration instead of , the overall cost is reduced. We summarize the advantage over the classical OLMC and ULMC in Table 1 (assuming computing the full gradient costs times of one partial derivative). The dependence on the conditioning of is omitted in the table, but will be discussed in detail in Section 5.
In some sense, the new methods share some similarity with SAGA Defazio et al. (2014), a modification of SAG (stochastic average gradient) Schmidt et al. (2013). These are two methods designed for reducing variance in the stochastic gradient descent (SGD) framework where the cost function has the form of . Similar approaches are also found in SGMCMC (stochasticgradient Markov chain Monte Carlo (SGMCMC)) Ma et al. (2015); Chen et al. (2014); Gao et al. (2018); Betancourt (2015); Betancourt et al. (2017); Zou et al. (2019); Chatterji et al. (2018). In their cases, variance reduction is introduced in the selection of . In our case, the cost function is a simple convex function, but the gradient can be viewed as and the variance reduction is introduced in the selection of .
There are other variance reduction methods, such as SVRG Johnson and Zhang (2013) and CVULD Baker et al. (2017); Chatterji et al. (2018). We leave the discussion to future research.
Algorithm  Number of iterations  Number of evaluations 

OLMCDalalyan and Karagulyan (2019)  
ULMCCheng et al. (2018); Dalalyan and RiouDurand (2018)  
RCADOLMC  
RCADULMC 
1.2 Organization
In Section 2, we discuss the essential ingredients of our methods: the random coordinate descent (RCD) method, the overdamped and underdamped Langevin dynamics and the associated Monte Carlo methods (OLMC and ULMC). In Section 3, we unify the notations and assumptions used in our methods. In Section 4, we discuss the vanilla RCD applied to LMC and present a counterexample to show it is not effective if used blindly. In Section 5, we introduce our new methods RCADO/ULMC and present the results on convergence and numerical cost. We demonstrate numerical evidence in Section 6. Proofs are rather technical and are all left to appendices.
2 Essential ingredients
2.1 Random coordinate descent (RCD)
When explicit formula for is not available, one needs to compute the partial derivatives for all directions. One straightforward way is to use finite difference: where is the th unit direction. Given enough smoothness, the introduced error is . For approximating the entire , such finite differencing evaluations are required, and it is expensive in the high dimensional setting when . The cost is similarly bad if one uses automatic differentiation.
Ideally one can take one random direction and computes the derivative in that direction only, and hopefully this random directional derivative reveals some information of the entire gradient . This approach is used in both RCD Wright (2015); Richtarik and Takac (2011); Nesterov (2012) and SPSA Gerencsér (1997); Kleinman et al. (1999). Both methods, instead of calculating the full gradient, randomly pick one direction and use the directional derivative as a surrogate of . More specifically, RCD computes the derivative in one random unit direction and approximates:
(1) 
where is randomly drawn from (see the distribution of drawing in Richtarik and Takac (2011)). This approximations is consistent in the expectation sense because
Here is to take expectation.
2.2 Overdamped Langevin dynamics and OLMC
The OLMC method is derived from the following Langevin dynamics:
(2) 
The SDE characterizes the trajectory of . The forcing term and the Brownian motion term compete: the former drives to the minimum of and the latter provides small oscillations. The initial data is a random variable drawn from a given distribution induced by . Denote the probability density function of , it is a wellknown result that satisfies the following FokkerPlanck equation:
(3) 
and furthermore, converges to the target density function exponentially fast in time Markowich and Villani (1999).
The overdamped Langevin Monte Carlo (OLMC), as a sampling method, can be viewed as a discreteintime version of the SDE (2). A standard EulerMaruyama method applied on the equation gives:
(4) 
where is i.i.d. drawn from with being the identity matrix of size . Since (4) approximates (2), the density of , denoted as , converges to as , up to a discretization error. It was proved in Dalalyan and Karagulyan (2019) that the convergence to is achieved within iterations if hessian of is Lipschitz. If hessian of is not Lipschitz, the number of iterations increases to . In many real applications, the gradient of is not available and some approximation is used, introducing another layer of numerical error. In Dalalyan and Karagulyan (2019), the authors did discuss the effect of such error, but they assumed the error has bounded variance.
2.3 Underdamped Langevin dynamics and ULMC
The underdamped Langevin dynamics Chen et al. (2014) is characterized by the following SDE:
(5) 
where is a parameter to be tuned. Denote the probability density function of , then satisfies the FokkerPlanck equation
and under mild conditions, it converges to , making the marginal density function for the target (Villani, 2006; Dolbeault et al., 2009).
The underdamped Langevin Monte Carlo algorithm, ULMC, can be viewed as a numerical solver to (5). In each step, we sample new particles , where is a Gaussian random vector determined by with the following expectation and covariance:
(6)  
We here used the notation to denote the expectation, and to denote the covariance of and . If , we abbreviate it to . The scheme can be interpreted as sampling from the following dynamics in each time interval:
ULMC does demonstrate faster convergence rate Cheng et al. (2018); Dalalyan and RiouDurand (2018) than OLMC. Without the assumption on the hessian of being Lipschitz, the number of iteration is to achieve accuracy. The faster convergence on the discrete level could be explained by the better discretization solver instead of faster convergence of the underlying SDEs. Indeed, without the Lipschitz continuity on the hessian term, the discretizing of (5) produces numerical error. In contrast, the discretization error of (4) is . A thirdorder discretization was discussed for (5) in Mou et al. (2019), further enhancing the numerical accuracy. Similar to OLMC, the method needs to numerically approximate . This induces another layer of error, and also requires times of evaluation of .
3 Notations
3.1 Assumption
We make some standard assumptions on :
Assumption 3.1.
The function is strongly convex and has an Lipschitz gradient:

Convex, meaning for any :
(7) 
Gradient is Lipschitz, meaning for any :
(8)
If is secondorder differentiable, these assumptions together mean where is the hessian of . We also define condition number of as
(9) 
We will express our results in terms of and . Furthermore, for some results we assume Lipschitz condition of the hessian too:
Assumption 3.2.
The function is secondorder differentiable and the hessian of is HLipschitz, meaning for any :
(10) 
3.2 Wasserstein distance
The Wasserstein distance is a classical quantity that evaluates the distance between two probability measures:
where is the set of distribution of whose marginal distributions, for and respectively, are and . These distributions are called the couplings of and . Here and can be either probability measures themselves or the measures induced by probability density functions and . In this paper we mainly study .
4 Direct application of RCD in LMC, a negative result
We study if RCD can be blindly applied to ULMC for reducing numerical complexity. This is to replace in the updating formula (4) for ULMC by the random directional derivative surrogates (1). The resulting algorithms are presented as Algorithm 2 in Appendix A.1.
RCD was introduced in optimization. In Richtarik and Takac (2011), the authors show that despite RCD computes only , instead of directional derivatives in each iteration, the number of iteration needed for achieving accuracy is , as compared to when the fullgradient is used (suppose Lipschitz coefficient in each direction is at the same order with the total Lipschitz constant). The gain on the cost is mostly reflected by the conditioning of the objective function . This means there are counterexamples for which RCD cannot save compared with ordinary gradient descent. We emphasize that there are of course also plenty examples for which RCD significantly outperforms when is special conditioning structures Richtarik and Takac (2011); Nesterov (2012); Wright (2015). In this article we would like to investigate the general lowerbound situations.
The story is the same for sampling. There are examples that show directly applying the vanilla RCD to ULMC fails to outperform the classical ULMC. One example is the following: We assume
where satisfies for all . Denote the sample computed through Algorithm 2 (underdamped) with stepsize . Let be extremely small and the finite differencing error is negligible, and denote the probability density function of , then we can show cannot converge too fast.
Theorem 4.1.
For the example above, choose , there exists uniform nonzero constant such that if satisfy
then
(11) 
where , and is the probability density function of th iteration of RCDULMC.
The proof is found in Section A.2. We note the second term in (11) is rather big. The smallness comes from , the stepsize, and it needs be small enough to balance out the influence from . This puts strong restriction on . Indeed, to have accuracy, , we need both terms smaller than , and this term suggests that at least. And when combined with restriction from the first term, we arrive at the conclusion that at least iterations are needed, and thus finite differencing approximation are required. The dependence is , and is exactly the same as that in ULMC, meaning RCDULMC brings no computational advantage over ULMC in terms of the dependence on the dimension of the problem.
5 Random direction approximation with variance reduction on O/ULMC, two positive results
The direct application of RCD induces high variance and thus high error. It leads to many more rounds of iterations for convergence, gaining no numerical saving in the end. In this section we propose RCADO/ULMC with RCAD reducing variance in the framework of RCD. We will prove that while the numerical cost per iteration is reduced by folds, the number of required iteration is mostly unchanged, and thus the total cost is reduced.
5.1 Algorithm
The key idea is to compute one accurate gradient at the very beginning in iteration No. , and to preserve this information along the iteration to prevent possible high variance. The algorithms for RCADOLMC and RCADULMC are both presented in Algorithm 1, based on overdamped and underdamped Langevin dynamics respectively. Potentially the same strategy can be combined with SPSA, which we leave to future investigation.
In the methods, an accurate gradient (up to a finitedifferencing error) is used in the first step, denoted by , and in the subsequent iterations, only one directional derivative of gets computed and updated in .
(12) 
(13) 
(14) 
5.2 Convergence and numerical cost analysis
We now discuss the convergence of RCADOLMC and RCADULMC, and compare the results with the classical OLMC and ULMC methods Dalalyan and Karagulyan (2019); Cheng et al. (2018). We emphasize that these two papers indeed discuss the numerical error in approximating the gradients, but they both require the variance of error being bounded, which is not the case here. One related work is Chatterji et al. (2018), where the authors construct the Lyapunov function to study the convergence of SGMCMC. Our proof for the convergence of RCADOLMC is inspired by its technicalities. In Cheng et al. (2018); Chatterji et al. (2018), a contraction map is used for ULMC, but such map cannot be directly applied to our situation because the variance depends on the entire trajectory of samples. Furthermore, the history of the trajectory is reflected in each iteration, deeming the process to be nonMarkovian. We need to reengineer the iteration formula accordingly for tracing the error propagation.
Convergence for RCADOLMC
For RCADOLMC, we have the following theorem:
Theorem 5.1.
Convergence for RCADULMC
For RCADULMC, we have the following theorem.
Theorem 5.2.
6 Numerical result
We demonstrate numerical evidence in this section. We first note that it is extremely difficult to compute the Wasserstein distance between two probability measures in high dimensional problems, especially when they are represented by a number of samples. The numerical result below evaluates a weaker measure:
(19) 
where is the test function. are different samples iterate till th step, and is the target distribution.
In the first example, our target distribution is with , and in the second example we use
For both example, we sample the initial particles according to . We run both RCDO/ULMC and RCADO/ULMC using particles and test MSE error with in both examples. In Figure 1 and Figure 2 respectively we show the error with respect to different stepsizes. In all the computation, is big enough. The improvement of adding variance reduction technique is obvious in both examples.
7 Conclusion and future work
To our best knowledge, this is the first work that discusses both the negative and positive aspects of applying random gradient approximation, mainly RCD type, to LMC, in both overdamped and underdamped situations without and with variance reduction. Without variance reduction we show the RCDLMC has the same numerical cost as the classical LMC, and with variance reduction, the numerical cost is reduced in both overdamped and underdamped cases.
There are a few future directions that we would like to pursue. 1. Our method, in its current version, is blind to the structure of . The only assumptions are reflected on the Lipschitz bounds. In Richtarik and Takac (2011); Nesterov (2012); Fercoq and Richtarik (2015) the authors, in studying optimization problems, propose to choose random directions according to the Lipschitz constant in each direction. The idea could potentially be incorporated in our framework to enhance the sampling strategy. 2. Our algorithms are designed based on reducing variance in the RCD framework. Potentially one can also apply variance reduction methods to improve SPSALMC. There are also other variance reduction methods that one could explore.
8 Broader Impact
The result provides theoretical guarantee to the application of random coordinate descent to Langevin Monte Carlo, when variance reduction technique is used to reduce the cost. It has potential application to inverse problems emerging from atmospheric science, remote sensing, and epidemiology. This work does not present any foreseeable societal consequence.
Both authors acknowledge generous support from NSFDMS 1750488, NSFTRIPODS 1740707, Wisconsin Data Science Initiative, and Wisconsin Alumni Research Foundation.
Appendix A Algorithms and Results of RCDLMC
a.1 Algorithm
We apply RCD as surrogates of the gradient in O/ULMC. This amounts to replacing the gradient terms in (4) using the approximation (1). The new methods are presented in Algorithm 2, termed RCDO/ULMC.
(20) 
(21) 
a.2 A counterexample
In this section, we prove Theorem 4.1.
Fisrt, we define , and denote the probability density of and the probability density of if is distributed according to density function . From [12], we have:
(22) 
and thus
(23) 
Proof of Theorem 4.1.
Throughout the proof, we drop the superscript “″ to have a concise notation. According to (23), it suffices to find a lower bound for . We first notice
(24)  
where takes all randomness into account. This implies to prove (11), it suffices to find a lower bound for second moment of . Indeed, in the end, we will show that
(25) 
and thus
proving the statement of the theorem since . To show (25), we first note, by direct calculation:
(26) 
then we divide the proof into several steps:

First step: Priori estimation
According to (26), use convergence result of Algorithm 2 ([21] Theorem 4.1), we have for any
Similar to (24), we have
which implies
(27) for any .
Finally, use (27), we can obtain
(28) 
Second step: Iteration formula of .
By the special structure of , we can calculate the second moment explicitly. Since can be written as
in each step of RCDULMC, according to Algorithm 2, for each and , we have
(29) where is a random variable defined as
and satisfies
(30) for each . Furthermore,
(31)