Abstract
Anomaly detection on attributed graphs plays an essential role in applications such as fraud detection, intrusion monitoring, and misinformation analysis. However, text-attributed graphs (TAGs), in which node information is expressed in natural language, remain underexplored, largely due to the absence of standardized benchmark datasets. In this work, we introduce TAG-AD, a comprehensive benchmark for anomaly node detection on TAGs. TAG-AD leverages large language models (LLMs) to generate realistic anomalous node texts directly in the raw text space, producing anomalies that are semantically coherent yet contextually inconsistent. We also propose a retrieval-augmented generation (RAG)-assisted, LLM-based zero-shot anomaly detection framework. Our results reveal that LLMs excel at contextual anomalies, while GNNs remain superior for structural detection. RAG-assisted prompting achieves performance comparable to manual prompts, offering a scalable alternative to prompt engineering.
Introduction
Graph Anomaly Detection (GAD) is a critical task for identifying irregular patterns in networked data, such as fraudulent transactions or malicious social media accounts. While traditional GAD focuses on nodes with fixed-dimensional vector features, real-world data often comes in the form of Text-Attributed Graphs (TAGs), where nodes are associated with rich natural language descriptions.
Current research faces two primary hurdles in this domain. First, existing benchmarks typically inject anomalies by perturbing feature vectors, creating "unnatural" data that fails to capture the semantic nuance of real-world textual anomalies. Second, while Large Language Models (LLMs) show promise for zero-shot detection, they often rely on brittle, manually-crafted prompts that are difficult to generalize across different domains.
Methodology: The TAG-AD Framework
To address these gaps, we introduce the TAG-AD benchmark and a novel RAG-assisted reasoning framework.
1. Realistic Anomaly Generation
Instead of simple vector noise, TAG-AD uses LLMs to generate Contextual Anomalies in the raw text space. By identifying a "Target Label" maximally different from a node's neighborhood, we prompt an LLM to rewrite the node's text to fit this inconsistent topic while maintaining original fluency. This creates anomalies that are semantically coherent but contextually out-of-place.
2. RAG-Assisted Zero-Shot GAD
To eliminate the need for manual prompt engineering, we developed a framework that distills global expert knowledge into structured reasoning guidelines.
The process involves:
- Corpus Construction: Building a knowledge base from anomaly detection literature.
- Global Distillation: Retrieving relevant definitions and condensing them into a unified analysis framework.
- Grounded Prompting: Providing the LLM with this distilled framework alongside specific node and neighborhood information for inference.
Experimental Results
We evaluated our framework on four citation and Wikipedia-based datasets (Cora, CiteSeer, PubMed, and WikiCS) against five types of anomalies.
The Division of Labor
Our experiments revealed a clear specialization between models. LLMs demonstrated a significant advantage in detecting contextual anomalies. For instance, on the Cora dataset, DeepSeek-V3 achieved a 0.966 ROC-AUC, far surpassing the best GNN baseline (CoLA at 0.688). This suggests that LLMs can identify subtle semantic inconsistencies that numerical "neighborhood smoothing" in GNNs often masks.
Conversely, GNN-based methods like DONE and AdONE remain superior for structural anomalies (e.g., dense cliques), often scoring above 0.98 ROC-AUC. LLMs still struggle to "visualize" complex graph topologies even when described textually.
Prompting Efficiency
As shown in the results, the RAG-assisted framework (RAG Prompt) consistently performs comparably to, or better than, human-designed prompts (Manual Prompt). This underscores the practical value of automating the "expertise" required for specialized detection tasks. Furthermore, model scaling plays a role: more advanced models like DeepSeek-V3 and GPT-4o-mini show greater performance gains from retrieved knowledge than smaller models.
Conclusion and Future Directions
While LLMs offer powerful semantic reasoning for TAG-AD, they exhibit "graph blindness" regarding complex structural connectivity. Future work should explore hybrid models that utilize GNNs as structural encoders and LLMs as semantic reasoners. Additionally, extending this benchmark to multi-modal settings—incorporating images and timestamps—will be essential for modeling the full complexity of real-world anomalous behavior.
Summary updated