Why do I get different results when running the same code with the same input data?
02:40 23 Jun 2026

I am running the same program with the same input dataset and configuration, but I sometimes get different results each time I execute it. The differences are not minor rounding errors — the model performance or output can noticeably vary between runs.

I have already confirmed that:

  • The input data has not changed

  • The code has not been modified

  • The execution environment appears to be the same

However, the outputs are still inconsistent.

I would like to understand:

  • What are the most common reasons why identical code can produce different results across runs?

  • How can randomness in training processes (e.g., initialization, data shuffling, dropout, or hardware-level operations) affect reproducibility?

  • Can GPU computation or multi-threading introduce non-deterministic behavior even when everything seems fixed?

  • What are the best practices to ensure reproducible results in machine learning or data processing pipelines?

deep-learning