5.3.14 · D1MLOps & Deployment

Foundations — A - B testing for models

3,646 words17 min readBack to topic

This page assumes you have seen none of the notation in the parent note. We will earn every symbol — one at a time, each anchored to a picture — before it is ever used.


1. A single user is a coin flip — the symbol

Picture one user arriving at your site. They either convert (buy, click, sign up) or they don't. That is a yes/no event: exactly like flipping a coin that lands heads or tails.

We write that outcome as — the little is just a name-tag ("user number "). We agree:

In figure s01 you see ten users drawn as bars: amber bars stand at height (converted), cyan bars at height (didn't). The number printed above each bar is that user's . Look at how their average — the box on the right — is simply the count of amber bars divided by ten.

Figure — A - B testing for models

This is the Bernoulli random variable. "Random variable" just means a number whose value we won't know until the event happens. A single yes/no coin flip like is called a Bernoulli trial.


2. Adding the flips up — the count and the sample size

Before we sum anything, we must name how many users we watched.

Once we have independent coin flips, the total number of conversions is their sum:


3. The true rate vs. the measured rate

The coin has a secret bias: some hidden fraction of all possible users would convert. Call that hidden fraction (a number between and ).

You cannot see . What you can do is watch real users and count. That gives you an estimate, and we mark estimates with a little hat: ("p-hat").

The symbol is a summation: the tall "S" (, Greek letter sigma) says "add these up". underneath and on top say "run from to ". So just means — the total conversion count from the previous section.


4. Variance — how much the measurement wobbles

If jumps around every time you re-run, how much does it jump? That "typical amount of wobble" is what variance and its square root, standard error, measure.

In figure s02 the amber curve plots the variance of one coin flip, , against . Follow it: the hill peaks at and touches zero at both ends. The two cyan arrows mark the "rigged coin" corners where a coin always does the same thing and never surprises you.

Figure — A - B testing for models

For one coin flip the variance is — biggest at (a fair coin is the most unpredictable) and at or .


5. The Normal curve and the Central Limit Theorem

A single is a lumpy thing. But here is the magic: average enough independent coin flips and the wobble of the average always takes the same bell shape, no matter how weird one flip was. That is the Central Limit Theorem (CLT).

In figure s03 the cyan curve is the standard bell; the vertical dashed line marks a point on the -axis, and the amber shaded region is everything to its left. That shaded area is exactly the number we define in the next section.


6. Two groups: the symbols , , and their per-group notation

Now the whole point: we run two models side by side and compare them.

The question "is B better?" is a question about the gap . To judge whether that gap is bigger than luck, we need its wobble — its standard error. Since the two groups are separate people, their variances add:

In figure s04 the same amber gap is drawn on two bells. On the narrow (large-) bell it juts far out — many wobbles wide, convincing. On the wide (small-) bell the identical gap is buried in the fuzz — just noise. Same gap, opposite verdict — that is why sample size decides everything.


7. Standardizing — the -score and then

Now the punchline symbol. Suppose the new model's rate beats the old by some gap. Is that gap big? "Big" only means something relative to the wobble. The -score answers exactly that — it re-expresses the gap in units of standard error:

Only now, with defined as the standard Normal variable, does earn its keep:


8. The decision vocabulary: , , , , and the p-value

These are the words the Hypothesis Testing framework wraps around the -score.

A confidence interval then reports the plausible range of the true gap — not just "different: yes/no" but "different by roughly this much." It is built with the unpooled SE from §6, because there we're estimating the actual gap rather than testing "no gap".


How the pieces feed the topic

User outcome X_i = 0 or 1 Bernoulli

Sample rate p-hat = average of X_i

Sum of flips K is Binomial n p

Bernoulli variance p times 1 minus p

Variance of p-hat shrinks with n

Gap p-hat B minus p-hat A

Standard error of the gap

Pooled SE under H0

z score equals signal over noise

Central Limit Theorem

Gap is bell shaped Normal

Null hypothesis H0

p value from Phi

alpha and power beta

MDE delta design target

Sample size n per group

A B test decision

Each foundation flows into the two-proportion -test and the sample-size formula in the parent note. Neighbouring ideas — Shadow Deployment, Canary Releases, Multi-Armed Bandits, Offline vs Online Evaluation, and Model Monitoring & Drift — reuse this same signal-vs-noise machinery.


Equipment checklist

Cover each answer and test yourself before moving to the parent note.

What does physically mean?
User did the good thing (converted / clicked) — a "heads" on their private coin; a single Bernoulli trial.
What does the symbol stand for?
The sample size — the number of users (coin flips) in the experiment, chosen in advance.
What is the difference between a Bernoulli and a Binomial?
Bernoulli is one yes/no flip (); Binomial is the count of heads in independent flips, with mean and variance .
What is the difference between and ?
is the unknowable true conversion rate of the whole population; is our measured fraction from a finite sample, marked with a hat.
Read in words.
Add up all the outcomes from user 1 to user — i.e. the total number of conversions .
Why is the variance of one Bernoulli flip ?
Uncertainty peaks at a 50/50 coin () and vanishes when the coin is rigged ( or ); the product is exactly that hill shape.
Under what assumption does hold?
The users must be independent; if outcomes are correlated (e.g. per-request splitting) the variances don't simply add and this underestimates the wobble.
What conditions must hold before you invoke the CLT here?
Independent flips of equal , and enough data that and ; it breaks near extreme or small where the count is skewed.
What is a continuity correction?
A nudge to the boundary when approximating a discrete count by the smooth Normal area; negligible for large but important for small counts.
What do , , , , , mean?
= users in each arm; = the true (unknown) rates of models A and B; = the measured sample rates of each arm.
What is the SE of the difference , and what do you plug in?
— the two independent group variances added then square-rooted, using the sample rates (the true 's are unknown).
Why and how do we pool under ?
Under both arms share one true rate, so the best estimate uses all data: , giving the -test's SE; the unpooled SE is for the confidence interval instead.
In one sentence, what is a -score?
The observed gap divided by its standard error — how many wobbles wide the difference is (signal over noise), on a bell standardized to centre , width .
What is ?
The area under the standard Normal bell to the left of — the lookup that turns a -score into a probability.
Give the two-sided and one-sided p-value formulas.
Two-sided ; one-sided . Two-sided uses threshold , one-sided at .
State for an A/B test.
The two models have identical true rates, ; the observed gap is pure luck.
What do and power control?
= tolerated false-alarm rate; power = chance of catching a real effect of size .
What is the MDE , and is it measured or chosen?
The smallest true lift you want to be able to detect — a design target chosen up front, not measured; it feeds the sample-size/power calculation.