Provably Efficient Exploration in Constrained Reinforcement Learning: Posterior Sampling Is All You Need

Danil Provodin, Pratik Gajane, Mykola Pechenizkiy, Maurits KapteinarXiv 2023 · DOI

Introduction

Standard Reinforcement Learning (RL) typically focuses on the maximization of a single scalar reward signal. However, real-world deployment—ranging from autonomous driving to industrial robotics—often requires agents to satisfy safety or resource constraints while optimizing performance. These scenarios are formally modeled as Constrained Markov Decision Processes (CMDPs).

Learning in CMDPs is particularly challenging in the infinite-horizon undiscounted setting, where an agent interacts with an environment indefinitely. The agent must navigate a complex "exploration-exploitation-feasibility" trade-off: it must explore to learn the environment's dynamics, exploit its knowledge to maximize rewards, and ensure that the policies it executes remain feasible under the true, unknown model. While "Optimism in the Face of Uncertainty" (OFU) has been the dominant paradigm for addressing this, it often leads to computationally expensive and mathematically complex algorithms. This paper introduces PSCONRL, the first posterior sampling-based algorithm for constrained RL in infinite-horizon settings, demonstrating that the simplicity of Thompson Sampling is sufficient for near-optimal performance.

The PSCONRL Algorithm

PSCONRL (Posterior Sampling for Constrained Reinforcement Learning) leverages the principle of posterior sampling to manage uncertainty. The algorithm operates in episodes, utilizing a structured approach to policy selection and execution:

  1. Posterior Update: The agent maintains a posterior distribution over the unknown transition probabilities, typically using a Dirichlet prior to incorporate observed state-action transitions.
  2. Sampling: At the start of each episode, the agent samples a single transition model from the current posterior.
  3. Planning via Linear Programming (LP): The agent solves the CMDP for the sampled model using a Linear Program in the space of occupancy measures. This transforms the RL planning problem into a tractable convex optimization problem.
  4. Feasibility Management: A critical challenge in constrained posterior sampling is that a sampled model might be infeasible, even if the true model is not. PSCONRL addresses this with a simple fallback: if the sampled model is feasible, the agent executes the optimal policy for that model. If the model is infeasible, the agent executes a uniform random policy to encourage exploration and gather more data.
  5. Stopping Criteria: Episodes are terminated based on a "doubling trick" (when the visit count of a state-action pair doubles) or a specific time-growth rate, ensuring efficient updates.

The Feasibility Lemma

The theoretical backbone of PSCONRL is the Feasibility Lemma. The authors prove that as the agent accumulates data, the probability of sampling an infeasible model diminishes rapidly. Specifically, the sampled models become feasible with high probability after approximately $O(\sqrt{T})$ steps, allowing the agent to transition from pure exploration to constrained optimization.

Theoretical Contributions

The paper provides the first Bayesian regret analysis for communicating CMDPs in the infinite-horizon setting. The authors establish that PSCONRL achieves a Bayesian regret bound of $\tilde{O}(HS\sqrt{AT})$ for both the primary reward and the constraint costs. This bound is significant because it matches the theoretical lower bound in terms of the time horizon $T$, proving that posterior sampling is as efficient as the more complex optimism-based alternatives.

Furthermore, PSCONRL offers a distinct computational advantage. Unlike OFU-based methods like UCRL-CMDP, which require solving non-linear optimization problems over sets of models, PSCONRL only requires solving a standard LP for a single sampled model. This makes the approach significantly more practical for environments with larger state spaces.

Empirical Evaluation

The researchers evaluated PSCONRL against three OFU-based baselines—CONRL, C-UCRL, and UCRL-CMDP—across several gridworld environments:

  • Marsrover (4x4 and 8x8): The agent must reach a goal while minimizing the probability of entering "risky" states. PSCONRL demonstrated faster and more consistent convergence to the optimal policy compared to the baselines.
  • Box (AI Safety Gridworlds): This environment tests long-term consequence learning, as pushing a box into a corner results in high auxiliary costs. In this complex task, PSCONRL significantly outperformed all OFU baselines, which struggled with near-linear regret.

Across these tests, PSCONRL maintained constraint violation levels comparable to or better than specialized "safe exploration" algorithms, while achieving superior cumulative rewards.

Discussion and Future Work

While PSCONRL represents a significant step forward, several avenues for future research remain. The current proof relies on a strict feasibility assumption, requiring the existence of at least one policy that satisfies constraints with a small margin. If a problem is only marginally feasible, the current bounds may not hold. Additionally, the analysis focuses on Bayesian regret (average performance over priors); extending these results to frequentist regret (worst-case performance) is a natural next step.

Finally, while the LP approach is more efficient than previous methods, it may still face scalability issues in massive state-action spaces. Integrating PSCONRL with deep reinforcement learning—using neural networks to approximate the posterior—could unlock its potential for high-dimensional real-world applications.

Summary updated

BibTeX
@misc{provodin2023provably,
  author = {Danil Provodin and Pratik Gajane and Mykola Pechenizkiy and Maurits Kaptein},
  title = {{Provably Efficient Exploration in Constrained Reinforcement Learning: Posterior Sampling Is All You Need}},
  year = {2023},
  eprint = {2309.15737},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.15737},
}
Figure