# Autotune (Bandits)

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Multi-Armed Bandits automatically find the best variant among a group of candidates by balancing between "exploring" options and "exploiting" the best option through dynamic traffic allocation. On Statsig, you use Bandits to select the best user experience to drive a target metric or action. Unlike a standard A/B test, where Statsig holds traffic allocation fixed to measure each variant's impact, a bandit shifts traffic toward the winning variant to maximize a target metric.

Statsig's [Autotune](./multi-armed-bandit) (the Multi-Armed Bandit solution) allocates traffic towards high-performing variants and can eventually identify a winning variant.

Statsig's [Autotune AI](./contextual-bandit) (the Contextual Bandit solution) is a personalization tool that serves users the best variant determined by a machine learning model trained on previous observations.

## How Autotune works

Autotune is Statsig's [Bayesian Multi-Armed Bandit](./multi-armed-bandit), and Autotune AI is Statsig's [Contextual Bandit](./contextual-bandit).

Both Autotune products test and measure different variations and their effect on a target metric.

- The multi-armed bandit continuously adjusts traffic toward the best-performing variations until it can select the best variation with confidence. The winning variation then receives 100% of traffic.
- The contextual bandit personalizes which variant a user sees based on provided user or interaction attributes, serving each user the variation predicted to be best for them.

Contextual Bandits are a subset of Multi-Armed Bandits. Both seek to balance the explore/exploit problem: choosing between exploiting the current best known solution and exploring to gather more information about other solutions.

The blog posts on [Multi-Armed Bandits](https://docs.statsig.com/autotune/multi-armed-bandit) and [Contextual Bandits](https://www.statsig.com/blog/statsig-autotune-contextual-bandits-personalization) cover use cases and considerations in depth. The table below summarizes the main considerations for when to use bandits, a ranking engine, or an experiment.

|  | A/B/n Test | Multi-Armed Bandit (Autotune) | Contextual Bandit (Autotune AI) | Ranking Engine |
| --- | --- | --- | --- | --- |
| Typical # Variants | 2-3 | 4-8 | 4-8 | Arbitrary # |
| Personalization Factor | None | None | Moderate | High |
| Input Data Required | None | Very Little (100+ samples) | Little - generally 1000+ samples | Tens of thousands to millions of samples |
| Model Efficacy | None | Basic | Moderate | High |
| Identifies Best Variant | Yes | Yes | No | No |
| Consistent User Assignment | Yes | No | No | No |
