NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

One-shot Learning for Temporal Knowledge Graphs

Mehrnoosh Mirtaheri, Mohammad Rostami, Xiang Ren, Fred Morstatter, Aram Galstyan

TL;DR

Real-world temporal knowledge graphs frequently suffer from long-tail sparsity, where newly emerging relations only have a single training example. This paper introduces OAT (One-shot Attention Temporal Graph Learning), a framework combining few-shot episodic meta-learning with multi-head self-attention over an entity’s recent historical snapshots. By conditioning future event predictions on temporally-aware neighborhood representations, OAT significantly outperforms traditional static few-shot methods and standard temporal graph completion models on sparse relations.

What Problem Does This Paper Address?

Temporal Knowledge Graphs (TKGs) store dynamic real-world facts as quadruples: (subject, relation, object, timestamp). While link prediction algorithms have advanced for TKGs, they struggle with data scarcity caused by long-tailed relational distributions—many relations appear only a handful of times or emerge as entirely new relation types over time.

Existing few-shot learning (FSL) frameworks tackle data scarcity for static graphs, but they flatten temporal graphs into static snapshots and discard crucial temporal order and burstiness. Meanwhile, standard TKG completion models assume relations have abundant training instances and struggle to extrapolate to unseen relations or timestamps with only a single reference example.

Methods

The authors propose OAT (One-shot Attention Temporal Graph Learning), which predicts the missing object entity in a query (s_q, r, ?, t_q) given only a single reference instance S_r = {(s_0, o_0, t_0)}:

  • Temporal Neighborhood Encoder:
  • Snapshot Aggregation: For each timestamp $\tau$ in the previous $\ell$ historical timesteps, a local aggregator summarizes an entity's 1-hop interactions.
  • Sequential Aggregation: Instead of mean pooling or recurrent units, OAT applies multi-head self-attention over the sequence of snapshot representations, allowing it to dynamically weight which past time steps matter most. A linear projection yields a single time-aware entity embedding $h_e$.
  • Similarity Network: Feeds concatenated representations of the entity pairs (support pair and query pair) through a 2-layer feedforward network with residual connections, computing a dot-product similarity score between the transformed support and query vectors.
  • Time-Dependent Episodic Training: Adapts meta-learning episodic training to the temporal domain. Rather than sampling queries randomly over the full timeline, the query set is restricted to a time window $I_\tau = (\tau, \tau + w]$ directly following the reference event at $\tau$, reflecting real-world temporal extrapolation tasks.
  • Optimization: Trained with a margin-based ranking hinge loss contrasting true queries against corrupted negative samples.

Datasets

The authors constructed two new benchmark splits specifically designed for temporal one-shot relational learning (ensuring non-overlapping time splits between train, validation, and test to test true temporal extrapolation):

  • ICEWS (Integrated Crisis Early Warning System): Evaluated on two temporal subsets:
  • ICEWS14 (2014–2016): 3,735 entities, 196 relations (66 meta-train / 5 meta-val / 15 meta-test tasks).
  • ICEWS17 (2017–2019): 2,419 entities, 153 relations (66 meta-train / 5 meta-val / 14 meta-test tasks).
  • GDELT (Global Database of Events, Language, and Tone): One month of data (Jan 2018) with 1,549 entities and 204 relations (50 meta-train / 5 meta-val / 14 meta-test tasks).

Relations with occurrences between 50 and 500 (or 700 for GDELT) serve as sparse/few-shot tasks, while relations with higher frequencies form a background graph $G'$.

Key Insights and Ideas

  • Self-attention beats standard metric networks in sparse regimes: Ablation studies revealed that adding complex metric networks (like Matching Networks) overparameterizes the model when data is scarce. A multi-head self-attention neighborhood encoder paired with a simple dot-product similarity preserves capacity and yields superior generalization.
  • Static FSL fails due to temporal blindness: Static few-shot models (GMatch, FSRL, MetaR) collapse time entirely. When predicting dynamic events, neglecting the sequence of past entity interactions drastically hurts predictive ranking.
  • Regular TKG models overfit frequent relations: Baseline temporal models like ReNet or TATransE show bias toward frequent relation pairs seen in training, collapsing in performance when evaluated strictly on one-shot, long-tail relations.

Key Results

OAT was evaluated against both regular TKG models (TTransE, TATransE, ATiSE, ReNet) and static few-shot baselines (GMatch, FSRL, MetaR):

  • GDELT: OAT-T (time-dependent) achieved 0.234 Hit@1 and 0.578 Hit@10 (MRR: 0.345), substantially outperforming the strongest baseline, TATransE (Hit@1: 0.062, Hit@10: 0.362, MRR: 0.151).
  • ICEWS17: OAT-T attained 0.743 Hit@10 and 0.170 Hit@1, compared to ReNet’s 0.407 Hit@10 and 0.126 Hit@1.
  • ICEWS14: OAT-R (random sampling) led in precision with 0.164 Hit@1 and 0.268 MRR (compared to the next best, MetaR, at 0.067 Hit@1 and 0.178 MRR).
  • Per-relation Breakdown: In relation-level testing on ICEWS17, OAT outperformed ReNet on 11 out of 14 unseen relations.

Limitations and Future Work

  • Emergent Entities: The current formulation assumes a closed entity set $E$. It cannot easily handle newly emergent entities that lack historical background interactions.
  • Higher-level Hierarchical Conflicts: Qualitative analyses revealed OAT struggled on specific subcategories of fine-grained events (e.g., CAMEO code sub-branches where baseline models leveraged background co-occurrences).
  • Extension to $k$-shot: The current architecture is specifically evaluated in a strict 1-shot setting; scaling and adapting the aggregation mechanism to general $k$-shot scenarios ($k > 1$) remains open for future exploration.

Summary updated

BibTeX
@inproceedings{mirtaheri2021one,
  author = {Mehrnoosh Mirtaheri and Mohammad Rostami and Xiang Ren and Fred Morstatter and Aram Galstyan},
  title = {{One-shot Learning for Temporal Knowledge Graphs}},
  booktitle = {AKBC},
  year = {2021},
  url = {https://openreview.net/forum?id=GF8wO8MFQOr},
}
Figure