Diagnostic Runtime Monitoring with Martingales

Ali Hindy, Rachel Luo, Somrita Banerjee, Jonathan Kuck, Edward Schmerling, Marco Pavone

TL;DR

This paper introduces a novel framework for real-time diagnosis of distribution shifts in robotics using multiple simultaneous stochastic martingales. By monitoring different stages of a machine learning pipeline—from raw sensor inputs to final control outputs—the system can not only detect that a shift has occurred but also identify its cause (e.g., sensor degradation vs. a new environment), enabling faster and more effective interventions.

What Problem Does This Paper Address?

Machine learning models are notoriously brittle when the data they see at "test time" differs from their training data—a phenomenon known as distribution shift. In safety-critical robotics, like an autonomous aircraft taxiing on a runway, a distribution shift can lead to catastrophic failure.

While existing "runtime monitors" can alert a user when something is wrong, they rarely tell you why. Is the camera lens dirty (sensor degradation)? Or is the robot at a new airport it hasn't seen before (environmental shift)? The fix for the former is replacing hardware; the fix for the latter is retraining the model. Treating every problem with a generic "retrain everything" approach is slow, costly, and often ineffective. This paper tackles the challenge of diagnostic monitoring: identifying the specific root cause of a shift in a streaming, online fashion.

Methods

The authors build upon a recent technique called martingale-based monitoring.

  1. The Intuition: A martingale is a sequence of random variables where the next value is expected to be the same as the current one, given all previous values. If you train a "recency" classifier to distinguish between old training data and new live data, and that classifier starts succeeding, it means the distributions have drifted. This success is used to drive a martingale value upward. When the value hits a certain threshold, an alert is triggered.
  2. The Multi-Monitor Framework: The core innovation here is deploying multiple martingales simultaneously. Instead of just monitoring the raw input, the authors place monitors at different "probes" in the system:
  3. Input Monitor: Detects changes in raw sensor data (e.g., Gaussian noise from a failing sensor).
  4. Intermediate Monitor: Detects changes in internal feature representations (e.g., brightness shifts).
  5. Output Monitor: Detects changes in the predicted actions or labels (e.g., different steering patterns required for a wider runway).

By looking at which monitor "trips" first, the system can diagnose the specific type of shift.

Datasets

The framework was evaluated in two distinct settings:

  • X-Plane 11 Flight Simulator: A photorealistic simulation of an autonomous aircraft taxiing. The authors induced shifts by adding Gaussian noise to images (sensor degradation), reducing image brightness, and moving the aircraft to a new airport (KJFK) not seen during training.
  • Free-Flyer Hardware Testbed: A physical 2D mobile robot that floats on a granite table to simulate zero-gravity/zero-friction space environments. It uses vision-based navigation to dock with a target. Shifts were induced via physical movement to new starting positions and simulated sensor noise.

Key Insights and Ideas

  • Diagnosis Enables Targeted Intervention: The "aha moment" is that knowing the cause allows for "surgical" fixes. If the output monitor trips, the system performs weighted retraining (prioritizing recent data). If the input monitor trips, it suggests hardware maintenance.
  • Speed Matters: In robotics, a delay in detection is the difference between a safe stop and a crash. Because these martingales are lightweight and process data in a stream, they detect shifts much faster than traditional batch-based statistical tests.
  • Feature Space Selection: The authors found that by choosing intermediate layers of a pre-trained network (like ResNet-50) that correspond to specific attributes (like brightness), they could create highly specialized "custom martingales" for specific failure modes.

Key Results

  • Faster Detection: In the X-Plane experiments, the proposed method detected sensor degradation in 14.92 iterations on average, compared to 38.10 iterations for the baseline Conformal Martingale (CM) method—a nearly 3x speedup. For environmental shifts, the speedup was even greater (approx. 5x).
  • High Diagnostic Accuracy: The system achieved 100% accuracy in correctly identifying sensor degradation and environmental shifts in the flight simulator.
  • Safety Outcomes: In lifecycle simulations, the martingale-based approach resulted in zero crashes, whereas a standard "scheduled maintenance" approach (retraining at fixed intervals) allowed for 3–5 crashes per 1,000 iterations because it couldn't react to shifts that happened between maintenance windows.

Limitations and Future Work

  • Correlated Monitors: The authors acknowledge that some shifts might trigger multiple monitors (e.g., a massive sensor failure will eventually affect the output). Future work is needed to understand how to combine these potentially correlated signals for even more robust guarantees.
  • Threshold Selection: While the threshold $C$ provides a theoretical bound on false alarms, choosing the optimal threshold for different robotics applications remains a practical challenge.
  • Complex Interventions: The current interventions (retrain vs. replace sensor) are relatively simple. The authors suggest exploring more complex "fallback-safe" control strategies that can be triggered by these monitors.

Summary updated

BibTeX
@misc{hindy2024diagnostic,
  author = {Ali Hindy and Rachel Luo and Somrita Banerjee and Jonathan Kuck and Edward Schmerling and Marco Pavone},
  title = {{Diagnostic Runtime Monitoring with Martingales}},
  year = {2024},
  eprint = {2407.21748},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.21748},
}
Figure