ARC: A Generalist Graph Anomaly Detector with In-Context Learning

Yixin Liu, Shiyuan Li, Yu Zheng, Qingfeng Chen, Chengqi Zhang, Shirui Pan

Abstract

Graph Anomaly Detection (GAD) is essential for identifying malicious activities in networked data, yet existing methods are often limited by their reliance on dataset-specific training. We present ARC (Anomaly detector with in-Context learning), a generalist model designed to eliminate the need for retraining on new domains. By utilizing in-context learning, ARC identifies abnormal nodes on-the-fly using a small set of normal nodes as a reference. Our approach incorporates smoothness-based feature alignment and a residual graph encoder to capture universal indicators of abnormality. Experimental results across 12 benchmark datasets demonstrate that ARC significantly outperforms traditional paradigms in zero-shot and few-shot scenarios.

The Challenge of Domain-Specific GAD

Current state-of-the-art Graph Anomaly Detection (GAD) methods typically follow a "one model for one dataset" approach. Deploying these models on a new network requires collecting extensive domain-specific labels and retraining from scratch—a process that is often slow, expensive, or impossible in data-sparse environments.

Comparison of supervised, unsupervised, and the proposed generalist GAD paradigms.

The authors identify three primary hurdles to creating a generalist GAD model:

  1. Feature Alignment: Disparate graphs use different feature dimensions and semantics.
  2. Representation Encoding: Designing a single encoder that captures structural "abnormality" without overfitting to specific dataset meanings.
  3. Few-shot Prediction: Defining "normal" behavior for a new dataset using only a handful of examples at inference time.

Methodology: The ARC Framework

ARC addresses these challenges through three integrated modules:

Smoothness-Based Feature Alignment

Rather than matching feature semantics, ARC aligns features based on their behavior across the graph. It projects features into a common dimension and sorts them by "smoothness"—the degree of variation between connected nodes. High-frequency ("rougher") features are often more indicative of anomalies across diverse datasets.

Ego-Neighbor Residual Graph Encoder

Standard Graph Neural Networks (GNNs) often act as low-pass filters, smoothing out the local discrepancies that signal anomalies. ARC employs a residual design that explicitly calculates the difference between a node and its neighbors across multiple hops. This architecture amplifies local "heterophily," making suspicious nodes stand out from their peers.

The Ego-Neighbor Residual Graph Encoder highlights local heterophily by calculating differences between nodes and their neighbors.

Cross-Attentive In-Context Anomaly Scoring

During inference, ARC is provided with a few "context" nodes known to be normal. A cross-attention mechanism attempts to reconstruct the target "query" node as a linear combination of these normal examples. Nodes that cannot be easily reconstructed (exhibiting high "drift distance") are flagged as anomalies.

Experimental Evaluation

ARC was evaluated across 12 benchmark datasets, including citation networks (Cora, CiteSeer, ACM), social networks (Flickr, Weibo, Reddit), and e-commerce co-review networks (YelpChi, Amazon). The model was trained on four datasets (PubMed, Flickr, Questions, YelpChi) and tested in a zero-shot/few-shot manner on the remaining eight, using only 10 normal nodes as context.

Key Insights

  • Smoothness as a Universal Metric: Feature smoothness serves as a dataset-agnostic indicator of anomaly relevance. Prioritizing "noisy" signals allows the model to focus on areas where anomalies typically reside.
  • Attention as a One-Class Classifier: The cross-attention module functions as a flexible one-class classifier. It compares query nodes against specific types of normal behavior rather than a single global average.
  • The Necessity of High-Pass Filtering: While most GNN research seeks to improve classification through smoothing, GAD benefits from the opposite. ARC’s residual encoder intentionally amplifies structural dissonance.

Results and Performance

ARC achieved the highest average ranking across the 8 test datasets, outperforming both supervised and unsupervised baselines. Notable gains include a 21.1% improvement in AUROC on the Cora dataset and a 36.6% improvement on Amazon. Furthermore, ARC’s inference is highly efficient, comparable to simple GCNs, and reaches peak performance with as few as 10 context nodes.

Conclusion and Future Work

ARC represents a significant step toward generalist graph models. By shifting from dataset-specific training to in-context learning, it enables rapid deployment in new domains. Current limitations include the inability to incorporate known abnormal samples into the context. Future research will explore leveraging mixed context samples (both normal and abnormal) and investigating potential adversarial attacks designed to mimic normal smoothness patterns.

Summary updated

BibTeX
@inproceedings{liu2024arc,
  author = {Yixin Liu and Shiyuan Li and Yu Zheng and Qingfeng Chen and Chengqi Zhang and Shirui Pan},
  title = {{ARC: A Generalist Graph Anomaly Detector with In-Context Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=IdIVfzjPK4},
}
Figure