Bandits & Exploration
Q: How do you choose between options while still learning which is best (ads, recommendations, layouts)?
The explore–exploit trade-off: always showing the current best wastes no traffic now but may never discover something better.
- ε-greedy: exploit with probability 1 − ε, explore uniformly otherwise. Simple; explores blindly.
- UCB: pick the arm maximizing
mean + c·√(ln t / n_arm)— optimism under uncertainty; rarely tried arms get a bonus. - Thompson sampling: keep a posterior per arm (Beta(successes + 1, failures + 1) for clicks), sample from each, play the best sample. Strong in practice, handles delayed feedback well.
- Contextual bandits (LinUCB, neural): choose based on user/context features — personalized recommendations and ads.
- Compared with A/B tests: bandits minimize regret during the experiment; A/B tests give cleaner estimates of the effect. Use bandits for many short-lived options (headlines, creatives), A/B for decisions you need to measure rigorously.
- Exploration traffic also produces unbiased logged data for training future models (counterfactual / off-policy evaluation with propensity weights).