Skip to content

Official PyTorch implementation of KDD2025 paper "AnomalyGFM: Graph Foundation Model for Zero/Few-shot Anomaly Detection"

Notifications You must be signed in to change notification settings

mala-lab/AnomalyGFM

Repository files navigation

AnomalyGFM: Graph Foundation Model for Zero/Few-shot Anomaly Detection

Promotional Video

📢 We are excited to share that our paper presentation video is now available on YouTube!

🎬 Watch it here: [YouTube Link]

📌 Your feedback and support are greatly appreciated!

Main Contributions

1️⃣ AnomalyGFM is the first GAD-oriented GFM with strong zero-shot and few-shot generalization abilities.

2️⃣ AnomalyGFM is pre-trained to learn discriminative, graph-agnostic class prototypes with normal and abnormal residual features, and it supports few-shot graph prompt tuning for better adaptation.

3️⃣ A comprehensive benchmark on both zero-shot and few-shot settings using 11 real-world GAD datasets is established, on which i) AnomalyGFM performs significantly better the state-of-the-art unsupervised, supervised, and generalist GAD methods, and ii) AnomalyGFM can scale up to very large graphs

Framework of AnomalyGFM

The GAD datasets after feature alignment can be obtained from google drive link.

Requirements

To install requirements:

pip install -r requirements.txt

Training and Zero-shot Inference

To run the model(s), run this command:

python run_abnormal.py 

Training and Few-shot Inference

Run this command:

python run_finetune_normal.py 

For few-shot labeled normal nodes fine-tuning.

Run this command:

python run_finetune_abnormal.py 

for few-shot labeled abnormal nodes fine-tuning.

Large-scale Graph Generalization

Run this command:

python run_inference.py 

Citation

If you find this repo useful, please cite our paper.

@article{qiao2025anomalygfm,
  title={AnomalyGFM: Graph Foundation Model for Zero/Few-shot Anomaly Detection},
  author={Qiao, Hezhe and Niu, Chaoxi and Chen, Ling and Pang, Guansong},
  journal={arXiv preprint arXiv:2502.09254},
  year={2025}
}

About

Official PyTorch implementation of KDD2025 paper "AnomalyGFM: Graph Foundation Model for Zero/Few-shot Anomaly Detection"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages