ML reproducibility

Also known as: reproducible machine learning

On this page 8

ML reproducibility is the ability to rerun a machine learning experiment, training job or evaluation and obtain the same model and the same results from a recorded set of inputs: code, data, configuration, environment and randomness. In MLOps & deployment, reproducible machine learning is the property that lets a team explain, audit, debug and safely retrain any model that reaches production.

Reproducibility is not a single tool but a discipline of capturing every input that influences a model. When one input is left unrecorded, such as a library version or a random seed, two runs that look identical can produce measurably different weights and metrics, and nobody can say which version is correct.

What must be captured to reproduce a model

A model is reproducible only when all five input classes are pinned and traceable. Code alone is never enough, because the same script trained on a different data snapshot or a different CUDA and cuDNN build produces a different artifact.

The following table lists each input class, what must be recorded and the typical tooling used to record it.

Input classWhat to recordTypical mechanism
CodeExact commit hash, uncommitted changes refusedGit, tagged releases
DataImmutable snapshot or content hash of every datasetData versioning, DVC, lakehouse time travel
ConfigurationHyperparameters, feature lists, preprocessing optionsVersioned YAML, experiment tracker
EnvironmentPython packages, drivers, CUDA, hardware typeLock files, container image digests
RandomnessSeeds for every generator and data shuffling orderSeed registry, deterministic flags
Inputs that determine a trained model

These records are linked through model lineage and stored in an ML metadata store, so that any registered model artifact can be traced back to the exact commit, dataset version and image digest that produced it.

Levels of reproducibility in machine learning

Practitioners distinguish several levels of reproducibility, because exact equality is expensive and not always necessary. The right target depends on regulatory exposure, model size and how results are consumed.

LevelGuaranteeTypical cost
Bitwise reproducibilityIdentical weights and outputs, byte for byteHigh: deterministic kernels, fixed hardware
Numerical reproducibilityMetrics equal within a small toleranceModerate: pinned environment and seeds
Statistical reproducibilitySame conclusion across several seedsModerate: repeated runs, confidence intervals
Conceptual replicabilitySame finding with new data or new codeLow tooling cost, high research effort
Common reproducibility levels and their guarantees

Most production teams aim for numerical reproducibility with a documented tolerance, for example an AUC difference below 0.001, and reserve bitwise guarantees for regulated models where auditors may request an exact rebuild.

Sources of nondeterminism in training

Even with fixed seeds, training is often nondeterministic by default. Parallel GPU reductions use atomic floating-point additions whose order changes between runs, and floating-point addition is not associative, so tiny rounding differences accumulate across millions of steps.

  • Non-deterministic GPU kernels, such as some convolution and scatter operations, chosen by autotuning for speed.
  • Data loader parallelism, where multiple worker processes deliver batches in a varying order.
  • Distributed training, where the number of devices changes gradient aggregation and batch composition.
  • Mixed precision, where reduced-precision arithmetic amplifies small numerical differences.
  • Unpinned dependencies, where a minor library upgrade changes a default value or an algorithm.

Frameworks expose deterministic modes, such as deterministic algorithm flags and disabled kernel autotuning, but these modes usually slow training by a noticeable margin, often between 10 and 50 percent depending on the model and hardware.

How reproducibility relates to neighboring MLOps practices

Reproducibility is the foundation that other MLOps practices rely on rather than a separate stage. The table shows how it differs from closely related concepts in the same field.

ConceptMain questionRelation to reproducibility
Model lineageWhere did this model come fromRecords the inputs that a rebuild needs
Data versioningWhich data did the run useSupplies the immutable data snapshot
Continuous trainingWhen is the model retrainedDepends on reproducible pipelines to compare runs
Model rollbackCan a previous model be restoredRequires stored artifacts, not a rebuild
ML testingDoes the model behave as expectedNeeds stable baselines to detect regressions
Reproducibility compared with related practices

A useful distinction is that rollback restores an artifact, while reproducibility recreates it. Teams need both, because stored artifacts can be lost or corrupted, and a rebuild proves that the recorded lineage is complete.

Building reproducible pipelines in practice

Reproducibility is achieved most reliably when it is enforced by the pipeline rather than by personal discipline. A training pipeline should refuse to start from uncommitted code, resolve every dataset to a hash and run inside a container referenced by digest, not by a mutable tag such as latest.

  1. Run training only through an orchestrated pipeline, never from an interactive notebook for registered models.
  2. Log the commit, data hashes, configuration, image digest and seeds automatically for every run.
  3. Register the resulting model artifact with its lineage before any model promotion.
  4. Schedule a periodic rebuild test that retrains a reference model and compares metrics within tolerance.

Tools such as DVC, Kedro, Metaflow, ZenML and Kubeflow provide pieces of this chain, but none guarantees reproducibility alone. The decisive factor is completeness of capture: a pipeline that records everything except the feature store snapshot is still not reproducible.

Limitations and common mistakes

Some inputs are inherently hard to freeze. External APIs, live feature stores, third-party pretrained weights and data subject to deletion requests can change after a run, so teams must snapshot or cache them at training time or accept a documented gap.

SymptomLikely causeFix
Metrics differ on rerunUnseeded shuffling or GPU nondeterminismSeed all generators, enable deterministic mode
Rebuild fails months laterMutable image tag or deleted packagePin image digests, mirror dependencies
Model differs across clustersDifferent GPU type or device countRecord hardware, fix the distributed setup
Training data cannot be foundOverwritten tables without versioningUse immutable snapshots or time travel
Frequent reproducibility failures

A common misconception is that fixing one random seed is sufficient. In reality, frameworks maintain several independent generators, and the data pipeline, the model initialization and dropout may each draw from a different one.

A non-technical view

Think of a model as a cake. To bake the same cake again, you need the same recipe, the same ingredients, the same oven and the same timing. ML reproducibility means writing all of that down. Then anyone can bake the cake again and get the same result.

If one detail is missing, the second cake turns out slightly different. Nobody can then tell which cake is right. Recording every ingredient is what makes a model trustworthy and easy to fix later.

A concrete example

A bank uses a credit scoring model that was trained eighteen months earlier. A regulator asks the bank to show exactly how the model reached its approval threshold. Because the training pipeline logged the Git commit, the dataset snapshot hash, the container image digest and all seeds, the MLOps team retrains the model on the original snapshot in a dedicated environment.

The rebuilt model matches the registered one within an AUC tolerance of 0.0005, and the predictions on a held-out audit set are identical after rounding. The team hands the auditors the lineage record and the comparison report. The audit closes without findings, and the same rebuild process now runs quarterly as a routine test.