advanced26 min studyLesson 876 in Engineering

Track slice quality with support and composition visible

Distinguish within-slice degradation from traffic-mix changes, and report the uncertainty and weighting support behind subgroup performance.

On this page

What you’ll understand

  • Decompose aggregate error across an exhaustive disjoint partition.
  • Calculate a weighted-support diagnostic without treating it as a universal confidence interval.
  • Define slice reports that expose label coverage, sampling, and uncertainty.

An overall metric can improve while a small but important group deteriorates. It can also worsen when traffic moves toward a historically harder group, even if every within-group metric stays constant. Slice monitoring makes these mechanisms visible, provided the slice definition, denominator, and evidence quality are preserved. A colorful table of percentages without sample counts or cohort completeness can make the least reliable estimates look as authoritative as the strongest ones.

Separate composition from within-slice behavior

Choose slices from the intended deployment question: language, device family, request source, input length, or an operationally meaningful difficulty category. A disjoint exhaustive partition allows aggregate error to be written as the sum of slice errors weighted by traffic shares. Report both quantities over time. Comparing the new traffic shares with old within-slice rates gives one composition-only counterfactual; comparing within-slice rates on a fixed mixture highlights another aspect. Neither standardization automatically identifies a causal effect of the model when users, labels, or policies also change.

Many useful slices overlap. A request can belong to both a language slice and a device slice, so adding their counts or weighted errors would double-count it. Keep each slice's denominator explicit and use a genuine partition only when applying the aggregate identity. Version the slice predicates, including treatment of unknown categories and missing metadata. If the group assignment itself changes after a preprocessing release, an apparent quality jump may simply reflect requests moving between groups. Preserve enough counts to reconcile the overall report with its partitioned view.

R=∑g=1GπgRg,πg≥0,∑g=1Gπg=1R=\sum_{g=1}^{G}\pi_gR_g,\qquad \pi_g\geq0,\quad \sum_{g=1}^{G}\pi_g=1
Groups form an exhaustive disjoint partition of the same population, R_g is its conditional mean loss, and π_g is its traffic probability. The identity does not apply by directly summing arbitrary overlapping slices. Risk has the loss's units.↔ Scroll wide equations horizontally.

A percentage needs independent information behind it

Report resolved examples, unique users or clusters, outcome completeness, and the metric's numerator and denominator. Precision needs predicted positives; recall needs actual positives. A large total slice count does not imply either denominator is large. Under independent identical Bernoulli errors, the standard error of an empirical error proportion is approximately the square root of p(1−p)/n, with an estimated p often substituted. Small or extreme samples need a more suitable interval construction than a naive symmetric normal interval. Repeated users and temporal correlation require dependence-aware analysis.

When examples carry nonnegative weights, a common diagnostic is squared total weight divided by squared-weight sum. It reports weight concentration: a few large weights can leave much less information than the raw row count suggests. This effective-size expression does not, on its own, correct clustering, estimated propensity uncertainty, label bias, or arbitrary metric variance. Report the weight policy and largest contributions as well as the diagnostic. If a slice has no resolved outcomes or no relevant positives, show the metric as unavailable rather than manufacturing a zero or a perfect score.

neff=(∑i=1nwi)2∑i=1nwi2,wi≥0,∑iwi>0n_{\rm eff}=\frac{(\sum_{i=1}^{n}w_i)^2}{\sum_{i=1}^{n}w_i^2},\qquad w_i\geq0,\quad \sum_iw_i>0
This dimensionless weight-concentration diagnostic lies between one and the number of positive weights. It is not automatically a valid sample size for every metric or confidence procedure, especially with correlated observations or estimated weights.↔ Scroll wide equations horizontally.

Make weak evidence actionable without overstating it

Predeclare critical slices and minimum evidence requirements for release decisions. Exploratory searches over many combinations can discover problems, but the most extreme observed group also benefits from selection by chance; confirm it on new evidence or use an appropriate simultaneous procedure. Minimum-count suppression should preserve an explicit 'insufficient evidence' state, not silently remove the group from the dashboard. A rare group can deserve targeted data collection or a conservative fallback before it has enough observations to support a precise performance claim.

The sampling lab isolates the effect of support. Reset, set p=0.10 and n=20, predict sample-mean variance 0.0045, then Play or Step. Separately Reset, set p=0.10 and n=100, predict variance 0.0009, then Play or Step. Playback highlights exact independent Bernoulli outcomes, rather than resampling a slice. The normal overlay can be poor near sparse boundaries; its CDF error bound does not certify individual bars or an arbitrary subgroup interval. Actual slice monitoring must also account for weighting, dependence, label availability, and how the slice was selected.

Overall improvement can hide a worse minority slice

In the reference, group A supplies 90% of traffic with 10% error and group B supplies 10% with 20% error. In the current window, A supplies 99% with the same 10% error, while B supplies 1% with 40% error. Assume exhaustive disjoint groups and fully observed population rates.

  1. Reference aggregate error is 0.90×0.10+0.10×0.20=0.11, or 11%. Current aggregate error is 0.99×0.10+0.01×0.40=0.103, or 10.3%.

  2. The aggregate improved by 0.7 percentage points, while group B's conditional error doubled from 20% to 40%. Its smaller traffic share masks that deterioration in the overall average.

  3. Reweight current slice errors to the reference mixture: 0.90×0.10+0.10×0.40=0.13, or 13%. This fixed-mixture comparison exposes a two-percentage-point increase relative to reference error, without claiming a causal explanation.

The result

Track traffic share and within-slice quality together. Observed sample estimates would additionally need support and uncertainty assessments.

Explore the model

Interactive lab

Interactive lab · sampling

A small slice has a wider sampling distribution

Reset, set p=0.10 and n=20, predict mean 0.10 and variance 0.0045, then Play or Step. Separately Reset, set p=0.10 and n=100, predict variance 0.0009, then Play or Step. Exact iid Bernoulli sample-mean masses are shown; playback highlights outcomes. This model does not handle overlapping slices, weights, clustering, or selective labels.

A small slice has a wider sampling distributionExact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Current readings: Mean sample proportion: 0.5; Sample-mean variance: 0.0125; Uniform CDF error bound: ≤ 0.1062. All parameters are adjustable with the labeled controls below.Exact distribution of the mean of 20 independent Bernoulli variables with success probability 0.5; playback highlights outcome 0.00.250.50.75100.0580.1150.1730.23Sample mean · k / nProbability massNormal bin masses are an approximationk = 0 · exact probability = 9.54e-7
Exact binomial massNormal interval massHighlighted outcome / mean
Mean sample proportion
0.5
Sample-mean variance
0.0125
Uniform CDF error bound
≤ 0.1062
t = 0 s

Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forSlice percentages require enough relevant, representative outcome evidence.

Check your understanding

A weighted slice has 1,000 rows but almost all total weight is concentrated on a few rows. What is the appropriate interpretation?

Try it yourself

Four resolved examples have weights 1, 1, 1, and 7. Compute total weight, squared-weight sum, and n_eff. Explain why reporting four rows alone is incomplete.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Square the total weight, then divide by the sum of individual squared weights.

Compare with the solution

Total weight is 10 and the squared-weight sum is 1+1+1+49=52, so n_eff=100/52≈1.923. One example carries 70% of total weight. Four rows therefore conceal substantial concentration. This diagnostic is not a confidence interval and does not account for whether the examples are independent or labels are selectively observed.

Take it with you

  • Overall quality mixes traffic composition and conditional slice performance.
  • Relevant denominators, label completeness, clustering, and weights determine evidence strength.
  • Rare and adaptively discovered slices need an explicit uncertainty and confirmation policy.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.