Kippler.

Flight log / Transmission 032

Multi-armed bandits, explained like an arcade cabinet

A row of machines, a pocket of quarters, and no idea which one pays out best. In a 2013 simulation published by Google, a bandit reached a call in 66 days where a classic A/B test needed 223.

By Ronny Cheng Updated 9 min read
warp zone: the 30-second version

> A multi-armed bandit is a testing method that shifts traffic toward better-performing variants while the test is still running. It balances exploring (learning which variant is best) with exploiting (earning from the current leader). It usually wastes fewer conversions than an A/B test, but gives a weaker answer about how much better the winner really is.

The name comes from slot machines, nicknamed one-armed bandits. Picture a wall of them, each with a different hidden payout rate. You can only learn a machine's rate by feeding it quarters. Every quarter spent learning is a quarter not spent on the best machine you've found so far.

Swap machines for landing page variants and quarters for visitors, and you have the oldest tension in testing: learn more, or earn more. Bandits try to do both at once. Here's how, and when they shouldn't be invited.

// 01 · the briefing

What is a multi-armed bandit?

A multi-armed bandit is a class of problems, and the algorithms that solve them, where you repeatedly choose between options with unknown payoffs and learn from each result. It gets the first technical chapter of Sutton and Barto's standard reinforcement learning textbook, because it's learning by trial and error in its simplest form.

In marketing, the "arms" are variants: two headlines, three offers, four ad creatives. The "payout" is a conversion. A bandit decides, visitor by visitor or batch by batch, which variant to show next based on what it has seen so far.

A classic A/B test does the opposite. It splits traffic evenly, holds that split until a planned sample size, and only then reads the result. Patient, rigid, expensive, clean. If you need a refresher on that side, start with landing page testing without lying to yourself.

// 02 · telemetry

What does explore vs. exploit mean?

Every allocation decision is a trade between two goals:

The Russo et al. tutorial on Thompson sampling frames it as balancing "exploiting what is known to maximize immediate performance" against "investing to accumulate new information." Explore too little and you lock onto an early fluke. Explore too much and you keep paying for a variant you already know is worse.

The bill for exploring has a name: regret, the conversions you gave up by not always showing the best option. A classic A/B test accepts a lot of regret in exchange for a clean measurement. A bandit tries to keep regret low while still finding the winner.

kipp>

An A/B test is a lab experiment. A bandit is a lab experiment that also has to hit its quarterly number. Expect it to cut a few corners on the lab report.

// 03 · pre-flight checklist

How does epsilon-greedy work?

Epsilon-greedy is the simplest bandit strategy and a staple of introductory texts. Pick a small number, epsilon, say 10%. Then for each visitor:

  1. 90% of the time, show the variant with the best observed conversion rate so far.
  2. 10% of the time, show a variant chosen at random.

Hypothetical: three headlines, 10,000 visitors. Under epsilon-greedy at 10%, roughly 9,000 visitors see whichever headline is leading, and roughly 1,000 are spread across all three at random so the method can notice if the leader was a fluke.

StrengthWeakness
Easy to explain and to auditExplores blindly: a variant that is clearly losing gets the same random share as one that is nearly tied
Never stops learningNever stops paying: that 10% keeps flowing to known losers unless epsilon shrinks over time
Works with any metric you can countEarly leaders get most of the traffic, so an early fluke can take a while to correct

A common fix decays epsilon over time: explore heavily early, less as evidence builds. Better, but now someone has to pick the decay schedule, and that someone is usually guessing.

// 04 · orbit

What is Thompson sampling?

Thompson sampling is smarter about where it explores. It was first proposed in 1933, and it also goes by posterior sampling and probability matching. The high-level version:

  1. Keep a belief, a probability distribution, for each variant's true conversion rate. Few visitors means a wide belief; many visitors means a narrow one.
  2. For each visitor, draw one plausible rate from each variant's belief.
  3. Show the variant whose draw came out highest.
  4. Update that variant's belief with the result. Repeat.

The result: a variant gets traffic roughly in proportion to the probability that it's the best one. Uncertain variants occasionally draw high and get explored. Variants that are clearly worse almost never win a draw, so they fade out on their own instead of collecting a fixed share forever.

If the word "belief" sounds familiar, it should: this is Bayesian reasoning applied to allocation. The Bayesian vs. frequentist guide covers the underlying idea.

kipp>

Epsilon-greedy explores on a timer. Thompson sampling explores where it's actually unsure. Same goal, much less waste.

// 05 · versus

Multi-armed bandit vs. A/B test: which should you use?

Classic A/B testMulti-armed bandit
Main goalMeasure the difference accuratelyEarn more conversions while choosing
Traffic splitFixed, usually evenShifts toward leaders during the test
Conversions lost to losing variantsMoreFewer
Estimate of the liftClean, with a known error rateNoisier, because losers get little traffic
Handles many variantsEach variant needs a full sampleDrops weak variants as it goes
Sensitive to delayed conversionsLess, if you wait for data to matureMore, since it allocates on what it has seen so far
Best forDecisions you'll build on and need to defendShort-lived choices where earning during the test matters
// 06 · fuel costs

How much faster is a bandit than an A/B test?

Depends on the setup, so treat any single number as an illustration, not a promise. The best-documented public example comes from Steven L. Scott, then a senior economic analyst at Google, writing on the Google Analytics blog in January 2013.

Note what that simulation assumes: conversion rates that never drift and conversions that are recorded right away. Paid B2B traffic rarely gives you either, so expect the real-world gap to be smaller and messier.

// 07 · go / no-go

When is a multi-armed bandit the wrong tool?

Bandits are good at exactly one thing: picking well while you pick. Ask them for anything else and they get shaky.

Where bandits do fit: short-lived decisions like a limited-time offer or seasonal headline, many variants where you want to drop weak ones fast, and cases where every lost conversion during the test is genuinely expensive.

kipp>

If someone asks "how much better was it?" and the honest answer is "unclear, but we earned more while finding out," you ran a bandit. Decide upfront which question you need answered.

What should you decide before running a bandit?

Bandits feel hands-off. That's the trap: all the judgment moves to before launch. Answer these in writing first:

QuestionWhy it matters
Do we need the size of the lift, or just a good pick?If you need the size, run an A/B test instead
How fast does the metric arrive?Allocation should run on a metric that matures within hours or a day, not weeks
What's the minimum run time?At least one full week, so weekday patterns don't drive early allocation
What's the floor for each variant?A minimum traffic share keeps the method from abandoning a variant on a few bad days
What's the guardrail metric?Lead quality or downstream conversion, checked by a person before declaring a winner
What ends the test?A stated threshold, not "when the chart looks settled"

Where this breaks

The math is solid. The plumbing is where it leaks:

kipp> waitlist --join

Something's warming up on the launch pad.

We're building something for people who read posts like this. Early access opens in waves.

Early access, by invitation.

// 08 · comms

FAQ

What is a multi-armed bandit?

A multi-armed bandit is a method for choosing between several options when you learn each option's payoff only by trying it. In marketing tests, it shifts traffic toward better-performing variants while the test is running instead of splitting traffic evenly until the end.

What is the difference between a multi-armed bandit and an A/B test?

An A/B test splits traffic evenly for a fixed period to measure the difference between variants as accurately as possible. A bandit reallocates traffic during the test to earn more conversions along the way, at the cost of a less precise estimate of how much better the winner is.

What is epsilon-greedy?

Epsilon-greedy is a simple bandit strategy. Most of the time, for example 90%, it sends traffic to the current best performer. The remaining share, epsilon, goes to a randomly chosen option so the method keeps learning.

What is Thompson sampling?

Thompson sampling, first proposed in 1933, keeps a probability distribution for each option's conversion rate. For each decision it draws a plausible rate from every distribution and picks the highest draw, so options get traffic in proportion to the chance they are best.

When should you not use a multi-armed bandit?

Avoid bandits when you need an accurate estimate of the lift, when conversions arrive days or weeks after the click, when performance swings by day or season, or when the result will guide a long-lived decision you want to explain and defend.

Ronny Cheng has spent 15+ years in performance marketing and led growth on 9+ startup exits across 75+ companies. He writes the Flight log for people who read search term reports for fun.

Receipts

  1. Google Analytics Blog: Multi-armed bandit experiments (Steven L. Scott, January 2013)
  2. arXiv: A tutorial on Thompson sampling (Russo, Van Roy, Kazerouni, Osband, Wen, 2017)
  3. Sutton and Barto: Reinforcement learning, an introduction (2nd edition, MIT Press, 2018)