← All writing
Evaluation · 5 min read · 24 Nov 2026

Why Two Runs of the Same Script Can Disagree

Same code, same data, same config, different results. Here is what actually varies underneath, and how to stop it from derailing your evaluation.

Cover image for the article: Why Two Runs of the Same Script Can Disagree

The quiet problem nobody mentions in the README

You run a training script, get 91.4% validation accuracy, run it again with no changes, and get 90.7%. Nothing in the code changed, the data file is identical, the config is the same YAML. This is not a bug in the usual sense, it is a feature of how modern training stacks are built. The uncomfortable truth is that very few training pipelines are actually deterministic end to end, even when everyone assumes they are because a seed was set somewhere near the top of the script.

This matters more than it looks. If your reported number depends on which run happened to land in the terminal history, then a single-run comparison between two models is not really evidence of anything. A difference of half a point between a baseline and a new idea can easily sit inside the natural run-to-run spread, and if you only ever ran each model once, you have no way of knowing whether you found a real improvement or just a lucky seed.

What actually varies: the usual suspects

The first and most obvious source is the random seed controlling weight initialisation, dropout masks, and data shuffling order. Setting seed=42 in Python and NumPy is necessary but rarely sufficient. Many frameworks keep separate random number generators for different libraries, and unless you seed all of them (Python's own random module, NumPy, and the deep learning framework's own generator), some part of the pipeline is still drawing fresh randomness each time.

Second, GPU computation itself introduces nondeterminism that has nothing to do with seeding. Operations like atomic additions in parallel reductions, certain convolution algorithms, and multi-threaded data loading can produce results that differ in the last few decimal places depending on the order floating point operations happen to execute in. On a single run this sounds negligible, perhaps a difference in the fifteenth decimal place of a loss value. But training is an iterative process: a tiny difference at step one nudges the gradient at step two, which nudges the weights slightly differently, and after a few thousand steps those microscopic rounding differences have compounded into a visibly different model.

Third, there is the data pipeline. If you shuffle the training set with a different seed, or if your data loader uses multiple worker processes that interleave batches in a nondeterministic order, two runs will see examples in different sequences. Early training is especially sensitive to batch order because the first few updates set the trajectory the optimiser follows; a different early batch can push the model into a different region of the loss surface entirely, not just a slightly different point in the same region.

Fourth, library and hardware versions matter more than people expect. A minor update to a numerical library can change the exact sequence of floating point operations in a matrix multiplication, which, combined with the compounding effect above, is enough to shift final metrics by a noticeable margin even with seeds fixed. Running the same script on a different GPU model, or even the same model with a different driver version, can do the same.

gpu server rack

A concrete worked example

Suppose you train a text classifier five times with everything fixed except that you allow ordinary GPU nondeterminism (no special deterministic flags set). You record validation accuracy each time: 88.9%, 89.6%, 88.3%, 89.2%, 89.9%. The mean is about 89.2%, with results spreading across a range of 1.6 points. Now imagine a colleague proposes a tweak, say a different learning rate schedule, and reports a single run at 89.8%, claiming an improvement.

Looking at the spread above, 89.8% sits comfortably inside the range your original method already produced by chance alone. The honest conclusion is not that the tweak failed, it is that one run tells you almost nothing. The only way to know whether the schedule genuinely helps is to run the new method multiple times too, report a mean and a spread (standard deviation, or a confidence interval if you have enough runs), and compare distributions rather than single points. If the new method's five runs come out at 90.1%, 90.4%, 89.9%, 90.6%, 90.2%, with a mean of 90.2% and a tighter spread, that is a far more convincing case for a real effect than any single comparison could be.

This is exactly the same logic used when comparing any two noisy measurements: you do not conclude a coin is biased from one flip, and you should not conclude a model is better from one training run, especially once you know the baseline's own repeated runs already wobble by more than the claimed improvement.

What to actually do about it

Full bitwise determinism is achievable in most frameworks but it usually costs training speed, since deterministic algorithms for convolutions and reductions tend to be slower than their nondeterministic counterparts. For most research and applied work, chasing perfect determinism is the wrong trade-off. The better habit is to accept that variance exists and to measure it rather than hide from it.

In practice that means training every configuration you care about across several seeds, typically three to five for exploratory work and more if the decision is important, reporting the mean and spread rather than a single number, and being explicit in writeups about which library versions and hardware were used. It also means treating a reported improvement with suspicion if no variance information is given alongside it, because a single favourable number is cheap to produce and easy to cherry-pick, even unintentionally, by running an experiment a few times and reporting only the best one.

None of this requires exotic tooling. A short loop that reruns training with seeds 0 through 4, logs results to a simple table, and reports mean plus standard deviation will catch the large majority of false conclusions that come from single-run comparisons. The discipline is cheap; the alternative, believing in an improvement that was really just noise, is expensive once it shapes further decisions.

laptop showing training graph
← All writing See the project case studies →