Bandit vs. A/B Race
You have three email subject lines and one send. To find out which works best you have to send some people the weaker ones — and every one of those is a sale you probably gave up. This lab lets you watch three different ways of handling that trade-off compete for the same customers, and shows you exactly what each one costs.
OVERVIEW & LEARNING OBJECTIVES
Imagine you run the homepage for an online store. You have two versions of the hero banner and you genuinely do not know which one sells more. So you run a test: half the visitors see version A, half see version B. After a few weeks you look at the numbers and keep the winner.
That is an A/B test, and it is the standard answer. But notice what it costs. If version B really is better, then for the whole length of the test you were sending half of your customers to the worse banner on purpose. You paid for that information in lost sales.
Here is what that looks like in actual money. Say the good banner converts 6% of visitors and the weak one converts 2%. You sent 1,000 people to the weak one, so you got about 20 orders instead of the 60 you would have got from the good one. Those 40 missing orders are called regret — the sales you gave up, compared to what a know-it-all oracle would have earned from exactly the same visitors.
A bandit algorithm tries to be cleverer. Instead of a fixed 50/50 split for a fixed length of time, it checks in as it goes and starts steering more traffic toward whichever option is winning. Less money wasted on the loser. The name comes from slot machines — “one-armed bandits” — where each machine pays out at a different rate and you have to work out which is which while you are still spending real coins.
🎯 What You’ll Learn
- Why testing costs money, not just time. Every visitor sent to a worse option is a sale you probably lost. You will be able to put a number on it.
- The explore / exploit trade-off. Exploring means trying options you are unsure about, which is how you learn. Exploiting means going with whatever looks best right now, which is how you earn. You cannot do both at once.
- Why the highest earner is not automatically the right choice. Bandits usually make more money during the test. They also come out the other side barely able to tell you anything about the options they stopped showing.
- When to use which. A one-week holiday banner and a permanent checkout redesign are not the same kind of decision, and they should not get the same kind of test.
- Why one result proves nothing. Run the identical situation again with different luck and you can get a different winner. You will see this happen.
So which one should I actually use?
- Use a bandit for a short-lived decision you will never revisit — a one-day flash sale, a seasonal banner, an ad creative in rotation. You want the money, you do not need a defensible number afterwards.
- Use an A/B test for a change you have to live with, or one you will have to justify to a boss who asks “better by how much, exactly?” A bandit cannot answer that question well, for reasons you will see below.
- Either is fine when the options are genuinely identical. Nobody loses money. But only the A/B test can actually tell you “we found no difference” — which is itself a useful, reportable finding.
Step 1 PICK A SITUATION
Each of these is a real marketing decision with real money attached. Start with Nordvik Travel if this is your first time — it is the simplest version, just two homepage images and a clear winner. The others get more interesting: one where the options are nearly identical, one where the world changes halfway through, and one where there is genuinely nothing to find.
Step 2 SET UP THE RACE
Because this is a simulation, you get to play god: you set the true conversion rate of each option, and then watch whether the three approaches can figure out what you already know. In a real test you would never have this information — that is the entire reason testing exists. If a preset is loaded, these are already filled in and you can go straight to Step 3.
The options
Set the true conversion rate of each option. In a real test you would not know these — that is the point of testing.
| Option | True conversion rate |
|---|
With this on, the rates above are masked until the race ends, so you face the same uncertainty the algorithms do.
The race
Contestants
Three different answers to the same question: “where should I send the next visitor?” Leave all three ticked so you can compare them.
At 10%, one visitor in ten is sent to a random option regardless of how badly it has been doing. That is the price epsilon-greedy pays to avoid getting stuck on a bad early guess.
Advanced: let the world change mid-test
| Option | Rate after the change |
|---|
A holiday, a novelty wearing off, a competitor's promotion. The oracle moves with the change; the contestants have to notice it themselves.
Step 3 RUN IT
Run one race sends every visitor through, one at a time, and shows you what happened on this particular occasion. Repeat the race does the whole thing over and over with different luck each time, which is the only way to tell a real pattern from a fluke.
More repeats give a steadier answer and take longer. You can stop a run at any point and nothing is lost.
🤔 Try this:
- Load Nordvik Travel and click Run one race. Look at the Scoreboard. Thompson sampling almost certainly earned the most conversions. Case closed?
- Now look further down at What each contestant can tell you at the end. Find the row for the option that lost. Compare how many visitors the A/B test sent there against how many Thompson sent, and look at how much wider Thompson's interval is.
- That width is the catch. Thompson made more money and learned less. If your boss asks “how much worse was the old banner?”, the A/B test can answer and Thompson has to shrug.
START HERE
THE RACE
Cumulative regret
Up is bad. This counts the sales each approach has given up so far, compared with a know-it-all oracle that always picks the best option. Visitors run left to right. A line that keeps climbing is still losing money on every visitor; a line that flattens out has worked out which option is best and stopped wasting traffic on the others. The height at the right-hand edge is the total bill.
📊 How to Read This Chart
- The steep early part is the cost of not knowing yet. Every approach has to pay this.
- The elbow is the moment an approach made up its mind. The A/B test has a sharp one, because it waits for its planned sample and then switches everything at once. The bandits bend gradually.
- A flat line near the bottom is the ideal: it found the winner early and stopped paying for the discovery.
- A line that never flattens means it never settled. That is not always a bug — if the options are genuinely almost identical, there is nothing to settle, and you should expect this.
- Lines crossing means the ranking changed part-way. Whoever is lowest at the far right won this race, which is not the same as being the better method.
Scoreboard
The bottom line for this one race. Conversions is sales made. Regret is sales given up. Traffic to the best option is the share of visitors that got the genuinely best version — higher means less waste. Picked the right one asks whether the approach would hand you the correct recommendation if you stopped the test right now.
One unfair advantage: the A/B test here was sized for the true gap; a real team sizes for the smallest gap worth finding.
| Contestant | Conversions | Regret | Traffic to the best option | Picked the right one? |
|---|
Where the traffic went
One panel per approach, all on the same clock. Each coloured band is one option, and the thickness of a band is the share of visitors being sent there at that moment. This is the explore/exploit trade-off made visible: a thick band means exploiting, several bands of similar thickness means still exploring.
📊 How to Read This Chart
- The A/B test looks like flat stripes of equal width, then a single hard step where one band takes over the whole panel. That step is the end of the planned sample.
- Thompson sampling looks like one band gradually swallowing the others. The speed of that squeeze tells you how obvious the winner was.
- Epsilon-greedy commits fast, but notice the thin stripes that never quite disappear — that is the ε share still being spent on random options right to the last visitor.
- If the world changes mid-test, look for whether any band reacts. Mostly they do not, and that is the lesson of that scenario.
What happens when you run it again and again
One race is an anecdote. Here the exact same situation was replayed many times, changing nothing but the luck. Each bar shows how often a given amount of regret came up. A narrow pile means the approach behaves predictably; a wide one means your single race could have landed almost anywhere. This is the difference between “Thompson won” and “Thompson usually wins”.
| Contestant | Average regret | Worst 5% of races | Picked the right one | Interval width on the runner-up |
|---|
📊 How to Read This Chart
- Average regret is the typical bill. Lower is better.
- Worst 5% of races is the bad-luck scenario — it went at least this badly one time in twenty. A method with a good average and a dreadful worst case is a gamble, and worth knowing about before you bet a quarter's revenue on it.
- Picked the right one is the number that should worry you most. If it says 80%, then one time in five this approach would have confidently handed you the wrong recommendation.
- Compare the spread of the piles, not just which is furthest left. Heavy overlap means that in any single race either could come out ahead.
What each contestant can tell you at the end
This is the half everyone forgets. Earning more during the test is only worth it if you can still answer the question your boss asks afterwards. The 95% interval is the range the true rate of that option plausibly sits in. A narrow interval means “we know this one well”. A very wide one means “we barely showed it to anyone, so we are mostly guessing” — which is exactly what happens to the options a bandit decided early on it did not like.
| Contestant | Option | Visitors sent | Estimated rate | 95% interval |
|---|
📊 How to Read This Chart
- Find the option that lost. Read across to Visitors sent for each approach. The A/B test will have sent it a lot; the bandits will have starved it.
- Now read the 95% interval on that same row. The bandit's is much wider. That width is the price of its extra earnings.
- This is the trade-off in one table. Money now, or knowledge you can defend later. You cannot have both from the same traffic.
WHAT THIS MEANS
Methods & Results
Managerial Interpretation
EXPLORATORY QUESTIONS
Each of these is answerable with the controls on this page. They are in rough order of difficulty, and the last two are the ones worth arguing about.
- How expensive is patience? Run Nordvik Travel. Note the A/B test's regret, then note Thompson's. The difference is what the A/B test paid for a defensible answer. Would you pay it?
- Does more exploring help? Drag ε from 10% up to 40% and re-run. Epsilon-greedy now explores four times as hard. Does its regret go up or down, and does it get better at picking the right option?
- What if there is nothing to find? Load Arcadia Software, where all four pricing pages convert identically. Everyone's regret is zero — so has everyone done equally well? Look at what each one would report.
- Can a bandit be fooled? Load Lumen Skincare, where the three subject lines are only a few tenths of a percentage point apart. Repeat the race 250 times and look at “Picked the right one”. Would you trust any of these to choose your Black Friday subject line?
- What happens when the world moves? Load Kettle & Co., where the winning banner changes in December. Which approach notices? Before you run it, write down your prediction — most people guess wrong.
- Why does exploring not rescue it? In that same scenario, push ε to 30% so epsilon-greedy is constantly sampling everything. It still gets the answer wrong. What is actually broken — is it not looking enough, or is it the way it is averaging what it sees?
DIAGNOSTICS
EXPORT
One row per checkpoint per contestant: visitors so far, conversions, regret and the share of traffic each option had received.