Fair Fifty Fifty Experiment Split From a Biased Random Bit
Last updated: November 29, 2026
Quick Overview
An experiment assignment service only has access to a random bit that is 1 with some unknown probability p. How can you produce an exactly fair 50/50 treatment assignment, and how many bits does it consume on average?
Meta
November 29, 20260
0
0 solved
An experiment assignment service only has access to a random bit that is 1 with some unknown probability p. How can you produce an exactly fair 50/50 treatment assignment, and how many bits does it consume on average?
Meta runs thousands of concurrent experiments, and assignment must be unbiased even if an entropy source is not. This von Neumann extractor question checks that a candidate can construct a symmetric event from a biased source and compute the expected cost with a geometric argument.
What the Interviewer Expects
- Pair the bits: 10 means treatment, 01 means control, otherwise discard
- Show $P(10) = P(01) = p(1-p)$ so the output is fair
- Compute expected bits $1/(p(1-p))$
- Evaluate for p = 0.7 (about 4.76 bits)
- Mention more efficient extractors and why production uses hashing
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- How could you reuse discarded pairs to waste fewer bits?
- What if consecutive bits are correlated?
- How would you test that the resulting split is fair?
- Why do real systems assign by hashing user IDs instead?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
Bits are iid with , , unknown. We need an output that is exactly 50/50 and independent of , and its expected cost in bits....
Approach
Look for two events with equal probability no matter what is. For a pair of bits, the outcomes 10 and 01 each have probability . So emit treatment on 10, control on 01, and retry on 00 or ...