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

TL;DR

Contrastive learning for graph anomaly detection breaks down when "interfering edges" connect normal and anomalous nodes, polluting local neighborhoods with noise. This paper introduces CVGAD, a framework that dynamically identifies and progressively removes these noisy edges, creating a "clean view" that significantly boosts anomaly detection performance.

What Problem Does This Paper Address?

Graph Anomaly Detection (GAD) is crucial for identifying unusual patterns in networked data, with vital applications in fraud detection, cybersecurity, and social network analysis. Modern state-of-the-art GAD methods heavily leverage self-supervised contrastive learning. Typically, these models sample a local subgraph around a target node (often using Random Walks with Restart) and assume that normal nodes will be highly similar to their local neighborhoods, while anomalous nodes will stand out as dissimilar.

However, the authors point out a fundamental flaw in this assumption: real-world anomalous graphs contain interfering edges. These can be structural anomalies (spurious edges connecting unrelated nodes) or edges attached to contextual anomalies (nodes with corrupted features).

When contrastive models blindly ingest these interfering edges, the noise bleeds into the subgraph embeddings. This distorts the similarity scores, making anomalous nodes look normal and normal nodes look anomalous. Standard fixes, like dropping edges with low feature similarity, fail because they are blind to the graph's multi-dimensional structure, while Graph Convolutional Networks (GCNs) tend to smooth out and hide these anomalous signals entirely.

Figure 1: (a) A toy example illustrating GAD problems based on contrastive learning. In the whole graph, the red dashed line represents an anomalous edge—a connection that did not originally exist between nodes. The red node signifies an anomalous node, whose features are altered. Both of these anomalies introduce interfering edges (shown as red solid lines), which disrupt the process of generating positive instance pairs. The middle subgraph is sampled through RWR starting from node 3, after which the subgraph embedding for node 3 is obtained through further processing; (b) The proportion of interfering edges under different similarity scores based on raw features on the Cora dataset; (c) The proportion of interfering edges under different similarity scores based on GCN-aggregated features on the Cora dataset.

Methods

To overcome this data-pollution problem, the authors propose CVGAD (Clean-View Enhanced Graph Anomaly Detection), which cleans the graph view dynamically during training. The pipeline consists of three core components:

  1. Multi-Scale Anomaly Awareness Module: This module employs a dual-scale contrastive learning architecture, executing both Node-Subgraph (NS) contrast and Node-Node (NN) contrast. Crucially, it trains simultaneously on two views: the original anomalous graph (to learn diverse features) and a dynamically updated "clean graph" (to minimize noise).
  2. Progressive Purification Module: Instead of removing noisy edges in a single, error-prone step at the start of training, CVGAD uses an iterative approach. It computes an "edge interference score" by summing the anomaly scores of an edge's two endpoints. In each iteration, it removes the top-$K$ highest-scoring interfering edges, resets the model parameters to avoid bias, and retrains on the cleaner graph.
  3. Score Calculation: The final anomaly score for each node is a weighted combination of its multi-scale contrastive score and a novel "detection score," which counts how frequently a node was found to be an endpoint of a deleted interfering edge.
Figure 2: Overview of CVGAD. It consists of three primary components: (1) Multi-scale anomaly awareness: NS contrast and NN contrast are conducted on both the anomalous graph and clean graph, jointly training the model; (2) Progressive purification: Node contrast scores are calculated on the anomalous graph. Based on these scores, an interference-sensitive edge detection matrix is generated. The edges with the top-K highest interference scores are removed to create a cleaner graph. This module, together with the multi-scale anomaly awareness component, is trained iteratively to incrementally improve model performance; (3) Score calculation: The contrast score and the detection score are combined to generate the final node anomaly value.

Datasets

The framework was evaluated on five widely used benchmark datasets:

  • Cora, Citeseer, PubMed (Citation networks)
  • Citation, ACM (Academic networks)

Because these standard datasets do not inherently contain anomalies, the authors artificially injected both structural anomalies (by creating fully connected cliques among random nodes) and contextual anomalies (by replacing node features with highly distinct attributes from other nodes) in equal proportions.

Key Insights and Ideas

  • The GAD Catch-22: To accurately find anomalies, you need clean representations; to get clean representations via contrastive learning, you need a graph free of anomalous interference. CVGAD breaks this loop through iterative purification.
  • Over-smoothing Masks Interference: The paper demonstrates why simple GCN-based edge filtering fails. GCNs naturally smooth neighbor representations, artificially inflating the feature similarity between connected nodes and masking the presence of interfering edges.
  • Iterative > One-Step: A single-step edge removal strategy at the beginning of training is highly inaccurate because the model hasn't learned robust representations yet. Gradual, multi-round pruning allows the anomaly awareness and purification modules to mutually reinforce each other.

Key Results

CVGAD was tested against seven state-of-the-art baselines (including CoLA, ANEMONE, and Sub-CR) using the ROC-AUC metric.

  • Superior Performance: CVGAD achieved the highest AUC across all five datasets, yielding notable improvements over the best baselines: +1.91% on Cora, +0.31% on Citeseer, +1.20% on Citation, +1.73% on ACM, and +0.35% on PubMed.
  • High Edge-Removal Accuracy: Empirical tracking showed that CVGAD successfully identified and removed a significantly higher proportion of actual interfering edges compared to variants relying purely on raw feature similarity or standard GCN embeddings.
Edge removal accuracy over iterations ($T_i$) on Cora and ACM datasets.

Limitations and Future Work

  • Computational Complexity: Because CVGAD relies on an iterative training loop—where edges are removed, parameters are reset, and the model is retrained over multiple rounds ($m$)—it possesses a higher time complexity than single-step contrastive methods. Scaling this iterative purification to massive, industrial-scale graphs remains a challenge.
  • Hyperparameter Sensitivity: The model introduces several balancing hyperparameters ($\alpha, \beta, \gamma$) to manage the multi-view and multi-scale loss functions, requiring careful tuning depending on the dataset's structural properties.

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