Table of Contents
Fetching ...

Cross-Domain Graph Anomaly Detection via Test-Time Training with Homophily-Guided Self-Supervision

Delaram Pirhayati, Arlei Silva

TL;DR

This work tackles cross-domain graph anomaly detection when labeled anomalies are scarce and feature spaces differ across domains. It introduces GADT3, a test-time training framework that adapts to the target domain by learning a target-specific encoder with a frozen source decoder, guided by a homophily-based self-supervised loss and reinforced by Normal Structure-preserved Attention Weighting (NSAW) and domain-specific encoders. A class-aware regularization term addresses extreme label imbalance, and an adaptive early-stopping criterion ensures stable adaptation without target labels. Theoretical guarantees show monotonic improvement in anomaly separation during test-time training, and empirical results across six datasets and large-scale graphs demonstrate substantial improvements over state-of-the-art baselines, highlighting the approach’s privacy-preserving, scalable applicability to cybersecurity and other cross-domain anomaly tasks.

Abstract

Graph Anomaly Detection (GAD) has demonstrated great effectiveness in identifying unusual patterns within graph-structured data. However, while labeled anomalies are often scarce in emerging applications, existing supervised GAD approaches are either ineffective or not applicable when moved across graph domains due to distribution shifts and heterogeneous feature spaces. To address these challenges, we present GADT3, a novel test-time training framework for cross-domain GAD. GADT3 combines supervised and self-supervised learning during training while adapting to a new domain during test time using only self-supervised learning by leveraging a homophily-based affinity score that captures domain-invariant properties of anomalies. Our framework introduces four key innovations to cross-domain GAD: an effective self-supervision scheme, an attention-based mechanism that dynamically learns edge importance weights during message passing, domain-specific encoders for handling heterogeneous features, and class-aware regularization to address imbalance. Experiments across multiple cross-domain settings demonstrate that GADT3 significantly outperforms existing approaches, achieving average improvements of over 8.2\% in AUROC and AUPRC compared to the best competing model.

Cross-Domain Graph Anomaly Detection via Test-Time Training with Homophily-Guided Self-Supervision

TL;DR

This work tackles cross-domain graph anomaly detection when labeled anomalies are scarce and feature spaces differ across domains. It introduces GADT3, a test-time training framework that adapts to the target domain by learning a target-specific encoder with a frozen source decoder, guided by a homophily-based self-supervised loss and reinforced by Normal Structure-preserved Attention Weighting (NSAW) and domain-specific encoders. A class-aware regularization term addresses extreme label imbalance, and an adaptive early-stopping criterion ensures stable adaptation without target labels. Theoretical guarantees show monotonic improvement in anomaly separation during test-time training, and empirical results across six datasets and large-scale graphs demonstrate substantial improvements over state-of-the-art baselines, highlighting the approach’s privacy-preserving, scalable applicability to cybersecurity and other cross-domain anomaly tasks.

Abstract

Graph Anomaly Detection (GAD) has demonstrated great effectiveness in identifying unusual patterns within graph-structured data. However, while labeled anomalies are often scarce in emerging applications, existing supervised GAD approaches are either ineffective or not applicable when moved across graph domains due to distribution shifts and heterogeneous feature spaces. To address these challenges, we present GADT3, a novel test-time training framework for cross-domain GAD. GADT3 combines supervised and self-supervised learning during training while adapting to a new domain during test time using only self-supervised learning by leveraging a homophily-based affinity score that captures domain-invariant properties of anomalies. Our framework introduces four key innovations to cross-domain GAD: an effective self-supervision scheme, an attention-based mechanism that dynamically learns edge importance weights during message passing, domain-specific encoders for handling heterogeneous features, and class-aware regularization to address imbalance. Experiments across multiple cross-domain settings demonstrate that GADT3 significantly outperforms existing approaches, achieving average improvements of over 8.2\% in AUROC and AUPRC compared to the best competing model.

Paper Structure

This paper contains 32 sections, 1 theorem, 26 equations, 13 figures, 10 tables.

Key Result

Proposition 1

Under the above assumptions, for all $k \ge 0$, starting from an initial parameter $\theta_t^{(0)}$ sufficiently close to the optimal $\theta_t^*$, the TTT update satisfies:

Figures (13)

  • Figure 1: Homophily score distributions across domains (Amazon to Reddit): normal nodes (blue) show higher scores than anomalous nodes (orange), suggesting homophily as a domain-invariant anomaly signal.
  • Figure 2: Overview of GADT3, our test-time training framework for node-level cross-domain anomaly detection. In the training phase (top), GADT3 learns an encoder $\theta_{s}$, a decoder $\theta_m$, and a prediction $\theta_{pred}$ by jointly minimizing supervised ($\mathcal{L}_{\text{sup}}$) and self-supervised homophily-based loss ($\mathcal{L}_{\text{self}}$). We propose using Normal Structure-preserved Attention Weights to defend against the adversarial influence of anomalous nodes during message passing in the GNN training. In the test-time training (TTT) phase (bottom), GADT3 learns a target encoder $\theta_{t}$ using only the self-supervised loss $\mathcal{L}_{\text{self}}$. The decoder $\theta_m$ is shared across phases to enable the cross-domain knowledge transfer while handling heterogeneous feature spaces. During inference, the adapted target representations produced by $\theta_m$ are used for anomaly scoring.
  • Figure 3: Symmetric attention: node $a$ gives high attention to node $v$ ($\alpha_1$), while $v$ gives lower attention to $a$ ($\alpha_2$). The final symmetric weight is $\min(\alpha_1, \alpha_2) = \alpha_2$.
  • Figure 4: T-SNE embeddings of node representations for source domain (Amazon) on the left and target domain (Facebook) on the right. The source model clearly separates normal/anomalous nodes. After adaptation, the pre-trained model maintains this separation in the target domain, indicating successful transfer.
  • Figure 5: Relationship between target anomaly detection accuracy (AUPRC) and our ratio-based adaptation score for Reddit$\to$Amazon and Amazon$\to$Facebook. We use the adaptation score as a label-free early stopping criterion, which is triggered at epochs 37 (left) and 24 (right).
  • ...and 8 more figures

Theorems & Definitions (1)

  • Proposition 1: Monotonic Margin Increase