Real-Time Probabilistic Programming

Lars Hummelgren,Matthias Becker,David Broman
2024-07-08
Abstract:Complex cyber-physical systems interact in real-time and must consider both timing and uncertainty. Developing software for such systems is expensive and difficult, especially when modeling, inference, and real-time behavior must be developed from scratch. Recently, a new kind of language has emerged -- called probabilistic programming languages (PPLs) -- that simplify modeling and inference by separating the concerns between probabilistic modeling and inference algorithm implementation. However, these languages have primarily been designed for offline problems, not online real-time systems. In this paper, we combine PPLs and real-time programming primitives by introducing the concept of real-time probabilistic programming languages (RTPPL). We develop an RTPPL called ProbTime and demonstrate its usability on an automotive testbed performing indoor positioning and braking. Moreover, we study fundamental properties and design alternatives for runtime behavior, including a new fairness-guided approach that automatically optimizes the accuracy of a ProbTime system under schedulability constraints.
Programming Languages
What problem does this paper attempt to address?
The problem that this paper attempts to solve is to combine probabilistic programming languages (PPLs) with real - time programming to develop a new programming paradigm - real - time probabilistic programming languages (RTPPLs). Existing probabilistic programming languages are mainly designed for offline problems and do not take into account the special requirements of real - time systems, such as time constraints and uncertainty handling. And real - time system programming languages lack support for probabilistic modeling and inference. Specifically, the paper aims to address the following two key challenges: 1. **How to reasonably combine timing and probabilistic inference constructs in the language**: This requires ensuring that users can conveniently encode real - time properties (such as deadlines and periodicity) and probabilistic constructs (such as sampling and observation) without specifying low - level details (such as the number of particles and worst - case execution time). 2. **How to fairly allocate resources**: Given real - time constraints and requirements for inference accuracy, how to ensure that the time allocation among different tasks is fair, so that each task can obtain an appropriate number of particles to ensure inference accuracy, while the entire system remains statically schedulable. To solve these problems, the authors introduce a new language - ProbTime, and demonstrate its application on an automotive test platform, including indoor positioning and braking functions. In addition, the paper also studies the basic properties of runtime behavior and design alternatives, including a new fairness - based method that can automatically optimize the accuracy of the ProbTime system under scheduling constraints. ### Summary The main contributions of this paper include: - Proposing and introducing the new paradigm of real - time probabilistic programming languages (RTPPL), explaining its necessity, and outlining the main design challenges. - Designing and implementing the ProbTime language and defining its formal behavior. - Proposing a novel automated offline configuration method that maximizes inference accuracy under time constraints, specifically introducing the concepts of execution time and particle fairness. - Developing an automotive test platform that includes hardware and software, demonstrating the complex application of ProbTime programs in a real - physical environment. Through these efforts, the paper provides an important foundation for research on real - time probabilistic programming and points out the direction for future research and development.