An Analysis of Ensemble Sampling
Abstract
Ensemble sampling serves as a practical approximation to Thompson sampling when maintaining an exact posterior distribution over model parameters is computationally intractable.
In this paper, we establish a regret bound that ensures desirable behavior when ensemble sampling is applied to the linear bandit problem.
This represents the first rigorous regret analysis of ensemble sampling and is made possible by leveraging information-theoretic concepts and novel analytic techniques that may prove useful beyond the scope of this paper
Introduction
Thompson sampling (TS) is a popular heuristic for balancing between exploration and exploitation in bandit learning.
In its basic form, TS operates maintains a posterior distribution over model parameters.
When the prior distribution and likelihood function exhibit conjugacy properties, the posterior can be maintained through computationally tractable Bayesian inference.
However, many practical contexts call for more complex models for which exact Bayesian inference becomes computationally intractable.
For such contexts, ensemble sampling (ES) can serve as a practical approximation to TS [Lu and Van Roy, 2017].
Instead of the posterior distribution, ES maintains an ensemble of statistically plausible models that can be updated in an efficient incremental manner.
The corresponding discrete distribution represents an approximation to the posterior distribution.
At the start of each timestep, a model is sampled uniformly from the ensemble and an action is selected to optimize expected reward with respect to the sampled model.
Each model is initially sampled from the prior distribution and evolves through an updating process that adapts to observations and random perturbations.
While a growing literature [Osband et al., 2016, Russo et al., 2018, Osband et al., 2018, Lu et al., 2018, Osband et al., 2019, Dwaracherla et al., 2020, Osband et al., 2022b] presents applications of ES, there has been no rigorous theory that ensures desirable behavior similar to that enjoyed by TS.
A regret bound for ES applied to the linear bandit is provided by Lu and Van Roy [2017], but a flaw in the associated analysis has brought this result into question.
Since the publication of that paper, several researchers have tried to remedy the analysis or otherwise establish performance guarantees for ES, but these efforts have gone without success.
We offer in this paper the first rigorous regret analysis of ES.
Like Lu and Van Roy [2017], we study
ES applied to the linear-Gaussian bandit.
This serves as a simple sanity check for the approach.
We establish a Bayesian regret bound (Theorem 1) that consists of two terms.
The first term is identical to a Bayesian regret bound established for TS.
The second term accounts for posterior distribution mismatch and can be made arbitrarily small by increasing the ensemble size.
Our analysis leverages information-theoretic concepts and novel analytic techniques that may prove useful beyond the scope of this paper.
As a stepping stone in our analysis, we establish a general Bayesian regret bound that applies to any learning algorithm for a linear bandit (Theorem 2).
In particular, this regret bound is based on the Hellinger distance between the action selection distribution of the learning algorithm and the posterior distribution of the optimal action at each timestep.
We believe that this Bayesian regret bound is of independent interest and might be useful in analyzing other learning algorithms, such as other approximate TS algorithms.
Note that for linear-Gaussian bandits considered in this paper, Kalman filtering offers a tractable means to exact inference and, as such, an approximation method like ES is not required.
However, it is worth mentioning that the analysis in this paper also offers insight into more complex models that call for approximate inference.
For example, consider a neural network with very wide hidden layers.
A recent research thrust (e.g., Jacot et al.
[2018], Lee et al.
[2017]) highlights that, under suitable technical conditions, training such a neural network via stochastic gradient descent (SGD) approximates Gaussian process inference.
Our result extends directly to finite-armed Gaussian process bandits.
This suggests that ES applied with neural networks that are trained via SGD can be effective in complex bandit problems, though formalizing this extension requires significant technical work, which we leave for future research.
The remainder of this paper is organized as follows: Section 2 reviews related work, and Sectionformulates the considered linear bandit problem and describes the ensemble sampling (ES) algorithm.
Section 4 presents the main result of this paper: a Bayesian regret bound for ES in linear bandits.
Before diving into the analysis, we define notation used in this paper in Section 5.
Then, we motivate and derive the general regret bound in Section 6 and sketch the proof of the main result in Section 7.
Finally, we conclude the paper and discuss future directions in Section 8.
Detailed proofs are provided in the appendices.
Related work
Thompson sampling [Thompson, 1933, Chapelle and Li, 2011, Russo et al., 2018] is a commonly used heuristic for balancing exploration and exploitation in bandit [Lattimore and Szepesvári, 2020] and reinforcement learning [Sutton and Barto, 2018] problems.
However, the basic form of Thompson sampling can be computationally intractable unless the prior distribution and likelihood function exhibit conjugacy properties.
To overcome this computational challenge, variants of approximate versions of TS (see Chapter 5 of Russo et al.
[2018]) have been developed, including approximate
TS using Laplace approximation [Chapelle and Li, 2011], bootstrapping [Eckles and Kaptein, 2019,
Kveton et al., 2019], variational inference [Urteaga and Wiggins, 2018, Yu et al., 2020], Markov chain
Monte Carlo [Casella and George, 1992, Roberts and Tweedie, 1996], hypermodels [Dwaracherla et al., 2020], and optimal transport [Zhang et al., 2019].
Ensemble sampling (ES) is also an approximate version of Thompson sampling, and was formally proposed by Lu and Van Roy [2017].
It has been one of the most popular methods in approximate
Bayesian inference and has wide applications in sequential decision making.
For example, variations of ES have been applied to (deep) reinforcement learning [Osband et al., 2016, 2018, 2019], online recommendation [Lu et al., 2018, Hao et al., 2020, Zhu and Van Roy, 2021], multi-agent reinforcement learning [Dimakopoulou and Van Roy, 2018], behavioral sciences [Eckles and Kaptein, 2019], and marketing strategies [Yang et al., 2020].
Recently, Osband et al.
[2022b] has developed a testbed to compare and rank agents for uncertainty modeling, including variants of the ensemble agents.
A lot of work has attempted to analyze ensemble sampling, but none of them has been successful.
In their original paper, Lu and Van Roy [2017] try to analyze ES in linear-Gaussian bandits, but there is a mistake in the final step of the analysis where they compare the regret of ES to that of
TS.
In particular, in the proof of Lemma 8, the random variables
A TS t are defined on histories of actions selected by ensemble sampling, instead of TS.
Therefore, the sum of regret incurred by these hypothetical Thompson sampling actions
A TS t is not equal to the cumulative regret of applying a TS agent throughout all timesteps.
The paper incorrectly claims that they are equal.
In addition to Lu and Van Roy [2017], Phan et al.
[2019] aims to analyze general approximate TS with approximation errors measured in α -divergence for K -armed bandit.
To demonstrate the main result, Phan et al.
[2019] uses ensemble sampling as an example, but also inherits the technical flaw in
Lu and Van Roy [2017].
In addition, though Phan et al.
[2019] shows that an approximate version of
Thompson sampling that uses uniform sampling achieves sublinear regret, this result mainly benefits from forced exploration.
There are also papers aiming to analyze bandit algorithms with approximate inference.
A recent paper [Huang et al., 2022] proposes and analyzes an upper-confidence-bound (UCB) type algorithm for bandit problems with approximate inference.
Another recent paper [Ash et al., 2021] proposes and analyzes an ensemble based UCB algorithm for bandit problems. Kveton et al.
[2020] studies linear bandits in the frequentist setting and provides a general regret bound that is tailored to analyzing randomized algorithms with good concentration and anti-concentration properties, but it could not be directly applied to analyzing ES due to ES’s discrete and incremental update nature.
Preliminaries
We begin by introducing a formulation of the linear bandit and an ensemble sampling (ES) algorithm suited for this environment.
3.1 Linear bandit
The linear bandit [Abbasi-Yadkori et al., 2011, Lattimore and Szepesvári, 2020] has received much attention in the bandit learning literature.
It serves as a simple didactic environment, often used to sanity-check agent designs.
In this spirit, we will analyze ES as applied to the linear bandit.
We consider a linear bandit with a Gaussian prior distribution and Gaussian noise.
An instance is characterized by a tuple E =
( A , µ 0 , Σ 0 , σ 2 ) , where A ⊂ R d is a finite action set, µ 0 and Σ 0 are the prior mean vector and covariance matrix, and σ 2 is the noise variance.
Note that actions are vectors of dimension d .
Let K = |A| denote the cardinality of the action set.
The prior distribution over the coefficient vector θ ∈ R d , P ( θ ∈ · ) , is multivariate Gaussian N ( µ 0 , Σ 0 ) .
Rewards are generated by a random sequence ( R t : t = 1 , 2 , . . . )
of K -dimensional vectors, which is i.i.d.
conditioned on θ .
In particular, for each t and a ,
R t,a = a ⊤ θ + W t,a , for an i.i.d.
sequence ( W t : t = 1 , 2 , . . . )
of K -dimensional vectors with each element distributed
N (0 , σ 2 I ) .
An agent interacts with the linear bandit as follows: at each timestep t = 0 , 1 , . .
, the agent executes an action A t ; then it observes a reward R t +1 ,A t .
Note that only the reward associated with the executed action is observed through what is termed bandit feedback .
The agent’s experience through time t is encoded by a history H t =
( A 0 , R 1 ,A 0 , . . .
, A t − 1 , R t,A t − 1 ) .
The agent’s objective is to maximize expected reward over some long duration T :
[Equation]
This is equivalent to minimizing the Bayesian regret:
[Equation]
where A ∗ ∼ unif (cid:8) arg max a ∈A a ⊤ θ (cid:9) .
Note that in both Equations (1) and (2), the expectations integrate over random reward realizations, algorithmic randomness, and the coefficient vector θ .
Note that A ∗ is also a random variable since it depends on θ as well the uniform sampling among maximizers, which breaks ties.
3.2 Ensemble sampling
In the absence of conjugacy properties that enable efficient Bayesian inference, TS in its exact form becomes computationally infeasible.
ES serves as a practical approximation to TS [Lu and Van Roy, 2017], often suitable for such contexts.
The key idea behind ES is to maintain an ensemble of statistically plausible models that can be updated in an efficient incremental manner and to treat the discrete distribution represented by this set of models as an approximation to the posterior distribution.
The algorithm begins by sampling M models from the prior distribution, where M is a hyperparameter.
Then, at the start of each timestep, a model is sampled uniformly from this set and an action is selected to optimize the immediate expected reward with respect to the sampled model.
Each model is updated incrementally based on the observed reward and a random perturbation.
Algorithm 1 presents the associated pseudo-code for ES.
1: Sample :
[Equation]
[Equation]
) 2: for t = 0 , . .
, T − 1 do 3:
Sample : m ∼ unif { [Equation] [Equation]
M } 4:
Execute : A t ∼ unif (cid:26) arg max a ∈A a [Equation] θ t [Equation]
m (cid:27) 5:
Observe : R t +1 ,A t 6:
Update : ˜ θ t, 1: M −→ ˜ θ t +1 , 1: M 7: end for The posterior distribution at time t + 1 is Gaussian with covariance matrix and mean vector [Equation] and
[Equation]
While this highlights conjugacy properties of a sort that allow for efficient Bayesian inference and thus tractable implementation of exact TS, the linear bandit with Gaussian prior distribution and likelihood function serves as a useful context for studying the behavior of ES in relation to TS.
Like [Lu and Van Roy, 2017], we consider a version of ES that updates each m -th model according to
[Equation]
where each ˜ W t +1 = (cid:16) ˜ W t +1 , 1 , . .
˜ W t +1 ,M (cid:17) ∼ N (0 , σ 2 I ) is an independent random perturbation.
Regret bound for ensemble sampling
In this paper, we establish the following Bayesian regret bound for ES (Algorithm 1) when it is applied to linear bandits described in Section 3.1:
Theorem 1.
Suppose ES Algorithm (Algorithm 1) is applied to linear bandit with prior P ( θ ∈ · ) =
N ( µ 0 , Σ 0 ) and M models, then
[Equation]
where d is the dimension of actions, T is the time horizon, K is the number of actions, H ( A ∗ ) is the entropy of the optimal action A ∗ under the prior, and
[Equation]
and
[Equation]
By treating the noise variance σ 2 , prior mean vector µ 0 , and prior covariance matrix Σ 0 as constants, we have ι = O (1) and κ = O ( √ log K ) , and thus
[Equation]
where ˜ O hides the logarithmic factors.
Theorem 1 represents the first rigorously proved regret bound that ensures some degree of robustness in application of ES to a nontrivial bandit problem. One limitation is that the second term (b) in our
Bayesian regret bound depends on K since our current analysis uses the method of (finite) types
[Cover and Thomas, 2006].
This might not be tight for linear bandit, and we conjecture that the second term (b) can be improved to be independent of K .
Another limitation is that the result applies only to the linear bandit with Gaussian prior distribution and likelihood function, which admits tractable application of exact TS.
Nevertheless, this result represents a beginning to the theory of ES, suggesting that the approach is sound and the analysis might be extended to broader problem classes in the future.
In the remainder of this section, we compare our regret bound to others presented in closely related literature.
Comparison with the regret bound for TS
The regret bound in Theorem 1 consists of two terms.
The first term (a) is exactly the regret bound achieved by TS with exact posterior
[Russo and Van Roy, 2016].
Note that H ( A ∗ ) is the entropy of the optimal action A ∗
and we always have H ( A ∗ ) ≤ log K .
As discussed in Russo and Van Roy [2016], this first term (a) is order optimal and improves upon the worst-case regret bound achieved by other algorithms such as upper confidence bound algorithms since H ( A ∗ ) ≪ log K when the prior is informative.
On the other hand, the second term (b) is an incremental term and accounts for posterior distribution mismatch.
Note that as the number of models used by ES M → ∞ , the second term (b) converges to 0 and the regret bound in Theorem 1 reduces to that of TS with exact posterior.
Moreover, as long as M ≥ KT/d , the regret bound in Theoremhas the same order as that of TS in terms of d and T (up to logarithmic factors).
Comparison with the regret bound in Lu and Van Roy [2017]
In Theorem 1, the upper bound is on the Bayesian regret where the prior over θ is N ( µ 0 , Σ 0 ) , and the regret also takes expectation over θ .
Lu and Van Roy [2017] studies ES in the frequentist setting where unknown θ is fixed, and tries to upper bound the frequentist regret of ES by that of TS plus some approximation error term due to posterior mismatch, similar to the second term (b) in our Bayesian regret bound.
However, there are some technical issues in the analysis, as is discussed in Section 2.
Theorem 3 in Lu and Van Roy [2017] suggests that for any ϵ > 0 , when the number of models M = ˜Θ (cid:0) K/ϵ 2 (cid:1) (where ˜Θ hides the logarithmic factors), the approximation error term is ϵ ∆( θ ) T where ∆( θ ) = max a ∈A a ⊤ θ − min a ∈A a ⊤ θ , while the second term (b) in our Bayesian regret bound in Theoremis linear in κ = O ( √ log K ) .
To make the second term (b) scale as ˜ O ( ϵT ) , the number of required models M is still ˜Θ (cid:0) K/ϵ 2 (cid:1) .
Notations
Before proceeding, we define some notations including Kullback–Leibler divergence, Hellinger distance, Shannon entropy and mutual information.
5.1 Kullback–Leibler divergence and Hellinger distance
For two probability distributions P and Q , the Kullback–Leibler (KL) divergence between P and Q is defined as
[Equation]
if P is absolutely continuous with respect to Q ; otherwise, define d KL ( P ∥ Q ) =
+ ∞ .
Note that in general d KL ( P ∥ Q ) ̸ = d KL ( Q ∥ P ) .
The Hellinger distance between P and Q is defined as
[Equation]
which is symmetric in P and Q .
In the special case of discrete distributions P = ( p 1 , . . . , p n ) and
Q = ( q 1 , . .
. , q n ) , the KL divergence and Hellinger distance between P and Q can be written as
[Equation]
The following inequality hold for Hellinger distance and KL divergences:
Fact 1 (Lemma 2.4 in Tsybakov [2009]) .
For two probability distributions P and Q , we have
[Equation]
In other words, the (squared) Hellinger distance is upper bounded by KL divergences in both directions.
We will use Fact 1 in Section 6.
5.2 Measures in information theory
Consider a discrete random variable X whose support is a finite set X and general random variable
Y and Z .
The Shannon entropy of X is defined as
[Equation]
The entropy of X conditional on Y =
y is
[Equation]
y
[Equation]
and the conditional entropy of X given Y is,
[Equation]
where the expectation is taken with respect to the marginal distribution of Y .
The mutual information between X and Y
[Equation]
is the KL divergence between the joint distribution of X and Y and the product of the marginal distributions, and the conditional mutual information between X and Y given Z is
[Equation]
where the expectation is taken with respect to the marginal distribution of Z .
General regret bound
In this section, we derive a general Bayesian regret bound for any learning algorithm (Theorem 2), based on the Hellinger distance between the (conditional) action-selection distribution specified by the algorithm and the posterior distribution of the optimal action A ∗ , and use it to establish the Bayesian regret bound for ES in Theorem 1.
We believe that our Bayesian regret bound is of independent interest and might be used to analyze other bandit algorithms, such as variants of approximate TS algorithms, in the future.
To simplify the exposition, we first define some shorthand notations to simplify the exposition of this paper.
First, we use subscript t to denote conditioning on H t , specifically, we define
[Equation]
In addition, we define probability distributions p t and p t over action set A as p t ( · ) ≜ P t ( A t [Equation] · ) and p t ( · ) ≜ P t ( A ∗ = · ) .
Given the history H t , p t is the conditional distribution of action A t and p t is the posterior distribution of the optimal action A ∗ .
Both p t and p t are specified by the algorithm.
Note that under TS, given the history H t , p t and p t are the same, but they are not under other algorithms.
We conjecture that for approximate TS algorithms, when the approximation is accurate, p t is close to p t .
We have the following Bayesian regret bound for any learning algorithm:
Theorem 2.
For linear bandits considered in Section 3.1, under any learning algorithm,
[Equation]
where ι is defined in Equation (5) and
[Equation]
where the expectation in Equation (9) is taken with respect to the prior over θ .
6.1 Discussion on the regret bound in Theorem
The regret bound in Theorem 2 holds for any learning algorithm.
Note H ( A ∗ ) is the entropy of the optimal action A ∗
and we always have H ( A ∗ ) ≤ log K .
The first term matches the regret bound for
TS derived in Russo and Van Roy [2016].
In the second term, (cid:80) T − 1 t =
(cid:112) E [ d 2H ( p t ∥ p t )] quantifies the cumulative distance between the conditional distribution of the action A t and the posterior distribution the optimal action A ∗ .
Under TS with exact posterior, d 2H ( p t ∥ p t ) =
due to the posterior matching property of TS, i.e., p t = p t .
Moreover, for approximate TS algorithms, if the approximation is accurate, d 2H ( p t ∥ p t ) should be small.
Regret bound in terms of KL divergence between p t and p t
It is sometimes more convenient to analyze the KL divergence between p t and p t .
Since the squared Hellinger distance is symmetric and upper bound by the KL divergence (see Fact 1), we obtain the regret upper bound with the approximation error in terms of two forms of KL divergence between p t and p t .
Corollary 1.
For linear bandits considered in Section 3.1, under any learning algorithm,
[Equation]
where ι and η are defined in Equations (5) and (9) , respectively.
We will show in Section 7 that for ensemble sampling, d KL ( p t ∥ p t ) can be bounded in terms of the number of models M .
It is noteworthy that in some other problems, it is more convenient to bound the other form d KL ( p t ∥ p t ) .
One such example is the regret bound developed in Wen et al.
Upper bound on constant η in Theorem 2 and Corollary
The constant η in Equation (9) depends on the prior over coefficient vector θ .
If the prior over θ is Gaussian random vector, so is a ⊤ θ for any action a ∈ A .
It is known that the expectation of the maximum of K (potentially correlated) Gaussian random variables is Θ( √ log K ) .
We show in the appendix that the expectation of the maximum of K squares of Gaussian random variables is O (log K ) .
Please refer to Lemmain Appendix B, which immediately leads to the following upper bound on η .
Corollary 2.
Suppose the prior over θ is N ( µ 0 , Σ 0 ) .
We have η ≤ κ , where η and κ are defined in
Equations (9) and (6) , respectively.
6.2 Proof sketch of Theorem
The cumulative regret can be written as follows,
[Equation]
where the per-period “main regret term" G t and “approximation error term" D t are defined as [Equation] 12) and [Equation]
The last equality in Equation (11) is shown in the following lemma.
Lemma 1.
For t = 0 , . . .
, T − 1 ,
[Equation]
Proof.
Fix t . Conditioned on H t , the regret can be written as follows.
[Equation]
where the second equation uses R t +
=
( R t +1 , 1 , . . .
, R t +1 ,K ) is independent of the action A t .
Now we are going to upper bound (cid:80) T − 1 t =
E [ G t ] and (cid:80) T − 1 t =
E [ D t ] in Equation (11), respectively.
We first analyze (cid:80) T − 1 t =
E [ G t ] .
We upper bound each main regret term G t by the mutual information between the optimal action A ∗ and action-reward pair ( A t , R t +1 ,A t ) conditioning on a given history H t :
Lemma 2.
For t = 0 , . . .
, T − 1 , with probability 1,
[Equation]
where ι is defined in Equation (5) and I t ( A ∗ ; ( A t , R t +1 ,A t )) is the mutual information between A ∗ and ( A t , R t +1 ,A t ) conditioning on a given history at timestep t .
This result generalizes Proposition 5 and Corollary 1 in Russo and Van Roy [2016] for Thompson sampling to approximate Thompson sampling such that A t and A ∗ are not identically distributed given the history.
The proof of Lemma 2 can be found in Appendix A.
Then, similar to the analysis in Russo and Van Roy [2016], using the Cauchy-Schwarz inequality and the chain rule for mutual information, we obtain the following result.
Lemma 3.
With ι defined in Equation (5) , the following inequality holds.
[Equation]
The complete proof of Lemma 3 is in Appendix A. Note that the upper bound in the above result is the first term of the regret bound in Theorem 2. The remaining task is to upper bound E
[ D t ] where D t is the approximation error term defined in Equation (13). By analyzing (potentially) unbounded prior and noises, we have the following lemma.
Lemma 4.
With η defined in Equation (9) , for t = 0 , . . .
, T − 1 ,
{+E [ D t ] ≤ η (cid:113) E [ d 2H ( p t ∥ p t )] . Summing over timestep t gives the second term of the regret bound in Theorem 2, i.e., (cid:80) T − 1 t =
 E [ D t ] ≤ η (cid:80) T − 1 t =
+}
(cid:112) E [ d 2H ( p t ∥ p t )] . The proof of this lemma is provided below. Proof of Lemma 4. Fix t .
D t = (cid:88) a ∈A (cid:16)(cid:112) p t ( a ) − (cid:112) p t ( a ) (cid:17) (cid:16)(cid:112) p t ( a ) E t [ R t +1 ,a | A ∗ = a ] + (cid:112) p t ( a ) E t [ R t +1 ,a ] (cid:17) =
(cid:88) a ∈A (cid:16)(cid:112) p t ( a ) − (cid:112) p t ( a ) (cid:17) (cid:112) p t ( a ) E t
[ R t +1 ,a | A ∗ = a ] + (cid:88) a ∈A (cid:16)(cid:112) p t ( a ) − (cid:112) p t ( a ) (cid:17) (cid:112) p t ( a ) E t
[ R t +1 ,a ] ≤ (cid:115)(cid:88) a ∈A (cid:16)(cid:112)
p t ( a ) − (cid:112) p t ( a ) (cid:17) (cid:115)(cid:88) a ∈A p t ( a ) ( E t [ R t +1 ,a | A ∗ = a ]) 2 + (cid:115)(cid:88) a ∈A p t ( a ) ( E t [ R t +1 ,a ])
 ≤ d H ( p t ∥ p t ) 
[Equation]
where the first inequality applies Cauchy–Schwarz inequality; the second inequality uses Jensen’s inequality as well as the definition of Hellinger distance; the second-to-last equality uses A t is independent of R t +1 =
( R t +1 , 1 , . . .
, R t +1 ,K ) .
Taking expectation on both sides, we have
[Equation]
where the second inequality uses Cauchy–Schwarz inequality and the last equality holds since
W t +1 ,A ∗ , W t +1 ,A t ∼ N (0 , σ 2 ) are independent noises.
Approximation error under ensemble sampling
In this section, we are going to bound the cumulative approximation error (cid:80) [-T − 1 t =
-][Equation] E [Equation]
d
[Equation] p [Equation] ] in Corollary 1 for ensemble sampling, where p t is the conditional distribution of the chosen action A t and p t is the posterior distribution of the optimal action A ∗ .
The whole section is devoted to proving the following Lemma 5 on per-period approximation error.
Summing over timestep t yields the upper bound on cumulative approximation error, which implies the regret bound for ensemble sampling in
Theorem 1.
Lemma 5.
Under ensemble sampling (Algorithm 1), for all t = 0 , . . .
, T − 1 ,
[Equation]
Before proving this result, we first discuss the behavior of ensemble sampling.
Ensemble sampling uniformly samples a model m ∈ { 1 , . . .
, M } , and then chooses the action A t uniformly from the set ˜ A t,m ≜ arg max a ∈A a ⊤ ˜ θ t,m .
We define the following approximation of p t ( a ) :
[Equation]
where | ˜
A t,m | is the cardinality of the set ˜
A t,m (with probability 1, | ˜
A t,m | = 1 ).
ES is a simple variant of approximate TS.
At time t , TS would sample an action from the posterior distribution of the optimal action A ∗ , while ES would sample an action from the approximation ˆ p t .
Notice that the history H t does not include independent random perturbation ˜ W t ∼ N (0 , σ 2 I ) used in updating
M models (see Equation (4)).
Therefore, given history H t , ˆ p t ( a ) is still a random variable, and its expectation is the conditional probability of sampling action a , i.e., E t
[ˆ p t ( a )] =
p t ( a ) .
By convexity of KL divergence, the per-period approximation error
[Equation]
Taking expectation of both sides gives E [ d KL ( p t ∥ p t )] ≤ E [ d KL (ˆ p t ∥ p t )] , and we are going to upper bound E [ d KL (ˆ p t ∥ p t )] .
Note that the relationship between the expectation and cumulative distribution function can be written as
[Equation]
The following result in Lu and Van Roy [2017] can be used to upper bound each P ( d KL (ˆ p t ∥ p t ) > ϵ ) in the above integral.
Lemma 6 (Lemma 4 in Lu and Van Roy [2017]) .
Let ϵ > 0 .
For t = 0 , . . .
, T − 1 ,
[Equation]
Taking expectation over θ gives P ( d KL (ˆ p t ∥ p t ) > ϵ ) ≤ ( t + 1) K ( M + 1) K e − Mϵ .
Consider any threshold δ ≥ 0 .
The integral in Equation (14) can be decomposed and bounded as follows.
[Equation]
Taking derivative of RHS gives optimal δ ∗ =
K [log( t +1)+log( M +1)] M .
Plugging in δ ∗ yields (cid:90) ∞
[Equation]
This completes the proof of Lemma 5.
Summing over timestep t yields the upper bound on cumulative approximation error, which implies the regret bound for ensemble sampling in Theorem 1.
Concluding remarks
We have presented the first rigorous analysis for ensemble sampling (ES) and developed the regret bound in Theorem 1 for linear bandits.
The regret bound approaches that for Thompson sampling (TS) as the ensemble size increases.
It is worth mentioning that ES is developed for broader and more challenging bandit and reinforcement learning problems, and the linear bandit serves only as a simple sanity check.
In particular, ES can be used to approximate TS in the absence of conjugacy properties, when it is intractable to maintain and sample from the exact posterior.
As discussed in Section 2, a substantial literature has been devoted to research in this direction.
It is also noteworthy that in many practical problems, ES with a moderate number of models (e.g. ≤ 30 models) outperforms other state-of-the-art benchmarks [Lu and Van Roy, 2017, Lu et al., 2018, Osband et al., 2019].
As a stepping stone, we have also established a general regret bound in Theorem 2 that applies to any learning algorithm for linear bandits . This general regret bound may be of independent interest, since it is particularly useful for analyzing other varieties of approximate TS (e.g. approximate TS with epistemic neural networks
[Osband et al., 2022a]). To establish a regret bound for an approximate TS algorithm based on Theorem 2, one only need to bound the Hellinger distance between the algorithm’s sampling distribution and the true posterior distribution over the optimal action.
Finally, we believe that Theorem 2 could be generalized to any bandit problem based on the concept of information ratio proposed in Russo and Van Roy [2016], as long as the information ratio can be appropriately bounded.
These problems include online learning with full information feedback [Shalev-Shwartz, 2012] and “graph" information feedback [Alon et al., 2015], combinatorial semibandits [Kveton et al., 2015, Wen et al., 2015], and pure exploration problems [Bubeck et al., 2009, Russo, 2016, Komiyama et al., 2021]. We also conjecture that the results of this paper can be extended to generalized linear bandits [Filippi et al., 2010, Dong et al., 2019] and episodic reinforcement learning [Osband et al., 2013], but leave these extensions to future work. A Proofs of Lemmas 2 and 3 in SectionA.1 Proof of Lemma
Fix t . Recall the probability distributions p t and p t over action set A : p t ( · ) = P t ( A t = · ) and p t ( · ) = P t ( A ∗ = · ) .
We first rewrite I t ( A ∗ ; ( A t , R t +1 ,A t )) as follows: I t ( A ∗ ; ( A t , R t +1 ,A t )) =
I t ( A ∗ ; A t )
+ I t ( A
[Equation]
; R t +1 ,A t | A t )
[Equation]
R
[Equation]
(cid:88)
[Equation]
a
[Equation]
[Equation]
a
[Equation]
p
[Equation]
a ) (cid:32)
[Equation]
a
[Equation]
[Equation]
)) (cid:33) =
(cid:88)
a
[Equation]
a ∗ ∈A p
[Equation]
( a )
[Equation]
a
[Equation]
( P
[Equation]
[Equation]
[Equation]
)) where the first equality uses the chain rule of mutual information (Fact 3); the second and fourth equalities follow from that conditioning on the history H t , A t is jointly independent of A ∗ and
R t +1 =
( R t +1 , 1 , . . .
, R t +1 ,K ) ; the fifth equality follows from the KL divergence form of mutual information (Fact 4).
For notational convenience, we write A = { a 1 , . . .
, a K } .
Define M ∈ R K × K by
[Equation]
, ∀ i, j ∈ [ K ] .
For each a i ∈ A , conditional on H t , the coefficient vector θ ∼ N ( µ t , Σ t ) , and then
[Equation]
The updating rule on covariance matrix in Equation (3) implies Σ t ⪯ Σ 0 , and thus
[Equation]
Hence, for each a i ∈ A , conditional on H t R t +1 ,a i is sub-Gaussian with variance proxy
[Equation]
Then by Lemma 9, we have
I t
[Equation]
A ∗
[Equation]
A t
[Equation]
R t +
[Equation]
A t
[Equation]
=
[Equation]
On the other hand, G t defined in Lemma 1 can be written as
[Equation]
This shows, by Fact 2, that
[Equation]
We now show Rank( M ) ≤ d .
Define
[Equation]
[Equation]
| A
[Equation]
a j ] ,
[Equation]
j
[Equation]
[ K ] and ν = E t [ θ ] , and then for any i, j ∈ [ K ] ,
[Equation]
i
[Equation]
which implies
[Equation]
Since M is the product of one K × d matrix and the other d × K matrix, Rank( M ) ≤ d .
A.2 Proof of Lemma
[Equation]
where the first and second inequalities follow from Lemma 2 and Cauchy-Schwarz inequality, respectively, and the last equality applies the chain rule for mutual information (Fact 3).
B Technical lemmas and facts B.1 Expectation of maximum of squares of sub-Gaussian variables
We upper bound the expectation of maximum of squares of sub-Gaussian variables.
Lemma 7.
For each a ∈ [ K ] , let X a be a sub-Gaussian random variable with mean µ a and variance proxy σ 2 a .
We have
[Equation]
Proof.
We begin by bounding the exponentiated quantity with the moment generating function.
When 0 < t ≤
[Equation]
where the first inequality uses Jensen’s inequality and the second-to-last inequality applies Lemma(Appendix B in Honorio and Jaakkola [2014])
[Equation]
which is stated after this proof.
Taking the logarithm on both sides gives
[Equation]
Then minimizing the RHS above over 0 < t ≤
[Equation]
a
[Equation]
[ K ] σ 2 a , we have
[Equation]
where the last inequality uses
[Equation]
Lemma 8 (Appendix B in Honorio and Jaakkola [2014]) .
Let X be a sub-Gaussian with mean µ and variance proxy σ 2 .
For | t | ≤ 14 σ 2 ,
[Equation]
B.2 Lemmas and facts from Russo and Van Roy [2016]
We present the lemmas and facts from Russo and Van Roy [2016] used in the proof of our Theorem 2.
Lemma 9 (Lemma 3 in Russo and Van Roy [2016]) .
Suppose there is a H t measurable random variable γ such that for each a ∈ A , R t +1 ,a is γ sub-Gaussian conditional on H t .
Then for any t ∈ [ T ] and a, a ∗ ∈ A , with probability 1,
[Equation]
Fact 2 (Fact 10 in Russo and Van Roy [2016]) .
For any matrix M ∈ R d × d ,
[Equation]
where ∥ M ∥ F is the Frobenius norm of M .
Fact 3 (Fact 5 in Russo and Van Roy [2016]: chain rule of mutual information) .
The mutual information between a random variable X and a collection of random variables ( Z 1 , . .
, Z T ) can be written as,
[Equation]
Fact 4 (Fact 6 in Russo and Van Roy [2016]: KL divergence form of mutual information) .
The mutual information between random variables X and Y can be written as,
[Equation]
X ; Y ) =
E X [ d KL ( P ( Y | X ) ||
P ( Y ))]
= (cid:88) x ∈X
P ( X = x ) d KL ( P ( Y | X = x ) || P ( Y )) .