Interpretable Graph Anomaly Detection using Gradient Attention Maps

Yifei Yang, Peng Wang, Xiaofan He, Dongmian Zou · DOI

Abstract

Graph Anomaly Detection (GAD) is critical for identifying malicious activities in complex relational data, such as financial fraud or network intrusions. However, most Graph Neural Network (GNN) based detectors operate as black boxes, providing little insight into why a specific graph or node is flagged. This paper introduces GRAM (GRadient Attention Map), an unsupervised framework that leverages the gradients of GNNs to derive anomaly scores. By training exclusively on normal data and analyzing gradient spikes during inference, GRAM provides both high detection accuracy and inherent interpretability. Our experiments across diverse benchmarks demonstrate that GRAM significantly outperforms state-of-the-art methods in both detection and localization tasks, offering a transparent solution for high-stakes applications.

Introduction

Graph Anomaly Detection is vital for spotting irregularities in structured data. While GNNs have become the standard for this task due to their ability to model complex relationships, they suffer from a significant lack of interpretability. Existing detectors often provide binary labels without explaining the underlying structural or feature-based reasons for an anomaly alert. This "black box" nature is a major hurdle in fields like medicine or finance, where human experts must verify model decisions.

Overview of Graph Anomaly Detection tasks: (a) Graph-level detection identifies anomalous graphs in a dataset, while (b) Node-level detection localizes specific anomalous nodes within a single graph.

Methodology: The GRAM Framework

GRAM turns the concept of model interpretability on its head: instead of using it solely for post-hoc analysis, it utilizes interpretability as the primary scoring mechanism. The framework operates in two main phases:

  1. Unsupervised Training: A GNN backbone (such as a Variational Graph Autoencoder or a regression model) is trained exclusively on "normal" data to learn the typical patterns and structural properties of the dataset.
  2. Gradient-Based Scoring: During the testing phase, the model calculates the gradient of its output with respect to the node feature embeddings. Because the model was optimized only for normal data, it "struggles" to represent anomalous structures, leading to distinct spikes in the gradient maps.
The GRAM architecture for graph-level detection using a VGAE backbone. (a) Training phase on normal data. (b) Testing phase where gradients are used to generate anomaly scores.

These gradients are aggregated into a final score for individual nodes or entire graphs. This approach is architecture-agnostic, meaning it can be integrated with various GNN backbones like GCN or GraphConv.

Experimental Results

GRAM was evaluated across a wide range of benchmarks, including chemical compounds (MUTAG, NCI1), protein structures, and social networks.

  • Superior Detection Accuracy: On graph-level detection tasks, GRAM achieved the highest AUC on 6 out of 9 datasets, including a near-perfect 99.49% on synthetic validation data. It consistently outperformed established baselines like DOMINANT and OC-GNN.
  • Precise Localization: In a wireless network relay node detection task, GRAM achieved 61.60% accuracy in identifying specific malfunctioning nodes—nearly double the performance of baseline models which hovered around 25%.
  • Explainability Leader: On interpretability benchmarks (MNIST superpixels and MUTAG), GRAM significantly outperformed the state-of-the-art SIGNET model in both node-level and edge-level explanation accuracy.

Discussion and Conclusion

The core insight of GRAM is that the difficulty a model faces when processing a data point is a powerful indicator of an anomaly. Theoretical analysis confirms that GRAM is particularly sensitive to critical structural points, such as "bridge" nodes that connect disparate clusters.

While highly effective, GRAM currently assumes a "clean" training set consisting only of normal samples. Future research will focus on adapting the gradient-based approach to handle noisy training data and massive, evolving graphs like global social networks. By bridging the gap between performance and transparency, GRAM represents a significant step forward for reliable graph anomaly detection.

Summary updated

BibTeX
@article{yang2024interpretable,
  author = {Yifei Yang and Peng Wang and Xiaofan He and Dongmian Zou},
  title = {{Interpretable Graph Anomaly Detection using Gradient Attention Maps}},
  journal = {Neural Networks},
  year = {2024},
  doi = {10.1016/j.neunet.2024.106463},
}
Figure