Abstract
Reinforcement learning in non-stationary environments presents a significant challenge: agents must balance learning from historical data with the need to adapt to shifting reward and transition dynamics. This paper introduces SW-UCRL (Sliding Window Upper Confidence Bound for Reinforcement Learning), an algorithm that utilizes a sliding window to "forget" stale observations. We prove that SW-UCRL achieves a regret bound of $O(T^{2/3})$, improving upon the state-of-the-art for switching Markov Decision Processes (MDPs). Empirical results on synthetic switching-MDPs confirm that SW-UCRL adapts more rapidly to abrupt changes than traditional restart-based approaches.
Introduction
In classical Markov Decision Processes (MDPs), the environment's transition and reward functions are assumed to be stationary. However, real-world applications—such as online advertising or financial modeling—often involve non-stationary dynamics where user preferences or market conditions shift over time. In these scenarios, a standard agent that accumulates all historical data may eventually be misled by obsolete information.
The fundamental challenge in non-stationary RL is the trade-off between sample efficiency and adaptability. Using too much historical data leads to bias from stale information, while using too little data prevents the agent from learning an effective policy. This paper addresses the problem of minimizing regret—the difference between the agent's accumulated reward and that of an optimal oracle with prior knowledge of the environment's changes.
Methodology: The SW-UCRL Algorithm
The authors propose SW-UCRL, a modification of the UCRL2 algorithm designed for non-stationary environments. The core innovation is the integration of a sliding window mechanism.
Key Features
- Sliding Window Mechanism: Unlike standard algorithms that store all past observations, SW-UCRL only considers data from the most recent $W$ time steps. This serves as an automated forgetting mechanism, ensuring that the agent's model is built on relevant, recent data.
- Optimism in the Face of Uncertainty: The algorithm maintains a set of plausible MDP models consistent with the data in the current window. It then selects the policy that maximizes the expected reward across this set of models.
- Episode Management: To maintain computational efficiency while remaining responsive, SW-UCRL operates in episodes. An episode concludes, triggering a policy update, whenever the number of visits to any state-action pair within the current window doubles.
- Optimal Window Tuning: The authors derive an optimal window size $W^*$ that depends on the total time horizon $T$, the number of changes $l$, and the MDP's complexity (number of states $S$, actions $A$, and diameter $D$).
Experimental Setup
The algorithm was evaluated using synthetic switching-MDPs to test its performance under controlled non-stationarity.
- Environment: A 5-state, 3-action MDP.
- Dynamics: Transition probabilities and rewards were programmed to change abruptly at regular intervals (e.g., every $T/l$ steps).
- Scale: Simulations spanned $T = 100,000$ steps, with results averaged over 1,000 independent trials to ensure statistical robustness.
Results and Analysis
The theoretical analysis shows that SW-UCRL achieves a regret bound of $O(l^{1/3} T^{2/3} D^{2/3} S^{2/3} (A \log T)^{1/3})$. This represents a significant improvement over previous "UCRL2 with restarts" methods, particularly in how the regret scales with the state space complexity ($S^{2/3}$ vs. $S$).
As seen in the experimental results, SW-UCRL consistently outperforms its competitors. The "bumps" in the regret curves correspond to the moments when the environment's dynamics shift. While every algorithm experiences a temporary spike in regret following a change, SW-UCRL flattens these curves significantly faster, demonstrating superior adaptability.
Key Insights
- Forgetting as a Feature: In non-stationary RL, memory can become a liability. The sliding window approach allows for a smoother transition between environment states compared to abrupt restarts.
- The $T^{2/3}$ Target: While stationary MDPs can achieve $O(\sqrt{T})$ regret, the authors demonstrate that $T^{2/3}$ is the achievable target in adversarial or switching environments when the window size is correctly tuned.
Conclusion and Future Work
SW-UCRL provides a robust framework for reinforcement learning in dynamic environments. By replacing indefinite data accumulation with a sliding window, it achieves tighter theoretical bounds and better empirical performance than existing methods.
However, several avenues for future research remain:
- Parameter Knowledge: Setting the optimal window size currently requires prior knowledge of the number of changes $l$ and the horizon $T$. Developing a parameter-free version with similar bounds is a key challenge.
- Gradual Changes: While optimized for abrupt "switches," the algorithm's performance in environments with slow, continuous drift remains to be fully explored.
- Refined Triggers: Future iterations might replace the doubling-visit criterion with performance-based triggers to further optimize the timing of policy updates.
Summary updated