Abstract
Researchers often assume that different software implementations of the same Deep Reinforcement Learning (DRL) algorithm are interchangeable. This paper challenges that assumption by applying differential testing to popular DRL libraries. The study reveals that subtle code-level discrepancies lead to significant performance gaps and can even reverse the conclusions of scientific studies, highlighting a critical threat to reproducibility in the field.
Introduction
In the world of Deep Reinforcement Learning (DRL), researchers frequently swap between libraries like Stable Baselines3, RLlib, or CleanRL, operating under the assumption that "PPO is PPO" regardless of the underlying code. However, DRL is notoriously sensitive to "implementation matters"—tiny details not always found in the original math-heavy papers. This paper investigates the interchangeability assumption, exploring whether different implementations of the same algorithm produce consistent results and identifying the root causes of any observed discrepancies.
Methodology
The authors employ differential testing, a software engineering technique where multiple systems are given the same input to see if their outputs match. To adapt this to the stochastic nature of DRL, they utilized:
- Stratified Bootstrap Confidence Intervals (SBCI): A statistical method to aggregate results across many trials and environments to ensure that observed differences are statistically significant rather than just "luck of the draw."
- Manual Code Analysis: After identifying performance gaps, the authors performed a "deep dive" into the source code of the libraries to find specific logic-based divergences.
- Replication Study: They re-ran a well-known hyperparameter study using a different DDPG implementation to see if the original conclusions held up.
Experimental Setup
The study primarily utilizes the Atari 2600 benchmark suite, testing across 56 different games to ensure a diverse range of challenges, from simple games like Pong to sparse-reward tasks like Montezuma’s Revenge. For the replication study, they used the MuJoCo HalfCheetah environment, a standard for continuous control tasks.
Key Insights and Results
Performance Tiering and the "Butterfly Effect"
Implementations often fall into distinct "high-performing" and "low-performing" groups. For PPO, three libraries (Stable Baselines3, CleanRL, and Baselines) were vastly superior to others (RLlib and Tianshou) across the Atari suite. Discrepancies often stem from "API-based" or "logic-based" choices that aren't part of the core algorithm, such as how a library handles the maximum number of frames per episode or how it clips gradients.
Flipping Outcomes
The most alarming insight is that the choice of implementation can act as a confounding variable. In the replication study, using a different library changed the "ideal" hyperparameter settings for 2 out of 3 experiments. This suggests that prior "best practices" in DRL might only be optimal for one specific library.
Quantitative Findings
- PPO Discrepancies: The top three PPO implementations achieved superhuman performance in 50% of trials, while the bottom two achieved it in less than 15%.
- Significant Differences: Even among high-performing libraries, statistically significant performance differences were found in 9 out of 56 games.
- Replication Failure: In the DDPG study replication, the "optimal" network architecture and reward scale changed when the library was swapped, effectively invalidating the original study's general recommendations.
Conclusion
The authors argue that while DRL is non-deterministic, the community should not accept inconsistent implementations. They recommend that the DRL community shifts toward using larger environment suites and adopts differential testing as a standard part of the library development pipeline. Future work should focus on automated inconsistency localization to help developers identify and resolve these "silent" implementation bugs more efficiently.
Summary updated