> For the complete documentation index, see [llms.txt](https://www.mlcompendium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.mlcompendium.com/decision-intelligence/multi-armed-bandits.md).

# Multi Armed Bandits

An A/B test waits until the end to act on what it learned; a multi-armed bandit keeps allocating trials while learning which arm pays off. The page starts with a book, then bandits in recommender systems, then the business case against conventional A/B testing, and ends with Thompson sampling.

The same notes are in [A/B Testing](/decision-intelligence/a-b-testing.md), [Contextual Bandits](/decision-intelligence/contextual-bandits.md), and [Reinforcement Learning](/decision-intelligence/reinforcement-learning.md). The same notes are in [Recommender Systems](/ai-product/recommender-systems.md).

The reference to start from is the [Book — bandit algorithms](https://tor-lattimore.com/downloads/book/book.pdf), the free online edition of Bandit Algorithms; its content is the same as the Cambridge University Press print edition, with minor typos corrected. Where the theory meets product, [Bandits for recommender systems](https://eugeneyan.com/writing/bandits/) is Eugene Yan on industry examples, exploration strategies, warm-starting, off-policy evaluation, and more.

The same notes are in [Recommender Systems](/ai-product/recommender-systems.md).

The business argument for bandits is speed. [Rolling out multi armed bandits for fast adaptive experimentation](https://www.bain.com/insights/rolling-out-multiarmed-bandits-for-fast-adaptive-experimentation/) is about how to outperform conventional A/B testing when scaling up personalized messages and services. The algorithm most of that rests on is [Thompson sampling for multi-armed bandit](https://medium.com/@iqra.bismi/thompson-sampling-a-powerful-algorithm-for-multi-armed-bandit-problems-95c15f63a180), a walkthrough of Thompson Sampling for decision-making under uncertainty; it was originally introduced by William R. Thompson in 1933 and is used in online advertising, clinical trials, and recommendation systems.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.mlcompendium.com/decision-intelligence/multi-armed-bandits.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
