Neural networks (NNs) are notoriously overconfident. Even when presented with unfamiliar inputs—such as a traffic sign obscured by heavy snow or an unexpected object on a highway—they often produce high-confidence predictions that are entirely incorrect. In safety-critical systems like autonomous driving or medical diagnostics, these "silent failures" are unacceptable. To address this, researchers deploy runtime monitors that act as safety guards, flagging out-of-distribution (OOD) data before it can lead to hazardous decisions.
Presented at CAV 2024, Monitizer is an open-source framework designed to automate the complex process of building and benchmarking these monitors. It provides a standardized, "push-button" solution to compare 19 different state-of-the-art monitoring techniques with minimal manual effort.
The Challenge of Runtime Monitoring
While numerous runtime monitors have been proposed, applying them in practice is difficult due to three primary hurdles:
- Hyperparameter Sensitivity: Most monitors rely on specific thresholds ($\tau$) and internal parameters that require extensive manual tuning to function correctly for a given network or dataset.
- The "No Free Lunch" Theorem: Monitoring performance is highly context-dependent. A monitor that excels at detecting blurred images might be ineffective against adversarial attacks or color inversions.
- Lack of Unified Tooling: Until now, engineers lacked a comprehensive tool to automatically identify and optimize the best monitor for a specific model.
The Monitizer Framework
Monitizer structures the monitoring workflow into three distinct, modular phases:
- Parse: The framework ingests the user's neural network (in PyTorch or ONNX format) and the "In-Distribution" (ID) dataset used for training.
- Optimize: This core component uses techniques such as Grid Search, Random Search, or Gradient Descent to automatically tune a monitor's hyperparameters. It supports multi-objective optimization, allowing users to maximize OOD detection for specific perturbations while ensuring the monitor does not exceed a defined false alarm rate (e.g., flagging no more than 5% of normal images).
- Evaluate: Monitizer benchmarks the tuned monitor against a structured hierarchy of OOD data, including Generated OOD (distortions like noise, blur, or rotation) and Collected OOD (entirely different datasets). It provides transparent metrics, such as AUROC, rather than potentially biased average scores.
Experimental Insights and Results
The authors conducted an extensive case study comparing 19 monitors across various OOD perturbations on an MNIST-trained network. Key findings include:
- Contextual Performance: The study confirmed that there is no single "best" monitor. For instance, while GradNorm performs exceptionally well on Gaussian noise, it is among the worst at detecting inverted colors.
- Top Performers: For detecting similar-but-different data (e.g., KMNIST), the MDS and Mahalanobis monitors achieved AUROC scores of 98 and 97, respectively.
- Optimization Trade-offs: When optimizing for specific OOD classes, monitors like the Gaussian monitor maintained 70% ID accuracy but showed clear trade-offs in detection strength compared to unconstrained alternatives.
- Visualization: To aid decision-making, Monitizer generates Pareto frontier and parallel coordinate plots, allowing engineers to visually select the optimal balance between detection sensitivity and false alarm rates.
Conclusion
Monitizer represents a significant step forward in AI safety, providing the necessary infrastructure to move runtime monitoring from manual experimentation to automated engineering. By simplifying the optimization and evaluation of safety guards, it makes reliable neural network deployment more accessible. While currently focused on OOD detection, the framework's modularity allows for future expansion into monitoring properties like adversarial robustness and fairness.
The Monitizer tool is open-source and available on GitLab.
Summary updated