SGPC: Safety-Guiding Policy Constraint for Stable Off-Policy Safe Reinforcement Learning

Yifan Liu, Nan Zhang, Yang CongarXiv 2026

TL;DR

Safe Reinforcement Learning often suffers from a "yo-yo" effect where an agent oscillates wildly between being safe-but-unproductive and high-performing-but-dangerous. This paper introduces SGPC, a clever "safety bumper" that provides specific steering corrections whenever an agent drifts toward danger, leading to much smoother training and significantly fewer safety violations without sacrificing performance.

What Problem Does This Paper Address?

Reinforcement Learning (RL) is great at teaching agents to maximize rewards, but in the real world, we also need them to follow rules—like a robot vacuum not falling down the stairs. This is usually handled by Safe RL, often formulated as a Constrained Markov Decision Process (CMDP).

The standard way to solve this is using "primal-dual" methods. Think of this as a tug-of-war: one side wants more reward, and the other side (the Lagrange multiplier) pulls back whenever the agent breaks a safety rule.

However, this leads to two major headaches:

  1. Oscillation: When the agent is unsafe, the "safety" side pulls hard. As soon as the agent is safe again, the safety side relaxes, and the "reward" side immediately pulls the agent back into the danger zone. This creates a jittery, unstable learning process.
  2. Unreliable Estimates: Off-policy methods (which learn from past experiences) often struggle because the "critics"—the neural networks estimating how much reward or cost an action will incur—can be very inaccurate in regions of the state space the agent hasn't mastered yet.

Methods

The authors propose a new framework called Safety-Guiding Policy Constraint (SGPC). Instead of just penalizing the agent for being bad, SGPC actively shows it how to be better.

The approach consists of two main parts:

  • Safety-Guiding Policy (SGP): When the agent's current plan is predicted to be unsafe, the system performs a quick, local search (sampling nearby actions) to find a "reference action" that is safer but still close to the original plan.
  • Safety-Guiding Policy Constraint (SGPC): This is a new, conditional constraint added to the optimization problem. If the agent is heading for trouble, this constraint kicks in and forces the agent to move its policy toward that safer reference action found by the SGP.

Crucially, if the agent is already in the "safe set," this extra constraint simply turns off, allowing the agent to focus entirely on maximizing its reward. This "plug-in" mechanism can be added to existing popular algorithms; the authors demonstrate this with SAC-SGPC and TD3-SGPC.

Fig. 1. Overview of the SGPC-based algorithm, which incorporates SGPC as a plug-in constraint into the actor update of off-policy actor-critic safe RL.

Datasets

The researchers evaluated their method using the Safety-Gymnasium benchmark, a standard "playground" for safe RL. They tested on eight different tasks across two categories:

  • Locomotion: Robots like "Ant," "HalfCheetah," and "Humanoid" trying to run fast without exceeding a specific velocity limit.
  • Navigation: A "Point" or "Car" robot trying to reach a goal while avoiding hazards like "gremlins" or forbidden zones.

Key Insights and Ideas

  • Guidance over Punishment: Traditional methods are like a GPS that only says "Wrong Way!" after you've missed the turn. SGPC is like a GPS that proactively suggests a specific U-turn to get you back on track.
  • Stabilizing the Boundary: By providing a consistent "pressure" toward the safe zone even before the Lagrange multipliers fully react, SGPC dampens the oscillations. This allows the agent to spend more time learning near the safety boundary, which is exactly where the most optimal (but tricky) policies usually live.
  • Calibration is Key: Since neural networks are prone to "estimation offset" (being consistently too optimistic or pessimistic), the authors include a batch-level centering term to calibrate the cost critic, ensuring the safety guidance is based on reality rather than a biased estimate.

Key Results

The results across the Safety-Gymnasium tasks were impressive. Compared to five state-of-the-art baselines (like SAC-Lag and CVPO):

  • Superior Safety: In tasks like SafeWalker2d, SGPC-based methods maintained costs well below the limit, while baselines frequently spiked into unsafe territory.
  • Reduced Oscillation: The learning curves for SGPC are visibly smoother. As seen in Figure 2, the "shaded regions" (representing variance across different runs) are much narrower for SGPC, indicating more reliable training.
  • Competitive Rewards: Despite the stricter safety adherence, the agents often achieved higher rewards than the baselines because they weren't constantly "bouncing" off the safety constraints.
  • Tighter Limits: When the safety threshold was made extremely strict (e.g., a cost limit of 5 instead of 25), the advantage of SGPC became even more pronounced.
Fig. 2. Reward and cost learning curves of comparative experiments under the default cost limit of 25. For readability, each task shows the two SGPC-based methods and the three best-performing baselines for that task.

Limitations and Future Work

While highly effective, the paper notes a few areas for improvement:

  • Computational Overhead: The SGP requires sampling multiple candidate actions during each actor update, which adds a bit of extra "thinking time" during training (though not during execution).
  • Critic Reliance: The whole system depends on the "cost critic" being reasonably accurate. If the critic is completely wrong about what is safe, the guidance will be equally wrong.
  • Complexity: Future work could explore extending this to even more complex, non-linear constraints or applying it to high-stakes real-world robotics where safety isn't just a benchmark score, but a physical necessity.

For those interested in the nitty-gritty math, the full paper provides proofs for the feasibility and optimality of this augmented optimization problem in Appendix A.

Summary updated

Abstract

Off-policy safe reinforcement learning (RL) faces a challenging trade-off between task optimality and constraint feasibility. In primal-dual methods, the coupled optimization of cumulative reward and constraint penalties through adaptive Lagrange multipliers may induce oscillatory policy updates near the safety boundary and amplify the effect of unreliable reward estimates outside the safe set. To address these issues, we formulate a new constrained optimization problem (COP) for safe RL by introducing a Safety-Guiding Policy (SGP) and a corresponding Safety-Guiding Policy Constraint (SGPC). The proposed COP augments the standard COP in safe RL with a conditional safety-guidance constraint. During actor updates, the current actor is evaluated using the learned cost critic. If it is predicted to be outside the safe set, SGP provides a nearby lower-cost training reference, and SGPC guides actor optimization toward this reference. Once the policy enters the safe set, the added constraint becomes inactive, and the formulation reduces to the original COP. This formulation leads to a plug-in actor-training constraint that can be integrated into off-policy safe RL algorithms. By applying primal-dual optimization to the auxiliary COP, we finally derive an SGPC-based off-policy safe RL algorithm and implement it in two representative off-policy algorithms, yielding SAC-SGPC and TD3-SGPC. Experiments on multiple Safety-Gymnasium benchmarks demonstrate that SGPC achieves a better optimality-safety trade-off by substantially reducing constraint violations and cost oscillations while maintaining competitive or better task returns.
BibTeX
@misc{liu2026sgpc,
  author = {Yifan Liu and Nan Zhang and Yang Cong},
  title = {{SGPC: Safety-Guiding Policy Constraint for Stable Off-Policy Safe Reinforcement Learning}},
  year = {2026},
  eprint = {2611.30265},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.30265},
}
Figure