GRAM: An interpretable approach for graph anomaly detection using gradient attention maps

Yifei Yang, Peng Wang, Xiaofan He, Dongmian Zou

TL;DR

This paper introduces GRAM, a novel approach to graph anomaly detection (GAD) that leverages gradient attention maps from Graph Neural Networks (GNNs) to provide interpretable anomaly scores. By making GNN decisions transparent, GRAM not only enhances performance but also builds trust in anomaly detection systems.

What Problem Does This Paper Address?

Detecting unusual patterns in graph data, known as Graph Anomaly Detection (GAD), is crucial across many domains like fraud detection and network intrusion. While GNNs have shown promise in GAD, they often act as "black boxes," making it difficult to understand why a particular node, edge, or graph is flagged as anomalous. This lack of interpretability hinders trust and adoption, especially when critical decisions depend on these detections. Existing GNN-based GAD methods also struggle with performance consistency across diverse graph datasets due to complex relational dependencies and data heterogeneity.

Methods

GRAM tackles these challenges by introducing an interpretable GAD framework. The core idea is to extract an "attention map" derived from the gradients of a GNN's output with respect to its intermediate representations. This attention map highlights which parts of the graph are most influential in the GNN's decision-making process.

Here's a breakdown of the GRAM approach:

  • Unsupervised Training: GRAM trains a GNN (specifically, a Variational Graph Autoencoder or VGAE for graph-level detection, and a GNN regression model for node-level detection) solely on normal graph data. This ensures the GNN learns the characteristics of typical data.
  • Gradient Attention Maps: During the testing phase, GRAM computes the gradients of the GNN's output (e.g., a latent representation or a prediction) with respect to the GNN's intermediate feature representations. These gradients, when combined with the intermediate features, form the "gradient attention coefficients."
  • Anomaly Scoring: These coefficients are then used to compute anomaly scores for individual nodes and entire graphs. The intuition is that anomalous data points will cause larger deviations in these gradients, leading to higher anomaly scores.
  • Flexibility: GRAM is designed to be flexible, not relying on a specific GNN architecture or a particular method for mapping GNN outputs to anomaly scores.

Datasets

The paper evaluates GRAM on a variety of datasets:

  • Synthetic Data: Used for theoretical analysis to understand GRAM's behavior under controlled conditions. This includes tree-structured graphs and double ring-structured graphs.
  • Real-World Graph Classification Datasets:
    • MUTAG
    • NCI1
    • PROTEINS
    • PTC
    • IMDB-B
    • RDT-B
    • IMDB-M
    • RDT-M5K For these datasets, one class is designated as "normal," and the rest as "anomalous."
  • Wireless Network Dataset: A newly introduced benchmark for node-level GAD. This dataset models wireless communication networks where anomalies are introduced by reducing the communication rate of a relay node, impacting overall network throughput.

Key Insights and Ideas

  • Interpretability as a Performance Booster: The paper demonstrates that by making GNNs interpretable through gradient attention maps, GRAM not only explains anomaly detection decisions but also achieves superior performance compared to many existing methods.
  • Gradient Attention Maps Reveal Critical Components: The theoretical analysis and visualizations show that GRAM can effectively highlight specific nodes or structural motifs (like the intersection point in a double ring graph) that contribute to a graph's anomalous nature.
  • Flexibility Across GNN Architectures: GRAM's effectiveness is shown to be independent of the specific GNN backbone used (e.g., GCN, GraphConv), suggesting its broad applicability.
  • Unsupervised Training for Robustness: Training solely on normal data is key. This allows the GNN to learn a strong representation of normalcy, making deviations (anomalies) more apparent.

Key Results

  • Graph-Level Anomaly Detection: GRAM consistently achieved excellent AUC and AP scores across nine real-world graph classification datasets, often outperforming baseline methods and ranking first or second on most. For example, on the SYN data, GRAM achieved an AUC of 99.49% and an AP of 99.26%.
  • Node-Level Anomaly Detection: On the wireless network dataset, GRAM achieved a significantly higher accuracy rate (61.60%) compared to all baseline methods, which struggled to surpass random guessing (around 25%).
  • Interpretability Evaluation: On datasets with ground-truth explanations (MNIST-0, MNIST-1, MUTAG), GRAM's interpretability performance (measured by NX-AUC and EX-AUC) outperformed baseline methods and even a specialized interpretability method like SIGNET.

Limitations and Future Work

  • Assumption of Normal Data: GRAM relies on the assumption that the training data consists solely of normal graphs. If anomalies are present in the training set, the GNN's learned representation of normalcy might be compromised, affecting interpretability and performance.
  • Multi-Graph Training Focus: The current GRAM framework is designed for training on multiple graphs. Scenarios where anomalies are present within a single graph (intra-graph anomalies) are not directly addressed.

Future work could focus on:

  • Developing methods to handle training data that may contain anomalies.
  • Extending GRAM to effectively detect anomalies within a single graph.
  • Further exploring its applicability to more complex and diverse graph structures.

Summary updated

BibTeX
@article{yang2024gram,
  author = {Yifei Yang and Peng Wang and Xiaofan He and Dongmian Zou},
  title = {{GRAM: An interpretable approach for graph anomaly detection using gradient attention maps}},
  journal = {Neural Networks},
  year = {2024},
  doi = {10.1016/j.neunet.2024.106463},
}
Figure