The interview problem

Practice prompt

Model A correctly classifies 900 of 1,000 test examples; model B correctly classifies 920 on the same examples. Is B better? Explain what a confidence interval tells you, calculate an interval for the improvement, and adapt the evaluation when examples come from repeated users.

Original ML fundamentals practice, not a reported company interview. Technical sources retrieved September 26, 2026. All counts below are hypothetical.

1. Define the population and the claim

Assume two fixed models, a test set held out from model selection, accurate reference labels and independent examples sampled from the intended deployment population. Start with accuracy because the prompt specifies binary correctness; in an imbalanced task, accuracy may be the wrong business metric. The estimand is the difference in expected correctness on that population, not a guarantee about every customer.

A 95% confidence procedure covers the fixed population parameter in about 95% of repeated samples under its assumptions. After observing one interval, ordinary frequentist inference does not assign a 95% probability to that fixed parameter lying inside it. Neither interpretation says that 95% of individual predictions are correct.

Ask whether a two-percentage-point gain matters operationally. A decision might require an improvement above one percentage point, with no unacceptable regression on a critical slice. Choose that criterion before inspecting results. Spend 5 minutes on the target population, 10 on the calculation, 10 on dependence and 5 on the deployment decision.

2. Estimate uncertainty for one model

For A, estimated accuracy is 900 / 1,000 = 0.90. Under an independent Bernoulli approximation, the estimated standard error is √(0.9 × 0.1 / 1,000) ≈ 0.00949. A simple normal interval gives 0.90 ± 1.96 × 0.00949, or approximately 88.14%–91.86%.

This symmetric interval behaves poorly with small samples or accuracies near zero or one. A Wilson score interval is a useful alternative for a binomial proportion; for these counts it is approximately 87.98%–91.71%. With zero observed errors, a naive standard error of zero certainly does not establish perfect population accuracy. Select an interval method that handles the sample size and boundary rather than clipping an invalid bound after the fact.

Even a well-calculated interval does not repair a biased test set. A large English-only sample can tightly estimate English performance while saying little about another language. State the population alongside the number.

3. Compare the models as a paired experiment

The models saw the same examples, so their correctness outcomes are related. Ask for the disagreement counts. Suppose both are correct on 880 examples, only A is correct on 20, only B on 40, and neither on 60. These counts sum to 1,000 and recover A's 900 and B's 920 correct answers.

For each example define d = correctness(B) − correctness(A). Then 40 differences are +1, 20 are −1 and 940 are zero. The mean difference is (40 − 20) / 1,000 = 0.02. The sample variance of d is (60 − 1,000 × 0.02²) / 999 ≈ 0.05966. The standard error of the mean difference is √(0.05966 / 1,000) ≈ 0.00772.

An illustrative large-sample 95% interval is 0.02 ± 1.96 × 0.00772, approximately 0.49–3.51 percentage points. Under these assumptions it excludes zero, but it does not establish that the gain exceeds the proposed one-point practical threshold. The lower bound is below that threshold.

Do not decide significance by checking whether two separate accuracy intervals overlap. Estimate the difference directly. Adding the two variances as if the models were evaluated independently discards covariance, and identical headline accuracies can produce different uncertainty depending on the disagreement pattern. For a hypothesis test of equal paired binary accuracy, a paired method such as McNemar's test addresses the discordant outcomes; a test alone still does not provide the effect-size interval needed for a practical decision.

4. Preserve dependence when resampling

A paired bootstrap samples example indices with replacement and applies each sampled index to both models. Recalculate the accuracy difference for every resample, then use a stated bootstrap interval method. Resampling A and B independently destroys the pairing. For ratios or nonlinear metrics such as F1, recompute the complete metric from the resampled predictions rather than averaging per-example F1 values.

If the 1,000 rows come from 100 users, repeated observations within a user may be correlated. Resample users and retain their associated observations together, preserving model pairing inside each selected user. Decide whether the metric weights users equally or weights observations equally: those are different estimands. A cluster bootstrap should reproduce the sampling unit and weighting scheme of the claim.

Time dependence needs additional care. Randomly shuffling tomorrow's correlated events does not recreate independent deployment periods. Use a suitable time-based evaluation and, when justified, block resampling that preserves relevant dependence. A bootstrap cannot create independent information absent from the data; very few clusters or severe distribution shift make nominal coverage unreliable.

5. Explain what the interval leaves out

This calculation conditions on the two trained models. It estimates test-sampling uncertainty, not variation across training datasets, random seeds or hyperparameter searches. If the claim concerns a training procedure, repeat training under a justified protocol and distinguish training variability from evaluation variability. Do not treat multiple seeds evaluated on one shared test set as independent test populations.

Selecting B from hundreds of candidates using this same test set makes the simple interval overconfident about the selection process. Keep selection and final evaluation separate, or use a procedure designed for selection and multiple comparisons. Repeatedly checking results and stopping when the interval excludes zero also changes error rates; use a predefined sample size or a valid sequential procedure.

Label mistakes, missing outcomes and production drift introduce other uncertainty or bias. Report exclusions and slice coverage. A narrow interval around the wrong metric is not evidence of product improvement. An offline gain may still lose online because latency, user behavior or the cost of errors differs.

6. Turn uncertainty into a decision

Report the estimated gain, interval, sample and cluster counts, test period, interval method and assumptions. For this example, say “B improves observed accuracy by two percentage points; the paired normal approximation gives about 0.49–3.51 points.” Avoid claiming the true improvement is exactly two points.

Under a stable independent sampling design, standard errors typically scale roughly as 1 / √n, so halving interval width requires about four times as many independent examples. Four times as many duplicated rows does not achieve that. Sample-size planning should use the desired effect, power and paired outcome variability rather than simply collecting until a result looks favorable.

If the practical threshold remains unresolved, collect additional independent evidence under a prespecified plan or run a controlled rollout with quality and latency guardrails. Cost and risk determine whether uncertainty warrants waiting. Confidence intervals support a decision; they do not supply its utility function.

7. Follow-ups and self-review

Foundation: explain why 920 versus 900 is insufficient without a sampling model. Senior: recalculate uncertainty if the disagreement counts change while both accuracies stay fixed. Staff: design an evaluation with repeated users, several model candidates and a delayed production outcome.

Score 0–2 each for defining the estimand, correct interval interpretation, paired arithmetic, dependence-aware evaluation and a decision tied to practical importance. Full credit requires naming the assumptions that would invalidate the result. Continue with validation strategies and probability calibration.

Sources and next steps

The prompt, numerical comparison and decision scenario are original. The normal approximation is illustrative, not a universal recommendation for small samples or dependent observations.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.