Abstract
Reinforcement Learning (RL) agents frequently encounter non-stationary environments where the underlying dynamics or reward functions change over time. Traditional experience replay methods, such as Prioritized Experience Replay (PER), often fail to distinguish between policy-driven learning progress and environment-driven shifts, leading to suboptimal sample efficiency. This paper introduces DEER (Discrepancy of Environment Prioritized Experience Replay), a framework utilizing a novel Discrepancy of Environment (DoE) metric. By isolating environment-induced changes in the value function, DEER enables agents to prioritize relevant past experiences and adapt to new conditions more effectively. Experimental results across MuJoCo benchmarks demonstrate that DEER outperforms state-of-the-art methods by up to 22% in extreme non-stationary scenarios.
Introduction
In standard Reinforcement Learning, agents store transitions in a replay buffer to improve sample efficiency. Prioritized Experience Replay (PER) typically uses Temporal Difference (TD) error as a proxy for the learning potential of a transition. However, in non-stationary environments—such as a robot experiencing mechanical wear or a changing navigation task—TD-error becomes a noisy signal. It fails to differentiate between "surprise" caused by an evolving policy and "surprise" caused by a fundamental shift in the environment. This ambiguity often results in the agent replaying obsolete data or neglecting critical transitions necessary for adaptation.
The DEER Framework
The authors propose the Discrepancy of Environment Prioritized Experience Replay (DEER) framework to address these challenges through a "detect and adapt" strategy.
Discrepancy of Environment (DoE) Metric
The core innovation is the DoE metric, which mathematically isolates the change in the Q-function specifically attributable to environmental shifts, independent of the agent's policy updates. This allows the system to quantify how much a past experience has been "invalidated" by the changing world.
System Architecture
The DEER framework operates in two main phases:
- Change Detection: A binary classifier monitors reward sequences within sliding time windows. A significant shift in reward distribution, detected via Jensen-Shannon divergence, triggers an environmental change flag.
- Adaptive Prioritization:
- Pre-change data: DEER prioritizes historical experiences with low DoE, identifying "stable" knowledge that remains valid despite the shift.
- Post-change data: During the transition period, high-DoE samples are prioritized to accelerate adaptation. Once the environment stabilizes, the system reverts to standard TD-error prioritization.
Experimental Evaluation
The DEER framework was evaluated using the MuJoCo Gymnasium suite, including Ant-v4, HalfCheetah-v4, Hopper-v4, and Inverted Double Pendulum-v4. Non-stationarity was simulated by introducing offsets to physical parameters (e.g., friction, joint damping) halfway through training, creating both "mild" (50% shift) and "extreme" (200% shift) scenarios.
Key Results
DEER demonstrated superior performance across all benchmarks, with an average improvement of 11.54% over existing state-of-the-art experience replay methods. In extreme scenarios, this advantage increased to 22.53%.
As shown in the performance plots, DEER-enabled agents exhibit a shallower performance dip and a significantly faster recovery trajectory following an environmental shift compared to competitors like PER or RB-PER. This suggests that isolating the "why" behind prediction errors allows for more strategic use of the replay buffer.
Discussion and Limitations
While DEER significantly improves robustness in non-stationary settings, it relies on reward-sequence shifts for change detection. In environments with sparse rewards, the detector may fail to trigger promptly. Additionally, the computational overhead of maintaining the binary classifier and calculating DoE, while manageable, is a factor for consideration. Future work may involve extending this logic to domains like autonomous driving or Large Language Models, where data drift is a persistent challenge.
By treating the environment as a dynamic target, DEER provides a more principled way for RL agents to navigate a changing world.
Summary updated