NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Generative and Contrastive Self-Supervised Learning for Graph Anomaly Detection

Yu Zheng, Ming Jin, Yixin Liu, Lianhua Chi, Khoa T. Phan, Yi-Ping Phoebe Chen · DOI

Abstract

Anomaly detection from graph data has drawn much attention due to its practical significance in many critical applications including cybersecurity, finance, and social networks. Existing data mining and machine learning methods are either shallow methods that could not effectively capture the complex interdependency of graph data or graph autoencoder methods that could not fully exploit the contextual information as supervision signals for effective anomaly detection. To overcome these challenges, in this paper, we propose a novel method, Self-Supervised Learning for Graph Anomaly Detection (SL-GAD). Our method constructs different contextual subgraphs (views) based on a target node and employs two modules, generative attribute regression and multi-view contrastive learning for anomaly detection. While the generative attribute regression module allows us to capture the anomalies in the attribute space, the multi-view contrastive learning module can exploit richer structure information from multiple subgraphs, thus abling to capture the anomalies in the structure space, mixing of structure, and attribute information. We conduct extensive experiments on six benchmark datasets and the results demonstrate that our method outperforms state-of-the-art methods by a large margin.

Introduction

Graph Anomaly Detection (GAD) is a critical task for identifying "odd-one-out" nodes in complex networks, such as fraudulent accounts in financial systems or malicious bots in social media. Detecting these anomalies is challenging because they can manifest in three distinct ways: through unusual structural connections, deviant node attributes, or a subtle mixture of both. Furthermore, the lack of ground-truth labels in real-world scenarios necessitates self-supervised approaches that can learn robust representations without explicit supervision.

Existing deep learning methods often rely on Graph Autoencoders (GAEs) to reconstruct the entire graph. However, these methods frequently fail to capture the local "contextual information"—the specific relationship between a node and its immediate neighborhood—which serves as the primary signal for abnormality.

Methodology: The SL-GAD Framework

SL-GAD addresses these limitations by treating a node's neighborhood as its context and utilizing self-supervision to determine if a node "fits" its surroundings. The framework operates through a four-step pipeline:

  1. Graph View Sampling: For any target node, the model samples two distinct local subgraphs (views) using Random Walk with Restart (RWR).
  2. Anonymization: To prevent the model from "cheating," the target node's features are zeroed out in these subgraphs. This forces the encoder to rely entirely on neighboring nodes to infer what the target node's representation should be.
  3. Dual Self-Supervised Modules:
    • Generative Attribute Regression: A GNN-based encoder-decoder attempts to reconstruct the target node's original attributes from its neighbors. High reconstruction error indicates an attribute anomaly.
  4. Multi-view Contrastive Learning: This module compares the target node's embedding to a summary (readout) of the local subgraphs. If the node's representation diverges significantly from its neighborhood's summary, it is flagged as a structural or mixed anomaly.
  5. Hybrid Anomaly Scoring: The final anomaly score is a weighted combination of generative and contrastive scores, stabilized over multiple evaluation rounds.
Detailed architecture of the SL-GAD framework, illustrating the generative and contrastive discrimination modules.

Experimental Setup

The authors evaluated SL-GAD against state-of-the-art baselines, including DOMINANT and CoLA, across six real-world benchmark datasets. These datasets represent two distinct types of networks: social networks (BlogCatalog, Flickr) and citation networks (ACM, Cora, CiteSeer, PubMed). As shown in the table below, these datasets vary significantly in scale and density, providing a rigorous test for the model's robustness.

Statistics of the six benchmark datasets used for evaluation.

Key Results and Insights

SL-GAD consistently outperformed all baselines. Notably, on the PubMed dataset, SL-GAD achieved an AUC of 0.9672, a significant improvement over the next best competitor, CoLA (0.9512). Several key insights emerged from the study:

  • The Power of Anonymization: By hiding target node features during encoding, the model becomes highly sensitive to mismatches between a node and its neighborhood distribution.
  • Complementary Modules: Ablation studies revealed that the generative module excels at identifying attribute-level noise, while the contrastive module is superior at detecting structural inconsistencies.
  • Contrastive Dominance: Contrastive learning generally plays a more critical role in detection performance than attribute reconstruction, as it captures higher-order dependencies between graph structure and content.

Conclusion and Future Work

While SL-GAD sets a new state-of-the-art for GAD, it faces limitations regarding fixed subgraph sizes, which may miss broader structural anomalies in very dense networks. Additionally, the balance between generative and contrastive scores currently requires manual hyperparameter tuning. Future research may explore Neural Architecture Search (NAS) to automatically optimize GNN architectures for specific graph topologies, further enhancing the framework's adaptability.

Summary updated

BibTeX
@article{zheng2021generative,
  author = {Yu Zheng and Ming Jin and Yixin Liu and Lianhua Chi and Khoa T. Phan and Yi-Ping Phoebe Chen},
  title = {{Generative and Contrastive Self-Supervised Learning for Graph Anomaly Detection}},
  journal = {IEEE Trans. Knowl. Data Eng.},
  year = {2021},
  doi = {10.1109/tkde.2021.3119326},
}
Figure