Text-Attributed Graph Anomaly Detection via Multi-Scale Cross- and Uni-Modal Contrastive Learning

Yiming Xu, Xu Hua, Zhenming Peng, Bin Shi, Jiarun Chen, Xingbo Fu, Song Wang, Bo DongFrontiers in Artificial Intelligence and Applications 2025 · OpenAlexGitHub resource

Abstract

Graph Anomaly Detection (GAD) is essential for identifying malicious or irregular entities in networked data. However, existing methods for Text-Attributed Graphs (TAGs) often suffer from a disconnection between text encoding and the downstream detection task, failing to capture multi-scale structural and semantic inconsistencies. This paper introduces CMUCL (Cross-Modal and Uni-modal multi-scale Contrastive Learning), an end-to-end framework that jointly trains language models and graph neural networks. By leveraging multi-scale representations and cross-modal alignment, CMUCL achieves significant improvements in detection accuracy, including an 11.13% increase in average precision over state-of-the-art baselines.

Introduction

In real-world scenarios, graphs are frequently enriched with textual attributes—such as product descriptions in e-commerce networks or abstracts in citation graphs. Detecting anomalies in these Text-Attributed Graphs (TAGs) is critical for security and data integrity. Traditional approaches typically employ a two-stage pipeline: extracting fixed text embeddings using a pre-trained model and subsequently feeding these into a Graph Neural Network (GNN).

This decoupled approach has two major drawbacks. First, the "frozen" text encoder is task-agnostic, potentially overlooking subtle textual indicators of anomalies. Second, anomalies can manifest at different granularities—from individual nodes to broader neighborhoods—which standard single-scale methods often miss.

Methodology: The CMUCL Framework

CMUCL addresses these challenges by treating text and graph structure as complementary modalities within a unified learning objective.

Bi-Modal and Multi-Scale Learning

The framework utilizes a Transformer-based text encoder and a Graph Convolutional Network (GCN) to extract features from raw text and graph topology, respectively. Unlike previous methods, these encoders are trained jointly. To capture anomalies at various levels, CMUCL learns representations at both the node level (local features) and the context level (aggregated neighborhood features).

Contrastive Alignment

The core of CMUCL lies in its multi-scale contrastive learning strategy:

  • Cross-Modal Contrastive Learning: Aligns text representations with structural representations. A mismatch between a node's textual description and its structural context (e.g., a "high-end laptop" node connected exclusively to "pet supplies") serves as a strong anomaly signal.
  • Uni-Modal Contrastive Learning: Ensures internal consistency within each modality, such as semantic similarity between a node's text and its neighborhood's text.
The CMUCL framework architecture for training and inference.

Anomaly Score Estimation

During inference, the model employs "inconsistency mining." It calculates an anomaly score based on how much a node deviates from the learned cross-modal and multi-scale patterns. This approach effectively identifies both contextual and structural outliers.

Experimental Setup and Datasets

To evaluate CMUCL, the authors introduced 8 new TAGAD benchmarks:

  1. Citation Networks: Citeseer, Pubmed, ogbn-Arxiv, and CitationV8.
  2. E-commerce Networks: History, Children, Photo, and Computers.

These datasets vary in scale, with CitationV8 containing over 1.1 million nodes, testing the framework's scalability in large-scale environments.

Key Results

CMUCL demonstrated superior performance across all 8 datasets, outperforming 11 baseline models. On average, the framework achieved a 4.68% increase in AUC and an 11.13% increase in Average Precision (AP) compared to the next best method.

ROC curves comparing CMUCL against baseline methods across four citation datasets.

The results highlight several key insights:

  • Joint Training Advantage: Fine-tuning the text encoder specifically for the GAD task is significantly more effective than using off-the-shelf embeddings.
  • Scalability: CMUCL's contrastive approach is more memory-efficient than reconstruction-based models, allowing it to scale to million-node graphs without out-of-memory (OOM) errors.
  • Robustness: The model is adept at catching diverse anomaly types, including those defined by attribute perturbations and structural cliques.

Conclusion and Future Work

CMUCL represents a significant step forward in TAGAD by integrating multi-modal and multi-scale learning. While the computational cost of training deep Transformers alongside GNNs is higher than shallow methods, the gains in accuracy and scalability are substantial. Future research may explore the integration of Large Language Models (LLMs) and the detection of "natural" anomalies in uncurated real-world datasets.

Summary updated

Abstract

The widespread application of graph data in various high-risk scenarios has increased attention to graph anomaly detection (GAD). Faced with real-world graphs that often carry node descriptions in the form of raw text sequences, termed text-attributed graphs (TAGs), existing graph anomaly detection pipelines typically involve shallow embedding techniques to encode such textual information into features, and then rely on complex self-supervised tasks within the graph domain to detect anomalies. However, this text encoding process is separated from the anomaly detection training objective in the graph domain, making it difficult to ensure that the extracted textual features focus on GAD-relevant information, seriously constraining the detection capability. How to seamlessly integrate raw text and graph topology to unleash the vast potential of cross-modal data in TAGs for anomaly detection poses a challenging issue. This paper presents a novel end-to-end paradigm for text-attributed graph anomaly detection, named CMUCL. We simultaneously model data from both text and graph structures, and jointly train text and graph encoders by leveraging cross-modal and uni-modal multi-scale consistency to uncover potential anomaly-related information. Accordingly, we design an anomaly score estimator based on inconsistency mining to derive node-specific anomaly scores. Considering the lack of benchmark datasets tailored for anomaly detection on TAGs, we release 8 datasets to facilitate future research. Extensive evaluations show that CMUCL significantly advances in text-attributed graph anomaly detection, delivering an 11.13% increase in average accuracy (AP) over the suboptimal.
BibTeX
@inproceedings{xu2025text,
  author = {Yiming Xu and Xu Hua and Zhenming Peng and Bin Shi and Jiarun Chen and Xingbo Fu and Song Wang and Bo Dong},
  title = {{Text-Attributed Graph Anomaly Detection via Multi-Scale Cross- and Uni-Modal Contrastive Learning}},
  booktitle = {Frontiers in Artificial Intelligence and Applications},
  year = {2025},
  doi = {10.3233/faia251124},
}

Loading related content...

Figure