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.

Google
Statistics & Math
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
Statistics & Math
Hard

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
SPRT
sequential testing
log likelihood ratio
canary analysis
operating characteristics
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. 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 Questions
Sample Answer
Clarify

Requests are independent Bernoulli failures with rate pp. H0:p=0.01H_0: p = 0.01 (healthy), H1:p=0.02H_1: p = 0.02 (bad). Targets: P(rollback∣H0)≤α=0.05P(\text{rollback} \mid H_0) \le \alpha = 0.05 and $P(\text{continue} \mid H_1) ...

Approach

Track the log likelihood ratio Λn=∑iℓi\Lambda_n = \sum_i \ell_i, where a failure adds ln⁡(p1/p0)=0.693\ln(p_1/p_0) = 0.693 and a success adds ln⁡1−p11−p0=−0.0102\ln\frac{1-p_1}{1-p_0} = -0.0102. Wald's boundaries: roll back when $\Lambd...


Submit Your Answer
Markdown supported