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 ﬁrst 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 maintains a posterior distribution over model parameters.
When the prior distribution and likelihood function exhibit conjugacy properties, the posterior distribution 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 efﬁcient 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., 2022] 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 linear-Gaussian bandits is provided by Lu and Van Roy [2017], but a ﬂaw 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 ﬁrst rigorous regret analysis of ES.
Like Lu and Van Roy [2017], we study ES applied to linear-Gaussian bandits.
This serves as a simple sanity check for the approach.
We establish a Bayesian regret bound (Theorem 1) that consists of two terms.
The ﬁrst term is identical to a Bayesian regret bound established for TS.
The second term accounts for posterior 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 linear bandits (Theorem 2).
In particular, this regret bound is based on the Hellinger distance between the action selection distribution of the learning algorithm and the 36th Conference on Neural Information Processing Systems (NeurIPS 2022).
posterior distribution of the optimal action at each timestep.
We believe that this 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 ﬁltering 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 ﬁnite-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 signiﬁcant 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 algorithm.
Section 4 presents the main result of this paper: a Bayesian regret bound for ES applied to linear bandits.
Before diving into the analysis, we deﬁne some notation used in this paper in Section 5.
Then we motivate and derive a general regret bound in Section 6, and apply it to analyzing ES in
Section 7.
Finally, we conclude the paper and discuss future directions in Section 8.
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 bandits [Lattimore and Szepesvári, 2020] and reinforcement learning [Sutton and Barto, 2018].
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 have been developed (see Chapter 5 of Russo et al.
[2018]), 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 is an approximate version of Thompson sampling, 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.
[2022] has developed a testbed to compare and rank agents designed for uncertainty modeling, including variants of 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 ﬁnal step of the analysis where they compare the regret of ES to that of TS.
In particular, in the proof of Lemma 8, the hypothetical actions selected by TS are deﬁned on the histories of ES, instead of TS.
Therefore, the cumulative regret incurred by these hypothetical TS actions is not equal to the cumulative regret of applying TS throughout all timesteps, while 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 ES as an example, but also inherits the technical ﬂaw in Lu and Van Roy [2017].
In addition, though Phan et al.
[2019] shows that the approximate version of TS with uniform sampling achieves sublinear regret, this result mainly beneﬁts from this forced exploration.
There are also papers aiming to analyze bandit algorithms with approximate inference.
A recent paper [Huang et al., 2022] studies an upper-conﬁdence-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 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 the linear bandit with a Gaussian prior distribution and likelihood function.
An instance is characterized by a tuple E =
( A , µ 0 , ⌃ 0 ,  2 ) , where A ⇢ R d is a ﬁnite action set, µ 0 and ⌃ 0 are the prior mean vector and covariance matrix, and  2 is the noise variance.
Let K = |A| denote the cardinality of the action set.
Note that actions are vectors of dimension d .
The prior distribution over the unknown coefﬁcient vector ✓ 2 R d , P ( ✓ 2 · ) , 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 ,
[Equation]
where W t =
( W t,a ) a 2 A is a K -dimensional vector with each element distributed as N (0 ,  2 ) .
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 A t is observed through what is termed bandit feedback .
The agent’s experience through timestep 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 duration T :
[Equation]
This is equivalent to minimizing the Bayesian regret:
[Equation]
where A ⇤ ⇠ unif  arg max a 2 A a > ✓ .
The expectations in both equations integrate over random reward realizations, algorithmic randomness, and the coefﬁcient vector ✓ .
Note that A ⇤ is random since it depends on random ✓ and the uniform sampling among maximizers (which breaks ties).
3.2 Ensemble sampling
In the absence of conjugacy properties that enable efﬁcient 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 efﬁcient incremental manner and to treat the discrete distribution represented by this ensemble 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.
At the start of each timestep, a model is sampled uniformly from the ensemble and an action is selected to optimize the immediate expected reward with respect to the sampled model.
Then, each model is updated incrementally based on the observed reward and a random perturbation.
Algorithm 1 presents the associated pseudo-code for ES.
Algorithm
1: Input : M and P ( ✓ 2 · ) 2: Sample : ˜ ✓ 0 , 1 , . . .
, ˜ ✓ 0 ,M ⇠ P ( ✓ 2 · ) 3: for t = 0 , 1 , . . .
do 4:
Sample : m t ⇠ unif { 1 , . . .
, M } 5:
Execute : A t ⇠ unif ⇢ arg max a 2 A a > ˜ ✓ t,m t  6:
Observe : R t +1 ,A t 7:
Update : (˜ ✓ t,m ) m 2 [ M ] !
(˜ ✓ t +1 {+,m ) m 
 [+} M ] 8: end for
For Gaussian prior N ( µ 0 , ⌃ 0 ) , by conjugacy, the posterior distribution is also Gaussian with covariance matrix and mean vector updated as follows,
[Equation]
While this highlights conjugacy properties of a sort that allow for efﬁcient Bayesian inference and thus tractable implementation of exact TS, the linear bandit with a 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 ˜ W t +1 =
( ˜ W t +1 ,m ) m 2 [ M ] is an M -dimensional vector with each element distributed as N (0 ,  2 ) .
A regret bound for ensemble sampling
In this section, we establish the following regret bound for ES (Algorithm 1) when it is applied to linear bandits described in Section 3.1:
Theorem 1.
Under ES Algorithm,
[Equation]
where H ( A ⇤ ) is the Shannon entropy of the optimal action A ⇤ under the prior, and
[Equation]
Note that ◆ =
O (1) and Lemma 7 in Appendix A shows ⌘ =
O
( p
[Equation]
{ d, log K } ) , so
[Equation]
Theorem 1 represents the ﬁrst 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 regret bound depends on the action set size K since our current analysis uses the method of (ﬁnite) types
[Cover and Thomas, 2006], which might not be tight for linear bandit.
We conjecture that the second term ( b ) can be improved to be only dependent of the dimension d .
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 of the theory of ES, suggesting that the approach is sound and the analysis might be extended to broader problem classes.
Comparison with the regret bound for TS
The regret bound in Theorem 1 consists of two terms.
The ﬁrst 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], since H ( A ⇤ ) ⌧ log K when the prior is informative, the ﬁrst term ( a ) is order optimal and improves upon the worst-case regret bound achieved by other algorithms such as upper conﬁdence bound type algorithms.
On the other hand, the second term ( b ) is an incremental term and accounts for posterior mismatch.
Note that as the ensemble size M ! 1 , 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 Theorem 1 has 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] Theorem 1 presents a Bayesian regret bound for the prior N ( µ 0 , ⌃ 0 ) over ✓ , while Lu and Van Roy [2017] studies ES in the frequentist setting where unknown ✓ is ﬁxed.
They try 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.
Although there are some technical issues in their analysis, as is discussed in Section 2, we compare both regret bounds.
The frequentist regret bound in Theorem 3 of Lu and Van Roy [2017] suggests that for any ✏ > 0 , when the ensemble size
M = ˜ ⇥ ( K/ ✏ 2 ) (where ˜ ⇥ hides the logarithmic factors), their approximation error term is ✏  ( ✓ ) T where  ( ✓ )
= max a 2 A a > ✓  min a 2 A a > ✓ .
To make the second term ( b ) in our Bayesian regret bound scale as ˜ O ( ✏ T ) (where ˜ O hides the logarithmic factors), we need the ensemble size M to be ˜ ⇥ ( K/ ✏ 2 ) as well.
We conjecture the required ensemble size can be improved to be only dependent of the dimension d .
Notation
Before proceeding, we deﬁne some notation 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 deﬁned as
[Equation]
if P is absolutely continuous with respect to Q ; otherwise, deﬁne d KL ( P k Q ) =
+
Note that d KL
[Equation]
P k Q ) 6 = d KL ( Q k P ) in general.
The Hellinger distance between P and Q is deﬁned 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]
5.2 Measures in information theory
Consider a random variable X that takes values in a countable set X .
The Shannon entropy of X is
[Equation]
with a convention that 0 log 0 = 0 .
For ease of exposition, let Y be another random variable that takes values in a countable set.
If
P ( Y = y ) > 0 , the realized conditional entropy of X given Y =
y is
H
[Equation]
) ,
[Equation]
[  log P ( X 2 ·| Y ) | Y =
y ] , and the conditional entropy of X given Y is
[Equation]
Note that the above deﬁnitions can be extended to general random variables.
The mutual information between X and Y is
[Equation]
and the conditional mutual information between X and Y given a general random variable Z is
I
[Equation]
X
[Equation]
A general regret bound
In this section, we derive a general regret bound for any learning algorithm (Theorem 2), based on the
Hellinger distance between the (conditional) action-selection distribution speciﬁed by the algorithm and the posterior distribution of the optimal action A ⇤ , and apply it to analyzing the regret bound for
ES in Theorem 1.
We believe that our 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 ﬁrst deﬁne some shorthand notation to simplify the exposition of this paper.
First, we use subscript t to denote conditioning on H t , speciﬁcally, we deﬁne
P t ( · ) , P ( ·| H t ) and E t [ · ] , E [ ·| H t ] .
In addition, we deﬁne probability distributions p t and p t over action set A as
[Equation]
Given the history H t , p t is the distribution of the selected action A t and p t is the posterior distribution of the optimal action A ⇤ .
Both p t and p t are speciﬁc to 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.
For approximate TS algorithms, if the approximation is accurate, p t is close to p t .
Now we introduce a general regret bound for any learning algorithm:
Theorem 2.
Under any learning algorithm,
[Equation]
where ◆ and ⌘ are deﬁned in Equation (3) .
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 ﬁrst term matches the regret bound for
TS derived in Russo and Van Roy [2016].
In the second term,
P
[Equation]
] quantiﬁes the cumulative distance between the distribution of the selected action A t and the posterior distribution the optimal action A ⇤ .
Under TS with exact posterior, d 2H ( p t k 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 k p t ) should be small.
Regret bounds 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 .
Recall that the squared Hellinger distance is symmetric and upper bound by the KL divergence.
Fact 1 (Lemma 2.4 in Tsybakov [2009]) .
For two probability distributions P and Q , we have
[Equation]
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.
Under any learning algorithm,
[Equation]
We will show in Section 7 that for ensemble sampling, d KL ( p t k p t ) can be bounded in terms of the ensemble size M .
It is noteworthy that in some other problems, it is more convenient to bound the other form d KL ( p t k p t ) .
One such example is the regret bound developed in Wen et al.
6.1 Proof of Theorem
We deﬁne the per-timestep “main regret term" G t and “approximation error term" D t as follows,
[Equation]
Lemma 1.
The cumulative regret can be written as follows,
[Equation]
Proof.
By the tower property of conditional expectation,
[Equation]
where
[Equation]
where the second equality uses that R t +
=
( R t +1 ,a ) a 2 A is independent of the action A t .
Next we upper bound
P
[Equation] [Equation]
] and
P
[Equation]
[ D t ] , respectively.
We ﬁrst analyze per-timestep main regret term G t .
The following result generalizes Proposition 5 and Corollary 1 in Russo and
Van Roy [2016] for the case such that A t and A ⇤ are not identically distributed given the history.
Lemma 2.
With ◆ deﬁned in Equation (3) , for t = 0 , . .
, T  1 ,
[Equation]
where I t ( A ⇤ ; ( A t , R t +1 ,A t )) is 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 at timestep t .
Proof.
Let the action set A
= { a 1 , . .
. , a K } .
Fix t and deﬁne M 2 R K ⇥ K by
[Equation]
i
[Equation]
j
[Equation]
Then G t = Trace(M) .
By the proof of Proposition 2 in Russo and Van Roy [2016],
I t
[Equation]
A t [Equation] where the ﬁrst equality uses the chain rule of information ( ones conditioned is jointly independent of = equality uses
KL divergence form of mutual information (Fact 3)
By the updating rule on covariance matrix in Equation (1), conditioned on H t , ✓ ⇠ N ( µ t , ⌃ t ) with ⌃ t  ⌃ 0 .
Hence, for any i
[ K ] ,
R t +1 ,a i = a > i ✓ + W t,a i ⇠ N  a > i µ t , a > i ⌃ t a i
+  where a > i ⌃ t a i  a > i ⌃
a i  max a 2 A a > ⌃ 0 a.
This implies that R t +1 ,a i is sub-Gaussian with variance proxy (max a 2 A a > ⌃
a +  2 ) .
Then by Lemma 10, we have
[Equation]
Then by Fact 4,
G 2 t
I t ( A ⇤ ; ( A t , R t +1 ,A t ))

[Equation]
Now we show that Rank( M )  d .
Deﬁne ⌫ =
E t [ ✓ ] and ⌫ j = E t [ ✓ | A ⇤ =
a j ] 8 j 2 [ K ] .
Then for any i, j 2 [ K ] ,
M i,j = q p t ( a i ) p t ( a j )
E t ⇥ ✓ > a i | A ⇤ =
a j ⇤  E t ⇥ ✓ > a
i ⇤
[Equation]
and thus
[Equation]
Since M is the product of one K ⇥ d matrix and the other d ⇥ K matrix, we have Rank( M )  d .
Now we are ready to bound
P
T  1 t =
E [ G t ] and derive the ﬁrst term of the regret bound in Theorem 2.
The analysis is the same as that of Proposition 1 in Russo and Van Roy [2016].
Lemma 3.
With ◆ deﬁned in Equation (3) , the following inequality holds:
[Equation]
Proof.
By Lemma 2,
T
[Equation]
where the second inequality applies the Cauchy-Schwarz inequality, and the last inequality uses the chain rule for mutual information (Fact 2) and the deﬁnition of mutual information.
The remaining task is to per-timestep approximation error term D t .
By analyzing (potentially) unbounded prior distribution and noises, we have the following lemma.
Lemma 4.
With ⌘ deﬁned in Equation (3) , for t = 0 , . .
, T  1 ,
[Equation]
Proof.
Fix t .
We write
[Equation]
where the ﬁrst inequality applies the Cauchy–Schwarz inequality; the second inequality uses the deﬁnition of Hellinger distance and the Jensen’s inequality; the second-to-last equality holds since A t is independent of R t +1 =
( R t +1 ,a ) a 2 A .
Taking expectation of both sides, we have
[Equation]
where the second inequality uses the Cauchy–Schwarz inequality and tower property of conditional expectation, and the second-to-last inequality holds for the independent mean-zero (sub-)Gaussian noises with variance bounded by  2 .
Proof of Theorem
In this section, we complete the proof of Theorem 1 by controlling the cumulative approximation error
P
[Equation]
p E [ d KL ( p t k p t )] in Corollary 1 for ensemble sampling, where p t is the distribution of the selected 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-timestep approximation error, and summing over timestep t yields the second term of the regret bound for ensemble sampling in Theorem 1.
Lemma 5.
Under ensemble sampling, for all t = 0 , . . .
, T  1 ,
[Equation]
Proof of Lemma 5 and Theorem 1.
We ﬁrst discuss the behavior of ensemble sampling.
Ensemble sampling uniformly samples a model m 2 { 1 , . . .
, M } , and then chooses the action A t uniformly from the set ˜
A t,m , arg max a 2 A a > ˜ ✓ t,m .
We deﬁne the following approximation of p t ( a ) :
[Equation]
where | ˜
A t,m | is the cardinality of the set ˜
A t,m (with probability one, | ˜
A t,m | = 1 ).
At timestep t , ES would sample an action from the approximation ˆ p t .
Notice that the history H t does not include independent random perturbation ˜ W t
= ( ˜ W t,m ) m
[ M ] ⇠ N (0 ,  2 I ) , which is used in updating
M models in Equation (2).
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-timestep approximation error
[Equation]
Taking expectation of both sides over H t gives E [ d KL ( p t k p t )]  E [ d KL (ˆ p t
k p t )] .
Next we upper bound E [ d KL (ˆ p t
k
p t )] by ﬁrst writing it in terms of the cumulative distribution function:
[Equation]
Then we use the following result to upper bound each P ( d KL (ˆ p t k 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 of both sizes over ✓ gives P ( d KL (ˆ p t k p t ) > ✏ )  ( t + 1) K ( M + 1) K e  M ✏ , and thus for any   0 , the integral in Equation (4) can be decomposed and bounded as follows,
[Equation]
Taking derivative of RHS gives optimal  ⇤ =
K [log( t +1)+log( M +1)] M , and then plugging in  ⇤ yields
[Equation]
This completes the proof of Lemma 5, and summing over timestep t gives Theorem 1.
Concluding remarks
We present the ﬁrst rigorous analysis for ensemble sampling, an approximate Thompson sampling method.
ES maintains an ensemble of statistically plausible models that can be updated in an efﬁcient incremental manner.
We develop the regret bound for ES in Theorem 1 for linear bandits, which approaches the regret bound for TS as the ensemble size increases.
The linear bandit problem serves only as a sanity check, and as discussed in Section 2, ES has been developed for broader and more challenging bandit and reinforcement learning problems.
It is noteworthy that in many practical problems, ES with a moderate ensemble size (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 also establish 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.
Using Theorem 2 to analyze an approximate TS algorithm, one only need to bound the Hellinger distances between the distribution of the selected arm speciﬁed by the algorithm and the true posterior distribution of the optimal action.
Finally, Theorem 2 is established by bounding the information ratios for linear bandits, and we believe it could be generalized to other bandit and online learning problems as long as the corresponding information ratios can be appropriately bounded.
These problems include generalized linear bandits, combinatorial semi-bandits, online learning with full information feedback, and problems with pure exploration objectives.
We also conjecture that the results of this paper can be extended to episodic reinforcement learning, but leave these extensions to future work.