Problem
A team has several ad variants and wants the one with the highest click-through rate. A classic A/B test splits traffic evenly and waits. With a big sample, many users see a losing banner. With a small one, the winner stays unclear. The test is static: it cannot move traffic toward the leader as evidence accumulates.
Example from the article: two banners, red and blue, tested on 5,000 users each. The blue one wins with 18% clicks against 11%, but half of the 10,000 impressions went to the weaker banner.
Solution in brief
Thompson sampling keeps a probability distribution of the click rate for every variant instead of one number. For each new user it draws one random value from each distribution and shows the variant with the largest draw. Uncertain variants are explored, and as evidence grows the best one gets most of the traffic. In the article's simulation of four banners this gave 7.4% more clicks than an even split after 1,000 impressions.
Questions this case answers
- How to allocate traffic among several variants whose success rates are unknown, so that cumulative conversions are maximized while the estimates are still uncertain
- How to avoid sending half of the traffic to a losing banner while an A/B test runs?
- How to decide when a test has enough data to start favoring the leading variant?
- How to route traffic across several ad variants so that clicks are maximized during the test itself?
Tools and methods
- Thompson sampling — chooses the variant for each user by sampling from per-variant distributions
- Beta distribution — models a click rate from the numbers of clicks and misses
- SciPy — computes beta and normal densities
Google or a one-time email code. No password.
