Introduction
Graph Neural Networks (GNNs) have become a cornerstone for analyzing networked data. However, their "black box" nature remains a significant hurdle for deployment in sensitive domains. While progress has been made in explaining static GNNs, most real-world graphs—such as social networks, financial transactions, and traffic flows—are dynamic, evolving in both structure and attributes over time.
Explaining dynamic GNNs presents a unique challenge, as it requires accounting for two distinct dimensions:
- Structural Importance: Identifying which specific nodes and edges drive a prediction at a given moment.
- Temporal Influence: Determining which past states of the graph inform the current output.
Existing explainers often fail to capture long-term dependencies or produce inconsistent explanations across time steps. To address these gaps, we present DyExplainer, the first general-purpose framework designed for real-time, "on-the-fly" explanations of dynamic GNNs.
Methodology
DyExplainer is an encoder-agnostic module that can be integrated into various dynamic GNN backbones. Its architecture centers on identifying the most influential structural and temporal components through a dual-attention mechanism.
Dual Sparse Attention
The core of DyExplainer consists of two attention layers:
- Structural Attention: Weights the importance of neighbors within the current graph snapshot.
- Temporal Attention: Aggregates information from a buffer of historical snapshots to determine their relative influence.
To ensure clarity, DyExplainer employs a Hard Attention Mechanism. Unlike traditional soft attention, which often assigns negligible but non-zero weights to all edges, this mechanism uses differentiable sampling to force unimportant weights to exactly zero. This results in sparse, "human-readable" explanations.
Contrastive Regularization
To maintain logical consistency, DyExplainer incorporates two primary constraints:
- Structural Consistency: Based on the principle of homophily, it encourages connected nodes to have similar explanation profiles.
- Temporal Continuity: It ensures that explanations for snapshots close in time remain smooth, preventing erratic shifts in identified importance.
Experimental Evaluation
The framework was evaluated on six diverse real-world datasets, including internet traffic (AS-733), subreddit hyperlinks (Reddit), student communications (UCI-Message), and cryptocurrency trust networks (Bitcoin).
Performance and Fidelity
DyExplainer consistently outperformed or matched seven state-of-the-art dynamic GNN baselines in link prediction tasks. Crucially, the model achieved high Fidelity—a measure of how much a prediction changes when "important" edges are removed—even at high levels of sparsity.
Explainability as a Performance Booster
A striking finding is that adding the DyExplainer module actually improves the backbone model's prediction accuracy. For instance, it yielded a 7.89% improvement in Mean Reciprocal Rank (MRR) on the Bitcoin-Alpha dataset. This suggests that forcing the model to focus on sparse, explainable patterns helps it filter out noise and generalize better, a concept rooted in "Rashomon set" theory.
Discussion and Future Work
Ablation studies revealed that while both structural and temporal information are necessary for peak performance, structural topology generally exerts a stronger influence on predictions. Furthermore, unlike post-hoc explainers that analyze single nodes, DyExplainer provides a global, model-level understanding of graph dynamics.
Despite its strengths, the framework faces challenges in scaling to massive graphs due to the computational cost of consistency regularization. While "anchor" sampling mitigates this, further optimization is required. Additionally, while this study focused on link prediction, future research will explore DyExplainer's utility in dynamic node classification and anomaly detection.
Summary updated