arXiv:2610.20255cs.ROOct 2026

Manuscript Offprint

arXiv:2610.20255

Safe Reinforcement Learning with Receding-Horizon Safety Critic and Differentiable Action Shields

Siwei Ju, Jan Peters, Oleg Arenz

Siwei Ju 1,∗^{1,*}, Jan Peters 1,2,3,4^{1,2,3,4}, and Oleg Arenz 1^{1}

Abstract—Despite the Markov assumption, safety failures in robot reinforcement learning rarely occur instantaneously; they typically emerge over several steps as the policy enters unfamiliar states under disturbances and domain shift. We address this limitation by learning a receding-horizon safety critic that predicts whether a state will remain non-terminating over the next receding horizon, enabling anticipatory detection of impending locomotion failures. The critic is trained from rollout-derived horizon labels with a composite objective that combines horizon classification, control-barrier-function-inspired temporal consistency, and smoothness regularization, and we aggregate an ensemble of critics with a conservative Conditional Value at Risk estimate to account for uncertainty. Building on the learned critic, we derive a closed-form, differentiable CBF-style safety filter that minimally modifies the policy action to improve predicted safety, and integrate it into PPO with an anticipation loss to reduce policy-filter mismatch during training. In simulated quadruped locomotion, our method improves robustness under action noise, external perturbations, and terrain shifts, reducing catastrophic failures while maintaining competitive returns.

I. INTRODUCTION

Reinforcement learning (RL) has enabled increasingly agile legged locomotion, yet safety remains a central obstacle to deploying learned controllers beyond narrow training conditions. In practice, many locomotion failures are delayed: a destabilizing contact, a slight foot scuff, or a suboptimal recovery step may not cause an immediate violation, but can drive the robot into an unrecoverable state several steps later. This makes safety inherently horizon-dependent in locomotion, especially under disturbances and terrain-induced contact variability.

A common approach to safety in continuous control is to enforce state constraints using control barrier functions (CBFs) [3] and differentiable safety layers that project actions through constrained optimization [1, 31]. Data-driven CBF variants often learn uncertainty or residual terms to compensate modeling error [27, 9], while neural CBFs (NCBFs) parameterize the certificate itself to reduce manual design effort [37, 24, 20, 25, 36, 17, 2]. In safe RL, CBF-style shields are frequently combined with actor-critic training [10, 7, 8, 32, 34] or treated as part of the environment dynamics [6]. Despite their success, these methods face persistent challenges in locomotion: (i) computational overhead from per-step optimization and the associated training-time scalability limits, (ii) myopia from one-step constraints on the safety layer that may not anticipate multi-step failures, and (iii) policy-filter mismatch, where the executed (filtered) actions induce a distribution shift that is not always accounted for during policy optimization.

Predictive safety filters address myopia by enforcing safety over a horizon, typically relying on known or nominal dynamics models and uncertainty representations [28, 29, 30]. In parallel, safe RL has explored learning feasibility or long-horizon safety signals that resemble critics/value functions [13, 26] and structured safety enforcement that avoids generic QPs when dynamics are known [15]. For robot control, complementary approaches predict failure and switch to recovery behaviors (e.g., safe-fall policies) [19, 14], or deploy CBF shields on complex platforms such as humanoids [33, 34]. These strands collectively indicate the need for safety mechanisms that are horizon-aware, computationally lightweight, and compatible with end-to-end policy learning under distribution shift.

We propose a receding-horizon safety critic that directly predicts whether the system will remain non-terminated over the next H steps from a state. The critic is trained from rollouts using horizon-wise binary labels, shaped by a temporal consistency prior inspired by discrete-time CBF conditions, and regularized for smoothness to improve robustness under distribution shift. To make the safety signal actionable for control, we derive a differentiable safety layer that minimally corrects the policy action via a single-constraint projection with a closed-form solution, and we use a slack variable scaled by the ensemble uncertainty. Because the safety layer is differentiable, we integrate it into PPO and introduce a safety anticipation loss so the policy learns to reduce interventions and align with the horizon-safety objective.

We evaluate the approach on quadruped locomotion under controlled domain shifts, including stochastic action noise and external perturbations on both flat and heightfield terrains. Across disturbance intensities, the proposed method substantially improves success rates while maintaining competitive returns compared to PPO with domain randomization and PPO augmented with an NCBF-style safety layer. An ablation on the horizon length reveals a clear trade-off: longer horizons better mitigate myopic failures but are harder to train and can become over-conservative under shift.

We summarize our contribution as follows:

1^{1}Department of Computer Science, Technical University of Darmstadt, Germany.

2^{2}Hessian.AI.

3^{3}German Research Center for AI (DFKI), Research Department: Systems AI for Robot Learning.

4^{4}Robotics Institute Germany (RIG).

• Receding-horizon safety critic. We learn a safety critic that predicts whether the system remains safe over the next H steps from horizon-labeled rollouts.

• Structured horizon-safety training. We propose a training objective combining horizon classification, temporal consistency, and smoothness regularization with balanced sampling of rare failures.

• Closed-form differentiable safety shield. We derive a one-constraint projection that minimally corrects the policy action to prevent decreases in predicted safety, enabling end-to-end optimization.

• Robust safe locomotion under shift. Integrated with PPO via a safety-anticipation loss, our method reduces catastrophic failures and improves robustness under domain shift, outperforming PPO baselines and an NCBF safety layer without hand-designed CBFs.

References (36)