advanced25 min studyLesson 851 in Engineering

Randomize the entity whose outcome you intend to compare

Connect stable assignment, repeated requests, analysis units, and the causal question.

On this page

What you’ll understand

  • Choose a randomization unit that matches the intended intervention.
  • Explain when deterministic assignment remains sticky.
  • Distinguish user-weighted outcomes from request-weighted duplication.

A live model experiment begins with a unit, not a percentage. Assigning requests, devices, people, or organizations produces different experiences and different evidence. A request-level switch can expose one person to both models, while an organization-level assignment can preserve a shared workflow but leave far fewer independent assignment units. State which entity receives treatment and which outcome is being averaged. Then make its assignment reproducible so retries, devices, and later sessions do not silently redefine the comparison halfway through the outcome window.

Choose assignment and analysis units together

Suppose the goal is conversion per person over seven days. Randomizing each request independently can mix experiences within one person and produce carryover from earlier requests. Randomizing a stable user identifier better matches that intervention, provided the identifier actually links the relevant activity. Device IDs answer another question when one person uses several devices or several people share one device. Neither identifier is universally correct; the target experience and identity limitations determine the choice.

The analysis must respect dependence induced by assignment. A user with many requests does not become many independent randomized users. Aggregate the declared user outcome or use an estimator and uncertainty calculation that accounts for repeated observations within users. A request-weighted metric can be legitimate when it is the intended estimand, but copying a user-level conversion label onto every request changes the weights and can change the apparent effect without adding new information.

Δ^user=1nT∑i:Zi=1Yi−1nC∑i:Zi=0Yi\widehat\Delta_{\rm user}=\frac{1}{n_T}\sum_{i:Z_i=1}Y_i-\frac{1}{n_C}\sum_{i:Z_i=0}Y_i
Zi is one assignment per stable user, Yi the declared user-level outcome, and both arm counts are positive. The difference has outcome units. Causal interpretation additionally requires the randomized design, consistent measurement, and the relevant no-interference or interference-aware assumptions.↔ Scroll wide equations horizontally.

Deterministic does not mean immutable under configuration changes

A common implementation hashes the experiment identifier, a stable unit identifier, and a versioned salt into a bucket. A fixed allocation rule converts that bucket into an arm. Repeated checks then return the same result as long as the identifiers, salt, and rule remain unchanged. The hash implements reproducibility; approximate uniform independent bucketing across units is a design assumption that should be checked, rather than a property established by printing a few balanced examples.

Changing the threshold, targeting rule, identifier resolution, or salt can change assignments even if the hash function is unchanged. Persistent assignment can retain the first enrolled decision while enrollment rules evolve, but its behavior must be specified and logged. A ramp should record configuration epochs and distinguish newly eligible units from previously assigned units. Reclassifying an existing unit after observing its outcome damages the original randomized comparison and cannot be fixed by relabeling the chart.

Zi=1{Ui<p},NT=∑i=1NZi,E[NT]=NpZ_i=\mathbf1\{U_i<p\},\qquad N_T=\sum_{i=1}^{N}Z_i,\qquad \mathbb E[N_T]=Np
Ui is a reproducible bucket modeled as Uniform[0,1), p∈(0,1) is a fixed treatment probability, and N is a fixed eligible-unit count. Independent buckets give a binomial count; the formula is not a promise of exactly Np assigned units.↔ Scroll wide equations horizontally.

Freeze the identity contract for the experiment

Store the randomization-unit type, identifier version, assignment probability, configuration epoch, and first-assignment timestamp with the experiment record. Test retries and sign-in transitions explicitly. If anonymous and signed-in IDs are joined, define whether an existing assignment wins and how conflicting histories are handled. An identity merge performed after treatment can otherwise turn one person into two counted units or selectively discard an arm’s earlier behavior.

An A/A exercise can expose integration and measurement problems before a substantive model comparison, but a passing A/A run does not prove future experiments correct. Keep assignment diagnostics separate from outcome significance. When treatment changes activity volume, a growing request log is especially easy to misread as a growing independent sample. Preserve the chosen denominator and unit-level lineage so the reported uncertainty still describes the entity that was actually randomized.

More requests do not create more randomized people

Four users are randomized: treatment users A and B have conversion labels 1 and 0 and request counts 4 and 1; control users C and D have labels 1 and 0 and request counts 3 and 2. Compare user conversion with an incorrect request-row average formed by duplicating each user label onto every request.

  1. Each arm contains two users. User-level conversion is (1+0)/2=0.5 in treatment and (1+0)/2=0.5 in control, so the observed user-level difference is zero. The ten requests do not change the four assignment decisions.

  2. Duplicating treatment labels across requests gives four ones and one zero, averaging 4/5=0.8. Control duplication gives three ones and two zeros, averaging 3/5=0.6. This produces an apparent difference of 0.2 by changing weights.

  3. The copied rows still contain only four independent randomized units. They neither establish a 0.2 user-conversion effect nor justify a ten-independent-user standard error. A genuinely request-level outcome would need its own definition and dependence-aware analysis.

The result

The two averages answer different weighting questions. The declared user conversion comparison is 0.5 versus 0.5, not the duplicated-row comparison 0.8 versus 0.6.

Explore the model

Interactive lab

Interactive lab · probability

Assignment count fluctuates around its expectation

Reset, set Success probability p to 0.5 and Trials n to 20. Predict treatment-count mean 10 and variance 5 before Step. Reset, set p to 0.25 and n to 20; predict mean 5 and variance 3.75 before Step. Playback highlights exact binomial outcomes, not fresh randomized users. This independent-count model does not hash IDs or implement sticky assignment.

Assignment count fluctuates around its expectationThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA planned allocation ratio defines probabilities, not an exactly balanced realized count.

Check your understanding

A user-randomized experiment has 100 users and 10,000 repeated requests. Which statement is justified?

Try it yourself

Under independent fixed-probability assignment, N=100 eligible users have treatment probability p=0.4. Find expected treatment count and its binomial variance. Does this require exactly 40 treated users?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Use Np and Np(1−p), distinguishing expectation from a realized count.

Compare with the solution

Expected treatment count is 100×0.4=40 and variance is 100×0.4×0.6=24 users squared. A realized count can differ from 40; exact balancing would require a different allocation design such as constrained randomization. The bucket model’s independence and stable eligible-unit list are assumptions of these calculations.

Take it with you

  • Choose the intervention unit before choosing a traffic percentage.
  • Sticky assignment requires stable identity and configuration behavior.
  • Repeated requests do not increase the independent assignment-unit count.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.