Busy Bees
Six flowers, and each one hides a secret: how often it has nectar. You can't see it, you have to visit and find out. Be the bee first: tap a flower!
How close to perfect (100% = always picks the best flower · each dot = 25 visits)
Nectar missed so far (regret: lower is better, flat = stopped making mistakes)
Checkpoints — the Dreamer hive's beliefs saved along the way. Tap one to see what it thought back then.
What just happened?
- No bee could see the nectar. Every hive had to try flowers to learn about them, and every try at a bad flower costs nectar.
- The Random hive never learns, so it stays stuck around 50-60%.
- The Greedy+dice hive mostly sticks with its favourite but keeps wasting a few visits on random flowers forever.
- The Curious hive gives a bonus to flowers it knows little about. The Dreamer imagines how good each flower might be and goes with its best dream. Both quickly stop making mistakes: their "missed nectar" line goes flat.
- When the meadow changed, hives that forget slowly noticed sooner. Remembering everything makes you stubborn!
How it works
Try
Visit a flower. Did it have nectar? Write it down.
Keep score
For each flower: how many visits, how much nectar. Few visits = still unsure.
Choose
Go to the best-looking flower, but give unsure flowers a chance too. That's the try or stick balance.
Repeat
The more you visit, the surer you get, and the less you need to explore.
For grown-ups: what's really going on
This is the multi-armed bandit problem: K arms (flowers) with unknown reward distributions, and the goal is to maximise total reward, i.e. minimise regret R(T) = Σt (μ* − μat), where μ* is the best arm's mean. The charts use expected (not sampled) regret, so lines are smooth. It is reinforcement learning with a single state: the pure exploration–exploitation trade-off.
- Rewards: normal flowers are Bernoulli(p), one drop or none. The jackpot flower pays 4 drops with probability 0.15 (mean 0.6, high variance) so a lucky early jackpot can fool greedy estimates.
- Random: uniform choice; linear regret.
- ε-greedy: with probability ε pick uniformly, otherwise argmax of the sample mean. With fixed ε regret still grows linearly (≈ ε·average gap per step).
- UCB1 (Auer et al. 2002): pick argmax of
x̄i + c·bi·√(2 ln N / ni), untried arms first. Here c = 0.5 and bi is the arm's payout size (range scaling). Logarithmic regret. - Thompson sampling: Beta(1,1) priors, posterior Beta(1+successes, 1+failures). Each step draw θi ~ Beta and pick argmax θi·bi. Payouts in [0, b] use the Bernoulli trick (Agrawal & Goyal): a reward r counts as a success of weight r/b. The curves in "What's happening inside" are these posteriors.
- Time of day makes the problem non-stationary: every 300 visits the arm means are swapped so a different flower is best. "Forget slowly" applies a discount γ = 0.99 to all counts each step (discounted UCB, Garivier & Moulines; discounted Thompson sampling), an effective memory of ≈ 1/(1−γ) = 100 visits. A sliding window of the last W visits works similarly.
- New flower: a new arm with μ = 0.88. UCB tries it immediately (n = 0 gives an infinite bonus), Thompson's flat prior makes it likely to be sampled high, ε-greedy only finds it by its random ε steps.
- Lai & Robbins showed no strategy can beat order log T regret on stationary bandits; UCB1 and Thompson sampling both achieve it. Bandits run real A/B tests, ad selection and clinical-trial designs.