advanced24 min studyLesson 844 in Engineering

Resample the independent units rather than their repeated rows

Identify conversation, user, and source dependence; preserve it in cluster resampling; and distinguish more bootstrap repetitions from more independent evidence.

On this page

What you’ll understand

  • Explain why repeated related examples can understate uncertainty.
  • Choose a bootstrap unit and statistic consistent with the estimand.
  • State finite-cluster and distribution-shift limits of resampling.

An evaluation has one hundred rows, but each original prompt was repeated four times with trivial formatting changes. Treating the rows as independent can make a score look much more precise than the underlying evidence supports. Dependence is a property of how cases were generated, not a nuisance removed by shuffling the file. Identify the highest relevant independent units, retain their grouping, and design an uncertainty procedure that respects that structure. Cluster resampling can approximate sampling variation under appropriate assumptions; it does not manufacture new independent tasks or users.

Describe the dependence before selecting a formula

Examples can share a conversation, repository, document, author, or generation template. Their outcomes may move together because they rely on the same knowledge or failure mechanism. Repeating more variants within one source can reveal local robustness while contributing less information about new sources than an equal number of independent sources would. In a simplified equal-size model, the variance inflation depends on within-cluster correlation. That model is a diagnostic calculation, not a universal formula for arbitrary overlapping groups, unequal cluster sizes, or unknown dependence.

The intended population determines which units should be considered exchangeable. For performance on new users, users may be the sampling units even when each provides many conversations. If repositories share a common upstream project, repository IDs alone may miss additional dependence. Grouping choices should follow collection and deployment knowledge, with sensitivity analyses when uncertainty remains. Saravanan and colleagues illustrate how treating nested measurements as independent can misstate uncertainty. Their hierarchical-bootstrap results concern their modeled structures; they do not justify blindly applying the same hierarchy to every evaluation dataset.

Var⁡(Yˉ)=σ2Gm[1+(m−1)ρ]\operatorname{Var}(\bar{Y})=\frac{\sigma^2}{Gm}\bigl[1+(m-1)\rho\bigr]
This equality assumes G independent equal-size clusters, m observations each, common marginal variance σ², and common within-cluster pairwise correlation ρ. Here use 0≤ρ≤1, positive integer G, and integer m≥2. Variance has squared score units; the bracket is a dimensionless design effect.↔ Scroll wide equations horizontally.

Keep the resampling unit and the statistic aligned

For a basic cluster bootstrap, sample cluster identities with replacement and keep each selected cluster's observed rows together. Recompute the declared statistic on that resample. For paired model comparisons, resample both models' outcomes on the same selected clusters. If the estimand gives each cluster equal weight, average cluster means. If it gives each request equal weight, recompute the request-weighted numerator and denominator; unequal cluster sizes make these different statistics. The resampling design should approximate the original sampling process rather than quietly change the target weights.

A multi-stage sample may call for a justified hierarchical bootstrap that also resamples lower-level units, while a block or other dependence-aware method may be needed for time series. There is no instruction to resample every level automatically. Cluster bootstrap intervals are generally approximations whose adequacy depends on the statistic, population, cluster count, and sampling design. A handful of highly unequal clusters can make the approximation poor. Report the number and size distribution of independent clusters, the exact resampling procedure, the interval construction, and sensitivity to plausible alternative grouping choices.

θ^cluster ∗=1G∑b=1Gyˉgb,gb∼iidUniform⁡{1,…,G}\widehat{\theta}^{\,*}_{\mathrm{cluster}}=\frac1G\sum_{b=1}^{G}\bar{y}_{g_b},\qquad g_b\overset{\mathrm{iid}}{\sim}\operatorname{Uniform}\{1,\ldots,G\}
This bootstrap statistic targets an equal-cluster-weighted mean by resampling the G observed cluster means, with G>0. The randomness is conditional on the observed dataset. It is not a claim that the original clusters were representative or that the resulting interval has exact finite-sample coverage.↔ Scroll wide equations horizontally.

Distinguish computational precision from evidence

Increasing the number of bootstrap resamples reduces Monte Carlo noise in the bootstrap calculation, but it does not increase the number of independent source clusters. A resample cannot add a missing language, undo contamination, or make an old workload representative of a new population. Validate implementation with simple examples where the sampling variance is known, and retain grouping identities in the artifact. Report unresolved dependence or low support directly rather than hide it behind many decimal places from a large resampling run.

The sampling lab offers a precise counterexample to row counting, not a bootstrap implementation. For each separate view, Reset, set both p=0.5 and n to 25 or 100, predict, then inspect. Independent sample-mean variances are 0.01 and 0.0025. In the worked example, one hundred perfectly repeated rows contain only twenty-five independent Bernoulli outcomes, so the twenty-five-trial variance is the relevant toy result. The display has no clusters or resampling controls. Its role is to contrast those two explicit assumptions, while actual cluster inference requires the retained grouping and justified procedure.

Four identical rows do not quadruple independent evidence

A fictional dataset has twenty-five independent source prompts. Each prompt has one Bernoulli outcome with success probability 0.5, copied identically into four rows. The score averages all one hundred rows, and every cluster has the same size.

  1. Because all four copies are identical, the one-hundred-row mean equals the mean of the twenty-five original independent outcomes. The within-cluster correlation is one.

  2. Its true sampling variance is 0.5×0.5/25=0.01, with standard deviation 0.1. Pretending all one hundred rows were independent would give variance 0.0025 and standard deviation 0.05.

  3. The equal-size design effect is 1+(4−1)×1=4, multiplying the naive variance by four. Resample original prompt clusters rather than their individual copies when approximating this sampling process.

The result

The repeated-row statistic has the precision of twenty-five independent outcomes in this construction. Generating more bootstrap replicates cannot change that evidence count.

Explore the model

Interactive lab

Interactive lab · sampling

Contrast independent evidence with duplicated rows

For each view: Reset, set both p=0.5 and n, predict, then inspect. n=25 gives variance 0.01; n=100 gives 0.0025. These are two independent Bernoulli models. The first matches the worked perfect-copy construction’s mean; the instrument itself performs no cluster bootstrap or correlated sampling.

Contrast independent evidence with duplicated rowsExact 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 forCount independent sources and preserve their structure. A large row count or resampling count is not automatically a large effective evidence base.

Check your understanding

An evaluation contains many conversations from each of ten users, and the question concerns new users. What is a defensible starting point for bootstrap design?

Try it yourself

One cluster has ten rows scoring one, and another has one row scoring zero. Compute the request-weighted and equal-cluster-weighted means. What changes if the bootstrap silently uses the other statistic?

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

Give me a hint

Compare the pooled numerator and denominator with the mean of the two cluster means.

Compare with the solution

The request-weighted mean is 10/11≈0.90909, while the equal-cluster mean is (1+0)/2=0.5. Switching statistics changes the estimand. Two clusters also provide very limited population evidence; resampling does not resolve that limitation.

Take it with you

  • Dependence follows source and collection structure, not file row order.
  • Resample justified independent units and preserve the estimand’s weighting.
  • Bootstrap approximation and Monte Carlo precision do not repair distribution shift or missing independent support.

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.