download

A 20-row subgroup drops to 80% precision. Should you block release?

Machine learning~15 minReviewed 3 Dec 2026Free · No sign-in

Question

Before releasing a new classifier, your eval report shows 92.0% overall precision (1,840 / 2,000). A small regional subgroup has only n = 20 flagged cases and shows 80.0% precision (16 / 20). One teammate says "block the launch immediately". Another says "ignore small slices and look at the overall 92%".

  1. Compute the Wilson 95% confidence interval for 16 / 20 and compare it with 160 / 200 (also 80.0%) and overall 1,840 / 2,000.
  2. Why are both teammates falling into a trap?
  3. How do you evaluate and gate small subgroups reliably?
Show hints (3)
  1. "CHECK THE 95% CI"

    With z = 1.96, a proportion 16 / 20 has a Wilson interval spanning more than 30 percentage points. Does it almost reach 92%?

  2. "COMPARE N=20 VS N=200"

    Now keep precision at 80% with n = 200 (160 / 200). How much narrower does the 95% interval become, and does it still overlap 92%?

  3. "CHECK THE MASKING TRAP"

    Suppose a 20-row slice (1% of 2,000) really collapses to 40% precision (8 / 20). How much does overall precision move from 92.0%?

Show checked explanation

Do not auto-block or ignore it. For 16 / 20 (80.0%), the Wilson 95% CI is [58.4%, 91.9%] (33.5 points wide). It nearly reaches the 92.0% baseline and overlaps the overall 95% CI [90.7%, 93.1%] (P(X <= 16 | p = 0.92) = 0.071). By contrast, 160 / 200 gives [73.9%, 85.0%], clear proof of a gap. Report Wilson CIs, oversample small slices, aggregate longer windows, and inspect the four errors.

"SOLUTION · PYTHON"
import math
from statistics import NormalDist

Z = NormalDist().inv_cdf(0.975)  # 95% two-sided normal quantile (~1.96)


def wilson_ci(k, n, z=Z):
    p = k / n
    denom = 1 + z * z / n
    center = (p + z * z / (2 * n)) / denom
    half = z * math.sqrt((p * (1 - p) + z * z / (4 * n)) / n) / denom
    return center - half, center + half


slices = [("overall", 1840, 2000), ("small", 16, 20),
          ("larger", 160, 200), ("perfect", 20, 20)]
for name, k, n in slices:
    lo, hi = wilson_ci(k, n)
    print(f"{name:7} {k:4d}/{n:<4d} ({k / n:5.1%}) "
          f"95% CI [{lo:.1%}, {hi:.1%}] width={(hi - lo) * 100:.1f}pp")
"OUTPUT"
overall 1840/2000 (92.0%) 95% CI [90.7%, 93.1%] width=2.4pp
small     16/20   (80.0%) 95% CI [58.4%, 91.9%] width=33.5pp
larger   160/200  (80.0%) 95% CI [73.9%, 85.0%] width=11.0pp
perfect   20/20   (100.0%) 95% CI [83.9%, 100.0%] width=16.1pp

Code, Wilson 95% intervals, and exact binomial checks run on CPython 3.12.10 (stdlib only) against the subgroup counts above; official SciPy and Python documentation links checked by the author. Checked by an editor other than the author.

Walkthrough

A point estimate without sample size hides how noisy a tiny slice is. Use the Wilson score interval for binomial rates (k / n), because the textbook Wald formula p +/- z * sqrt(p*(1-p)/n) under-covers small n and collapses to zero width at 20 / 20 ([100.0%, 100.0%] vs Wilson [83.9%, 100.0%]).

SliceCountPoint precisionWilson 95% CICI width
Overall1,840 / 2,00092.0%[90.7%, 93.1%]2.4 pp
Small subgroup16 / 2080.0%[58.4%, 91.9%]33.5 pp
Larger subgroup160 / 20080.0%[73.9%, 85.0%]11.0 pp
Perfect tiny slice20 / 20100.0%[83.9%, 100.0%]16.1 pp

1. Trap A: blocking blindly on n = 20 noise. With n = 20, a single case moves precision by 5 percentage points. Flipping just one error to a hit (17 / 20 = 85.0%) shifts the 95% CI to [64.0%, 94.8%]. Even if true precision is still 92.0%, seeing 16 or fewer hits in 20 trials happens 7.1% of the time by chance. At n = 200, the same 80.0% yields [73.9%, 85.0%] (p < 1e-7), clearly below the [90.7%, 93.1%] overall band.

2. Trap B: ignoring small subgroups. Suppose this 20-row slice (1% of traffic) really drops from 90% (18 / 20) to 40% (8 / 20). Overall precision barely budges from 92.0% (1,840 / 2,000) to 91.5% (1,830 / 2,000). Overall averages silently hide real harm on minority regions, languages, or high-value tiers.

3. How to gate small subgroups cleanly.

  • Inspect the 4 errors immediately. On n = 20, reading all four false positives takes five minutes and spots systematic bugs (like a broken currency parser) faster than any test.
  • Set a minimum n before hard CI gating. Detecting a drop from 92% to 80% at 80% power (alpha = 0.05) needs at least 53 rows against a fixed benchmark (128 per arm for two-sample comparison).
  • Grow signal deliberately. Oversample key slices with stratified evaluation, or aggregate over longer rolling windows. You can also use hierarchical (Bayesian) pooling to shrink noisy slices toward the global rate without hiding large drops.

Common mistakes

  • Hard-gating releases on raw point estimates for 50 tiny slices. By multiple-testing chance alone, several n = 20 slices dip below 85% on every single release.
  • Using the Wald formula p +/- 1.96 * SE on small or extreme proportions. It overflows 100% or gives zero width on 20 / 20; use Wilson or exact binomial intervals.
  • Dropping small slices from dashboards because they are noisy. A 1% slice collapsing to 40% moves overall precision by only 0.5 points (92.0% to 91.5%).
  • Forgetting to check the actual error rows. Four errors on n = 20 are small enough to inspect by hand and catch deterministic feature bugs immediately.

Follow-up questions

  • "You track 30 regions on every release. How do you stop false alarms without missing real regional regressions?" Require both statistical evidence and a meaningful drop. Apply Benjamini-Hochberg FDR control (or a stricter alpha) across slices above your minimum n. For tiny slices, track a rolling multi-week window and alert when the upper CI bound falls below your floor.
  • "When does hierarchical (Bayesian) pooling help, and when can it mislead you?" Empirical-Bayes pooling shrinks noisy n = 20 estimates toward the global 92% rate, cutting false alarms while letting n = 200 slices speak for themselves. It can under-report a genuinely broken tiny region early on, so always show raw counts k / n and Wilson CIs beside pooled rates.

What a strong answer covers

Computes Wilson 95% CIs for 16 / 20 ([58.4%, 91.9%]) vs 160 / 200 ([73.9%, 85.0%]), exposing both traps: gating on tiny-slice noise and masking real slice failures inside overall averages. Inspects the four errors, sets minimum n (~53), and uses stratified sampling, longer windows, or pooling.

Open in interactive practice deck →

Original OfferVibe question. Edwin B. Wilson, "Probable Inference, the Law of Succession, and Statistical Inference" (JASA, 1927); Alan Agresti and Brent A. Coull, "Approximate Is Better than 'Exact' for Interval Estimation of Binomial Proportions" (The American Statistician, 1998) · SciPy proportion_ci (Wilson method) · Python statistics.NormalDist.
© 2026 OfferVibe · Text CC BY-NC-SA 4.0 · code MITFree to share and adapt with credit, not for commercial use. Code samples are free for any use.