Sequential Probability Ratio Test for a Canary Release Error Rate
Last updated: November 29, 2026
Quick Overview
A Google service canary normally fails 1% of requests; a bad build fails 2%. Design a Wald sequential probability ratio test that decides rollback or continue as requests arrive, with 5% false rollbacks and 80% detection of bad builds, and compare its average sample size with a fixed-size test.
0
0
0 solved
A Google service canary normally fails 1% of requests; a bad build fails 2%. Design a Wald sequential probability ratio test that decides rollback or continue as requests arrive, with 5% false rollbacks and 80% detection of bad builds, and compare its average sample size with a fixed-size test.
Canary analysis at Google is a sequential decision: you want to stop a bad rollout fast without false alarms. Interviewers check that you can derive SPRT boundaries from error targets, implement the log likelihood ratio update, and validate operating characteristics by simulation.
What the Interviewer Expects
- Set up simple null and alternative hypotheses
- Derive Wald's boundaries from alpha and beta
- Write the per-request log likelihood ratio increment
- Validate error rates and expected sample size by simulation
- Compare with a fixed-sample test
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
- What happens when the true error rate is 1.5%, between the hypotheses?
- How would you handle time-varying traffic mix during the canary?
- How would you run this across many canary metrics at once?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
Requests are independent Bernoulli failures with rate . (healthy), (bad). Targets: and $P(\text{continue} \mid H_1) ...
Approach
Track the log likelihood ratio , where a failure adds and a success adds . Wald's boundaries: roll back when $\Lambd...