Regularizing a Model-based Policy Stationary Distribution to Stabilize Offline Reinforcement Learning

Shentao Yang, Yihao Feng, Shujian Zhang, Mingyuan Zhou

Abstract

Offline reinforcement learning (RL) extends the paradigm of classical RL algorithms to purely learning from static datasets, without interacting with the underlying environment during the learning process. A key challenge of offline RL is the instability of policy training, caused by the mismatch between the distribution of the offline data and the undiscounted stationary state-action distribution of the learned policy. To avoid the detrimental impact of distribution mismatch, we regularize the undiscounted stationary distribution of the current policy towards the offline data during the policy optimization process. Further, we train a dynamics model to both implement this regularization and better estimate the stationary distribution of the current policy, reducing the error induced by distribution mismatch. On a wide range of continuous-control offline RL datasets, our method indicates competitive performance, which validates our algorithm. The code is publicly available.

Introduction

Offline Reinforcement Learning (RL) offers the promise of training intelligent agents using pre-collected, static datasets, bypassing the need for expensive or dangerous real-world exploration. However, the field is plagued by the "distribution mismatch" problem. When an agent is trained offline, it tends to favor actions that maximize its predicted rewards. If these actions lead to states not well-represented in the training data (out-of-distribution or OOD states), the agent's value function (Q-function) often produces overly optimistic estimates. This leads the policy to drift into "hallucinated" high-reward areas, resulting in failure during actual deployment.

While many existing approaches attempt to constrain the policy's immediate actions to match the dataset, they often fail to account for the long-term cumulative effect of these actions. A policy might appear safe in the short term but eventually drift into dangerous territory. This paper introduces a novel framework to address this by regularizing the policy's long-term stationary distribution.

Methodology: SDM-GAN

We propose Stationary Distribution Matching via GAN (SDM-GAN), a model-based approach designed to stabilize offline RL by ensuring the policy's long-term behavior remains within the support of the offline data.

1. Stationary Distribution Regularization

Unlike standard methods that penalize OOD actions at a single state, SDM-GAN regularizes the undiscounted stationary state-action distribution of the policy. By minimizing the distance between the policy’s long-term occupancy and the offline dataset's distribution, the agent is incentivized to stay within the "safe zone" of the data throughout the entire task duration.

2. Model-Based Estimation

Since the true stationary distribution of a policy cannot be measured without environment interaction, we utilize a learned dynamics model. We derive a tractable mathematical bound that allows us to estimate the distribution mismatch using short-term model rollouts combined with the offline data. This synergy allows the model to act as a proxy for the environment, providing the necessary data to estimate long-term occupancy.

3. GAN-based Optimization

To minimize the Jensen-Shannon Divergence (JSD) between the policy's distribution and the offline data, we employ a Generative Adversarial Network (GAN) framework. In this setup:

  • The Discriminator attempts to distinguish between state-action pairs from the offline dataset and those generated by the policy's simulated rollouts.
  • The Policy (Generator) is optimized to "fool" the discriminator, effectively learning to stay within the footprint of the real data.

4. Implicit Policies

Offline datasets often contain multi-modal behavior (e.g., different ways to solve the same task). Standard Gaussian policies often struggle here, as they tend to average these modes, leading to sub-optimal behavior. SDM-GAN utilizes an implicit policy—a noise-conditioned generator—capable of representing complex, multi-modal distributions, allowing the agent to capture the full diversity of successful behaviors in the data.

Experimental Evaluation

We evaluated SDM-GAN on the D4RL benchmark, focusing on three distinct domains:

  • Gym-MuJoCo: Standard locomotion tasks (HalfCheetah, Hopper, Walker2d).
  • Adroit: High-dimensional robotic hand manipulation (Pen, Door), characterized by sparse rewards and narrow data distributions.
  • Maze2D: Navigation tasks where data is often collected by non-optimal policies.

Key Results

SDM-GAN demonstrated superior robustness and performance, particularly in challenging domains:

  • High-Dimensional Success: On the Adroit pen-expert task, SDM-GAN achieved a score of 135.8, significantly outperforming established methods like CQL (95.9).
  • Stability Across Data Quality: The method remained stable across various data types, including medium, medium-replay, and expert datasets, showing more consistency than "DICE-style" occupancy-matching algorithms.
  • Ablation Insights: Our experiments confirmed that a rollout ratio of $f=0.5$ (balancing real and synthetic data) provided the optimal "sweet spot" for performance, offering enough augmentation to stabilize the Q-function without succumbing to model-induced errors.

Discussion and Limitations

While SDM-GAN provides a robust framework for stationary distribution matching, it is not without limitations. As a model-based method, its performance is inherently tied to the accuracy of the learned dynamics model; significant model errors can lead to regularization based on "hallucinated" dynamics. Additionally, the GAN-based architecture introduces increased training complexity and hyperparameter sensitivity (such as the rollout horizon $h$) compared to simpler model-free constraints.

Conclusion

SDM-GAN offers a powerful perspective on offline RL by shifting the focus from local action constraints to global stationary distribution matching. By combining a model-based bound with a GAN-based optimization strategy and implicit policies, we provide a method that is both theoretically grounded and empirically effective on complex, high-dimensional tasks. Future work will explore alternative distance metrics, such as Maximum Mean Discrepancy (MMD), to further refine the regularization process.

Summary updated

BibTeX
@misc{yang2022regularizing,
  author = {Shentao Yang and Yihao Feng and Shujian Zhang and Mingyuan Zhou},
  title = {{Regularizing a Model-based Policy Stationary Distribution to Stabilize Offline Reinforcement Learning}},
  year = {2022},
  eprint = {2206.07166},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.07166},
}
Figure