TL;DR
Aegis is a novel framework that synthesizes lightweight, highly permissive programmatic runtime shields to keep neural network controllers safe without destroying system performance. By combining sketch-based program synthesis, counterexample-guided inductive synthesis (CEGIS), and Bayesian optimization, it achieves 100% safety verification while drastically reducing computational overhead and unnecessary interventions compared to the state-of-the-art.
What Problem Does This Paper Address?
Deep Neural Networks (DNNs) are increasingly deployed as "neural policies" to manage complex control systems like autonomous vehicles, drones, and industrial robots. However, because DNNs are inherently black boxes, they can produce unpredictable or unsafe commands in edge-case scenarios, leading to catastrophic system failures.
To mitigate this, engineers use programmatic runtime shields—small, verifiable backup programs that run alongside the neural policy. The shield monitors the network's commands and overrides them with a safe alternative if it detects an impending safety violation.
The catch? Existing state-of-the-art shield synthesis methods rely on complex, high-degree polynomial equations (barrier certificates) to calculate safety boundaries. This introduces two major flaws:
- High Computational Overhead: The complex math causes latency spikes and heavy memory usage, making them impractical for resource-constrained embedded systems.
- Low Permissiveness: These shields are overly conservative, frequently intervening and overriding perfectly benign commands, which destabilizes the system and degrades overall performance.
Aegis was designed to solve this efficiency-permissiveness trade-off.
Methods
Aegis shifts the paradigm away from complex polynomials toward simpler, highly optimized linear functions and inequalities. Its workflow consists of four main phases:
- Program Sketching: Aegis defines a universal program template (a sketch) containing a linear fallback policy and a threshold-based switching strategy.
- Dynamics Inference: Because real-world environments often have unknown physics models, Aegis uses numerical differentiation to locally approximate the environment's dynamics as a linear time-invariant system using Jacobian matrices.
- Counterexample-Guided Inductive Synthesis (CEGIS): Aegis initializes the fallback policy using a standard Linear-Quadratic Regulator (LQR) algorithm. It then uses a CEGIS loop paired with the Maximal Output Admissible Set (MOAS) to find states where the policy might fail. If a counterexample is found, the policy is iteratively refined using gradient-based optimization until it is mathematically proven to be 100% safe.
- Bayesian Optimization (BO): To ensure the shield isn't overly aggressive, Aegis applies Bayesian Optimization with a Gaussian Process surrogate model to discover the optimal switching threshold ($\lambda$). The objective function specifically balances minimizing safety violations while maximizing the ratio of necessary interventions to total interventions.
Datasets
The authors evaluated Aegis across eight representative continuous control systems standard in reinforcement learning and control theory literature:
- Quadcopter: Stabilizing an aerial drone's pitch and yaw.
- CartPole-v1 & CartPole-v2: Balancing a pole on a moving cart (tested with small and large neural network controllers).
- Pendulum-v1 & Pendulum-v2: Inverted pendulum balancing tasks with varying lengths.
- Self-Driving-v1 & Self-Driving-v2: Autonomous lane-keeping and trajectory tracking under strict lateral constraints.
- 4-Car Platoon: Maintaining safe distances in a line of four autonomous vehicles.
While no new datasets were introduced, these benchmarks represent highly challenging, multi-dimensional environments with strict safety envelopes.
Key Insights and Ideas
- Linear Templates are Sufficient: The most significant "aha" moment is that high-degree polynomial barrier certificates are overkill. Well-optimized linear functions can guarantee the exact same level of safety while executing orders of magnitude faster.
- Safety vs. Stability Trade-off: Over-shielding actively harms system stability. When a shield intervenes unnecessarily, it forces the system into a conservative fallback state, requiring more time steps to reach a steady state. Optimizing for permissiveness is just as critical as safety.
- Decoupled Reward Optimization: Unlike previous frameworks that forced the fallback policy to mimic the neural network, Aegis refines its fallback policy purely to maximize environmental safety rewards. This prevents the shield from accidentally inheriting the neural policy's unsafe behaviors.
Key Results
Aegis was evaluated against the current state-of-the-art framework, VRL:
- 100% Safety Enforcement: Aegis successfully eliminated all safety violations across 1,000 test episodes per system, dropping the unshielded neural policy failure rate from 7.9% to 0%.
- Drastic Overhead Reductions: Aegis achieved a 2.2$\times$ reduction in execution latency and a 3.9$\times$ reduction in memory usage compared to VRL.
- Superior Permissiveness: Aegis's shields triggered 1.5$\times$ fewer interventions than the baseline and demonstrated a 10.2% higher ratio of necessary interventions, meaning it lets the neural network operate with much more freedom.
- Excellent Scalability: Shield synthesis time was cut by 3.0$\times$ on average (112 seconds vs 337 seconds) and remained highly stable even when scaling up to control large neural networks containing 7 million neurons.
Limitations and Future Work
- Convexity Assumption: Aegis relies on linear programming to compute safety sets, meaning it assumes safety specifications define convex regions (conjunctions of linear inequalities). It cannot currently handle disjunctive or non-convex safety specifications (e.g., safe zones with physical obstacles or "holes").
- Linearization Limits: The framework assumes system dynamics can be locally linearized. For highly chaotic or extremely non-linear systems, the inferred dynamics model might lose fidelity.
- Future Work: The authors plan to extend Aegis to handle complex systems that process high-dimensional inputs like camera images or audio streams, and explore integrating Large Language Models (LLMs) to optimize the program synthesis pipeline.
Summary updated