A Time-Aware Self-Supervised Framework for Anomaly Detection in Temporal Graphs

Real time systems and telematic services architecture Research Group
Information Processing and Telecommunications Center (IPTC), Universidad Politécnica de Madrid, Av. Complutense, 30, Moncloa - Aravaca, 28040 Madrid, Spain

Abstract

Anomaly detection in temporal graphs aims to identify fraudulent users, malicious transactions, and other irregular behavior as interaction networks evolve. Two practical realities constrain this task. Labeled anomalies are scarce and costly to obtain, and real-world graphs grow to scales where many detection methods become computationally infeasible. To address both constraints, we propose T-ADTG, a self-supervised framework that requires no anomaly labels and scales near- linearly with the number of interactions. T-ADTG treats time as a first-class signal throughout the detection pipeline rather than as an auxiliary feature. At the interaction level, Temporal Rotary Message Encoding embeds each timestamp directly into the propagated message through a magnitude- preserving rotation, while Similarity-Aware Message Aggregation weights neighbors by how similarly their behavior has evolved. At the node level, a gated memory module accumulates each node’s behavioral trajectory across interactions. A multi-level contrastive objective then enforces consistency between a node’s present, its past, and its neighborhood, and deviations from this consistency directly yield the anomaly score in a single forward pass. We evaluate T-ADTG on five benchmark datasets against fifteen baselines, obtaining the best mean AUROC on every dataset. Despite using no labels, it matches or exceeds supervised and semi-supervised methods, and remains effective on a 330K-node graph where several static and snapshot-based baselines exhaust memory. These results show that accurate, label-free anomaly detection at scale is achievable, precisely in the fraud and abuse settings where labels are hardest to obtain.

Framework Overview

Temporal Rotary Message Encoding (TRME)

llustration of Temporal Rotary Message Encoding (TRME). Each edge message is partitioned into two- dimensional subspaces, and every subspace is rotated by an angle proportional to the interaction timestamp, embedding continuous-time information directly into the message geome- try before neighborhood aggregation.

Results

Image 1
Image 2
Image 3

Illustration of the impact of anomalous nodes on GNN-based representation learning: (a) a normal node connected to normal neighbors, yielding a reliable representation; (b) a normal node influenced by an anomalous neighbor, leading to representation contamination; and (c) an anomalous node surrounded by normal neighbors, resulting in a camouflaged representation that obscures anomalous behavior and reduces discriminative capability.

Results

Mean ROC curves of T-ADTG on the five benchmark datasets, averaged over 10 runs. Each panel reports the mean AUROC and its standard deviation.

Acknowledgements

This work was carried out within the STRAST Research Group at the Information Processing and Telecommunications Center (IPTC), Universidad Politécnica de Madrid, as part of the CEDAR project, funded by the Horizon Europe Programme (Grant Agreement No. 101135577).

BibTeX

The paper has been submitted and is currently under review.