Abstract
Temporal Knowledge Graph (TKG) is an efficient method for describing the dynamic development of facts along a timeline. Most research on TKG reasoning (TKGR) focuses on modelling the repetition of global facts and designing patterns of local historical facts. However, they face two significant challenges: inadequate modeling of the event distribution shift between training and test samples, and reliance on random entity substitution for generating negative samples, which often results in low-quality sampling. To this end, we propose a novel distributional feature modeling approach for training TKGR models, Test-Time Training-guided Distribution shift Modelling (T3DM), to adjust the model based on distribution shift and ensure the global consistency of model reasoning. In addition, we design a negative-sampling strategy to generate higher-quality negative quadruples based on adversarial training. Extensive experiments show that T3DM provides better and more robust results than the state-of-the-art baselines in most cases.
Introduction
Temporal Knowledge Graphs (TKGs) represent facts as quadruples: (subject, predicate, object, time). Unlike static knowledge graphs, TKGs must account for how relationships evolve. However, existing reasoning models struggle with two primary issues. First, the Event Distribution Shift: the "tone" of the world changes over time. For example, a dataset might show a surge in "diplomatic appeals" during training but a shift toward "denying liability" during testing. Most models are static and cannot adapt to these shifting frequencies once training is over.
Second, models suffer from Low-Quality Negative Sampling. To train these models, researchers often generate "fake" facts by randomly swapping entities. This often results in "easy" negatives that don't challenge the model or, worse, "false negatives" (facts that are actually true but not in the training set), leading to the "zero-loss" problem where the model stops learning meaningful features.
The T3DM Framework
To address these challenges, we propose T3DM, a two-pronged framework that integrates adversarial training with test-time adaptation.
TKGAN: Adversarial Negative Sampling
Instead of random swapping, T3DM utilizes a Generative Adversarial Network (GAN). A Generator learns to select "hard" negative samples that are difficult for the Discriminator (the reasoning model) to distinguish from real facts. This process is guided by reinforcement learning (Policy Gradient) to ensure the generator produces high-quality, plausible-but-false quadruples. This adversarial approach forces the model to learn the subtle logical and structural nuances of the graph.
Test-Time Training (TTT)
TTT is the core mechanism for handling distribution shifts. During the inference (testing) phase, the model performs an auxiliary task: predicting the distribution of entities at the current time step using an LSTM. The reasoning model is then "fine-tuned" on the fly to align its predictions with this expected distribution. This allows the model to calibrate itself to the test set's specific characteristics without needing ground-truth labels for the actual reasoning task, effectively bridging the gap between training and test distributions.
Experimental Evaluation
We evaluated T3DM on five widely used TKG benchmarks, including ICEWS14, ICEWS18, GDELT, WIKI, and YAGO11K. T3DM showed significant improvements across almost all metrics (MRR, Hits@1, Hits@3, Hits@10):
- Performance Gains: On the ICEWS18 dataset, integrating T3DM into TTransE improved the Mean Reciprocal Rank (MRR) from 8.36 to 11.98.
- Robustness: Even on complex datasets like YAGO, the TTT component helped models maintain high accuracy despite significant shifts in how entities were distributed over time.
- Versatility: T3DM is a "plug-and-play" training strategy. We demonstrated its effectiveness by integrating it into various base architectures like TTransE, HyTE, and DE-SimplE, showing consistent gains regardless of the underlying mathematical formulation.
Conclusion
T3DM introduces a novel paradigm for TKGR by addressing the inherent dynamic nature of temporal data. By combining adversarial training to solve the zero-loss problem and Test-Time Training to handle distribution shifts, T3DM provides a robust and adaptable framework for future research in temporal reasoning. Future work will explore more sophisticated self-supervised tasks for the TTT phase, potentially integrating Large Language Models (LLMs) to better encode the semantic meaning of entities and relations.
Summary updated