Module: L2-M07 · Duration: ~105 min (estimate, including the independent exercise) · Previous: L04 · Next: L2-M08-L01 (module Capstone AI Evaluation Platform, not yet written)
1. Introduction
A number in a report is usable only if others know where it came from and can rerun it. Reports tend to fail in a few familiar ways: numbers typed by hand from a notebook, no configuration to rerun with, the prettiest slice promoted to the headline, a decision recorded as "auto-approved", and nowhere saying that this is a simulation. This lesson teaches how to build an experiment report from the plan (L01), the manifest and the pipeline results (L04): with the full configuration, numbers that can be recomputed from the data, confirmatory results kept apart from exploratory ones, deviations from the plan listed, and a decision recorded by a person with a name and a reason.
This is the product of the module: a reproducible experiment report. Every system is simulated; the sample report says so explicitly and the numbers do not describe a real model. The earlier policy still stands: the gate and the judge only flag, and a person decides.
2. Learning objectives
- Build a report from the plan, the manifest and the results, and lint its structure. Practice: §8.2 parts A and B, §8.3 (line 1).
- Recompute the report's numbers from the data and catch hand-typed numbers. Practice: §8.2 part C, §8.3 (line 2), §9 (TODO 1).
- Separate confirmatory results from exploratory results. Practice: §8.2 part B, §8.3 (line 5).
- Prove that a run is repeatable and point out which field the manifests differ in. Practice: §8.2 part D, §8.3 (line 4), §9 (TODO 2).
- Record deviations from the plan. Practice: §8.2 part E, §8.3 (line 6).
- Record the person's decision together with the limits of the conclusion. Practice: §8.2 parts A and C, §9 (TODO 1).
3. Prerequisites and tools
- L01 to L04 of this module; L2-M05 (human labellers and decisions), L2-M04 (the judge only flags). Code lab
code-labs/l2-m07. - Disambiguation. Reproducible here: rerunning the same code, config and data gives similar results, as defined by Pineau et al. [R1] (the lab is stricter: identical results, because all randomness comes from the seed). It is different from correct: an experiment can be perfectly repeatable and still wrong (a skewed dataset, a poor metric). It is also different from replication on new data.
4. Concept explanation
4.1 What a report needs so that others can rerun it
Pineau et al. define reproducibility as obtaining similar results to the paper, using the same code and data, and as a necessary step for checking reliability [R1]. The NeurIPS 2019 reproducibility checklist asks, among other questions, for a clear definition of the measure or statistic used to report results, error bars that are clearly defined, and results described with central tendency and variation [R1]; 36% of submissions marked the error-bar question themselves as "not applicable" [R1]. Miller proposes that every report state the number of questions and the standard error alongside the score, and that when comparing several models it add the paired difference, the standard error of the difference and the score correlation [R2]. From this the lab fixes the required parts of a report: the plan hash, the manifest_id and the results_digest, the dataset version and fingerprint, the two systems (pinned ids), the seed, the number of runs, the number of items, the primary result with its interval, p, the verdict, the deviations from the plan, the number of comparisons, the gate's decision, the person's decision, and the limits.
4.2 From the number in the report back to the data
build_report produces the primary result from analyze_pair on the pipeline's scores and stores every number as an exact fraction (decimal display only when reading). verify_report recomputes the difference, both bounds, the sign p-value and the verdict from the data and compares them for exact equality with the report, together with the manifest_id, results_digest, dataset, the two systems, the seed, the number of runs, the number of items and the n of the primary result; if the policy is also passed, the gate's decision too. A number typed by hand (or copied from another run) that is off by one digit is caught. lint_report checks something different: that the parts are present and of the right type. Two independent checks; a good report passes both.
4.3 Confirmatory or exploratory
Only one primary result is pre-registered (L01). The per-slice numbers (concept, check, hint, offtopic, pii) are exploratory: the report records status: exploratory and lint_report demands that label. The reason: five slices are five more comparisons; picking the prettiest slice is the winner's curse (L01 §5.2). Nosek describes pre-registration as a way to separate "prediction" results from "postdiction" results [R3] (abstract only). A noteworthy exploratory slice is a hypothesis for a later experiment with a new plan and new confirmation items, not a conclusion.
4.4 Deviations from the plan and the person's decision
deviations (L01 §5.3) compares the run with the frozen plan. A deviation is not a sin: the plan may have to change for real reasons. What is forbidden is changing it silently: the deviation must be in the report, with a reason. The decision (decided_by, decision, reason) is recorded by a person. lint_report rejects auto, bot, ci, gate, github-actions, an empty value, and an empty reason; it does not know whether the name is a real person. The gate returns an exit code; a person reads the report, looks at real error samples and signs.
5. Technical deep dive
5.1 Reading a sample report
The sample plan asks whether the small system S can replace A with a margin of 0.05. Run on v1, three runs per item, seed rp1: the difference S minus A is −0.135, interval [−0.178; −0.088], exact sign-test p below 0.001, verdict worse (the upper bound −0.088 is below −0.05); the gate gives FAIL; the person records "keep A" with the reason that the interval lies wholly below the margin. The report comes with five exploratory slices, an empty list of deviations (the automatic check only sees no deviations in the fields it checks) and the limit "simulated, one seed, one dataset version" (§8.2).
5.2 Reproducing from the manifest
reproduce(manifest) reruns the pipeline from manifest["config"] and compares config_hash, the dataset fingerprint, the simulator version, results_digest, the seed, the number of runs and the two systems: the result is (True, []). compare_manifests returns the names of the fields that differ; two runs with different seeds differ in config_hash, results_digest and seed, exactly as expected. The Python version is not part of the comparison. True means it can be rerun on this machine with this code, and it says exactly one thing: nothing is random apart from the seed. With a real model, exact repeatability is not guaranteed (L1-M06); the manifest still records what was run and with which model.
5.3 Structure lint and number check: two different nets
A forged copy has a hand-typed lo and decided_by: "ci": lint_report sees that the decision is not by a person (the number is still valid in shape), verify_report sees PRIMARY:lo (the structure is still complete). Both have blind spots: verify_report does not recompute the per-slice numbers, the list of deviations, the plan hash (it does not take the plan as input), the limits, or the content of the decision, and it checks the gate's decision only when given the policy; lint_report does not know whether the stated limits are appropriate, and an invented name still passes. The two checks shorten the path for the reader, and do not replace the reader.
6. The QA perspective
6.1 What a good report still does not guarantee
- It does not guarantee correctness: the dataset may be skewed, the metric may be poor, the labels may be wrong (L2-M02, L2-M03, L2-M05). Being repeatable proves nothing about that.
- It does not prove it was written beforehand: the plan hash is only worth something when recorded somewhere with a timestamp out of reach of the person running the experiment (L01 §4.1).
- One seed, one dataset: the conclusion does not extend beyond them; exploratory slices are suggestions.
- Simulation: every number describes the simulator; a real report must name the real system and the source of prices and latency.
- The reader: a report with all its parts can still lead to a bad decision; the signer is responsible, not the lint.
6.2 Checklist before sending
Numbers recomputable (verify_report is empty); structure complete (lint_report is empty); manifest_id checkable (check_manifest is empty) and reproduce correct; deviations with reasons; slices recorded as exploratory; the decision has a name and a reason; the limits mention the simulation, the seed and the dataset; no secrets or personal data in the report.
7. Real-world scenarios
Scenario 1 (fictional): "A number copied from a notebook". A report stated a lower bound of −0.05, copied from a run before the seed was changed. verify_report reported PRIMARY:lo. The team found the report had drifted from the last run by three days, regenerated it from the manifest and recorded the deviation.
Scenario 2 (fictional): "A decision recorded as ci". The pipeline filled in "keep A, decided by ci" by itself. The lint rejected it. The process changed: the gate returns an exit code; a person reads the report, records a name and a reason, and only then closes the ticket.
8. Hands-on tutorial
8.1 Setup
cd academy-content/code-labs/l2-m07
python3 -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -r requirements.txt
python -m pytest # 79 passed
8.2 Run the demo
python -m lab.demo l05
Output (copied from a real run on Python 3.14.6 and 3.12.14, 2026-11-04; the two versions give identical output). Every system is a simulation:
A. report lint: [] verify: [] deviations: []
B. report text (first lines):
# Comparison report PLAN-DEMO-01
**All systems and numbers are SIMULATED (educational lab).**
- Plan: `PLAN-DEMO-01` (hash `98a9a5db35ec`)
- Run: manifest `28744dc233b6`, results digest `608a80b713c7`
- Dataset: v1 (`51be75ec232c`), 200 items, 3 runs per item, seed `rp1`
- Baseline: `tutor-a-2026-03-01`; candidate: `tutor-s-2026-06-15`
## Primary result
pass_rate: candidate minus baseline = -0.135, 95% interval [-0.178, -0.088], n = 200 items, exact sign-test p = <0.001; practical verdict: **worse**.
C. forged copy: lint ['DECISION_NOT_BY_A_PERSON_WITH_A_REASON'] verify ['PRIMARY:difference']
D. reproduce from the manifest: (True, [])
another seed differs in: ['config_hash', 'results_digest', 'seed'] edited manifest: ['MANIFEST_ID_MISMATCH']
E. deviations when a run reports an unplanned metric and makes 3 comparisons: ['UNPLANNED_METRIC:rouge', 'MORE_COMPARISONS_THAN_PLANNED']
Reading the output: A is the sample report passing the lint, passing the number check and with no deviations. B is the start of the Markdown report, with the simulation label line and the primary result. C is a forged copy: the lint catches the auto decision, the number check catches the hand-typed difference. D is reproduction from the manifest, two different seeds and an edited manifest. E is the deviations when a run reports a metric outside the plan and makes three comparisons.
8.3 Try it yourself
Save it as try_l05.py in the lab's root folder (next to lab/, not inside lab/), run python try_l05.py, then delete the file:
import copy
from fractions import Fraction as F
from lab import data, design, gate as G, pipeline as P, report as R
plan = data.load_json("plan_example.json")
cfg = design.config_from_plan(plan, plan["candidates"][0], "rp1")
out = P.run_pipeline(cfg)
policy = {"margin": cfg["margin"], "min_n": 100, "min_slice_n": 20, "critical_slices": ["pii"], "slice_margins": {"pii": "1/100"}}
g = G.gate(G.result_dict(out, "base"), G.result_dict(out, "cand"), policy)
decision = {"decided_by": "the quality owner (a person)", "decision": "keep A", "reason": "interval wholly below -0.05"}
rep = R.build_report(plan, out, g, decision, ["Simulated systems: nothing here describes a real model."])
print(R.lint_report(rep), R.verify_report(rep, out), rep["primary"]["verdict"], g["decision"])
typed = copy.deepcopy(rep)
typed["primary"]["lo"] = str(F(-1, 20))
typed["decision"]["decided_by"] = "ci"
print(R.lint_report(typed), R.verify_report(typed, out))
text = R.render_markdown(rep)
print(text.splitlines()[0], "|", [l for l in text.splitlines() if l.startswith("pass_rate")][0][:60])
other = P.run_pipeline({**cfg, "seed": "rp2"})
print(P.compare_manifests(out["manifest"], other["manifest"]), P.reproduce(out["manifest"])[0])
print(sorted(rep["slices"]), rep["slices"]["pii"]["n"], rep["slices"]["pii"]["status"])
m = out["manifest"]
run = {"plan_hash": design.plan_hash(plan), "dataset_fingerprint": m["dataset"]["fingerprint"], "n_items": 200, "reps": 3,
"baseline": plan["baseline"], "candidate": plan["candidates"][0], "alpha": "1/20", "margin": "1/10", "test": plan["test"],
"reported_metrics": ["pass_rate"], "n_comparisons": 1}
print(design.deviations(plan, run))
Output (identical on Python 3.14.6 and 3.12.14):
[] [] worse FAIL
['DECISION_NOT_BY_A_PERSON_WITH_A_REASON'] ['PRIMARY:lo']
# Comparison report PLAN-DEMO-01 | pass_rate: candidate minus baseline = -0.135, 95% interval [
['config_hash', 'results_digest', 'seed'] True
['check', 'concept', 'hint', 'offtopic', 'pii'] 20 exploratory
['CHANGED:margin']
Reading it: line 1: the report is lint-clean, number-check-clean, with the verdict worse and the gate FAIL. Line 2: the hand-edited copy: the lint catches the decision-maker, the number check catches PRIMARY:lo. Line 3: the title and the start of the primary-result line of the Markdown. Line 4: two seeds differ in three fields, and reproduce is correct. Line 5: the slices and the exploratory label of the pii slice (20 items). Line 6: changing the run's margin to 1/10 gives CHANGED:margin.
8.4 Run the lesson's tests
python -m pytest tests/test_l05_report.py -v
Result: 8 passed. Read test_each_structural_defect_is_named, test_typed_in_numbers_that_do_not_match_the_data_are_caught and test_the_lint_cannot_tell_a_real_person_from_a_made_up_name. The tests run on in-memory values and the lab's data.
8.5 Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
MANIFEST_ID in verify_report |
The report is from a different run | Regenerate the report from the current manifest, record the deviation |
SLICE_NOT_MARKED_EXPLORATORY |
A slice lacks status: exploratory |
Add the label; to confirm it, write a new plan |
reproduce returns False |
The config, the simulator code or the dataset changed | Compare with compare_manifests; do not edit the manifest to make it match |
9. Independent exercise
Problem: Fix a draft report so every number can be recomputed from the data, and judge three manifests.
Requirements: complete exercises/test_l05_report.py:
- TODO 1:
FIXED_REPORT: a copy of the draft that has no remaining errors from eitherlint_reportorverify_report. Keep the plan hash, themanifest_id, theresults_digestand the content ofdecisionunchanged; put your name or role indecided_by. - TODO 2:
REPRODUCIBLE:{manifest name: True or False},Trueonly whencheck_manifestsees no errors andreproducefrom its own config gives the same result.
Test data: exercises/ex_config.json, exercises/ex_report_draft.json, exercises/ex_manifests.json (simulated; the draft has hand-typed numbers and is missing parts, three manifests: one from a real run and two corrupted copies).
Deliverable: the two variables above, in the file exercises/test_l05_report.py itself.
Acceptance criteria: python -m pytest exercises/test_l05_report.py passes (2 tests). The tests do not check whether the limits you write are sufficient and correct, or whether the person you name is real.
Hints: TODO 1: run lint_report and verify_report first and read each code; the right numbers come from P.run_pipeline and analyze_pair, not from estimates. TODO 2: a manifest can pass the hash check and still not be reproducible; try each one yourself.
10. Knowledge check
0/18 done · Results are kept in this browser only.
P02 · True or false
P04 · Select all that apply
P05 · Put in order
P06 · Match
P07 · Spot the bug
The function below is meant to check the primary result's lower bound in the report against the number recomputed from the data, but lets a hand-typed number through. Find the bug.
from fractions import Fraction
def primary_matches(report, lo):
return abs(float(Fraction(report["primary"]["lo"])) - float(lo)) < 0.001P08 · Short answer
A run of PLAN-PRAC-05 (the plan's margin is 1/50) reports margin 1/10, and also reports a metric rouge that is not in the plan; everything else matches the plan (pass_rate is reported). Which codes does deviations return, and what must the team do?
P09 · Essay
Write 5-8 sentences: the report of PLAN-PRAC-05 (simulated) has an empty lint_report, an empty verify_report, an empty check_manifest and reproduce returns (True, []). Primary result: B minus A = +0.015, interval [−0.027; 0.055], exact sign p 0.668, 200 items, 3 runs per item, seed q2, verdict unclear with margin 0.02. The ticket proposes "release B because the report is perfect". State what the report guarantees, what it does not guarantee, and the decision you recommend.
P11 · Recall
Lesson: L2-M07-L04P12 · Recall
Lesson: L2-M07-L01P13 · Multiple choice
P14 · Select all that apply
P15 · True or false
P16 · Fill in the blank
P17 · Recall
Lesson: L2-M05-L04P18 · True or false
11. Summary
- Concepts: reproducible is different from correct; a report from the manifest; numbers recomputed from the data; the primary result kept apart from exploratory ones; deviations from the plan; the person's decision; limits stated explicitly.
- Skills: building, linting and number-checking a report; comparing manifests; reproducing from the manifest; recording deviations.
- Traps: hand-typed numbers; the pretty slice made into the headline; an automatic decision; treating repeatable as correct; trusting the lint or the number check as enough.
- You can now: receive a comparison report and ask: which numbers can be recomputed, which manifest, which deviations, who decided and on what basis.
12. References
| ID | Title | Publisher | URL | Accessed | Relevance |
|---|---|---|---|---|---|
| R1 | Improving Reproducibility in Machine Learning Research (Pineau et al., 2020) | arXiv (v4) | https://arxiv.org/abs/2003.12206 | 2026-11-04 | Read the PDF text: the definition of reproducibility, the checklist questions quoted in the body, 36% "not applicable" for error bars; the full checklist (Figure 9) is an image, not readable as text |
| R2 | Adding Error Bars to Evals (Miller, 2024) | arXiv | https://arxiv.org/abs/2411.00640 (full-text PDF read: https://arxiv.org/pdf/2411.00640) | 2026-11-04 | Read in full: report the number of questions, the standard error, the paired difference, the correlation |
| R3 | The preregistration revolution (Nosek et al., 2018) | PNAS, via Europe PMC | https://doi.org/10.1073/pnas.1708274114 | 2026-11-04 | Abstract-only (Europe PMC API query): pre-registration separates prediction from analysis after the fact |
Key terms (English ↔ Vietnamese)
| English | Tiếng Việt |
|---|---|
| Reproducible | Lặp lại được: cùng mã, cấu hình, dữ liệu cho kết quả tương tự (khác đúng và khác nhân rộng) |
| Experiment report | Báo cáo thí nghiệm |
| Run manifest | Manifest lần chạy (L04) |
| Results digest | Mã băm của kết quả |
| Exploratory vs confirmatory | Khám phá / xác nhận |
| Deviation (from the plan) | Sai lệch khỏi kế hoạch, ghi cùng lý do |
| Recompute check | Kiểm số: tái tính số của báo cáo từ dữ liệu |
| Decision record | Bản ghi quyết định của người: tên, quyết định, lý do |