Exercises — Experiment tracking and reproducibility
The single tool we reuse everywhere below is the pipeline determinism product. Let me restate it so no symbol is unearned.
The figure below draws the pipeline of L3.1 (load 1.0 → shuffle 0.7 → train 0.9 → eval 1.0).
Read it left to right: the height of each bar is the fraction of reruns still bit-identical
after that stage. The pale bar is the fraction arriving into a stage; the solid bar is what
survives it (input ). Watch the solid bar shrink from to at the shuffle
(the biggest single drop, because is the smallest ), stay at
through training, and the final magenta label reads the product . The picture makes the
weakest-link lesson visible: the output stream can never be taller than the shortest solid bar
upstream.

Level 1 — Recognition
L1.1 — Name the axes
The training run is written as List the five inputs you must pin to reproduce a run, and the two outputs you compare/reuse.
Recall Solution
Five inputs (the five arguments of ): code (git commit SHA), data (dataset hash/version), hyperparameters (config), environment (library + CUDA versions), random seed. Two outputs: artifacts (model weights, plots) and metrics (accuracy, loss curves). Mnemonic: C-D-H-E-S in, A-M out.
L1.2 — Match tool to axis
For each axis, name a standard tool: (a) data, (b) environment, (c) code.
Recall Solution
(a) Data → DVC (or LakeFS). (b) Environment →
Docker image digest / locked requirements.txt.
(c) Code → git commit SHA.
L1.3 — Repeatability vs reproducibility vs replicability
Fill the blank with the correct level: "A different team reads only your written description and gets the same result" = ____ .
Recall Solution
Reproducibility (using the levels defined in the parent note). Caveat — the words are not universal. Different bodies swap these labels: the ACM uses repeatability = same team same setup, reproducibility = different team same setup, and replicability = different setup same conclusion; some science journals flip reproducibility and replicability. So the safe habit is to state which axis you hold fixed rather than trust the word alone. On the parent note's ladder (repeatability → reproducibility → replicability), "different team, same written description, same result" is reproducibility.
Level 2 — Application
L2.1 — Compute pipeline reproducibility
A pipeline has four stages with determinism probabilities (load), (augment), (train), (eval). Compute .
Recall Solution
Step — multiply (the AND rule). Why multiply? All four must reproduce simultaneously (and we take the stages as independent — separately seeded). Only 60% of reruns match bit-for-bit.
L2.2 — Effect of adding a leaky stage
Take the pipeline from L2.1 () and insert a new unseeded shuffle stage with . What is the new , and by what factor did it drop?
Recall Solution
Step — multiply the extra factor in. Why? A new independent AND-stage multiplies. It halved (dropped by factor ). One unseeded stage can silently destroy half your reproducibility.
L2.3 — Solve for a required stage quality
You need . Three stages already sit at . What minimum must a fourth stage have?
Recall Solution
Step — isolate the unknown factor. Why? , and we want it . So — roughly . Even three near-perfect stages leave almost no slack; the fourth must be deterministic.
Level 3 — Analysis
L3.1 — Locate the reproducibility leak
A run reproduces only of the time. Stages and probabilities: load , shuffle , train , eval . (a) Verify the . (b) You can fix one stage to . Which single fix raises the most, and to what value?
Recall Solution
(a) . ✓ (b) Step — try each fix, keep the largest gain. Why? Fixing stage divides out (replaces it with ), so the new is . Dividing by the smallest gives the biggest jump.
- Fix shuffle (): .
- Fix train (): .
Fixing the shuffle (the smallest factor) wins → . Attack the smallest first.
L3.2 — Confounded comparison
Run A: lr=0.01, seed=1 → . Run B: lr=0.001, seed=7 → .
Someone claims "the lower learning rate gave ." Is this conclusion valid? What do you do?
Recall Solution
Step 1 — count what changed. Why? A causal claim about lr requires that only lr
differs. Here two things changed: lr and seed. The could be pure seed noise.
Step 2 — control the confounder. Re-run both learning rates with the same fixed seed
(and ideally several seeds, comparing the mean). Only then is the lr's effect isolated.
Conclusion: the claim is not yet valid — it is a confounded comparison. Tracking the
seed is precisely what lets you detect and fix this.
L3.3 — Hash diagnosis
Last week hash(train.csv) = a1b2c3. Today the identical training script logs
hash(train.csv) = ff9900 and accuracy dropped from to . Code SHA is unchanged.
Where is the fault, and how did tracking prove it in seconds?
Recall Solution
Step — compare fingerprints. Why? A content hash is a fingerprint: same bytes → same
hash, different hash → the bytes changed. Code SHA identical rules out a code change; the data
hash differing pinpoints the culprit.
Conclusion: the data was silently modified (someone re-exported train.csv). The metric
drop is a data problem, not a code bug. Without the logged hash this is a week of blind
debugging; with it, a two-second diff.
Level 4 — Synthesis
L4.1 — Design a minimal reproducible-run schema
Design the smallest record that lets a teammate (a) reproduce the run and (b) compare/reuse it. Justify every field directly from the arguments and outputs of — no decorative fields.
Recall Solution
Start from the run function
.
The minimal record is exactly its inputs and outputs — nothing else:
Note on naming: hyperparameters is the same axis the parent note logs as the config /
params field — I keep the full word here to stay tied to 's argument list.
Justification, field by field (each is an argument or output of , so none is decorative):
- drop
code_sha→ cannot pin the code argument; - drop
data_hash→ cannot reproduce after data drift (the data argument); - drop
hyperparameters→ cannot recreate the config argument; - drop
env_digest→ breaks after a library upgrade (see Docker and Containerization); - drop
seed→ the training stage has ; - drop
metrics→ cannot compare (output 1); - drop
artifacts→ cannot reuse the model (output 2).
What about run_id / timestamp / tags? These are not arguments or outputs of , so
by the "no decorative fields" rule they are excluded from this minimal schema. Real trackers
(MLflow, W&B) add them purely for lookup and indexing, not for reproduction — they are
convenience metadata, and the question asked only for what is strictly required by .
L4.2 — Hit a determinism budget
Your pipeline load→shuffle→train→eval has , so .
You may apply two fixes, each pushing a stage to : (i) seed the shuffle,
(ii) torch.use_deterministic_algorithms(True) for training. What is afterward, and what
theoretical maximum can this pipeline reach?
Recall Solution
Step — remove the two sub-unity factors. Why these two? They are the only stages with
; fixing them replaces the offending factors with .
The theoretical max is (all four stages deterministic). See
Random Seeds and Determinism in PyTorch for the exact PyTorch calls and
CUBLAS_WORKSPACE_CONFIG.
L4.3 — Cost-aware plan (the 80/20)
You have limited engineering hours. Rank these four actions by reproducibility-incident prevented per hour, cheapest wins first: (A) full bit-for-bit determinism across GPUs, (B) log config + git SHA, (C) log data hash, (D) log the seed. Give the ordering and the reason.
Recall Solution
Order (do first → last): B, C, D, then A. Why? B, C, D are each a one-line log call and together pin four of five axes — the parent's 80/20: cheap tracking prevents ~ of "cannot reproduce" incidents. A (bit-for-bit across hardware) is expensive, often infeasible, and buys the last, rarely-needed slice. Rule of thumb: log everything cheap first; chase full determinism only when the metric variance actually breaks a decision.
Level 5 — Mastery
L5.1 — Two pipelines, same average, different reproducibility
Pipeline X: . Pipeline Y: . (a) Show both have the same average stage quality. (b) Compute each . (c) Which is more reproducible, and what deep lesson does the gap teach?
Recall Solution
(a) Average X . Average Y . Equal. ✓ (b) . . (c) X wins (). Lesson: the product is dominated by its worst factor. Many mildly-imperfect stages (X) can beat one badly-broken stage (Y) even at equal average — a single caps everything. Reproducibility is a weakest-link quantity, not an average one. Kill the smallest before polishing the good ones.
L5.2 — Decide under a tolerance
Runs of the same config give accuracies . Your reproducibility tolerance is . A colleague says "these don't match, the pipeline is broken." Adjudicate.
Recall Solution
Step — measure the spread against . Why? Reproducibility means "metric within ", not bit-identical.
- Mean .
- Max deviation from mean . Full range band.
Verdict: every run is inside → the pipeline is reproducible by the agreed definition. The colleague is applying a bit-for-bit standard the project never chose.
L5.3 — Combine everything: full diagnosis
A prod retrain scores vs the logged . From the tracker you see: code_sha
identical, data_hash identical, seed identical, but env_digest differs (pandas
) and the pipeline's train stage has (GPU nondeterminism, tolerance
). Rank the two suspects and state your action plan.
Recall Solution
Step 1 — separate "in-tolerance noise" from "real regression". GPU nondeterminism at
produces run-to-run wobble, but only within — it cannot explain a drop.
So it is not the primary cause.
Step 2 — follow the one axis that changed. Diff the tracked axes: code_sha, data_hash,
seed are all identical, so those three arguments of are ruled out. Only env_digest
differs (pandas ). An unpinned environment is the classic silent breaker (the
parent's "it worked last Tuesday" catastrophe).
Ranking: (1) environment change — primary, and the only changed axis, large enough to
explain the full ; (2) GPU nondeterminism — secondary, bounded at noise, far too
small to be the cause.
Action: rebuild in the exact logged environment via the Docker
digest / locked requirements, retrain, and confirm accuracy returns to ; then
enforce env pinning in CI so it cannot recur.
Recall Final self-check (predict, then reveal)
Weakest-link rule ::: reproducibility is a product, so it is dominated by the smallest — fix that stage first. Confounded comparison fix ::: change one variable at a time; hold the seed fixed to isolate a hyperparameter's effect. Reproducibility definition to use in practice ::: metrics within , not bit-identical weights. First suspect for a big prod-vs-logged gap ::: the tracked axis that changed (often environment), not the scariest-sounding one. Why does the product formula assume independence ::: whole-pipeline reproduction is an AND of stage events; multiplying is exact only when those events do not share a hidden dependency (e.g. one global RNG).