Source-linked AI summary

OmniSafe: An Infrastructure for Accelerating Safe Reinforcement Learning Research

Jiaming Ji, Jiayi Zhou, Borong Zhang, Juntao Dai, Xuehai Pan, Ruiyang Sun, Weidong Huang, Yiran Geng, Mickel Liu, Yaodong Yang

arXiv:2305.09304v1cs.LGcs.AI

TL;DR

SafeRL research lacks a unified framework despite technical challenges integrating algorithms across domains. OmniSafe provides a modular, broad algorithm infrastructure with asynchronous parallel training; the authors report experimental validation across diverse RL domains.

  • Problem

    SafeRL lacks a unified, maintained framework, and integrating algorithms across domains presents significant technical challenges.

    Source: §1 · p. 2
  • Method

    OmniSafe provides a broad SafeRL algorithm framework with modular Adapter and Wrapper components and asynchronous parallel training.

    Source: §1 · p. 2, §2 · p. 2
  • Results

    The authors report experimentally validating numerous algorithms spanning diverse RL domains.

    Source: §4 · p. 4
  • Takeaways & Limitations

    OmniSafe combines documentation, environment compatibility, modularity, and distributed computing support for SafeRL research.

    Source: §4 · p. 4

Abstract

from arXiv · show

AI systems empowered by reinforcement learning (RL) algorithms harbor the immense potential to catalyze societal advancement, yet their deployment is often impeded by significant safety concerns. Particularly in safety-critical applications, researchers have raised concerns about unintended harms or unsafe behaviors of unaligned RL agents. The philosophy of safe reinforcement learning (SafeRL) is to align RL agents with harmless intentions and safe behavioral patterns. In SafeRL, agents learn to develop optimal policies by receiving feedback from the environment, while also fulfilling the requirement of minimizing the risk of unintended harm or unsafe behavior. However, due to the intricate nature of SafeRL algorithm implementation, combining methodologies across various domains presents a formidable challenge. This had led to an absence of a cohesive and efficacious learning framework within the contemporary SafeRL research milieu. In this work, we introduce a foundational framework designed to expedite SafeRL research endeavors. Our comprehensive framework encompasses an array of algorithms spanning different RL domains and places heavy emphasis on safety elements. Our efforts are to make the SafeRL-related research process more streamlined and efficient, therefore facilitating further research in AI safety. Our project is released at: https://github.com/PKU-Alignment/omnisafe.

1. Introduction

SafeRL research addresses the risk that agents may develop unsafe behaviors in safety-critical applications, but the field lacks a unified, maintained framework. OmniSafe is introduced to provide infrastructure and a broad algorithm collection for SafeRL research.

  • SafeRL agents can develop unsafe control policies through environmental feedback, with potential harms in safety-critical applications.Source: §1 · pp. 1–2
  • SafeRL lacks a unified, maintained framework, while cross-domain algorithm integration presents significant technical challenges.The earlier safety-starter-agent implemented four classical algorithms but has not been maintained, and its TensorFlow-v1 dependency is deprecated.Source: §1 · p. 2
  • OmniSafe addresses this gap with infrastructure spanning Off-Policy, On-Policy, Model-based, and Offline algorithms.Source: §1 · p. 2

2. Features of OmniSafe

OmniSafe combines modular algorithm and environment interfaces with asynchronous parallel training. It also provides algorithm verification resources and documentation aimed at supporting SafeRL researchers and newcomers.

High Modularity

  • Adapter and Wrapper components reconcile algorithm-structure differences across CMDPs and variability in algorithm-environment interactions.Source: §2 · p. 2

High-performance parallel computing acceleration

  • Process parallelism supports environment-level asynchronous parallelism and agent asynchronous learning, which the authors say bolster stability and expedite training.Source: §2 · p. 2

Code reliability and reproducibility

  • Algorithms were tested in Safety-Gym and Mujoco-Velocity against results in original papers, with code examples provided for reproduction.Source: §2 · p. 2

Fostering the Growth of SafeRL Community

  • Documentation combines user guides, examples, parameter-selection and monitoring best practices, theoretical derivations, and practical tutorials for learners.Source: §2 · p. 3
  • Single-file training and algorithm-level abstractions complement the documented API and asynchronous training features.Source: Figure 1 · p. 3

3. DataFlows of OmniSafe

OmniSafe uses a unified dataflow with Adapters and Wrappers to connect algorithms and environments. Its modular design supports reuse, compatibility, and changes to problem paradigms with minimal code alterations.

  • Adapter and Wrapper designs support reuse and compatibility across algorithm and environment interfaces, reducing engineering for new integrations.Source: §3 · pp. 3–4
  • Changing from CMDP to SauteMDP requires replacing the inflow-side Adapter, enabling the paradigm change with minimal code alterations.Source: §3 · p. 4
  • The dataflow moves from vectorized-environment trajectories through EnvWrapper monitoring, Adapter preprocessing, Learner training, and ActionWrapper action conversion.Processes periodically synchronize weights and all-reduce gradients.Source: Figure 2 · p. 4

4. Conclusion and Outlook

OmniSafe brings documentation, environment compatibility, modularity, and distributed computing support to SafeRL infrastructure. The authors report experimental validation of algorithms across diverse RL domains and aim to standardize research tools and methods.

  • OmniSafe combines extensive API documentation, popular-environment compatibility, high modularity, and distributed computing support.Source: §4 · p. 4
  • The framework's algorithms were experimentally validated across diverse RL domains to support experimentation and verification of new concepts.Source: §4 · p. 4
  • The authors aim to standardize SafeRL tools and methods for a more streamlined and efficient research process.Source: §4 · p. 4

A. Implemented Algorithms of OmniSafe

OmniSafe combines algorithms across SafeRL domains with a modular design intended to support extension. Its coverage spans both conventional RL algorithm families and SafeRL learning paradigms.

  • OmniSafe integrates a broad collection of SafeRL algorithms, and its Adapter module supports expanding the framework with different algorithm types.Source: A. Implemented Algorithms of OmniSafe · p. 8
  • The collection spans on-policy, off-policy, offline, and model-based RL, alongside primal-dual, projection, penalty-function, and primal SafeRL paradigms.Source: Table 1 · p. 8

B. Safety-Gymnasium Experiment Results of OmniSafe

OmniSafe reports evaluations of its algorithms in Safety-Gymnasium environments and compares classical RL implementations with published baselines. The provided passages describe the evaluation scope and settings but do not report comparative outcome values.

  • OmniSafe’s performance was compared with published Tianshou and Stable-Baselines3 baselines in Safety-Gymnasium MuJoCo Velocity environments, with results reported as mean and standard deviation across 10 assessment iterations and multiple random seeds.Stable-Baselines3 used distinct parameters tailored to each environment, while OmniSafe maintained one consistent parameter set across environments.Source: B. Safety-Gymnasium Experiment Results… · p. 8, Table 2 · p. 9
  • The Safety-Gymnasium MuJoCo Velocity training curves cover classical RL algorithms and show rewards over 1e6 interaction steps.Source: Figure 3 · p. 9
  • OmniSafe reports reward and cost results for its algorithms across Safety-Gymnasium environments, with Table 3 covering multiple algorithm families.The table includes on-policy, off-policy, offline, and model-based evaluations, but the supplied passages do not provide their outcome values.Source: B. Safety-Gymnasium Experiment Results… · p. 9, Table 3 · p. 12
  • Figure 4 plots reward and cost curves in MuJoCo Navigation and Velocity environments over 1e7 interaction steps, with a target cost of 25.0 for a safe policy.Some Early-Terminated MDP algorithms have cost values exactly 25.00 because training stops when constraint violation exceeds the set range.Source: B. Safety-Gymnasium Experiment Results… · p. 9, Figure 4 · p. 10

C. Experiment Grid of OmniSafe

OmniSafe’s Experiment Grid runs multiple configured experiment sets in parallel, supporting repeated evaluation and parameter tuning. The reported batch-size exploration found an optimal value of 128 for PPO-Lag in SafetyAntVelocity-v1.

  • The Experiment Grid launches multiple configured experiment sets in parallel, helping researchers repeat evaluations across distinct random seeds.Users configure the experiment parameters and run multiple sets through a single file.Source: C. Experiment Grid of OmniSafe · p. 13, Figure 5 · p. 13
  • The grid script can group seeds and generate training curves across environments and algorithms, as illustrated with PPO-Lag and TRPO-Lag.The example uses SafetyAntVelocity-v1 and SafetyWalker2dVelocity-v1.Source: Figure 5 · p. 13, C. Experiment Grid of OmniSafe · p. 14
  • For PPO-Lag in SafetyAntVelocity-v1, batch size 128 was reported as optimal after repeated experiments and statistical analysis.The exploration compared batch sizes 64, 128, and 256; the passage says batch size significantly influenced performance in this setting.Source: C. Experiment Grid of OmniSafe · p. 14, Figure 7 · p. 14

D. The Documentation of OmniSafe

OmniSafe’s documentation combines introductory guidance, theory, and implementation material to help users learn SafeRL algorithms and use the framework. It links mathematical explanations to code tutorials and provides quick-start video examples.

  • Quick-start videos demonstrate algorithm training, evaluation, Experiment Grid use, and help access.Figure 8 shows commands for running PPO in the default SafetyPointGoal1-v0 environment and the resulting terminal output.Source: Figure 8 · p. 15, D. The Documentation of OmniSafe · p. 16
  • Introductory mathematical tutorials and a unified symbol system help readers approach SafeRL algorithms whose derivations require prerequisite knowledge and use differing notation.The documentation also provides API usage examples and detailed function introductions.Source: D. The Documentation of OmniSafe · p. 16
  • The documentation links SafeRL theory to implementation through tutorials that cover algorithm commands, parameter explanations, and core functions.CPO is presented as an example, with clickable access to theoretical proofs alongside step-by-step code guidance.Source: D. The Documentation of OmniSafe · p. 17, Figure 10 · p. 17

E. Features of OmniSafe

OmniSafe combines a standardized, user-friendly framework with features intended to support code quality, learning, and experiment analysis. Its documentation, command-line help, Colab tutorial, and WandB reports provide guidance and experimental views for users.

Loading 2305.09304v1…