Exploration: bandits, UCB, Thompson sampling and exploration bonuses
Read first: Reinforcement Learning: An Introduction, Ch. 5–6 — Monte Carlo, Temporal-Difference Learning and Q-learning
TL;DR. An agent that only does what currently looks best can lock onto a mediocre choice forever, because it never collects the evidence that would change its mind. The multi-armed bandit is the cleanest version of this problem: pick one of options (“arms”) each round, see a random reward, repeat. Its score is regret, the reward lost compared with always playing the best arm. Random exploration (ε-greedy) keeps paying for exploration forever, so its regret grows linearly with time. UCB (“upper confidence bound”) adds a bonus for arms that have been tried rarely; Thompson sampling (TS) samples a plausible mean from each arm’s posterior and plays the winner. Both have regret that grows only like . In deep RL with huge state spaces, the same idea becomes an exploration bonus added to the reward (pseudo-counts, Random Network Distillation). LLM RL, by contrast, mostly explores by sampling from a policy initialised from a strong pretrained model, which is why entropy collapse, pass@k and zero-variance groups matter so much there.
Why it matters now. The open questions in RL for reasoning and search agents (“does RL only sharpen what the base model knows?”) are exploration questions. Knowing what a principled exploration method looks like tells you what GRPO-style training is not doing, and gives you a vocabulary (regret, optimism, posterior sampling, novelty bonuses) for designing something better. It is also the theory behind online learning to rank, which you already know from the IR side.
How to read this page. First pass: read regret (§1), the UCB intuition and index table (§3), the Beta-posterior example (§4), the bonus idea and noisy-TV problem in §6, and the LLM exploration section. Skip at first (especially if you are reading this in the RL reasoning track, as a lead-in to the reasoning-boundary question): the ETC theorem, the Hoeffding/concentration derivation and its adaptive-count caveat, the asymptotic bounds (gap-free and Lai–Robbins), the detailed regret comparison in §5, the IR click-model section, the optional labs, and questions 1–3, which drill those derivations. Second pass: ETC, the concentration derivation, asymptotic bounds, and the IR click-model discussion. In the book, Chapters 4, 6 and 7 back this page; Chapter 5 (concentration inequalities) can be taken on trust, Chapters 8–10 (refined UCB variants) can wait, and Chapter 36’s Bayesian-regret analysis is further reading, not required to understand this page.
Key idea
Section titled “Key idea”1. The problem, measured as regret
Section titled “1. The problem, measured as regret”There are arms. Arm pays a random reward with unknown mean ; the best mean is . Over rounds the learner picks arms and receives rewards . In words, regret is “how much expected reward I gave up by not knowing which arm is best”. The book defines it as (Eq. 4.1)
where is the gap of arm and is how many times arm was played. The second form is the useful one: regret = Σ (gap × how often you played that arm). Every algorithm below is a rule for keeping small for bad arms while still playing each arm enough to tell it is bad.
IR translation. An A/B test that splits traffic 50/50 for a month and then ships the winner is a bandit algorithm (explore-then-commit, below). Its regret is the clicks lost by the users who saw the worse ranker. The book’s introduction mentions finite-armed bandits as a replacement for A/B testing.
2. Two simple strategies: explore-then-commit and ε-greedy
Section titled “2. Two simple strategies: explore-then-commit and ε-greedy”Explore-then-commit (ETC) plays every arm times, then commits to the arm with the best average for the rest of the horizon. For rewards that are “1-subgaussian” (rewards in qualify) and , Theorem 6.1 gives
Here “σ-subgaussian” means centred reward noise obeys for every real : a bound on tail behaviour, not a claim that rewards are Gaussian. You may take the concentration bound on trust.
The first term is the cost of exploring; the second is the cost of committing to the wrong arm, which shrinks exponentially in . For two arms and large , the bound is minimised (up to rounding) by (Eq. 6.5), a large-horizon approximation. The catch: you need to know the gap in advance to set , which you never do.
ε-greedy plays the empirically best arm with probability and a uniformly random arm with probability . With constant , the random rounds keep picking bad arms forever, so (book Exercise 6.7)
which is linear regret. Decaying fixes the rate (Auer et al., Theorem 3), but only if you know a lower bound on the gap. There is also a deeper waste: ε-greedy spends exploration equally on an arm that is almost surely bad and an arm that is merely untested.
3. UCB1: optimism in the face of uncertainty
Section titled “3. UCB1: optimism in the face of uncertainty”Intuition first. Treat every arm as being as good as it plausibly could be given the data. An arm tried rarely has a wide range of plausible means, so its optimistic value is high and it gets tried. Each try narrows the range. A bad arm’s optimistic value usually falls below the good arm’s, so it is played increasingly rarely. It is not permanently eliminated: as time grows, the term can make its index competitive again. A good arm stays optimistic and accurate, so it keeps being played. Exploration switches itself off where it is no longer needed.
Deriving the bonus from Hoeffding. For independent rewards in with mean and sample mean , Hoeffding’s inequality (Auer et al., Fact 1) says the sample mean rarely falls far below the truth:
Choose so that this failure probability is tiny and shrinks with time, say at round . Solving gives . So with probability at least , the true mean is below . That upper confidence bound is the UCB1 index: at round , play
after playing each arm once. The book’s general version (Eq. 7.2) is for -subgaussian noise; rewards in have , and recovers the same formula.
The calculation above fixes . Because depends on earlier rewards, we cannot simply condition on its realised value and reuse an independent-sample guarantee. Auer et al.’s proof handles this by union bounds over counts (proof of Theorem 1).
Worked example. After rounds, :
| Arm | Pulls | Mean | Bonus | Index |
|---|---|---|---|---|
| A | 60 | 0.60 | 0.39 | 0.99 |
| B | 30 | 0.50 | 0.55 | 1.05 |
| C | 10 | 0.40 | 0.96 | 1.36 |
UCB1 plays C, the arm with the worst mean, because 10 pulls cannot rule out that C is the best. As a fixed- sensitivity check (not a possible history: 60 + 30 + 40 pulls do not fit in 100 rounds), holding fixed and giving C 40 pulls at the same mean makes its bonus 0.48 and its index 0.88, the lowest of the three. After 130 total pulls, at decision round 131, the indices would be about 1.00, 1.07 and 0.89.
Where comes from. A bad arm beats the best arm only if its bonus is still large compared with its gap. Ignoring estimation noise, that requires , i.e. . So each bad arm is played about times, contributing to the regret. Auer et al.’s Theorem 1 makes this exact for rewards in and every :
No knowledge of the gaps is needed. For its horizon-dependent UCB algorithm with 1-subgaussian noise and , the book’s Theorem 7.2 gives . This illustrates a gap-free guarantee, which stays meaningful when gaps are tiny, but is not a theorem stated for exactly the time-varying UCB1 index above.
Is the best possible? Yes. Lai and Robbins’ lower bound (book Theorem 16.2), specialised to Bernoulli arms and a policy consistent across Bernoulli instances, says , where is the Bernoulli Kullback–Leibler divergence. For general reward families, Theorem 16.2 instead minimises KL over allowed alternatives whose mean exceeds . Since , UCB1’s is optimal in the rate but loose in the constant.
4. Thompson sampling: explore in proportion to the chance of being best
Section titled “4. Thompson sampling: explore in proportion to the chance of being best”Intuition first. Keep a probability distribution (a posterior) over each arm’s mean. Each round, draw one plausible mean from each arm’s posterior and play the arm whose draw is highest. An arm gets played with exactly the probability that it is the best arm, given the data so far (probability matching). Arms that cannot be best are dropped; uncertain arms that might be best are tried.
Bernoulli arms with Beta posteriors. For 0/1 rewards, a Beta() prior on the success probability stays Beta after each observation (Russo et al., Example 3.1):
so counts successes and counts failures (plus the prior’s 1 each for a uniform Beta(1,1) start). The mean is ; the distribution narrows as grows. Greedy uses the mean; TS samples and plays . Note that TS samples a plausible success probability, not a plausible 0/1 outcome.
Worked example (the tutorial’s Figure 2.2). Arm 1: 600 successes in 1,000 pulls → Beta(601, 401), mean 0.60, standard deviation ≈ 0.015. Arm 2: 400 in 1,000 → Beta(401, 601), mean 0.40. Arm 3: 1 in 3 → Beta(2, 3), mean 0.4, standard deviation 0.2.
- Greedy plays arm 1 forever and never learns about arm 3.
- ε-greedy with ε = 0.1 gives arms 2 and 3 the same 1/30 chance each, wasting half its exploration on arm 2, which is almost certainly worse.
- TS: arm 1’s draw is almost always ≈ 0.6, and arm 2’s almost never beats it, so arm 3 is played when its draw exceeds about 0.6. The Beta(2, 3) density is , whose integral from 0.6 to 1 is . The tutorial reports TS choices of ≈ 0.82, 0 and 0.18 for arms 1, 2, 3.
If arm 3 then succeeds, it becomes Beta(3, 3), mean 0.5, and its chance of beating 0.6 rises to about 0.32. If it fails, it becomes Beta(2, 4), and the chance drops to about 0.09. Exploration follows the evidence.
On Bernoulli bandits, TS attains the Lai–Robbins rate asymptotically (Russo et al., §8.1). Its weaknesses (§8.2): it over-explores when there are many near-identical arms and short-term reward matters, it is not designed for pure “find the best arm” problems such as offline model selection, and it adds nothing when the data already explore by themselves.
5. The regret numbers side by side
Section titled “5. The regret numbers side by side”Two Bernoulli arms with means 0.9 and 0.6 (Auer et al.’s “distribution 1”), , horizon , :
| Method | What the theory says | Regret |
|---|---|---|
| ε-greedy, ε = 0.1 | , linear | ≈ 1,500 |
| ETC with the ideal (needs ) | Eq. 6.6 bound, | ≤ ≈ 117 |
| UCB1 (no knowledge of ) | Theorem 1 bound | ≤ ≈ 308 |
| Lai–Robbins rate, attained by TS asymptotically | , KL ≈ 0.311 | ≈ 11 |
These are bounds and asymptotic rates, not measured regrets; the optional lab below lets you measure them. The lesson is in the shapes: linear versus logarithmic, and “needs the gap” versus “adapts to it”.
6. Deep RL: exploration as a bonus on the reward
Section titled “6. Deep RL: exploration as a bonus on the reward”In an MDP the same optimism becomes a bonus added to the reward. With tabular counts of state–action visits, MBIE-EB (cited by Bellemare et al.) adds , the same width as UCB. With raw Atari frames, almost every state is new, so true counts are 0 or 1 everywhere and say nothing about familiarity. Two fixes:
Pseudo-counts (Bellemare et al., 2016). Train a density model over states. Let be the probability it gives state now and the probability right after training on once more. Asking “what count would make one more observation raise the empirical frequency by this much?” gives (Eq. 2)
Example: , gives : “seen about four times”. The agent’s reward gets a bonus with (Eq. 4), here ≈ 0.025. Because the density model generalises, similar frames share counts.
Random Network Distillation (Burda et al., 2018). Freeze a randomly initialised network . Train a predictor to match it on the states the agent visits. The bonus is the prediction error : high on states unlike anything seen, low on familiar ones. Predicting a random fixed function rather than the next observation matters. A next-state predictor also has high error wherever the world is random (a TV showing static, a coin flip), so the agent gets stuck watching noise: the noisy-TV problem. The deterministic target removes irreducible target randomness from this prediction task, and a sufficiently expressive predictor removes model-class misspecification. Error can still reflect imperfect optimisation as well as unfamiliarity; RND is not a guarantee of task-useful exploration. Two practical details from the paper: the intrinsic reward is divided by a running estimate of the standard deviation of the intrinsic returns, and extrinsic and intrinsic returns get separate value heads.
What the numbers say
Section titled “What the numbers say”- UCB1 and friends in practice (Auer et al., §4). On Bernoulli bandits with 2 and 10 arms over 100,000 plays, a well-tuned decaying ε-greedy was almost always best, but degraded quickly when its parameter was mistuned and suffered when there were several bad arms with very different means. UCB1-TUNED, which replaces the worst-case variance 1/4 by an estimate, did about as well without tuning.
- TS versus greedy (Russo et al., §3). On three arms with means 0.9, 0.8 and 0.7 over 1,000 rounds, greedy sometimes locked onto a bad arm after a lucky start; TS selected the best arm in the final period in an overwhelmingly large fraction of 10,000 simulations.
- Pseudo-counts on Montezuma’s Revenge (Bellemare et al., §6.1 and Appendix C.3). After 50 million frames, the DQN-family agent with the bonus had visited 15 of the 24 rooms of the first level, against 2 without it. Its average score was 2,461 at 50M frames and 3,439 at 100M frames.
- RND (Burda et al., Table 1, final mean scores). Montezuma’s Revenge: RND 8,152, PPO without a bonus 2,497, a forward-dynamics bonus 400, average human 4,753. Venture: RND 1,859, PPO 0. On Pitfall! every method stayed at about zero. The best long run visited all 24 rooms and once finished the first level.
Exploration in LLM RL: why it is mostly implicit
Section titled “Exploration in LLM RL: why it is mostly implicit”Recipes such as GRPO, DeepSeek-R1 and DAPO do not add a UCB or novelty bonus. In bandit language, here is what they do instead. (If you have not met them yet, read the GRPO and DAPO pages before this section; the bandit material above does not need them.)
- The pretrained prior is the exploration policy. For each prompt, the “arms” are possible completions, an astronomically large set. Nobody can try them all, but the base model already puts most of its mass on plausible ones. The pretrained model supplies the initial policy; during RL, each group of completions is sampled from the current rollout policy, not from an unchanged prior.
- Temperature resembles Boltzmann exploration. Sampling from with temperature has the same form as the bandit heuristic “pick each arm with probability proportional to ”, but LLM token logits are not estimated action rewards, and autoregressive token-temperature sampling is not generally a softmax over complete-answer values. Like Boltzmann exploration, it is undirected: it does not know which alternatives are uncertain and which are known to be bad.
- Zero-variance groups expose missing within-group reward contrast. For independent binary-reward samples with success rate , a group of has nonzero reward variance with probability . At , this is about 0.149 (all wrong the rest of the time); at , it is about 0.337 (all right with probability ). All-failure and all-success groups both give zero group-relative reward advantages, but only the former suggests an unsolved task. DAPO’s dynamic sampling discards those sampled groups from the current update and keeps sampling to fill the batch. It does not permanently blacklist their prompts: a later group may contain mixed outcomes, and shared-parameter updates can change their success rates. Dynamic sampling improves the fraction of useful groups, but does not itself supply a directed novelty or uncertainty bonus. Zero advantages remove the reward-surrogate contribution, not necessarily a separate KL or entropy term.
- Entropy collapse is exploration being spent. Rewarding tokens the model already likes sharpens the distribution (see the Entropy Mechanism page). DAPO’s clip-higher raises the upper clip from to so that low-probability tokens with positive advantage can grow. It keeps the sampler diverse; it does not direct it toward what is uncertain.
- pass@k is the exploration meter. pass@1 measures exploitation (“how often”); pass@k at large measures what the policy can still reach. Large-k pass@k measures coverage at a specified sampling budget, not proof that an answer has zero probability. Compare models under matched prompts, decoding settings, token/call budgets and verifier quality, and attach uncertainty to never-solved estimates (for an IR reader: “not sampled” is not “not supported”). The RL reasoning boundary paper finds base models overtake RL models at large , which is what you expect from a learner that exploits a prior without exploring beyond it.
The IR connection: online learning to rank and click models
Section titled “The IR connection: online learning to rank and click models”- Ranking as a bandit (book Ch. 32). Each round, the system shows a ranked list of items out of , observes clicks, and wants to maximise expected clicks. Treating every ranking as an arm is hopeless: there are of them. The fix is a click model that factorises click probability into item attractiveness × examination. The book uses the three you know: document-based ( for shown items), position-based (, with parameters) and cascade (the user scans down and clicks the first attractive item). Cascading bandits run UCB or KL-UCB on attractiveness under the cascade model; the book’s TopRank algorithm needs only weaker ordering assumptions.
- Exploration must account for position bias. Showing an untested document at rank 1 is pulling an uncertain arm: it costs clicks now and buys information. Moving a new document upward changes both exposure and the information gathered; the opportunity cost is foregone utility, while position bias is the observation mechanism. The two are related, not synonyms. UCB’s optimism is a principled answer to “how often should a fresh document get a high slot?”
- Interleaving gives relative feedback. Interleaving two rankers yields “which one won this query”, a preference, not a reward. Bandits with pairwise feedback (dueling bandits) are the online-LTR counterpart; the book does not cover them, but the regret logic is the same.
- Counterfactual LTR needs the logger to have explored. Inverse-propensity scoring can only reweight documents the production ranker sometimes showed; an always-greedy logger leaves zero propensities. This is the off-policy correction on the MC, TD and Q-learning page, and the reason production systems inject a little randomisation.
Caveats
Section titled “Caveats”- Bounds are not measurements. The UCB1 bound above is ≈ 308 for a problem where UCB1 typically scores far less. Compare algorithms by simulation or experiment, and use bounds for rates and shapes.
- Independent arms are a strong assumption. UCB1 and Beta-Bernoulli TS learn nothing about arm B from pulling arm A. Rankers, documents and completions share structure, which is why the book moves to linear and structured bandits, and why deep RL uses density models or networks for its counts.
- Stationarity. All of the above assumes arm means do not change. Click behaviour, live web results and a policy that is itself training all drift.
- Bonuses are rewards, and rewards get hacked. A novelty bonus can be farmed (once RND’s agent has collected the extrinsic rewards it can reliably get, it keeps jumping back and forth over a moving skull in Montezuma’s Revenge, §3.7). In LLM RL, a diversity bonus can be met by paraphrasing.
- LLM-RL statements here are about current recipes. Whether directed exploration helps at LLM scale is an open research question, not a settled result.
Optional: if you want to try it
Section titled “Optional: if you want to try it”Nothing below is required for the reading route. Without running code, predict the regret curves and explain why the five-seed TS result may fall below the asymptotic reference value.
Lab 1 (laptop, CPU, ~5 seconds). Save this as bandit_lab.py and run python3 bandit_lab.py. It compares ε-greedy, UCB1 and Thompson sampling on the 0.9 / 0.6 problem above, reporting pseudo-regret (the sum of gaps of the arms played).
import math, random
def run(policy, means, n, seed): rng = random.Random(seed) k = len(means) pulls, wins = [0] * k, [0] * k regret = 0.0 for t in range(1, n + 1): if policy == "eps": # epsilon-greedy, eps = 0.1 if t <= k: a = t - 1 elif rng.random() < 0.1: a = rng.randrange(k) else: a = max(range(k), key=lambda i: wins[i] / pulls[i]) elif policy == "ucb1": # mean + sqrt(2 ln t / n_i) if t <= k: a = t - 1 else: a = max(range(k), key=lambda i: wins[i] / pulls[i] + math.sqrt(2 * math.log(t) / pulls[i])) else: # Thompson sampling, Beta(1, 1) prior a = max(range(k), key=lambda i: rng.betavariate(1 + wins[i], 1 + pulls[i] - wins[i])) r = 1 if rng.random() < means[a] else 0 pulls[a] += 1; wins[a] += r regret += max(means) - means[a] return regret
means, n = [0.9, 0.6], 100_000for policy in ["eps", "ucb1", "ts"]: regs = [run(policy, means, n, s) for s in range(5)] print(f"{policy:5s} mean pseudo-regret over 5 seeds: {sum(regs) / len(regs):8.1f}")Expect ε-greedy near the predicted 1,500, UCB1 in the tens (well under its bound of 308), and TS lower still (a five-seed TS mean below the ≈ 11 asymptotic reference does not violate an asymptotic lower bound); exact values vary with the seeds. Then try: means 0.55 / 0.45 (Auer et al.’s “hard” case), 10 arms, and printing regret at = 1,000, 10,000 and 100,000 to see linear versus logarithmic growth.
Lab 2 (one GPU, optional). In any GRPO run you already have (for example a small-model math or search-agent run on the site’s agentic-RL stack), log three exploration diagnostics per step: the fraction of zero-variance groups, mean token entropy, and pass@k at a few values of on a fixed held-out set. Then rerun with a larger group size or a higher sampling temperature at the same number of generated tokens and see which diagnostic moves.
You should now be able to…
Section titled “You should now be able to…”- Write regret as Σ gap × pulls and explain why constant ε-greedy is linear.
- Compute UCB1 indices by hand and derive the bonus from Hoeffding.
- Update a Beta posterior and explain why TS explores untested arms but not known-bad ones.
- Explain why deep RL needs pseudo-counts or RND instead of visit counts, and what the noisy-TV problem is.
- Say what GRPO/DAPO-style training does for exploration (sampling, temperature, dynamic sampling, clip-higher) and what it lacks, and use pass@k to check.
- Map online LTR onto bandits: click models as structure, interleaving as relative feedback, IPS as the price of not exploring.
Connections
Section titled “Connections”- Previous: DQN, which explores with annealed ε-greedy, the baseline that count bonuses beat on hard Atari games. Foundations: MC, TD and Q-learning (off-policy learning and importance sampling, which require an exploratory behaviour policy).
- Exploration in LLM RL: The Entropy Mechanism (why sampling-based exploration decays) · DAPO (clip-higher, dynamic sampling) · RL reasoning boundary (pass@k as a coverage test) · Evaluating reasoning RL (pass@k estimator, zero-variance groups).
- Search agents: Search-R1, the baseline setup for the search-agent design question; Evaluating reasoning RL lists the exploration diagnostics (zero-variance groups, distinct queries or documents per group) to log in such a run.
- Further reading: the book’s Ch. 8–10 (asymptotically optimal UCB and KL-UCB) and Ch. 32 (ranking); Russo et al., A Tutorial on Thompson Sampling (arXiv 1707.02038); Auer, Cesa-Bianchi & Fischer, Finite-time Analysis of the Multiarmed Bandit Problem (Machine Learning, 2002); Bellemare et al. (arXiv 1606.01868); Burda et al. (arXiv 1810.12894, code).
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
A Bernoulli bandit has been played t = 100 times. Arm A: 60 pulls, mean 0.6. Arm B: 30 pulls, mean 0.5. Arm C: 10 pulls, mean 0.4. Compute each UCB1 index (mean + √(2 ln t / n)) and say which arm UCB1 pulls. Then derive the bonus from Hoeffding's inequality P(mean ≤ μ − ε) ≤ exp(−2nε²): what failure probability does it correspond to? Holding ln t fixed, recompute C's index with count 40 as an algebraic sensitivity check. Why is that not a possible later history if A and B still have 60 and 30 pulls? Explain why the fixed-count Hoeffding bound needs an additional argument for adaptive counts.
What a strong answer covers
- 2 ln 100 ≈ 9.21. Bonuses: A √(9.21/60) ≈ 0.39, B √(9.21/30) ≈ 0.55, C √(9.21/10) ≈ 0.96. Indices ≈ 0.99, 1.05, 1.36, so UCB1 pulls C, the arm with the lowest mean.
- Setting ε = √(2 ln t / n) in the lower-tail bound gives exp(−2n · 2 ln t / n) = exp(−4 ln t) = t⁻⁴: for a fixed count n, the true mean exceeds mean + bonus with probability at most t⁻⁴, so the index is an upper confidence bound (Auer et al., proof of Theorem 1).
- Equivalently, for [0, 1] rewards (1/2-subgaussian) the book's bonus √(2σ² log(1/δ)/n) becomes √(log(1/δ)/(2n)), and δ = t⁻⁴ recovers √(2 ln t / n).
- With 40 pulls and ln 100 held fixed, C's bonus is √(9.21/40) ≈ 0.48 and its index ≈ 0.88, now the lowest. This is only a sensitivity check: 60 + 30 + 40 = 130 pulls cannot fit in t = 100; at decision round 131 the indices would be about 1.00, 1.07 and 0.89.
- The bonus shrinks like 1/√n, so a bad arm is played increasingly rarely, but the ln t term keeps growing while its count is fixed, so it is revisited occasionally rather than permanently eliminated.
- The count T_i(t − 1) depends on earlier rewards, so the realised count cannot simply be plugged into a fixed-sample bound; Auer et al. union-bound over all possible counts (proof of Theorem 1, Eqs. 6–9).
- Derive / compute
For two Bernoulli arms with means 0.9 and 0.6 (gap Δ = 0.3) and horizon n = 100,000, compute (a) the long-run regret of ε-greedy with constant ε = 0.1, (b) Auer et al.'s UCB1 regret bound 8·Σ ln n/Δ + (1 + π²/3)·ΣΔ, and (c) the Lai–Robbins asymptotic rate Δ·ln n / KL(0.6‖0.9). What does the gap between (b) and (c) say about UCB1's confidence width?
What a strong answer covers
- (a) Constant ε explores uniformly forever: regret ≈ n·(ε/k)·ΣΔ = 100,000 × 0.05 × 0.3 = 1,500, linear in n (book Exercise 6.7).
- (b) ln 100,000 ≈ 11.51, so 8 × 11.51/0.3 ≈ 307 plus (1 + 3.29) × 0.3 ≈ 1.3, about 308; it grows like log n.
- (c) KL(0.6‖0.9) = 0.6 ln(0.6/0.9) + 0.4 ln(0.4/0.1) ≈ 0.311, so Δ·ln n/KL ≈ 0.3 × 11.51 / 0.311 ≈ 11. No policy consistent across Bernoulli instances does better asymptotically; Thompson sampling attains this rate on Bernoulli arms.
- UCB1 bounds the bad arm's pulls by 8 ln n/Δ² ≈ 89 ln n, against the Bernoulli optimum ln n/KL ≈ 3.2 ln n. The ratio is about 27.7, but it compares an upper bound with an asymptotic optimum, not measured regret.
- UCB1 uses a distribution-agnostic Hoeffding radius and a conservative proof. KL-UCB exploits the Bernoulli divergence; UCB1-TUNED uses empirical variances but has no proven regret bound. The whole gap is not due to the variance of the 0.9 arm.
- Derive / compute
Thompson sampling with uniform Beta(1, 1) priors has seen arm 1 succeed 600 times in 1,000 pulls, arm 2 succeed 400 times in 1,000, and arm 3 succeed once in 3 pulls. Write each posterior, explain why the chance of pulling arm 3 is close to P(θ₃ > 0.6), compute that probability by integrating the Beta(2, 3) density 12x(1 − x)², and compare with what ε-greedy (ε = 0.1) does. How does the posterior of arm 3 change after one more success?
What a strong answer covers
- Posteriors: Beta(601, 401) with mean ≈ 0.60 and sd ≈ 0.015; Beta(401, 601) with mean ≈ 0.40; Beta(2, 3) with mean 0.4 and sd 0.2.
- Arm 1's sample is almost always ≈ 0.6 and arm 2's almost never beats it, so TS picks arm 3 roughly when its sample exceeds 0.6. The antiderivative 6x² − 8x³ + 3x⁴ gives 1 − 0.8208 = 0.179, matching the tutorial's ≈ 0.18 for arm 3, ≈ 0.82 for arm 1 and ≈ 0 for arm 2.
- ε-greedy gives arms 2 and 3 the same 1/30 ≈ 0.033 each and plays arm 1 otherwise: it wastes trials on arm 2, which is almost surely worse, and under-explores arm 3.
- A success moves arm 3 to Beta(3, 3) (mean 0.5), raising P(θ₃ > 0.6) to about 0.32; a failure gives Beta(2, 4) (mean 0.33) and about 0.09. Exploration follows the posterior probability of being optimal (probability matching).
- Mechanism
Explain why UCB-style counts do not transfer directly to deep RL from pixels, how Bellemare et al.'s pseudo-count turns a density model into a count, and why Random Network Distillation (RND) predicts a fixed random network rather than the next observation. Use the pseudo-count formula with ρ(x) = 0.01 before and ρ′(x) = 0.0125 after one more observation of x.
What a strong answer covers
- With raw pixels almost every state is new, so tabular visit counts stay at 0 or 1 and a bonus β·N^(−1/2) gives no signal about which states are familiar; the bonus needs a count that generalises across similar states.
- Pseudo-count: N̂ = ρ(1 − ρ′)/(ρ′ − ρ) = 0.01 × 0.9875 / 0.0025 ≈ 3.95, so the density model behaves as if x had been seen about 4 times; the paper's bonus β(N̂ + 0.01)^(−1/2) with β = 0.05 is ≈ 0.025.
- RND's bonus is the error ‖f̂(x) − f(x)‖² of a trained predictor against a frozen random network: it is high where the predictor has seen few similar inputs (epistemic uncertainty) and falls as states are revisited.
- A forward-dynamics predictor also gets high error from irreducible randomness (the noisy-TV problem); a deterministic random target removes that source. In the paper's ablation, a dynamics-based bonus oscillated between two rooms in Montezuma's Revenge because sticky actions made the next room unpredictable.
- Critique
A colleague says GRPO and DAPO do not need directed exploration because the pretrained policy already samples useful solutions. Give the strongest argument for this claim and a counterargument. For independent binary rewards, derive the chance that G = 8 samples have nonzero reward variance at p = 0.02 and p = 0.95. Distinguish dynamic sampling from permanent prompt removal, and design a matched-budget test of whether RL improves coverage rather than only sampling efficiency.
What a strong answer covers
- Pretraining gives an informative starting distribution; rollouts are sampled from the evolving policy, not from an unchanged prior.
- Mixed-group probability is 1 − p⁸ − (1 − p)⁸: approximately 0.149 and 0.337. All-success zero-variance groups are not evidence of failure.
- Dynamic sampling filters this update's groups and resamples; it supplies no uncertainty bonus, but does not permanently exclude prompts or prevent transfer.
- Clip-higher relaxes the positive-advantage upper clipping threshold; it is not posterior uncertainty estimation.
- Compare pass@1 and large-k coverage, zero-variance rates, and newly solved prompts under matched decoding/call budgets and seeds. A finite sample's zero successes is not proof of absent capability.
- Design
You are RL-training a search agent (query, read, answer) on 5,000 questions with GRPO, 8 rollouts per question, and a budget of 10 search calls per rollout. A third of the questions are never solved in the first 50 steps. Design an exploration strategy that uses at least one idea from bandits and one from exploration bonuses, say what can go wrong, and how you would validate it.
What a strong answer covers
- Define the prompt-selection objective before applying a bandit heuristic: maximising a posterior draw of solve probability selects easy prompts, not those with the most learning signal. Instead draw each prompt's solve rate p̃ from a discounted or windowed Beta model, rank by h(p̃) = 1 − p̃⁸ − (1 − p̃)⁸ (the predicted chance of a mixed-reward group), and keep a uniform-exploration floor for unsolved prompts. This is a curriculum heuristic, not a stationary-bandit regret guarantee; mixed rewards are only a proxy for learning progress.
- Rollout-level novelty: a count-based bonus on retrieved document IDs or normalised queries within a group, β·N^(−1/2), so rollouts that reach unseen evidence get credit even when the answer is wrong; decay β so the task reward dominates later.
- Risks: the bonus is a new reward to hack (rephrasing queries to look novel, retrieving irrelevant documents); live-web results that change between calls act like a noisy TV; extra rollouts and calls cost money. A learning-signal curriculum can neglect genuinely hard prompts; solve-rate estimates are nonstationary, so reserve exploration budget and discount old evidence.
- Validation: at matched search calls, compare against plain GRPO on pass@1, pass@k for large k, how many never-solved questions become solved, distinct documents per group, and a judged check that newly solved answers are supported by the retrieved evidence.