8 Multi-Armed Bandit Examples and What They Teach You

Learn how a multi-armed bandit shifts signup-page traffic to the better headline while a test runs, with a worked example, epsilon-greedy and regret.

Published on 13 min read
Table of contents

Most teams that test a signup page run a fixed split. Half the visitors see the control, half see the challenger, and everyone waits until the test ends. That is clean statistics, but it keeps sending traffic to the weaker version for the whole run. Textbook bandit explanations rarely help, because they stop at slot machines and banner ads.

This article asks and answers three questions. What is a concrete multi-armed bandit example? How does a bandit send more traffic to the better option while a test is still running? And what does that look like on a signup page, where the reward is a signup? The short answer: a multi-armed bandit treats each page variation as an option to pull, watches how often each one produces a signup, and gradually routes more visitors to the one that is working, while still reserving some traffic to check the others. Below are eight examples, one fully worked with labeled hypothetical numbers, each read through a signup-page lens.

What Does a Multi-Armed Bandit Example Look Like on a Signup Page?

A multi-armed bandit example on a signup page is a test where several headlines compete, and the share of visitors each one receives changes as signups come in. Early on the split is roughly even. As one headline pulls ahead, it gets more visitors, and the weaker headlines get fewer.

Three terms map the idea onto your page:

  • Arm: each page variation, such as one headline, one block of copy or one call to action.
  • Pull: each visitor assignment, meaning one visitor is shown one variation.
  • Reward: a signup. A visitor who does not sign up produces no reward for that pull.

The difference from a fixed split is the allocation rule. A fixed split holds traffic constant, so each variation keeps its share regardless of results. A bandit shifts traffic as results arrive. Amplitude and Statsig both describe this distinction for online experiments. If you want the full method behind the examples, the blog's multi-armed bandit guide covers it.

Practical rule: a fixed split asks "which version is better?" at the end. A bandit asks "which version should this visitor see?" at every step.

1. The Slot Machine Gambler: The Original Multi-Armed Bandit Problem

What They Did: The problem takes its name from a gambler facing a row of slot machines. A slot machine is called a one-armed bandit because it has one lever and tends to take your money. The gambler can pull any lever on any turn, does not know which machine pays best, and wants the most total winnings. Wikipedia's entry on the multi-armed bandit describes this setup.

How do one-armed bandits work? Each machine has its own hidden payout behavior. You pull, you either win or you do not, and over many pulls you learn what each machine tends to pay. The N-armed bandit problem is the same situation with N machines: with N levers and a limited number of pulls, which do you pull next? The "multi-armed" part is a row of one-armed bandits.

Why It Works: The example isolates the dilemma at the center of every bandit. If you keep pulling the lever that has paid best so far, you may miss a better machine you barely tried. That is exploitation of what you know. If you keep trying every machine, you spend pulls on poor ones. That is exploration. The Stanford text on exploration versus exploitation is built around this trade-off.

Regret is the cost of getting it wrong. It is the winnings you lost by not always pulling the best machine. Suppose you try each of three machines once, one pays, and you commit to it forever. If a different machine was actually better, every later pull costs you regret.

What To Copy: Rename the parts. Machines are headlines, pulls are visitors, winnings are signups. Every bandit decision on your page is a choice between trying something uncertain and using something that already works.

2. Three Headlines on a Signup Page: A Worked Example

What They Did: This example is hypothetical. Every number below is invented for teaching and is not from a real test. A SaaS founder tests three headlines on a signup page:

  • Headline A: a feature-led headline.
  • Headline B: an outcome-led headline.
  • Headline C: a question-style headline.

The bandit reviews results after each batch of 90 visitors and reallocates traffic. The rates below are signups divided by visitors, written as decimals.

  1. Batch 1, even start (30 visitors each): A gets 3 signups, B gets 6, C gets 2. Observed rates: A 0.10, B 0.20, C about 0.07. With no history, an even split is the only fair start.
  2. Batch 2, split 20 / 50 / 20: B leads, so it gets more visitors. A gets 2 signups from 20 visitors, B gets 11 from 50, C gets 1 from 20. Cumulative rates: A 5 in 50 (0.10), B 17 in 80 (about 0.21), C 3 in 50 (0.06).
  3. Batch 3, split 10 / 70 / 10: The gap held, so B gets most of the traffic. A gets 1 signup, B gets 15, C gets 0. Cumulative: A 6 in 60 (0.10), B 32 in 150 (about 0.21), C 3 in 60 (0.05).
  4. Batch 4, split 5 / 80 / 5: B gets nearly everything, while A and C keep a small sample in case the picture changes. A gets 1 signup, B gets 17, C gets 0. Cumulative: A 7 in 65 (about 0.11), B 49 in 230 (about 0.21), C 3 in 65 (about 0.05).

Why does the allocation change? Because the recalculated rate after each batch is the only evidence the bandit has. B's rate stays near 0.21 while the sample grows, so its lead looks real. C's rate keeps sliding, so each visitor sent to C is a visitor probably wasted.

Now the same 360 visitors under a fixed split, 120 per headline. Assume each headline converts at about its observed rate: A about 0.10, B about 0.21, C about 0.05. That gives roughly 12, 25 and 6 signups, 43 in total.

Hypothetical resultFixed splitBandit
Visitors who saw a weaker headline (A or C)240130
Visitors who saw headline B120230
Signups (total)4359

Why It Works: The bandit did not know B was best at the start. It found out while traffic flowed, and it protected visitors from the weaker headlines as the evidence built. The fixed split would give you cleaner, balanced samples. The bandit gives you more signups during the test.

This isn't a trick to skip rigor. It's a different trade: more signups during the test in exchange for less even data on the losers. If you need a precise estimate of how much worse C was, the fixed split gives it to you. The blog's A/B test examples show what that kind of read-out looks like.

What To Copy: Track visitors and signups per variation after every batch, and write down the rate. If you cannot say why a variation's share changed, you are not running a bandit. You are guessing.

3. Epsilon-Greedy on Ad Clicks: Cars vs Sports

What They Did: The cfoh/Multi-Armed-Bandit-Example repository on GitHub is a demonstration with two ads, one for "cars" and one for "sports". Users click "sports" with a 40% chance. The learner uses epsilon-greedy with epsilon set to 0.15, and the tutorial reports a click rate of "around 36%".

The learner first favors "cars". It then explores "sports", sees that the click-through rate is better, and shifts toward it.

Why It Works: Epsilon-greedy is the simplest bandit rule. Most of the time it shows the option with the best average so far. A small fraction of the time, set by epsilon, it picks an option at random. An epsilon of 0.15 reserves 15 of every 100 visitors for exploration. Those random picks are the only reason the learner ever discovers that sports beats cars.

Read the 36% against the 40%. The learner cannot match the best ad's rate, because the exploration share keeps sending some visitors to the weaker ad. Treat the figure as a reference point for how close a simple rule gets to the best arm, never as a target for your page.

What To Copy: Decide your exploration share on purpose. On a signup page, an epsilon of 0.15 means roughly one visitor in seven sees a random headline, even when you already have a leader. Raise it if you doubt the leader. Lower it once the evidence is thick.

4. Three Checkout Designs Weighted 70/20/10

What They Did: Statsig illustrates a checkout page with three designs. Traffic is assigned according to each design's estimated chance of being best: 70%, 20% and 10%. This is an illustrative scenario, not a reported company case study. Statsig describes its Autotune feature as allocating traffic in proportion to a variant's estimated probability of being best.

Why It Works: Weighting by the chance of being best differs from picking the current leader. A leader-only rule would send all traffic to the 70 design and stop learning. The 70/20/10 rule keeps the other designs alive in proportion to how plausible it is that they are the winner. A design that might be best still gets a share, and a design that almost certainly is not gets very little.

What To Copy: On a signup page, think of the weights as confidence, not as rankings. Suppose headline B is probably best but the sample is small. A 70/20/10 split protects the upside without ending the test early. As the sample grows and doubt shrinks, the weights should move toward one headline on their own.

5. A Three-Arm Regret Example

What They Did: The Cambridge handout on bandit algorithms includes a three-arm regret example with a maximal mean reward of 10 × 0.7 = 7. That is the best total you could expect if you always played the best arm.

Why It Works: Regret is the gap between that maximum and what your strategy actually earns. If the best arm is worth 7 in expectation and your strategy earns 5, your regret is 2. Every pull of a worse arm adds to it. Good bandit strategies keep regret growing slowly, which means they find the best arm fast and pull it most of the time.

Translate it to the hypothetical in example 2. If headline B converts at about 0.21, then 360 visitors would produce about 76 signups if every one saw B. The fixed split earned 43, a regret of about 33 signups. The bandit earned 59, a regret of about 17. These numbers are hypothetical, but the arithmetic is the one the handout uses.

What To Copy: Count regret in signups, not in abstractions. For each test, ask how many signups you would have had if every visitor saw the winner. The gap is what the test cost you.

Practical rule: regret is the price of learning, and a good allocation rule keeps that price low.

6. The Mushroom Reward Setup: When a Wrong Choice Costs More

What They Did: The TensorFlow Agents bandit tutorial uses a mushroom example. Eating an edible mushroom gives +5. Eating a poisonous one gives either +5 or −35 with equal probability. The agent must decide which mushrooms to eat.

Why It Works: Rewards can be negative, and the cost of a wrong pull shapes the right strategy. The expected value of a poisonous mushroom is (5 − 35) ÷ 2 = −15, so it looks tempting half the time and ruinous the other half. A cautious agent explores differently when one bad pull can wipe out several good ones.

A signup page is the opposite case. A weak headline does not penalize you. It just fails to earn a signup, so the reward is 0, never negative. That makes aggressive exploration cheaper on a signup page than in the mushroom setup, since the worst outcome of a pull is a missed signup.

What To Copy: Check what a bad pull costs on your page. For a headline or call to action, the cost is one missed signup, so you can explore freely. If a variation could also hurt trust, such as a misleading promise, the cost is higher than the reward score suggests. Keep those out of the test.

7. A Two-Week Website Design Test, and How Long to Let a Bandit Run

What They Did: The Stanford GSB article on experiments inspired by slot machines describes a two-week experiment comparing two website designs and explains how a bandit can adjust resource allocation over time. It is an illustration. The article reports no measured outcome, so treat it as a way of seeing the idea, not as evidence of a result.

Why It Works: In a classic test, you wait the full two weeks, then decide. A bandit adjusts allocation during those two weeks. If one design is ahead after the first few days, it receives more of the remaining visitors. By the end, most of the traffic has already gone to the stronger design.

What do the available sources not establish? They do not say how a bandit handles signups that arrive days after the visit, how it behaves on low traffic, or what happens when the mix of visitors changes during the test. I won't guess at those. They are worth checking in whatever tool you use before you trust its allocation.

What To Copy: Set the review cadence before you start. Decide how often allocation updates and what you will do if the visitor mix shifts, for example when a campaign launches mid-test. The A/B test duration calculator helps you size the run for the fixed-split comparison you may still want as a check.

8. One Headline Per Visitor: From a Bandit to Visit Signals

What They Did: A basic bandit finds one best option for everyone. In example 2, headline B wins for all 360 visitors. But the best headline may differ by visitor. A person arriving from a pricing-comparison search may respond to a different headline than one arriving from a newsletter about your product category.

A contextual bandit adds that missing information. It takes signals about the visit, chooses the arm based on them, and learns which arm works for which kind of visit. The hypothetical version: B's outcome-led headline wins for visitors from one source, while A's feature-led headline wins for visitors from another. A plain bandit would average them and pick one. A contextual bandit picks per visit.

Why It Works: Polish is an AI agent built for founders and website owners who want more signups. Most sites show the same page to every visitor regardless of where they come from. Polish reads visit signals to rewrite headlines, copy and calls to action for each visitor. It continuously tests variations on live traffic and keeps the versions that generate conversions. The signup is the reward, the page elements are the arms, and the visit signals are the context.

What To Copy: Stop asking "which headline wins?" and start asking "which headline wins for which visitor?" The blog's guide to headline testing shows how to build the variations worth testing.

Side-by-Side: What Each Example Shows

Example🎯 What It Shows⚡ Effort To Copy🧩 What It Needs💡 Outcome It Aims At
1. Slot machine gamblerThe core dilemma and regretLowNothing, a mental modelUnderstanding the problem
2. Three headlinesTraffic shifting batch by batchMediumPer-variation visitor and signup countsMore signups during the test
3. Cars vs sports, epsilon-greedyA fixed exploration shareLowA random-pick ruleA rate close to the best arm
4. Checkout designs, 70/20/10Weights follow chance of being bestMediumAn estimate of each arm's oddsProtecting upside while learning
5. Three-arm regretMeasuring the cost of learningLowA best-arm estimateFewer lost signups
6. Mushroom rewardsNegative rewards change strategyLowA view of what a bad pull costsSafer exploration
7. Two-week design testAdjusting allocation over timeMediumA review cadenceLess waiting for a verdict
8. Contextual, per visitorDifferent winners for different visitsHighVisit signalsA matched message per visitor

Turning These Examples Into Action on Your Own Page

Use the examples as a sequence, not a menu. Work through these steps:

  1. Define arms, pulls and reward: list the headline, copy or call-to-action variations, count each visitor as one pull, and count a signup as the reward.
  2. Pick an exploration share: start with something like epsilon 0.15 from example 3 and lower it as evidence grows.
  3. Recalculate after every batch: write down visitors, signups and the observed rate per variation, as in example 2.
  4. Weight by confidence: follow example 4 and keep plausible challengers alive instead of crowning the current leader.
  5. Measure regret in signups: compare the signups you got with the signups you would have had if every visitor saw the best variation.
  6. Exclude costly variations: keep out anything that could hurt trust, as example 6 warns.
  7. Plan the review cadence: decide how you will treat late signups and campaign-driven traffic shifts before you start, since the sources do not settle those cases.
  8. Check for visitor-specific winners: once one overall winner emerges, ask whether it wins for every kind of visit. That is the step toward the contextual setup in example 8.

A bandit is a way of learning while you earn. The slot machine gives the vocabulary, the three-headline example shows the mechanics, epsilon-greedy and the 70/20/10 weighting give two ways to set the split, regret gives the cost, and the mushroom and two-week examples set the limits. The contextual step then asks whether one winner is the right goal at all.

Polish applies this logic to signup pages: it reads visit signals to rewrite headlines, copy and calls to action for each visitor. It tests variations on live traffic and keeps the ones that convert. See how it works at Polish.

  • multi armed bandit example
  • bandit testing

Share this post

Your website rewrites itself until it converts.

Polish writes new versions of your headlines and CTAs, tests them on your real visitors and keeps the ones that win.

Start free