Classical A/B testing has an uncomfortable cost that product teams rarely admit out loud: to find out which variation wins, you intentionally send thousands of paying visitors to an inferior experience for weeks. In academic statistics, that is rigorous exploration. In e-commerce during a four-day flash sale, it is burning money.
Optimizely addresses this trade-off through Multi-Armed Bandit (MAB) optimizations and Contextual Bandits (CMAB). Instead of locking traffic into a rigid 50/50 split until a fixed sample size delivers a $p$-value, Optimizely dynamically redirects incoming visitors toward higher-performing variations while the experiment is still live.
At 365Finds, we look at this mechanism not as a statistical novelty, but as a pragmatic business trade-off between learning and earning. Here is how Optimizely actually implements it under the hood, how traffic shifts across variations, and when 365Finds recommends using it—or avoiding it completely.
The Dual-Engine Algorithm: Thompson Sampling and Epsilon-Greedy
A multi-armed bandit algorithm continuously balances two opposing forces: exploration (testing underrepresented variations to see if they might perform better) and exploitation (funneling traffic to the variation that currently looks best).
Optimizely does not use a single monolithic algorithm for every experiment. It bifurcates its algorithmic approach depending on the mathematical nature of your primary metric:
┌────────────────────────┐
│ Primary Metric │
└───────────┬────────────┘
│
┌────────────────────┴────────────────────┐
▼ ▼
Binary Conversion / Click Continuous / Numeric
(e.g., Signup, Purchase) (e.g., Revenue, Order Value)
│ │
▼ ▼
Thompson Sampling Epsilon-Greedy
(Bayesian Beta-Bernoulli) (Heuristic Exploration)
│ │
Samples from Beta(α, β) posteriors Routes (1 - ε) to top mean,
Traffic ∝ Probability of being best splits ε uniformly for testing
│ │
└────────────────────┬────────────────────┘
│
▼
Backend Hourly Reallocation
(Pushed to SDK / Edge Ruleset)
1. Binary Metrics: Thompson Sampling
When your goal is a discrete conversion event—such as a click, a newsletter signup, or an add-to-cart action—Optimizely deploys Thompson Sampling, a Bayesian probability matching algorithm.
- The Math: Optimizely models the conversion probability of each variation using a Beta distribution, $\text{Beta}(\alpha, \beta)$, where $\alpha$ tracks unique conversions and $\beta$ tracks non-converting visitors.
- The Mechanism: Instead of picking a single static percentage, the system repeatedly draws random samples from each variation's posterior distribution. The variation that generates the highest sampled number "wins" that simulation round.
- Traffic Allocation: Traffic allocation percentages are set proportional to the posterior probability that a given variation is the absolute best arm. If Variation B produces stronger early conversion signals, its Beta distribution narrows and shifts to the right, naturally commanding an increasing share of future visitor allocations.
2. Numeric and Continuous Metrics: Epsilon-Greedy
When optimizing for continuous or financial metrics—such as average order value (AOV), revenue per visitor (RPV), or session duration—Thompson Sampling becomes computationally complex and sensitive to extreme outliers. For these metrics, Optimizely switches to an Epsilon-Greedy ($\epsilon$-greedy) procedure.
- Exploration ($\epsilon$): A small, fixed percentage of incoming traffic ($\epsilon$) is split equally among all active variations to continually probe for performance shifts.
- Exploitation ($1 - \epsilon$): The remaining majority of traffic is routed directly to whichever variation currently holds the highest empirical mean.
- If a new trend emerges and a previously trailing variation takes the lead in average revenue, the exploitation share pivots toward it at the next calculation update.
How Optimizely Recalculates and Pushes Traffic in Production
A common misconception is that Optimizely evaluates machine learning weights per millisecond request directly inside your browser or mobile client. It does not.
- Client Event Ingestion: As visitors trigger events, Optimizely's SDKs and event pipelines ingest conversion and impression logs.
- Hourly Model Updates: On the backend, Optimizely updates its bandit calculations on a scheduled cadence—typically every hour. It recalculates the Beta distributions or empirical means based on accumulated events.
- Ruleset Distribution: The resulting traffic allocation weights are pushed into the environment's ruleset configuration (the Datafile in Feature Experimentation or CDN-cached edge configurations).
- Deterministic User Bucketing: When an SDK calls
.decide()on a feature flag or web rule, it buckets visitors using deterministic hashing combined with a User Profile Service. Returning visitors remain pinned to their initially assigned variation to avoid jarring UX shifts, while newly arriving traffic is divided according to the freshly updated bandit weights.
For developers configuring this programmatically, Optimizely Feature Experimentation exposes a REST API endpoint:
PATCH https://api.optimizely.com/flags/v1/projects/{project_id}/flags/{flag_key}/environments/{environment_key}/ruleset
Setting the rule type to "multi_armed_bandit" establishes dynamic allocation without requiring manual traffic tweaks in the dashboard.
Standard MAB vs. Contextual Bandits (CMAB)
Standard multi-armed bandits search for a single, globally superior variation for everyone. But what if mobile users in Tokyo convert best on Variation A, while desktop users in New York prefer Variation B?
Optimizely solves this through Contextual Multi-Armed Bandits (CMAB), powered by its embedded machine learning service.
| Dimension | Standard Multi-Armed Bandit (MAB) | Contextual Multi-Armed Bandit (CMAB) |
|---|---|---|
| Optimization Target | One global winner across all aggregate traffic | 1:1 personalized variation matched to user context |
| Data Inputs | Variation impressions + primary conversions | User attributes (location, device, referral, custom traits) + conversions |
| Attribution Scope | Visitor-level assignment | Decision-level scoping (adapts if user context changes mid-journey) |
| Complexity | Lightweight, fast convergence | Requires attribute collection; recommended limit ~20 variations & 50 attributes |
| Primary Use Case | Promotional banners, short campaigns, headline tests | Dynamic personalization, localized feature rollouts |
In CMAB, Optimizely evaluates incoming visitor attributes at decision time and predicts which variation yields the highest expected value for that specific context profile, while reserving an exploration sliver to keep learning.
Bandit Optimizations vs. Stats Accelerator: Knowing the Difference
Optimizely offers two distinct traffic-shifting tools, and conflating them is a frequent operational mistake.
- Stats Accelerator: Designed for scientific discovery. It shifts traffic using an Upper Confidence Bound (UCB) approach specifically to drive variations toward statistical significance faster, reducing sample size waste while maintaining statistical rigor. Once a variation wins or loses convincingly, it is pulled.
- Multi-Armed Bandit (MAB): Designed purely for economic yield. It abandons traditional statistical significance altogether.
In an Optimizely MAB results dashboard, you will not find $p$-values, confidence intervals, or a baseline control comparison. Instead, Optimizely displays "Improvement over original" or "Improvement over equal allocation"—an estimated calculation of how many incremental conversions were harvested compared to keeping traffic split evenly.
365Finds Commercial Stance: When to Use Bandits and When to Walk Away
At 365Finds, our stance on Optimizely's multi-armed bandits is straightforward: use them when opportunity cost is lethal; reject them when institutional learning is the objective.
Decision Framework
│
┌──────────────────────────────┴──────────────────────────────┐
▼ ▼
Time-Sensitive / Short-Lived? Strategic / Long-Term UX?
(Black Friday, 48-Hour Sale, Headlines) (Checkout Redesign, Pricing Tiers)
│ │
▼ ▼
Multi-Armed Bandit (MAB) Standard A/B Test
• Maximize immediate revenue • Statistically valid p-values
• Cut regret on bad variants • Isolates underlying user intent
• Accepts biased data • Clean post-hoc segmentation
Where 365Finds Recommends Multi-Armed Bandits
- Short-Lived Commercial Events: Black Friday campaigns, Cyber Week promotions, or flash discounts that run for 48 to 72 hours. An A/B test running over a weekend will reach statistical confidence on Tuesday—long after the cash register has closed. MAB maximizes revenue while the sale is live.
- High-Velocity Content and Headline Testing: Media sites and landing page headers where content shelf-life is measured in days. The winning headline captures 80% of traffic before the news cycle moves on.
- Risk Mitigation on Radical Messaging: If you test an aggressive promotional offer against a conservative one, MAB quickly throttles traffic away from the radical variant if it alienates initial visitors.
Where 365Finds Advises Against Bandits
- Delayed Conversions: Thompson Sampling assumes relatively quick feedback loops. If your primary conversion is a B2B demo request or an enterprise checkout that takes 5 to 7 days to finalize, early traffic allocations will be heavily distorted by noisy, incomplete data.
- Foundational Product Decisions: When deciding whether to rebuild navigation or overhaul checkout steps, you need to understand why users drop off. MAB creates mathematically biased data samples, rendering post-hoc demographic filtering and statistical significance invalid.
- Winner's Curse in Volatile Traffic: Because recalculations happen hourly, an unexpected traffic spike from a temporary marketing email can cause a sub-optimal variation to look like an early champion, starving better variations of exploration traffic before equilibrium is reached.
Optimizely’s multi-armed bandit provides an automated lever to stop bleeding conversions during short-window events, provided teams remember that they are purchasing immediate yield at the price of diagnostic truth.