Published in the journal Data Science and Engineering, the study presents CTM-Explainer, a post-hoc counterfactual explanation model that identifies specific temporal events driving these networks’ predictions. The work addresses a critical gap in machine learning interpretability, where existing methods often confuse temporal proximity with causal influence, leading to ambiguous and cluttered explanations for high-stakes applications.
The primary motivation for this research stems from the increasing deployment of TGNNs in dynamic scenarios such as social network evolution and urban computation. While these models capture complex spatio-temporal patterns effectively, their decision-making processes remain opaque. This opacity limits their adoption in high-stakes domains like clinical diagnostics and pharmaceutical risk assessment, where understanding the rationale behind a prediction is ethically imperative. The inherent complexity of temporal interactions, characterized by nonlinear event dependencies and shifting graph topologies, poses unique challenges to explainability that standard static graph methods cannot address.
Existing explanation frameworks for graph neural networks predominantly rely on correlation-driven techniques, such as the Graph Information Bottleneck or heuristic temporal motif extraction. These methods align explanations with input graph structures by highlighting temporally contiguous subgraphs. However, by privileging temporal adjacency over causal necessity, they indiscriminately include both truly causal interactions and spurious temporal neighbors. For instance, when explaining a prediction that a user will join a high-risk organization, factual explanations might highlight generic shares or off-topic replies that merely co-occur in time, alongside the specific inquiry that actually influences the prediction. This results in explanations cluttered with redundant and imprecise events that do not clarify the model’s decision-making process.
To overcome these limitations, the authors propose CTM-Explainer, which identifies critical temporal dependencies through iterative “what-if” perturbation analysis. To the best of the authors’ knowledge, this is the first post-hoc counterfactual explanation framework specifically designed for TGNNs. The model enables precise attribution of how specific timestamped events influence predictions by embedding causal analysis into a reinforcement learning framework. It constructs Counterfactual Temporal Motifs, or CTMs, that are causally grounded in model outcome shifts via interventional probability estimation. This design eliminates temporally correlated but non-essential events while preserving those with verified causal influence.
The core innovation of CTM-Explainer lies in its systematic integration of Individual Causal Effect, or ICE, into the generation of counterfactual explanations. Unlike Granger causality, which infers relationships from lagged correlations and often produces overly broad explanations, or backdoor-adjustment methods that rely on identifying confounders in dynamic networks, ICE directly quantifies the causal impact of individual events. The framework uses causal interventions via the do-operator to explicitly cut off indirect causal paths and potential confounding interactions. Before performing these interventions, the system pre-constructs a candidate event set based on strict temporal and topological constraints, localizing the explanatory scope to a bounded spatio-temporal subgraph containing only events within two hops and two timestamps of the target event.
The methodology formalizes the counterfactual explanation process as a Markov Decision Process. The state space begins as an empty set and evolves to encapsulate the growing CTM, representing the aggregation of selected explanatory events. The action space comprises candidate counterfactual modifications that could be applied to the temporal graph, selected based on topological and temporal proximity to the target event. The reward function is a direct reflection of the ICE of the modification, serving as a catalyst for the selection of events with the most substantial explanatory power. A policy network, utilizing a Gated Recurrent Unit or Multilayer Perceptron, dictates the selection probabilities of actions given the current state, refining its strategy through a policy gradient-based training regimen to maximize expected reward.
The study evaluated CTM-Explainer using four real-world temporal graph datasets: Wikipedia, which details user collaborations through edit histories; Reddit, capturing user interactions within subreddits; and Enron, which records email communications. Additionally, two synthetic datasets, Synthetic v1 and Synthetic v2, were applied to test the model’s generalizability. The experiments compared CTM-Explainer against state-of-the-art baselines, including GNN-Explainer, PG-Explainer, and T-GNNExplainer, utilizing Temporal Graph Network and Temporal Graph Attention Network as backbone models. The evaluation focused on the impact of removing identified motifs on the predictions, measuring performance through Counterfactual Fidelity, sparsity, and the Area Under the Counterfactual Fidelity-Sparsity Curve.
The results demonstrate that CTM-Explainer achieves the best overall performance across both backbone models. On the TGN-Reddit dataset, CTM-Explainer reduced the Best Counterfactual Fidelity to −5.0931, compared with −3.2243 for PG-Explainer and −3.4706 for T-GNNExplainer. On TGN-Enron, it reached −2.6934, clearly lower than −2.0008 from T-GNNExplainer. Under the TGAT backbone, the improvements were even more evident, with Best CFF reaching −5.7106 on Wikipedia and −8.4668 on Synthetic v2. The AUFCFSC values confirmed this advantage, showing that fidelity remains stable even when explanations are constrained to be sparse. These results highlight that CTM-Explainer secures leading performance not only on average but also across diverse datasets with distinct temporal characteristics.
Computational efficiency is another significant advantage of the proposed framework. The authors compared CTM-Explainer with T-GNNExplainer, a baseline specifically designed for TGNNs, and found that CTM-Explainer achieves one to two orders of magnitude lower computation time across all datasets. For example, on TGN-Reddit, T-GNNExplainer required over 31,000 seconds, whereas CTM-Explainer completed 800 test samples in under 500 seconds. This efficiency arises because T-GNNExplainer relies on Monte Carlo Tree Search, which repeatedly expands candidate subsets at high cost, while CTM-Explainer adopts a reinforcement learning strategy that incrementally selects events without exhaustive exploration. This streamlined design addresses computational bottlenecks in interpreting predictions on large-scale temporal graph datasets.
An ablation study validated the necessity of each design choice in CTM-Explainer. The researchers constructed three variants: CTM-Random, which used randomly initialized parameters; CTM-GIB, which replaced the ICE-based causal objective with the Graph Information Bottleneck; and CTM-w/o T, which removed temporal embeddings from event representations. CTM-Random yielded the weakest performance, demonstrating that explanation quality requires a trained optimization policy. CTM-GIB showed mixed results, indicating that correlation-based compression may capture partial relevance but fails to balance sparsity and fidelity stably. CTM-w/o T achieved results sometimes close to the full model, reflecting the effect of the candidate construction strategy, which already confines events within strict spatio-temporal constraints. This localization preserves local temporal order, making explicit temporal embeddings less critical in this restricted setting.
The study also included a case study focusing on a pivotal event in the Reddit dataset, comparing the explanatory outputs of PG-Explainer, T-GNNExplainer, and CTM-Explainer under different sparsity constraints. The visualizations revealed that when explaining predictions for the same sample, the events deemed important by the models vary under a sparsity constraint of 0.2. However, as the constraint increases, there is a notable convergence in the set of explanations. This suggests that the variability in explanatory models is particularly evident when generating more concise sets of explanations. The comparison indicates that the explanatory outcomes vary across models even with identical input data, underscoring the models’ ability to capture intrinsic characteristics of the TGNN’s decision-making process.
The authors acknowledge limitations in the current implementation, noting that while CTM-Explainer supports synthetic event addition, all quantitative comparisons used event removal to align with baseline methods. Furthermore, on synthetic datasets, the performance advantage of CTM-Explainer narrows as sparsity increases, and in some settings, T-GNNExplainer performs competitively. This suggests that heuristic exploration can still provide benefits when temporal structures are simplified or artificially constrained. Nevertheless, the consistent dominance of CTM-Explainer on real-world datasets confirms that causality-guided counterfactual reasoning offers a more reliable and generalizable solution for complex temporal graphs.
In conclusion, the introduction of CTM-Explainer represents a significant step forward in the explainability of Temporal Graph Neural Networks. By generating Counterfactual Temporal Motifs through a sequential process guided by Individual Causal Effect analysis and reinforcement learning, the framework identifies the influence of temporal events that can lead to different outcomes. This provides clear and actionable insights into the TGNN’s decision-making process, offering a more targeted and efficient explanatory model. The extensive experiments on both real-world and synthetic datasets demonstrate the framework’s ability to generate faithful and concise explanations at significantly lower computational cost, paving the way for its application in high-stakes environments where interpretability is essential.
Subject of Research: Generating Counterfactual Temporal Motifs: Unraveling the Mysteries of Temporal Graph Neural Networks
Article Title: Generating Counterfactual Temporal Motifs: Unraveling the Mysteries of Temporal Graph Neural Networks
Article References: Zhao, Y., Xu, Y., Liu, N., Cui, L., & Li, Q. (2026). Generating Counterfactual Temporal Motifs: Unraveling the Mysteries of Temporal Graph Neural Networks. Data Science and Engineering, 11(1), 199-212. https://doi.org/10.1007/s41019-025-00321-x
Image Credits: AI Generated
DOI: 10.1007/s41019-025-00321-x
Keywords: Generating, Counterfactual, Temporal, Motifs, Unraveling, Mysteries, Graph, Neural, Networks, scientific research
News Source: Cassandra Pierce. (November 10, 2026). New Framework Clarifies Temporal Graph Neural Network Predictions. Scienmag.



