The multi-arm bandit problem (MAB) models a casino with kk machines, where the reward of each machine is controlled by a fixed and unknown distribution. The player (agent) observes independent random rewards from generated from the distribution of a machine each time it pulls its arm. Because of limited budget, the player can only play the machines TT times. The goal of the player is to maximize its expected gain.

There is an inherent exploration-exploitation nature of the problem. The player has to explore what is a good machine while simultaneously exploits what seems to be a good machine.

Formulation

We study the restricted case where the reward distribution of each machine is bounded on [0,1][0, 1]. Define

  1. Di:D_i: the reward distribution on [0,1][0, 1] of the ii-th machine, where i∈[k]i \in [k],
  2. μi:\mu_i: the expected reward of the ii-th machine, where i∈[k]i \in [k],
  3. μ∗=max⁡i∈[k]μi\mu^* = \max_{i \in [k]} \mu_i,
  4. i∗:i^*: the index of the machine with highest expected reward,
  5. Δi=μ∗−μi\Delta_i = \mu^* - \mu_i.

Let Y⃗i\vec Y_i be the random reward vector whose elements are i.i.d. random variables from DiD_i:

  1. Y⃗i=(Yi,1,Yi,2,...,Yi,T)\vec Y_i = (Y_{i, 1}, Y_{i, 2}, ..., Y_{i, T})

Denote YY be the matrix of the random variables

  1. Y=[Y⃗1Y⃗2...Y⃗k] Y = \begin{bmatrix} \vec Y_1 \\ \vec Y_2 \\ ... \\ \vec Y_k \end{bmatrix}

Each time the player pulls the arm, it observes one random variable from the matrix. Specially, let

  1. It:I_t: the machine played at the tt-th trial,
  2. Ni(t):N_i(t): the number of times the machine ii is played up to trial tt.

Before trial tt, the number of random variables observed in Y⃗It\vec Y_{I_t} is NIt(t−1)N_{I_t} (t - 1). At trial tt, a new random variable in Y⃗It\vec Y_{I_t} is observed, and NIt(t)=NIt(t−1)+1N_{I_t} (t) = N_{I_t} (t - 1) + 1. Hence, the newly observed random variable is YIt,NIt(t)Y_{I_t, N_{I_t} (t)}. For convenience, we define

  1. Xt≐YIt,NIt(t):X_{t} \doteq Y_{I_t, N_{I_t} (t)}: the rewards obtained at the tt-th trial.

When the player chooses a machine ItI_t on trial tt, it is based on the history of his play, which consists of his past decisions, and the corresponding observed rewards:

  1. Ht:{(I1,X1),(I2,X2),...,(It−1,Xt−1)}H_t: \{ (I_1, X_1), (I_2, X_2), ..., (I_{t -1}, X_{t - 1}) \} the history up to trial tt.

The strategy the player uses at trial tt is considered as a functions from HtH_t to [k][k]:

  1. ϕt:Ht→[k]\phi_t: H_t \rightarrow [k] a function that chooses a machine based on the history at trial tt

We define the policy as the strategies the player uses over all trials:

  1. ϕ=(ϕ1,ϕ2,...,ϕT):\phi = (\phi_1, \phi_2, ..., \phi_T): policy, the strategy for the pulling arms by the player

The goal is to find a policy that maximizes the expected rewards, or equivalently, the one that minimizes the expected regret

R(ϕ)=T⋅μ∗−E[∑t=1TXt] \small \mathbb{R}(\phi) = T \cdot \mu^* - \mathbb{E}[\sum_{t = 1}^T X_t ]

By definition of Ni(t)N_i(t)'s, we have ∑i=1kNi(T)=T\sum_{i = 1}^k N_i(T) = T. Then the regret can be written as

R(ϕ)=E[∑i=1kNi(T)]⋅μ∗−∑i=1kE[Ni(T)]⋅μi=∑i:Δi>0E[Ni(T)]⋅Δi \mathbb{R}(\phi) = \mathbb{E}[\sum_{i = 1}^k N_i(T)] \cdot \mu^* - \sum_{i = 1}^k \mathbb{E}[N_i(T) ] \cdot \mu_i = \sum_{i : \Delta_i > 0} \mathbb{E}[N_i(T) ] \cdot \Delta_i

The Upper Confidence Bound (UCB) Algorithm

When making decision at trial tt, a good indicator of a machine's performance is its empirical reward:

μ^i,Ni(t−1)≐∑τ=1Ni(t−1)1Ni(t−1)Yi,τ \hat \mu_{i, N_i(t - 1)} \doteq \sum_{\tau = 1}^{N_i(t - 1) } \frac{1}{ N_i(t - 1) } Y_{i, \tau}

But this might not reflect the true value of its expectation μi\mu_i because of sampling variation. The UCB algorithm takes the variation into consideration.

Fact. Hoeffding Inequality. Let Z1,Z2,...,ZsZ_1, Z_2, ..., Z_s be i.i.d. copies of random variable ZZ on [a,b][a, b]. Then

Pr⁡[1s∑τ=1sZτ−E[Z]≥r]≤exp⁡(−2sr2(b−a)2) \Pr[ \frac{1}{s} \sum_{\tau = 1}^s Z_\tau - E[Z] \ge r] \le \exp(- \frac{2 s r^2}{(b - a)^2 } )

where r > 0.

Now, consider a fixed ss (1≤s≤T1 \le s \le T) and a failure probability δ>0\delta > 0. Applying Hoeffding inequality with Z1=Yi,1,Z2=Yi,2,...,Zs=Yi,sZ_1 = Y_{i, 1}, Z_2 = Y_{i, 2}, ..., Z_s = Y_{i, s}, a=0,b=1a = 0, b = 1 and r=log⁡1δ2sr = \sqrt { \log \frac{1}{\delta} \over 2 s }, we get

Pr⁡[μ^i,s−μi≥log⁡1δ2s]≤δ \small \Pr \left[ \hat \mu_{i, s} - \mu_i \ge \sqrt { \log \frac{1}{\delta} \over 2 s } \right] \le \delta

Similarly, by applying Hoeffding inequality with Z1=−Yi,1,Z2=−Yi,2,...,Zs=−Yi,sZ_1 = -Y_{i, 1}, Z_2 = -Y_{i, 2}, ..., Z_s = -Y_{i, s}, a=−1,b=0a = -1, b = 0 and r=log⁡1δ2sr = \sqrt { \log \frac{1}{\delta} \over 2 s }, we have

Pr⁡[μi−μ^i,s≥log⁡1δ2s]≤δ \small \Pr \left[ \mu_i - \hat \mu_{i, s} \ge \sqrt { \log \frac{1}{\delta} \over 2 s } \right] \le \delta

Inspired by this, the UCB defines the upper and lower bounds for the expected reward of the ii-th machine as follows:

UBi(t)≐μ^i,Ni(t−1)+log⁡tα2Ni(t−1)LBi(t)≐μ^i,Ni(t−1)−log⁡tα2Ni(t−1) \small UB_i ( t ) \doteq \hat \mu_{i, N_i(t - 1)} + \sqrt { \log t^\alpha \over 2 N_i(t - 1) } \\ LB_i ( t ) \doteq \hat \mu_{i, N_i(t - 1)} - \sqrt { \log t^\alpha \over 2 N_i(t - 1) } \\

where α>0\alpha > 0 is a parameter to be set. By convention here that if Ni(t−1)=0N_i(t - 1) = 0, log⁡tα2Ni(t−1)=∞\sqrt { \log t^\alpha \over 2 N_i(t - 1) } = \infty.

The UCB algorithms chooses just the machine with highest upper bound. The lower bound is needed for its analysis.

UCB algorithm

  1. For t←1t \leftarrow 1 to TT do
  2. \qquad Choose It=arg⁡max⁡i∈[k]UBi(t)I_t = \arg \max_{i \in [k] } UB_i ( t )
  3. \qquad Observe a reward XtX_t

Intuitively, there are two cases when UBi(t)UB_i ( t ) is high:

  1. The value μi\mu_i is high;
  2. The ii-th machine is under-explored.

Caveat: The reader might start to think that at trial tt, it holds that Pr⁡[μi≥UBi(t)]\Pr[\mu_i \ge UB_i(t) ] (or Pr⁡[μi≤LBi(t)]\Pr[\mu_i \le LB_i(t) ]) is bounded by 1tα\frac{1}{t^\alpha}, according to Hoeffding inequality. It is not. Hoeffding inequality requires the number of samples to be a fixed number. On the other hand, Ni(t−1)N_i(t - 1) is a random variable that depends on the history of the game. We will discuss this later.

The following theorem states that the expected regret of UCB algorithm grows logarithmically with TT.

Theorem. If α>2\alpha > 2, the regret of the UCB algorithm is bounded by

R(ϕ)≤log⁡T⋅(∑i:Δi>02αΔi)+αα−2∑i:Δi>0Δi \small \mathbb{R}(\phi) \le \log T \cdot ( \sum_{i : \Delta_i > 0 } \frac{2 \alpha }{\Delta_i } ) + \frac{\alpha}{ \alpha - 2 } \sum_{i : \Delta_i > 0 } \Delta_i

Proof:

We will show that for i:Δi>0i : \Delta_i > 0,

E[ni,T]≤αlog⁡TΔi2+αα−2 \small \mathbb{E} [n_{i, T}] \le \frac{ \alpha \log T }{ \Delta_i^2} + \frac{\alpha}{\alpha - 2}

The key for the proof relies on a sufficient condition that the ii-th machine will not be chosen at trial tt:

if the following events happen at trial tt, machine ii will not be chosen:

  1. At:2αlog⁡t2Ni(t−1)≤ΔiA_t: 2 \sqrt { \alpha \log t \over 2 N_i(t - 1) } \le \Delta_i
  2. Bt:UBi∗(t)>μ∗B_t: UB_{ i^* } ( t ) > \mu^*
  3. Ct:μi>LBi(t)C_t: \mu_i > LB_i ( t )

This condition essentially prevents UBi(t)UB_i(t) from exceeding μ∗\mu^* while assures UBi∗(t)UB_{i^*}(t) is higher than μ∗\mu^*.

UBi(t)=LBi(t)+2αlog⁡t2Ni(t−1)<μi+Δi=μ∗<UBi∗(t) \small UB_i ( t ) = LB_i ( t ) + 2 \sqrt { \alpha \log t \over 2 N_i(t - 1) } < \mu_i + \Delta_i = \mu^* < UB_{ i^* } ( t )

Let β=⌈2αlog⁡TΔi2⌉\beta = \lceil \frac{2 \alpha \log T}{\Delta_i^2} \rceil. Note that At={Ni(t−1)≥2αlog⁡tΔi2}⊂{Ni(t−1)≥β}A_t = \{ N_i(t - 1) \ge \frac{2 \alpha \log t}{\Delta_i^2} \} \subset \{ N_i(t - 1) \ge \beta \}. Now,

{It=i}⊂At∩Bt∩Ct‾=Aˉt∪Bˉt∪Cˉt \{I_t = i \} \subset \overline{ A_t \cap B_t \cap C_t } = \bar A_t \cup \bar B_t \cup \bar C_t

and

E[ni,T]=E[∑t=1T1{It=i}]=E[∑t=1T1{It=i,Aˉt}+∑t=1T1{It=i,At}]≤E[∑t=1T1{It=i, Ni(t)<β}]+∑t=1TE[1{It=i,At}]≤β+∑t=β+1TPr⁡[{It=i}∩At]≤β+∑t=β+1T(Pr⁡[Bˉt∩At]+Pr⁡[Cˉt∩At])≤β+∑t=β+1T(Pr⁡[Bˉt]+Pr⁡[Cˉt]) \begin{array}{ll} \mathbb{E}[n_{i, T}] &= \mathbb{E}[ \sum_{t = 1}^T \mathfrak{1} \{I_t = i\} ] \\ &= \mathbb{E} [ \sum_{t = 1}^T \mathfrak{1} \{I_t = i, \bar A_t \}+ \sum_{t = 1}^T \mathfrak{1} \{I_t = i, A_t \} ] \\ &\le \mathbb{E} [ \sum_{t = 1}^T \mathfrak{1} \{I_t = i, \ N_i(t) < \beta \} ] + \sum_{t = 1}^T \mathbb{E} [\mathfrak{1} \{I_t = i, A_t \} ] \\ &\le \beta + \sum_{t = \beta + 1}^T \Pr[ \{I_t = i\} \cap A_t ] \\ &\le \beta + \sum_{t = \beta + 1}^T ( \Pr[ \bar B_t \cap A_t ] + \Pr[ \bar C_t \cap A_t ] ) \\ &\le \beta + \sum_{t = \beta + 1}^T ( \Pr[ \bar B_t ] + \Pr[ \bar C_t ] ) \\ \end{array}

It is non-trivial to bound Pr⁡[Bˉt]\Pr[\bar B_t]. For a fixed 1≤s≤t−11 \le s \le t - 1, define the event

Ms:1s∑τ=1sYi∗,τ+αlog⁡t2s≤μ∗ M_s : \frac{1}{s} \sum_{\tau = 1}^s Y_{i^*, \tau} + \sqrt{ \frac{\alpha \log t}{2 s} } \le \mu^*

Since ss is fixed, by Hoeffding inequality, Pr⁡[Ms]≤1tα\Pr[M_s] \le \frac{1}{t^\alpha}. Then

Bˉt={μi∗,Ni∗(t−1)+αlog⁡t2Ni∗(t−1)≤μ∗}⊂∪s=1t−1Ms \small \begin{aligned} \bar B_t = \left\{ \mu_{ {i^*}, N_{i^*} (t - 1)} + \sqrt { \alpha \log t \over 2 N_{i^*} (t - 1) } \le \mu^* \right\} \subset \cup_{s = 1}^{t - 1} M_s \end{aligned}

and

Pr⁡[Bˉt]≤Pr⁡[∪s=1t−1Ms]≤∑s=1t−1Pr⁡[Ms]<tα−1 \Pr[ \bar B_t ] \le \Pr[ \cup_{s = 1}^{t - 1} M_s ] \le \sum_{s = 1}^{t - 1} \Pr[M_s] < t^{\alpha - 1}

and

∑t=β+1TPr⁡[Bˉt]<∑t=β+1Ttα−1<∫t=1∞1xα−1dx=1α−2x−(α−2)∣t=1∞=1α−2 \sum_{t = \beta + 1}^T \Pr[ \bar B_t ] < \sum_{t = \beta + 1}^T t^{\alpha - 1} < \int_{t = 1}^\infty \frac{1}{ x^{\alpha - 1} } dx = \frac{1}{\alpha - 2} x^{-(\alpha - 2)} \mid_{t = 1}^\infty = \frac{1}{\alpha - 2}

Similarly, we have

∑t=β+1TPr⁡[Cˉt]<1α−2 \sum_{t = \beta + 1}^T \Pr[ \bar C_t ] < \frac{1}{\alpha - 2}

Finally,

E[ni,T]≤β+2α−2≤2αlog⁡TΔi2+1+2α−2=2αlog⁡TΔi2+αα−2 \begin{aligned} \small \mathbb{E} [n_{i, T}] &\le \beta + \frac{2}{\alpha - 2} \\ &\le \frac{2 \alpha \log T}{\Delta_i^2} + 1 + \frac{2}{\alpha - 2} \\ &= \frac{2 \alpha \log T}{\Delta_i^2} + \frac{\alpha }{\alpha - 2} \end{aligned}

Remark: Can we bound Pr⁡[Bˉt]\Pr[ \bar B_t ] as follows:

Pr⁡[Bˉt]=∑τ=1t−1Pr⁡[UBi∗(t)<μ∗∣ni∗,t=τ]⋅Pr⁡[ni∗,t=τ]=∑τ=1t−11tα⋅Pr⁡[ni∗,t=τ]=1tα \begin{array}{ll} \Pr[\bar B_t] &= \sum_{\tau = 1}^{t - 1} \Pr[UB_{ i^* } ( t ) < \mu^* \mid n_{i^*, t} = \tau] \cdot \Pr[n_{i^*, t} = \tau]\\ &= \sum_{\tau = 1}^{t - 1} \frac{1}{t^\alpha} \cdot \Pr[n_{i^*, t} = \tau] \\ &= \frac{1}{t^\alpha} \end{array}

When we know ni∗,t=τn_{i^*, t} = \tau for some τ\tau, the ni∗,tn_{i^*, t} rewards from machine i∗i^* can't be viewed as independent samples. E.g., if tt is large, the best machines has much larger expected reward than others, and ni∗,tn_{i^*, t} is very small compared to tt. Then it is likely machine i∗i^* generates bad rewards in the history. The reward sequence of i∗i^* can't be viewed as a sequence of independent samples from distribution Di∗D_{i^*}.

■\blacksquare

Reference

[1] D. Katselis, B. Miranda, and H. Hu, “Lecture 8: Multi-Armed Bandits”, ECE586 MDPs and Reinforcement Learning, Spring 2019, University of Illinois at Urbana-Champaign.
[2] S. Bubeck and N. Cesa-Bianchi, “Regret Analysis of Stochastic and Nonstochastic Multi-armed Bandit Problems,” arXiv:1204.5721 [cs, stat], Nov. 2012, Accessed: Oct. 19, 2020.