Up nextNext guide
Speculative Streaming and Multi-Token Prediction
Technical
Technical GUIDE
A multi-armed bandit is a decision problem where you repeatedly choose among options with unknown payoffs and learn as you go, balancing exploring new options against exploiting the best one found.
Listen to this guideAI-narrated · ~2 min
It powers A/B testing, recommendations, and online ad selection.
The name comes from a gambler facing several slot machines (one-armed bandits), each with an unknown win rate, who wants to maximize reward over many pulls. The central tension is the explore-exploit tradeoff: keep pulling the arm that looks best, or sample uncertain arms to learn more. Performance is measured by regret, the cumulative gap between your rewards and always picking the true best arm; good algorithms achieve regret that grows only logarithmically in the number of rounds. Classic strategies include epsilon-greedy (exploit, but explore at random with small probability), Upper Confidence Bound (pick the arm with the highest optimistic estimate), and Thompson sampling (sample from each arm's posterior belief and play the winner). Contextual bandits extend this by using features of the situation to choose.
A news site uses bandits to decide which headline variant to show, quickly shifting traffic to the version earning the most clicks.
An online ad platform allocates impressions across creatives with Thompson sampling to maximize click-through while still testing new ads.
An adaptive clinical trial assigns more patients to treatments showing better outcomes, reducing exposure to inferior arms.
A streaming service tunes recommendation thumbnails per user with contextual bandits that read viewing-history features.
Bandits are spreading into reinforcement learning, where they form the simplest building block, and into large-scale personalization with contextual and neural bandits that read rich features. Active research targets non-stationary rewards that drift over time, bandits with safety or fairness constraints, and combining bandits with deep representation learning. Expect them embedded in adaptive clinical trials, dynamic pricing, and LLM systems that choose prompts or tools online while controlling regret.
Free newsletter
Three verified AI stories every weekday morning, written in plain English. Free forever, no ads.
One email each weekday. Unsubscribe in one click. We never sell or share your address.
Test yourself
Instant feedback on every answer, and a shareable certificate with a verifiable ID once you pass a course.
Support free AI education. AI Understanding is a 501(c)(3) nonprofit — no ads, no paywall, ever. Make a donation
A multi-armed bandit is a decision problem where you repeatedly choose among options with unknown payoffs and learn as you go, balancing exploring new options against exploiting the best one found. It powers A/B testing, recommendations, and online ad selection.
Epsilon-greedy exploits the current best arm most of the time and explores a random arm with small probability epsilon.
Contextual bandits observe side information (features) about each round and use it to pick the best arm for that context.
The UCB bonus is larger for under-sampled arms and shrinks as their count grows.
Logarithmic regret is sublinear in the number of rounds, so average regret per round can decrease over time.
Keep learning
More guides picked for this topic
Up nextNext guide
Speculative Streaming and Multi-Token Prediction
Technical