Graph Anomaly Detection with Unsupervised GNNs

Lingxiao Zhao, Saurabh Sawlani, Arvind Srinivasan, Leman AkogluarXiv 2022

Abstract

Graph-based anomaly detection finds numerous applications in the real-world. Thus, there exists extensive literature on the topic that has recently shifted toward deep detection models due to advances in deep learning and graph neural networks (GNNs). A vast majority of prior work focuses on detecting node/edge/subgraph anomalies within a single graph, with much less work on graph-level anomaly detection in a graph database. This work aims to fill two gaps in the literature: We (1) design GLAM, an end-to-end graph-level anomaly detection model based on GNNs, and (2) focus on unsupervised model selection, which is notoriously hard due to lack of any labels, yet especially critical for deep NN based models with a long list of hyper-parameters. Further, we propose a new pooling strategy for graph-level embedding, called MMD-pooling, that is geared toward detecting distribution anomalies which has not been considered before. Through extensive experiments on 15 real-world datasets, we show that (i) GLAM outperforms node-level and two-stage (i.e. not end-to-end) baselines, and (ii) model selection picks a significantly more effective model than expectation (i.e. average) -- without using any labels -- among candidates with otherwise large variation in performance.

Introduction

Detecting anomalies in graph databases—identifying the "odd graph out"—is a critical task with applications ranging from toxicity prediction in chemical compounds to malware detection in software control-flow graphs. While significant research has focused on "local" anomalies (e.g., a fraudulent node in a single large network), "global" or graph-level anomaly detection (GLAD) remains less explored.

Existing GLAD methods often rely on disconnected two-stage pipelines, where graph features are extracted independently of the outlier detection objective. Furthermore, deep learning models for GLAD face a significant "hyperparameter headache": in unsupervised settings, the lack of labels makes it nearly impossible to validate and select the best model configuration. This paper introduces GLAM (Graph-Level Anomaly detection Model) to address these challenges through an end-to-end framework and a novel unsupervised model selection strategy.

Methodology: The GLAM Framework

GLAM integrates graph representation learning with an anomaly detection objective in a unified, end-to-end architecture.

Dual-Pooling for Comprehensive Representations

To capture diverse types of anomalies, GLAM employs two complementary pooling strategies to aggregate node embeddings into a graph-level vector:

  1. Mean-pooling: This standard approach is effective at identifying "Point Anomalies," where a graph contains a few highly unusual nodes that shift the overall average.
  2. MMD-pooling (Maximum Mean Discrepancy): A core innovation of this work, MMD-pooling treats a graph as a distribution of node embeddings. It captures "Distribution Anomalies"—cases where individual nodes may appear normal, but their collective composition is unusual. To maintain efficiency, the Nyström method is used for approximation.
Comparison of Mean and MMD pooling in detecting point and distribution anomalies.

One-Class Objective and Model Selection

The model is trained using a Deep-SVDD objective, which maps "normal" graphs into a compact hypersphere in the embedding space. Graphs falling outside this sphere are flagged as anomalies.

To solve the hyperparameter tuning problem, the authors propose HITS-ENS, an unsupervised model selection (UMS) tool. Inspired by the HITS algorithm for web ranking, HITS-ENS treats models and graphs as a bipartite network. It recursively calculates a "reliability" score for each model based on their consensus on identified outliers, allowing for the automatic selection of high-performing configurations without ground-truth labels.

Experimental Evaluation

The performance of GLAM was evaluated across 15 real-world datasets from the TU Datasets repository, spanning bioinformatics (e.g., PROTEINS, DD), small molecules (e.g., TOX21, AIDS), and social networks (e.g., COLLAB, REDDIT). These datasets were adapted for anomaly detection by treating one class as the inlier and downsampling others to approximately 5% to represent outliers.

Key Results

GLAM demonstrated superior performance, achieving an average rank of 1.8 across all datasets and significantly outperforming eight baseline methods, including OCGNN and DOMINANT. Statistical tests confirmed GLAM's superiority ($p < 0.01$) over both traditional kernel-based and repurposed node-level baselines.

A critical finding was the effectiveness of the HITS-ENS selection strategy. As shown in the experimental results, the selected models consistently outperformed the average performance across all candidate models, often by a significant margin.

ROC-AUC performance across 15 datasets, comparing the model selected by HITS-ENS against the average performance of all candidate models.

Conclusion

GLAM advances graph-level anomaly detection by providing an end-to-end framework that captures both point and distribution anomalies. Its built-in unsupervised model selection addresses a major practical hurdle in deploying deep anomaly detection models. Future work may focus on improving the scalability of the consensus phase for massive graph databases and developing methods to provide explanations for detected anomalies.

Summary updated

BibTeX
@misc{zhao2022graph,
  author = {Lingxiao Zhao and Saurabh Sawlani and Arvind Srinivasan and Leman Akoglu},
  title = {{Graph Anomaly Detection with Unsupervised GNNs}},
  year = {2022},
  eprint = {2210.09535},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.09535},
}
Figure