Shaping the model: data and training
Constrained reinforcement learning and shielding
Keep a learning agent inside safety limits. Either maximise reward subject to cost constraints, or add a shield outside the policy that blocks unsafe actions.
Constrained reinforcement learning and shielding keep a learning agent inside explicit safety limits. Constrained RL maximises reward while keeping a separate safety cost below a set budget. Shielding puts a checker outside the agent that blocks or corrects any action that would break a formal safety rule. Both give safety its own explicit place in the system, instead of hoping a single reward captures it.
How it works
In ordinary reinforcement learning, an agent gets one reward signal, and designers try to fold safety into it with penalties. Constrained RL keeps two signals apart: a reward for the task and a cost for unsafe events, such as a robot entering a forbidden zone. The agent maximises reward subject to a limit on expected cost. Constrained Policy Optimization (2017) was the first general-purpose policy-search method for this, with guarantees of near-constraint satisfaction at each training step on simulated robot tasks.
Shielding works differently. Engineers write the safety rule in a formal logic, for example "never enter state X", and build a conservative model of when each action is unsafe. From these they compute a shield. The shield can sit before the agent, offering only safe actions, or after it, letting the agent choose and overriding the choice only if it would break the rule. The 2017 paper that introduced shielding says the shield "corrects them only if the chosen action causes a violation of the specification."
Safe RLHF (October 2023) brought the constrained approach to language models. It trained separate models for helpfulness (reward) and harmlessness (cost) and tuned a chat model to maximise helpfulness under a harm constraint.
Where research stands
This is a large, mature subfield of robotics and control. Surveys map many ways to state constraints, such as cumulative limits over a whole run or instantaneous limits at every step. A 2024 survey accepted at the IJCAI conference derives how these formulations relate. Peking University's Safety-Gymnasium benchmark (NeurIPS 2023) offers safety-critical tasks for single and multiple agents and a library of 16 safe RL algorithms. A November 2025 review in Communications of the ACM covers how shields are computed, what guarantees they give and how they fit with learning.
These methods have so far had limited reach into frontier AI safety. On language models, Safe RLHF cut the share of harmful responses of a 7-billion-parameter model from 53.08% to 2.45% while raising helpfulness ratings. Shields, though, need a correct model of when actions are unsafe, and their guarantees hold only if the real environment matches that model. Such a model is hard to write down for open-ended agents acting through text and software. Shields built on simple backup behaviours can also make agents overly cautious.
Key results
- Constrained Policy Optimization was the first general-purpose policy-search method for constrained RL, with near-constraint satisfaction at each iteration on simulated robot tasks. Joshua Achiam, David Held, Aviv Tamar, Pieter Abbeel, 2017
- A shield synthesised from a temporal-logic safety rule and a conservative environment model can enforce that rule during learning, either by offering only safe actions or by correcting unsafe ones. Mohammed Alshiekh, Roderick Bloem, Ruediger Ehlers, Bettina Könighofer, Scott Niekum, Ufuk Topcu, 2017
- Training a language model to maximise helpfulness under a separate harmlessness constraint cut harmful responses from 53.08% to 2.45% while raising helpfulness ratings. Josef Dai, Xuehai Pan, Ruiyang Sun, Jiaming Ji et al. (Peking University), 2023
- Choosing recovery actions with a local planner kept provable safety while reducing the overly cautious behaviour of earlier backup-policy shields. Arko Banerjee, Kia Rahmani, Joydeep Biswas, Isil Dillig, 2024
- A unified benchmark offers safety-critical tasks for single and multiple agents with vector or vision inputs, plus a library of 16 safe RL algorithms. Jiaming Ji, Borong Zhang, Jiayi Zhou et al., 2023
Open problems
- Shields need an approximate model of when each action is unsafe, and their guarantee fails if the real environment departs from it. source
- Backup policies and shields can be so conservative that they block progress on the task. source
- Stating constraints in natural language, so safe RL can apply to real-world AI systems such as language models, is a promising but early direction. source
- Researchers still debate which constraint formulation fits which problem, and how the formulations relate. source
See all open problems in this group
Criticisms
- Shield guarantees cover only environments that conform to the hand-built abstraction, and shields can grow large for complex rules, which limits use in open-ended settings. Mohammed Alshiekh, Roderick Bloem and co-authors (the method's own authors)
- Shielding approaches built on backup policies "often hinders task progress" because the backups are conservative and ignore the task. Arko Banerjee, Kia Rahmani, Joydeep Biswas, Isil Dillig
Who works on it
- Graz University of Technology: Researchers co-developed shielding and wrote the 2025 review of the field. Shields for Safe Reinforcement Learning (Communications of the ACM) (2025)
- University of Texas at Austin: Researchers co-authored the paper introducing shielding for RL. Safe Reinforcement Learning via Shielding (2017)
- Peking University (Institute for AI, PKU-Alignment): Built the Safety-Gymnasium benchmark and applied constrained RL to language models with Safe RLHF. Safe RLHF: Safe Reinforcement Learning from Human Feedback (2023)
- University of California, Berkeley: Researchers developed Constrained Policy Optimization. Constrained Policy Optimization (2017)
- Tsinghua University: A researcher co-authored the IJCAI 2024 survey of constraint formulations. A Survey of Constraint Formulations in Safe Reinforcement Learning (2024)
Status
Active.
Start reading
- A Survey of Constraint Formulations in Safe Reinforcement Learning, Akifumi Wachi, Xun Shen, Yanan Sui (2024). Short map of how safety constraints are stated and solved.
- Shields for Safe Reinforcement Learning, Bettina Könighofer, Roderick Bloem, Nils Jansen, Sebastian Junges, Stefan Pranger (2025). Accessible review of shielding in Communications of the ACM.
- A Review of Safe Reinforcement Learning: Methods, Theory and Applications, Shangding Gu, Long Yang, Yali Du, Guang Chen et al. (2022). Broad review with applications and open-source code.
- Safe RLHF: Safe Reinforcement Learning from Human Feedback, Josef Dai et al. (2023). The bridge from constrained RL to language-model safety.
Related approaches
- Guaranteed-safe AI and formal verification formal guarantees for AI systems
- Learning from feedback (RLHF) Safe RLHF adds constraints to it
- Impact measures limiting side effects of actions
- Mild optimisation (satisficing) another way to limit optimisation
- AI control outside checks on an agent's actions
In their own words
For many applications of reinforcement learning it can be more convenient to specify both a reward function and constraints, rather than trying to design behavior through the reward function. For example, systems that physically interact with or around humans should satisfy safety constraints.
Joshua Achiam, David Held, Aviv Tamar, Pieter Abbeel, Constrained Policy Optimization, 2017
Reinforcement learning algorithms discover policies that maximize reward, but do not necessarily guarantee safety during learning or execution phases. We introduce a new approach to learn optimal policies while enforcing properties expressed in temporal logic. ... The shield monitors the actions from the learner and corrects them only if the chosen action causes a violation of the specification.
Mohammed Alshiekh, Roderick Bloem, Ruediger Ehlers, Bettina Könighofer, Scott Niekum, Ufuk Topcu, Safe Reinforcement Learning via Shielding, 2017
Suggest a correction Something wrong, out of date or missing, such as an organisation? Opens a GitHub issue (free account needed).