Intuition The one core idea
An agent that learns by doing faces a permanent gamble: stick with the choice that looks best so far, or gamble on a less-known choice that might be even better. Everything in this topic — regret, epsilon-greedy, UCB, Thompson sampling — is just a different, principled way to decide how much to gamble.
Before we can read a single formula on the parent page, we need to build every symbol from the ground up. This page is a dictionary you can trust: nothing appears here that we haven't first drawn a picture for. We start with the story, then the vocabulary, then the numbers.
Imagine a row of slot machines. Each machine has a lever ("arm") you can pull, and each pull spits out some reward — a number, maybe a coin, maybe nothing. You do not know which machine is generous. The only way to find out is to pull levers and watch.
This is the Multi-Armed Bandit — the simplest possible world in which the exploration/exploitation dilemma exists. Everything else on the parent page is a tool for playing this game well.
Figure s01 — the row of arms. Three slot machines stand side by side, each drawn in its own colour (arm 1 burnt orange, arm 2 teal, arm 3 plum). Above each lever is a "r ? " mark: pulling that lever produces an unknown reward. This is the whole world we play in — refer back to it whenever a symbol names something in this picture.
Definition The players in the story
An arm (or action ) is one lever you could pull.
A reward is the number you get back after pulling.
A step (or trial ) is one round: choose an arm, receive a reward.
A strategy (or policy ) is your rule for deciding which arm to pull each step.
Each block below gives a symbol: plain words → the picture → why the topic needs it. They are ordered so each one only uses symbols already defined above it.
a = "which lever", A = "the whole menu of levers"
Plain words: a is a label for one choice. If there are three machines, a can be machine 1, 2, or 3. The capital A is the collection of every choice available — the full menu, written A = { 1 , 2 , 3 } in a 3-arm world. So a is one item; A is the set that a is picked from .
Picture: in Figure s01 , a single coloured lever is an a ; the entire row of levers, taken together, is A .
Why we need it: the whole problem is choosing an a out of A each step . Without a name for a single choice (a ) and for the pool of choices (A ), we can't write a rule for choosing.
K = "how many levers"
Plain words: count of available arms — that is, how many items are inside the set A .
Picture: the length of the row of machines in Figure s01 .
Why we need it: exploration means "trying the other arms." How many others there are (K − 1 of them) controls how hard exploration is. In code you'll also see this written ∣ A ∣ — the size of the action set A we just defined. The bars ∣ ⋅ ∣ just mean "how many items are inside," so ∣ A ∣ = K .
∣ A ∣ is not absolute value here
The vertical bars around a set mean "count the elements," not "make it positive." Since A is the menu of arms, ∣ A ∣ = K .
t (small) and T (big)
Plain words: t is which round we are on right now (1, then 2, then 3...). T is the total number of rounds we will ever play .
Picture: a timeline of pulls. t is a moving marker sliding along it; T is where the line ends.
Why we need it: a good strategy explores a lot early (small t ) and exploits more later. Any formula that changes with time uses t ; any total-lifetime score uses T .
r = a reward, r t = reward we got on step t
Plain words: r is a single payout number. The little t underneath (r t ) means "the payout that happened on round t ." Subscripts are just address labels — "the r that belongs to step t ."
Picture: a coin dropping out of a machine, stamped with the round number.
Why we need it: the agent only ever sees rewards; it never sees the machine's true quality directly. Everything it believes is reconstructed from a history of r t values.
Figure s02 — one arm's payout cloud. The teal curve is the spread of rewards a single arm can produce; the plum dashed line marks its true mean μ a (the balance point of the cloud). The orange dots are a handful of actually observed rewards r i , and the orange dotted line is their average — our estimate Q t ( a ) , which wobbles near, but rarely exactly on, the true mean.
count is a stand-in for uncertainty
Averaging noisy numbers is like listening in a crowd: the more voices (samples) you average, the more the random noise cancels out. Statisticians make this exact — if each pull has spread σ (the arm's payout width we just defined), the standard error of the average of N t ( a ) pulls is
uncertainty ≈ N t ( a ) σ .
Read this as: the wobble in our estimate shrinks like 1/ N t ( a ) — the fixed fog σ divided by the growing square-root of our count. That is why the raw count N t ( a ) is an uncertainty measure — a big count means a small wobble, a tiny count means a big wobble. This exact 1/ N t ( a ) shape is what reappears as the UCB exploration bonus ln t / N t ( a ) on the parent page.
Definition The hat means "our guess"
Plain words: μ ^ a (mu with a hat) is our best current guess of μ a , computed from the rewards we've actually seen. The parent also writes this as Q t ( a ) — the estimated value of action a at time t . Same idea, two names.
How it's computed: average the rewards you got from arm a : Q t ( a ) = N t ( a ) 1 ∑ i : a i = a r i (when N t ( a ) ≥ 1 ) The notation i : a i = a under the sum means "add up over every past round i where the arm chosen was a " — this is exactly where the symbol a i earns its keep.
Picture: the orange dotted line in Figure s02 — a wobbly estimate of the true centre, drawn from just a handful of dots.
Why we need it: μ ^ a is all the agent has. The gap between μ ^ a and μ a is exactly what exploration shrinks. The Q name connects to Q-Learning , where the same "estimated action value" idea drives a full learning algorithm.
Common mistake The formula breaks when
N t ( a ) = 0
If we have never pulled arm a , then N t ( a ) = 0 and the formula divides by zero — Q t ( a ) is simply undefined , because we have no evidence at all. Every real algorithm handles this with an initial value Q 0 ( a ) :
Pull each arm once first (so no arm starts at zero pulls), or
Set an optimistic start like Q 0 ( a ) = + ∞ (or a large number), which forces every untried arm to be tried before the averaging formula ever applies.
So read Q t ( a ) = N t ( a ) 1 ∑ r i as the rule once N t ( a ) ≥ 1 ; before that, Q t ( a ) is whatever initial value you chose.
Definition The star means "the best one"
Plain words: a ∗ = arg max a μ a is the arm with the highest true average; μ ∗ = max a μ a is that highest average itself.
Reading arg max vs max : max a μ a answers "what is the biggest value?" (a number). arg max a μ a answers "which arm achieves it?" (a label). One gives the prize, the other gives the winner's name.
Picture: the tallest machine in the line-up.
Why we need it: we score ourselves against this ideal. Every point below μ ∗ is a point we regretted.
Now every symbol in the parent's headline formula is defined, so we can finally read it:
Intuition Regret is itself an
expected quantity — why the E sits inside
Because which arm we pull and what reward we get are both random, the reward we actually pocket varies run to run. So regret is not a fixed number for a single lucky/unlucky game — it is an average over all possible runs . Two facts make the formula clean:
Linearity of expectation: the average of a sum equals the sum of the averages, i.e. E [ ∑ t r t ] = ∑ t E [ r t ] . That is why we can slide the E inside the sum and write ∑ t = 1 T E [ r t ] term by term.
The genie's total T μ ∗ has no randomness (it always plays a ∗ ), so no E is needed on that side.
Bottom line: Regret ( T ) is an expected regret — the typical amount you'd lose, not a one-off outcome.
Figure s03 — two shapes of regret. The orange curve is a straight ramp: a strategy that never corrects its mistakes keeps paying the same reward gap on every step, so its total regret grows in proportion to T . The teal curve bends flat: a balanced strategy stops adding much regret once it has identified the best arm, so its total grows only like log T . The gap between the two curves is the value of being clever about exploration.
Intuition Why regret shape matters
A strategy that never explores can get stuck on a wrong-but-comfortable arm forever — every step adds the same gap, so regret grows in a straight line: O ( T ) .
A strategy that only explores gathers perfect knowledge but never uses it — also a straight line, O ( T ) .
A clever balance stops adding much regret once it's fairly sure of a ∗ — its curve bends flat , growing like O ( log T ) . "Sublinear" just means "slower than a straight line."
Definition Big-O = "grows roughly like"
Plain words: O ( T ) means "for large T , this grows in proportion to T ." O ( log T ) means "grows in proportion to log T ," which is much slower — doubling the game length adds only a fixed chunk of regret.
Picture: the two curve shapes in Figure s03 — the straight ramp versus the flattening curve.
Why we need it: we compare strategies not by exact regret (which depends on luck) but by how fast their regret grows. Big-O is the language for that.
Definition The small control letters
ϵ ("epsilon") in epsilon-greedy = the probability of ignoring your best guess and choosing randomly. ϵ = 0.1 means "explore 10% of the time."
c in UCB = how boldly you chase uncertainty; a bigger c inflates the exploration bonus.
β ("beta") in curiosity methods = how much weight you give a "novelty" bonus (see Curiosity-Driven Exploration ).
Picture: dials on a control panel; turning them shifts you along the explore↔exploit slider.
Why we need them: they are the amount of gamble , made explicit and adjustable.
π ( a ∣ s ) — a policy
Plain words: π ("pi") is the strategy written as probabilities: π ( a ∣ s ) = "the chance I pick action a when I'm in situation s ." In a plain bandit, since s never changes, this is effectively just π ( a ) .
Picture: a spinner whose slice sizes are how likely each arm is.
Why we need it: every method on the parent page (epsilon-greedy, UCB, Thompson) is ultimately a recipe for building this spinner. It is the shared output. Policies are learned directly in Policy Gradient Methods .
Recall Where the estimate
Q t ( a ) comes from (link to TD learning)
The running average Q t ( a ) can be updated one reward at a time instead of re-summing everything. That incremental update is the seed of Temporal-Difference Learning — same "nudge your estimate toward the new evidence" spirit.
Recall Why too much exploitation resembles overfitting
Locking onto an arm after tiny evidence is like overfitting : you've trusted noise as if it were signal. Exploration plays the role of regularization — it keeps you humble about small samples.
Action a and set A of size K
Reward r and spread p of r given a
Best arm a-star and value mu-star
Count N gives standard error sigma over sqrt N
Exploration vs Exploitation
Expectation E over randomness
Epsilon-greedy UCB Thompson
Read it top-down: naming choices (a out of A ) and rewards lets us estimate arm values; estimates plus true means define regret; counts and the spread σ create uncertainty (standard error σ / N ) and exploration bonuses; regret and bonuses together frame the tradeoff, which the three named strategies then resolve.
Test yourself — cover the right side and answer each before revealing.
What does the subscript in r t mean? The reward that occurred on step t ; subscripts are address labels, not multiplication.
What is the difference between a and the set A ? a is one chosen arm; A is the whole menu of arms it is picked from, and ∣ A ∣ = K counts them.
What is the difference between a and a t ? a names a possible choice; a t is the arm actually chosen on round t (e.g. a 4 = 2 means arm 2 was pulled on round 4).
What is the difference between μ a and μ ^ a (i.e. Q t ( a ) )? μ a is the hidden true average of arm a ; μ ^ a is our estimate built from observed rewards.
What does σ measure? The spread (standard deviation) of an arm's payouts around its mean — the width of its reward cloud.
What happens to Q t ( a ) when N t ( a ) = 0 ? It is undefined (division by zero); we handle it with an initial value Q 0 ( a ) or by pulling each arm once first.
What does ∣ A ∣ mean in this topic? The number of available actions, K — a count of the action set, not absolute value.
Difference between max a μ a and arg max a μ a ? max gives the largest value μ ∗ ; arg max gives which arm a ∗ achieves it.
How does the count N t ( a ) translate into uncertainty? The standard error of the estimate is
σ / N t ( a ) , so the wobble shrinks like
1/ N t ( a ) — a big count means a small wobble.
Is Regret ( T ) a fixed number or an expectation, and why? An expectation — actions and rewards are random, so we average over all runs; linearity of expectation lets us write ∑ t E [ r t ] .
Why is O ( log T ) regret better than O ( T ) ? O ( log T ) grows far slower than a straight line, meaning we stop making mistakes once we've learned the best arm.
What does ϵ control in epsilon-greedy? The probability of exploring (choosing randomly) instead of exploiting the best current estimate.
What is the state s in a plain bandit? There is only one, unchanging state, so s is constant and π ( a ∣ s ) collapses to π ( a ) .
What does π ( a ∣ s ) represent? The policy — the probability of choosing action a in situation s ; the shared output of every strategy.