Chapter 13 · Simulation

Multi-Armed Bandit

← Chapter 13
Cumulative reward and best-arm expectation■ reward · ■ regret

    How to play

    Each arm is an action with a hidden probability of paying a reward of 1. Click an arm to pull it; every pull returns 1 or 0. The goal is to find out which arm is best while keeping cumulative regret low. Every new experiment draws new hidden probabilities, so memorizing the previous winner does not help.

    • Reward is the number of successes; Round counts all pulls.
    • Each arm card shows the number of pulls and the observed average (bar). If “True probabilities” is checked, the red line shows the hidden value.
    • Regret = expected reward of always pulling the truly best arm − reward actually obtained.
    • The “Algorithm: 50 rounds” button lets the selected algorithm continue the same experiment, for comparison.

    Contribution to game theory

    Bandit algorithms balance exploration of uncertain options against exploitation of the best known option. This is the basic learning problem behind repeated games, recommender systems and online advertising.

    Modes

    • Benchmark: you choose every arm and compare your reward and regret with the algorithm runs. Check whether you explored enough before deciding.
    • With advice: the arm the selected algorithm would exploit is marked “Recommended”. You can follow or reject the advice; useful for discussing automation bias.
    • Computer learns: the algorithm plays the first 50 rounds; continue in blocks of 50 to watch convergence.

    Levels

    • Level 1: 3 arms: stationary; the best introduction to the exploration–exploitation dilemma.
    • Level 2: 4 arms: stationary; the extra arm spreads out exploration and makes early commitment more costly.
    • Level 3: Changing rewards: four arms; after round 40 the hidden probabilities change. Old observations become misleading; watch whether the learner starts exploring again.

    Algorithms

    • ε-greedy: with probability ε = 0.15 a random arm is pulled, otherwise the arm with the highest observed average. It is simple and never stops exploring, so it can notice a change, but it wastes pulls on clearly weak arms.
    • UCB1: the arm with the highest score is pulled; score = average + √(2 ln t / pulls). Rarely pulled arms get a large bonus, so exploration is directed rather than random. It is strong in stationary environments and slow after abrupt changes, because old evidence stays in the averages.

    Mode × level

    ModeLevel 1Level 2Level 3
    BenchmarkThe basic exploration–exploitation trade-off.Is your attention spread fairly across four options?Noticing the change and dropping old beliefs.
    AdviceA steady recommendation versus intuition.Recommendations shift as evidence spreads out.Does following the old advice delay adaptation?
    ComputerA fast-convergence baseline.Comparing algorithms when more exploration is needed.Recovery after the change; stale data.

    Suggested order

    1. Benchmark + Level 1 + ε-greedy: at least 20 manual pulls.
    2. Repeat with UCB1 and compare how evenly the arms are sampled.
    3. Level 2: see how an extra option raises the cost of exploration.
    4. Advice mode: deliberately reject some recommendations and judge the result.
    5. Computer learns + Level 3: compare the two algorithms after the change at round 40.

    Note on interpretation: a single run is not enough to say that one algorithm is better. Rewards are random; compare several experiments by average reward, regret and speed of adaptation.