Enforcing Ellipsoidal Constraints in Neural Networks with a Polynomial Safety Layer
Authors: Rolf Findeisen, Sebastian Hirt, Hoang Hai Nguyen, Grace Li Zhang, Hendrik Alsmeier
Organizations: Control and Cyber-Physical Systems Laboratory, Technical University of Darmstadt, Germany · Hardware for Artificial Intelligence, Technical University of Darmstadt, Germany
Often the output of a learned mapping must satisfy prescribed constraints. In the control of autonomous systems, for example, the chosen action must keep the system within a collision-free region. We consider the case in which a proposed output is corrected by projection onto a safety ellipsoid. Computing this projection amounts to solving a quadratically constrained quadratic program (QCQP). We construct a neural-network safety layer by unrolling a feasibility-preserving polynomial penalty iteration. The unrolled structure allows the loss gradient to propagate from the feasible output through the safety layer to the network parameters during training. We show how to choose the layer parameters so that every iterate is feasible and give a computable bound on its distance to the exact projection at any prescribed depth. We illustrate the method by training a LiDAR-based policy to control an unmanned aerial vehicle. A privileged model predictive control expert uses the map and the measured vehicle state to generate the training data. In the simulated narrow mazes, the filtered policy avoided wall contact at every tested stage of training, including at initialization, when every unfiltered flight hit a wall. A representative build of the learned policy and its safety layer for an Arm Cortex-M4F microcontroller occupies about 36 KiB of flash, with a RAM budget below 5 KiB.
Figures & tables
Figure 1: The neural network hθ proposes uNN . The safety layer starts at the feasible point u(0)=v . Each block Fℓ performs one polynomial penalty step and returns a feasible iterate. The diamond marks the filtered output uS , and the black dot marks the exact projection u⋆ . Pink shows the learning process. During training, y=ydata and the loss compares uS with the paired target udata .
Figure 2: The learned LiDAR policy proposes an acceleration from sensor measurements and route references. The safety layer filters the proposal before it is applied. The MPC supplies the training targets.
Trained with filter
Trained without filter
Examples
Filter active
Bypassed
Filter added
No filter
10,000
102 / 0
78 / 6
60 / 0
90 / 0
20,000
90 / 0
54 / 0
102 / 0
90 / 0
Full dataset
96 / 0
72 / 0
102 / 0
102 / 0
Table 1: Goal arrivals / wall contacts in 108 narrow-maze flights per column and training budget. The remaining flights timed out.
Figure 3: Flight on a held-out maze. The enlargement shows the filter active and bypassed. The square marks where the drone comes to rest when the filter is added only at deployment.
Figure 5: Perturbed starts on a complex maze (left, one policy seed). The enlarged bend shows matched calm and wind-driven flights. The filled circle marks the end of the gust and the open circle marks return to the route tube.