Lecture 14 · Research Skills and Experimental Design

Advanced Natural Language Processing · Lecture 14。个人学习讲义与配套实验,按主题整理并持续修订。

课程源码 ZIP ↓

个人整理的学习笔记,非官方讲义;课程来源与整理说明见课程介绍。配套示例未逐一运行验证。

本篇目录

Maps to: CMU 11-711 Spring 2026, Lecture 14 (02/26), slides anlp-s2026-14-experimentation.pdf (many slides from Graham Neubig’s Fall 2024 course); course code 14_experimental/ (power.ipynb, iaa.ipynb) and 13_evaluation/errorbars.ipynb. Reading: E. Miller, Adding Error Bars to Evals: A Statistical Approach to Language Model Evaluations (2024). Sources: the public slides and notebooks, the reading, and the papers cited in each section. Every number labelled “measured” comes from code/lecture14/, run on the author’s machine (Apple M4 Pro, Python 3.13). The evaluation statistics are checked on simulated evaluations whose truth is known; the research project uses real classifiers from Lecture 1. Code: code/lecture14/ — four demos, each under ten seconds, standard library only. Reading time: ~90 minutes for the prose; ~10 more for the demos.


0. How to read this lecture

0.1 Learning goals

After this lecture you should be able to:

  1. Put an error bar on a benchmark score: the standard error from the central limit theorem, a 95% confidence interval, and when the simple interval fails (near 0 or 1; clustered questions).
  2. Compare two models properly: paired vs unpaired analysis, z and p-values (including the classic sign bug), and what “not significant” does and does not mean.
  3. Plan an evaluation with a power analysis: how many questions are needed to detect a given difference, and what goes wrong in underpowered studies.
  4. Measure inter-annotator agreement (Cohen’s and Fleiss’ kappa, Krippendorff’s alpha), know their paradoxes, and know what noisy gold labels do to model comparisons.
  5. Run a research project: from an observation to a falsifiable hypothesis, an experiment with controls and seeds, an honest analysis (multiple comparisons, the seed lottery), and a report.

0.2 Prerequisites and scope

  • Prerequisites: Lecture 13 (benchmarks, metrics); Lecture 1 (Cinema World, the linear classifiers); basic probability (mean, variance, the normal distribution).
  • Scope: the statistics of model evaluation, and the practice of research in NLP.
  • Not in scope: Bayesian analysis, mixed-effects models (mentioned only), and how to write the paper, beyond pointers.

0.3 Section → code map

SectionIdeaDemo in code/lecture14/
§1.1–1.3SE, CI, coverage; Wilson; clustered questions01_error_bars.py Parts A–C (+ stats.py, exam_world.py)
§1.4–1.5unpaired vs paired; power; the sign bug; K samples per question01_error_bars.py Parts D–E
§1.6earlier lectures’ claims with error bars01_error_bars.py Part F
§2power analysis; pilots; the winner’s curse02_power.py
§3.3kappa, its paradox, agreement by category, noisy gold03_annotation.py
§4–5a research project in miniature; the seed lottery04_mini_research.py

0.4 Notation

SymbolMeaning
sis_ithe score on question ii (0/1 for accuracy); sˉ\bar s the mean over nn questions
μ\muthe true score: the mean over the whole population of questions the benchmark samples
SE\mathrm{SE}standard error of sˉ\bar s
zz, ppz-score and p-value; zα/2=1.96z_{\alpha/2} = 1.96 for α=0.05\alpha = 0.05
ω2\omega^2across-question variance of the difference between two models’ scores
σ2\sigma^2, KKwithin-question variance with stochastic decoding; samples per question
δ\deltaminimum detectable effect (the smallest difference worth detecting)
pop_o, pep_e, κ\kappaobserved agreement, chance agreement, Cohen’s kappa

1. What can we conclude from a benchmark score?

1.1 A score is an estimate

The setup (Miller, 2024; the slides):

  • An evaluation is nn questions q1,…,qnq_1, \dots, q_n, assumed independently drawn from a population of possible questions.
  • The model scores sis_i on each.
  • The true score μ=E[s]\mu = \mathbb{E}[s] is unobserved. By the law of large numbers, μ≈sˉ=1n∑isi\mu \approx \bar s = \frac{1}{n}\sum_i s_i.

By the central limit theorem, sˉ\bar s is approximately normal around μ\mu, with standard error

SECLT=Var(s)/n=1n−1∑i(si−sˉ)2/n,SEBernoulli=sˉ(1−sˉ)/n for 0/1 scores.\mathrm{SE}_{\text{CLT}} = \sqrt{\mathrm{Var}(s)/n} = \sqrt{\tfrac{1}{n-1}\textstyle\sum_i (s_i - \bar s)^2 \big/ n}, \qquad \mathrm{SE}_{\text{Bernoulli}} = \sqrt{\bar s(1-\bar s)/n} \text{ for 0/1 scores}.

A 95% confidence interval is sˉ±1.96×SE\bar s \pm 1.96 \times \mathrm{SE}: 95% of a standard normal’s mass lies within 1.96 standard deviations. The slides ask every report to include the number of questions nn and the standard error or an interval.

Measured (demo 01 Part A). The course notebook’s setting is a model of true accuracy 86% on a HumanEval-sized benchmark of 164 questions. Simulated questions get difficulties and the model an ability, so the true accuracy is known exactly: it is exam_world.py’s item response model. One evaluation gives 86.0%, SE 0.027, 95% CI [80.6%, 91.3%]. That interval is 10 points wide. “Model B scores 2 points higher” cannot be read off two numbers of this kind.

questions nn1001645001,0002,0005,000
SE at 86%0.0350.0270.0160.0110.0080.005
95% half-width±6.8±5.3±3.0±2.2±1.5±1.0 points

SE∝1/n\mathrm{SE} \propto 1/\sqrt{n}: four times the questions halve the error bar.

1.2 Does a 95% interval cover the truth 95% of the time?

That is a claim we can test: simulate 5,000 evaluations, each on freshly drawn questions, and count how often the interval contains the known true accuracy:

true accuracy, questionssˉ±1.96 SE\bar s \pm 1.96\,\mathrm{SE}Wilson interval
86%, n=164n = 16494.8%94.9%
97%, n=30n = 3059.4%94.3%
97%, n=164n = 16487.1%97.2%

The CLT interval works in the comfortable middle and fails near 0 or 1 with few questions. A model that gets all 30 questions right gets an interval of width zero. The Wilson score interval fixes this and costs nothing. Use it for small or near-saturated evaluations, which are exactly where frontier benchmarks live.

1.3 Clustered questions

The CLT assumes independent questions. Often they are not. MGSM is the same 250 math problems translated into ten languages; reading comprehension has several questions per passage; code benchmarks have several tests per problem. Questions in a cluster succeed and fail together, so nn overstates the information. Miller’s clustered standard error keeps the within-cluster cross terms:

SEclustered=1n2∑c∑i∈c∑j∈c(si−sˉ)(sj−sˉ).\mathrm{SE}_{\text{clustered}} = \sqrt{\frac{1}{n^2}\sum_{c}\sum_{i \in c}\sum_{j \in c}(s_i - \bar s)(s_j - \bar s)}.

Measured (demo 01 Part C): 250 problems × 10 languages = 2,500 questions, over 1,000 simulated evaluations.

standard error95% interval covers the truth
naive (questions independent)0.007273.6%
clustered0.012295.5%

The clustered SE is 1.7× the naive one: 2,500 clustered questions carry about the information of 864 independent ones. Reporting the naive interval would claim a precision the data do not have.

1.4 Comparing two models: unpaired vs paired

Unpaired (the slides):

  • The difference of means is μ^A−B=μ^A−μ^B\hat\mu_{A-B} = \hat\mu_A - \hat\mu_B, with SEA−B=SEA2+SEB2\mathrm{SE}_{A-B} = \sqrt{\mathrm{SE}_A^2 + \mathrm{SE}_B^2}.
  • 95% CI: μ^A−B±1.96 SEA−B\hat\mu_{A-B} \pm 1.96\,\mathrm{SE}_{A-B}. If it excludes 0, the difference is statistically significant.
  • Equivalently, z=μ^A−B/SEA−Bz = \hat\mu_{A-B}/\mathrm{SE}_{A-B} and the p-value is the probability of a difference at least this large if the null hypothesis (no difference) were true.

Paired. Both systems usually answer the same questions, and they find the same questions hard. Analyze the per-question differences di=sA,i−sB,id_i = s_{A,i} - s_{B,i}:

Var(A−B)=Var(A)+Var(B)−2 Cov(A,B).\mathrm{Var}(A - B) = \mathrm{Var}(A) + \mathrm{Var}(B) - 2\,\mathrm{Cov}(A, B).

The positive covariance shrinks the variance, so the same data give a sharper test.

Measured (demo 01 Part D): two models of true accuracy 86% and 88% on the same 164 questions.

analysisdifferenceSEzp
unpaired+0.0180.03810.480.631
paired+0.0180.03050.600.549

Their scores correlate at 0.36 across questions. Over 2,000 simulated evaluations:

unpairedpaired
detects the real 2-point difference (power)5.6%9.2%
“detects” a difference between two equal models2.6%5.5%

Pairing helps. It keeps the promised 5% false-alarm rate, while unpaired is conservative because it overstates the SE. But both powers are terrible: 164 questions cannot detect a 2-point difference (§2). The p = 0.55 here does not say the models are equal. It says this evaluation lacks the evidence to tell. The slides’ “What can we conclude? What do we lack evidence for?” is exactly this distinction.

The sign bug. The two-sided p-value is 2(1−Φ(∣z∣))2(1 - \Phi(|z|)). The course notebook’s paired cell computes 2(1−Φ(z))2(1 - \Phi(z)) with a negative zz (A−BA - B instead of B−AB - A) and prints a “p-value” of 1.84. Demo 01 reproduces the bug: with z=−0.60z = -0.60 it gives 1.451, and with ∣z∣|z|, 0.549. A p-value above 1 is a bug report, not a result.

1.5 Variance reduction

Var(μ^)=Var(s)/n\mathrm{Var}(\hat\mu) = \mathrm{Var}(s)/n suggests two levers (the slides):

  • more questions;
  • with stochastic decoding, more samples per question, averaged.

The second lever has a limit. The variance has a part from which questions were drawn and a part from sampling within a question, and only the second shrinks with KK. Measured (demo 01 Part E), 164 questions:

samples per question KK141664∞ (only the questions vary)
spread (std) of the accuracy estimate0.02820.01720.01390.01230.0126

A few samples per question help a lot. Beyond that, only more questions do.

1.6 Lectures 11–13, revisited with error bars

Demo 01 Part F applies an (unpaired, hence conservative) test to five comparisons reported earlier in these notes:

claimdifference95% half-widthp
L13: verbatim-leaked items, contaminated vs clean model (300 items)+21.3 points±7.89 × 10⁻⁸
L12: CLIP reranking vs first sample, exact (300 captions)+26.7±7.53 × 10⁻¹²
L11: CLIP binding, colors swapped vs objects swapped (1,000 images)+47.5±3.2< 10⁻¹⁵
L11: 10-prompt ensemble vs bare label, zero-shot shape (1,000 images)+1.9±3.10.24
L13: clean items, contaminated vs clean model (300 items)+2.7±7.90.5

The large effects stand. The prompt ensemble’s +1.9 points is within noise at this test size, and so is the contaminated model’s small gain on clean items. In Lecture 11, “prompt wording matters, within limits” was a fair reading of these numbers; “ensembling helps” would not have been. (A paired test on the same images would be sharper, and still could not rescue a 2-point effect on 1,000 items.)


2. How much test data do I need? Power analysis

2.1 The question and the formula

Before collecting data, decide what difference matters, then size the evaluation so that it can see it. The ingredients (the slides):

  • Null hypothesis: A and B perform equally.
  • Significance level α\alpha: the probability of falsely detecting a difference (Type I error), e.g. 0.05.
  • Power 1−β1 - \beta: the probability of detecting a true difference (1 − Type II error), e.g. 0.8.
  • Minimum detectable effect δ\delta: the smallest difference we care about detecting.

With a pilot evaluation of both systems giving the variances, the required number of questions is (Miller, 2024):

n=(zα/2+zβ)2 ω2+σA2/K+σB2/Kδ2,n = (z_{\alpha/2} + z_\beta)^2\,\frac{\omega^2 + \sigma_A^2/K + \sigma_B^2/K}{\delta^2},

  • ω2\omega^2 is the across-question variance of the true difference between A and B.
  • σA2,σB2\sigma_A^2, \sigma_B^2 are the average within-question variances with KK samples (stochastic decoding or graders).

With deterministic decoding and grading, n=(zα/2+zβ)2 ω2/δ2n = (z_{\alpha/2} + z_\beta)^2\,\omega^2/\delta^2.

2.2 The slides’ example, checked

A pilot of 156 items, both models at 0.86, ω^2=0.077\hat\omega^2 = 0.077, α=0.05\alpha = 0.05, power 0.8, δ=0.03\delta = 0.03:

n=(1.960+0.842)2×0.077/0.032=671.5  →  672 questions.n = (1.960 + 0.842)^2 \times 0.077 / 0.03^2 = 671.5 \;\to\; 672 \text{ questions}.

The slides print 674. Their unrounded pilot variance was presumably about 0.0772 (any ω2\omega^2 between 0.07718 and 0.07728 gives 674).

Does the formula deliver what it promises? Demo 02 takes a simulated pair at 86% vs 89%, whose ω2=0.174\omega^2 = 0.174 is larger than the slides’ because these two models correlate less. The formula plans 1,518 questions. Of 2,000 simulated studies of that size, 80.8% detect the difference: the planned 80%.

From a pilot (demo 02 Part B; the notebook’s procedure). A 156-question pilot estimates ω^2=0.193\hat\omega^2 = 0.193 (true 0.174):

smallest difference to detect3 points21.51
questions needed (pilot estimate)1,6873,7956,74615,179

Halving δ\delta quadruples nn. The pilot’s variance is itself an estimate, so plan with a margin.

2.3 What a benchmark can see

Turning the formula around gives the minimum detectable difference of a benchmark of size nn (power 0.8, ω2=0.174\omega^2 = 0.174):

questionsminimum detectable differencepower for a 2-point difference
164 (HumanEval)9.1 points9.4%
5005.218.9%
1,0003.732.9%
5,0001.792.4%

Many leaderboard comparisons are differences of 1–2 points on a few hundred items: noise, by this table. Card et al. (2020) found many NLP comparisons underpowered in exactly this way.

2.4 The winner’s curse

Underpowered studies do not just miss effects; their significant results mislead. Demo 02 Part D runs 4,000 studies of 164 questions, each comparing a real 2-point improvement:

value
true improvement2.0 points
studies with p < 0.05 (the power)10.2%
mean estimate over all studies2.1 points (unbiased)
mean size of the estimate among significant studies7.8 points (3.9× the truth)
significant studies with the wrong sign23 of 410

To be significant in a small study, an estimate must be large. So the significant ones are the lucky overestimates (Type M error), and some point the wrong way (Type S error) (Gelman & Carlin, 2014). If only significant results get published, the literature fills with exaggerated effects. Power analysis is not bureaucracy; it is what makes a positive result believable.


3. Running experiments: data

3.1 Finding test data

The slides’ order of preference:

  1. If building on previous work, use the same datasets (comparability).
  2. If answering a new question, try to repurpose existing datasets (Hugging Face datasets, the ELRA/LREC catalogue, Papers with Code).
  3. Only then create your own.

Creating data means deciding:

  • how much to annotate (§2: test data from a power analysis);
  • how to sample it;
  • annotation guidelines;
  • who annotates;
  • how to check quality (§3.3).

How much training data? More is usually better, so collect in phases. Fine-tune on increasing amounts and watch the marginal improvement (a learning curve; Lecture 7’s scaling laws in miniature). Active learning picks the next examples to label where the model is most uncertain.

3.2 Guidelines and annotators

Guidelines. Annotate some data yourself, write guidelines, and iterate. The slides show the Penn Treebank part-of-speech guidelines (Santorini, 1990): definitions plus long lists of difficult cases.

Annotators, from cheapest to largest scale:

  • yourself;
  • colleagues;
  • freelancers (UpWork);
  • crowd workers (Mechanical Turk).

Hire for a small job first to gauge speed and accuracy. Work with human annotators may need IRB approval (human-subjects review).

3.3 Inter-annotator agreement

Several raters label the same items. How much do they agree beyond chance? Cohen’s kappa (Cohen, 1960) for two annotators:

κ=po−pe1−pe,pe=∑cpc(A) pc(B),\kappa = \frac{p_o - p_e}{1 - p_e}, \qquad p_e = \sum_c p^{(A)}_c\,p^{(B)}_c,

  • pop_o is the observed agreement: the diagonal of the confusion matrix.
  • pep_e is the agreement expected if each annotator labeled at random with their own label frequencies.

Landis & Koch’s (admittedly arbitrary) bands:

κ< 00–0.200.21–0.400.41–0.600.61–0.800.81–1
noneslightfairmoderatesubstantialalmost perfect

Measured (demo 03). Two simulated annotators label 674 reviews (the slides’ setting) as positive or not:

  • po=0.856p_o = 0.856 and pe=0.500p_e = 0.500, so κ = 0.712 (substantial), with a 95% bootstrap CI of [0.659, 0.765]. An agreement statistic is an estimate too: report its interval.
  • stats.cohen_kappa reproduces the course notebook’s matrix (293, 46 / 31, 304) exactly: κ = 0.7716.

The kappa paradox. The same 90% agreement gives very different kappas:

label distributionpop_opep_eκ
balanced (45 / 5 / 5 / 45)90%50%0.800 (substantial)
95% / 5% (85 / 5 / 5 / 5)90%82%0.444 (moderate)

With a skewed label distribution, chance agreement is high and kappa is low. Report the label distribution next to kappa.

More than two annotators.

  • Fleiss’ kappa generalizes to any fixed number of raters per item.
  • Krippendorff’s alpha also handles ordinal or interval labels, varying numbers of raters, and missing labels.

Demo 03 simulates three annotators on 1,000 Cinema World reviews, with error rates that depend on the phenomenon (an assumption of the simulation), and computes agreement per phenomenon:

phenomenontrue labelslabels correctpairwise agreementFleiss’ κ
plainneg/pos97.6%95.3%0.91
negationneg/pos83.5%70.6%0.49
contrastneg/pos75.1%58.6%0.32
factualneu97.9%95.8%−0.02
mixedneu64.9%50.5%0.04

Low agreement on mixed reviews (“the acting is great and the plot is dull”) tells the designer what the slides prescribe when agreement is low:

  • revisit the guidelines (what is a mixed review?);
  • hire or train better annotators;
  • or rethink whether the task is possible.

Note the trap. “factual” has κ ≈ 0 although 98% of its labels are correct: within that category every true label is “neutral”, so chance agreement is already near 1. That is the paradox again. Within a category, read observed agreement.

Overall: Fleiss’ κ is 0.719, and Krippendorff’s α is 0.719 with all three labels. With each review given only two of the three labels, α is 0.744; Fleiss cannot handle that case and α can.

3.4 What noisy gold labels do to evaluation

Test labels are themselves annotations. Demo 03 scores two real Lecture 1 classifiers (unigrams; unigrams + negation features) against three references:

reference labelsa perfect model would scoreunigram+ negationdifference
true labels100%83.2%87.9%+4.7 points
one annotator89.5%76.1%79.8%+3.7
majority of three94.8%79.5%83.7%+4.2

Label noise lowers every score: a perfect model would get 89.5%. It also compresses differences between models, here from 4.7 to 3.7 points, which costs power (§2). Majority votes of three annotators recover most of it (Snow et al., 2008 found that a few non-experts’ majority approaches expert quality).


4. Doing research: from observation to hypothesis

4.1 Why we do research

The slides distinguish two motivations, often mixed in one paper:

  • Application-driven: make a useful system, or make one work better. Examples:
    • Pang et al. (2002) proposed sentiment analysis so readers get succinct summaries.
    • Reddy et al. (2019) proposed conversational QA because assistants lack common ground.
    • Gehrmann et al. (2018) proposed bottom-up summarization because neural summarizers were fluent but poor at content selection.
    • Kudo & Richardson (2018) proposed language-independent segmentation (SentencePiece) because per-language preprocessing hampers multilingual models.
  • Curiosity-driven: know more about language, or the world through language. Examples:
    • Rashkin et al. (2017): how does real news differ from satire, hoaxes and propaganda?
    • Cotterell et al. (2018): are all languages equally hard to language-model?
    • Tenney et al. (2019): where in BERT is each kind of linguistic information?

4.2 Getting ideas, and surveying

Ideas come from two directions:

  • Bottom-up discovery: turn a concrete understanding of existing research’s failings into a higher-level question. It is a great tool for incremental progress, but may preclude larger leaps.
  • Top-down design: move from a big question to concrete tests. It favors bigger ideas, but can be disconnected from reality: solving a problem that is not a problem, or forcing a method chosen beforehand.

Surveying has a routine:

  1. Keyword search (Google Scholar, the ACL Anthology, arXiv, OpenReview, which has the reviews).
  2. Find older papers by following references, and newer ones through “cited by”.
  3. Read abstracts, introductions and key results.
  4. Read the most relevant papers in detail.

Start with the last 3–5 years of a few top venues. The trade-off of surveying before you start:

  • For: it prevents duplicated work and stocks your toolbox.
  • Against: it can constrain your thinking (the slides cite Varian, 1994, on building models before reading too much).

4.3 Research questions and hypotheses

  • A research question is one or several explicit questions about what you want to know. Yes/no questions are often better than “how to” questions.
  • A hypothesis is your a-priori guess at the answer. It must be falsifiable: some result would prove it wrong.

The slides warn about one natural question, “Does X make Y better?” The answer “yes” or “no” is indirect. If the answer is no, you cannot tell what went wrong. And you usually have an intuition about why X should help, which is itself a set of testable assumptions. Ask those questions too.


5. A research project in miniature

Demo 04 runs the whole cycle on Lecture 1’s Cinema World, with real classifiers and real numbers. The scientific method cycles through question → hypothesis → experiment → analysis → conclusions → new questions.

1. Observation. A bag-of-words logistic regression (Lecture 1) gets 15.5% ± 4.0% of dev-set negation reviews right. Every other phenomenon is at 53–100%.

2. Question and hypothesis.

  • Question: do negation errors come from the bag of words not seeing which words a “not” applies to?
  • Hypothesis, written down before touching the test set: marking negation scope (the NOT_ features of Das & Chen, 2001, and Pang et al., 2002) raises negation accuracy by ≥ 15 points, and moves every other phenomenon by < 2 points.
  • Controls, which test the mechanism and not just “does X help”:
    • a placebo: the same kind and number of extra features, attached to the wrong words (those before “not”);
    • an alternative mechanism: bigrams, which also see local word order.

3. Experiment. Four variants × 10 training sets (seeds), one fixed test set of 4,000 reviews (374 negation reviews):

variantoverall (mean ± SE over seeds)negation reviewsnegation, worst–best seed
baseline (unigrams)81.9% ± 0.313.4% ± 1.29.9–20.6%
+ negation scope86.3% ± 0.350.9% ± 2.344.4–64.7%
+ placebo scope (wrong words)82.0% ± 0.315.4% ± 0.712.3–18.4%
+ bigrams86.7% ± 0.248.8% ± 1.543.3–55.6%

4. Analysis.

  • The main prediction holds. Scope features add 37.5 points on negation; the placebo adds ~2; bigrams, which also capture “not” + word, add 35. The mechanism is “knowing which words follow not”, not “more features”.
  • The secondary prediction fails narrowly. “Plain” reviews moved by +2.1 points (p < 0.05), not < 2. The report says so instead of rounding the miss away. A hypothesis that cannot fail is not a hypothesis.
  • Multiple comparisons. Testing every variant on every phenomenon is 24 paired tests. Six have p < 0.05 uncorrected; four survive Holm’s correction. The two that do not (the placebo’s −1.8 on contrast, bigrams’ +1.3 on neutral reviews) are what chance alone produces when you look in 24 places.
  • Seeds matter. The baseline’s negation accuracy ranges from 9.9% to 20.6% across training sets. With one run per variant, a 5-point effect could have come out either way.

5. The seed lottery. Rerun the unchanged baseline recipe with 20 more seeds (same training data) and compare each run with the original:

difference vs the original runp (paired over test reviews)
best of the 20 reruns, on the test set+1.52 points0.0004
the same two models on a fresh test set+1.23 points0.0044

13 of the 20 reruns “differ significantly” from the original, and the best one’s advantage replicates on new reviews. That is not a statistical error. Two seeds really are two different models, and a test over test items compares two fixed models. But a paper claims something about a method, and for that question the unit of analysis is the training run.

  • The 21 runs of one recipe span 81.3–83.0% (sd 0.48 points); the original run ranks 2nd of 21.
  • Compare a new method with one baseline run and you may be comparing with an unlucky draw.
  • The fix: several seeds per variant, with the comparison across seeds (step 3), or a method that accounts for both seed and item variance (Bouthillier et al., 2021). Dodge et al. (2019) make the same point about hyperparameter budgets: report expected performance as a function of how many configurations were tried.

The same discipline in practice:

  • Choose on the dev set; touch the test set once.
  • Report every variant you tried.
  • Correct for multiple comparisons.
  • Report seeds and their spread.
  • Report n and error bars on every number.

5.1 Computing, analyzing, reporting

  • Compute (the slides): cloud credits (AWS for the class), Google Colab, the TPU Research Cloud, or a workstation GPU (RTX 3090 24 GB, A6000 48 GB). Plan experiments to fit the budget: power analysis tells you how many test questions, and seeds tell you how many runs.

  • Analyze — look at the data:

    • quantitatively: tables, breakdowns by phenomenon, as in every demo of these notes;
    • qualitatively: read the errors.

    Most surprises in these notes came from a breakdown: a parser’s failure, kappa’s collapse, a seed’s luck.

  • Report: the slides recommend Simon Peyton Jones’s “How to Write a Great Research Paper”:

    • write to convey one clear idea;
    • state your contributions explicitly;
    • put the related work after you have made your point;
    • use examples.

6. Summary

  1. A score is an estimate.
    • Report n and SE=Var(s)/n\mathrm{SE} = \sqrt{\mathrm{Var}(s)/n} or a 95% interval.
    • Near 0 or 1 with few questions, use Wilson: the simple interval covered 59.4% instead of 95%.
    • For clustered questions use the clustered SE: naive coverage was 73.6%.
  2. Compare models paired on the same questions: Var(A−B)\mathrm{Var}(A-B) drops by 2 Cov2\,\mathrm{Cov}. Not significant ≠ no difference, and the two-sided p uses ∣z∣|z|.
  3. Power analysis: n=(zα/2+zβ)2(ω2+σ2/K…)/δ2n = (z_{\alpha/2}+z_\beta)^2(\omega^2 + \sigma^2/K\ldots)/\delta^2. The slides’ example gives 672 (674).
    • 164 questions can only detect ~9-point differences.
    • Significant results from underpowered studies exaggerate effects (3.9×) and sometimes flip their sign.
  4. Annotation: guidelines, pilot annotation, κ with an interval.
    • Beware the kappa paradox (90% agreement: κ 0.80 or 0.44).
    • Agreement by category locates guideline problems.
    • Noisy gold caps accuracy and compresses differences; majority votes help.
  5. Research:
    • Yes/no questions with falsifiable hypotheses.
    • Controls that test the mechanism (a placebo; an alternative explanation).
    • Seeds as the unit for claims about methods (the seed lottery).
    • Multiple-comparison corrections; dev for choices, test once.

Common pitfalls

  • Bare numbers. Reporting a score without n and an error bar, or comparing two such numbers as if any difference were real.
  • Naive SEs on clustered data (multilingual copies, several questions per passage, several tests per problem).
  • Unpaired tests when the systems answered the same questions. They throw away power.
  • Reading “p > 0.05” as “no difference”. It is “not enough evidence”.
  • p-values above 1, or one-sided p’s reported as two-sided.
  • Designing an evaluation without a power analysis, then over-interpreting a lucky significant result.
  • Reporting kappa without the label distribution, or per-category kappa where a category has one true label.
  • Comparing a new method with a single baseline run, or picking the best seed, prompt or checkpoint on the test set.
  • Testing many things and reporting only what came out significant, without correction.
  • “Does X make Y better?” as the only question. Also test the assumptions behind it.

Exercises

  1. Error bars. A model gets 820 of 1,000 questions right. Give the SE, the 95% CI, and the Wilson interval. Would a second model at 835 / 1,000 be significantly better (unpaired)?

    Answerp = 0.82, SE = √(0.82·0.18/1000) = 0.0121; CI [0.796, 0.844]; Wilson ≈ [0.795, 0.843] (nearly identical in the middle of the range). Difference 0.015, SE_diff = √(0.0121² + 0.0117²) = 0.0169; z = 0.89, p ≈ 0.37: not significant. A paired analysis on the same questions could be sharper, but 1.5 points needs thousands of questions at typical correlations.
  2. Clustering. A benchmark has 100 passages with 10 questions each. Within a passage, scores correlate with ρ = 0.3. Roughly how many independent questions is it worth? (Design effect: 1+(m−1)ρ1 + (m - 1)\rho for clusters of size mm.)

    AnswerDesign effect = 1 + 9·0.3 = 3.7. The effective n = 1,000 / 3.7 ≈ 270. The clustered SE is √3.7 ≈ 1.9× the naive one. In demo 01 the clustered SE was 1.7× the naive one, an effective 864 of 2,500 questions.
  3. Paired variance. Two models have accuracies 0.80 and 0.82 on the same questions, and their per-question scores correlate at 0.6. Compute Var(A − B) per question and compare with the unpaired Var(A) + Var(B).

    AnswerVar(A) = 0.16, Var(B) = 0.1476. Cov = 0.6·√(0.16·0.1476) = 0.6·0.1537 = 0.0922. Var(A − B) = 0.16 + 0.1476 − 0.184 = 0.1232, vs 0.3076 unpaired: 2.5× smaller. So a paired test needs 2.5× fewer questions for the same power.
  4. Power. With ω² = 0.1, α = 0.05 and power 0.8, how many questions are needed to detect δ = 0.02? To detect δ = 0.05? What does this say about benchmarks of a few hundred items?

    Answer(1.96 + 0.84)² = 7.85. δ = 0.02: 7.85·0.1/0.0004 ≈ 1,962. δ = 0.05: 7.85·0.1/0.0025 ≈ 314. A few hundred items can see 5-point differences, not 2-point ones. Most "state of the art by 1 point" claims on such benchmarks are within noise.
  5. The winner’s curse. Why does the average effect among significant results exceed the true effect in an underpowered study, and why does the problem vanish when power is high?

    AnswerSignificance requires |estimate| > 1.96·SE. When the true effect is much smaller than 1.96·SE, only estimates inflated by noise cross the threshold. Conditioning on crossing selects overestimates, and some wrong-sign estimates too. With high power, almost all estimates cross, so the conditioning removes little and the significant estimates average close to the truth.
  6. Kappa. Two annotators label 200 items: both “yes” 150, both “no” 20, A yes / B no 20, A no / B yes 10. Compute pop_o, pep_e and κ. Why is κ much lower than pop_o?

    Answer$p_o$ = 170/200 = 0.85. A says yes 170/200 = 0.85; B says yes 160/200 = 0.80. $p_e$ = 0.85·0.80 + 0.15·0.20 = 0.68 + 0.03 = 0.71. κ = (0.85 − 0.71)/(1 − 0.71) = 0.48 (moderate). Most items are "yes", so two annotators who mostly say "yes" agree often by chance alone.
  7. Design an experiment. You believe a retrieval step helps your QA model “because it supplies facts the model lacks”. State a falsifiable hypothesis that tests this mechanism (not just “retrieval helps”), and two controls.

    AnswerHypothesis: retrieval improves accuracy on questions about facts the closed-book model gets wrong (rare entities) by ≥ X points, and changes accuracy on questions it already gets right by < Y points. Control 1 (placebo): retrieve random passages of the same length. If accuracy rises anyway, the gain is not from the facts (format, length or prompting effects). Control 2: an oracle passage that contains the answer, which gives the upper bound. Also stratify by popularity as in Lecture 10, use several seeds or retriever indices, and run a power analysis for the effect size you care about.
  • Assignment 3 (literature review, proposal, baseline reproduction): §4 is the method.

    • Survey top-down and bottom-up.
    • Turn “does X help?” into falsifiable questions about mechanisms.
    • When reproducing a baseline, report seeds and error bars: a reproduction that differs by less than the error bar is a reproduction.
  • Assignment 4 (final project):

    • Size your test set with a power analysis.
    • Choose on dev; test once.
    • Report paired comparisons with intervals and corrections for the comparisons you made.

    These notes do not provide assignment code.

Further reading

  • E. Miller, “Adding Error Bars to Evals: A Statistical Approach to Language Model Evaluations”, 2024 (course reading).
  • D. Card et al., “With Little Power Comes Great Responsibility”, EMNLP 2020; R. Dror et al., “The Hitchhiker’s Guide to Testing Statistical Significance in Natural Language Processing”, ACL 2018.
  • A. Gelman, J. Carlin, “Beyond Power Calculations: Assessing Type S (Sign) and Type M (Magnitude) Errors”, Perspectives on Psychological Science 2014; J. Simmons, L. Nelson, U. Simonsohn, “False-Positive Psychology”, 2011.
  • X. Bouthillier et al., “Accounting for Variance in Machine Learning Benchmarks”, MLSys 2021; J. Dodge et al., “Show Your Work: Improved Reporting of Experimental Results”, EMNLP 2019; N. Reimers, I. Gurevych, “Reporting Score Distributions Makes a Difference”, EMNLP 2017.
  • J. Cohen, “A Coefficient of Agreement for Nominal Scales”, 1960; J. Fleiss, 1971; K. Krippendorff, Content Analysis, 2004; J. R. Landis, G. Koch, 1977; A. Feinstein, D. Cicchetti, “High agreement but low kappa”, 1990; R. Snow et al., “Cheap and Fast — But is it Good?”, EMNLP 2008.
  • S. Peyton Jones, “How to Write a Great Research Paper” (talk); H. Varian, “How to Build an Economic Model in Your Spare Time”, 1994.

Preview of Lecture 15 — Diffusion and flows

Lecture 12 ended with a con: tokenizing images loses information, and generating them token by token is slow. Lecture 15 generates by iterative denoising instead:

  • DDPM’s forward and reverse processes;
  • the noise-prediction loss;
  • flow matching’s straight paths;
  • discrete (masked) diffusion for text — and how it compares, on a toy language with exact probabilities, with the autoregressive models of this course. Every comparison will carry an error bar.

术语表 (Glossary, English → 中文)

English中文
standard error / central limit theorem标准误 / 中心极限定理
confidence interval / coverage置信区间 / 覆盖率
Wilson score intervalWilson 得分区间
clustered standard error / design effect聚类标准误 / 设计效应
null hypothesis / p-value / z-score零假设 / p 值 / z 分数
statistically significant统计显著
paired / unpaired comparison配对 / 非配对比较
covariance / correlation协方差 / 相关系数
variance reduction方差缩减
power analysis / statistical power功效分析 / 统计功效
significance level / Type I error / Type II error显著性水平 / 第一类错误 / 第二类错误
minimum detectable effect / pilot study最小可检测效应 / 预实验
winner’s curse / Type M error / Type S error赢家诅咒 / 量级错误 / 符号错误
bootstrap / permutation test自助法 / 置换检验
multiple comparisons / Bonferroni / Holm correction多重比较 / Bonferroni 校正 / Holm 校正
annotation guidelines / annotator / crowdsourcing标注规范 / 标注者 / 众包
inter-annotator agreement (IAA)标注者间一致性
Cohen’s kappa / Fleiss’ kappa / Krippendorff’s alpha科恩 kappa / 弗莱斯 kappa / 克里彭多夫 alpha
chance agreement / kappa paradox偶然一致 / kappa 悖论
gold label / label noise / majority vote金标签 / 标签噪声 / 多数投票
active learning / learning curve主动学习 / 学习曲线
application-driven / curiosity-driven research应用驱动 / 好奇心驱动研究
bottom-up discovery / top-down design自底向上发现 / 自顶向下设计
literature survey文献调研
research question / hypothesis / falsifiable研究问题 / 假设 / 可证伪
control / placebo / ablation对照 / 安慰剂对照 / 消融
seed variance / unit of analysis随机种子方差 / 分析单位
replication / reproducibility复现 / 可复现性
IRB (institutional review board)机构审查委员会
← 返回课程目录