Manuscript Offprint
arXiv:2611.08273Accelerating Safe Reinforcement Learning with Massive Parallelism
Abstract
We investigate the problem of scaling safe reinforcement learning (safe RL) to massively parallel training regimes, where a large number of environments are executed with short rollout horizons. Although this setting improves data throughput and wall-clock efficiency, it creates a mismatch with constrained Markov decision processes (CMDPs), whose safety constraints are defined over full-episode cost returns. We address this mismatch by analyzing staggered environment resets as a phase-mixture distribution over short trajectory segments. This analysis characterizes the bias induced by phase coverage and motivates a phase-aggregated cost estimator that reconstructs episode-level cost estimates from short rollout batches. We further incorporate finite-sample uncertainty and distribution mismatch into a constraint-tightening framework, yielding a scalable Safe RL method compatible with on-policy optimization. Using an MJX-based implementation of Safety Gym, our experiments show that the proposed method achieves performance comparable to non-massively parallel implementations while substantially reducing wall-clock training time. Code is available at: GitHub Repository.
1 Introduction
Reinforcement learning (RL) provides a general framework for learning decision-making policies through sequential interaction with an environment and is commonly formulated as a Markov decision process (MDP). In many real-world applications, however, policies must satisfy safety requirements such as collision avoidance, energy limits, and operational constraints [7]. Safe RL addresses this challenge through constrained MDPs (CMDPs), where policy optimization is performed under explicit constraints [3].
Recent advances in accelerator hardware have enabled massively parallel simulation, where simulation and learning can be executed with high throughput on devices such as GPUs and TPUs [11]. This regime is particularly beneficial for on-policy RL, which requires data collected from the current policy for each update and has traditionally suffered from limited sample efficiency. By collecting short rollouts concurrently from many environments, massively parallel training enables frequent policy updates with large effective batches [16]. It also substantially reduces wall-clock training time, making repeated runs for statistical evaluation and rapid parameter tuning feasible within a limited
*Corresponding author.
40th Conference on Neural Information Processing Systems (NeurIPS 2026).
experimental budget [2, 5]. Despite these advantages, Safe RL has not fully incorporated this training regime, and existing methods remain misaligned with its data-processing characteristics.
A key challenge in applying massively parallel training to Safe RL is estimating reliable cost returns for policy update. In CMDPs, constraints are typically formulated in terms of cumulative costs, and existing Safe RL implementations commonly rely on episodic cost returns from completed or terminated episodes to balance reward maximization and constraint satisfaction [7, 18]. However, updates in massively parallel training are highly likely to occur without any episode terminating in any of the parallel environments, particularly in tasks without early termination [4]. Even when an episode terminates, the cost return of the full trajectory is biased by earlier policies in two ways: P1 the cost return includes costs incurred by actions taken under earlier policies, and P2 these actions influence the initial-state distributions of subsequent rollouts.
In this paper, we first revisit staggered reset [4], originally introduced to address the cyclical nonstationarity problem. By initializing parallel environments at different episode time steps, each update batch covers the entire episode horizon through short rollouts from different environments. This enables cost estimation by aggregating short rollout segments from different phases, each generated entirely by the current policy, which can address P1. We further analyze how policy history biases the phase-initial state distribution and apply tightening to handle P2. The resulting framework enables existing Safe RL algorithms to train in the massively parallel regime, improving wall-clock efficiency while maintaining reliable constraint satisfaction. The main contributions are summarized as follows:
-
We analyze staggered reset as a phase-mixture batch collection scheme, characterize how policy history biases cost returns and derive computable bounds for the return discrepancy.
-
We propose a massively parallel safe-RL framework with staggered reset that estimates cost directly from the phase-mixture batch and instantiate it with phase-initial state distribution correction estimation (PIS-DICE), a phase-initial density-ratio estimator for rollout-start state distributions.
-
We provide an implementation of Safety Gym exploration tasks using MuJoCo XLA (MJX) for end-to-end accelerator side training and evaluation, showing improved wall-clock efficiency with reliable cost control.
2.1 Constrained Markov Decision Processes
A CMDP is defined by , where is the state space, is the action space, is the transition probability, is the initial state distribution, is the reward function, is the cost function, is the discount factor, and is the cost limit. Under a stationary policy , the discounted CMDP objective is defined as follows [7, 18]:
Assumption 2.1 (Bounded rewards, costs, and returns). For , there exists such that for all .
For discounted infinite-horizon returns, the bound is . For finite-horizon returns, the bound is , with allowed for undiscounted episodic returns. The cost limit must be expressed on the same return scale as .
Although we treat discounted returns, many safe RL tasks set the cost threshold as an undiscounted episodic sum. To support both, the return bound is for the discounted infinite-horizon case and for a finite horizon .
2.2 Massively parallel data collection under staggered reset
In massively parallel on-policy training, each policy update uses length- rollouts from parallel environments. We consider episodic tasks with a fixed horizon , so the discounted returns in Eq. (1) truncate at . When , synchronous reset concentrates each batch on a narrow part of the task horizon, inducing a repeating distribution shift known as cyclical nonstationarity [16, 11, 4]. Staggered reset mitigates this by starting groups of environments at different episode steps, so that a single batch covers the whole horizon rather than a narrow slice.
On-policy RL has traditionally updated frequently from relatively small batches, whereas massively parallel simulation collects short rollouts across a large number of environments and updates from a much larger batch at far lower wall-clock cost. Safe RL fits this regime naturally, since its on-policy algorithms already rely on large batches to estimate the cost constraint with low variance. Massively parallel safe RL has been demonstrated on Isaac Gym [12], but it has not become widespread and has not been studied from an algorithm training perspective, in part because the available tasks have short horizons which avoid the short rollout regime ().
2.3 Distribution correction from flow identities
Distribution correction is commonly used in off-policy and offline RL to correct the mismatch between the distribution induced by a target policy and the distribution represented by sampled transitions [14, 22, 23]. For the discounted infinite-horizon formulation, let denote the normalized discounted state-action occupancy distribution induced by a stationary policy , and let denote the underlying state-action sampling distribution from which the transitions in are collected.
Assumption 2.2 (Absolute continuity). is absolutely continuous with respect to .
With Assumption 2.2, the density ratio is defined as . Multiplying by turns an expectation under into an expectation under , so for a bounded function ,
However, neither density is available in closed form and is accessed only through samples, so cannot be computed directly. Instead, under a stationary policy , the discounted state-action distribution satisfies the flow identity
The flow into splits into the initial-state contribution and the transition flow from previous state-action pairs. Substituting into Eq. (3) leaves as the only unknown, so distribution correction estimation (DICE) methods [14, 22, 23] estimate by enforcing Eq. (3) on samples of , without estimating the two densities separately.
3 Methodology
We formalize constraint estimation from phase-mixture batches collected from environments with different phases. We first analyze the return computed from the collected batch and compare it with the corresponding current policy return. We then construct phase-wise cost surrogates and tighten the update by considering finite-sample error and distribution mismatch. Finally, we specialize the construction to uniform staggered reset and introduce PIS-DICE as the distribution correction estimator for phase-initial states.
3.1 Phase-mixture return analysis
When training with parallel environments and short rollouts, early termination of individual environments or staggered reset distributes environments over phases [2, 4]. At epoch , define the phase distribution by , and let be the number of environments in phase . Let be the collected phase-initial state distribution [21, 8, 20]. Under policy , define . For any return function , set . The expected -step return from rollouts initialized at phase is
For the collected batch, the empirical K-step phase-mixture return is
Lemma 3.1. For a batch with phase distribution , the empirical K-step return is an unbiased estimator of the phase-mixture return, given by
Proof. See Appendix A.1.1.
The collected phase-initial distribution may be shaped by previous policies, which changes the state-action distribution and the expected return . Let denote the phase-initial distribution induced by the current policy . The corresponding current policy state-action distribution is . The current policy one-step return is , and the corresponding K-step phase-mixture return is
Proposition 3.2 (Initial phase state bias bound). Under Assumption 2.1, for , the initial phase state mismatch bias can be bounded as
Proof. See Appendix A.1.2.
Proposition 3.2 identifies the distributional term separating the phase-mixture return estimated from the batch and the corresponding current policy phase-mixture return. Even in on-policy algorithms, this correction is required when the collected phase-initial distribution differs from the current policy phase-initial distribution .
3.2 Phase-wise cost surrogates and tightening
Since safe RL algorithms need cost returns for dual updates or feasibility recovery, we consider two cost surrogates from the collected phase-mixture batch. The sampled cost surrogate aggregates the sampled cost with phase-coverage correction. The critic value surrogate evaluates the cost critic on states sampled from the same phase-mixture batch. Define the binary indicator . The coverage mass of timestep t and the coverage-correction weight are
Assume for , and let denote the set of observed phases. The two phase-wise surrogates are
(10)
Here predicts .
Proposition 3.3 (Finite-sample error bound). Under Assumption 2.1, choose either surrogate in Eq. (10) and write it as , where the are independent per-environment random variables. Let be a deterministic range satisfying for every environment , and let . By the one-sided empirical Bernstein inequality, the finite-sample error of the cost surrogate is bounded with probability at least ,
Proof. See Appendix A.1.3.
Theorem 3.4 (Constraint satisfaction with tightened cost surrogate). Assume that the selected surrogate scale satisfies the distribution mismatch upper bound . Together with Propositions 3.2 and 3.3, if the cost surrogate from the phase-mixture batch satisfies
then with probability at least .
Proof. See Appendix A.1.4.
3.3 Uniform staggered reset
Massively parallel environment training is typically executed under JIT/XLA compilation [11, 16], where keeping rollout tensors shape stable after compilation is important. Therefore, staggered reset partitions the environments into phase groups and assigns each group a fixed phase offset for along the task horizon . Environments that terminate early are kept in a masked terminal state until the group reset point or the episode end point, so no individual environment reset is performed. This group-wise distribution yields a uniform phase allocation over non-overlapping horizon segments, with mass on each observed phase and no mass on other phases, and provides a practical instance of the phase-mixture analysis in Section 3.1.
Theorem 3.5 (Uniform staggered reset induces a Cesàro phase mixture). Under uniform staggered reset, the phase-mixture return in Eq. (6) is the finite Cesàro mean of the phase-wise returns from Eq. (4), namely .
Proof. See Appendix A.1.5.
Corollary 3.6 (Cesàro phase-mixture return). Under uniform staggered reset, the phase-mixture return in Lemma 3.1 becomes
Corollary 3.7 (Cesàro initial phase state bias bound). Under uniform staggered reset and Assumption 2.1, the mismatch bound in Proposition 3.2 becomes
Corollary 3.8 (Uniform phase-wise cost surrogate under staggered reset). Under uniform staggered reset, the phase-wise surrogate in Eq. (10) becomes
(15)
The corollary proofs are given in Appendices A.1.6, A.1.7, and A.1.8, respectively.
3.4 PIS-DICE: phase-initial state distribution correction
The TV term in Eq. (14) compares collected state-action distributions with current policy state-action distributions at each phase and rollout offset, which cannot be estimated directly in the short-rollout training regime. Therefore, we extend the concept of distribution correction from state-action distributions to phase-initial state distributions.
Under uniform staggered reset, a phase-initial pair is , where is the state at the start of phase . Let be the transition kernel obtained after executing for environment steps. For consecutive phase-initial pairs used by the estimator, with . For every observed phase, assume is absolutely continuous with respect to . Writing their densities with the same symbols, define the phase-initial correction weight , so . For each interior phase , the phase-initial one-block relation is
Here is a class of bounded measurable functions. The sampled one-block residual below is used as an empirical fitting objective for the learned weights, while the formal bounds use the change-of-measure identity directly. For a fixed phase , let be the -step expected cost return under the current policy from phase state . Averaging this conditional expected return over the collected and current policy phase-initial state distributions gives and . The phase-initial change of measure gives . Thus, we use this phase-initial correction to handle the TV term in Eq. (14).
PIS-DICE uses two learned models. The ratio model outputs a nonnegative phase-initial correction weight. The residual model maps a phase-initial pair to a scalar whose difference across one rollout block defines an auxiliary fitting objective for the ratio model. In the implementation, the ratio-model output is , with . Since the exact ratio is not observed, the implementation fits using collected phase-initial samples and the states reached after the rollout block. The residual model is used only for this empirical fitting objective. The theoretical statements below are stated for the exact ratio , and Proposition 3.10 quantifies the additional error introduced by replacing with learned weights.
For each environment , denotes the phase-initial pair and denotes the pair obtained after the collected rollout block. Let be the residual-model output. The sampled residual is . The residual model is trained to expose this discrepancy, and the ratio model is trained to reduce the exposed discrepancy together with phase-wise normalization and ratio regularization. Let denote stop-gradient. The losses are
where is the phase-wise normalization term, . After training, the raw weights are clipped to and normalized within each phase. We write the final normalized weight as , where , so for every observed phase. The losses above are used only to fit . The formal bounds below use the exact change-of-measure identity for and then account for replacing with through an explicit learned-ratio error term.
Proposition 3.9 (PIS-DICE phase-initial discrepancy upper bound). With the exact phase-initial ratio defined above, under Assumption 2.1, , the phase-wise cost discrepancy satisfies
Proof. See Appendix A.1.9.
Proposition 3.9 gives a phase-initial change-of-measure bound for the cost discrepancy induced by initial phase-state mismatch. The bound replaces the state-action TV terms over all phase offsets with a phase-initial correction term. The practical correction therefore depends on the accuracy of the learned ratio.
Proposition 3.10 (Learned PIS-DICE correction error). For the exact phase-initial ratio , condition on a learned nonnegative estimate . Assume the selected surrogate cost scalar satisfies . Then
(19)
Proof. See Appendix A.1.10.
3.5 Practical update rule
The implementation uses the uniform staggered reset form in Eq. (15). The sampled cost form accumulates binary costs from the phase-mixture batch and compares the result with on the task cost-return scale. The critic value form evaluates the same batch with and compares it with the cost limit on the critic-return scale.
For the selected cost surrogate, write the per-environment scalar as . For the sampled cost form, ; for the critic value form, . The finite-sample term is computed from Proposition 3.3 for the selected scalar .
PIS-DICE provides the normalized learned weight . The update keeps the unweighted cost surrogate and uses to compute the mismatch correction
The policy update uses in Eq. (12), combining the finite-sample term with the empirical correction computed from the learned weights. In the main experiments, PIS-DICE changes only the cost-side tightening, while the actor objective remains unchanged.
4 Evaluation
We focus on evaluating whether the proposed massively parallel safe RL training framework can maintain reliable cost control with short, accelerator-friendly updates. The experiments first evaluate the effect of uniform staggered reset and the additional effect of tightening. We then compare the massively parallel training approach with the small-vectorized environment setting used in existing implementations in terms of both sample efficiency measured by total environment steps and wall-clock efficiency.
Table 1: Evaluation of CPO across 2k, 4k, and 8k parallel environments with a fixed rollout length of 10. Values are mean ± standard deviation of the last 10 epochs over eight seeds. Shading indicates violation of the cost threshold (cost > 25). Bold highlights, for each environment count, the highest reward that satisfies the cost threshold.
| Init | Cost est. | Env | Point/Goal | Car/Goal | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| w/o tightening | w/ tightening | w/o tightening | w/ tightening | |||||||
| Reward | Cost | Reward | Cost | Reward | Cost | Reward | Cost | |||
| Standard | LR | 2K | 15.13±9.94 | 55.48±24.54 | - | - | 29.14±4.76 | 65.87±12.06 | - | - |
| Staggered | SC | 2K | 14.57±2.78 | 27.08±0.84 | 7.56±3.06 | 13.88±1.59 | 25.12±2.11 | 28.63±1.46 | 18.52±2.83 | 14.38±1.18 |
| 4K | 17.28±5.37 | 26.27±1.23 | 13.42±3.52 | 20.00±3.49 | 27.57±1.76 | 26.87±1.18 | 24.38±2.04 | 18.43±0.75 | ||
| 8K | 21.23±1.05 | 27.02±1.50 | 18.83±0.73 | 21.19±2.05 | 32.17±0.95 | 26.52±1.38 | 29.57±0.70 | 21.06±0.70 | ||
| CV | 2K | 15.29±3.76 | 29.55±3.43 | 13.42±2.06 | 24.53±3.93 | 26.13±2.57 | 28.80±3.16 | 22.69±3.00 | 22.19±3.23 | |
| 4K | 19.30±2.27 | 29.61±3.04 | 17.40±2.23 | 24.57±2.98 | 30.16±2.04 | 29.87±3.98 | 28.46±1.37 | 25.78±3.53 | ||
| 8K | 21.46±1.17 | 27.82±2.25 | 20.55±2.29 | 26.91±3.21 | 32.67±0.86 | 29.75±2.06 | 31.21±1.40 | 26.37±3.17 | ||
Setup We implement Goal tasks with Point and Car agents in MJX, following Safety Gym-style navigation task definitions [15, 9] and the accelerator-side simulation design of JAX-based physics engines [6]. We further implement a locomotion task with a Laikago robot [10] in both MJX and MuJoCo Warp. To compare different constraint-handling paradigms, CPO, TRPO-Lag, and CRPO were chosen as representative primal-dual, Lagrangian, and primal methods, respectively [1, 17, 19]. By default, the massively parallel setting uses 2,000 environments collecting a batch size of 20,000 steps per update over 500 epochs. All experiments on the Goal tasks were conducted on Google TPU v4, while locomotion tasks were conducted on machine with NVIDIA GeForce RTX 4090 GPU.
Effect of staggered reset and tightening. We first compare massively parallel training with short-rollout updates using the two initialization schemes, standard synchronous reset and staggered reset, and then evaluate the additional effect of the tightening method. Since standard initialization does not provide a finished-episode cost return at every update, the latest completed-episode cost return is reused for updates without completed episodes; we denote this estimate by LR. Staggered reset uses two cost surrogates, denoted as SC for sampled cost and CV for critic value estimates, evaluated with and without tightening. We further scale parallelism from 2k to 4k and 8k environments, so the batch size increases to 40,000 and 80,000 transitions, respectively.
Table 1 shows the results of CPO on the Goal task across different environment scales. At 2k environments, standard initialization exceeds the cost limit, with completed episode cost returns available only sparsely. Staggered reset reduces cost returns by providing estimates from every phase-mixture batch. Without tightening, both surrogates still exceed the cost limit, even as increasing parallelism leads to higher rewards. Applying tightening further reduces costs at the expense of reward: SC keeps the reported mean episodic cost below the limit across the tested scales, whereas CV exceeds it in some configurations. The reward gap between tightened and untightened training narrows at larger scales, consistent with the smaller finite-sample bound afforded by increased sampling.
Comparison with non-massive environment training. We compare the proposed massively parallel setting against the small-vectorized environment setting used in existing implementations, denoted as the standard setting. Figure 1 shows the learning curves of the Goal tasks in terms of wall-clock time and total environment steps. With the same number of environment steps, the massively parallel setting generally converges to lower rewards than the standard setting using full task-horizon rollouts, which achieves better sample efficiency by providing complete task trajectories. However, the primary advantage of massively parallel training lies in wall-clock efficiency rather than sample efficiency. By processing many short rollouts from different phases concurrently on accelerators, the massively parallel setting increases transition throughput and enables more frequent policy updates within the same elapsed time. In terms of wall-clock time, training in the massively parallel setting converges to higher reward levels across algorithms as parallelism increases. In

(a) Point/Goal. The left side shows the wall-clock wise comparison and the right side shows the total sample wise comparison.

(b) Car/Goal. The left side shows the wall-clock wise comparison and the right side shows the total sample wise comparison.
Figure 1: Wall-clock wise and total sample wise learning curves of all algorithms on the Goal task. Columns correspond to CPO, CRPO, and TRPO-Lag. Markers are shown every 100 epochs and report trailing 10-epoch averages, and the horizontal line marks the cost limit.
particular, 8k configuration achieves rewards comparable to the standard setting with better constraint satisfaction in substantially less training time.
Figure 2 shows the learning curves of the Laikago locomotion task implemented using MJX and MuJoCo Warp. Consistent with the trends observed in the Goal tasks, reward convergence improves as parallelism increases, reaching a level comparable to the standard setting at 4K environments and surpassing it at 8K. In terms of wall-clock time, both MJX and MuJoCo Warp achieve substantially shorter training times at 8K environments than the standard setting. The difference between the two implementations further suggests that additional efficiency gains can be obtained through the choice of GPU simulation backend. Overall, these results demonstrate that massively parallel training could provide substantial wall-clock efficiency gains for safe RL research while maintaining or improving performance.
Ablation studies We conduct ablation studies to compare the effects of increasing rollout length against increasing the number of parallel environments and to examine how each tightening term affects training. The results are provided in Appendix B.

(a) Comparison across environment scales in terms of total environment steps, averaged over MJX and MuJoCo Warp.

(b) Comparison of the standard and 8k environment settings in terms of wall-clock time using MJX and MuJoCo Warp.
Figure 2: Learning curves of CRPO on the Laikago locomotion task. Markers are shown every 100 epochs and report trailing 10-epoch averages. Costs are normalized by their respective limits, with horizontal lines indicating the normalized cost limit of 1.
5 Limitations
The theoretical results assume bounded costs, independent samples across environments, sufficient phase coverage, and uniform staggered resets for the simplified corollaries. Freezing terminated environments wastes some computation but preserves fixed computation shapes for efficient accelerator execution, allowing the throughput gains from massive parallelism to potentially outweigh this overhead. Nevertheless, extending the implementation to arbitrary asynchronous or highly nonuniform reset schedules remains for future work. The practical tightening rule combines finite-sample tightening with density ratio correction, but the ablations show that most of the improvement in constraint satisfaction comes from the finite-sample term. Further evaluation on complex tasks with greater phase-initial distribution mismatch would help clarify the contribution of distribution correction. Applying tightening to multiple constraints may also become overly conservative and restrict learning, motivating further study of alternatives to tightening. The CV surrogate relies on critics trained with bootstrapped k-step targets from short rollouts and shows less consistent cost control than SC in the reported experiments. The current tightening rule does not account for critic estimation errors, and extending it to cover these errors could further increase conservatism. An alternative is to investigate distributional critics that exploit the large training batches to improve cost estimation.
6 Conclusion
We propose a massively parallel Safe RL framework that aligns short-rollout training with episode-level CMDP constraints through phase-covered cost estimation. By analyzing staggered reset as a phase-mixture data collection scheme, we derive cost surrogates with finite-sample and phase-initial distribution corrections, and instantiate the correction with PIS-DICE. Experiments on Safety Gym-style Goal tasks implemented in MJX and Laikago locomotion tasks implemented in both MJX and MuJoCo Warp show that the proposed framework improves wall-clock efficiency while keeping costs near their limits. These results demonstrate that safe RL can be effectively extended to massively parallel training regimes, achieving substantial gains in wall-clock efficiency while maintaining constraint satisfaction.
Acknowledgments and Disclosure of Funding
This work was supported by the Institute of Information & Communications Technology Planning & Evaluation (IITP) grants funded by the Korea government (MSIT) through the Information Technology Research Center program (IITP-2026-RS-2023-00260098) and the Artificial Intelligence Convergence Innovation Human Resources Development program (IITP-2026-RS-2023-00254177).
This work was also supported with Cloud TPUs from Google's TPU Research Cloud (TRC) program, and we sincerely thank the TRC team for their generous and continuous support.
References
[1] Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International conference on machine learning, pages 22–31. Pmlr, 2017.
[2] Rishabh Agarwal, Max Schwarzer, Pablo Samuel Castro, Aaron C Courville, and Marc Bellemare. Deep reinforcement learning at the edge of the statistical precipice. Advances in Neural Information Processing Systems, 34, 2021.
[3] Eitan Altman. Constrained Markov Decision Processes. Technical Report RR-2574, INRIA, May 1995. URL https://inria.hal.science/inria-00074109.
[4] Sid Bharthulwar, Stone Tao, and Hao Su. Staggered environment resets improve massively parallel on-policy reinforcement learning. In The Thirty-ninth Annual Conference on Neural Information Processing Systems, 2026. URL https://openreview.net/forum?id=hesM5BWt0J.
[5] Theresa Eimer, Marius Lindauer, and Roberta Raileanu. Hyperparameters in reinforcement learning and how to tune them. In Proceedings of the 40th International Conference on Machine Learning, ICML'23. JMLR.org, 2023.
[6] C Daniel Freeman, Erik Frey, Anton Raichuk, Sertan Girgin, Igor Mordatch, and Olivier Bachem. Brax—a differentiable physics engine for large scale rigid body simulation. arXiv preprint arXiv:2106.13281, 2021.
[7] Shangding Gu, Long Yang, Yali Du, Guang Chen, Florian Walter, Jun Wang, and Alois Knoll. A review of safe reinforcement learning: Methods, theories, and applications. IEEE Trans. Pattern Anal. Mach. Intell., 46(12):11216–11235, December 2024. ISSN 0162-8828. doi: 10.1109/TPAMI.2024.3457538. URL https://doi.org/10.1109/TPAMI.2024.3457538.
[8] Ashish Kumar Jayant and Shalabh Bhatnagar. Model-based safe deep reinforcement learning via a constrained proximal policy optimization algorithm. In Proceedings of the 36th International Conference on Neural Information Processing Systems, NIPS '22, Red Hook, NY, USA, 2022. Curran Associates Inc. ISBN 9781713871088.
[9] Jiaming Ji, Jiayi Zhou, Borong Zhang, Qingyang Dai, Xuehai Pan, Ruiyang Sun, Weidong Huang, Yiran Geng, and Yaodong Liu. Safety-gymnasium: A unified safe reinforcement learning benchmark. In Advances in Neural Information Processing Systems, Datasets and Benchmarks Track, 2023.
[10] Dohyeong Kim, Taehyun Cho, Seungyub Han, Hojun Chung, Kyungjae Lee, and Songhwai Oh. Spectral-risk safe reinforcement learning with convergence guarantees. Advances in Neural Information Processing Systems, 37:92465–92498, 2024.
[11] Sotetsu Koyamada, Shinri Okano, Soichiro Nishimori, Yu Murata, Keigo Habara, Haruka Kita, and Shin Ishii. Pgx: Hardware-accelerated parallel game simulators for reinforcement learning. In Thirty-seventh Conference on Neural Information Processing Systems Datasets and Benchmarks Track, 2023. URL https://openreview.net/forum?id=UvX8QfhfUx.
[12] Viktor Makovychuk, Lukasz Wawrzyniak, Yunrong Guo, Michelle Lu, Kier Storey, Miles Macklin, David Hoeller, Nikita Rudin, Arthur Allshire, Ankur Handa, and Gavriel State. Isaac gym: High performance gpu-based physics simulation for robot learning. arXiv preprint arXiv:2108.10470, 2021.
[13] Andreas Maurer and Massimiliano Pontil. Empirical bernstein bounds and sample variance penalization. In Conference on Learning Theory, 2009.
[14] Ofir Nachum, Yinlam Chow, Bo Dai, and Lihong Li. Dualdice: Behavior-agnostic estimation of discounted stationary distribution corrections. Advances in neural information processing systems, 32, 2019.
[15] Alex Ray, Joshua Achiam, and Dario Amodei. Benchmarking safe exploration in deep reinforcement learning. arXiv preprint arXiv:1910.01708, 7(1):2, 2019.
[16] Nikita Rudin, David Hoeller, Philipp Reist, and Marco Hutter. Learning to walk in minutes using massively parallel deep reinforcement learning. In 5th Annual Conference on Robot Learning, 2021. URL https://openreview.net/forum?id=wK2fDDJ5VcF.
[17] John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning, 2015.
[18] Akifumi Wachi, Xun Shen, and Yanan Sui. A survey of constraint formulations in safe reinforcement learning. In Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence, IJCAI '24, 2024. ISBN 978-1-956792-04-1. doi: 10.24963/ijcai.2024/913. URL https://doi.org/10.24963/ijcai.2024/913.
[19] Tengyu Xu, Yingbin Liang, and Guanghui Lan. CRPO: A new approach for safe reinforcement learning with convergence guarantee. In International Conference on Machine Learning, 2021.
[20] Moritz A. Zanger, Karam Daaboul, and J. Marius Zöllner. Safe continuous control with constrained model-based policy optimization. In 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 3512–3519, 2021. doi: 10.1109/IROS51168.2021.9635984.
[21] Sihan Zeng, Thinh T. Doan, and Justin Romberg. Finite-time complexity of online primal-dual natural actor-critic algorithm for constrained markov decision processes. In 2022 IEEE 61st Conference on Decision and Control (CDC), pages 4028–4033, 2022. doi: 10.1109/CDC51059.2022.9992837.
[22] Ruiyi Zhang, Bo Dai, Lihong Li, and Dale Schuurmans. Gendice: Generalized offline estimation of stationary values. In International Conference on Learning Representations, 2020.
[23] Shangtong Zhang, Bo Liu, and Shimon Whiteson. Gradientdice: Rethinking generalized offline estimation of stationary values. In International Conference on Machine Learning, pages 11194–11203, 2020.
A Supplementary proofs and implementation details
A.1 Proofs omitted in the main text
A.1.1 Proof of Lemma 3.1
Proof. Condition on the phase allocation . For each environment with , the distribution of under the rollout policy is . Hence the definition of gives
Starting from the empirical phase-mixture return in Eq. (5) and using linearity of expectation,
By the definition and the phase return in Eq. (4), the final line equals
which is Eq. (6).
□
A.1.2 Proof of Proposition 3.2
Proof. Lemma 3.1 gives the collected phase-mixture expectation in Eq. (6). Expanding by Eq. (4),
The current policy phase-mixture return is Eq. (7), namely
Subtracting the two displays and applying the triangle inequality yields
For any measurable with , the TV variational inequality gives
Applying this inequality with and for every gives Eq. (8).
A.1.3 Proof of Proposition 3.3
Proof. After selecting one of the two cost surrogates in Eq. (10), write it in the form assumed by the proposition,
The variables are independent across environments under the batch construction. The one-sided empirical Bernstein inequality for independent bounded variables [13] states that, with probability at least ,
where . Replacing the sample mean by gives Eq. (11). Thus the right-hand side of Eq. (11) is a valid term for the selected surrogate.
A.1.4 Proof of Theorem 3.4
Proof. Let be the event in Proposition 3.3. On this event, Eq. (11) implies
The theorem assumes the distribution mismatch upper bound
Combining the two inequalities on ,
If the tightened surrogate constraint in Eq. (12) holds, then
The event has probability at least , so the same probability applies to the final constraint statement.
A.1.5 Proof of Theorem 3.5
Proof. Uniform staggered reset assigns equal phase mass for and zero mass to other phases. Substituting this phase distribution into the phase-mixture return from Eq. (6) gives
The final expression is the finite Cesàro mean stated in Theorem 3.5.
A.1.6 Proof of Corollary 3.6
Proof. Lemma 3.1 gives
Theorem 3.5 evaluates the right-hand side under uniform staggered reset as the Cesàro mean. Therefore,
which is Eq. (13).
□
A.1.7 Proof of Corollary 3.7
Proof. Start from the distribution mismatch bound in Eq. (8). Under uniform staggered reset, the only nonzero phase masses are for . Substituting these identities gives
(43)
(44)
The final expression is Eq. (14).
□
A.1.8 Proof of Corollary 3.8
Proof. Begin with the general phase-wise surrogates in Eq. (10). Uniform staggered reset gives and . For every time step , there is a unique pair with and . Using the coverage mass definition in Eq. (9),
The coverage-correction weight in Eq. (9) is therefore
For the sampled cost surrogate in Eq. (10), substituting and the preceding weight gives
(49)
(50)
For the critic value surrogate, Eq. (10) has no coverage-correction weight. Substituting only gives
The two derived expressions are exactly Eq. (15).
Table 2: Goal-task configurations. The cost limit specifies the maximum cumulative episodic cost.
| Task | Agent | Horizon | Objects | Cost event | Limit |
|---|---|---|---|---|---|
| Goal | Point | 1000 | goal, 8 hazards, 1 vase | hazard proximity | 25 |
| Goal | Car | 1000 | goal, 8 hazards, 1 vase | hazard proximity | 25 |
A.1.9 Proof of Proposition 3.9
Proof. For each phase , the change-of-measure identity gives
Taking absolute values, applying the triangle inequality, and using gives
Applying the triangle inequality to the uniform phase average and then averaging the preceding bound over proves Eq. (18).
A.1.10 Proof of Proposition 3.10
Proof. For each phase , change of measure gives
Therefore, the difference between the exact-ratio correction and the learned-ratio correction is
Taking absolute values and using gives
(56)
Applying the triangle inequality to the uniform phase average and then averaging the preceding bound over gives the result.
A.2 Implementation details
We implement the Safety Gym-style Goal tasks in MJX and the Laikago locomotion task in both MJX and MuJoCo Warp to support massively parallel training on accelerators.
Goal Tasks Following Safety Gym and Safety-Gymnasium [9, 15], we implement the Point/Goal and Car/Goal tasks with MuJoCo agent models, goals, hazards, and vases. The environments are vectorized in MJX, with rewards, costs, and observations computed at each simulation step.
Both agents use two-dimensional continuous action vectors, with 12-dimensional and 24-dimensional sensor vectors for Point and Car, respectively. Observations combine these sensor vectors with three 16-bin pseudo-lidar groups for the goal, hazards, and vase, resulting in observation dimensions of 60 and 72, respectively.
Let and denote the agent and goal positions, respectively, and let . The reward is defined as
where is the goal radius. The reward consists of progress toward the goal and a unit reward upon reaching it, after which a new goal is sampled. The binary safety cost is defined as
where denotes the position of hazard i and is the hazard radius. Both tasks use a single safety constraint with an episodic cost limit of 25.
Table 3: Algorithm configuration. Rows with shared values span all three algorithms.
| Config | CPO | CRPO | TRPO-Lag |
|---|---|---|---|
| Critic learning rate | |||
| Discount factor | 0.99 | ||
| Reward trace parameter | 1.0 | ||
| Cost trace parameter | 1.0 | ||
| Target KL | 0.01 | ||
| CG iterations | 15 | ||
| CG damping | 0.1 | ||
| Line search coefficient | 0.8 | ||
| Rollout mode | staggered | ||
| Rollout length | |||
| Policy updates | 500 | ||
| Cost limit | 25 | ||
| Tightening confidence level | 0.05 | ||
| Tightening ratio clip | 3.0 | ||
| Hidden layers | (64, 64) | ||
| Activation | tanh | ||
| Observation normalization | true | ||
| Lagrange optimizer | - | - | Adam |
| Lagrange learning rate | - | - | 0.035 |
| Initial Lagrange multiplier | - | - | 0.001 |
Locomotion Task We adopt the Laikago locomotion task from [10] and implement it in both MJX and MuJoCo Warp. The robot tracks velocity commands on flat terrain. At the beginning of each episode, the forward and angular velocity commands are sampled as
The reward penalizes squared tracking errors between commanded and actual base velocities, with an additional power regularization term.
The task uses three costs for balance, center-of-mass (CoM) height, and foot contact timing:
Here, is the angle between the robot base and world vertical axes, is the CoM height, and and denote the measured and desired contact states of leg , respectively. The desired contact pattern follows per-leg phase variables with a fixed frequency. The foot timing constraint uses a looser limit than the balance and height constraints, as it primarily serves as a motion regularizer.
B Ablation studies
This appendix reports the Goal-task ablations that isolate the effects of staggered reset, rollout length, and constraint-tightening terms. All entries report the mean and standard deviation of the last 10 epochs over eight seeds unless otherwise specified. SC denotes the sampled cost estimate, CV denotes the critic value estimate.
B.1 Rollout length
To examine the trade-off between rollout length and environment parallelism in massively parallel safe RL, Table 4 compares increasing batch size through longer rollouts with the environment scaling results reported in Table 1.
Both approaches tend to achieve higher rewards as batch size increases, although the cost limit remains violated without tightening. Once tightening is applied, all configurations satisfy the constraint, with increasing environment parallelism achieving higher rewards in most cases than extending rollout length. This difference is consistent with the larger number of samples collected per phase, which reduces the finite-sample bound and allows less conservative tightening. Moreover, the higher transition throughput obtained through greater parallelism reduces wall-clock time, making short-rollout training more effective in terms of both reward performance and training efficiency.
Table 4: Comparison of increasing rollout length and environment scale at the same batch size using CPO with the SC surrogate. Values are mean ± standard deviation of the last 10 updates over eight seeds. Shading indicates cost > 25. Bold highlights the highest feasible reward and its corresponding cost and time for each task and batch size.
| Task | Batch size | Fixed envs (2k) | Fixed rollout (10) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Rollout | w/o tightening | w/ tightening | Envs | w/o tightening | w/ tightening | ||||||||||
| Reward | Cost | Time | Reward | Cost | Time | Reward | Cost | Time | Reward | Cost | Time | ||||
| Point/Goal | 20k | 10 | 14.57±2.78 | 27.08±0.84 | 4.10 | 7.56±3.06 | 13.88±1.59 | 4.09 | 2k | - | - | - | - | - | - |
| 40k | 20 | 17.96±1.12 | 27.05±1.10 | 7.77 | 13.96±1.41 | 15.05±0.63 | 7.88 | 4k | 17.28±5.37 | 26.27±1.23 | 6.84 | 13.42±3.52 | 20.00±3.49 | 7.09 | |
| 80k | 40 | 20.46±0.48 | 27.18±0.91 | 15.91 | 16.43±0.81 | 16.36±0.39 | 16.20 | 8k | 21.23±1.05 | 27.02±1.50 | 12.87 | 18.83±0.73 | 21.19±2.05 | 13.03 | |
| Car/Goal | 20k | 10 | 25.12±2.11 | 28.63±1.46 | 12.92 | 18.52±2.83 | 14.38±1.18 | 13.03 | 2k | - | - | - | - | - | - |
| 40k | 20 | 29.11±1.69 | 26.45±0.77 | 25.64 | 22.29±2.90 | 15.49±0.66 | 25.75 | 4k | 27.57±1.76 | 26.87±1.18 | 24.82 | 24.38±2.04 | 18.43±0.75 | 24.96 | |
| 80k | 40 | 32.55±0.52 | 26.54±0.74 | 51.22 | 26.76±1.16 | 16.69±0.70 | 51.32 | 8k | 32.17±0.95 | 26.52±1.38 | 50.24 | 29.57±0.70 | 21.06±0.70 | 50.53 | |
B.2 Tightening term ablation
To examine the contribution of each tightening term to constraint satisfaction, Table 5 compares CPO with the finite-sample term and the phase-initial distribution correction term , applied individually and jointly to the SC and CV surrogates across environment scales from 2k to 32k.
The results show that applying the finite-sample term accounts for most of the improvement in constraint satisfaction, whereas alone has little effect on cost returns. For the SC surrogate, satisfies the constraint across all environment scales, and combining both terms provides further cost reductions in some configurations. However, the CV surrogate continues to violate the constraint in several configurations even with both terms, since critic approximation errors are not covered by the finite-sample bound. The limited effect of in these experiments also indicates that further evaluation on tasks with greater phase-initial distribution mismatch is needed to assess the contribution of distribution correction.
Table 5: Ablation of finite-sample tightening () and phase-initial distribution correction () across environment scales using SC and CV surrogates. Values are mean standard deviation of the last 10 epochs over eight seeds. Shading indicates cost .
| Cost est. | Envs | No tightening | only | only | Both () | ||||
|---|---|---|---|---|---|---|---|---|---|
| Reward | Cost | Reward | Cost | Reward | Cost | Reward | Cost | ||
| SC | 2k | 14.57 2.78 | 27.08 0.84 | 12.87 3.83 | 25.77 1.87 | 9.55 4.08 | 17.43 2.39 | 7.56 3.06 | 13.88 1.59 |
| 4k | 17.28 5.37 | 26.27 1.23 | 16.44 3.21 | 27.10 2.27 | 12.71 1.99 | 18.19 1.91 | 13.42 3.52 | 20.00 3.49 | |
| 8k | 21.23 1.05 | 27.02 1.50 | 21.27 0.69 | 27.02 1.62 | 18.68 1.43 | 22.69 1.70 | 18.83 0.73 | 21.19 2.05 | |
| 16k | 23.07 0.46 | 25.73 0.84 | 23.09 0.48 | 25.72 1.20 | 22.09 0.55 | 21.86 1.02 | 22.30 0.68 | 22.66 1.41 | |
| 32k | 23.81 0.64 | 25.07 0.33 | 24.37 0.54 | 25.88 0.74 | 23.48 0.70 | 23.19 0.42 | 23.43 0.70 | 23.06 0.59 | |
| CV | 2k | 15.29 3.76 | 29.55 3.43 | 16.41 2.95 | 26.62 1.28 | 13.49 2.16 | 24.60 5.18 | 13.42 2.06 | 24.53 3.93 |
| 4k | 19.30 2.27 | 29.61 3.04 | 19.91 1.09 | 28.82 2.96 | 17.10 1.24 | 23.31 1.66 | 17.40 2.23 | 24.57 2.98 | |
| 8k | 21.46 1.17 | 27.82 2.25 | 21.71 1.58 | 27.16 2.66 | 20.43 2.75 | 26.16 2.34 | 20.55 2.29 | 26.91 3.21 | |
| 16k | 23.10 0.87 | 26.78 2.76 | 23.38 0.59 | 26.07 1.56 | 23.05 0.81 | 25.55 1.69 | 22.79 1.18 | 23.94 2.26 | |
| 32k | 24.82 0.36 | 26.82 1.42 | 24.39 0.73 | 25.37 2.50 | 24.42 0.47 | 25.28 1.84 | 24.41 0.86 | 24.92 1.61 | |