Abstract
Off-policy reinforcement learning (RL) is theoretically efficient because it allows agents to learn from a replay buffer of past experiences. However, in practice, these algorithms often suffer from state distribution shift: a mismatch between the states visited by the behavior policy (stored in the buffer) and those visited by the current target policy. This shift leads to unreliable value estimates and extrapolation error. We introduce a "StateKL" regularizer that constrains policy updates to minimize the divergence between behavior and target state distributions. By utilizing a Variational Auto-Encoder (VAE) to estimate state densities and coupling state features with the policy network, our approach enables differentiable optimization of the state distribution. Our results on MuJoCo benchmarks show that StateKL consistently improves performance and robustness for DDPG, TD3, and SAC, particularly when dealing with stale or delayed data.
The Challenge: State Distribution Shift
The primary hurdle in off-policy RL is ensuring that the agent's learning remains grounded in the data it has actually seen. While most existing methods focus on correcting for differences in actions (e.g., via importance sampling or action constraints), they often neglect the mismatch in states. If the target policy visits states that are absent from the replay buffer, the critic's value estimates for those states become highly inaccurate, leading to policy collapse.
Methodology: The StateKL Regularizer
To address this, we propose a novel constrained policy optimization method. The approach has two pillars:
- Density Estimation via VAEs: We use a Variational Auto-Encoder to estimate the state visitation frequency $d_\mu(s)$ of the behavior policy. To make this differentiable, the policy network outputs state features ($\psi$) which are then processed by the VAE.
- KL-Divergence Constraint: We modify the standard policy gradient objective by adding a KL-divergence penalty: $KL(d_\mu || d_\pi)$. This encourages the target policy $\pi$ to stay within a "trust region" of states visited by the behavior policy $\mu$.
By coupling the state features with the policy parameters, the agent can compute gradients through the density estimate, effectively "steering" the policy toward familiar state distributions during training.
Experimental Results
We evaluated StateKL on standard MuJoCo continuous control tasks, including HalfCheetah-v1, Hopper-v1, and Walker2d-v1.
Robustness to Delayed Data
A key finding is the method's robustness to "stale" data. In many real-world scenarios, the replay buffer may contain samples from policies that are significantly older than the current one. As shown in Figure 6, performance typically degrades as the "delay" in the buffer increases, representing a widening state distribution shift. The StateKL regularizer helps mitigate this degradation by preventing the policy from drifting into regions where the old data is no longer representative.
Replay Buffer Windowing
We also examined the impact of the "window" size—the range of past experiences included in the buffer. In environments like Hopper-v1 (Figure 4), using a smaller window of more recent (near on-policy) data generally yields higher returns. StateKL allows for more stable learning even as this window expands, by explicitly managing the resulting distribution shift.
Conclusion
By moving beyond action-only constraints and directly addressing state distribution shift, the StateKL regularizer provides a more robust framework for off-policy RL. This approach not only improves performance on standard benchmarks but also enhances the reliability of agents learning from delayed or fixed datasets, a crucial step toward practical offline RL.
Summary updated