Correct-by-Construction Runtime Enforcement in AI - A Survey

Bettina Könighofer, Roderick Bloem, Rüdiger Ehlers, Christian Pek · DOI

Abstract

Reinforcement learning (RL) agents typically learn through trial and error, a process that inherently involves exploring potentially unsafe states. In safety-critical applications such as robotics or autonomous driving, this exploration can lead to catastrophic failures. This survey explores the emerging field of "correct-by-construction" runtime enforcement—a suite of techniques designed to provide formal safety guarantees for AI systems. By bridging the gap between traditional AI safety and formal methods, the paper reviews state-of-the-art approaches including shielding, reward shaping, and control barrier functions across both discrete and continuous domains.

Introduction

Model-free reinforcement learning has demonstrated remarkable success in complex environments, yet its deployment in the physical world remains limited by safety concerns. Traditional AI safety methods, such as out-of-distribution detection or robust training, improve reliability but lack strict, provable guarantees. Conversely, static formal verification is often inapplicable because a learning agent's behavior is dynamic and evolves over time.

Runtime enforcement addresses this gap by monitoring AI systems in real-time. These techniques act as a "safety net," intervening to block or correct unsafe actions before they occur. This survey categorizes these methods based on the nature of the environment and the underlying mathematical framework used to ensure safety.

Methodological Frameworks

1. Discrete Domains

In environments with finite state and action spaces, runtime enforcement often relies on formal specifications, typically written in Linear Temporal Logic (LTL).

  • Shielding: This is a primary formal method where a "shield" is synthesized from a safety specification and an environmental model.
  • Pre-shields act as action masks, filtering out unsafe options before the agent can select them.
  • Post-shields monitor the agent's output and overwrite unsafe actions with safe alternatives if a violation is predicted.
  • Logically-Constrained RL: This approach involves translating formal safety formulas into state-adaptive reward structures. By penalizing risky behavior through reward shaping, the agent is incentivized to minimize safety violations during and after training.

2. Continuous and Hybrid Domains

Physical systems require methods that can handle continuous state spaces and complex dynamics.

  • Control Barrier Functions (CBFs): CBFs are used to mathematically define and enforce safe boundaries. They provide a way to ensure that the system state remains within a predefined safe set throughout the execution.
  • Justified Speculative Control: This technique allows the agent to explore freely until it approaches a safety boundary. At that critical juncture, a provably correct, non-deterministic backup strategy takes over to guide the system back to a safe state.
  • Reachability Analysis: Often used in tandem with runtime monitoring, reachability analysis helps handle partially unknown environment dynamics without becoming overly conservative.

Key Insights and Challenges

The Synergy of Safety and Learning

A common misconception is that safety constraints hinder performance. However, the survey highlights that restricting an agent's actions using a shield can actually accelerate learning. By pruning the action space and removing catastrophic failures, the agent spends more time exploring high-reward, safe pathways rather than wasting episodes on fatal errors.

The Model Dependency Paradox

A significant hurdle in this field is the "Model Dependency Paradox." While most modern AI approaches strive to be "model-free" to handle complexity, formal runtime enforcement almost always requires a mathematical model of the environment to prove safety. This creates a tension between the flexibility of RL and the rigor of formal methods.

Dimensionality and Conservativeness

In complex, continuous systems, achieving "maximally permissive" enforcement—where only guaranteed unsafe actions are blocked—is often mathematically undecidable. Consequently, researchers rely on approximations, such as affine control barrier functions. While computationally tractable, these approximations can lead to overly conservative behavior, where the monitor prevents the AI from taking safe actions simply because their safety cannot be efficiently verified.

Current Results and Future Directions

The survey notes that runtime enforcement has already yielded impressive results, such as the development of the safest known RL agents for Atari 2600 games using probabilistic shields. However, the field faces a critical lack of standardized benchmarks, making it difficult to compare different approaches' overhead and performance.

Future research is expected to focus on:

  • Automatic Model Identification: Learning the environment's rules on the fly to reduce reliance on predefined models.
  • Partial Observability: Developing enforcement techniques for environments where the agent does not have a full view of the state.
  • Standardized Metrics: Moving beyond simple runtime overhead to measure the trade-off between safety guarantees and behavioral conservativeness.

Summary updated

BibTeX
@inproceedings{konighofer2022correct,
  author = {Bettina Könighofer and Roderick Bloem and Rüdiger Ehlers and Christian Pek},
  title = {{Correct-by-Construction Runtime Enforcement in AI - A Survey}},
  booktitle = {Principles of Systems Design},
  year = {2022},
  url = {https://openreview.net/forum?id=W-LDik9Y7c4},
}
Figure