Monitoring with uncertainty

Ezio Bartocci, Radu Grosu

Introduction

In modern software engineering, ensuring that a program adheres to its formal specifications is a critical task, particularly for safety-critical and real-time systems. Runtime Verification (RV) has emerged as a powerful technique for this purpose, monitoring execution traces to detect violations of properties such as "every login must be followed by a logout." However, RV is not a zero-cost operation. The instrumentation required to monitor events consumes CPU cycles and can alter the timing behavior of the system, potentially leading to performance degradation or the introduction of "Heisenbugs."

This paper, based on the research of Ezio Bartocci and Radu Grosu, explores the fundamental trade-off between monitoring precision and system performance. When full monitoring is too expensive, developers often resort to sampling or overhead control, which inevitably creates gaps in the execution trace. The authors propose a shift from traditional binary logic to a probabilistic framework, using statistical models to "fill in" these gaps and quantify the uncertainty of property satisfaction.

The Problem of Incomplete Traces

Traditional RV operates on the assumption of a complete execution trace. When a monitor is deactivated to save resources, the system loses visibility into the program's state. In these intervals, a property violation might occur undetected. The challenge addressed by Bartocci and Grosu is how to move from a definitive "Pass/Fail" verdict to a probabilistic estimation—determining the likelihood that a property was satisfied even when the data is incomplete.

Methodological Evolution

The authors outline three primary approaches developed to manage uncertainty in runtime monitoring:

1. Runtime Verification with State Estimation (RVSE)

The first iteration, RVSE, utilizes Hidden Markov Models (HMMs) to represent the program's behavior. In this model, the program's internal states are "hidden," and the monitored events are observations. When the monitor is active, it updates the state estimate based on observed events. During gaps (when the monitor is off), the system uses the HMM’s transition probabilities to estimate the most likely sequence of missed events. While theoretically sound, the initial implementation of RVSE faced a significant bottleneck: the matrix multiplications required for state estimation were computationally intensive, sometimes exceeding the overhead of the monitoring it was intended to replace.

2. Approximate Precomputed RVSE (AP-RVSE)

To mitigate the computational costs of RVSE, the authors introduced AP-RVSE. This method shifts the heavy lifting to a pre-computation phase. Possible state distributions are calculated in advance and stored in a lookup table. By employing an $\epsilon$-approximation, the system can reuse existing table entries if a new calculation is sufficiently similar to a stored one. This approach successfully decoupled runtime overhead from the desired accuracy, though it requires prior knowledge of the distribution of monitoring gaps.

3. Runtime Verification with Particle Filtering (RVPF)

The most recent advancement is RVPF, which replaces HMMs with Dynamic Bayesian Networks (DBNs) and utilizes Particle Filtering for state estimation. Instead of exhaustive matrix math, RVPF uses a set of "particles" to represent the probability distribution of the program's state. This method is highly tunable; developers can adjust the number of particles to balance memory usage and CPU overhead against prediction accuracy.

A key innovation in RVPF is the introduction of "Peek Events." These are inexpensive, partial observations of the program state performed during monitoring gaps. These small "peeks" allow the model to refocus and significantly reduce uncertainty without the high cost of full event logging.

Monitoring as Sensor Fusion

A central insight of this work is the parallel between software monitoring and robotics. In robotics, a system uses noisy sensors and "dead reckoning" to estimate its physical position. Similarly, in the presence of gaps, a software monitor can use partial events and statistical models to estimate the program's logical state. This conceptual shift transforms monitoring from a discrete logical check into a signal processing task, where the goal is to minimize the variance of the state estimate.

Results and Performance Trade-offs

Evaluations across various C-based benchmarks indicate that while initial probabilistic methods were overhead-heavy, the evolution toward precomputation (AP-RVSE) and particle filtering (RVPF) has made the approach viable for real-time systems. RVPF, in particular, offers the greatest flexibility, allowing for high-assurance monitoring even when significant portions of the execution trace are missing. The use of "peek events" has been shown to drastically improve accuracy, proving that total visibility is not always necessary for reliable verification.

Limitations and Future Outlook

Despite its promise, probabilistic RV is dependent on the quality of the underlying statistical model. If the HMM or DBN does not accurately reflect the program's actual behavior, the resulting probability estimates will be misleading. Furthermore, complex programs with massive state spaces may still challenge the scalability of particle-based methods.

Future research directions include the development of more sophisticated DBN structures and the automated generation of statistical models from program source code. By bridging the gap between high-performance execution and high-assurance monitoring, these techniques provide a path forward for verifying the increasingly complex and resource-constrained systems of the future.

Summary updated

BibTeX
@inproceedings{bartocci2013monitoring,
  author = {Ezio Bartocci and Radu Grosu},
  title = {{Monitoring with uncertainty}},
  booktitle = {HAS},
  year = {2013},
  url = {https://openreview.net/forum?id=fYZRIS5Uj5},
}
Figure