Generation is better than Modification: Combating High Class Homophily Variance in Graph Anomaly Detection

Rui Zhang, Dawei Cheng, Xin Liu, Jie Yang, Yi Ouyang, Xian Wu, Yefeng ZhengarXiv 2024

Abstract

Graph-based anomaly detection is currently an important research topic in the field of graph neural networks (GNNs). We find that in graph anomaly detection, the homophily distribution differences between different classes are significantly greater than those in homophilic and heterophilic graphs. For the first time, we introduce a new metric called Class Homophily Variance, which quantitatively describes this phenomenon. To mitigate its impact, we propose a novel GNN model named Homophily Edge Generation Graph Neural Network (HedGe). Previous works typically focused on pruning, selecting or connecting on original relationships, and we refer to these methods as modifications. Different from these works, our method emphasizes generating new relationships with low class homophily variance, using the original relationships as an auxiliary. HedGe samples homophily adjacency matrices from scratch using a self-attention mechanism, and leverages nodes that are relevant in the feature space but not directly connected in the original graph. Additionally, we modify the loss function to punish the generation of unnecessary heterophilic edges by the model. Extensive comparison experiments demonstrate that HedGe achieved the best performance across multiple benchmark datasets, including anomaly detection and edgeless node classification. The proposed model also improves the robustness under the novel Heterophily Attack with increased class homophily variance on other graph classification tasks.

Introduction: The Challenge of Class Homophily Variance

In graph-based learning, "homophily" refers to the tendency of similar nodes to connect. While most Graph Neural Networks (GNNs) rely on this assumption, Graph Anomaly Detection (GAD) presents a unique challenge: normal nodes typically follow homophilic patterns, while anomalous nodes often exhibit heterophilic behavior (connecting to different types of nodes).

Homophily distributions across different graph types, highlighting the bimodal nature of anomaly detection datasets.

The authors identify a phenomenon called a bimodal homophily distribution in GAD datasets. Unlike standard homophilic or heterophilic graphs which show a single peak, GAD graphs exhibit two distinct peaks—one for "cliquey" normal nodes and another for "isolated" anomalies. To quantify this, the paper introduces Class Homophily Variance (CHV). High CHV makes it difficult for standard GNNs to learn effectively, as the "social rules" for different classes are fundamentally inconsistent.

The HedGe Framework: Generating New Relationships

To address high CHV, the authors propose HedGe (Homophily Edge Generation Graph Neural Network). Rather than merely modifying the existing, often deceptive graph structure through pruning or adding edges, HedGe builds a new adjacency matrix from scratch.

The HedGe architecture, featuring position encoding and an attention-based edge sampler for graph generation.

The architecture is built on three pillars:

  1. Triple Position Encoding: Combines Degree, Laplacian, and Label encodings to provide the model with a comprehensive sense of a node's global and local structural context.
  2. Attention-based Edge Sampler: Uses a self-attention mechanism to determine node connectivity based on feature similarity. It employs an Edge Specific Gumbel-Softmax trick to allow for differentiable discrete edge sampling.
  3. Heterophily Edge Suppression: A specialized loss function penalty that discourages the generation of edges between nodes with different labels, forcing the resulting graph to be more homophilic and easier for the GNN to process.

Key Results and Insights

HedGe was evaluated against top-tier models like CAREGNN and GDN across several benchmarks, including Amazon, YelpChi, Reddit, and BlogCatalog.

  • State-of-the-Art Performance: HedGe achieved superior results, notably reaching an AUC of 98.25% on the Amazon dataset.
  • Robustness in Data Deserts: The model maintained a significant lead even with only 1% training data, outperforming competitors by over 2% in AUC on Amazon.
  • Edgeless Scenarios: In a stress test where all original edges were deleted, HedGe successfully generated a new structure that outperformed traditional non-graph classifiers like Random Forest, proving its ability to reconstruct meaningful relationships from features alone.
  • Theoretical Proof: The authors provide theoretical evidence that as CHV increases, the misclassification probability for standard GNNs also rises, justifying the need for the generation-based approach.

Conclusion

HedGe demonstrates that when an input graph is unreliable or exhibits high class homophily variance, generating a new structure is more effective than modifying the old one. While the $O(N^2)$ complexity of global self-attention presents a scaling challenge for massive graphs, the model's performance in anomaly detection and robustness against heterophily attacks marks a significant advancement in GNN research. Future work may involve optimizing these mechanisms for dynamic, evolving networks.

Summary updated

BibTeX
@misc{zhang2024generation,
  author = {Rui Zhang and Dawei Cheng and Xin Liu and Jie Yang and Yi Ouyang and Xian Wu and Yefeng Zheng},
  title = {{Generation is better than Modification: Combating High Class Homophily Variance in Graph Anomaly Detection}},
  year = {2024},
  eprint = {2403.10339},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.10339},
}
Figure