Deterministic Implementations for Reproducibility in Deep Reinforcement Learning

Prabhat Nagarajan, Garrett Warnell, Peter StonearXiv 2018

Introduction: The Reproducibility Crisis in DRL

Deep Reinforcement Learning (DRL) is notoriously difficult to reproduce. Unlike other scientific fields where identical experimental setups yield identical results, DRL agents trained with the same hyperparameters often exhibit wildly different performance. This paper investigates the root causes of this variance, identifying a "cascading effect" where minor initial noise—such as GPU floating-point errors or random seeds—explodes into massive performance swings as the agent interacts with its environment.

Methodology: Achieving Bit-Wise Replicability

To isolate the sources of variance, the researchers developed a fully deterministic implementation of the Deep Q-Learning (DQN) algorithm using PyTorch. Achieving true replicability (getting the exact same numbers across runs) required "locking down" five primary sources of randomness:

  1. GPU Operations: Forcing deterministic algorithms for atomic operations.
  2. Environment: Controlling stochasticity (e.g., "sticky actions") in the Arcade Learning Environment (ALE).
  3. Policy: Seeding the $\epsilon$-greedy exploration mechanism.
  4. Network Initialization: Ensuring identical starting weights.
  5. Minibatch Sampling: Seeding the replay buffer to ensure identical training sequences.

By establishing a zero-variance baseline, the authors could perform a sensitivity analysis, re-introducing one source of noise at a time to measure its specific impact on the agent's learning trajectory.

Key Insights: The Impact of "Negligible" Noise

The study reveals that factors often dismissed as minor have profound effects on agent training.

Impact of GPU nondeterminism on training variance.

A critical finding is the role of GPU Noise. Researchers frequently ignore nondeterminism in libraries like cuDNN as negligible. However, this study demonstrates that enabling nondeterministic GPU operations alone leads to a 12.41% relative standard deviation in final scores. This occurs because DRL learns from a nonstationary distribution; a single different calculation changes the agent's policy, which changes its future experiences, creating a divergent "life trajectory."

Furthermore, Network Initialization emerged as the most volatile factor. The "luck of the draw" in starting weights accounted for a 43.61% relative standard deviation, suggesting that many reported DRL successes may be artifacts of favorable initializations rather than algorithmic superiority.

Experimental Results

The researchers evaluated their methods on the Atari game Breakout using a robust protocol of 100 unique start sequences to ensure evaluation was not just a result of memorization.

Comparison of training curves across different sources of nondeterminism.

The following table summarizes the final performance and variance across five runs for each noise source:

Metric (Final Score) Deterministic GPU Noise Environment Noise Initialization Noise
Average Score 146.7 126.5 29.0 108.6
Rel. Std. Deviation 0.0% 12.41% 37.65% 43.61%

The results highlight that while a deterministic implementation can eliminate variance, external factors like environment stochasticity significantly degrade both average performance and stability, making the agent's task much harder.

Conclusion and Future Directions

This work underscores that deterministic implementations are a prerequisite for understanding DRL algorithm behavior. However, the authors warn of a "replicability gap": even with deterministic code, changes in hardware architecture or library versions can still cause results to diverge. Future research should extend this analysis to continuous control tasks and actor-critic methods to determine if these sensitivities are universal across the DRL landscape.

Summary updated

BibTeX
@misc{nagarajan2018deterministic,
  author = {Prabhat Nagarajan and Garrett Warnell and Peter Stone},
  title = {{Deterministic Implementations for Reproducibility in Deep Reinforcement Learning}},
  year = {2018},
  eprint = {1809.05676},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1809.05676},
}
Figure