Particle-based Online Bayesian Sampling
Yifan Yang, Chang Liu, Zheng Zhang

TL;DR
This paper introduces an online particle-based variational inference algorithm that effectively tracks dynamic posterior distributions in streaming data scenarios, with theoretical guarantees and superior empirical performance.
Contribution
It proposes a novel online Bayesian sampling method using particles and a variance reduction technique, with theoretical analysis and improved results over existing methods.
Findings
Achieves better tracking of dynamic posteriors in experiments.
Provides theoretical analysis using Wasserstein gradient flow.
Outperforms naive Bayesian sampling in online settings.
Abstract
Online optimization has gained increasing interest due to its capability of tracking real-world streaming data. Although online optimization methods have been widely studied in the setting of frequentist statistics, few works have considered online optimization with the Bayesian sampling problem. In this paper, we study an Online Particle-based Variational Inference (OPVI) algorithm that uses a set of particles to represent the approximating distribution. To reduce the gradient error caused by the use of stochastic approximation, we include a sublinear increasing batch-size method to reduce the variance. To track the performance of the OPVI algorithm with respect to a sequence of dynamically changing target posterior, we provide a detailed theoretical analysis from the perspective of Wasserstein gradient flow with a dynamic regret. Synthetic and Bayesian Neural Network experiments show…
| Methods | Avg. RMSE | Avg. LL | Time |
|---|---|---|---|
| OPVI | 2.4 | ||
| OPVI | 2.4 | ||
| SVGD | 2.4 | ||
| SVGD | 5.8 | ||
| LD | 1.7 | ||
| LD | 5.2 |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Bandit Algorithms Research · Sparse and Compressive Sensing Techniques · Advanced Adaptive Filtering Techniques
MethodsVariational Inference
Particle-based Online Bayesian Sampling
Yifan Yang
Chang Liu
Zheng Zhang
Abstract
Online learning has gained increasing interest due to its capability of tracking real-world streaming data. Although it has been widely studied in the setting of frequentist statistics, few works have considered online learning with the Bayesian sampling problem. In this paper, we study an Online Particle-based Variational Inference (OPVI) algorithm that updates a set of particles to gradually approximate the Bayesian posterior. To reduce the gradient error caused by the use of stochastic approximation, we include a sublinear increasing batch-size method to reduce the variance. To track the performance of the OPVI algorithm with respect to a sequence of dynamically changing target posterior, we provide a detailed theoretical analysis from the perspective of Wasserstein gradient flow with a dynamic regret. Synthetic and Bayesian Neural Network experiments show that the proposed algorithm achieves better results than naively applying existing Bayesian sampling methods in the online setting.
Machine Learning, ICML
1 Introduction
Online learning is an indispensable paradigm for problems in the real world, as a machine learning system is often expected to adapt to newly arrived data and respond in real-time. The key challenge in this setting is that the model cannot be updated with all data in history each time, which grows linearly and would make the system unsustainable. There are quite a few online optimization methods developed over the decades that address the challenge by only taking the last arrived batch of data for each update and by using a shrinking step size to control the increase of error. They have been successfully applied to a wide range of tasks like online ranking, network scheduling and portfolio selection (Yu et al., 2017; Pang et al., 2022).
Online optimization methods can directly be applied to update models that are fully specified by a certain value of its parameters. Beyond such models, there is another class of models known as Bayesian models that treat the parameters as random variables, thus giving an output also as a random variable (often the expectation is taken as the final output on par with the conventional case). The stochasticity enables Bayesian models to provide diverse outputs, characterize prediction uncertainty, and be more robust to adversarial attacks (Hernández-Lobato and Adams, 2015; Li and Gal, 2017; Yoon et al., 2018; Zhang et al., 2019; Tolpin et al., 2021; Wagner et al., 2023). Hence Bayesian models are receiving increasing attention in research and practice, and an online learning method for them is highly desired.
Nevertheless, the learning procedure of Bayesian models is different from conventional models, which poses a challenge in directly applying online optimization methods in an online setting. This is because a Bayesian model is characterized by the distribution of its parameters but not a single value, and the learning task, a.k.a. Bayesian inference, is to approximate the posterior distribution of the parameters given received data. A tractable solution is Variational Inference (VI) (Jordan et al., 1999; Blundell et al., 2015), which approaches the posterior using a parameterized approximating distribution, which enables optimization methods again (Hoffman et al., 2010a; Broderick et al., 2013a; Foti et al., 2014; Chérief-Abdellatif et al., 2019). However, the accuracy is restricted by the expressiveness of the approximating distribution which is not systematically improvable.
A more accurate method is Monte Carlo which aims to draw samples from the posterior. As the posterior is only known with an unnormalized density function, direct sampling is intractable, and Markov chain Monte Carlo (MCMC) is employed. While it makes sampling tractable, it comes with the issue of sample efficiency due to the correlation among the samples. Recently, a new class of Bayesian inference methods is developed, known as particle-based variational inference (ParVI) (Liu and Wang, 2016; Chen et al., 2018; Liu et al., 2019; Zhu et al., 2020; Zhang et al., 2020; Korba et al., 2021; Liu and Zhu, 2022). They try to approximate the posterior using a set of particles (i.e., samples) of a given size, which are iteratively updated to minimize the difference between the particle distribution from the posterior. The accuracy of the method can be systematically improved with more particles, and due to the limited number of particles, sample efficiency is enforced so as to minimize the difference. While ParVI methods have been successfully applied to the full-batch and mini-batch settings, to our knowledge there is no online version of ParVI.
In this work, we develop an Online Particle-based Variational Inference (OPVI) method to meet this desideratum and also provide an analysis on its regret bound which can achieve a sublinear order in the number of iterations. The method and analysis are inspired by the distribution optimization view of ParVI on the Wasserstein space, under which we could leverage techniques and theory of conventional online optimization methods. To do this, we first extend existing Maximum a Posterior (MAP) methods to better handle the prior term, and give the regret bound analysis for the online MAP algorithm. We then extend the results to the Wasserstein space as an online sampling method by leveraging the Riemannian structure of the space. Notably, we leverage techniques from online optimization that improves upon naively applying existing ParVI methods in an online setting. Here, we bound the dynamic regret under the Wassesterin space by using a trigonometric distance inequality for the inexact gradient descent method. We study the empirical performance of the method on a 2-dimensional synthetic setting which allows easy visualization, and real-world applications using Bayesian neural networks for image classification. The results suggest better posterior approximation and classification accuracy than naive online ParVI methods and online MCMC methods, which is even comparable to full batch results.
2 Related Work
Since (Cesa-Bianchi and Lugosi, 2006) study the online properties of VI, there are a couple of works showing online VI gives good performance in practice cases (Hoffman et al., 2010b, 2013; Broderick et al., 2013b). Furthermore, researchers in (Chérief-Abdellatif et al., 2019) derive the theoretical results for the generalization properties of the Online VI algorithm. Even though online VI is well studied, few papers pay attention to the problem of online MCMC, except (Chopin, 2002; Kantas et al., 2009; Christensen et al., 2012) study a series of sequential Monte Carlo methods that combine importance sampling with Monte Carlo schemes to track the changing distribution. Unfortunately, no previous work considers an online MCMC method from the perspective of optimization methods, not to mention the theory behind them.
Our method employs a gradient descent-based optimization strategy to update particles toward the target posterior. However, the target posterior is dynamically changing with streaming data arriving in the system, which makes the optimal solutions change. To solve this problem, we consider a performance metric called dynamic regret in our analysis. In previous research, it has been proved that algorithms that achieve low regret under the traditional regret may perform poorly in dynamic environment (Besbes et al., 2015) and it’s impossible to achieve a sublinear dynamic regret for an arbitrary sequence of loss functions (Yang et al., 2016). To achieve a sublinear regret, researchers propose different constraints on the sequence of loss functions, like the functional variation (Besbes et al., 2015), gradient variation (Rakhlin and Sridharan, 2013; Yang et al., 2014) and path variation (Yang et al., 2016; Bedi et al., 2018; Cesa-Bianchi et al., 2012). However, even though this dynamic problem is essential to be considered in the analysis of Bayesian inference algorithms, no previous papers considered this. As a result, existing theoretical guarantees regarding the online VI (e.g. (Chérief-Abdellatif et al., 2019)) may be insufficient under the dynamic changing online environment.
The stochastic gradient descent algorithm is widely used as an incremental gradient algorithm that offers inexpensive iterations by approximating the gradient with a mini-batch of observations. Through the past decade, it has been used in a wide variety of problems with different variations, like network optimization (Pang et al., 2022; Zhou et al., 2022) reinforcement learning (Liu et al., 2021b, a), federated learning (Sun and Wei, 2022) and recommendation system (Yang et al., 2020). However, this method, at the same time, incurs gradient error when approximating the gradient. In most of the novel sampling methods, we normally obtain diverse solutions by injecting diffusion noises (e.g. Langevin Dynamic (LD) (Neal et al., 2011), Stochastic Gradient Langevin Dynamics (SGLD) (Welling and Teh, 2011), which makes this type of algorithm sensitive to the noise. For Stein Variational Gradient Descent (SVGD) (Liu and Wang, 2016), there is also a similar instability observed in the experiments, even though the reason is still unknown. This instability makes reducing the stochastic gradient error important.
To reduce the gradient error, researchers studied multiple variance reduction methods, like using adaptive learning rates and increasing batch size. In the previous work, an adaptive learning rate was used to adapt the optimization to the most informative features with Adagrad (Ward et al., 2019) and estimate the momentum for Adam(Kingma and Ba, 2014). Compared with the adaptive methods, the increasing batch size methods have greater parallelism and shorter training times (Smith et al., 2017) and are also studied in offline and online cases (Friedlander and Schmidt, 2012; Zhou et al., 2018), which shows great importance to achieve applicable convergence rate and sublinear regret bound. Especially, (Bedi et al., 2018; Yang et al., 2016), give algorithms that consider a more general case of optimization with inexact gradient.
3 The online Maximum a Posterior on Euclidean Space
In this section, we first introduce an online MAP algorithm on Euclidean decision space with gradient descent method, which helps the reader to understand our OPVI sampling method on Wasserstein space. Here, we give some prior knowledge about the online MAP problem and the dynamic regret metric. Then, we give a detailed policy using an online stochastic gradient descent algorithm to solve the online MAP problem and a detailed theoretical analysis based on the dynamic regret metric.
3.1 Preliminaries
For an online MAP algorithm run with time slots , let denote a convex set, set be some parameter of interest and be the set of i.i.d. observations. In a typical problem of MAP, we aim to maximize a target posterior , where we usually take logarithm on both sides to simplify the computation as .
Different from the offline MAP, we set a adaptive weight for the prior in our online setting, which divides the whole prior for each update with when . Then, the goal of the online MAP problem on is to find parameter that maximizes the cumulative of a linear combination of minus likelihood and partial prior, which can be given as:
[TABLE]
To simplify the notation, we use to denote the log-likelihood with data and to denote the log-prior, where is called the cost function in the literature of optimization and we take minus logarithm since we want to make sure the cost function to be positive all the time. We denote as the true likelihood considering all data in the dataset. Then, we can formulate the goal eq. (1) to be an optimization problem with as the objective function and follow the goal of:
[TABLE]
As we have mentioned in Section 2, the target posterior is dynamically changing with the new observations, we are interested in using dynamic regret as the performance metric for our problem, which is defined as the difference between the total cost incurred at each time slot and a sequence of optimal solutions in hindsight, i.e.,
[TABLE]
In this paper, instead of using all data in , we consider using mini-batch to approximate the gradient as , where the approximation leads to a gradient error that can calculated by:
[TABLE]
where is the batch size.
Note that the gradient error can be deterministic or stochastic, depending on the way we set up the mini-batch. In this paper, we choose to select samples for mini-batch arbitrarily from , which makes the gradient error to be stochastic in this paper. As a result, the expectation of can be bounded by some time-varying variable as . Then, we introduce an error bound to measure the cumulative gradient error lead by the stochastic gradient approximation over , which is given by:
[TABLE]
We will show a sublinear increasing batch size is enough to keep growing sublinear, which enables the online MAP algorithm to enjoy a sublinear dynamic regret.
3.2 Dynamic Algorithm for Online Maximum a Posterior
It is well known that the online gradient descent algorithm can be used to solve online optimization problems (Zinkevich, 2003; Besbes et al., 2015; Yang et al., 2022). Here, we give an online stochastic gradient descent algorithm with increasing batch size for the online MAP problem in the following updating policy:
[TABLE]
where is the projection back to the convex set .
We will illustrate the relationship between and in the following analysis. Next, we first introduce some widely used assumptions required for the theoretical analysis.
Assumption 1**.**
(Bounded Convex Set) For any two decisions , we have .
Assumption 2**.**
(Convexity and Lipschitz smooth) The function is convex and Lipschitz smooth, so its derivatives are Lipschitz continuous with constant with a constant , i.e., for two real , we have:
[TABLE]
Assumption 3**.**
(Vanishing gradient) We assume the optimal solutions lie in the interior of the convex set , where we assume there exists such that
We give a sublinear regret upper bound in the next subsection, which means is decreasing and the parameter of interest can converge to the dynamic changing optimal solutions when is large enough. That indicates we can obtain a promising MAP result with the policy in eq. (15). Furthermore, we also give an analysis of the influence of the increasing batch-size setting on the performance of the algorithm.
3.3 Theoretical Analysis for Online MAP
In this section, we begin with the proof of the online MAP algorithm following the policy in eq. (15) over the Euclidean space . As we mentioned in Section 2, it is impossible to achieve a sublinear regret bound for any sequence of cost functions. To solve this problem, we consider a path variation budget for the sequence of optimal solutions , which bound the cumulative path length of the optimal solutions as .
We give the following Theorem following the proof of (Bedi et al., 2018, Theorem 2). Note that following eq. 3, we use true gradient and a gradient error to represent the approximated gradient to highlight the influence of the gradient error and simplify the proof. The result is summarized in Theorem 4, which gives the sublinear bound for the dynamic regret .
Theorem 4**.**
(Regret Bound under (Bedi et al., 2018, Theorem 2)) Under the Assumption 1 - 3, given a sequence of optimal solutions , variational budget and gradient error bound . Following the updating policy in eq. (15) on Euclidean Space , we have the dynamic regret:
[TABLE]
- Proof.
Detail of the proof can be found in Appendix A. ∎
To further find the relationship between and to bound , we give some analysis for the gradient error led by the stochastic batch sampling with the sublinear increasing batch size following Theorem 4. Base on section 2.8 in (Lohr, 2021), we have:
[TABLE]
where is the total number of data samples we have and is a bound on the sample variance of the gradients, which is defined by:
[TABLE]
To fulfill the requirement of in eq. (6), we assume and the sublinear increasing batch-size as . Then, we can bound as:
[TABLE]
We can see when the batch size is growing sublinear, the gradient error bound is sublinear. Thus if the variational budget is constrained to be sublinear, the regret bound is proved to be sublinear. Note that in the regret analysis, we set a static stepsize for convenience. The algorithm can also achieve a sublinear regret bound when the stepsize is set to be digressive like . Next, we illustrate why a static batch size fills to achieve a sublinear regret.
Remark: Set the batch size to be static as . The agent update for over rounds and use a total of data samples, where can be calculated by . Following a similar setting in eq. (7), we bound the gradient error over as:
[TABLE]
which gives a linear increasing gradient error bound . That makes it impossible to give a sublinear regret bound, which is necessary to ensure the algorithm can finally converge to the optimal solutions.
4 Online Particle-based Variational Inference on Wasserstein Space
In this section, we propose the OPVI algorithm on , which formulate the online MAP problem in Section 3 as an online sampling method from the perspective of Wasserstein gradient flow. To begin with, we first introduce some preliminary knowledge about the -Wasserstein Space , as well as its Riemannian structure and the gradient flow on it. Then, we give a brief introduction to a well-known ParVI method, called SVGD (Liu and Wang, 2016) and take it as an example to illustrate how to simulate a ParVI problem as a gradient flow on . Based on this idea, we give the theoretical analysis for OPVI as a distribution optimization flow on to show a sublinear dynamic regret. For convenience, we only consider Wasserstein Space supported on the Euclidean space in our analysis.
Here, we first clarify the notation used in this section. We use as a set of compactly supported valued functions on and use to denote the scalar-valued functions in . Except for the Euclidean space and Wasserstein space we just mentioned, we consider two other types of space in this paper, the Hilbert space and the vector-valued Reproducing Kernel Hilbert Space (RKHS) of a kernel . The Hilbert space , is a space of -valued functions with inner product . The RKHS is a kernel version of the Hilbert space , which is the closure of linear span equipped with inner products for .
4.1 The Wasserstein Space , its Riemannian Structure and the Gradient Flow
Generally, the Wasserstein space is a metric space equipped with Wasserstein distance . Set as the space of probability measures on the Euclidean support space . The -Wasserstein space on can be defined as . Since the Riemannian structure of Wasserstein space is discovered (Otto, 2001; Benamou and Brenier, 2000), several interesting quantities have been defined, like the gradient and the inner product on it.
To define the gradient of a smooth curve on , we can set a time-dependent vector field on , such that for a.e. and , where the overline means closure (Villani, 2009). Note that the vector field here is the so-called tangent vector of the curve at and the closure is denoted as tangent space at , whose elements are the tangent vectors for the curves passing through the point . The relation between , and can be found in Fig. 1. The inner product in the tangent space is defined on , which defines the Riemannian structure on and is consistent with the Wasserstein distance due to the Benamou-Brenier formula (Benamou and Brenier, 2000).
An important role of the vector field representation is that we can approximate the change of distribution within a distribution curve . For a single update in each time slot, we can set as a first-order approximation of the updated distribution in the next time slot (Ambrosio et al., 2005). Therefore, for a set of particles that obey distribution at time , we can update these particles with a stepsize of as , to approximate distribution in time , when is small. We show this approximation as a red arrow in Fig. 1.
Another important concept on is the definition of the gradient flow. Given a function , the gradient flow can be described as the family of descending curves that maximize the decreasing rate of the derivative of . In , the tangent vector of the gradient flow can be defined by the gradient of at , which is given by:
[TABLE]
where we define a measurable transformation and denote as the -transformed distribution for .
In the task of Bayesian inference, our goal is to minimize the KL-divergence between a current estimated distribution and the target posterior as , which has the tangent vector for its gradient flow as a vector field of:
[TABLE]
4.2 Particle-based Variational Inference Methods
In this section, we first use SVGD as an example to illustrate the ParVI methods. Then we show how to simulate SVGD as the gradient flow on Wasserstein space , which can help the analysis of OPVI in the following subsection. For SVGD, let be a set of particles that obey an empirical measure of distribution . We initialize as some simple distribution , then use a vector field to update these particles toward the target posterior : , where should be chosen to maximize the decreasing of the KL-divergence . In SVGD, the vector field is chosen to be optimized over RKHS with a closed-form solution:
[TABLE]
Note that the updating of SVGD particles is actually an approximation of the gradient flow by taking as its tangent space instead of , since the function in is roughly a kernel smoothed function in (Liu and Zhang, 2019). Thus, the vector field in eq. (8) can be used to approximate the vector field in on (Liu et al., 2019, Theorem 2), where the solution gives:
[TABLE]
That enables us to use to approximate the vector field on in the following analysis, which like doing a projection from to .
4.3 Online Particle-based Variational Inference on
In this section, we aim to develop an online sampling method on and proposed the OPVI algorithm. We first illustrate the policy of OPVI over RKHS . Then, we interpret the OPVI as the gradient flow on and conduct the theoretical analysis by transferring the proof in 3 from Euclidean space to Wasserstein space . Note that we use as the vector field on RKHS and as the vector field on .
We begin with reviewing the KL-divergence in an offline setting, which is given as:
[TABLE]
where is the number of data samples in the dataset. Following a similar idea as the online MAP algorithm, we set a adaptive weight for the prior in our online setting and using mini-batch with batch size to approximate the likelihood. Thus, we give an online stochastic version of KL-divergence between and the dynamic changing posterior as:
[TABLE]
Similar to SVGD, we first draw a set of particles that obey some simple initial distribution . Then, we update these particles with a gradient descent updating scheme with step size :
[TABLE]
where is the vector field on that maximizes the decrease of online stochastic KL-divergence to give a closed-form solution:
[TABLE]
where is satisfied by commonly used kernels like the exponential kernel and the general workflow of the OPVI algorithm is summarized in Alg. 1.
4.4 Proof of Dynamic Regret Bound under
To begin with, we first formulate the updating rule in Alg. 1 as a Wasserstein gradient flow. Here, we ignore the kernel smooth used in the implementation of the algorithm by approximating the vector field on RKHS with the vector field on Hilbert space . To simplify the proof, we denote and in eq. (4.3) and follow eq. (3) to represent the stochastic approximation as the sum of the true gradient and a gradient error , which gives:
[TABLE]
Then, the updating of the particles can be formulated as an optimal transport for distribution over as:
[TABLE]
Before we give the proof for the regret bound, we first re-assume some assumption under the .
Assumption 5**.**
(Bounded geodesically-convex (g-convex) set on ) Assume to be a g-convex set on some Wasserstein space supported on . From Theorem 2 of (Gibbs and Su, 2002), we can establish a bound for the maximum Wasserstein distance in a bounded support space with . Then , we have:
[TABLE]
which bound the geodescially convex set .
Assumption 6**.**
(Geodesically-L-Lipschitz (g-L-Lipschitz)). Similar to the definition over , we assume to be a g-convex function and has a geodesically L-Lipschitz continuous gradient on if there exists a constant that:
[TABLE]
where should be some Wasserstein distance.
Compared with the proof on , the key difference is the way to obtain Lemma 9. Instead of updating a set of parameters of interest over , we update the distribution by optimal transport over .
Lemma 7**.**
Suppose that is a Wasserstein space supported on Euclidean space with the sectional curvature lower bounded by . Under Assumption 3, 5, 6, for any , following the updating rule in eq. (11), we have:
[TABLE]
where .
- Proof.
The proof can be found in Appendix B ∎
Using Lemma 7 and the definition of dynamic regret in eq. (2), we give the dynamic regret bound on in the following Theorem.
Theorem 8**.**
(Regret Bound over ) Under the Assumption 3, 5, 6, given a sequence of optimal solutions , define the variational budget and the error bound . Following the updating rule in eq. (11), we have the dynamic regret bound:
[TABLE]
- Proof.
The detail of the proof can be found in Appendix C. ∎
Different from the proof of the inexact gradient descent on Euclidean space, we include the trigonometric distance inequality introduced in (Zhang et al., 2016) and give the first dynamic regret bound for the inexact infinitesimal gradient descent methods over . Note the regret bound here is related to a curvature bound , where we set as a constant since it is not the key point of this paper.
Since the gradient error is denied in , we can follow the same analysis as Section 3.3 to bound the gradient error bound , which gives a sublinear error bound. As a result, by setting a sublinear increasing constraint for the variational budget , we can make sure is increasing sublinear. That means the OPVI methods can converge to the dynamic changing target posterior when is large enough.
In SVGD, the author didn’t consider this gradient error in their algorithm. However, since the gradient error can be viewed as a part of noise added into the updating process, we should not use the whole diffusion noise in eq. (8). In the experiment, we set the diffusion term as for OPVI. We observe that this trick gives tremendous improvements in performance, especially in some high-dimensional tasks like image classification.
5 Experiments
In this section, we test the performance of the proposed OPVI algorithm, and compare it with two famous Bayesian sampling methods, the LD (Welling and Teh, 2011) and SVGD (Liu and Wang, 2016). We run these methods with three types of batch settings, mini-batch with increasing batch size, mini-batch with static batch size, and full batch. To make the comparison fair, we set a Fixed Iterations and Total Data Samples (FITDS) policy for experiments under the mini-batch setting, which means we set the total number of data samples and the total number of time slots to be same for each experiment.
Except for the full-batch methods, all algorithms follow the FITDS policy. For a dataset of nearly 10k data samples, we run all methods for 500 rounds and set for the static batch size methods and for the increasing batch size methods to keep same. For full batch methods, we use all 10k data samples in each round to show the best possible results. All experiments are run under the same setting (unless otherwise stated), codes for these experiments are available at https://github.com/yifanycc/OPVI.
5.1 Synthetic Experiments
The synthetic experiments follow the setting in (Welling and Teh, 2011) that conduct a simple example with two parameters, based on the mixture Gaussian distribution:
[TABLE]
where , and .
Here, we draw approximately 10,000 data samples from the above distribution with and . Except for the full-batch methods, all algorithms follow the FITDS policy. Fig. 2 shows the results for the OPVI, SVGD, and LD with 100 particles, where the true posteriors are shown as contour and the inference results are represented by the particles.
As we can observe from the result, the proposed increasing batch size OPVI gives a better result than the static batch size OPVI, which is caused by the use of increasing batch size as a variance reduction method. Compared with previous SVGD and LD, the OPVI method shows much better performance for tracking the posterior. That should be led by the influence of the gradient noise on the noise injection process of the LD method since we use a smaller diffusion term to offset the gradient error. In the last two figures, we can see the performance of OPVI is approaching or even better than the full batch methods.
5.2 Bayesian Neural Network (BNN) Experiment
In this subsection, we further compare our work with SVGD and LD on some Bayesian Neural Networks (BNN) tasks. We follow the experiment setting in (Liu and Tao, 2015), which uses a single hidden layer BNN with 50 hidden units. We use a Gamma(1, 0.1) function in the prior distribution, Kin8nm as the dataset and divide the dataset randomly 90% for training and 10% for testing. For all methods, we set the number of particles to 20.
All ParVI methods use the same stepsize, except for LD, which uses a smaller but best possible stepsize. We test the Root Mean Squared Error (RMSE) and the test Log-Likelihood (LL). The experiment results are shown in Table. 1. The OPVI algorithm can achieve an ** 11.8% and 20.1% improvement** compared with SVGD and LD with the same total number of data and the same total time slots respectively. This result is even comparable to the full batch SVGD algorithm. Note that the running time for OPVI is the same as the SVGD algorithm, which is less than half of the full batch methods.
5.3 Image classification Task
Finally, we conduct experiments to test the performance of the proposed algorithm on a high-dimensional image classification problem. The dataset we used is the MNIST dataset, which contains 60,000 training cases and 10,000 test cases. We consider a two-layer BNN model with 100 hidden variables, with a sigmoid input layer and a softmax output layer. All experiments are using 20 particles. The comparison result is shown in Fig. 3. As we can see from the figure, except for the full batch LD algorithm, the OPVI algorithm with an increasing batch size achieves the best result. However, the full batch LD method uses much more time (30 times) and data samples (500 times), and the result is similar. We can observe that the noise of the increasing batch size OPVI is decreasing with increase, which verifies our analysis for the gradient error. An interesting thing is that SVGD shows poor performance in this high-dimensional task, which may lead by an incorrect approximation for the diffusion term with limited particle numbers. Instead, we improve the diffusion term in OPVI, which solves this problem.
6 Conclusion
In this paper, we consider the OPVI algorithm as a possible sampling method for the intractable posterior under the online setting. To reduce the variance, we include an increasing batch size scheme and analyze the influence of the choice of batch size on the performance of the algorithm. Furthermore, we develop a detailed analysis by understanding the algorithm as a Wasserstein gradient flow. Experiments show the proposed algorithm outperforms other naive online particle-based VI and online MCMC methods.
Appendix A Proof of Theorem 4
The main idea of this proof follows [Bedi et al., 2018, Theorem 2]. We start by providing a Lemma that gives the relationship between the distance and the quantity . Then, we use this Lemma to prove the Theorem 4.
Lemma 9**.**
Under Assumptions 1 - 3, given a sequence of optimal solutions , gradient error and the updating policy eq. (15), the online MAP algorithm adheres to the following inequality:
[TABLE]
where .
- Proof.
We start by proving a fact with Assumption 2. For any , by the smoothness and convexity of , in [Zhou, 2018, Lemma 4] we have:
[TABLE]
Here, we set a specific value for as in the above inequality and get:
[TABLE]
On the other hand, by the convexity of and and the vanishing gradient assumption in Assumption 3, we have:
[TABLE]
which leads to the following inequality of interest:
[TABLE]
which is equivalent to:
[TABLE]
Following eq. 3, we use true gradient and a gradient error to represent the approximated gradient , which simpify the the updating policy eq. (15) as:
[TABLE]
following eq. 3 to highlight the influence of the gradient error and simplify the proof. Then, we bound the left-hand side of Lemma 9 by evolving the updating policy eq. (15) in , then:
[TABLE]
where (a) can be obtained by expanding the squared term, (b) is following the convexity property that and eq. (14). Next, we bound the last two terms in eq. (21) separately. We take expectation on the sequence of , which is denoted by and get:
[TABLE]
where (a) is obtained by the definition of the stochastic gradient error in Section 3.1, (b) is given by using the fact for the first term and (c) follows eq. (14). Taking expectations for eq. (21) and combining the above inequalities lead to:
[TABLE]
where .
Finally, we take full expectations (for both and ) as and take a root on both sides of the above equation and give:
[TABLE]
where the inequality follows and the fact proved as following:
[TABLE]
where are all positive and . ∎
Note that if we take a summation over on the second term on the right side of eq. (9), we can get the regret . However, we can divide the left side of eq. (9) into two parts with triangle inequality for a tighter bound, which give the proof for Theorem 4 as follows.
First, we start with using triangle inequality on a quantity , which gives:
[TABLE]
Rearranging the above inequality and take summation for , by the definition of the dynamic regret in eq. (2) we have:
[TABLE]
where (a) is obtained by using Lemma 9 and (b) follows Assumption 1 and the definition of variational budget . The second term in the last inequality can be bounded by:
[TABLE]
where (a) can be obtained by Hölder’s inequality as for a vector Taking it back, we get the dynamic regret of:
[TABLE]
Appendix B Proof of Lemma 7
- Proof.
We start from a fact proved in Lemma 6 of [Zhang and Sra, 2016], which gives an inequality for a geodesic triangle with curvature bounded by , where the length of sides for the triangle is , , and is the angle between sides and , then:
[TABLE]
In our work, we map our problem on a triangle, where the vertices of this triangle is set to be three status of the decisions in our problem, the current step decision , the next step decision and the optimal solution in current step . Denote to be the Wasserstein distance between two distribution and over . As a result, the three sides of the triangle should be , and . Base on the updating rule, we have when is small enough. and . Taking all sides into the triangle inequality, we have:
[TABLE]
where (a) follows [Zhang and Sra, 2016, Lemma 6], , (b) follows the assumption 5, (c) follows the fact proved in eq. (14) and the convexity of Then, we bound the last two terms in the above inequality with the expectation on the sequence of , which is denoted by and get::
[TABLE]
where (a) is obtained by the fact . Taking the above inequality back gives:
[TABLE]
where .
Finally, using the fact and full expectation , we finish the proof:
[TABLE]
∎
Appendix C Proof of Theorem 8
- Proof.
The proof start from Lemma 7 with using the triangle inequality, which gives:
[TABLE]
Rearrange the inequity, taking summation from , evolving the definition of the regret, we have:
[TABLE]
where the second term can be simplified as:
[TABLE]
Then, we finally prove the regret bound as:
[TABLE]
∎
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1Ambrosio et al. [2005] Luigi Ambrosio, Nicola Gigli, and Giuseppe Savaré. Gradient flows: in metric spaces and in the space of probability measures . Springer Science & Business Media, 2005.
- 2Bedi et al. [2018] Amrit Singh Bedi, Paban Sarma, and Ketan Rajawat. Tracking Moving Agents via Inexact Online Gradient Descent Algorithm. IEEE Journal of Selected Topics in Signal Processing , 12(1):202–217, February 2018.
- 3Benamou and Brenier [2000] Jean-David Benamou and Yann Brenier. A computational fluid mechanics solution to the monge-kantorovich mass transfer problem. Numerische Mathematik , 84(3):375–393, 2000.
- 4Besbes et al. [2015] Omar Besbes, Yonatan Gur, and Assaf Zeevi. Non-stationary Stochastic Optimization. page 52, 2015.
- 5Blundell et al. [2015] Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In International conference on machine learning , pages 1613–1622. PMLR, 2015.
- 6Broderick et al. [2013 a] Tamara Broderick, Nicholas Boyd, Andre Wibisono, Ashia C Wilson, and Michael I Jordan. Streaming variational Bayes. Advances in neural information processing systems , 26, 2013 a.
- 7Broderick et al. [2013 b] Tamara Broderick, Nicholas Boyd, Andre Wibisono, Ashia C Wilson, and Michael I Jordan. Streaming Variational Bayes. In Advances in Neural Information Processing Systems , volume 26. Curran Associates, Inc., 2013 b.
- 8Cesa-Bianchi and Lugosi [2006] Nicolo Cesa-Bianchi and Gábor Lugosi. Prediction, learning, and games . Cambridge university press, 2006.
