Papers
Topics
Authors
Recent
Search
2000 character limit reached

RSGF-RL: Anytime Safe Constrained RL

Updated 14 July 2026
  • RSGF-RL is an off-policy constrained RL method that guarantees anytime safety by ensuring every policy update satisfies predefined constraints via solving a convex QCQP.
  • It is derived from Robust Safe Gradient Flow, leveraging continuous-time dynamics to combine objective descent with safety constraints and robustness margins against estimation errors.
  • The algorithm employs off-policy estimation through importance sampling and finite-sample safety buffers, with convergence guarantees to KKT points under proper step-size conditions.

Searching arXiv for the exact method name and primary source paper. Searching arXiv for related acronym collisions and nearby methods to support disambiguation. RSGF-RL is an off-policy method for constrained reinforcement learning derived from the Robust Safe Gradient Flow (RSGF), a continuous-time dynamics for nonlinear constrained optimization. Its defining objective is to provide anytime safety guarantees: with a user-specified probability and sufficient data, each policy update yields a constraint-satisfying policy, and a mildly unsafe policy can be driven back to safety in one step with high probability. The method estimates value functions and their gradients from episodic data and computes each policy update by solving a convex quadratically constrained quadratic program (QCQP) (Mestres et al., 1 Oct 2025).

1. Constrained RL setting and meaning of anytime safety

RSGF-RL is formulated for a finite-horizon discounted constrained Markov decision process

M=(S,A,P,R0,{Rj}j=1q),\mathcal{M} = (\mathcal{S},\mathcal{A},P,R_0,\{R_j\}_{j=1}^q),

with task reward R0R_0, safety-cost functions RjR_j, discount factor γ(0,1)\gamma\in(0,1), horizon TZ>0T\in\mathbb{Z}_{>0}, and parameterized policy πθ\pi_\theta, θRd\theta\in\mathbb{R}^d. The paper writes the optimization problem as

minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}

The sign of the reward is flipped so that the task is written as a minimization problem (Mestres et al., 1 Oct 2025).

The corresponding feasible parameter set is

C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.

Because the value functions induced by a parameterized policy are generally nonconvex in θ\theta, the method targets convergence to KKT points rather than global optima (Mestres et al., 1 Oct 2025).

In this framework, anytime safety means that if the algorithm generates policy iterates R0R_00, then constraint satisfaction is preserved at every training iterate with prescribed probability. The finite-horizon statement is

R0R_01

provided the paper’s per-iteration sample conditions hold (Mestres et al., 1 Oct 2025). This is a training-time property, not merely a guarantee on the terminal policy.

The paper also notes that suitable cumulative constraints can encode state-space safety with confidence. If

R0R_02

then satisfying R0R_03 implies

R0R_04

This links CMDP constraints to high-probability state safety (Mestres et al., 1 Oct 2025).

2. Continuous-time foundation: Robust Safe Gradient Flow

RSGF-RL is built from a continuous-time constrained optimization dynamics called the Robust Safe Gradient Flow. For the generic nonlinear program

R0R_05

the flow direction is defined by the QCQP

R0R_06

The associated continuous-time dynamics is

R0R_07

The construction is called gradient flow because the objective drives R0R_08 toward R0R_09, safe because the admissible directions are constrained by the safety functions, and robust because the quadratic term RjR_j0 creates explicit margin against perturbations and estimation errors (Mestres et al., 1 Oct 2025).

Under MFCQ, if RjR_j1 denotes the Lagrange multiplier of the RjR_j2-th constraint, the solution has the closed form

RjR_j3

This makes the direction a scaled combination of the objective gradient and active constraint gradients (Mestres et al., 1 Oct 2025).

A key dissipation inequality follows from feasibility of the QCQP constraints:

RjR_j4

On the boundary RjR_j5, this yields

RjR_j6

so the vector field lies in the tangent cone of the feasible set. By Nagumo’s theorem, the paper proves that the feasible set is forward invariant under the flow (Mestres et al., 1 Oct 2025).

The equilibrium structure is equally central. The paper proves that if RjR_j7, then RjR_j8, and under MFCQ, RjR_j9 if and only if γ(0,1)\gamma\in(0,1)0 is a KKT point. Thus, the equilibria of the flow coincide exactly with KKT points of the constrained problem (Mestres et al., 1 Oct 2025).

3. Discrete algorithm and off-policy estimation

The practical algorithm is the forward-Euler discretization

γ(0,1)\gamma\in(0,1)1

with step sizes γ(0,1)\gamma\in(0,1)2. Since γ(0,1)\gamma\in(0,1)3 and γ(0,1)\gamma\in(0,1)4 are unknown, RSGF-RL replaces them with data-driven estimates and computes the sampled direction by solving

γ(0,1)\gamma\in(0,1)5

The actual update is

γ(0,1)\gamma\in(0,1)6

The additional constraint

γ(0,1)\gamma\in(0,1)7

is introduced to enforce a compact parameter set γ(0,1)\gamma\in(0,1)8 (Mestres et al., 1 Oct 2025).

The algorithm is explicitly off-policy. At iteration γ(0,1)\gamma\in(0,1)9, estimation may use an offline batch TZ>0T\in\mathbb{Z}_{>0}0 generated by policies in a set TZ>0T\in\mathbb{Z}_{>0}1 together with previous and current batches TZ>0T\in\mathbb{Z}_{>0}2, selecting any subset

TZ>0T\in\mathbb{Z}_{>0}3

If the TZ>0T\in\mathbb{Z}_{>0}4-th episode in TZ>0T\in\mathbb{Z}_{>0}5 was generated by behavior policy TZ>0T\in\mathbb{Z}_{>0}6, then the value estimator is

TZ>0T\in\mathbb{Z}_{>0}7

where TZ>0T\in\mathbb{Z}_{>0}8 and TZ>0T\in\mathbb{Z}_{>0}9 for πθ\pi_\theta0 (Mestres et al., 1 Oct 2025).

The gradient estimator is REINFORCE-style with baseline:

πθ\pi_\theta1

with

πθ\pi_\theta2

and πθ\pi_\theta3 (Mestres et al., 1 Oct 2025).

The paper does not formulate RSGF-RL as an actor-critic method. Its formal estimation theory is based on trajectory-wise importance sampling and score-function gradients, with the baseline πθ\pi_\theta4 as the explicit variance-reduction device (Mestres et al., 1 Oct 2025).

4. Finite-sample safety guarantees and recovery mechanism

The safety theorem is based on a step-size condition and a robustness margin. The step size must satisfy

πθ\pi_\theta5

where πθ\pi_\theta6 are Lipschitz constants of πθ\pi_\theta7 (Mestres et al., 1 Oct 2025).

For each constraint, the paper defines

πθ\pi_\theta8

This is the finite-sample robustness buffer: simultaneous errors in value and gradient estimation smaller than this quantity can be tolerated while preserving one-step safety (Mestres et al., 1 Oct 2025).

The required sample conditions are

πθ\pi_\theta9

with θRd\theta\in\mathbb{R}^d0 the number of episodes in θRd\theta\in\mathbb{R}^d1 generated by the current policy, θRd\theta\in\mathbb{R}^d2, and constants θRd\theta\in\mathbb{R}^d3 determined by the reward bounds, horizon, discount factor, and action-probability lower bound (Mestres et al., 1 Oct 2025).

Under these conditions, if θRd\theta\in\mathbb{R}^d4, then

θRd\theta\in\mathbb{R}^d5

Thus, a policy estimated safe updates to a truly safe next policy with high probability (Mestres et al., 1 Oct 2025).

The same theorem also yields a recovery guarantee. If θRd\theta\in\mathbb{R}^d6 but θRd\theta\in\mathbb{R}^d7 and the sample conditions hold, then

θRd\theta\in\mathbb{R}^d8

This is the one-step recovery statement for a mildly unsafe policy (Mestres et al., 1 Oct 2025).

The mechanism is based on combining the sampled QCQP constraints with the descent lemma

θRd\theta\in\mathbb{R}^d9

The quadratic robustness term in the QCQP is therefore not merely regularization; in the paper’s analysis it is part of the margin that compensates for estimation uncertainty (Mestres et al., 1 Oct 2025).

5. Statistical analysis and asymptotic convergence

RSGF-RL’s statistical analysis begins with unbiasedness:

minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}0

The paper also gives variance expressions for the off-policy estimators and Hoeffding-type concentration inequalities for both values and gradient components (Mestres et al., 1 Oct 2025).

For the value estimator,

minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}1

and the tail bound is

minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}2

For the gradient estimator, the componentwise variance and concentration bounds are given analogously in terms of minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}3 and minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}4 (Mestres et al., 1 Oct 2025).

The asymptotic convergence argument rewrites the algorithm as stochastic approximation:

minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}5

Under regularity assumptions, feasibility of the sampled QCQP, initialization in the bounded set, asymptotically vanishing QCQP error

minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}6

and step-size conditions

minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}7

the iterates converge almost surely to the set of KKT points of the constrained RL problem in minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}8 (Mestres et al., 1 Oct 2025).

The continuous-time convergence result provides the template. Inside the feasible set, the objective minθRdV0(θ)=Eaπθ(s) s0η[k=0TγkR0(sk,ak,sk+1)] s.t.Vj(θ)=Eaπθ(s) s0η[k=0TγkRj(sk,ak,sk+1)]0,j[q].\begin{aligned} \min_{\theta\in\mathbb{R}^d}\quad V_0(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} -\gamma^k R_0(s_k, a_k, s_{k+1}) \biggr] \ \text{s.t.}\quad V_j(\theta) &= \mathbb{E}_{\substack{a \sim \pi_{\theta}(\cdot|s) \ s_0 \sim \eta}} \biggl[ \sum_{k=0}^{T} \gamma^k R_j(s_k, a_k, s_{k+1}) \biggr] \le 0,\qquad j\in[q]. \end{aligned}9 is nonincreasing along the flow, and for global convergence the paper introduces the exact-penalty-like function

C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.0

which is nonincreasing along the flow on compact sets for small enough C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.1 (Mestres et al., 1 Oct 2025). This suggests that the robust flow is designed not only to preserve safety but also to organize descent toward KKT points from both safe and mildly unsafe initial conditions.

6. Empirical behavior, positioning, and disambiguation

The paper evaluates RSGF-RL on a navigation example and the cart-pole system. In the navigation problem, a single-integrator robot in C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.2 must reach a goal while avoiding obstacles; in cart-pole, the state is C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.3, the action is a continuous force in C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.4, the reward is C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.5, and the safety set requires C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.6 (Mestres et al., 1 Oct 2025).

The baselines are off-policy RSGF-RL, on-policy RSGF-RL from the conference version, and CPO. The evaluation reports task performance through C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.7 and safety through C={θRd:Vj(θ)0, j[q]}.C = \{\theta\in\mathbb{R}^d : V_j(\theta)\le 0,\ \forall j\in[q]\}.8. Across both tasks, the paper reports that RSGF-RL maintains safety during training or recovers quickly from unsafe initial conditions, that both on-policy and off-policy variants outperform CPO in reward performance, and that off-policy RSGF-RL with clipped importance weights performs best in practice (Mestres et al., 1 Oct 2025). The clipped importance weights are described as an empirical modification; they are not part of the theoretical estimator.

Within safe RL, RSGF-RL is positioned as a policy-parameter update rule that solves a convex QCQP at each iteration rather than using dual ascent or action-level shielding. This suggests a design centered on directly computing a feasible local descent direction in parameter space. The paper’s own comparison emphasizes superior performance with respect to the state of the art on its reported experiments (Mestres et al., 1 Oct 2025).

The acronym is potentially confusable. It should not be conflated with SG-RL, a hierarchical path planning framework combining Simple Subgoal Graphs and LSPI for rational pathfinding in continuous and uncertain environments (Zeng et al., 2018); with RSG, the Robot Skill Graph framework for organizing and inferring quadruped skills (Zhang et al., 2023); or with RSF-GLLM, whose core module is Recurrent Soft-Flow for multi-hop KGQA and which does not use reinforcement learning (Bandyopadhyay et al., 7 Jul 2026). In the literature represented here, RSGF-RL refers specifically to “Off-Policy Reinforcement Learning with Anytime Safety Guarantees via Robust Safe Gradient Flow” (Mestres et al., 1 Oct 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to RSGF-RL.