Skip to content
AriadneTechnology

The Inner Ring · Chamber 7 of 8

Experiments & Scientific Rigor

Baselines, ablations, seeds and error bars: how to know whether your result is real. Then put on Reviewer #2's hat.

30 min 60 XP + 4 questions + 2 challengesMathLabCode

In this chamber you will

  • Write falsifiable, specific hypotheses
  • Choose fair baselines and design ablations
  • Quantify uncertainty with seeds, standard errors and confidence intervals
  • Spot data leakage and other common experimental flaws

From hunch to hypothesis

Research starts with a hunch ("warmup seems to help") and becomes science when the hunch is turned into a hypothesis: a specific, falsifiable prediction, stated before you look at the results.

Before

Learning-rate warmup is good for training.

After

Linear warmup over the first 1,000 steps reduces the fraction of diverged runs at batch size 4,096, compared with no warmup, across 5 seeds.

The second version names the intervention, the comparison, the metric and the conditions. An experiment can prove it wrong, and that's what makes it scientific.

Decide your metric, your comparison and your number of runs in advance. If you choose them after peeking at the results, it becomes frighteningly easy to fool yourself, and the first principle of science, in Richard Feynman's words, is that "you must not fool yourself, and you are the easiest person to fool."

Baselines: compared to what?

A number means nothing on its own. "92% accuracy" is impressive if the previous best was 80% and embarrassing if always predicting the majority class gets 95%. Every claim needs a baseline: a reference point.

Good baselines are:

  • Strong and recent: the best existing methods, not a strawman.
  • Fairly tuned: given the same hyperparameter budget as your method.
  • Matched: the same data, the same splits, similar compute.
  • Simple, too: a trivial baseline (majority class, linear model) tells you how hard the task really is.

Ablations: what actually matters?

A method with several new components raises an obvious question: which parts are doing the work? An ablation study answers it by removing one component at a time:

VariantAccuracy (%)
Full model84.1 ± 0.3
without gating module79.3 ± 0.4
without data augmentation83.8 ± 0.5
without both78.9 ± 0.4

(Illustrative numbers, mean ± standard deviation over 5 seeds.) Reading it like a reviewer: the gating module is doing almost all of the work. The augmentation's effect (0.3 points) is smaller than the run-to-run noise, so we can't claim it helps at all.

Randomness and error bars

Train the same network twice with different random seeds and you'll get different numbers. Randomness enters through initialisation, data order, dropout, augmentation and even non-deterministic GPU kernels. So a single run is a single draw from a distribution, and you need several draws to see its shape.

For nn runs with scores x1,…,xnx_1, \dots, x_n:

xˉ=1n∑i=1nxi,s=1n−1∑i=1n(xi−xˉ)2,SE=sn\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i, \qquad s = \sqrt{\frac{1}{n-1}\sum_{i=1}^{n} (x_i - \bar{x})^2}, \qquad \mathrm{SE} = \frac{s}{\sqrt{n}}

The sample standard deviation ss describes how much individual runs vary. The standard error SE\mathrm{SE} describes how precisely you know the mean, and it shrinks as 1/n1/\sqrt{n}. A 95% confidence interval for the mean is xˉ±t⋆⋅SE\bar{x} \pm t^\star \cdot \mathrm{SE}, where t⋆≈2.78t^\star \approx 2.78 for 5 runs, 2.092.09 for 20, and tends to 1.961.96 as nn grows.

Quick check +20 XP

Your runs have a sample standard deviation of s=2.0s = 2.0 across n=16n = 16 seeds. What is the standard error of the mean, s/ns/\sqrt{n}?

Now feel it for yourself. Two methods, one of which is genuinely a little better, but you don't know which or by how much. Gather evidence:

Interactive lab

Signal or noise?

Two methods, trained with different random seeds. Each dot is one run's test accuracy. Shaded bars are 95% confidence intervals for each mean. Keep running seeds until you can say, with evidence, whether the new method really wins.
76%78%80%82%84%86%Baseline · n=0New method · n=0

Difference (new − baseline) with 95% interval

-3-2-10+1+2+3

Run some seeds. One run of each method tells you almost nothing.

Challenge: Signal or noise?Run seeds until the 95% confidence interval of the difference excludes zero.+30 XP

Data leakage: the silent killer

Leakage is any path by which information from your evaluation data sneaks into training or model selection. It makes results look better than they are, often dramatically, and it's one of the most common reasons published results fail to reproduce. Classic forms:

  • Duplicates: the same (or nearly the same) example appears in both training and test sets.
  • Preprocessing on everything: normalisation statistics, vocabularies or feature selection computed on the full dataset before splitting.
  • Label proxies: a feature that secretly encodes the answer, such as a hospital billing code when predicting a diagnosis.
  • Time travel: training on the future to predict the past in time-series data.
  • Test-set model selection: choosing checkpoints or hyperparameters by test score.
  • Contamination: benchmark questions that appeared in a large model's pretraining data.

Put on Reviewer #2's hat

In academic folklore, "Reviewer #2" is the reviewer who finds every flaw. Today, that's you.

Peer-review simulator

You are Reviewer #2

1/5
Five submissions have landed on your desk. Each report hides one serious experimental flaw. Find it before the program chair does.

Submission #1041: “DeepThread beats all baselines”

“We tuned our model's hyperparameters with 200 trials of random search. For the baseline we used the default settings from its original paper. Our model wins by 2.1 points.”

What's the most serious problem?

Challenge: Reviewer #2Find the flaw in five experimental reports.+40 XP

Reproducibility

A result you can't reproduce is a result you can't trust, and one nobody can build on. Before you report anything, make sure you could rerun it exactly. Record:

  • the code version (for example, the git commit hash);
  • the full configuration: every hyperparameter, not just the interesting ones;
  • the random seeds;
  • the data version and the exact splits;
  • the environment: library versions and hardware.

A minimal, reproducible experiment script looks like this:

Python
import json, random, subprocess

import numpy as np
import torch

def set_seed(seed: int) -> None:
    random.seed(seed)
    np.random.seed(seed)
    torch.manual_seed(seed)
    torch.cuda.manual_seed_all(seed)
    # For bit-exact GPU runs you may also need:
    # torch.use_deterministic_algorithms(True)

config = {"lr": 3e-4, "batch_size": 128, "epochs": 20, "seed": 0}
set_seed(config["seed"])
config["git_commit"] = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()

with open("run_config.json", "w") as f:
    json.dump(config, f, indent=2)

# ...train, then save metrics next to run_config.json
Improving Reproducibility in Machine Learning ResearchJoelle Pineau, Philippe Vincent-Lamarre, Koustuv Sinha, et al. · JMLR, 2021

A report from the NeurIPS 2019 reproducibility programme, including the ML reproducibility checklist many conferences now use.

Deep Reinforcement Learning that MattersPeter Henderson, Riashat Islam, Philip Bachman, et al. · AAAI, 2018

A sobering demonstration of how much results can vary with random seeds and implementation details.

Key takeaways

  • Turn hunches into specific, falsifiable hypotheses, and fix metrics and comparisons before you look.
  • Compare against strong, fairly tuned baselines, and use ablations to show what each component contributes.
  • Run multiple seeds. Report the mean with a clearly labelled spread, and remember SE=s/n\mathrm{SE} = s/\sqrt{n}.
  • Hunt for data leakage, and log everything needed to reproduce a run exactly.

Checkpoint

Prove it to the labyrinth

Answer every question to clear this chamber. First-try answers earn the most XP.

0/3
Question 1 of 3 +20 XP

Method A scores 81.2±0.981.2 \pm 0.9 and method B scores 81.6±1.181.6 \pm 1.1 (mean ±\pm standard deviation over 5 seeds). What is the most defensible conclusion?

Question 2 of 3 +20 XP

You standardise features with the mean and standard deviation of the entire dataset, then split it into train and test. What's the problem?

Question 3 of 3 +20 XP

Which of these belongs in a reproducible experiment log?

End of the chamber

Clear this chamber

  • Questions in this chamber (0/4 solved)Next unsolved
  • Bonus: Signal or noise? (+30 XP)
  • Bonus: Reviewer #2 (+40 XP)
+60 XPBaselineRandom SeedError BarsData Leakage