Numerical Reproducibility Across Platforms
The same code can give different last digits on different machines; understanding why is the key to reproducing results anywhere.
Bit-for-Bit Is Not Free
Running identical source code on two computers can yield slightly different numbers. This is not a bug in the usual sense; it follows from how floating-point arithmetic interacts with compilers, hardware, and parallelism. Expecting bit-for-bit identity across platforms without effort is a common and costly misconception.
Where the Differences Come From
- Non-associative arithmetic: (a+b)+c differs from a+(b+c) in the last bits, so reordering changes results.
- Parallel reductions: summing in a different order across threads gives a different sum.
- Fused multiply-add: hardware that computes a*b+c in one rounded step differs from two steps.
- Compiler optimization: aggressive flags reorder operations for speed.
- Different math libraries: transcendental functions round differently.
Two Kinds of Reproducibility
Bitwise reproducibility demands identical bits and requires pinning the environment and constraining operation order, often at a performance cost. Tolerance reproducibility accepts agreement within a stated numerical tolerance and is usually the right, achievable goal for scientific work. Choosing which one a result needs is part of specifying it.
Achieving It
Tolerance reproducibility is reached by recording the environment, fixing random seeds, and validating that results agree within a documented tolerance across platforms. Bitwise reproducibility additionally requires fixed thread counts, deterministic reductions, and controlled compiler flags. The stronger guarantee is reserved for cases where it is genuinely needed, such as exact audit reproduction.
At Kronos
Reproduction runbooks distinguish a bitwise tier from a tolerance tier, so an independent party knows which digits to expect to match and which are legitimately platform-dependent. This keeps an honest boundary between a real discrepancy and harmless rounding.