GuARD: Effective Anomaly Detection through a Text-Rich and Graph-Informed Language Model

Yunhe Pang, Bo Chen, Fanjin Zhang, Yanghui Rao, Evgeny Kharlamov, Jie Tang · DOI

TL;DR

GuARD (Text-Rich and Graph-Informed Language Model) is a novel framework that bridges the gap between Large Language Models (LLMs) and Graph Neural Networks (GNNs) for anomaly detection. By integrating structural topology and rich semantic attributes through a progressive multi-modal instruction tuning approach, it achieves state-of-the-art accuracy while being up to 10x faster during inference than vanilla LLM baselines.

What Problem Does This Paper Address?

Real-world data often exists as "text-rich graphs"—networks where nodes are associated with significant amounts of text. Examples include academic citation networks (where nodes are papers with titles, abstracts, and author lists) and social media (where nodes are users with profiles and tweets). Detecting anomalies in these graphs—such as a paper incorrectly assigned to an author or a social bot spreading misinformation—is a complex challenge.

Figure 1: Illustration about typical anomaly detection in text- rich graph: (a) shows the anomaly detection in authors’ multi- relation graph (i.e. Incorrect Assignment Detection, IND); (b) show- cases the bot detection on social networks; (c) depicts the misinfor- mation detection of news articles on comment networks.

Traditional Graph Neural Networks (GNNs) excel at capturing structural patterns but often fail to grasp deep, fine-grained semantics. Conversely, Large Language Models (LLMs) are semantic powerhouses but face three major hurdles:

  1. High Cost: Processing massive amounts of text for every node in a graph is computationally expensive.
  2. "Lost in the Middle": LLMs often struggle to identify critical signals when buried in long-context inputs.
  3. Structural Blindness: LLMs do not inherently understand the topological biases (like co-author links) that are vital for distinguishing normal patterns from abnormal ones.

Methods

The authors propose a three-pronged architecture designed to make LLMs "graph-aware" and "text-efficient":

  1. Task-Guided Multi-Turn Instruction Tuning: Instead of predicting one node at a time, GuARD stacks multiple node queries into a single multi-turn prompt. This allows the model to reuse global context across turns, significantly boosting speed. Furthermore, earlier queries act as "soft" few-shot examples that help the model decode subsequent labels more accurately.
  2. Semantic Embedding Module: To handle long textual attributes without blowing up the context window, GuARD uses a Small Language Model (SLM) like RoBERTa to summarize rich text into a single "semantic token." This token is then projected into the LLM's embedding space.
  3. Structural Embedding Module: GuARD leverages state-of-the-art GNNs (like GCCAD) to encode the graph's topology. These structural features are similarly projected into "graph tokens" that the LLM can ingest alongside text.
The GuARD workflow, illustrating how key info, semantic tokens, and graph tokens are integrated into the LLM via a progressive training regime.

Progressive Training: To ensure these diverse inputs don't clash, the authors use a three-phase training recipe: first tuning the base LLM on key text, then freezing it to train the semantic projector, and finally training the graph projector.

Datasets

The framework was evaluated across four diverse domains:

  • WhoIsWho & MAG: Academic networks focused on author name disambiguation (detecting incorrectly assigned papers).
  • TwiBot-20: A large-scale social graph for Twitter bot detection.
  • SemEval-23F: A dataset for identifying propaganda tactics in news comment networks.

Key Insights and Ideas

  • Efficiency through Multi-turn: Stacking queries isn't just a performance hack; it actually improves detection accuracy. The causal masking in LLMs allows later queries to benefit from the context of earlier ones, effectively creating an automated few-shot learning environment.
  • Summarization vs. Raw Text: By using SLMs to "compress" long attributes into tokens, GuARD avoids the "lost in the middle" problem where LLMs ignore the center of a long text block.
  • Synergy of Modalities: The experiments show that graph features are most helpful when text is ambiguous (e.g., authors with similar names), while semantic features shine when the graph structure is sparse.
  • Training Order Matters: The authors found that training the modalities progressively is superior to joint training from scratch, which often causes the model to over-rely on a single feature source (usually the graph).

Key Results

GuARD consistently outperformed both pure GNN-based and fine-tuned LLM-based methods across all datasets.

  • Accuracy: On the WhoIsWho dataset, GuARD achieved an AUC of 0.789, significantly higher than the fine-tuned Llama3-8B baseline (0.741) and SOTA GNNs (0.741).
  • Efficiency: Compared to vanilla long-context LLMs, GuARD offered a 5x speedup in training and a 10x speedup in inference on the large-scale WhoIsWho dataset.
  • Leaderboard Performance: GuARD surpassed the top-3 winning solutions from the KDD Cup 2024 leaderboard, demonstrating its real-world competitiveness.
Figure 2: AUC vs. inference time of different models on the WhoIsWho dataset. GNN: Graph Neural Network, SLM: Small Language Model, LLM: Large Language Model.

Limitations and Future Work

While GuARD is highly efficient, it still requires pre-trained GNNs and SLMs to act as encoders, which introduces a dependency on external models and some initial feature engineering. The authors suggest that future research could explore more seamless, end-to-end integration of these modalities or apply the "graph-informed LLM" concept to other downstream tasks like node classification or link prediction in text-rich environments.

Summary updated

Abstract

Anomaly detection on text-rich graphs is widely prevalent in real life, such as detecting incorrectly assigned academic papers to authors and detecting bots in social networks. The remarkable capabilities of large language models (LLMs) pave a new revenue by utilizing rich-text information for effective anomaly detection. However, simply introducing rich texts into LLMs can obscure essential detection cues and introduce high fine-tuning costs. Moreover, LLMs often overlook the intrinsic structural bias of graphs which is vital for distinguishing normal from abnormal node patterns. To this end, this paper introduces GuARD, a text-rich and graph-informed language model that combines key structural features from graph-based methods with fine-grained semantic attributes extracted via small language models for effective anomaly detection on text-rich graphs. GuARD is optimized with the progressive multi-modal multi-turn instruction tuning framework in the task-guided instruction tuning regime tailed to incorporate both rich-text and structural modalities. Extensive experiments on four datasets reveal that GuARD outperforms graph-based and LLM-based anomaly detection methods, while offering up to 5$\times$ times speedup in training and 5$\times$ times speedup in inference over vanilla long-context LLMs on the large-scale WhoIsWho dataset.
BibTeX
@inproceedings{pang2024guard,
  author = {Yunhe Pang and Bo Chen and Fanjin Zhang and Yanghui Rao and Evgeny Kharlamov and Jie Tang},
  title = {{GuARD: Effective Anomaly Detection through a Text-Rich and Graph-Informed Language Model}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
}
Figure