Thought Toys · Chance & inference · Exhibit 115

Play the best machine, and you never find the best machine.

Four slot machines. You do not know what any of them pays. Every pull you spend finding out is a pull you did not spend winning — and every pull you spend winning is a pull you did not spend finding out. The two obvious ways to settle that are both losing strategies, and they lose in the same shape.

Four players, the same four machines ● back the leader   ● try them at random   ● fixed curiosity   ● shrinking curiosity

pulls played the leader-backer gave up shrinking curiosity gave up times worse

your turn — drag Fixed curiosity anywhere you like and watch that line stay straight. There is no setting on it that bends

What you're seeing

Four players sit at the same four machines. The chart does not plot what they won — it plots what they gave up: for every pull, how much less that machine pays on average than the best one does. That number can only go up, and a perfect player's line would be flat along the bottom. It is the expected shortfall, computed from the machines' true rates, not a realised difference in cash — which is why it is exactly zero when all four machines are identical, however badly you choose. Each line is one run, on one seeded sequence of luck, so that changing a slider changes the setting and not the draws.

The red player always pulls whichever machine currently has the best record. It is the obvious plan and it fails in an obvious way once you see it: a good machine that opens with a run of bad luck can be set aside, and with real probability is never touched again — so the mistake is never discovered. Look at the strip below the chart — the red bars show where that player actually spent its pulls.

The blue player pulls at random forever. It always knows which machine is best and almost never plays it. Its line is the steepest of all.

The cyan player splits the difference: play the leader most of the time, try something random the rest of the time. Now move that slider. Every setting above zero gives a line that bends briefly while it is still working out which machine is best — and then stops bending, and climbs at a fixed rate forever after. A smaller curiosity buys a shallower final slope, never a flattening one. You cannot buy the right answer here, because the mistake is not the amount of exploring; it is that the amount never changes. At zero this player simply is the red one.

The amber player explores too. The difference is that its curiosity is a schedule, not a setting: it adds a bonus to each machine's record that grows with how long that machine has been ignored and shrinks with how often it has been tried. Early on the bonus is large and it tries everything. Later the bonus has shrunk below the differences it has already measured, and it stops. Its line bends toward flat.

That bend is the whole result. The other three lines are straight, so their losses grow in proportion to how long you play — play ten times as long and lose ten times as much. The amber line's slope keeps dropping, so its total grows like the logarithm of the pulls. Push both sliders to the far left, though, and watch the amber line take much longer to bend: when the machines are nearly identical, telling them apart is genuinely expensive, and no algorithm gets round that. Telling two machines apart to a fixed confidence costs on the order of 1/gap² pulls — which is a different quantity from the regret plotted here, whose dependence on the gap is milder. What is being claimed is not that learning is cheap, only that its cost is paid once rather than per pull.

The rule, exactly. Machine k pays 1 with probability pk. Write p* for the best and Δk = p*pk. After T pulls, having played machine k exactly nk times, the regret is R(T) =k nk · Δk The amber player is UCB1 (Auer, Cesa-Bianchi & Fischer, 2002): each pull, play the machine maximising mean so far + √( 2 ln tnk ) whose regret is O(log T) — sublinear, so the loss per pull goes to zero. Verified in node (improve/verify/115-multi-armed-bandit.js, 22 checks):
  • Every policy is judged on its loss per pull over two late windows (25k–50k, then 50k–100k), not on a ratio: growth rates are what is being claimed, and a late window makes the early transient irrelevant instead of hoping it is small.
  • UCB1's loss per pull is still falling between those two windows, and sits under the slope its own O(log T) bound allows. Its total regret is checked against the published bound at two horizons.
  • Negative control. The leader-backer's loss per pull does not fall — it is flat and positive across both late windows, and by 20,000 pulls it has lost ten times what UCB1 lost.
  • Negative control. Pulling at random loses the mean gap per pull forever, matched to the closed form to under half a percent. Exploring more is not the fix.
  • Negative control. A fixed curiosity of 30%, 10% and 2% each settle on a flat loss per pull of exactly (curiosity × mean gap), within 12% — linear, at a rate you can compute in your head. Halving the setting halves the toll; it never removes it.
  • Negative control. Delete the √(2 ln tn) bonus and the same code goes linear, so the bonus is what buys the result rather than some detail of the bookkeeping.
  • Negative control (vacuity). With all four machines identical every player has exactly zero regret, including the leader-backer — pinning that regret measures the gap and not the choosing.
What this leaves out: real problems move. If the machines' payouts drift over time, a curiosity that shrinks to nothing is exactly the wrong thing to have, and the algorithms that handle it deliberately keep a floor under their exploring. The result on this page is about a world that holds still.

Also in Chance & inference: Buffon's needle →

All 26 in Chance & inference
  1. 05The Galton board
  2. 06The Monty Hall problem
  3. 09Bayes' theorem
  4. 104You always land in the long gap.
  5. 110Five serial numbers. Now guess how many they built.
  6. 113In enough dimensions, nothing is near anything
  7. 115Play the best machine and you never find the best machine — you are here
  8. 13Buffon's needle
  9. 14The central limit theorem
  10. 28Simpson's paradox
  11. 30Markov chains
  12. 31Averages that never settle
  13. 35The birthday paradox
  14. 38The drunkard's walk
  15. 39Zipf's law
  16. 40Benford's law
  17. 42The coupon collector's problem
  18. 48The wisdom of crowds
  19. 52Genetic drift
  20. 63The gaps are chaos. The count is law.
  21. 76Every bet here has an edge. Some sizes still go broke.
  22. 86Nobody got worse. The luck just didn't show up twice.
  23. 87Your friends really do have more friends than you.
  24. 96Plan for the average and you'll be wrong every time
  25. 98The numbers agree. The pictures don't.
  26. 99Unrelated in the crowd. A trade-off inside the gate.

Thought Toys · built in public, one exhibit at a time.