interviewpath
  • 0day streak
  • 10total XP
  • Level 1
0/6

Unit 9 · Research methods · Lesson 5 of 12

Statistical uncertainty, seeds and paired comparisons

Performance and ML results are noisy: runs differ because of seeds, scheduling, caches, co-tenants and data order. Knowing what counts as an independent sample, how to pair comparisons and how to report a confidence interval is what makes a claimed improvement believable.
About 5 hFocus mode

Step 1: Learn the ideas

  • Sources of variance: seeds, scheduling, caches, co-tenancy, data order
  • Experimental units and pseudo-replication
  • Repeated runs and how many
  • Confidence intervals for means (t) and for medians or percentiles (bootstrap)
  • Paired and interleaved comparisons
  • Dependence: correlated requests, shared machines, warm-up and drift
  • p-values and their failure modes
  • Effect sizes and practical significance
  • Reporting variance: distributions, CDFs, all seeds

Why it matters

"Did you run it more than once?" is a standard question, and "what is the variance across seeds?" follows quickly for ML work. Small improvements are routinely within run-to-run noise. In industry the same reasoning decides whether a regression or an A/B result is real.

Core ideas

Where variance comes from. In systems: thread scheduling, cache and TLB state, memory placement, CPU frequency and turbo, interrupts, background daemons, network jitter and co-located tenants. In ML: initialization, data order, dropout, nondeterministic GPU kernels and the data split itself. A seed controls only the randomness routed through it; fixing one seed makes one sample repeatable and hides seed-to-seed variance instead of measuring it.

The experimental unit. Ask what could be repeated independently. Ten thousand request latencies from one run are not ten thousand independent samples: they share warm caches, process layout and machine state, and queueing correlates neighbouring requests. The unit is usually the run (fresh process, ideally fresh placement), the seed, the machine or the data split. Treating correlated measurements as independent, sometimes called pseudo-replication, yields intervals that are far too narrow. Runs are not automatically independent either: consecutive runs on one shared machine or cloud cluster see the same neighbours, thermal state and time-of-day load. Spread runs over time and machines, or block by machine and compare variants within each block. Variance can sit at several levels (builds, machines, process restarts, iterations); vary every level your claim should cover.

How many runs. Start with five to ten, inspect the spread, then decide; interval width shrinks roughly in proportion to one over the square root of n, so quadrupling the runs about halves it. Tail metrics such as p99 need more and longer runs than means. Exclude warm-up explicitly and say how.

Confidence intervals. For a mean over n independent runs, a t-interval (mean plus or minus a t quantile times the standard error) is reasonable unless run-level values are strongly skewed. For medians, percentiles and ratios, use bootstrap or quantile-based intervals. Compute one statistic per run (that run's p99) and then the interval across runs; pooling every request into one p99 hides between-run variance.

Pair and interleave. When variants A and B use the same seeds, traces and machines, analyse per-pair differences: shared noise cancels, so the interval of the difference is often much narrower than two separate intervals suggest. Interleave runs (A, B, B, A, ...) or randomize order so environmental drift (thermal state, time of day, a noisy neighbour) does not line up with the treatment.

# 95% percentile-bootstrap interval for the mean paired difference (B - A)
import random, statistics
def paired_bootstrap_ci(a, b, iters=10_000):
    d = [y - x for x, y in zip(a, b)]          # one value per paired run
    m = sorted(statistics.mean(random.choices(d, k=len(d))) for _ in range(iters))
    return m[int(0.025 * iters)], m[int(0.975 * iters) - 1]

When not to trust a p-value. A p-value measures how surprising the data would be under a specific null model; it is not the probability that your hypothesis is true and says nothing about effect size. It misleads when you test many metrics or configurations and report the best, stop collecting once significance appears, ignore dependence between samples, or have so many samples that a negligible difference becomes "significant". A non-significant result from three runs is not evidence of no effect. Prefer intervals on effect sizes, an analysis plan fixed in advance and a stated minimum effect that matters.

Reporting. State n, what one sample is, the interval method and level, and show distributions (CDFs, box plots) rather than single bars. Report all seeds or runs, not the best.

Common misconceptions

  • "Ten thousand requests give a tight interval." Not if they come from one run; the run is the unit.
  • "A fixed seed solves variance." It makes one sample repeatable; you still need several seeds to know the spread.
  • "Overlapping error bars mean no difference." With paired designs the per-pair difference can be clearly non-zero while separate intervals overlap.
  • "p < 0.05 means the improvement is real and important." It may reflect many attempts, dependence or a negligible effect; check the interval against the practical threshold.
  • "Standard deviation bars and confidence intervals are interchangeable." They answer different questions; always say which you plot.

How to approach it

Re-run one experiment you control ten times, compute per-run statistics and a paired interval against a variant, and state the result in one sentence with n, unit and interval. Graduates are expected to insist on repeated runs and name the unit; senior candidates should raise dependence, tail metrics and multiple comparisons unprompted.

Suggested order

  1. 1Read Le Boudec Ch. 2 (Summarizing Performance Data, Confidence Intervals), including intervals for medians and quantiles and the section on the independence assumption.
  2. 2Read Georges, Buytaert and Eeckhout on statistically rigorous performance evaluation to see how warm-up, repetitions and intervals change conclusions.
  3. 3Read Rules 5 to 8 of Hoefler and Belli on nondeterministic data, normality, comparisons and measures of central tendency.
  4. 4Read Greenland et al. on misinterpretations of p-values and confidence intervals and note three you have seen in papers or reports.
  5. 5For ML work, read Bouthillier et al. on sources of variance in benchmarks and on comparing models across seeds and splits.
  6. 6Do the "Repeat one benchmark ten times" exercise: ten interleaved paired runs of two configurations, one statistic per run and a paired interval of the difference.

Step 2: Check off what you can do

Tap each one you can genuinely do or explain. Each earns 10 XP.

Step 3: Go deeper

  • Performance Evaluation of Computer and Communication SystemsStart here

    EPFL (free online edition by the author)

    Section: Ch. 2: Summarizing Performance Data, Confidence Intervals

    Intervals for means, medians and quantiles, the bootstrap and the independence assumption, with performance-evaluation examples.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Statistically Rigorous Java Performance EvaluationStart here

    Dries Buytaert's website (co-author copy)

    Systems example of how repetitions, warm-up handling and confidence intervals change benchmark conclusions.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Scientific Benchmarking of Parallel Computing Systems: Twelve Ways to Tell the Masses when Reporting Performance Results

    ETH Zürich SPCL (author copy)

    Section: Rules 5–8

    Rules for reporting nondeterministic measurements and choosing summary statistics.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Statistical tests, P values, confidence intervals, and power: a guide to misinterpretations

    PubMed Central (open access)

    Catalogue of misreadings of p-values, confidence intervals and power, with corrections.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Accounting for Variance in Machine Learning Benchmarks

    arXiv

    Sources of variance in ML benchmarks and how many seeds and splits a comparison needs.

    Open(opens in a new tab)Link responded, 5 Oct 2026

Step 4: Practice

Use something you can run repeatedly on one machine: an HTTP or key-value server under a load generator, a compression or sorting routine, or a short training run with several seeds. Restart the process for every run, interleave the two variants, compute one statistic per run and report a paired interval. Then repeat on a second machine or instance type and note whether the conclusion survives.

Record attempts on each problem’s page (+15 XP, +10 more when solved on your own).

Step 5: Test yourself

Answer each one out loud or on paper before you finish the lesson.

  1. Question 1What is the experimental unit in your last experiment, and how many units did you have?
  2. Question 2Which sources of variance does your seed control, and which does it not?
  3. Question 3Why can paired differences be clearly non-zero when separate error bars overlap?
  4. Question 4How did you handle warm-up and drift over time?
  5. Question 5How many configurations or metrics did you look at before choosing the one you report?
  6. Question 6What effect size would matter in practice, and is your interval narrow enough to show it?

You’re done when you can

  • Report a paired 95% interval for a configuration change from at least ten interleaved runs, stating n and the unit.
  • Explain in under two minutes why per-request samples from one run are not independent.
  • Compute a bootstrap interval for a median or p99 across runs from raw data you collected.
  • Name four ways a p-value can mislead and the safer alternative for each.

Finish the lesson

How confident do you feel?

Lesson complete!

+50 XP

Reviews will come up on the Practice tab so it sticks.

Your notes and study time

Log study time