Online Test-Time Adaptation for Generalizable Dynamic Graph Anomaly Detection

Jialun Zheng, Hanchen Yang, Jiannong Cao, Yankai Chen, Yuanjing Feng, Philip S. YuarXiv 2026

TL;DR

Detecting anomalies in evolving networks (like fraud in transaction streams) is notoriously difficult when deploying models to a brand-new domain with unlabeled, streaming data. This paper introduces OTTA-DGAD, a novel framework that adapts a pretrained model on-the-fly to streaming target data by balancing domain-agnostic and domain-specific knowledge while preserving crucial historical context across data chunks.

What Problem Does This Paper Address?

Dynamic Graph Anomaly Detection (DGAD) identifies unusual activities—such as fraudulent transactions, network intrusions, or malicious users—in graphs that change over time. While deep learning models can be trained for specific domains, they generalize poorly to new ones due to domain shift. What looks anomalous in a financial network (a sudden spike in transactions among a small group) might be perfectly normal in a traffic network (a surge in traffic due to a new shopping mall opening).

Retraining models for every new domain is computationally expensive and slow. Furthermore, in real-world scenarios, target data arrives sequentially in unlabeled chunks (streaming). Existing test-time adaptation methods either overfit to short-term local patterns within a single chunk or completely miss newly emerging, domain-specific anomalies because they focus solely on domain-agnostic features.

Fig. 1. Motivating experiments. (a) Anomalous patterns change over time, chunks and cross datasets. (b) Existing generalist methods capture only domain agnostic patterns, without cross chunk information preservation. (c) Our method, OTTA-DGAD, captures both domain-agnostic and domain-specific patterns. Cross chunk information is also preserved.

Methods

The authors propose OTTA-DGAD (Online Test-Time Adapted Generalizable Dynamic Graph Anomaly Detector), which operates under a strict "test-then-adapt" protocol. It consists of four main pillars:

  1. Dynamic Prototype Extraction: Uses a Graph Neural Network (GNN) and a Transformer over temporal ego-graphs to extract evolving representations of normal and abnormal behaviors, storing them as "prototypes" in a memory buffer.
  2. Cross-Domain Anomaly Scoring: Instead of a simple binary classifier, it uses distribution-based scoring (tracking the mean and covariance of prototypes) to measure how much an incoming edge deviates from normal vs. abnormal distributions.
  3. Entropy-Structural Guided Pseudo-Labeling: To update the model without ground-truth labels, it selects highly reliable pseudo-labels. It combines prediction entropy (model confidence) with structural support (whether a node's predicted label aligns with its neighbors) to avoid updating the model with confidently incorrect predictions.
  4. Cross-Chunk Context Enrichment: A dedicated context buffer retains representative historical representations from previous chunks. This prevents information loss caused by the fragmented nature of streaming data chunks.
The overall framework of OTTA-DGAD, detailing prototype extraction, cross-domain scoring, context enrichment, and pseudo-label updates.

Datasets

The model was evaluated across 10 real-world datasets spanning diverse domains, including online collaboration, transaction networks, autonomous systems, and citation networks:

Summary statistics of the 10 real-world datasets used for evaluation.

The datasets include: Wikipedia, Bitcoin-OTC, Bitcoin-Alpha, Email-DNC, UCI Messages, AS-Topology, MOOC, Synthetic-Hijack, TAX51, and DBLP. Anomalies were injected following standard protocols to simulate dynamic structural irregularities.

Key Insights and Ideas

  • The Dual-Pattern Necessity: Generalist models typically discard domain-specific features to achieve invariance. OTTA-DGAD proves that keeping a mixture of domain-agnostic and domain-specific prototypes is essential for robust test-time adaptation.
  • Structure as a Truth Serum: Relying purely on prediction entropy for pseudo-labeling fails under domain shift because models can be "confidently wrong." Introducing structural support—checking if neighbors agree—acts as a powerful regularizer.
  • Context Matters in Streams: Chunk-wise processing inherently breaks long-term temporal dependencies. Explicitly caching and retrieving historical context via a coverage/difference score prevents the model from developing "amnesia" regarding older structural patterns.

Key Results

The authors compared OTTA-DGAD against 11 baselines across three categories (standard DGADs, generalists, and specialized OTTA methods) under a strict chunk-by-chunk online adaptation protocol.

  • Superior Performance: OTTA-DGAD consistently achieved state-of-the-art results in both AUROC and AUPRC across all ten datasets. For example, on the Synthetic-Hijack dataset (at a 1% anomaly ratio), it achieved an AUROC of 81.33%, outperforming the next best OTTA baseline (LCoTTA) at 72.36%.
  • Stability: It demonstrated significantly lower performance variance across chunks, proving highly resilient against continuous domain shifts where other models suffered severe performance degradation or catastrophic forgetting.

Limitations and Future Work

  • Hyperparameter Sensitivity: Performance relies heavily on optimal tuning of the chunk size (found to be optimal at 128 edges) and the pseudo-label selection threshold (top 10%). Deviating from these can introduce noise or cause overfitting.
  • Computational Overhead: Maintaining and updating dual buffers (prototype memory and context buffer) on-the-fly adds computational and memory overhead, which could be challenging for resource-constrained edge devices.
  • Future Directions: The authors suggest exploring ways to handle completely open-set anomaly types that were never seen in any form during pretraining, as well as optimizing the buffer mechanisms for extreme-scale streaming graphs.

Summary updated

BibTeX
@misc{zheng2026online,
  author = {Jialun Zheng and Hanchen Yang and Jiannong Cao and Yankai Chen and Yuanjing Feng and Philip S. Yu},
  title = {{Online Test-Time Adaptation for Generalizable Dynamic Graph Anomaly Detection}},
  year = {2026},
  eprint = {2608.19858},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.19858},
}
Figure