Abstract
We study the problem of off-policy policy optimization in Markov decision processes and develop a novel off-policy policy gradient method. Prior off-policy policy gradient approaches have generally ignored the mismatch between the state distribution of the behavior policy and the target policy, leading to biased gradient estimates. We introduce OPPOSD (Off-Policy Policy Optimization with State Distribution Correction), which utilizes a stationary distribution correction to achieve more accurate gradients. Our method employs a minimax density ratio estimation technique to handle the variance typically associated with importance sampling. Empirical results on a challenging HIV treatment simulator and the CartPole benchmark demonstrate that OPPOSD significantly outperforms existing off-policy actor-critic methods.
Introduction
In many real-world applications of reinforcement learning (RL), such as healthcare, education, or industrial control, it is often impractical or unsafe to allow an agent to learn through online trial and error. Instead, we must rely on "batch off-policy" learning, where the goal is to optimize a policy using a fixed dataset collected by a different "behavior policy" (e.g., historical medical records from human doctors).
The primary obstacle in this setting is distribution shift. While standard off-policy methods use importance sampling to correct for differences in action selection, they frequently ignore the fact that a new target policy would visit a different distribution of states than the behavior policy. If the training data lacks coverage of states that the optimal policy would visit, or if the gradient estimates fail to account for how actions change future state distributions, the learning process becomes biased and often fails to converge to a high-performing policy.
Methodology: The OPPOSD Algorithm
The authors propose OPPOSD to address the state distribution mismatch directly. The algorithm incorporates several key technical innovations:
- Stationary Distribution Correction ($w$): Rather than re-weighting entire trajectories—which leads to exponential variance—OPPOSD estimates the ratio of the stationary state distributions: $w(s) = d^\pi(s) / d^\mu(s)$. This ratio indicates how much more likely the target policy $\pi$ is to visit state $s$ compared to the behavior policy $\mu$.
- Augmented MDP and Support Mismatch: To handle cases where the behavior policy never visits certain states required by the target policy, the authors theoretically construct an augmented MDP with an absorbing state. This provides robust convergence guarantees even under mild support assumptions.
- Minimax Density Estimation: The estimation of the correction factor $w$ is framed as a minimax optimization problem within a Reproducing Kernel Hilbert Space (RKHS). This approach avoids explicit density modeling, which is often unstable, and keeps the variance of the gradient estimates manageable.
- Actor-Critic Integration: This $w$ estimator is integrated into a standard actor-critic framework. The "critic" learns the value function, while the "actor" uses the corrected gradient—weighted by $w(s)$—to update the policy parameters.
Key Insights: The Failure of Standard Off-Policy Gradients
A critical insight of this work is the identification of why standard methods like Off-PAC fail. The authors provide an illustrative "Hard Example" where a standard off-policy actor-critic can have a gradient of zero even when it is far from the optimal policy.
In the example shown in Figure 1, standard methods fail because they do not "realize" that changing an action at an early state (like $s_1$) would lead to a much more favorable distribution of states later on. By incorporating the state distribution correction $w(s)$, OPPOSD correctly identifies these long-term benefits, allowing it to escape local optima that trap other algorithms.
Experimental Results
The authors evaluated OPPOSD against several baselines, including Off-PAC, ACER, and SAC (adapted for batch settings), across two primary domains:
- CartPole-v0: A benchmark task where the agent must balance a pole. Using a challenging setup with random behavior data, OPPOSD was the only method to consistently reach the maximum reward of 200.
- HIV Treatment Simulator: A complex, 6-dimensional medical simulation modeling immune system responses to drug regimens. This environment is highly sensitive to policy changes and represents a high-stakes scenario for off-policy learning.
As shown in Figure 2, OPPOSD (orange) achieves a significantly higher value than the behavior policy and all other baselines. While methods like Off-PAC barely improve upon the historical data, OPPOSD successfully discovers a treatment policy that yields substantially better outcomes. Furthermore, the authors found a high correlation (0.71 to 0.80) between their estimated policy values and true on-policy values, confirming the accuracy of the $w$ correction.
Conclusion and Future Work
OPPOSD demonstrates that correcting for state distribution mismatch is not just a theoretical necessity but a practical requirement for successful batch RL. By using minimax density estimation to keep variance in check, the algorithm provides a stable and effective way to learn from fixed datasets. While currently formulated for infinite horizons, the method's success on truncated tasks suggests broad applicability. Future work may explore more flexible function approximators, such as deep neural networks, to further enhance the $w$ estimator in even higher-dimensional state spaces.
Summary updated