Section 11.43

Reproducibility versus repeatability

Definition

Repeatability is the agreement between results of the same measurement repeated under the same conditions: the same procedure, people, equipment and place, over a short time. Reproducibility is the agreement between results of the same measurement carried out under changed conditions, such as another team, another machine or another place, following the same method. The difference that matters is which conditions may change. Because fields use the words differently, a claim must state what is rerun, what may differ, and what counts as agreement.

The idea

A paper reports that a message handler takes 10.4 microseconds on average. A reader can check that claim in at least three ways. The authors can run the same program again on the same board next week. Another lab can take the authors’ source code, build it and run it on its own board of the same model. A third group can write its own handler from the paper’s description and measure it on its own workload. Each step changes more conditions, and each needs a different set of records.

Measurement science calls the first kind of agreement repeatability and the second reproducibility, and treats both as kinds of precision: how closely results agree when a measurement is done again. Computing adds a third word, replicability, for the third kind, but communities do not assign the words the same way. The Association for Computing Machinery (ACM) awards badges to published papers whose artifacts, the software, data and scripts behind the results, others have checked. In 2020 the ACM exchanged its meanings of reproducibility and replicability to match other sciences [481]. A careful claim therefore names the operation and the agreement criterion instead of relying on a label.

How it works

Step 1: name the goal as one of three operations.

Step 2: fix the identities of everything the goal holds constant. An identity must pick out exactly one thing: a commit identifier of a version-control system (software that records every version of the source code), not a repository address or a branch name, which moves; a cryptographic hash §5.1, a short fingerprint designed to make two distinct files with the same digest extremely hard to find, for each program and input file; exact version numbers for tools and libraries.

Step 3: record how varying inputs were made. Inputs drawn at random come from a pseudorandom number generator (PRNG): a deterministic algorithm §14.1 that expands a starting value, called the seed, into a long sequence of numbers that look random. The same generator, seed and library version give the same sequence every time, so recording all three turns random inputs into fixed ones. The same holds for the bootstrap §11.19, which draws thousands of random resamples from the data to compute a confidence interval §11.18: with the generator, seed and library version recorded, the interval can be recomputed exactly.

Step 4: record the conditions that can affect the result: hardware model and revision, clock settings, operating system or firmware version, temperature, radio environment, background load, and the measurement procedure itself, meaning the timing endpoints §18.1.6, the clock and its calibration §11.42, the warmup §11.27 and the exclusion rules.

Step 5: declare the agreement criterion before the rerun. A deterministic output, such as a built program file or the count of rejected messages for a fixed input, can be required to match exactly. A timing result cannot: rerunning it gives slightly different numbers every time, so agreement means that the difference between two results is small compared with their combined uncertainty.

Worked example

Exact agreement. A second lab builds the published source revision with the same toolchain §12.2. The SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output) hash of its program file equals the hash the authors published. Byte identity is the criterion here. Matching SHA-256 digests provide strong evidence of identical bytes when the published reference is authentic. A direct comparison of both files can establish exact byte equality. Getting such a match requires a reproducible build §13.8, one that produces identical bytes from identical source.

Statistical agreement. The authors report a mean latency of 10.4 microseconds with a standard error §11.15, the typical sampling error of a mean, of 0.2 microseconds. The second lab measures 10.9 microseconds with a standard error of 0.3 microseconds. The difference is 10.9−10.4=0.510.9 - 10.4 = 0.5 microseconds. For two independent results, the standard uncertainty §11.33 of the difference, its uncertainty expressed as a standard deviation §11.14, is 0.22+0.32=0.04+0.09=0.13≈0.36\sqrt{0.2^2 + 0.3^2} = \sqrt{0.04 + 0.09} = \sqrt{0.13} \approx 0.36 microseconds. The criterion, declared in advance, is agreement within 2 such uncertainties, a limit of 2×0.36=0.722 \times 0.36 = 0.72 microseconds. The 0.5 microsecond difference passes this compatibility check. Larger standard errors widen that acceptance threshold. To establish equivalence within a practical margin fixed in advance, the entire chosen confidence interval for the difference must fit inside the margin. For a margin of 0.2 microseconds, even the observed 0.5 microsecond difference lies outside. Demanding identical decimal digits would have declared a failure where nothing failed.

A seeded bootstrap. An analysis draws 10,000 bootstrap resamples with NumPy §12.29, the numerical library for the Python §12.23 language. It uses NumPy’s default generator, PCG64, a permuted congruential generator (PCG) with 128 bits of internal state that outputs 64-bit numbers, and the seed 12345. Rerunning the script with the same NumPy version, seed and data returns the same interval to the last digit. With the seed 12346 the endpoints move slightly, because 10,000 random resamples estimate the interval only approximately. That movement is a property of the method, not a failure to reproduce.

Stated precisely

A claim of reproducibility is complete when it states four things.

  1. The property reported, such as a mean latency or the hash of a file.

  2. What is held fixed, each item named by an exact identity.

  3. What may differ, such as the team, the individual board or the day.

  4. The agreement criterion.

For a deterministic computation, identical inputs, program and environment give identical outputs, and the criterion is equality. For a measurement with random variation, let x1x_1 and x2x_2 be two independent results with standard uncertainties u1u_1 and u2u_2, and let kk be a multiplier fixed in advance, called the coverage factor, commonly 2. The results agree when |x1−x2|≤ku12+u22.|x_1 - x_2| \le k \sqrt{u_1^2 + u_2^2}. Measurement science calls this metrological compatibility. Two correct measurements fail this test now and then by chance; with k=2k = 2 and errors that follow the bell-shaped normal distribution, about 5% of the time.

A pseudorandom generator’s output is a function of its inputs: with the generator algorithm GG, the library version vv and the seed ss fixed, the sequence of draws Gv(s)G_v(s) is fixed. Recording GG, vv and ss, or the generator’s full internal state, is enough to regenerate every draw.

Limits and common mistakes

Fix the seed before seeing the data. Different seeds give slightly different bootstrap intervals. An analyst who tries several seeds and keeps the interval that looks best has made a choice based on the result, a hidden form of the multiple comparisons problem §11.26: the more analyses are tried and selectively reported, the more likely a finding that is due to chance. A seed written into the analysis plan §13.17 in advance cannot be chosen that way.

A generator suited to resampling need not be suited to keys. Resampling needs draws that are evenly spread and free of patterns that could line up with the data; nobody is trying to predict the next draw. A cryptographic key needs unpredictability against an attacker who has seen other outputs, which a cryptographically secure pseudorandom number generator §5.27 (CSPRNG) is designed to provide. PCG64 does not claim that property, and researchers have shown how to recover its internal state from its outputs, after which every later output is predictable. Conversely, a generator that makes keys must never be seeded reproducibly.

A seed controls one generator’s draws and nothing else: not thread scheduling, interrupts §6.11, cache contents, radio interference or clock drift §6.18. Two runs with the same seed get the same inputs, not the same timings.

A library update can change how a sampling method turns the generator’s output into draws, so the same seed can give different resamples under another version.

Reproducible does not mean correct. A program with a unit-conversion error reproduces the same wrong number on every rerun; an independent implementation, which does not share the code, is more likely to expose the error.

Usage differs between fields. A 2019 report of the United States National Academies of Sciences, Engineering, and Medicine uses reproducibility for consistent results from the same input data, code and conditions of analysis, and replicability for consistent results from a new study that collects its own data [482].

Questions answered

Which artifacts, versions, inputs, and procedures are needed for each goal?

Each goal needs the records that let someone hold fixed what that goal holds fixed, plus a criterion for agreement declared in advance.

For every goal, state what may differ, such as the team, the individual board or the day, and the agreement criterion: exact equality for deterministic outputs such as a built file or a count, and agreement within a stated multiple of the combined uncertainty for timing measurements, which never repeat exactly. A seed fixes generated inputs and resamples, not the hardware’s timing.

Related entries: Measurement uncertainty (§11.33), External validity (§11.44), Internal validity (§11.45), Mechanism versus evidence (§1.37), Bootstrap (§11.19), CSPRNG (§5.27), Reproducible build (§13.8). Further reading: [28, 481, 482].