HomeAI & Machine LearningThompson Sampling: Bayesian Multi-Armed Bandit

Thompson Sampling: Bayesian Multi-Armed Bandit

Interactive Thompson Sampling simulator: watch a reinforcement-learning agent maintain a Beta-distribution belief over each slot machine's win rate, sample from those posteriors every round, and converge on the best arm — with live regret and reward tracking.

AI & Machine Learning3DAdvanced60 FPS📱 Mobile-adapted⇄ 2D version
reinforcement-learning-computer-science ↗ Open standalone

Thompson Sampling is one of the oldest and still best-performing algorithms for the exploration/exploitation trade-off at the heart of reinforcement learning. Instead of a fixed exploration rate like ε-greedy or a hand-tuned confidence bound like UCB1, it keeps a full Bayesian posterior — a Beta(α, β) distribution — over each option's unknown win rate, draws one random sample from every posterior each round, and simply pulls whichever arm's sample is highest. This simulator renders those posteriors as live 3D density curves above each slot machine: watch them start flat and uncertain, then narrow and separate as rounds accumulate, while cumulative reward and regret track how quickly the agent locks onto the best arm.

⚙ Under the hood

Watch a reinforcement-learning agent maintain a live Beta-distribution belief over each slot machine's hidden win rate, sample from those posteriors every round, and converge on the best arm — with real-time reward and regret tracking.

reinforcement learningbandit algorithmsbayesian inferenceexploration exploitationmachine learningprobability

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)