RAYEN: Imposition of Hard Convex Constraints on Neural Networks

Jesus Tordesillas, Jonathan P. How, Marco HutterarXiv 2023 · DOI

Abstract

In safety-critical domains such as robotics and power grid management, neural networks must adhere to strict physical and safety constraints. Traditional methods either rely on "soft" penalties that offer no guarantees or "projection layers" that are computationally prohibitive. We present RAYEN (RAY-tracing based ENforcement), a framework that analytically maps unconstrained network outputs into a feasible convex set. By utilizing closed-form ray-tracing solutions, RAYEN ensures 100% constraint satisfaction with inference speeds up to 7,000x faster than optimization-based projection layers.

Introduction

Neural networks (NNs) are increasingly used to approximate complex optimization problems in real-time systems. However, their "black box" nature poses significant risks in safety-critical applications. Standard training techniques often fail to guarantee that outputs will satisfy essential constraints, such as obstacle avoidance in autonomous driving or voltage limits in power systems.

Existing approaches to enforce safety typically fall into two categories: soft constraints and projection layers. Soft constraints incorporate penalties into the loss function, which encourages safety but provides no hard guarantees at test time. Projection layers, such as OptNet, solve a quadratic program to project unsafe outputs onto the nearest feasible point. While mathematically sound, these layers require iterative solvers that introduce massive computational overhead, making them unsuitable for high-frequency control loops.

Methodology: The RAYEN Framework

RAYEN addresses these challenges by replacing the orthogonal projection with a ray-tracing operation. The framework operates in two distinct phases: an offline setup and an online enforcement layer.

Offline Phase

Before training, RAYEN performs a one-time preprocessing step to simplify the constraint set. This involves calculating the affine hull to remove redundant equality constraints and identifying an interior point $z_0$ that lies strictly within the feasible set $\mathcal{Y}$. This point serves as the "safe origin" for all subsequent ray-tracing operations.

Online Phase and Architecture

During the forward pass, the neural network generates a latent vector $v$, which RAYEN interprets as a direction and magnitude relative to the interior point $z_0$.

The RAYEN architecture integrates a standard neural network with a ray-tracing enforcement layer to ensure outputs remain within a feasible set.

The core innovation lies in the analytical calculation of the directional distance to the boundary. For each constraint—whether linear, quadratic, second-order cone, or a linear matrix inequality (LMI)—RAYEN computes an "inverse distance" $\kappa$.

RAYEN analytically computes the distance to the boundary for various constraint types along a ray from an interior point $z_0$.

By taking the maximum $\kappa$ across all constraints, the framework identifies the "worst-case" boundary intersection. The final output is then scaled to ensure it remains within the feasible region. Because these calculations rely on standard matrix algebra and closed-form solutions, the entire process is fully differentiable and compatible with standard backpropagation.

Key Insights

The shift from orthogonal projection to ray-tracing is the fundamental insight of RAYEN. While finding the closest point on a boundary requires iterative optimization, finding the intersection of a specific ray and a convex boundary can often be solved analytically. This allows RAYEN to handle a "zoo" of constraint types within a unified mathematical recipe without sacrificing performance or safety.

Experimental Results

The authors evaluated RAYEN on complex optimization benchmarks and robotic trajectory planning tasks, including drone navigation through "safe corridors."

  • Massive Speedups: RAYEN demonstrated massive speedups, performing between 20x and 7,468x faster per inference than competing methods like OptNet or DC3.
  • Guaranteed Safety: In 100% of test cases, including out-of-distribution data, RAYEN maintained zero constraint violations, whereas unconstrained and soft-constraint models frequently failed.
  • Scalability: The framework handles high-dimensional constraints with minimal overhead. For instance, a 300x300 LMI constraint was processed in less than 12ms.

Conclusion and Future Work

RAYEN provides a fast, general, and differentiable method for imposing hard convex constraints on neural networks. While currently limited to convex sets, it offers a robust solution for many real-world engineering problems. Future work aims to extend this ray-tracing logic to non-convex constraints and generic matrix manifolds, further expanding the reach of safe deep learning.

Summary updated

BibTeX
@misc{tordesillas2023rayen,
  author = {Jesus Tordesillas and Jonathan P. How and Marco Hutter},
  title = {{RAYEN: Imposition of Hard Convex Constraints on Neural Networks}},
  year = {2023},
  eprint = {2307.08336},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.08336},
}
Figure