Thompson Sampling for Complex Bandit Problems

Aditya Gopalan, Shie Mannor, Yishay Mansour

Introduction

The stochastic Multi-Armed Bandit (MAB) is a classical framework in machine learning and optimization. In the basic MAB setting, there is a finite set of actions, each of which has a reward derived from some stochastic process, and a learner selects actions to optimize long-term performance. The MAB model gives a crystallized abstraction of a fundamental decision problem – whether to explore or exploit in the face of uncertainty. Bandit problems have been extensively studied and several well-performing methods are known for optimizing the reward . However, the requirement that the actions’ rewards be independent is often a severe limitation, as seen in these examples:

Web Advertising: Consider a website publisher selecting at each time a subset of ads to be displayed to the user. As the publisher is paid per click, it would like to maximize its revenue, but dependencies between different ads could mean that the problem does not “decompose nicely”. For instance, showing two car ads might not significantly increase the click probability over a single car ad.

Job Scheduling: Assume we have a small number of resources or machines, and in each time step we receive a set of jobs (the “basic arms”), where the duration of each job follows some fixed but unknown distribution. The latency of a machine is the sum of the latencies of the jobs (basic arms) assigned to it, and the makespan of the system is the maximum latency across machines. Here, the decision maker’s complex action is to partition the jobs (basic arms) between the machines, to achieve the least makespan on average.

Routing: Consider a multi-commodity flow problem, where for each source-destination pair, we need to select a route (a complex action). In this setting the capacities of the edges (the basic arms) are random variables, and the reward is the total flow in the system at each time. In this example, the rewards of different paths are inter-dependent, since the flow on one path depends on which other paths where selected.

These examples motivate settings where a model more complex than the simple MAB is required. Our high-level goal is to describe a methodology that can tackle bandit problems with complex action/reward structure, and also guarantee high performance. A crucial complication in the problems above is that it is unlikely that we will get to observe the reward of each basic action chosen. Rather, we can hope to receive only an aggregate reward for the complex action taken. Our approach to complex bandit problems stems from the idea that when faced with uncertainty, pretending to be Bayesian can be advantageous. A purely Bayesian view of the MAB assumes that the model parameters (i.e., the arms’ distributions) are drawn from a prior distribution. We argue that even in a frequentist setup, in which the stochastic model is unknown but fixed, working with a fictitious prior over the model (i.e., being pseudo-Bayesian) helps solve very general bandit problems with complex actions and observations.

Our algorithmic prescription for complex bandits is Thompson sampling : Start with a fictitious prior distribution over the parameters of the basic arms of the model, whose posterior gets updated as actions are played. A parameter is randomly drawn according to the posterior and the (complex) action optimal for the parameter is played. The rationale behind this is twofold: (1) Updating the posterior adds useful information about the true unknown parameter. (2) Correlations among complex bandit actions (due to their dependence on the basic parameters) are implicitly captured by posterior updates on the space of basic parameters.

The main advantage of a pseudo-Bayesian approach like Thompson sampling, compared to other MAB methodologies such as UCB, is that it can handle a wide range of information models that go beyond observing the individual rewards alone. For example, suppose we observe only the final makespan in the multi-processor job scheduling problem above. In Thompson sampling, we merely need to compute a posterior given this observation and its likelihood. In contrast, it seems difficult to adapt an algorithm such as UCB for this case without a naive exponential dependence on the number of basic armsThe work of Dani et al. first extended the UCB framework to the case of linear cost functions. However, for more complex, nonlinear rewards (e.g., multi-commodity flows or makespans), it is unclear how UCB-like algorithms can be applied other than to treat all complex actions independently.. Besides, the deterministic approach of optimizing over regions of the parameter space that UCB-like algorithms follow is arguably harder to apply in practice, as opposed to optimizing over the action space given a sampled parameter in Thompson sampling – often an efficient polynomial-time routine like a sort. The Bayesian view that motivates Thompson sampling also allows us to use efficient numerical algorithms such as particle filtering to approximate complicated posterior distributions in practice.

Our main analytical result is a general regret bound for Thompson sampling in complex bandit settings. No specific structure is imposed on the initial (fictitious) prior, except that it be discretely supported and put nonzero mass on the true model. The bound for this general setting scales logarithmically with timeMore precisely, we obtain a bound of the form B+ClogT\mathsf{B}+\mathsf{C}\log T, in which C\mathsf{C} is a non-trivial preconstant that captures precisely the structure of correlations among actions and thus is often better than the decoupled sum-of-inverse-KL-divergences bounds seen in literature . The additive constant (wrt time) B\mathsf{B}, though potentially large and depending on the total number of complex actions, appears to be merely an artifact of our proof technique tailored towards extracting the time scaling C\mathsf{C}. This is borne out, for instance, from numerical experiments. We remark that such additive constants, in fact, often appear in regret analyses of basic Thompson sampling ., as is well-known. But more interestingly, the preconstant for this logarithmic scaling can be explicitly characterized in terms of the bandit’s KL divergence geometry and represents the information complexity of the bandit problem. The standard MAB imposes no structure among the actions, thus its information complexity simply becomes a sum of terms, one for each separate action. However, in a complex bandit setting, rewards are often more informative about other parameters of the model, in which case the bound reflects the resulting coupling across complex actions.

Recent work has shown the regret-optimality of Thompson sampling for the basic MAB , and has even provided regret bounds for a specific complex bandit setting – the linear bandit case where the reward is a linear function of the actions . However, the analysis of complex bandits in general poses challenges that cannot be overcome using the specialized techniques in these works. Indeed, these existing analyses rely crucially on the conjugacy of the prior and posterior distributions – either independent Beta or exponential family distributions for basic MAB or standard normal distributions for linear bandits. These methods break down when analyzing the evolution of complicated posterior distributions which often lack even a closed form expression.

In contrast to existing regret analyses, we develop a novel proof technique based on looking at the form of the Bayes posterior. This allows us to track the posterior distributions that result from general action and feedback sets, and to express the concentration of the posterior as a constrained optimization problem in path space. It is rather surprising that, with almost no specific structural assumptions on the prior, our technique yields a regret bound that reduces to Lai and Robbins’ classic lower bound for standard MAB, and also gives non-trivial and improved regret scalings for complex bandits. In this vein, our results represent a generalization of existing performance results for Thompson sampling.

We have complemented our theoretical findings with numerical studies of Thompson sampling. The algorithm is implemented using a simple particle filter to maintain and sample from posterior distributions. We evaluated the performance of the algorithm on two complex bandit scenarios – subset selection from a bandit and job scheduling.

Related Work: Bayesian ideas for the multi-armed bandit date back nearly 80 years ago to the work of W. R. Thompson , who introduced an elegant algorithm based on posterior sampling. However, there has been relatively meager work on using Thompson sampling in the control setup. A notable exception is that develops general Bayesian control rules and demonstrates them for classic bandits and Markov decision processes (i.e., reinforcement learning). On the empirical side, a few recent works have demonstrated the success of Thompson sampling . Recent work has shown frequentist-style regret bounds for Thompson sampling in the standard bandit model , and Bayes risk bounds in the purely Bayesian setting . Our work differs from this literature in that we go beyond simple, decoupled actions/observations – we focus on the performance of Thompson setting in a general action/feedback model, and show novel frequentist regret bounds that account for the structure of complex actions.

Regarding bandit problems with actions/rewards more complex than the basic MAB, a line of work that deserves particular mention is that of linear bandit optimization . In this setting, actions are identified with decision vectors in a Euclidean space, and the obtained rewards are random linear functions of actions, drawn from an unknown distribution. Here, we typically see regret bounds for generalizations of the UCB algorithm that show polylogarithmic regret for this setting. However, the methods and bounds are highly tailored to the specific linear feedback structure and do not carry over to other kinds of feedback.

Setup and Notation

The goal is to play an action at each time tt to minimize the (expected) regret over TT rounds: RT:=t=1Th(Xt,a(θ))h(Xt,At)R_{T}:=\sum_{t=1}^{T}h(X_{t},a^{*}(\theta^{*}))-h(X_{t},A_{t}), or alternatively, the number of plays of suboptimal actionsWe refer to the latter objective as regret since, under bounded rewards, both the objectives scale similarly with the problem size.: t=1T1{Ata}\sum_{t=1}^{T}\mathbf{1}\{A_{t}\neq a^{*}\}.

For each action aAa\in\mathcal{A}, define Sa:={θΘ:a(θ)=a}S_{a}:=\{\theta\in{\Theta}:a^{*}(\theta)=a\} to be the decision region of aa, i.e., the set of models in Θ\Theta whose optimal action is aa. Within SaS_{a}, let SaS_{a}^{\prime} be the models that exactly match θ\theta^{*} in the sense of the marginal distribution of action aa^{*}, i.e., Sa:={θSa:D(θaθa)=0}S_{a}^{\prime}:=\{\theta\in S_{a}:D(\theta^{*}_{a^{*}}||\theta_{a^{*}})=0\}. Let SaS_{a}^{\prime\prime} be the remaining models in SaS_{a}.

Regret Performance: Overview

We propose using Thompson sampling (Algorithm 1) to play actions in the general bandit model. Before formally stating the regret bound, we present an intuitive explanation of how Thompson sampling learn to play good actions in a general setup where observations, parameters and actions are related via a general likelihood. To this end, let us assume that there are finitely many actions A\mathcal{A}. Let us also index the actions in A\mathcal{A} as {1,2,,A}\{1,2,\ldots,|\mathcal{A}|\}, with the index A|\mathcal{A}| denoting the optimal action aa^{*} (we will require this indexing later when we associate each coordinate of A|\mathcal{A}|-dimensional space with its respective action). Denote by D(θaθa)D(\theta^{*}_{a}||\theta_{a}) the marginal Kullback-Leibler divergence between the output distributions of parameters θ\theta^{*} and θ\theta upon playing action aa, i.e., between the distributions {l(y;a,θ):yY}\{l(y;a,\theta^{*}):y\in\mathcal{Y}\} and {l(y;a,θ):yY}\{l(y;a,\theta):y\in\mathcal{Y}\}.

When action AtA_{t} is played at time tt, the prior density gets updated to the posterior as πt(dθ)exp(logl(Yt;At,θ)l(Yt;At,θ))πt1(dθ)\pi_{t}(d\theta)\propto\exp\left(-\log\frac{l(Y_{t};A_{t},\theta^{*})}{l(Y_{t};A_{t},\theta)}\right)\pi_{t-1}(d\theta). Observe that the conditional expectation of the “instantaneous” log-likelihood ratio logl(Yt;At,θ)l(Yt;At,θ)\log\frac{l(Y_{t};A_{t},\theta^{*})}{l(Y_{t};A_{t},\theta)}, is simply the appropriate marginal KL divergence, i.e.,

with Nt(a):=i=1t1{Ai=a}N_{t}(a):=\sum_{i=1}^{t}\mathbf{1}\{A_{i}=a\} denoting the play count of aa. The quantity in the exponent can be interpreted as a “loss” suffered by the model θ\theta up to time tt, and each time an action aa is played, θ\theta incurs an additional loss of essentially the marginal KL divergence D(θaθa)D(\theta^{*}_{a}||\theta_{a}).

Upon closer inspection, the posterior approximation (1) yields detailed insights into the dynamics of posterior-based sampling. First, since exp(aANt(a)D(θaθa))1\exp\left(-\sum_{a\in\mathcal{A}}N_{t}(a)D(\theta^{*}_{a}||\theta_{a})\right)\leq 1, the true model θ\theta^{*} always retains a significant share of posterior mass: πt(dθ)exp(0)  π0(dθ)Θ1  π0(dθ)=π0(dθ)\pi_{t}(d\theta^{*})\gtrsim\frac{\exp(0)\;\pi_{0}(d\theta^{*})}{\int_{\Theta}1\;\pi_{0}(d\theta)}=\pi_{0}(d\theta^{*}). This means that Thompson sampling samples θ\theta^{*}, and hence plays aa^{*}, with at least a constant probability each time, so that Nt(a)=Ω(t)N_{t}(a^{*})=\Omega(t).

Suppose we can show that each model in any SaS_{a}^{\prime\prime}, aaa\neq a^{*}, is such that D(θaθa)D(\theta^{*}_{a^{*}}||\theta_{a^{*}}) is bounded strictly away from with a gap of ξ>0\xi>0. Then, our preceding calculation immediately tells us that any such model is sampled at time tt with a probability exponentially decaying in tt: πt(dθ)eξΩ(t)π0(dθ)π0(dθ)\pi_{t}(d\theta)\lesssim\frac{e^{-\xi\Omega(t)}\pi_{0}(d\theta)}{\pi_{0}(d\theta^{*})}; the regret from such SaS_{a}^{\prime\prime}-sampling is negligible. On the other hand, how much does the algorithm have to work to make models in SaS_{a}^{\prime}, aaa\neq a^{*} suffer large (logT\approx\log T) losses and thus rid them of significant posterior probability?Note: Plays of aa^{*} do not help increase the losses of these models.

A model θSa\theta\in S_{a}^{\prime} suffers loss whenever the algorithm plays an action aa for which D(θaθa)>0D(\theta^{*}_{a}||\theta_{a})>0. Hence, several actions can help in making a bad model (or set of models) suffer large enough loss. Imagine that we track the play count vector Nt:=(Nt(a))aAN_{t}:=(N_{t}(a))_{a\in\mathcal{A}} in the integer lattice from t=0t=0 through t=Tt=T, from its initial value N0=(0,,0)N_{0}=(0,\ldots,0). There comes a first time τ1\tau_{1} when some action a1aa_{1}\neq a^{*} is eliminated (i.e., when all its models’ losses exceed logT\log T). The argument of the preceding paragraph indicates that the play count of a1a_{1} will stay fixed at Nτ1(a1)N_{\tau_{1}}(a_{1}) for the remainder of the horizon up to TT. Moving on, there arrives a time τ2τ1\tau_{2}\geq\tau_{1} when another action a2{a,a1}a_{2}\notin\{a*,a_{1}\} is eliminated, at which point its play count ceases to increase beyond Nτ2(a2)N_{\tau_{2}}(a_{2}), and so on.

To sum up: Continuing until all actions aaa\neq a^{*} (i.e., the regions SaS_{a}^{\prime}) are eliminated, we have a path-based bound for the total number of times suboptimal actions can be played. If we let zk=Nτkz_{k}=N_{\tau_{k}}, i.e., the play counts of all actions at time τk\tau_{k}, then for all iki\geq k we must have the constraint zi(ak)=zk(ak)z_{i}(a_{k})=z_{k}(a_{k}) as plays of aka_{k} do not occur after time τk\tau_{k}. Moreover, minθSakzk,DθlogT\min_{\theta\in S_{a_{k}}^{\prime}}\langle z_{k},D_{\theta}\rangle\approx\log T: action aka_{k} is eliminated precisely at time τk\tau_{k}. A bound on the total number of bad plays thus becomes

The final constraint above ensures that an action aka_{k} is eliminated at time τk\tau_{k}, and the penultimate constraint encodes the fact that the eliminated action aka_{k} is not played after time τk\tau_{k}. The bound not only depends on logT\log T but also on the KL-divergence geometry of the bandit, i.e., the marginal divergences D(θaθa)D(\theta^{*}_{a}||\theta_{a}). Notice that no specific form for the prior or posterior was assumed to derive the bound, save the fact that π0(dθ)0\pi_{0}(d\theta^{*})\gtrsim 0, i.e., that the prior puts “enough” mass on the truth.

In fact, all our approximate calculations leading up to the bound (2) hold rigorously – Theorem 1, to follow, states that under reasonable conditions on the prior, the number of suboptimal plays/regret scales as (2) with high probability. We will also see that the general bound (2) is non-trivial in that (a) for the standard multi-armed bandit, it gives essentially the optimum known regret scaling, and (b) for a family of complex bandit problems, it can be significantly less than the one obtained by treating all actions separately.

Regret Performance: Formal Results

Our main result is a high-probability large-horizon regret boundMore precisely, we bound the number of plays of suboptimal actions. A bound on the standard regret can also be obtained easily from this, via a self-normalizing concentration inequality we use in this paper (Appendix A). However, we avoid stating this in the interest of minimizing clutter in the presentation, since there will be additional O(logT)O(\sqrt{\log T}) terms in the bound on standard regret. for Thompson sampling. The bound holds under the following mild assumptions about the parameter space Θ\Theta, action space A|\mathcal{A}|, observation space Y|\mathcal{Y}|, and the fictitious prior π\pi.

Remark: We emphasize that the finiteness assumption on the prior is made primarily for technical tractability, without compromising the key learning dynamics of Thompson sampling perform well. In a sense, a continuous prior can be approximated by a fine enough discrete prior without affecting the geometric structure of the parameter space. The core ideas driving our analysis explain why Thompson sampling provably performs well in very general action-observation settings, and, we believe, can be made general enough to handle even continuous priors/posteriors. However, the issues here are primarily measure-theoretic: much finer control will be required to bound and track posterior probabilities in the latter case, perhaps requiring the design of adaptive neighbourhoods of θ\theta^{*} with sufficiently large posterior probabiity that depend on the evolving history of the algorithm. It is not clear to us how such regions may be constructed for obtaining regret guarantees in the case of continuous priors. We thus defer this highly nontrivial task to future work.

For each action aAa\in\mathcal{A}, let Sa:={θΘ:a(θ)=a}S_{a}:=\{\theta\in{\Theta}:a^{*}(\theta)=a\} be the set of parameters for which playing aa is optimal. For any suboptimal action aaa\neq a^{*}, let Sa:={θSa:D(θaθa)=0}S_{a}^{\prime}:=\{\theta\in S_{a}:D(\theta^{*}_{a^{*}}||\theta_{a^{*}})=0\}, Sa:=SaSaS_{a}^{\prime\prime}:=S_{a}\setminus S_{a}^{\prime}, and ξ:=infθSaD(θaθa)\xi:=\inf_{\theta\in S_{a}^{\prime\prime}}D(\theta^{*}_{a^{*}}||\theta_{a^{*}}).

We now state the regret bound for Thompson sampling for general stochastic bandits. The bound is a rigorous version of the path-based bound presented earlier, in Section 3.

Under Assumptions 1-3, the following holds for the Thompson Sampling algorithm. For δ,ϵ(0,1)\delta,\epsilon\in(0,1), there exists T0T^{\star}\geq 0 such that for all TTT\geq T^{\star}, with probability at least 1δ1-\delta, aaNT(a)B+C(logT)\sum_{a\neq a^{*}}N_{T}(a)\leq\mathsf{B}+\mathsf{C}(\log T), where BB(δ,ϵ,A,Y,Θ,π)\mathsf{B}\equiv\mathsf{B}(\delta,\epsilon,\mathcal{A},\mathcal{Y},\Theta,\pi) is a problem-dependent constant that does not depend on TT, and C(logT)C(T,δ,ϵ,A,Y,Θ,π)\mathsf{C}(\log T)\equiv\mathsf{C}(T,\delta,\epsilon,\mathcal{A},\mathcal{Y},\Theta,\pi) in general, but we suppress the dependence on the problem parameters δ,ϵ,A,Y,Θ,π\delta,\epsilon,\mathcal{A},\mathcal{Y},\Theta,\pi as we are chiefly concerned with the time scaling.:

The proof is in Appendix A of the supplementary material, and uses a recently developed self-normalized concentration inequality to help track the sample path evolution of the posterior distribution in its general form. The power of Theorem 1 lies in the fact that it accounts for coupling of information across complex actions and give improved structural constants for the regret scaling than the standard decoupled case, as we showWe remark that though the non-scaling (with TT) additive constant B\mathsf{B} might appear large, we believe it is an artifact of our proof technique tailored to extract the time scaling of the regret. Indeed, numerical results show practically no additive factor behaviour. in Corollaries 1 and 2. We also prove Proposition 2, which explicitly quantifies the improvement over the naive regret scaling for general complex bandit problems as a function of marginal KL-divergence separation in the parameter space Θ\Theta.

A natural finite prior for this problem can be obtained by discretizing each of the NN basic dimensions and putting uniform mass over all points: Θ={β,2β,(1β1)β}N\Theta=\left\{\beta,2\beta,\ldots\left(\lfloor\frac{1}{\beta}\rfloor-1\right)\beta\right\}^{N}, β(0,1)\beta\in(0,1), and π(θ)=1Θ\pi(\theta)=\frac{1}{|\Theta|} θΘ\forall\theta\in\Theta. We can then show, using Theorem 1, that

Suppose μ(μ1,μ2,,μN)Θ\mu\equiv(\mu_{1},\mu_{2},\ldots,\mu_{N})\in\Theta and μNM<μNM+1\mu_{N-M}<\mu_{N-M+1}. Then, the following holds for the Thompson sampling algorithm for Y\mathcal{Y}, A\mathcal{A}, ff, gg, Θ\Theta and π\pi as above. For δ,ϵ(0,1)\delta,\epsilon\in(0,1), there exists T0T^{\star}\geq 0 such that for all TTT\geq T^{\star}, with probability at least 1δ1-\delta, aaNT(a)B2+(1+ϵ1ϵ)i=1NM1D(μiμNM+1)logT\sum_{a\neq a^{*}}N_{T}(a)\leq\mathsf{B}_{2}+\left(\frac{1+\epsilon}{1-\epsilon}\right)\sum_{i=1}^{N-M}\frac{1}{D(\mu_{i}||\mu_{N-M+1})}\log T, where B2B2(δ,ϵ,A,Y,Θ,π)\mathsf{B}_{2}\equiv\mathsf{B}_{2}(\delta,\epsilon,\mathcal{A},\mathcal{Y},\Theta,\pi) is a problem-dependent constant that does not depend on TT.

This result, proved in Appendix B of the supplementary material, illustrates the power of additional information from observing several arms of a bandit at once. Even though the total number of actions (NM){N\choose M} is at worst exponential in MM, the regret bound scales only as O((NM)logT)O((N-M)\log T). Note also that for M=1M=1 (the standard MAB setting), the regret scaling is essentially i=1NM1D(μiμNM+1)logT\sum_{i=1}^{N-M}\frac{1}{D(\mu_{i}||\mu_{N-M+1})}\log T, which is interestingly the optimal regret scaling for standard Bernoulli bandits obtained by specialized algorithms for decoupled bandit arms such as KL-UCB and, more recently, Thompson Sampling with the independent Beta prior .

2 A General Regret Improvement Result & Application to MAX Subset Regret

Using the same setting and size-MM subset actions as before but not being able to observe all the individual arms’ rewards results in much more challenging bandit settings. Here, we consider the case where we get to observe as the reward only the maximum value of MM chosen arms of a standard NN-armed Bernoulli bandit. The feedback is still aggregated across basic arms, but at the same time very different from the full information case, e.g., observing a reward of is very uninformative whereas a value of 11 is highly informative about the constituent arms.

We can again apply the general machinery provided by Theorem 1 to obtain a non-trivial regret bound for observing the highly nonlinear MAX reward. Along the way, we derive the following consequence of Theorem 1, useful in its own right, that explicitly guarantees an improvement in regret directly based on the Kullback-Leibler resolvability of parameters in the parameter space – a measure of coupling across complex actions.

Let TT be large enough such that maxθΘ,aAD(θaθa)1+ϵ1ϵlogT\max_{\theta\in\Theta,a\in\mathcal{A}}D(\theta^{*}_{a}||\theta_{a})\leq\frac{1+\epsilon}{1-\epsilon}\log T. Suppose Δminaa,θSaD(θaθa)\Delta\leq\min_{a\neq a^{*},\theta\in S_{a}^{\prime}}D(\theta^{*}_{a}||\theta_{a}), and that the integer LL is such that for every aaa\neq a^{*} and θSa\theta\in S_{a}^{\prime}, {a^A:a^a,D(θa^θa^)Δ}L|\{\hat{a}\in\mathcal{A}:\hat{a}\neq a^{*},D(\theta^{*}_{\hat{a}}||\theta_{\hat{a}})\geq\Delta\}|\geq L, i.e., at least LL coordinates of DθD_{\theta} (excluding the A|\mathcal{A}|-th coordinate aa^{*}) are at least Δ\Delta. Then, C(logT)(ALΔ)2(1+ϵ)1ϵlogT\mathsf{C}(\log T)\leq\left(\frac{|\mathcal{A}|-L}{\Delta}\right)\frac{2(1+\epsilon)}{1-\epsilon}\log T.

Note that the result assures a non-trivial additive reduction of Ω(LΔlogT)\Omega\left(\frac{L}{\Delta}\log T\right) from the naive decoupled regret, whenever any suboptimal model in Θ\Theta can be resolved apart from θ\theta^{*} by at least LL actions in the sense of marginal KL-divergences of their observations. Its proof is contained in Appendix C in the supplementary material.

The following holds for the Thompson sampling algorithm for Y\mathcal{Y}, A\mathcal{A}, ff, gg, Θ\Theta and π\pi as above. For 0MN0\leq M\leq N, MN2M\neq\frac{N}{2}, δ,ϵ(0,1)\delta,\epsilon\in(0,1), there exists T0T^{\star}\geq 0 such that for all TTT\geq T^{\star}, with probability at least 1δ1-\delta, aaNT(a)B3+(log2)(1+ϵ1ϵ)[1+(N1M)]logTμmin2(1β)\sum_{a\neq a^{*}}N_{T}(a)\leq\mathsf{B}_{3}+(\log 2)\left(\frac{1+\epsilon}{1-\epsilon}\right)\left[1+{N-1\choose M}\right]\frac{\log T}{\mu^{2}_{\min}(1-\beta)}.

Observe that this regret bound is of the order of (N1M)logTμmin2{N-1\choose M}\frac{\log T}{\mu^{2}_{\min}}, which is significantly less than the usual, decoupled bound of AlogTμmin2=(NM)logTμmin2|\mathcal{A}|\frac{\log T}{\mu^{2}_{\min}}={N\choose M}\frac{\log T}{\mu^{2}_{\min}} by a multiplicative factor of (N1M)(NM)=NMN\frac{{N-1\choose M}}{{N\choose M}}=\frac{N-M}{N}, or by an additive factor of (N1M1)logTμmin2{N-1\choose M-1}\frac{\log T}{\mu^{2}_{\min}}. In fact, though this is a provable reduction in the regret scaling, the actual reduction is likely to be much better in practice – experimental results attest to this. The proof of this result uses sharp combinatorial estimates relating to vertices on the NN-dimensional hypercube , and can be found in Appendix C, in the supplementary material.

Discussion & Future Work

We applied Thompson sampling to balance exploration and exploitation in bandit problems where the action/observation space is complex. Using a novel technique of viewing posterior evolution as a path-based optimization problem, we developed a generic regret bound for Thompson sampling with improved constants that capture the structure of the problem. In practice, the algorithm is easy to implement using sequential Monte-Carlo methods such as particle filters.

Moving forward, the technique of converting posterior concentration to an optimization involving exponentiated KL divergences could be useful in showing adversarial regret bounds for Bayesian-inspired algorithms. It is reasonable to posit that Thompson sampling would work well in a range of complex learning settings where a suitable point estimate is available. As an example, optimal bidding for online repeated auctions depending on continuous bid reward functions can be potentiallly learnt by constructing an estimate of the bid curve.

Another unexplored direction is handling large scale reinforcement learning problems with complex, state-dependent Markovian dynamics. It would be promising if computationally demanding large-state space MDPs could be solved using a form of Thompson sampling by policy iteration after sampling from a parameterized set of MDPs; this has previously been shown to work well in practice . We can also attempt to develop a theoretical understanding of pseudo-Bayesian learning for complex spaces like the XX-armed bandit problem with a continuous state space. At a fundamental level, this could result in a rigorous characterization of Thompsn sampling/pseudo-Bayesian procedures in terms of the value of information per learning step.

References

Appendix A Proof of Theorem 1

Sampling from the posterior as proportional to exponential weights: Let Nt(a)N_{t}(a) be the number of times action aa has been played up to (and including) time tt. At any time tt, the posterior distribution πt\pi_{t} over Θ\Theta is given by Bayes’ rule:

with the weight Wt(θ)W_{t}(\theta) of each θ\theta being the likelihood of observing the history under θ\theta:

Here, for any θΘ\theta\in\Theta and aAa\in\mathcal{A}, θa\theta_{a} is used to denote the “marginal” probability distribution {l(y;a,θ)}yY\{l(y;a,\theta)\}_{y\in\mathcal{Y}} of the output of action aa when the bandit has parameter θ\theta. For probability measures ν,μ\nu,\mu over Y\mathcal{Y}, D(νμ)D(\nu||\mu) measures the Kullback-Leibler (KL) divergence of ν\nu wrt μ\mu.

Note that by definition, Wt(θ)=1W_{t}(\theta^{*})=1 at all times tt – a fact that we use often in the analysis.

For any action-observation sequence (at,yt)(a_{t},y_{t}), t=1,,Tt=1,\ldots,T of a bandit algorithm,

Let Nt(a)N_{t}^{\prime}(a) (resp. Nt(a)N_{t}^{\prime\prime}(a)) be the number of times that a parameter has been drawn from SaS_{a}^{\prime} (resp. SaS_{a}^{\prime\prime}), so that Nt(a)=Nt(a)+Nt(a)N_{t}(a)=N_{t}^{\prime}(a)+N_{t}^{\prime\prime}(a).

The following self-normalized, uniform deviation bound controls the empirical distribution of each row Qa()Q_{a}(\cdot) of the random reward matrix QQ. It is a version of a bound proved in .

Let aAa\in\mathcal{A}, yYy\in\mathcal{Y} and δ(0,1)\delta\in(0,1). Then, with probability at least 1δ21-{\delta}{\sqrt{2}},

Put c:=logYAδc:=\log\frac{|\mathcal{Y}||\mathcal{A}|}{\delta}, and ρ(x)ρc(x):=4c+logx2\rho(x)\equiv\rho_{c}(x):=4\sqrt{c+\frac{\log x}{2}} for x>0x>0. It follows that the following “good data” event occurs with probability at least (1δ2)(1-\delta\sqrt{2}):

Fix ϵ(0,1)\epsilon\in(0,1). There exist λ,n0\lambda,n^{\star}\geq 0, not depending on TT, so that the following is true. For any θΘ\theta\in\Theta, aAa\in\mathcal{A} and yYy\in\mathcal{Y}, under the event GG,

To show the second part, notice again that for fixed θΘ\theta\in\Theta and aAa\in\mathcal{A}, there exists nθ,a0n^{\star}_{\theta,a}\geq 0 such that

since ρ(x)=o(x)\rho(x)=o(x). Setting n:=maxθΘ,aAnθ,an^{\star}:=\max_{\theta\in\Theta,a\in\mathcal{A}}n^{\star}_{\theta,a} then completes the proof of the second part. ∎

The result of Lemma 3 implies that under the event GG, and at all times t1t\geq 1:

Also, under the event GG, the posterior probability of θSa\theta\in S_{a}^{\prime\prime} at all times tt can be bounded above using Lemma 3 and the basic bound in (6):

In the above, the penultimate inequality is by Lemma 3 applied to all actions aaa\neq a^{*}, and the final inequality follows in a manner similar to (6), for action aa^{*}. Letting d:=eλAπ(θ)d:=\frac{e^{\lambda|\mathcal{A}|}}{\pi(\theta^{*})}, we have that under the event GG, for aaa\neq a^{*} and θSa\theta\in S_{a}^{\prime\prime},

Recall that by definition, any θSa\theta\in S_{a}^{\prime\prime} with aaa\neq a^{*} can be resolved apart from θ\theta^{*} in the action aa^{*}, i.e., D(θaθa)ξD(\theta^{*}_{a^{*}}||\theta_{a^{*}})\geq\xi. Moreover, the discrete prior assumption (Assumption 2) implies that ξ>0\xi>0. Using this, we can bound the right-hand side of (8) further under the event GG:

Integrating (9) over θSa\theta\in S_{a}^{\prime\prime} and noticing that π(Sa)1\pi(S_{a}^{\prime\prime})\leq 1 gives, under GG,

We can now estimate, using the conditional version of Markov’s inequality, the number of times that parameters from SaS_{a}^{\prime\prime} are sampled under “good data” GG:

where the final inequality is by (10) and the fact that πt(Sa)1\pi_{t}(S_{a}^{\prime\prime})\leq 1.aba\wedge b denotes the minimum of aa and bb.

At each time tt, if we let Ft\mathcal{F}_{t} denote the σ\sigma-algebra generated by the random variables {(θi,Ai,Yi):it}\{(\theta_{i},A_{i},Y_{i}):i\leq t\}, then

where, in the penultimate step, we use πt(θ)p1G\pi_{t}(\theta^{*})\geq p^{*}\cdot\mathbf{1}_{G} from (7). Iterating this estimate and using it in (11) together with the trivial bound Nt(a)t\sqrt{N_{t}(a^{*})}\leq\sqrt{t} gives

Since peξ+1p<1p^{*}e^{-\xi}+1-p^{*}<1 and ρ(t)t=o(t)\rho(t)\sqrt{t}=o(t), the sum above is dominated by a geometric series after finitely many tt, and is thus a finite quantity α<\alpha<\infty, say. (Note that α\alpha does not depend on TT.) Replacing δ\delta by δA\frac{\delta}{|\mathcal{A}|} and taking a union bound over all aaa\neq a^{*}, this proves

where λ\lambda and nn^{\star} satisfy the assertion of Lemma 3. Thus, by Lemma 3, under GG, and for all θΘ\theta\in\Theta,

where the last inequality is because Nt(a)=Nt(a)+Nt(a)N_{t}(a)=N_{t}^{\prime}(a)+N_{t}^{\prime\prime}(a), and because bθ,a(x)b_{\theta,a}(x) is monotone non-decreasing in xx.

Note: In what follows, we assume that T>0T>0 is large enough such that logTλAϵ\log T\geq\frac{\lambda|\mathcal{A}|}{\epsilon} holds.

We proceed to define the following sequence of non-decreasing stopping times, and associated sets of actions, for the time horizon 1,2,,T1,2,\ldots,T.

Let τ0:=1\tau_{0}:=1 and A0:=\mathcal{A}_{0}:=\emptyset. For each k=1,,A1k=1,\ldots,|\mathcal{A}|-1, let

In other words, for each kk, Ak\mathcal{A}_{k} represents a set of “eliminated” suboptimal actions. τk\tau_{k} is the first time after τk1\tau_{k-1}, when some suboptimal action (which is not already eliminated) gets eliminated in the sense of satisfying the inequality in (12). Essentially, the inequality checks whether the condition

is met for all particles θSak\theta\in S_{\mathsf{a}_{k}}^{\prime} at time tt, with a slight modification in that the play count Nt(a)N_{t}^{\prime}(a) is “frozen” to Nτm(am)N_{\tau_{m}}(a_{m}) if action aa has been eliminated at an earlier time τmt\tau_{m}\leq t, and the introduction of the factor 1+ϵ1ϵ\frac{1+\epsilon}{1-\epsilon} to the right hand side.

In case more than one suboptimal action is eliminated for the first time at τk\tau_{k}, we use a fixed tie-breaking rule in A\mathcal{A} to resolve the tie. We then put

Thus, τ0τ1τA1T\tau_{0}\leq\tau_{1}\leq\ldots\leq\tau_{|\mathcal{A}|-1}\leq T, and A0A1AA1=A\mathcal{A}_{0}\subseteq\mathcal{A}_{1}\subseteq\ldots\subseteq\mathcal{A}_{|\mathcal{A}|-1}=\mathcal{A}.

For each action aaa\neq a^{*}, by definition, there exists a unique τk\tau_{k} for which aa is first eliminated at τk\tau_{k}, i.e., AkAk1=a\mathcal{A}_{k}\setminus\mathcal{A}_{k-1}=a. Let τ(a):=τk\tau(a):=\tau_{k}.

The following lemma states that after an action aa is eliminated, the algorithm does not sample from SaS_{a}^{\prime} more than a constant number of times.

If logTλA\log T\geq\lambda|\mathcal{A}|, then

Observe that under GG, whenever Tt>τkT\geq t>\tau_{k}, every θSak\theta\in S_{\mathsf{a}_{k}}^{\prime} satisfies

The second inequality above is because the definition of bθ,a(x)b_{\theta,a}(x) implies that x0  (1ϵ)xD(θaθa)bθ,a(x)λ\forall x\geq 0\;(1-\epsilon)xD(\theta^{*}_{a}||\theta_{a})-b_{\theta,a}(x)\leq\lambda. The penultimate inequality above is due to the fact that for any mkm\leq k, we have τmτkt\tau_{m}\leq\tau_{k}\leq t, implying that Nt(am)Nτm(am)N_{t}^{\prime}(a_{m})\geq N_{\tau_{m}}^{\prime}(a_{m}). We now estimate

Replacing δ\delta by δA\frac{\delta}{|\mathcal{A}|} and taking a union bound over k=1,2,,A1k=1,2,\ldots,|\mathcal{A}|-1 proves the lemma. ∎

Now we bound the number of plays of suboptimal actions under the event

which, according to the results of Theorem 3, Lemma 4 and Lemma 5, occurs with probability at least 1(δ2+2δ)1-(\delta\sqrt{2}+2\delta). Under the event HH, we have

Under HH, k=1A1Nτk(ak)CT\sum_{k=1}^{|\mathcal{A}|-1}N_{\tau_{k}}^{\prime}(\mathsf{a}_{k})\leq\mathsf{C}_{T}, where CT\mathsf{C}_{T} solves

With regard to the definition of the τk\tau_{k} and ak\mathsf{a}_{k} in (12), if we take

then it follows, from (12), that the zkz_{k} and aka_{k} satisfy all the constraints of the optimization problem (13). We also have k=1A1zk(k)=k=1A1Nτk(ak)\sum_{k=1}^{|\mathcal{A}|-1}z_{k}(k)=\sum_{k=1}^{|\mathcal{A}|-1}N_{\tau_{k}}^{\prime}(\mathsf{a}_{k}). This proves the lemma. ∎

Appendix B Proof of Corollary 1

The optimal action (in this case a subset) is a={NM+1,,N}a^{*}=\{N-M+1,\ldots,N\}. It can be checked that the assumptions 1-3 are verified, thus the bound (3) applies and we will be done if we estimate C(logT)\mathsf{C}(\log T).

The essence of the proof is to first partition the space of suboptimal actions (subsets) according to the least-index basic arm that they contain, i.e., for i=1,2,,NMi=1,2,\ldots,N-M, let

be all the actions whose least-index (or “weakest”) arm is ii This covers all of A{a}\mathcal{A}\setminus\{a^{*}\} since every suboptimal set must contain a basic arm of index NMN-M or lesser..

Take any sequence {zk}k=1A1\{z_{k}\}_{k=1}^{|\mathcal{A}|-1}, {ak}k=1A1\{a_{k}\}_{k=1}^{|\mathcal{A}|-1} feasible for (3). Fix 1iNM1\leq i\leq N-M and consider the sum k:akAizk(ak)\sum_{k:a_{k}\in\mathcal{A}_{i}}z_{k}(a_{k}). We claim that this does not exceed 1+(1+ϵ1ϵ)1D(μiμNM+1)logT1+\left(\frac{1+\epsilon}{1-\epsilon}\right)\frac{1}{D(\mu_{i}||\mu_{N-M+1})}\log T. If, on the contrary, it does, then put k^:=max{k:akAi}\hat{k}:=\max\{k:a_{k}\in\mathcal{A}_{i}\}. Take any model θSak^\theta\in S_{a_{\hat{k}}}^{\prime}. We must have D(μaθa)=0D(\mu_{a^{*}}||\theta_{a^{*}})=0. Since the KL divergence due to observing a tuple of MM independent rewards is simply the sum of the MM individual (binary) KL divergences, we get that θj=μj\theta_{j}=\mu_{j} for all jNM+1j\geq N-M+1. However, the optimal action for θ\theta is ak^a_{\hat{k}} containing the basic arm ii. Hence, we get that θiμNM+1μi\theta_{i}\geq\mu_{N-M+1}\geq\mu_{i}, which implies that D(μiθi)D(μiμNM+1)D(\mu_{i}||\theta_{i})\geq D(\mu_{i}||\mu_{N-M+1}).

by hypothesis. This violates the final inequality of (3) and yields the desired contradiction. Since the above argument is valid for any 1iNM1\leq i\leq N-M, summing over all such ii completes the proof.

Appendix C Proof of Proposition 2 & Corollary 2

Let TT be large enough such that maxθΘ,aAD(θaθa)1+ϵ1ϵlogT\max_{\theta\in\Theta,a\in\mathcal{A}}D(\theta^{*}_{a}||\theta_{a})\leq\frac{1+\epsilon}{1-\epsilon}\log T. Then, the optimization problem (3) admits the following upper bound:

Take a feasible solution {zk,ak}k=1A1\{z_{k},a_{k}\}_{k=1}^{|\mathcal{A}|-1} for the optimization problem (3). We will show that z=zA1z=z_{|\mathcal{A}|-1} and a=aA1a=a_{|\mathcal{A}|-1} satisfy the constraints (14) above and yield the same objective function value in both optimization problems.

as zA1(ak)zk(ak)z_{|\mathcal{A}|-1}(a_{k})\geq z_{k}(a_{k}), for all kA1k\leq|\mathcal{A}|-1, by (3). This shows that the objective functions of both (3) and (14) are equal at {zk,ak}k=1A1\{z_{k},a_{k}\}_{k=1}^{|\mathcal{A}|-1} and (z,a)(z,a) respectively.

Next, for any 1jA11\leq j\leq|\mathcal{A}|-1 and the unit vector e(j)e^{(j)}, we have

This shows that the penultimate constraint in (14) is satisfied. For the final constraint in (14), fix 1jA11\leq j\leq|\mathcal{A}|-1, so that we have

exactly as in the preceding derivation. This implies that z(a^)2δa^(1+ϵ1ϵ)logTz(\hat{a})\leq\frac{2}{\delta_{\hat{a}}}\left(\frac{1+\epsilon}{1-\epsilon}\right)\log T for all a^a\hat{a}\neq a^{*}. ∎

Let TT be large enough such that maxθΘ,aAD(θaθa)1+ϵ1ϵlogT\max_{\theta\in\Theta,a\in\mathcal{A}}D(\theta^{*}_{a}||\theta_{a})\leq\frac{1+\epsilon}{1-\epsilon}\log T. Suppose

i.e., at least LL coordinates of DθD_{\theta} (excluding the A|\mathcal{A}|-th coordinate aa^{*}) are at least Δ\Delta. Then,

Consider a solution (z,a)(z,a) to a relaxation of the optimization problem (14) obtained by replacing δa^\delta_{\hat{a}} with Δ\Delta and DθD_{\theta} with Dθ:=min(Dθ,Δ1)DθD_{\theta}^{\prime}:=\min(D_{\theta},\Delta\cdot\mathbf{1})\preceq D_{\theta} Here 1\mathbf{1} represents an all-ones vector of dimension A\mathcal{A}, and the minimum is taken coordinatewise. Also, a solution exists since the objective is continuous and the feasible region is compact.. We claim that z11,z(ALΔ)χ||z||_{1}\equiv\langle\mathbf{1},z\rangle\leq\left(\frac{|\mathcal{A}|-L}{\Delta}\right)\chi where χ:=2(1+ϵ)1ϵlogT\chi:=\frac{2(1+\epsilon)}{1-\epsilon}\log T. If not, let y=χ(1Δ,,1Δ,0)y=\chi\left(\frac{1}{\Delta},\ldots,\frac{1}{\Delta},0\right), and observe that

since DθΔ1D_{\theta}^{\prime}\preceq\Delta\cdot\mathbf{1} by definition and zyz\preceq y by hypothesis. This is a contradiction. ∎

Playing Subsets with Max reward: Let β(0,1)\beta\in(0,1), and suppose that Θ={1βR,1βR1,,1β2,1β}N\Theta=\{1-\beta^{R},1-\beta^{R-1},\ldots,1-\beta^{2},1-\beta\}^{N}, for positive integers RR and NN. Consider an NN armed Bernoulli bandit with arm parameters μΘ\mu\in\Theta. The complex actions are all size MM subsets of the NN basic arms, MN12M\leq\frac{N-1}{2}. Let μmin:=minaAia(1μi)\mu_{min}:=\min_{a\in\mathcal{A}}\prod_{i\in a}(1-\mu_{i}).

Since the reward from playing a subset aa is the maximum (equivalently, the Boolean OR) value, the marginal KL divergence along action aa is simply the Bernoulli KL divergence for the product of the parameters: D(θaθa)=D(μaθa)=D(ia(1μi)ia(1θi))D(\theta^{*}_{a}||\theta_{a})=D(\mu_{a}||\theta_{a})=D\left(\prod_{i\in a}(1-\mu_{i})||\prod_{i\in a}(1-\theta_{i})\right).

If μi=1βri\mu_{i}=1-\beta^{r_{i}} and θi=1θsi\theta_{i}=1-\theta^{s_{i}} for integers ri,sir_{i},s_{i}, i=1,2,,Ni=1,2,\ldots,N, then Pinsker’s inequality yields

D(μaθa)>0D(\mu_{a}||\theta_{a})>0 if and only if iasiiari1|\sum_{i\in a}s_{i}-\sum_{i\in a}r_{i}|\geq 1. This implies, together with the above, that

Next, we claim that for any μθΘ\mu\neq\theta\in\Theta, D(μaθa)>0D(\mu_{a}||\theta_{a})>0 for at least L=(N1M1)1L={N-1\choose M-1}-1 size MM subsets/actions aa. This is because if otherwise, then iari=iasi\sum_{i\in a}r_{i}=\sum_{i\in a}s_{i} for at least (NM)L=(NM)(N1M1)+1=(N1M)+1{N\choose M}-L={N\choose M}-{N-1\choose M-1}+1={N-1\choose M}+1 subsets aa. However, a combinatorial result states that the maximum number of weight MM vertices of the NN dimensional hypercube (in our case, a size MM subset corresponds to a weight MM vertex) that do not span NN dimensions is (N1M){N-1\choose M}. This forces ri=rir_{i}=r_{i} for all i[N]i\in[N] and hence μ=θ\mu=\theta, a contradiction.

Now, we can apply Proposition 2 with Δ\Delta and LL as above. This gives us that for TT large enough, the total number of arm plays is bounded above, with probability at least 1δ1-\delta, by