Pinet: Optimizing hard-constrained neural networks with orthogonal projection layers

Panagiotis D. Grontas, Antonio Terpin, Efe C. Balta, Raffaello D'Andrea, John Lygeros

TL;DR

$\Pi$net is a novel neural network architecture that guarantees the satisfaction of hard convex constraints by design. By integrating an efficient operator-splitting projection layer with implicit differentiation, it achieves orders-of-magnitude faster training and significantly higher solution quality than existing state-of-the-art hard-constrained learning methods.

What Problem Does This Paper Address?

Many real-world tasks—from controlling power grids to planning robot trajectories—rely on solving parametric constrained optimization problems. These problems require finding a solution that minimizes a cost while strictly adhering to physical or safety constraints (e.g., "don't hit the wall" or "don't exceed voltage limits").

Traditional numerical solvers are reliable but often too slow for real-time applications. While neural networks (NNs) can learn to approximate these solutions nearly instantaneously, they typically struggle to satisfy "hard" constraints. Common workarounds like "soft constraints" (adding penalty terms to the loss function) provide no guarantees at inference time and often require tedious hyperparameter tuning. Existing "hard-constrained" NN approaches frequently suffer from slow training times, limited scalability, or an inability to handle constraints that change based on the input context.

Methods

The authors introduce $\Pi$net, which appends a specialized projection layer to any standard "backbone" neural network.

Figure 1: Illustration of the Πnet architecture. The infeasible output of the backbone network is projected onto the feasible set through an operator splitting scheme. To train the backbone network, we use the implicit function theorem to backpropagate the loss through the projection layer.

Key technical components include:

  • Efficient Forward Projection: Instead of solving a generic optimization problem, $\Pi$net decomposes complex constraint sets into the intersection of a hyperplane and a simple convex set (like a box). It then uses the Douglas-Rachford operator splitting algorithm to rapidly compute the orthogonal projection.
  • Implicit Backpropagation: To train the network, the authors avoid the memory-heavy process of "unrolling" the projection iterations. Instead, they apply the Implicit Function Theorem (IFT) to differentiate through the fixed point of the projection algorithm. This is implemented efficiently using an indirect linear solver (bicgstab) in JAX.
  • Numerical Robustness: The paper introduces Ruiz equilibration (a matrix preconditioning technique) and an automated hyperparameter tuning procedure to ensure the projection layer converges quickly and remains stable across different problem scales.

Datasets

The authors evaluated $\Pi$net against several benchmarks:

  • Standard Optimization Benchmarks: Convex (Quadratic Programs) and non-convex problems originally proposed for the DC3 algorithm, scaled up to "Large" versions with 1,000 variables and 1,000 constraints.
  • Multi-Vehicle Motion Planning: A complex robotics task involving 5 to 15 vehicles, requiring the satisfaction of dynamics, workspace limits, and jerk constraints while optimizing for non-convex objectives like workspace coverage.
  • Second-Order Cone Programs (SOCP): Benchmarks involving non-linear, potentially unbounded feasible sets.
  • High-Dimensional Contexts: Experiments using 1024x1024 images as input context to test the network's ability to handle millions of input variables.

Key Insights and Ideas

  • Feasibility-by-Design: By placing the projection at the very end of the network, $\Pi$net ensures the output is mathematically guaranteed to be feasible (or within a tiny, controllable tolerance).
  • Constraints as Inductive Bias: The authors demonstrate that enforcing constraints during training—rather than just at inference—acts as a powerful inductive bias. It allows the backbone network to "anticipate" the projection, leading to much better objective values (lower suboptimality) than training unconstrained and projecting later.
  • Structure is King: The core efficiency of $\Pi$net comes from exploiting the mathematical structure of projections. By breaking down complex sets into simpler components, they enable high-performance, GPU-accelerated training that leaves generic differentiable solvers in the dust.

Key Results

$\Pi$net demonstrates significant improvements over state-of-the-art methods like DC3 and JAXopt:

  • Training Efficiency: On large non-convex problems, $\Pi$net reaches high accuracy in minutes, while JAXopt requires roughly 14 hours.
  • Solution Quality: $\Pi$net consistently achieves lower Relative Suboptimality (RS) and Constraint Violation (CV). In many cases, previous methods like DC3 failed to produce feasible solutions on larger datasets, whereas $\Pi$net remained robust.
  • Inference Speed: While slightly slower than simple unconstrained NNs, $\Pi$net is orders of magnitude faster than traditional solvers. For batch processing, it can solve 1,024 instances in milliseconds.
Figure 2: Scatter plots of RS and CV on the small and large non-convex problems on the test set. The red dashed lines show the thresholds to consider a candidate solution optimal.

Limitations and Future Work

The primary limitation of $\Pi$net is its requirement for convex constraint sets. While many practical problems are convex or can be "convexified," purely non-convex constraints (like obstacle avoidance in its raw form) cannot be directly handled by the current projection layer.

The authors suggest that future work could involve sequential convexification—iteratively approximating non-convex constraints as convex ones—to expand $\Pi$net's reach to even more complex robotics and engineering domains. They also envision integrating these hard-constraint layers into large-scale foundation models to make AI systems more trustworthy and safe.

Summary updated

BibTeX
@inproceedings{grontas2026pinet,
  author = {Panagiotis D. Grontas and Antonio Terpin and Efe C. Balta and Raffaello D'Andrea and John Lygeros},
  title = {{Pinet: Optimizing hard-constrained neural networks with orthogonal projection layers}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=EJ680UQeZG},
}
Figure