AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How Optimizely Uses Multi-Armed Bandits to Allocate Traffic During Experimentation

松下祥子 · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

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.

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.


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.

  1. Client Event Ingestion: As visitors trigger events, Optimizely's SDKs and event pipelines ingest conversion and impression logs.
  2. 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.
  3. 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).
  4. 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.

DimensionStandard Multi-Armed Bandit (MAB)Contextual Multi-Armed Bandit (CMAB)
Optimization TargetOne global winner across all aggregate traffic1:1 personalized variation matched to user context
Data InputsVariation impressions + primary conversionsUser attributes (location, device, referral, custom traits) + conversions
Attribution ScopeVisitor-level assignmentDecision-level scoping (adapts if user context changes mid-journey)
ComplexityLightweight, fast convergenceRequires attribute collection; recommended limit ~20 variations & 50 attributes
Primary Use CasePromotional banners, short campaigns, headline testsDynamic 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.

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

  1. 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.
  2. 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.
  3. 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

  1. 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.
  2. 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.
  3. 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.


References