A multi-armed bandit is a row of slot machines with different, unknown payout rates. Each turn you pull one arm and see its reward. Your goal is to earn as much as possible over many pulls. The name comes from the slot machine’s old nickname, the “one-armed bandit”.
The difficulty is the exploration–exploitation trade-off in its purest form. Pull the arm that has paid best so far and you might be ignoring a better one you under-sampled. Keep sampling others and you give up reward you could have had. Unlike full reinforcement learning, there are no states to move between: every action leads back to the same choice, so the whole problem is about learning which action is best while acting.
Measuring success: regret
Bandit algorithms are judged by regret: how much total reward you lost compared with always pulling the best arm, had you known it from the start. Good algorithms keep regret growing slowly as the number of pulls increases, which means they settle on the best arm without wasting too many pulls on bad ones.
Common strategies
- ε-greedy: exploit the best-looking arm most of the time, explore at random with a small probability.
- Upper confidence bound (UCB): be optimistic about arms you know little about by adding an uncertainty bonus to each arm’s average.
- Thompson sampling: keep a probability distribution over each arm’s payout, sample from it, and pull the arm that looks best in the sample.
Where it shows up
Bandits are a natural fit for online experiments. Compared with a fixed-split A/B test, a bandit shifts traffic toward the winning variant while the test is still running. The same framing is used for ad and content selection in recommender systems, where each item shown is an arm and each click is a reward.