Growth Marketing Glossary

Thompson Sampling

thomp·son sam·plingnoun

Earn while you learn. Thompson sampling draws from each option's reward belief and plays the best, balancing exploration and exploitation on its own.

uncertain armssample then play bestthe best arm
Schematic — reward beliefs sampled per round
Term
Thompson sampling
Is
A Bayesian multi-armed-bandit strategy
Method
Sample each arm's reward belief, play the best draw
Balances
Exploration and exploitation

Parts of speech & senses

thompson sampling · noun
  1. Thompson sampling is a Bayesian strategy for the multi-armed bandit problem that maintains a probability distribution over each option's reward, draws a random sample from every distribution, and plays whichever option's sample is highest — automatically balancing exploration and exploitation. "Thompson sampling shifted traffic to the winner on its own."

What Thompson sampling is

Thompson sampling is a decision rule for the multi-armed bandit problem — the challenge of repeatedly choosing among several options whose payoffs are unknown, learning as you go. Named after William R. Thompson, who described it in 1933, it takes a Bayesian view. For each option, or 'arm,' it holds a probability distribution representing its current belief about that arm's reward rate. On every round it draws one random sample from each arm's distribution and plays the arm whose sample came out highest. Then it observes the result — a click, a conversion, a reward — and updates that arm's distribution to reflect the new evidence. Over many rounds the distributions sharpen, the better arms get sampled high more often, and traffic naturally flows to the winners while still occasionally testing the rest.

The elegance is that the exploration is built in, not bolted on. Because each choice comes from a random draw, an arm the algorithm is still unsure about — one with a wide distribution — will sometimes produce a high sample and get played, giving it a chance to prove itself. An arm the algorithm is confident is weak has a narrow, low distribution and rarely wins a draw, so it is quietly starved of traffic. As evidence accumulates, uncertainty shrinks and the sampling concentrates on the genuinely best arm. This is why Thompson sampling is called a probability-matching method. It plays each arm roughly in proportion to the probability that it is the best. Marketers use it to allocate traffic across creatives, offers, or layouts without hand-tuning a schedule.

Thompson sampling versus epsilon-greedy and UCB

Thompson sampling is one of three well-known bandit strategies, and each explores differently. Epsilon-greedy is the bluntest. Most of the time it plays the arm with the best average so far, but with a fixed small probability — epsilon — it picks a random arm to explore. That works, but the exploration is undirected. It wastes pulls on arms already known to be poor just as readily as on promising ones. Upper Confidence Bound (UCB) is smarter. It plays the arm with the highest optimistic estimate, adding a bonus for arms it has tried less, so uncertainty itself drives exploration. Thompson sampling reaches a similar goal by a different route — randomized draws from Bayesian beliefs — and in practice it often matches or beats UCB while being simple to implement and naturally handling delayed or batched feedback.

The practical differences guide the choice. Epsilon-greedy is trivial to code and explains itself in a sentence, but its constant random exploration is inefficient and you must tune epsilon. UCB is deterministic and comes with strong theoretical guarantees, which appeals when you want provable behavior, but it can be sensitive to its tuning constant and to noisy rewards. Thompson sampling is randomized, adapts its exploration automatically as beliefs sharpen, and tends to be robust and sample-efficient in messy real-world settings — the reason many production experimentation systems favor it. Its one demand is a probability model for the rewards, typically a simple Beta distribution for click-or-convert outcomes. When you want hands-off, self-balancing allocation, Thompson sampling is usually the strongest default of the three.

Using Thompson sampling well

Use Thompson sampling when you have many rounds, want to minimize regret — the reward lost by not always playing the best arm — and can update beliefs as results arrive. Pick a reward model that fits your outcome. A Beta distribution pairs naturally with binary conversion data, since it updates cleanly with each success or failure. Let the algorithm run long enough for the distributions to sharpen before you read too much into which arm is 'winning,' and feed it fresh data continuously so it can react to change. For binary metrics like conversion rate, it slots neatly into an experimentation platform and reallocates traffic on its own, steering toward the best creative or offer while still probing the others enough to catch a late bloomer.

The traps are real. Thompson sampling optimizes for reward, not for a clean, fixed-horizon statistical test, so if your goal is a rigorous A/B test with a preplanned sample size and p-value, a bandit is the wrong tool — it deliberately imbalances traffic. Non-stationary environments, where the best arm changes over time, can fool a naive implementation that never forgets old evidence, so use discounting or sliding windows so stale data does not anchor the beliefs. Delayed feedback needs care so the model is not updated on incomplete results. And a poorly chosen reward model gives poorly calibrated beliefs. Respect those limits and Thompson sampling is a powerful, self-tuning way to earn while you learn, converging on the best option with less wasted spend than a fixed split.

Worked example. A retailer tests five homepage banners and does not want to split traffic evenly for weeks while lesser banners drag down conversions. It runs Thompson sampling instead. Each banner starts with a wide belief about its conversion rate. Every visitor triggers a random draw from all five, and the highest draw shows. Early on, traffic spreads while the algorithm learns, but as evidence mounts the two strongest banners win most draws and the weak ones fade. Total conversions beat what an even split would have produced, because losing banners were starved quickly. The lesson is that Thompson sampling samples each option's reward belief and plays the best draw, balancing exploration and exploitation so it earns while it learns instead of paying full price to test. (Illustrative; RGM analysis.)
Failure modes to watch. Using a bandit when you actually need a fixed-horizon A/B test with a preplanned sample and p-value; letting stale evidence anchor beliefs in a non-stationary setting instead of discounting old data; mishandling delayed feedback; and choosing a reward model that fits the outcome poorly.

Synonyms & antonyms

Synonyms

probability matchingBayesian banditposterior sampling

Antonyms

epsilon-greedyfixed A/B split

Origin & history

Thompson sampling is named for William R. Thompson, who proposed the idea in a 1933 paper on choosing between treatments, and it was revived decades later for online machine learning.

Etymology: source.

Usage trends

Search interest for this term over the last five years:

View interest-over-time on Google Trends →

Common questions

What is Thompson sampling?
Thompson sampling is a Bayesian strategy for the multi-armed bandit problem. It keeps a belief distribution over each option's reward, draws a random sample from each, and plays the highest, so it explores uncertain options and exploits strong ones automatically.
How is Thompson sampling different from epsilon-greedy?
Epsilon-greedy explores by picking a random arm a fixed fraction of the time, wasting pulls on known-poor options. Thompson sampling explores through randomized draws from Bayesian beliefs, so it probes uncertain arms more and confident losers less, usually more efficiently.
When should you not use Thompson sampling?
Avoid it when you need a rigorous fixed-horizon A/B test with a preplanned sample size and p-value. A bandit deliberately imbalances traffic to maximize reward, which breaks the clean statistical comparison a controlled experiment depends on.

Resources & people to follow

Curated, non-competitor resources verified per term.

Related training

Disciplines

Areas of marketing where thompson sampling is a core concern:

Sources

  1. trendsGoogle Trends — "thompson sampling"