Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.A lab notebook for models
Scientists keep lab notebooks so that anyone can see what was tried, under which conditions, and with what result. Training models is experimental science too: dozens or hundreds of runs with different settings, data and code. An experiment tracker is the automatic lab notebook. It also protects against a subtle trap: when you try many things and keep the best, the best score is partly luck, and the notebook lets you measure how much.
If validation scores of equally good runs scatter with standard deviation 0.0143 around 0.8013, the best of 60 is expected at about 0.834, 3.3 points above a typical run, with no better test accuracy.
N2-1, seed 0: one configuration trained with 60 seeds had validation accuracy 0.8013 ± 0.0143 and a best of 0.840, whose test accuracy (0.7938) was ordinary. Expected maxima assume normal scatter.
In Exercise 2, the best of 60 runs scored 0.830 on validation but 0.786 on test; re-running the top configurations with five seeds each and choosing by the average picked a model that scored 0.793.
- 1. An experiment tracker records…
- 2. The best of many runs usually looks…
- 3. To reproduce a run you need its…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Run: one execution of training or evaluation, with parameters, tags, metrics (often per step), artifacts and status.
- Lineage: the data version, code version (a commit) and environment a run used; fingerprints (hashes) identify them exactly.
- Artifacts: files produced by a run (weights, plots, predictions), stored with their hashes.
- Search and comparison: filtering runs by tags or parameters and ranking them by a metric; parallel-coordinate plots and learning curves.
- Selection bias (the winner’s curse): the maximum of many noisy validation scores overstates the chosen run’s true performance.
- Seeds: runs that differ only in random seed can differ by more than many hyperparameter changes; report means and spreads.
- Tools: MLflow, Weights & Biases, TensorBoard, Neptune, Comet, Aim, Sacred; DVC for data versions.
- 1. A fingerprint of a dataset is…
- 2. The winner's curse means…
- 3. Lineage records…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.A tracker in fifty lines
Exercise 1.
- A Tracker class: start a run with parameters, data and code fingerprints and a seed; log metrics per step and artifact fingerprints; finish; search with filters and ordering.
- A task worth tracking: logistic regression on linear or quadratic features of 8 inputs, 300 training and 200 validation examples, mini-batch gradient descent with L2.
- reproduce: refuse if the data fingerprint differs, otherwise re-run and compare the final metric and the weights’ fingerprint.
Practice.
- Log automatically, from the training code, not by hand: parameters, seed, data and code versions, environment, metrics, artifacts.
- Fingerprint data and outputs; compare runs only within the same data version.
- Separate search from evaluation: select on validation data, report on a test set used once.
- Re-run finalists with several seeds and report means and spreads.
- Prefer larger validation sets when many configurations are compared.
- Make reproduction a test: a logged run should reproduce from its record.
rid = tracker.start_run(params, data_fp=sha256(train, val),
code_fp=git_commit(), seed=seed)
for step in range(steps):
...
if step % 50 == 0:
tracker.log_metric(rid, "val_acc", evaluate(), step)
tracker.log_artifact(rid, "weights", w)
tracker.end_run(rid)- 1. Runs should be compared only when they share…
- 2. Finalists should be re-run…
- 3. Logging should be…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
The winner’s curse. Suppose n runs have validation scores Vᵢ = aᵢ + εᵢ, where aᵢ is the run’s true accuracy and εᵢ is noise from the finite validation set and the seed. Selecting the largest Vᵢ favours runs with large εᵢ, so E[V_best − a_best] is positive. For equally good runs with independent normal noise of standard deviation σ, the expected maximum noise is about σ times 0.56, 1.54, 2.32 and 2.74 for n = 2, 10, 60 and 200. A test set used only once gives an unbiased estimate of the chosen run. Part of the gap is shared by every run (a validation set that happens to be easy); part comes from the selection itself.
Sources of noise. With m validation examples, accuracy has a sampling standard deviation of about √(p(1 − p)/m): 0.028 for p = 0.8 and m = 200. Seeds add variation in initialization and batch order. Averaging k seeds divides the seed variance by k but does not remove the validation set’s own sampling error, which only a larger validation set reduces.
Successive halving. With n = ηᵏ configurations, a minimum budget r, and k + 1 rounds in which the best 1/η survive with η times more steps, every round costs rn steps, so the total is rn(k + 1); it explores n configurations for the cost of about (k + 1)/η full-length runs per η configurations. Hyperband runs several such brackets with different r.
Fingerprints. A cryptographic hash changes completely when any input byte changes. With 12 hexadecimal digits (48 bits), two different inputs collide by chance with probability about 2⁻⁴⁸.
- 1. The expected maximum of 60 independent standard normal values is about…
- 2. Averaging k seeds reduces…
- 3. Each round of successive halving with n = ηᵏ costs about…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.After a tracked random search, how far does the winning run’s validation score overstate its test accuracy, and does re-running finalists with several seeds help?
History.
- J. Bergstra and Y. Bengio (2012) showed random search is more efficient than grid search; K. Jamieson and A. Talwalkar (2016) proposed successive halving and L. Li and colleagues (2017) Hyperband.
- G. Cawley and N. Talbot (2010) analysed over-fitting in model selection; X. Bouthillier and colleagues (2021) measured how seeds and data splits change benchmark conclusions.
- ModelDB (M. Vartak and colleagues, 2016), Sacred (K. Greff and colleagues, 2017), Weights & Biases (2018) and MLflow (M. Zaharia and colleagues, 2018) made tracking routine; J. Pineau and colleagues (2021) introduced a reproducibility checklist at NeurIPS.
Exercise 2.
- 60 configurations sampled at random (degree 1 or 2, L2 from 10⁻⁴ to 1, learning rate from 0.01 to 1, 200 to 800 steps, batch 16 to 64), one seed each; 300 training, 200 validation and 5,000 test examples.
- The top 10 by validation accuracy are re-run with 5 new seeds; a configuration is then chosen by its mean validation accuracy. 110 tracked runs in all.
Seed 0:
| quantity | value |
|---|---|
| best single run: validation, test | 0.830, 0.7862 |
| mean validation − test over all 60 runs | +0.0222 |
| best configuration re-run: mean validation, standard deviation | 0.814, 0.0037 |
| chosen by mean over seeds: validation, test | 0.815, 0.7926 |
| best test accuracy of any search run | 0.7966 |
Seeds 1 and 2: best single run 0.810 and 0.865 on validation, 0.8028 and 0.8034 on test; mean validation − test −0.0080 and +0.0568; chosen by mean over seeds 0.8050 and 0.8074 on test.
Findings.
- The winning run’s validation score exceeded its test accuracy by 0.7 to 6.2 points; in seeds 0 and 2, half or more of it was shared by all runs (the 200-example validation set happened to be easy), and the rest came from selection.
- Choosing by the mean over five seeds raised test accuracy by 0.2 to 0.6 points over the single best run, in every seed.
- Seed-to-seed spread of the best configuration was 0.3 to 0.8 points, smaller than the validation set’s own sampling error of about 2.8 points.
Experiment tracking in practice
- Teams log to a shared server (MLflow, Weights & Biases) from every training job, with the commit, data version and environment attached automatically.
- Large models are tracked with system metrics (GPU use, throughput) and many checkpoints; dashboards compare learning curves across hundreds of runs.
- Science benefits in the same way: a tracked run documents exactly how a published number was produced.
References
- J. Bergstra and Y. Bengio (2012). “Random search for hyper-parameter optimization.” JMLR.
- G. C. Cawley and N. L. C. Talbot (2010). “On over-fitting in model selection and subsequent selection bias in performance evaluation.” JMLR.
- K. Jamieson and A. Talwalkar (2016). “Non-stochastic best arm identification and hyperparameter optimization.” AISTATS.
- L. Li and colleagues (2017). “Hyperband: a novel bandit-based approach to hyperparameter optimization.” JMLR.
- M. Zaharia and colleagues (2018). “Accelerating the machine learning lifecycle with MLflow.” IEEE Data Engineering Bulletin.
- X. Bouthillier and colleagues (2021). “Accounting for variance in machine learning benchmarks.” MLSys.
- J. Pineau and colleagues (2021). “Improving reproducibility in machine learning research.” JMLR.