Rethinking Contrastive Learning in Graph Anomaly Detection: A Clean-View Perspective

Di Jin, Jingyi Cao, Xiaobao Wang, Bingdao Feng, Dongxiao He, Longbiao Wang, Jianwu Dang

Abstract

Graph Anomaly Detection (GAD) is a critical task in identifying irregular patterns within networked data. While Contrastive Learning (CL) has emerged as a powerful paradigm for GAD, its performance is often hindered by "interfering edges"—spurious connections created by anomalies that corrupt the local neighborhood structure. This paper introduces CVGAD (Clean-View Enhanced Graph Anomaly Detection), a framework designed to iteratively identify and remove these disruptive edges. By generating a "clean-view" of the graph, CVGAD enables more robust representation learning, effectively distinguishing between normal nodes and outliers. Experimental results across five benchmark datasets demonstrate that CVGAD consistently outperforms state-of-the-art methods.

Introduction

Graph Anomaly Detection (GAD) plays a vital role in various domains, including financial fraud detection, cybersecurity, and bioinformatics. Recent advancements have leveraged Contrastive Learning (CL) to learn node representations by assuming that a normal node should exhibit high similarity to its local neighborhood (positive pairs) and low similarity to distant nodes (negative pairs). However, this assumption frequently breaks down in the presence of anomalies. Anomalies are not merely isolated entities; they are embedded within the graph structure, often creating "interfering edges" that distort the definition of normalcy. This paper addresses the fundamental flaw in static graph contrastive learning by proposing a progressive purification strategy.

The Challenge of Interfering Edges

The authors identify two primary ways anomalies sabotage the contrastive learning process:

  1. Structural Anomalies: These create synthetic or "fake" edges between unrelated nodes, forming dense cliques that mimic normal community structures.
  2. Contextual Anomalies: Nodes with anomalous attributes propagate their "noise" to healthy neighbors through existing edges, leading to corrupted neighborhood embeddings.

When a model attempts to force a node to align with a neighborhood corrupted by these interfering edges, it fails to learn a robust representation of normal behavior. Instead, the model becomes biased toward the noise, reducing its ability to distinguish outliers.

The CVGAD Framework

To mitigate the impact of interfering edges, the Clean-View Enhanced Graph Anomaly Detection (CVGAD) framework introduces a three-stage pipeline:

1. Multi-Scale Anomaly Awareness

CVGAD analyzes the graph at two distinct granularities to capture diverse anomaly patterns. It employs Node-Subgraph (NS) contrast to evaluate how well a node fits into its broader local context and Node-Node (NN) contrast to assess its similarity to immediate neighbors. Random Walk with Restart (RWR) is utilized to sample these multi-scale neighborhoods effectively.

2. Progressive Purification

The core innovation of CVGAD is its iterative approach to graph cleaning. Rather than attempting to fix the graph in a single step—which risks deleting valid edges—the model calculates "interference scores" for edges based on the anomaly scores of the nodes they connect. It then removes the top-$K$ most suspicious edges and restarts the training process. This progressive refinement allows the model to gradually improve its understanding of the graph structure as the view becomes cleaner.

3. Dual-View Training

The framework jointly trains on both the original (anomalous) graph and the purified (clean) graph. This dual-view approach allows the model to contrast the noisy reality with the idealized normal structure, enhancing its sensitivity to the discrepancies that signal an anomaly.

Experimental Evaluation

The researchers evaluated CVGAD against seven state-of-the-art baselines, including CoLA, ANEMONE, and SL-GAD. The evaluation utilized five benchmark datasets: Cora, Citeseer, PubMed, Citation, and ACM.

Following standard GAD research protocols, synthetic anomalies were injected into these datasets:

  • Structural Anomalies: Created by forming fully connected cliques of 15 nodes.
  • Contextual Anomalies: Created by replacing a node's features with those of a distant, highly dissimilar node.

Results and Insights

CVGAD consistently outperformed all baselines across the tested datasets. Key findings include:

  • Performance Gains: The model achieved significant improvements in Area Under the Curve (AUC), notably increasing performance by 1.91% on Cora and 1.73% on ACM compared to the strongest baselines.
  • The Necessity of Iteration: Ablation studies confirmed that the "progressive" nature of the purification was essential. One-shot edge removal strategies often proved biased, whereas iterative removal allowed the model to learn in a virtuous cycle.
  • Purification Accuracy: The interference-sensitive edge detection mechanism was found to be significantly more accurate at identifying harmful edges than simpler methods based on raw feature similarity or standard Graph Convolutional Network (GCN) embeddings.

Conclusion

CVGAD shifts the focus of Graph Anomaly Detection from simply processing the provided graph to actively refining it. By identifying and removing interfering edges, the framework prevents anomalies from poisoning the training signal. While the iterative nature of the model introduces some computational overhead, the gains in detection accuracy and robustness suggest that a "clean-view" perspective is essential for the next generation of GAD algorithms. Future work will focus on scaling this approach to massive graphs and testing its efficacy against real-world adversarial attacks.

Summary updated

BibTeX
@inproceedings{jin2025rethinking,
  author = {Di Jin and Jingyi Cao and Xiaobao Wang and Bingdao Feng and Dongxiao He and Longbiao Wang and Jianwu Dang},
  title = {{Rethinking Contrastive Learning in Graph Anomaly Detection: A Clean-View Perspective}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.24963/ijcai.2025/335},
}
Figure