Abstract
Dynamic graphs represent connections in complex systems changing over time, posing unique challenges for anomaly detection. Traditional static graph models and shallow dynamic graph methods often fail to capture the temporal dynamics and interactions effectively, limiting their ability to detect anomalies accurately. In this work, we introduce the Attribute Encoding Transformer (AET), a novel framework specifically designed for anomaly detection in unattributed dynamic graphs. The AET integrates advanced encoding strategies that leverage both spatial and historical interaction data, enhancing the model’s ability to identify anomalous patterns. Our approach includes a Link Prediction Pre-training methodology that optimizes the transformer architecture for dynamic contexts by pre-training on link prediction tasks, followed by fine-tuning for anomaly detection. Comprehensive experiments on four real-world datasets demonstrate that our framework outperforms the state-of-the-art methods in detecting anomalies, thereby addressing key challenges in dynamic graph analysis. This study not only advances the field of graph anomaly detection but also sets a new benchmark for future research on dynamic graph data ana
Introduction
Anomaly detection in dynamic graphs is critical for identifying irregular behaviors in evolving systems like social networks or financial platforms. However, most existing methods rely heavily on node or edge attributes (e.g., user profiles or transaction amounts). In many real-world scenarios, these attributes are unavailable due to privacy or collection constraints, leaving only the structural evolution of the graph—unattributed dynamic graphs.
Detecting anomalies in such graphs presents three primary challenges: the lack of initial features for nodes and edges, the difficulty in capturing fine-grained temporal nuances (like interaction frequency), and the optimization of Transformer architectures which typically require large-scale data to learn effectively on graphs.
The Attribute Encoding Transformer (AET) Framework
To address these challenges, we propose the Attribute Encoding Transformer (AET). The core idea is to synthesize "attributes" from the graph's inherent structure and temporal dynamics. The mathematical framework of AET relies on several key notations for graph snapshots, node sets, and encoding matrices as defined below.
Architecture Overview
The AET framework consists of three main components: substructure sampling, a spatial-historical encoder, and a Transformer-based prediction module.
- Substructure Sampling via Diffusion: To provide context for an edge, the model uses Personalized PageRank (PPR) to identify influential neighboring nodes. This "neighborhood shape" serves as a surrogate for missing attributes.
- Spatial-Historical Encoder: This module fuses four distinct signals:
- Global Spatial: Rankings derived from graph diffusion.
- Local Spatial: Shortest-path distances between nodes.
- Relative Temporal: Sequences of timestamps within a sliding window (denoted as $\lambda$).
- Appearance Frequency: A count of edge repetitions, which is vital for identifying "bursty" anomalies.
- Link Prediction Pre-training: To overcome the data scarcity of anomalies, the Transformer is first pre-trained on a link prediction task. This allows the model to learn the structural "grammar" of dynamic graphs before being fine-tuned for anomaly detection.
Experimental Evaluation
We evaluated AET on four real-world dynamic graph datasets: UCI Messages (online community), Email-DNC (political email network), Digg (social news responses), and Bitcoin-Alpha (trust-based trading).
Results and Discussion
AET consistently outperformed seven state-of-the-art baselines, including NetWalk, AddGraph, and TADDY, across all datasets using the AUC (Area Under Curve) metric.
- Superior Performance: On the UCI dataset, AET achieved a 6% improvement in AUC when the anomaly proportion was low (1%).
- Robustness and Efficiency: AET maintained stable performance across varying anomaly ratios. Notably, it achieved higher AUC scores with only 20-30% of training data compared to competitors using 100%, demonstrating the effectiveness of the pre-training strategy.
- Structural Insights: Our results confirm that in unattributed graphs, the "role" a node plays in its neighborhood and the frequency of its interactions are powerful indicators of normal vs. anomalous behavior. Unlike traditional methods that discard duplicate edges, AET leverages interaction frequency as a critical feature.
Conclusion
The Attribute Encoding Transformer (AET) provides a robust solution for anomaly detection in unattributed dynamic graphs by leveraging structural and historical data. While the model shows significant promise, future work will address the computational overhead of graph diffusion on massive scales and explore more flexible time-windowing strategies to capture long-term anomalous trends.
Summary updated