Table of Contents
Fetching ...

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.

PiShield: A PyTorch Package for Learning with Requirements

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.
Paper Structure (11 sections, 3 figures, 1 table)

This paper contains 11 sections, 3 figures, 1 table.

Figures (3)

  • Figure 1: PiShield overview.
  • Figure 2: The unconstrained models (top row) violate simple background knowledge rules, predicting (i) that a pedestrian is both on the right and on the left pavement, and (ii) that a person is both a pedestrian and a cyclist, and is moving towards and away from the self-driving vehicle at the same time. On the other hand, the predictions made using PiShield (bottom row) are guaranteed to be compliant with the background knowledge.
  • Figure 3: Real data (left) and samples generated by an unconstrained neural network (middle) and a neural network constrained with PiShield (right).

Theorems & Definitions (2)

  • Example 1
  • Example 2