Deep Neural Programs for Adaptive Control in Cyber-Physical Systems

Konstantin Selyunin, Denise Ratasich, Ezio Bartocci, Radu GrosuarXiv 2015

Introduction

Traditional programming paradigms rely on rigid, discrete logic that often fails to account for the inherent uncertainty of the physical world. In Cyber-Physical Systems (CPS), where software interacts directly with hardware and sensors, this mismatch can lead to system instability and failure. This paper introduces Deep Neural Programs (DNP), a novel framework that bridges the gap between symbolic logic and probabilistic reality by replacing "hard" control structures with "soft," differentiable counterparts.

The Problem with Discrete Logic

The fundamental challenge in CPS design is the discrete if-then-else construct. In standard imperative programming, a condition like if (x > a) acts as a step function. This binary behavior introduces three significant issues:

  1. Frailness: Minor sensor noise can trigger a boolean flip, causing drastic and potentially dangerous changes in system behavior.
  2. Intractability: Optimization techniques like gradient descent require continuous, differentiable functions. Step functions create flat plateaus with no gradient, making automated tuning impossible.
  3. Undecidability: Formal verification of systems with numerous discontinuous jumps is mathematically complex, often preventing safety proofs.

Deep Neural Programs (DNP) Methodology

To address these issues, DNPs redefine the building blocks of programming using probabilistic models.

Smoothing Logic with nif and nwhile

Instead of hard thresholds, DNPs utilize "neural" statements (nif, nwhile) based on a smooth sigmoidal curve. Specifically, they employ the Probit distribution—the Cumulative Distribution Function (CDF) of a Gaussian. This transformation turns a sharp step function into a continuous transition.

Comparison of discrete step function logic versus the smooth Probit distribution used in Neural Programs.

Gaussian Bayesian Networks (GBN)

The control flow of a DNP is structured as a Gaussian Bayesian Network. The "guards" or conditions are linked to capture dependencies between sequential actions. For instance, in a vehicle maneuver, the parameters of a second turn are conditioned on the outcome of the first.

Probabilistic Execution and Learning

During execution, a nif statement calculates a "confidence" value by comparing the input variable to a threshold while accounting for environmental uncertainty ($\sigma^2$). The system then samples from this distribution to determine the execution path. Rather than manual tuning, the means, variances, and coefficients of the GBN are learned by observing traces of human experts performing the target task.

Key Insights: Preserving Probability

A critical advantage of the DNP approach is its impact on data distributions. Traditional if statements "cut" probability distributions, creating truncated shapes that are difficult for downstream sensor fusion algorithms (like Kalman Filters) to process. In contrast, the nif approach maintains the Gaussian characteristics of the data.

Comparison of how traditional 'if' statements truncate distributions versus how 'nif' preserves the probabilistic structure.

By smoothing the logic, the entire program becomes differentiable. This transparency allows DNPs to avoid the "black-box" nature of standard deep learning; the network structure directly mirrors the program's logical flow, making it human-interpretable.

Experimental Results

The authors validated the DNP framework using a Pioneer P3AT-SH mobile rover tasked with parallel parking. Using a dataset of human expert traces—incorporating wheel encoders, IMU data, and sonars—the system learned an adaptive controller.

The resulting controller demonstrated significant robustness. Because it samples from a learned GBN, it can dynamically compensate for real-world perturbations, such as wheel slip or motor variance. The system effectively quantifies its trust in sensors and actuators, allowing for reliable performance in noisy environments.

Conclusion and Future Work

Deep Neural Programs offer a promising path toward more robust and optimizable Cyber-Physical Systems. By making program logic differentiable and probabilistic, DNPs enable systems to handle uncertainty gracefully. Future research will focus on scaling this approach to more complex, highly branched codebases and developing the formal safety proofs enabled by this continuous mathematical foundation.

Summary updated

Abstract

We introduce Deep Neural Programs (DNP), a novel programming paradigm for writing adaptive controllers for cy-ber-physical systems (CPS). DNP replace if and while statements, whose discontinuity is responsible for undecidability in CPS analysis, intractability in CPS design, and frailness in CPS implementation, with their smooth, neural nif and nwhile counterparts. This not only makes CPS analysis decidable and CPS design tractable, but also allows to write robust and adaptive CPS code. In DNP the connection between the sigmoidal guards of the nif and nwhile statements has to be given as a Gaussian Bayesian network, which reflects the partial knowledge, the CPS program has about its environment. To the best of our knowledge, DNP are the first approach linking neural networks to programs, in a way that makes explicit the meaning of the network. In order to prove and validate the usefulness of DNP, we use them to write and learn an adaptive CPS controller for the parallel parking of the Pioneer rovers available in our CPS lab.
BibTeX
@misc{selyunin2015deep,
  author = {Konstantin Selyunin and Denise Ratasich and Ezio Bartocci and Radu Grosu},
  title = {{Deep Neural Programs for Adaptive Control in Cyber-Physical Systems}},
  year = {2015},
  eprint = {1502.04013},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1502.04013},
}
Figure