Workspace/Lesson workspace
Loading progress
Training & research45 min

Package an experiment so another engineer can challenge it

Lesson 3 of 3
How to study this lesson

Read one section, trace the worked example, and try the knowledge check. Bookmark saves a shortcut; notes appear in My notebook. Mark lesson complete is your own assessment and does not mark its lab passed.

By the end, you can

  • Create a complete experiment manifest and result lineage.
  • Distinguish a runnable artifact from reproduced findings.
  • Write bounded contribution and limitation statements.

Reproducibility begins before the final run

An experiment is difficult to reproduce when important choices exist only in the author's memory. Record the code revision, dependency versions, model and tokenizer revisions, prompt templates, data manifest, split identifiers, decoding settings, hardware, and environment assumptions as the run starts. Store configuration in a machine-readable format and keep raw per-case outputs sufficient to recompute the reported metrics, subject to the data-handling rules of the project.

A run identifier should connect configuration, inputs, outputs, and analysis. Content hashes help detect whether a file or configuration changed, but a hash does not preserve the content by itself. Store or reference retrievable artifacts with appropriate access controls. If a hosted model can change behind an alias, record the identifier and date available to you and state the reproducibility limitation. Do not promise exact replay when the underlying service does not provide it.

Separate computation from interpretation

Make the evaluation program produce a structured result table with one row per independent case or a clearly defined lower-level unit. Let the analysis program consume that table to calculate aggregates, intervals, and figures. This separation makes it possible to correct a plotting bug without rerunning expensive model calls and to inspect whether missing cases or failures were handled consistently.

For an invented experiment, a result row might include case_id, variant, run_id, success, cost_units, latency_ms, and failure_category. Preserve the definition of success beside the code that evaluates it. A cached output is acceptable when its lineage is explicit and it was generated under the intended configuration. A manually edited success field without a documented adjudication process breaks the chain of evidence. Keep corrections visible and rerun the relevant analysis rather than silently replacing inconvenient observations.

A clean checkout is a real test

A useful artifact has a quick-start path that runs on a fresh environment, a small smoke dataset, and an expected output. Expensive experiments can have a separate full-reproduction command with stated hardware and time requirements. Avoid assuming that local absolute paths, private credentials, or unpublished data are available to a reviewer. Where redistribution is restricted, provide a permitted synthetic fixture and explain which scientific claims require the original data.

The reproducibility program described by Pineau and colleagues combines code availability, community reproduction, and explicit reporting practices. NeurIPS' checklist similarly asks authors to expose assumptions and limitations. These resources are prompts for concrete evidence, not badges to claim without an actual review. Running your own script twice establishes a narrower fact than an independent team reproducing the study. Name what was tested and by whom.

Write the claim at the strength of the evidence

Lead a research report with the question and the observed answer. A bounded statement might say that a retrieval policy reduced unsupported claims on a specified held-out collection under a fixed model-call budget, with the measured difference and uncertainty. If the cases were synthetic, say so in the same claim. If the experiment found no clear benefit, explain the observed effect and what alternatives remain plausible rather than calling the method useless everywhere.

A contribution statement should identify the artifact, mechanism, or insight the reader can reuse. Include limitations about population, labels, baselines, budget, and implementation. Distinguish established observations from hypotheses explaining them. A failure analysis that shows a confidence signal is miscalibrated on conflicting documents can be useful even without a new architecture. The strength of the work comes from the connection between a clear question, defensible evidence, and an honest conclusion.

Invite checks that could change the conclusion

Publish enough detail for someone to rerun the comparison or construct a stronger counterexample. Include the strongest baseline you evaluated, important ablations, the tuning budget, and representative failures. Explain why each omitted comparison was outside scope. Do not imply that omitted alternatives were tested and lost. When another engineer finds a discrepancy, preserve both configurations and investigate whether the cause is data, code, numerical behavior, or a changed service.

Finish with a research backlog tied to uncertainty: more independent cases, a missing language slice, a stronger baseline, or a cheaper verifier. This is more actionable than a vague call for future work. A well-packaged negative or conditional result can become a strong portfolio artifact because it demonstrates experimental judgment. Claims about publication acceptance, novelty, or career outcomes require evidence of their own and should never be inferred from having a polished repository.

Work through the code

Canonical JSON removes dictionary-key ordering as an irrelevant difference while preserving meaningful values. The demo does not capture a real git revision or model run. Store the actual manifest and result artifacts alongside their hashes so another person can inspect them.

experiment_manifest.py
python
import hashlib
import json

def digest(value):
    payload = json.dumps(value, sort_keys=True, separators=(",", ":"))
    return hashlib.sha256(payload.encode()).hexdigest()

manifest = {"code_revision": "example-rev-1", "model_revision": "fixture-model-1",
            "dataset_ids": ["e1", "e2", "e3"], "seed": 7,
            "settings": {"max_calls": 2, "temperature": 0.0}}
original = digest(manifest)
reordered = dict(reversed(list(manifest.items())))
changed = {**manifest, "settings": {"max_calls": 3, "temperature": 0.0}}
print("key order invariant:", original == digest(reordered))
print("budget change detected:", original != digest(changed))
outputs = [{"case_id": "e1", "success": True},
           {"case_id": "e2", "success": False}]
print("observed cases:", len(outputs))
print("scope: hashes detect change; retain the actual artifacts")
EXPECTED / ILLUSTRATIVE OUTPUT
key order invariant: True
budget change detected: True
observed cases: 2
scope: hashes detect change; retain the actual artifacts

Run Python snippets locally with the prerequisites named above. The module coding lab runs directly in your browser.

Pause and reason

A repository contains a result chart and a random seed, but no dataset snapshot, model revision, or per-case outputs. What can a reviewer verify, and what should the author add first?

Check your understanding

Your script runs twice with identical output on your machine. Which statement is warranted?

Your notes

Explain the mechanism in your own words. Add a failure you want to test.

Saved notes appear in your notebook

Go deeper with primary sources

Practice this module