Safe Policy Iteration: A Monotonically Improving Approximate Policy Iteration Approach

Alberto Maria Metelli, Matteo Pirotta, Daniele Calandriello, Marcello RestelliJMLR 2021

Introduction

In the field of Reinforcement Learning (RL), the standard approach for identifying optimal strategies is Policy Iteration (PI). In an idealized setting with perfect models and infinite computational resources, PI alternates between policy evaluation and policy improvement, guaranteeing a monotonic increase in performance until the optimal policy is reached.

However, real-world applications necessitate Approximate Policy Iteration (API). In these scenarios, value functions are estimated from finite samples or represented via function approximators like neural networks. These approximations introduce errors that frequently lead to "policy oscillation" or "chattering," where an agent's performance fluctuates or degrades over time. While previous methods like Conservative Policy Iteration (CPI) attempted to solve this by enforcing "safe," incremental updates, they are often too pessimistic, resulting in agonizingly slow convergence rates. This paper introduces Safe Policy Iteration (SPI), a framework designed to provide the stability of CPI with significantly improved convergence speeds.

The SPI Framework

The core innovation of SPI is the derivation of tighter mathematical lower bounds for policy improvement. Rather than taking the extremely small steps mandated by CPI, SPI identifies a new policy $\pi'$ that maximizes a guaranteed improvement over the current policy $\pi$ based on more precise bounds.

Hierarchical Variants of SPI

The authors propose three distinct schemas for SPI, varying in their granularity and flexibility:

  1. Unique-parameter SPI (USPI): This variant utilizes a single global step size ($\alpha$) for the entire policy update. While structurally similar to CPI, USPI employs a tighter bound that allows for larger, more confident updates, accelerating the path to the optimum.
  2. per-State-parameter SPI (SSPI): This version allows for a unique step size $\alpha(s)$ for every state. This enables the agent to make aggressive changes in states where improvement is certain while remaining cautious in states with high uncertainty.
  3. per-State-Action-parameter SPI (SASPI): The most flexible variant, SASPI assigns different weights $\alpha(s, a)$ to every state-action pair, allowing for maximum exploitation of local certainties within the environment.

Theoretical and Practical Implementation

To bridge the gap between theory and practice, the authors introduce an Approximate SPI framework. This includes a rigorous Probably Approximately Correct (PAC) analysis, which calculates the specific sample sizes required to ensure a "safe" improvement with high statistical confidence.

Furthermore, the authors develop the Forward Bound Optimizer (FBO). The FBO is an efficient computational method for calculating the optimal update parameters (the $\alpha$ values) for the SPI variants, ensuring that the theoretical guarantees of the framework can be realized in practical RL tasks.

Experimental Results

The SPI framework was evaluated across three distinct simulated environments:

  • Chain-Walk Domain: In this classic 1D environment, USPI demonstrated its efficiency by reaching the optimal policy in only 44 iterations. In contrast, CPI remained far from the optimum even after hundreds of iterations.
  • The Prison Domain: This grid-world features noisy transitions and penalizing "absorbing" states. The experiment highlighted the power of granularity; the per-state-action updates of SASPI allowed the agent to navigate complex penalties that caused global update methods to stall.
  • Blackjack: In this stochastic multi-action setting, the approximate versions of SSPI and SASPI (aSSPI and aSASPI) significantly outperformed standard API methods. While standard API suffered from performance oscillations, the SPI variants maintained monotonic improvement and reached higher scores with fewer total updates.

Key Insights

  • Tighter Bounds Enable Speed: By proving that CPI's bounds were overly conservative, the authors show that agents can take much larger steps toward a greedy policy without risking performance degradation.
  • Granularity is Essential: Moving from global parameters to state-action specific parameters allows agents to exploit local information, which is critical in environments with non-uniform uncertainty.
  • Finite Convergence: Unlike many safe algorithms that only converge asymptotically, the authors prove that USPI can reach the optimal policy in a finite number of steps under specific conditions.

Limitations and Future Work

The primary challenge for SPI is sample complexity. As the granularity of the update increases (moving toward SASPI), the number of samples required to accurately estimate the advantage for every state-action pair grows significantly. This can be prohibitive in environments with large state spaces.

Future research directions include:

  1. State-Action Aggregation: Grouping similar states to share advantage estimates, thereby reducing the total sample requirement.
  2. Off-Policy Learning: Extending the safe improvement bounds to scenarios where the agent learns from data generated by a different policy, such as human demonstrations or historical logs.

Summary updated

BibTeX
@article{metelli2021safe,
  author = {Alberto Maria Metelli and Matteo Pirotta and Daniele Calandriello and Marcello Restelli},
  title = {{Safe Policy Iteration: A Monotonically Improving Approximate Policy Iteration Approach}},
  journal = {J. Mach. Learn. Res.},
  year = {2021},
  url = {https://openreview.net/forum?id=rnfWZWdYvxc},
}
Figure