Using Kernel SHAP XAI Method to optimize the Network Anomaly Detection Model

Khushnaseeb Roshan, Aasim ZafararXiv 2023 · DOI · arXiv

TL;DR

This paper tackles the challenge of explaining network anomalies detected by deep learning models. By leveraging the Kernel SHAP explainable AI (XAI) technique, they not only identify why an anomaly is flagged but also use this insight to select the most impactful features, leading to a significantly improved anomaly detection model.

What Problem Does This Paper Address?

Network anomaly detection is crucial for security, but deep learning models, while powerful, often act as "black boxes." This means they can flag suspicious activity but can't easily explain why a particular instance is deemed anomalous. This lack of interpretability hinders trust, debugging, and model improvement. The paper specifically addresses the difficulty of explaining anomalies in unsupervised network traffic detection, where the "normal" behavior is learned without explicit labels, making it hard to pinpoint the root cause of deviations.

Methods

The core of this work lies in using Kernel SHAP, a model-agnostic XAI technique, to understand the contributions of individual features to an anomaly detection model's output.

Here's a breakdown of their approach:

  • Unsupervised Anomaly Detection: They employ an Autoencoder (AE), a type of neural network that learns to reconstruct its input. Anomalies are identified by a high Reconstruction Error (RE) – the difference between the input and its reconstructed version.
  • Kernel SHAP for Feature Importance: Instead of just looking at raw reconstruction errors, they use Kernel SHAP to quantify the true contribution of each feature to the RE for anomalous instances. This is a key differentiator, as it goes beyond simple error magnitude to understand feature influence.
  • Unsupervised Feature Selection: Based on the SHAP values computed for attack instances, they identify the top 40 features that most significantly contribute to the reconstruction error. This selection is done without using any target class labels, making it truly unsupervised.
  • Model Optimization: A new, optimized model (OPT_Model) is then trained using only these selected top 40 features. This contrasts with the baseline model (Model_1) which uses all available features.

Datasets

The primary dataset used in this research is the CICIDS2017 dataset. This dataset is a well-known benchmark for network intrusion detection, containing both benign and various attack traffic. The authors used a subset of this dataset, splitting it into training/validation (Monday file, containing only benign data for training the autoencoder) and testing (Friday file, containing both benign and attack data).

Key Insights and Ideas

  • SHAP Values Reveal True Anomaly Drivers: The paper demonstrates that SHAP values provide a more nuanced understanding of anomaly causes than raw reconstruction errors. They can pinpoint features that, while not having the highest individual error, significantly influence the overall anomalous behavior.
  • Unsupervised Feature Selection Boosts Performance: By selecting features based on their contribution to reconstruction error (as revealed by SHAP), the authors were able to create a more efficient and accurate anomaly detection model. This highlights the power of XAI not just for explanation but also for model improvement.
  • XAI as a Tool for Model Optimization: The work strongly advocates for XAI not just as a post-hoc explanation tool but as an integral part of the model development lifecycle, capable of guiding feature engineering and model refinement.

Key Results

The optimized model (OPT_Model), which uses the top 40 features identified by Kernel SHAP, significantly outperformed the baseline model (Model_1) which used all 78 features.

  • AUC Improvement: The Area Under the ROC Curve (AUC) for OPT_Model was 0.95, a substantial increase from Model_1's AUC of 0.803. AUC is a critical metric for imbalanced datasets, indicating better overall discriminative power.
  • Accuracy and F-Score: The paper reports an overall accuracy of 0.90 and an F-score of 0.76 for the OPT_Model. While specific numbers for Model_1's accuracy and F-score aren't explicitly stated in the abstract, the comparison figures (Fig. 8 and Table III) clearly show OPT_Model's superiority across metrics like precision, recall, and F1-score. For instance, the weighted average F1-score for OPT_Model is 0.91, compared to 0.75 for Model_1.

Limitations and Future Work

  • Time Complexity: The authors acknowledge that Kernel SHAP's time complexity can be a drawback, especially with larger background datasets. Increasing the background set size can lead to significantly longer computation times, potentially taking hours.
  • Future Work: The paper suggests exploring other model-agnostic or specific, global or local explanation techniques. They also propose applying these XAI-driven anomaly detection and explanation methods to other domains beyond network traffic.

Summary updated

Abstract

Anomaly detection and its explanation is important in many research areas such as intrusion detection, fraud detection, unknown attack detection in network traffic and logs. It is challenging to identify the cause or explanation of why one instance is an anomaly? and the other is not due to its unbounded and lack of supervisory nature. The answer to this question is possible with the emerging technique of explainable artificial intelligence (XAI). XAI provides tools and techniques to interpret and explain the output and working of complex models such as Deep Learning (DL). This paper aims to detect and explain network anomalies with XAI, kernelSHAP method. The same approach is used to improve the network anomaly detection model in terms of accuracy, recall, precision and f score. The experiment is conduced with the latest CICIDS2017 dataset. Two models are created (Model_1 and OPT_Model) and compared. The overall accuracy and F score of OPT_Model (when trained in unsupervised way) are 0.90 and 0.76, respectively.
BibTeX
@misc{roshan2023using,
  author = {Khushnaseeb Roshan and Aasim Zafar},
  title = {{Using Kernel SHAP XAI Method to optimize the Network Anomaly Detection Model}},
  year = {2023},
  eprint = {2308.00074},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.00074},
}
Figure