PiShield: A PyTorch Package for Learning with Requirements
Mihaela Cătălina Stoian, Alex Tatomir, Thomas Lukasiewicz, Eleonora Giunchiglia
TL;DR
PiShield tackles the challenge of ensuring safety constraints in neural network outputs by embedding domain requirements directly into the network topology through Shield Layers in PyTorch. The method supports both training-time and inference-time enforcement and handles propositional CNF constraints as well as linear inequalities. It demonstrates benefits across functional genomics, autonomous driving, and tabular data generation, yielding guaranteed compliance and improved performance. This work offers a practical, modular tool for constraint-driven learning with significant implications for safety-critical AI deployments.
Abstract
Deep learning models have shown their strengths in various application domains, however, they often struggle to meet safety requirements for their outputs. In this paper, we introduce PiShield, the first package ever allowing for the integration of the requirements into the neural networks' topology. PiShield guarantees compliance with these requirements, regardless of input. Additionally, it allows for integrating requirements both at inference and/or training time, depending on the practitioners' needs. Given the widespread application of deep learning, there is a growing need for frameworks allowing for the integration of the requirements across various domains. Here, we explore three application scenarios: functional genomics, autonomous driving, and tabular data generation.
