Constrained Policy Optimization with Explicit Behavior Density For Offline Reinforcement Learning

Jing Zhang, Chi Zhang, Wenjia Wang, Bingyi Jing

Introduction

Offline reinforcement learning (RL) holds immense promise for learning optimal policies entirely from static datasets, bypassing the need for costly or dangerous environment interactions. However, this paradigm introduces a critical challenge: distribution shift (or extrapolation error). When an agent evaluates actions that are absent from the training data (Out-of-Distribution or OOD actions), the Q-function often wildly overestimates their value, tricking the agent into adopting a catastrophic policy.

To mitigate this, existing methods typically either artificially lower the Q-values of unknown actions (pessimistic Q-learning) or force the learned policy to stay extremely close to the dataset's original behavior policy (policy control). Unfortunately, these methods usually rely on implicit distance metrics (like Maximum Mean Discrepancy) or lower-bound density estimators (like Variational Autoencoders). Because these estimators are imprecise, the resulting algorithms are forced to be overly conservative. They restrict the agent to a tiny neighborhood around the training data, preventing it from discovering optimal policies that might lie in unobserved, yet perfectly safe, regions of the state-action space.

Conceptual comparison of safe areas

The CPED Approach

To overcome the pitfalls of overly conservative exploration, the authors propose CPED (Constrained Policy optimization with Explicit Behavior Density). The core idea is to map out the exact boundaries of the safe state-action space so the agent can explore freely within it, rather than being artificially tethered to individual data points.

Key techniques driving CPED include:

  • Flow-GAN for Explicit Density Estimation: Instead of using VAEs (which are prone to mode-collapse) or standard GANs (which generate samples but lack explicit probability densities), CPED employs a Flow-GAN. This architecture combines normalizing flows—which provide exact, invertible density functions—with a GAN framework to accurately model the behavior policy's distribution.
  • Hybrid Loss Function: The Flow-GAN is trained using a hybrid objective that combines maximum likelihood estimation (MLE) with an adversarial GAN loss. This ensures a highly accurate and robust model of the behavior policy's density.
  • Density-Constrained Policy Optimization: During actor-critic training (built upon the TD3 framework), CPED restricts the actor's updates to a explicitly defined "safe region." This region encompasses any state-action pair where the Flow-GAN's estimated density exceeds a specific threshold ($\epsilon$).
  • Dynamic Constraint Relaxation: To balance safety and exploration, the algorithm uses a time-varying Lagrange multiplier ($\alpha$) to enforce the density constraint. It applies strict boundaries early in training to prevent catastrophic failures, then gradually relaxes them to allow fine-tuning and discovery of optimal actions.

Key Theoretical Insights

The paper provides strong theoretical backing for its empirical claims. The authors mathematically prove that their Flow-GAN hybrid loss converges quickly to the true distribution ($O_P(n^{-1/2})$). Furthermore, they demonstrate that CPED is guaranteed to find the optimal Q-value within the support of the behavior policy at a linear convergence rate. This proves that explicitly estimating behavior density is vastly superior to using implicit distance metrics or lower-bound estimators for defining safe RL boundaries.

Empirical Evaluation

The method was rigorously evaluated on the standard D4RL (Datasets for Deep Data-Driven Reinforcement Learning) benchmark, encompassing continuous control tasks (Gym-MuJoCo: HalfCheetah, Hopper, Walker2d) and sparse-reward navigation tasks (AntMaze).

State-of-the-Art Performance: CPED significantly outperformed a wide array of strong baselines, including CQL, IQL, Decision Transformer (DT), and SPOT, on most Gym-MuJoCo tasks. For example, on the hopper-medium dataset, CPED achieved a score of 100.1 ± 2.8, vastly exceeding the next best baseline (SPOT at 86.0). On walker2d-medium, it reached 90.2 ± 1.7 compared to SPOT's 86.4.

Competitive in Sparse Rewards: In the challenging AntMaze tasks, which require the agent to stitch together sub-optimal trajectories to find a goal, CPED remained highly competitive. It achieved top scores in umaze (96.8) and medium-play (85.1).

Superior Learning Dynamics: An analysis of the learning curves reveals a distinct advantage of CPED. While conservative methods like BEAR tend to plateau very quickly—indicating they have simply memorized the dataset—CPED's average returns continue to rise steadily throughout training. This empirically validates that CPED successfully explores the safe region to find better policies.

Limitations and Future Directions

While CPED represents a significant step forward, it is not without limitations. Setting the likelihood threshold ($\epsilon$) can be sensitive, particularly in high-dimensional spaces. The authors mitigate this by using the mean likelihood of the training batch as a dynamic heuristic, but it remains a hyperparameter that requires careful tuning.

For future work, the authors suggest exploring more advanced GAN architectures to push the boundaries of density estimation even further. Additionally, there is room to investigate how to explore the identified feasible region more efficiently, and to test CPED on more complex datasets generated by multiple behavior policies or multi-agent systems.

Summary updated

BibTeX
@inproceedings{zhang2023constrained,
  author = {Jing Zhang and Chi Zhang and Wenjia Wang and Bingyi Jing},
  title = {{Constrained Policy Optimization with Explicit Behavior Density For Offline Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=dLmDPVv19z},
}
Figure