Online Reinforcement Learning in Non-Stationary Context-Driven Environments
Pouya Hamadanian, Arash Nasr-Esfahany, Malte Schwarzkopf, Siddartha Sen, Mohammad Alizadeh
TL;DR
This paper tackles online reinforcement learning in non-stationary, context-driven environments where the environment dynamics shift with exogenous contexts, causing catastrophic forgetting. It introduces Locally Constrained Policy Optimization (LCPO), an on-policy method that anchors policy outputs on past experiences using out-of-distribution samples to constrain updates for current contexts, thereby reducing forgetting without requiring task labels. LCPO integrates reservoir-buffered old experiences, an OOD difference detector, and a KL-based optimization constraint to bound policy changes, achieving performance close to a prescient offline agent across a suite of Mujoco, classic control, and computer-systems tasks. The approach demonstrates strong robustness to detector thresholds and buffer sizes, and its code is publicly available, making it a practical tool for real-world non-stationary RL deployments.
Abstract
We study online reinforcement learning (RL) in non-stationary environments, where a time-varying exogenous context process affects the environment dynamics. Online RL is challenging in such environments due to "catastrophic forgetting" (CF). The agent tends to forget prior knowledge as it trains on new experiences. Prior approaches to mitigate this issue assume task labels (which are often not available in practice), employ brittle regularization heuristics, or use off-policy methods that suffer from instability and poor performance. We present Locally Constrained Policy Optimization (LCPO), an online RL approach that combats CF by anchoring policy outputs on old experiences while optimizing the return on current experiences. To perform this anchoring, LCPO locally constrains policy optimization using samples from experiences that lie outside of the current context distribution. We evaluate LCPO in Mujoco, classic control and computer systems environments with a variety of synthetic and real context traces, and find that it outperforms a variety of baselines in the non-stationary setting, while achieving results on-par with a "prescient" agent trained offline across all context traces. LCPO's source code is available at https://github.com/pouyahmdn/LCPO.
