arXiv:2506.17297cs.LGcs.AI2025-06

让强化学习更安全可解释,轻松添加约束并实时生成决策理由。

SafeRL-Lite: A Lightweight, Explainable, and Constrained Reinforcement Learning Library

  • 通过模块化包装标准环境与算法,实现安全约束训练
  • 支持实时生成SHAP值和显著图,解释模型决策逻辑
  • 轻量易用,适合需安全可控的RL应用开发

我们提出SafeRL-Lite,一个开源的Python库,用于构建具备约束性和可解释性的强化学习(RL)智能体。现有工具包普遍缺乏原生的安全约束机制或人类可理解的决策解释能力。SafeRL-Lite通过模块化封装标准Gym环境与深度Q-learning智能体,实现:(i) 通过约束强制的安全感知训练;(ii) 借助SHAP值与显著图实现实时后验解释。该库轻量、可扩展,可通过pip安装,并内置约束违规检测指标。我们在受限版CartPole任务上验证了其有效性,可视化结果揭示了策略逻辑与安全遵守情况。完整代码可在https://github.com/satyamcser/saferl-lite获取。

原文摘要 · Abstract (English)

We introduce SafeRL-Lite, an open-source Python library for building reinforcement learning (RL) agents that are both constrained and explainable. Existing RL toolkits often lack native mechanisms for enforcing hard safety constraints or producing human-interpretable rationales for decisions. SafeRL-Lite provides modular wrappers around standard Gym environments and deep Q-learning agents to enable: (i) safety-aware training via constraint enforcement, and (ii) real-time post-hoc explanation via SHAP values and saliency maps. The library is lightweight, extensible, and installable via pip, and includes built-in metrics for constraint violations. We demonstrate its effectiveness on constrained variants of CartPole and provide visualizations that reveal both policy logic and safety adherence. The full codebase is available at: https://github.com/satyamcser/saferl-lite.

强化学习安全约束可解释性Python库

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。