How learning works

Version Compare helps you improve a website by learning which versions lead to your goal. You supply the content and choose what success means. It adjusts new choices as results arrive, so you do not need to manage traffic shares or declare a winner.

This approach is called a multi-armed bandit. It suits ongoing optimisation, but it still needs evidence. A few visits can start the learning process. They cannot establish a reliable difference between similar versions.

Learning as visitors arrive

In a bandit problem, each available choice is an "arm" with an unknown reward. For a website, the arms are versions of a heading, hero section, or other content. The reward is whether an observed version receives credit for a goal.

The challenge is to balance two uses of traffic:

  • Exploration tries versions whose performance is uncertain.
  • Exploitation gives more opportunities to versions that look promising.

Version Compare uses Thompson sampling to make this trade-off. It keeps a range of plausible success rates for each version. For a new choice, it draws one rate from each range and selects the version with the highest draw. The mathematics below explains how those ranges work.

A version with strong results tends to receive more new choices. An uncertain version can still get a high draw and receive a chance to gather evidence. Returning visitors normally keep their saved version while it remains available, rather than switching whenever the counts change.

What counts as evidence

A counted visit is an observation of a selected version. Assigning a version or sending its HTML does not count by itself. Both integrations use browser visibility checks to report a version when it enters the visible page area. This measures an opportunity to see the content, not proof that the visitor read it.

The browser script saves choices in local storage. The proxy uses cookies. Returning to a page does not normally add another counted visit for the same saved choice. Clearing storage, changing browser, or replacing a version can lead to a fresh choice. Counts are therefore neither ordinary page views nor a count of unique people.

A success means that a recorded observation receives credit for an applicable goal. A goal can be a page visit, an interaction, or a server-confirmed completion. Goal scope and item identifiers determine which observations are eligible.

The learning signal is binary: an observed choice has a credited success, or it does not. Reaching another applicable goal does not add a second reward to that choice. If a set has both a newsletter-click goal and a purchase goal, either can make it successful. A purchase does not carry more weight, and purchase value is not part of this model.

One goal can credit observations from several version sets. Adding their successes together does not give a count of distinct purchases or customers. Nor does that credit establish which part of the page caused the outcome.

How this differs from fixed A/B/C testing

A conventional fixed-allocation test keeps a planned split, such as half the visitors for A and half for B. An A/B/C test might use thirds. Random assignment still makes the actual counts vary.

QuestionFixed-allocation comparisonVersion Compare
Where do new choices go?To versions with fixed assignment probabilitiesTo versions selected from the current model
What is the usual aim?Estimate a difference or support a planned decisionImprove the sequence of choices while learning
When does it finish?At a planned stopping point or a valid statistical stopping ruleThere is no automatic finish or winner declaration
What evidence is needed?Enough relevant observations to distinguish the effects of interestThe same need for informative observations remains

Version Compare uses adaptive allocation. Adding three versions does not create a fixed one-third split. With no observations, their selection chances are equal, but results can change those chances from the start.

You can inspect the counts whenever you like. That does not turn the largest observed rate into a proven winner. Adaptive allocation also changes the statistical properties of the data. Do not apply a fixed-sample significance test to these counts and assume its usual guarantees hold. Hadad and colleagues show why inference from adaptive experiments needs suitable methods.

If your main need is a defensible estimate of lift for a specific launch decision, use an experiment and analysis designed for that question. Ongoing allocation and precise effect estimation have different aims. A bandit is not automatically the fastest way to establish a winner.

Regret: the cost of learning

Regret is the gap between the expected goals from your choices and the expected goals from always using the best available version. It compares against an ideal decision-maker who already knows the true success rates.

Suppose A's true rate is 2% and B's is 3%. Showing A to 100 comparable visitors costs one expected goal relative to showing B. The actual outcomes will vary. You cannot identify which visitor would have converted under the other version.

For a stable model, the calculation is:

regret after T choices = sum, over those choices, of (p_best - p_chosen)

Here, p_best is the best true success probability among the available versions. p_chosen is the true probability for the version selected on that occasion. These are unknown probabilities, not the observed percentages in your results.

Exploration has a cost when it selects a worse version. It can also prevent a greater cost: repeatedly using a poor version because a few early results made it look good. Thompson sampling aims to manage this trade-off over many choices.

Agrawal and Goyal prove regret bounds for Thompson sampling under a stable model with independent outcomes for each version. Such results do not promise an uplift on a particular website, or a date when learning will finish. Regret is also not a measured revenue-loss figure in Version Compare.

The mathematics of a new choice

Version Compare models each version with a Beta-Bernoulli distribution. "Bernoulli" means that the outcome is binary. "Beta" names a distribution over possible success probabilities, from zero to one.

For each version, let:

  • n be its counted visits.
  • s be the visits with a credited success.
  • n - s be the visits without a credited success.

Start with a prior

Before any observations, each version starts with Beta(1, 1). This is a uniform distribution over success probabilities. Its mean is 50%, a modelling starting point rather than a measured or site-specific conversion estimate.

The model does not borrow a prior from other sites or version sets. New versions begin with the same prior, even when other versions have substantial history.

Update from the counts

With n visits and s successes, the distribution used for selection is:

p given the counts ~ Beta(s + 1, n - s + 1)
posterior mean = (s + 1) / (n + 2)

The symbol ~ means "follows this distribution". The posterior is the model's updated distribution after incorporating the counts. Its mean is a summary of that distribution, not a traffic share.

For example, eight visits and three successes give Beta(4, 6). The observed rate is 3 / 8 = 37.5%, while the posterior mean is 4 / 10 = 40%. Eight observations still leave substantial uncertainty. The prior affects the calculation most when there is little evidence.

More comparable observations usually concentrate the distribution into a narrower range. A high rate from two observations should not carry the same certainty as a similar rate from thousands.

A visit without a recorded success contributes to n - s for now. A later valid success moves it into s. The calculation has no separate category for outcomes still pending. Allow for the time visitors need to complete a goal when interpreting recent results.

Sample, then select

The Thompson sampling rule draws independently from each available version's distribution:

draw_i ~ Beta(s_i + 1, n_i - s_i + 1)
choose the version with the largest draw_i

It does not always choose the largest observed rate or the largest posterior mean. Under the model, each version's chance of selection equals its posterior probability of being the best among those available.

There is no fixed exploration quota, minimum traffic share, or confidence threshold that permanently removes a version. A version that looks much worse can become very unlikely to receive a new choice. Continuing exploration does not mean every version receives regular or equal traffic.

These are the standard Beta-Bernoulli updates and sampling rule described in Russo and colleagues' tutorial, particularly section 3.

Cached models in the browser

The proxy draws from these distributions when it selects HTML on the server. Browsers use cached banks of 32 to 256 draws per measured version. To give each bank a more even spread, the server takes regularly spaced ranks from 2,048 sorted samples, starting at a random rank. The browser picks one retained sample per version and shows the version with the highest sample.

A version without observations uses a fresh uniform draw, its Beta(1, 1) prior. Adding or removing a version changes which candidates take part. A saved choice stays in place while that version remains available.

Without a usable model, the browser keeps the authored fallback visible and unmeasured. It can select a version once the background refresh provides a model.

This keeps browser selection local. Public model responses contain samples and opaque lookup keys, rather than exact counts, page content, or private credentials. The samples still reveal approximate performance. They are public data, not a way to keep a model confidential.

A finite bank approximates the allocation probabilities of direct Thompson sampling. Visitors also reuse cached evidence until an update arrives. These approximations affect how traffic is allocated, not the recorded visits or successes. The standard regret result does not give an unchanged guarantee for this cached implementation.

How much traffic do you need?

There is no universal visit count at which a comparison becomes trustworthy. The useful quantity is evidence for the particular set and goal, not total website traffic.

Consider a goal with a true success rate of 2%. Five hundred comparable observations produce ten successes on average, with random variation around that number. If a set receives 1,000 fresh observations a month and two versions initially share them evenly, that is about ten expected successes each. This is an illustration, not a minimum sample size or a promise that a month is enough.

The evidence you need depends on:

  • How often the goal occurs. Rare goals need more observations to provide many successes.
  • How different the versions really are. A small improvement is harder to distinguish from chance than a large one.
  • How many versions share the opportunities. More alternatives leave less evidence for each, especially early on.
  • How long outcomes take to arrive. Recent observations may have had less time to succeed.
  • Whether the visitors and conditions remain comparable. A change in audience or season can change the underlying rates.

One version with three successes and another with two has not necessarily demonstrated an advantage. Likewise, a clear traffic preference is an allocation decision from the model, not a separate certificate of statistical significance.

For a formal fixed-allocation comparison, plan around a baseline rate, the smallest improvement that matters, and acceptable error rates. Those choices determine a sample-size calculation. Replacing that design with a bandit does not remove the need for evidence.

Is it suitable for your site?

Small sites

Ongoing allocation can be useful when traffic arrives slowly and you want to avoid managing a test schedule. Start with two meaningfully different versions of one important part of the page. Choose a goal that reflects the outcome you actually want, and give visitors time to reach it.

Expect uncertainty to last when goals are sparse. A bandit cannot manufacture information from a handful of visits. If content changes before enough outcomes arrive, you may never get a clear comparison. Customer conversations and usability work may then be more useful than adding further versions.

A more frequent goal can provide feedback sooner, but it changes what you optimise. More button clicks need not mean more completed purchases.

Large sites

More relevant observations can make differences clearer sooner. Adaptive allocation can then direct more new choices towards promising versions while the comparison continues. It can be useful for content that stays live long enough to benefit from what you learn.

High traffic does not correct a badly chosen goal, missing observations, or changes in the audience. Small improvements can still require substantial evidence. Use a separate, suitable evaluation when you need a precise causal claim or must protect outcomes beyond the configured goal.

For either site size, publish only versions you are comfortable showing to visitors. Exploration can show an inferior version, and the model does not enforce a limit on business harm.

Keep the comparison meaningful

Keep the goal stable while interpreting a set's history. Changing a goal does not recalculate earlier counts. Combining an easy interaction goal with a rarer completion goal makes either outcome sufficient for success.

Within each version set, visitors contribute to the same counts. Version Compare does not estimate separate success rates by device, traffic source, or visitor profile. An overall preference need not be the best choice for every audience.

Each set learns separately. When several parts of a page change at once, their effects may depend on one another. The model does not estimate those interactions. Avoid reading each set's results as an isolated causal effect.

Counts accumulate for each version without a rolling window or an automatic reduction in the weight of older observations. Established versions can therefore respond slowly to changes in visitor behaviour. Changing content changes its version identity, while unchanged versions keep their history. Restoring earlier content can reuse its earlier results. Continuing exploration alone does not guarantee quick adaptation to a new season or campaign.

Reliable measurement comes first. Check that versions can be observed, that goals report the intended outcome, and that attribution reaches the destination. Use a server-confirmed completion when a click or page visit is not enough to establish success. Report it within 30 days of the first recorded observation, even if you capture the completion context later.

Sources and further reading

To get started, add your versions and choose a goal.