Inferensys

Glossary

Bayesian Bandit

A class of multi-armed bandit algorithms that maintain a posterior probability distribution over unknown reward parameters and update it using Bayes' theorem as data is observed.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
PROBABILISTIC SEQUENTIAL DECISION-MAKING

What is a Bayesian Bandit?

A Bayesian bandit is a class of reinforcement learning algorithm that maintains a posterior probability distribution over unknown reward parameters and updates it using Bayes' theorem as data is observed, enabling principled uncertainty quantification during the exploration-exploitation trade-off.

A Bayesian bandit models the unknown reward distribution of each arm as a random variable with a prior belief, typically a Beta distribution for binary rewards or a Gaussian distribution for continuous outcomes. After observing the reward from a chosen action, the algorithm applies Bayes' theorem to compute the posterior distribution, which becomes the new prior for the next decision step. This explicit representation of uncertainty allows the agent to make decisions that optimally balance gathering information against earning immediate reward.

The most prominent implementation is Thompson Sampling, which selects arms stochastically by drawing a sample from each arm's posterior distribution and choosing the arm with the highest sampled value. Unlike deterministic methods such as Upper Confidence Bound, the Bayesian approach naturally injects exploration proportional to uncertainty without requiring manually tuned exploration parameters. Bayesian bandits excel in non-stationary environments where reward distributions drift, as the posterior can be decayed or reset to reflect changing conditions.

PROBABILISTIC DECISION-MAKING

Key Characteristics of Bayesian Bandits

Bayesian Bandits represent a principled approach to the exploration-exploitation trade-off by maintaining a full probability distribution over unknown reward parameters and updating beliefs as data arrives.

01

Posterior Updating via Bayes' Theorem

The core mechanism of a Bayesian Bandit is the continuous updating of a posterior distribution over each arm's reward probability. Starting with a prior belief (e.g., a Beta distribution for binary rewards), the algorithm observes the outcome of a chosen action and applies Bayes' theorem to compute a new, more informed posterior. This posterior encodes both the estimated reward rate and the uncertainty around that estimate, shrinking as more data is collected. This principled uncertainty quantification is what distinguishes Bayesian methods from frequentist approaches like Upper Confidence Bound (UCB).

02

Thompson Sampling: Probability Matching

Thompson Sampling is the most prominent action selection strategy for Bayesian Bandits. At each decision step, the algorithm draws a single random sample from the current posterior distribution of each arm. It then selects the arm with the highest sampled value. This elegant mechanism achieves a natural balance:

  • Exploitation: Arms with high estimated means are sampled more frequently.
  • Exploration: Arms with high uncertainty have wide posteriors, giving them a chance to produce a high sample and be selected. This probability matching approach has been proven to minimize cumulative regret asymptotically.
03

Conjugate Priors for Computational Efficiency

To make posterior updates analytically tractable and computationally fast, Bayesian Bandits heavily leverage conjugate priors. A conjugate prior is a distribution that, when combined with a specific likelihood function via Bayes' theorem, yields a posterior in the same distributional family.

  • Beta-Bernoulli: For binary click/no-click rewards, a Beta prior is conjugate to the Bernoulli likelihood.
  • Normal-Normal: For continuous, normally distributed rewards (e.g., revenue per session), a Normal prior is conjugate.
  • Dirichlet-Multinomial: For categorical outcomes with more than two possibilities. This allows for simple, closed-form parameter updates without expensive Markov Chain Monte Carlo (MCMC) methods.
04

Natural Exploration with Uncertainty Quantification

Unlike Epsilon-Greedy, which explores blindly at random, a Bayesian Bandit directs exploration toward arms where the value of information is highest. An arm with a wide posterior distribution represents a high degree of uncertainty—it could be terrible or excellent. Thompson Sampling naturally prioritizes these ambiguous arms to reduce uncertainty. This targeted exploration is far more sample-efficient, avoiding wasting trials on arms already known with high confidence to be suboptimal. The posterior variance serves as an intrinsic, dynamic exploration bonus that decays as knowledge is gained.

05

Incorporating Prior Domain Knowledge

A significant practical advantage of the Bayesian framework is the ability to warm-start the model with existing knowledge. If a product team has historical data from a previous campaign or expert intuition about a new item's performance, this can be encoded directly into the prior distribution. For example, a Beta(α=20, β=80) prior on a new banner's click-through rate expresses a strong belief that the rate is around 20%, based on similar past creatives. This prevents the bandit from starting with a completely random, high-regret exploration phase and accelerates convergence to an optimal policy.

06

Non-Stationary Adaptation via Forgetting

In dynamic retail environments, consumer preferences drift over time, violating the stationary assumption of standard bandits. Bayesian Bandits can be adapted for non-stationary reward distributions by introducing a forgetting mechanism. Instead of updating posteriors indefinitely, a discount factor is applied to past observations, or the posterior variance is artificially inflated over time. This causes the model to gradually forget old data and increase its uncertainty, triggering a fresh wave of targeted exploration to re-learn the current optimal action in a shifting landscape.

METHODOLOGICAL COMPARISON

Bayesian vs. Frequentist Bandit Algorithms

A technical comparison of Bayesian and frequentist approaches to multi-armed bandit problems, highlighting differences in uncertainty representation, prior incorporation, and exploration mechanisms.

FeatureBayesian BanditFrequentist BanditHybrid Approaches

Uncertainty Representation

Posterior probability distribution over parameters

Point estimates with confidence intervals

Bayesian posteriors with frequentist bounds

Prior Knowledge Incorporation

Exploration Mechanism

Thompson Sampling: probability matching via posterior sampling

Upper Confidence Bound: optimism in the face of uncertainty

Bayesian UCB: posterior quantiles as bounds

Update Rule

Bayes' theorem: P(θ|data) ∝ P(data|θ)P(θ)

Maximum likelihood estimation or method of moments

Variational approximation of posterior

Conjugate Priors Required

Computational Complexity

Moderate: requires sampling or integration

Low: closed-form updates for linear models

High: approximate inference methods

Regret Bound Type

Bayesian regret: expectation over prior

Frequentist regret: worst-case over parameters

Empirical Bayes: data-driven prior selection

Small Sample Performance

Strong: prior regularizes early estimates

Weaker: relies on asymptotic guarantees

Strong: borrows Bayesian regularization

Non-Stationary Adaptation

Discounting or sliding window on posterior

Reset confidence bounds or exponential weighting

Dynamic prior re-estimation

BAYESIAN BANDITS EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about Bayesian Bandit algorithms, their mechanisms, and their application in modern reinforcement learning systems.

A Bayesian Bandit is a class of multi-armed bandit algorithm that maintains a posterior probability distribution over the unknown reward parameters of each action and updates this belief using Bayes' theorem as new data is observed. Unlike frequentist approaches that rely on point estimates, a Bayesian Bandit quantifies uncertainty explicitly. At each decision step, the algorithm samples from the posterior distribution for each arm—typically a Beta distribution for binary rewards or a Gaussian distribution for continuous rewards—and selects the action with the highest sampled value. After observing the actual reward, the prior distribution is updated to a new posterior, which becomes the prior for the next step. This principled probabilistic framework naturally balances exploration and exploitation: arms with high uncertainty have wider posterior distributions, making them more likely to generate a high sample and be selected for exploration. The most famous implementation is Thompson Sampling, which is provably asymptotically optimal and often outperforms deterministic methods like Upper Confidence Bound (UCB) in practice due to its randomized action selection that prevents systematic over-exploitation of suboptimal arms.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.