Self-Checking Deep Neural Networks in Deployment

Yan Xiao, Ivan Beschastnikh, David S. Rosenblum, Changsheng Sun, Sebastian G. Elbaum, Yun Lin, Jin Song Dong

TL;DR

This paper introduces SelfChecker, a novel system that monitors deployed Deep Neural Networks (DNNs) by analyzing their internal layer features to detect potential misclassifications. It not only raises an alarm when confidence is low but also provides an alternative prediction, significantly improving upon existing methods in accuracy and trustworthiness for critical applications.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are increasingly deployed in safety-critical domains like self-driving cars and medical diagnostics. While highly accurate, DNNs are not infallible and will inevitably make mistakes. In these high-stakes scenarios, simply knowing a DNN might be wrong isn't enough; we need a way to detect these errors during deployment and ideally, have a fallback or "advice" to mitigate the consequences. Traditional confidence measures like softmax probabilities are unreliable for complex DNNs, often overestimating confidence even for incorrect predictions. This paper addresses the critical need for a robust, automated system that can reliably identify DNN misclassifications in real-time and offer corrective guidance.

Methods

The core of SelfChecker lies in its "self-checking" mechanism, which leverages the internal workings of a DNN. Instead of relying solely on the final output, SelfChecker examines the features extracted by intermediate layers.

Here's a breakdown of their approach:

  • Kernel Density Estimation (KDE): For each layer and each class, SelfChecker first builds a probability density function (PDF) using KDE on the training data. This allows it to understand what "normal" feature representations look like for each class at different stages of the network.
  • Inferred Class per Layer: When a new test instance arrives, SelfChecker uses the learned PDFs to estimate the likelihood of that instance's layer features belonging to each class. The class with the highest likelihood is considered the "inferred class" for that layer.
  • Layer Selection: Not all layers are equally informative. SelfChecker employs a search-based optimization strategy to identify the most effective combinations of layers for triggering alarms and providing advice. This is crucial because some layers might have misleading attention patterns.
  • Confidence Score: A confidence score is derived based on the consistency between the inferred layer classes and the model's final prediction. If a significant number of layers infer classes different from the model's prediction, confidence is considered low.
  • Alarm and Advice Generation: If the confidence score falls below a threshold, an alarm is triggered. Crucially, SelfChecker also provides an "advice" – an alternative prediction derived from the selected layers, aiming to correct the model's potential error.
  • Boosting Strategy: To further refine alarm triggering and reduce false positives, a boosting strategy is used. This involves cross-referencing alarm signals with advice signals to ensure a more robust decision.

Datasets

The paper evaluates SelfChecker on several standard image classification datasets:

  • MNIST: A dataset of handwritten digits.
  • FMNIST (Fashion-MNIST): A dataset of clothing items.
  • CIFAR-10: A dataset of 10 classes of images.
  • CIFAR-100: A dataset of 100 classes of images.

For self-driving car scenarios, they used datasets associated with the DAVE-2 and Chauffeur models.

Key Insights and Ideas

  • Internal Features are Key: The most significant insight is that internal DNN layer features, not just the final output, contain crucial information for detecting misclassifications. This moves beyond traditional confidence measures.
  • "Over-thinking" is Detectable: The paper builds on the idea that DNNs can "over-think" – reaching a correct conclusion early in the network but then changing it to an incorrect one by the final layer. SelfChecker effectively identifies these inconsistencies.
  • Layer Selection Matters: Randomly picking layers or using all of them isn't optimal. A targeted selection of informative layers is essential for maximizing alarm accuracy.
  • Advice is More Than Just an Alarm: Providing an alternative prediction (advice) is a valuable extension that can actively improve system performance, especially in scenarios where a correct decision is paramount.
  • Softmax is Not Enough: The paper strongly demonstrates the unreliability of softmax probabilities as confidence estimators, showing that incorrect predictions can still have very high softmax scores.

Key Results

  • High Alarm Accuracy: SelfChecker achieves a 60.56% True Positive Rate (TPR) for detecting wrong DNN predictions, significantly outperforming prior methods like SELFORACLE and ConfidNet.
  • Low False Alarm Rate: It maintains a low False Positive Rate (FPR) of 2.04%, meaning it rarely raises an alarm for correct predictions.
  • Improved F1-Score: SelfChecker achieves the highest F1-score (68.07%), an 8.77% improvement over the next best approach (ConfidNet).
  • Advice Improves Accuracy: For 10-class datasets, SelfChecker's advice improves the original model's prediction accuracy by an average of 0.138%.
  • Acceptable Deployment Time: The system adds an average overhead of 34.98ms per inference, which is considered acceptable for many applications.
  • Self-Driving Car Performance: In self-driving scenarios, SelfChecker triggers more correct alarms than SELFORACLE with comparable false alarms.

Limitations and Future Work

  • Distribution Assumption: SelfChecker assumes that the training and validation datasets are representative of the data encountered during deployment. Significant distribution shifts could impact performance.
  • White-Box Access: The approach requires access to the internal layers of the DNN, making it a white-box method. It might be less effective for very shallow networks.
  • Adversarial Inputs: The current work focuses on non-adversarial inputs. The authors plan to explore handling adversarial inputs in the future.
  • Real-time Latency: While acceptable for many tasks, the latency for real-time applications like autonomous driving might need further reduction. The authors suggest parallelizing the per-class density function computation.
  • Regression Tasks: The current design is primarily for classifiers, though it can be adapted for regression by transforming it into a binary classification problem. Further exploration on diverse regression tasks could be beneficial.

Summary updated

BibTeX
@inproceedings{xiao2021self,
  author = {Yan Xiao and Ivan Beschastnikh and David S. Rosenblum and Changsheng Sun and Sebastian G. Elbaum and Yun Lin and Jin Song Dong},
  title = {{Self-Checking Deep Neural Networks in Deployment}},
  booktitle = {ICSE},
  year = {2021},
  doi = {10.1109/icse43902.2021.00044},
}
Figure