Learning to Sample and Aggregate: Few-shot Reasoning over Temporal Knowledge Graphs
Abstract
In this paper, we investigate a realistic but underexplored problem, called few-shot temporal knowledge graph reasoning, that aims to predict future facts for newly emerging entities based on extremely limited observations in evolving graphs.
It offers practical value in applications that need to derive instant new knowledge about new entities in temporal knowledge graphs (TKGs) with minimal supervision.
The challenges mainly come from the few-shot and time shift properties of new entities.
First, the limited observations associated with them are insufﬁcient for training a model from scratch.
Second, the potentially dynamic distributions from the initially observable facts to the future facts ask for explicitly modeling the evolving characteristics of new entities.
We correspondingly propose a novel
Meta Temporal Knowledge Graph Reasoning ( MetaTKGR ) framework.
Unlike prior work that relies on rigid neighborhood aggregation schemes to enhance low-data entity representation, MetaTKGR dynamically adjusts the strategies of sampling and aggregating neighbors from recent facts for new entities, through temporally supervised signals on future facts as instant feedback.
Besides, such a meta temporal reasoning procedure goes beyond existing meta-learning paradigms on static knowledge graphs that fail to handle temporal adaptation with large entity variance.
We further provide a theoretical analysis and propose a temporal adaptation regularizer to stabilize the meta temporal reasoning over time.
Empirically, extensive experiments on three real-world TKGs demonstrate the superiority of MetaTKGR over state-of-the-art baselines by a large margin.
Introduction
Temporal Knowledge Graphs (TKGs) [26, 3, 20, 46] store temporally evolving facts (By fact, we refer to a subject entity has a relation with an object entity at some time, e.g., “ Macron ” was “ elected ” as “ French president ” in “ 2017 ”).
It has been increasingly used in various knowledge-driven and time-sensitive applications, such as social event forecasting [29, 22, 44], question answering [31], and recommendation [60, 59, 45].
Large scale TKGs are hard to obtain due to the time-varying nature of labels and the excessive cost of human annotation.
As such, automating prediction and reasoning about missing facts over time has attracted more recent interest [38, 9, 12, 39, 18].
However, most prior efforts are limited to reasoning about existing entities but neglecting the commonly observed low-data regime where many new entities emerge with extremely few observations as new events or topics evolve over time [35].
This restricts their applicability.
Instead, inspired by the human ability to recognize new concepts from exposure to only very few instances, we propose and solve a practical and challenging few-shot temporal knowledge graph 36th Conference on Neural Information Processing Systems (NeurIPS 2022).
reasoning problem that speciﬁcally aims to predict future facts for newly emerging entities with a few observed links on TKGs.
Existing efforts [14, 43, 1, 7] in similar settings simplify the task by ignoring the emergence of new entities over time and randomly simulating unseen entities on static knowledge graphs.
This formulation, originating from few-shot learning in the vision domain [10, 30], fails at capturing the real-world divergence between the distributions of seen and unseen entities.
To the best of our knowledge, the generalized few-shot temporal reasoning task, that aims to imitate the fast learning ability of humans, has still not been formally investigated.
The challenges in solving this problem are two-fold: 1) few-shot : the extremely few facts associated with new entities cannot provide sufﬁcient information for representation learning from scratch.
2) time shift : new entities usually exhibit different characteristics in the future, due to the time-evolving nature of TKGs.
It leads models to generalize poorly in the future.
Unfortunately, prior work fails to overcome these two challenges simultaneously.
On one hand, to enhance low-data entity characterization, a diverse range of neighborhood aggregation schemes that retrieve related information from other entities are explored, such as hard subgraph sampling methods (e.g., vanilla hop-based sampling [32], random sampling [15], personalized Pagerank sampling [57, 45], importance sampling [5], etc) and soft sampling via trainable attention mechanisms [38, 39, 18].
However, those rigid methods cannot well adapt to the new entities with the time-varying distributions due to the lack of instant supervision.
On the other hand, recent attempts [1, 58, 17, 4] leverage meta-learning to improve unseen entity adaptation.
While the setup for unseen entities is simulated by randomly splitting entity sets from static graphs, they fail to handle the more realistic temporal adaptation with large entity variances.
To overcome both the aforementioned challenges, we propose a novel Meta Temporal Knowledge
Graph Reasoning ( MetaTKGR ) framework, where learning the strategies for sampling and aggregating neighbors from recent facts (to enhance the new entities’ predictions) can be dynamically adapted from signals of temporal supervision on their future facts as instant feedback.
Intuitively, the global knowledge of sampling and aggregating can be extracted as learning to learn ability through such a meta-optimization, which takes the time-evolving nature of knowledge into consideration, avoiding progressive performance drift over time.
Concretely, we formulate this learning strategy to be parameterized by a temporal encoder.
On the simulated new entities during training phase, starting from the initial few-shot links, the temporal encoder can softly sample and attentively integrate relative and time-aware information from the temporal neighbors, making the strategy learning (neighbor sampling + aggregation) differentiable.
The quantitative measurement of how well the current strategy performs can be reﬂected in the performance on predicting future facts allowing one to automatically adjust the strategy in turn.
During the nested loop for meta-optimization, we ﬁrstly learn the temporal encoder on recent facts ( inner loop ), then gradually increase the difﬁculties by autoregressively adapting it to farther away future facts ( outer loop ).
Furthermore, to better estimate the supervision signal given by future facts in different and unseen distributions, we adopt the PAC-Bayes method [27] to theoretically analyze the temporal adaptation bound on the future facts.
This can serve as an adaptation regularizer to provide stability and improve the generalization ability of current strategy over time.
Empirically, extensive experiments on three real-world TKGs validate the effectiveness of MetaTKGR , which signiﬁcantly outperforms all baselines from static/temporal KG reasoning and few-shot (knowledge) graph learning areas, by up to 11 .
4% relative gain on average with competitive efﬁciency.
To sum up, our main contributions are three-fold:
• Problem formulation: We explore a practical few-shot temporal knowledge graph reasoning setting, minimizing the gap with the realistic few-shot learning scenarios for humans; • Novel framework: We propose a novel meta temporal reasoning framework on TKGs, namely MetaTKGR , to address both few-shot and time shift challenges; • Extensive evaluation: the proposed MetaTKGR method demonstrates signiﬁcant gains in effectiveness on three real-world TKGs over a diverse range of state-of-the-art baselines.
Problem Deﬁnition
In this section, we formally deﬁne the few-shot temporal knowledge graph reasoning task.
First of all, a temporal knowledge graph can be deﬁned as follows:
Deﬁnition 2.1 ( Temporal Knowledge Graph).
A temporal knowledge graph can be denoted as
G T = { ( e s , r, e o , t ) } ✓ E T ⇥ R ⇥ E T ⇥ T , where E T denotes a set of entities that appear in time interval (0 , T ) ,
R denotes relation set, and T denotes timestamp set.
Each temporal link ( e s , r, e o , t ) refers to the fact that a subject entity e s 2 E T has a relation r 2 R with an object entity e o 2 E T at timestamp t 2 T .
As a temporal knowledge graph evolves, new entities continuously emerge, leading to an expansion of the entities set E T over time.
We further deﬁne new entities as follows:
Deﬁnition 2.2 ( New Entities in a Temporal Knowledge Graph).
Given a time interval ( T, T 0 ) ( T 0 > T ), entities that join the graph during ( T, T 0 ) , i.e., ˜ e 2 E T 0 \ E T ( \ denotes setminus), are deﬁned as new entities on time interval ( T, T 0 ) .
Knowledge graph reasoning (KGR) is essentially the problem of predicting missing facts in the partially observed KG.
While existing few-shot KGR models simulate unseen entities by randomly selecting from the existing entities, we focus speciﬁcally on predictions for newly emerging entities over time, which can be formalized as few-shot temporal knowledge graph reasoning task:
Deﬁnition 2.3 ( Few-shot Temporal Knowledge Graph Reasoning).
Given a temporal knowledge graph G T collected no later than T , for each new entity ˜
e 2 E T 0 \ E T ( T 0 > T ) , we assume the ﬁrst K associated facts are observed: { (˜ e, r i , e i , t i ) or ( e i , r i , ˜ e, t i ) } Ki =1 .
The task aims to predict the missing entities in the future facts (˜ e, r, ? , t ) or (? , r, ˜ e, t ) given the relation r 2 R and speciﬁc time t 2 ( T, T 0 ) .
We further assume K is a small number, as a realistic setting.
Learning to Sample And Aggregate with MetaTKGR
In this section, we present a novel framework MetaTKGR to solve the few-shot temporal knowledge graph reasoning problem.
We ﬁrst introduce the basic setup of our learning objective and the overall framework, and then detail the temporal encoder module to represent new entities, followed by introduction of meta temporal reasoning for model training. 3.1 Learning Objective
Suppose we are given a temporal knowledge graph G T
= { ( e s , r, e o , t ) } ✓ E T ⇥ R ⇥ E T ⇥ T collected no later than time T .
For each new entity ˜ e appearing within a later interval ( T, T 0 ) , we aim to predict future links (˜ e, r, e, t ) or ( e, r, ˜ e, t ) happening at timestamp t 2 ( T, T 0 ) .
Towards this goal, we measure correctness of each possible quadruple by a score function s ( · ;  ) parameterized by  , and maximize the scores of true quadruples containing any new entities in order to rank them higher than all other false quadruples:
[Equation]
where p ( ˜ E ) denotes distribution of all new entities,  denotes parameters of model to represent entity/relation into d -dimensional space h ˜ e , h e , h r 2 R d .
To represent ˜ e into h ˜ e via  , as aforementioned, the challenges lie in how to enable  to encode generalized knowledge (how to sample and aggregate temporal neighbors) that can be easily adapted to new ˜ e and achieve robust performance over time, even for a long time interval ( T, T 0 ) .
We thereby formulate few-shot temporal knowledge graph reasoning as a meta-learning problem to extract such knowledge. 3.2 MetaTKGR Framework
Figure 1 shows the MetaTKGR framework.
To be more formal, each task corresponds to each new entity ˜ e over distribution p ( ˜ E ) , and the links can be represented as a chronological sequence { (˜ e, r i , e i , t i ) or ( e i , r i , ˜ e, t i ) | t
i 2 ( T, T 0 ) , t i  t j if i < j } N ˜ e i =1 , where N ˜ e denotes total number of links associated to ˜ e .
Then we divide them into support set S ˜ e
= { (˜ e, r i , e i , t i ) or ( e i , r i , ˜ e, t i ) }
Ki =1 , and query set Q ˜
e = { (˜ e, r i , e i , t i ) or ( e i , r i , ˜ e, t i ) } N ˜
e i =
K +1 , where K denotes the amount of initially observable facts of ˜ e .
During the meta-training phase, we simulate a set of new entities from existing entity set by assuming there are only few-shot links of these entities (support set S ˜ e ).
The model ﬁrst ﬁne-tunes parameters
̃" " " " # " $ " % " [Figure] [Figure]
[Figure]
$
[Figure]
[Figure]
ℎ ' [Figure]
[Figure]
[Figure] [Figure] ℎ * #
[Figure]
[Figure]
ℎ ̃*(
[Figure]
[Figure]
̃*
[Figure]
[Figure] [Figure] [Figure] [Figure]
[Figure]
Inner Optimization
[Figure]
Outer Optimization
[Figure]
[Figure]
to optimize entity-speciﬁc parameters; In the outer optimization , MetaTKGR optimizes global parameters on query set via step (3) to learn good and robust global parameters.  on S ˜ e ( inner loop ), and then minimizes the predictive loss on corresponding query set Q ˜ e using the updated parameters  ˜ e ( outer loop ).
It optimizes the global sampling and aggregation strategy as generalized knowledge (i.e., learning to learn ability) by this bi-level optimization, as this procedure mimics the normal machine learning and inference process. For simplicity, to represent new entity ˜ e along time, we denote f  ˜ e as the temporal encoder parameterized by  ˜ e , L ( f  ˜ e , S ˜ e ) as model predictive loss on
S [Equation] e .
Model-agnostic meta-learning (MAML) [10] can be utilized to fulﬁll this goal as follows:
[Equation]
where ⌘ denotes inner-loop learning rate.
However, this training strategy cannot guarantee good generalization ability over time ( challenge 2 ), as they assume identical distributions between S ˜ e and
Q ˜ e , contradicting the facts that new entities are highly evolving over time on TKGs.
To coherently resolve the two challenges, we advance the existing few-shot KG reasoning works by proposing:
• Temporal encoder , which learns the time-aware representation of each new entity ˜ e by sampling and aggregating information from TKG neighbors on continuous domain.
• Meta temporal reasoning , which learns an optimal sampling and aggregating parameters via bi-level optimization ( inner optimization and outer optimization ).
The learned parameters can be easily adapted to new entities and maintain temporal robustness.
[Table]
On temporal knowledge graphs, entities are evolving over time.
The temporal encoder f  is designed to embed each entity ˜ e into low-dimensional latent space at each time: h ˜ e ( t ) 2 R d , where it can model the temporal pattern of ˜ e along time.
By doing so, it resolves the scarcity issues caused by few-shot links to some extent.
Towards this goal, f  ﬁrst samples temporal neighbors from TKGs, then attentively aggregates information from the temporal neighbors of each entity, which takes neighbor feature, relation feature and time feature into account.
To better represent few-shot entities, a wider range of neighbors should be considered, as the close neighbors around the new entities are usually insufﬁcient.
Conventionally, stacking several graph neural networks (GNNs)-based layers can integrate information from multi-hop neighbors [32, 15].
In few-shot cases, such layer-by-layer procedure faces difﬁculties.
For one thing, the limited one-hop neighbors can dominate the aggregation process, as the information of multi-hop neighbors is all propagated from them to the target entity.
Also, the size of neighbors grows exponentially with the increase of GNN layers, as they collect all neighbors in each hop without strategic selection, causing severe efﬁciency issues.
Instead, our temporal encoder ﬁrst samples multi-hop neighbors via a time-bounded breadth-ﬁrst-search algorithm, then aggregates information directly from the sampled neighbors in an attentive manner.
As summarized in Algorithm 1, at each time, it selectively samples up to b multi-hop temporal neighbors N ˜ e ( t ) which have interactions within a recent time range  t .
Given the temporal neighbor N ˜ e ( t ) for each new entity, temporal encoder f
represents a new entity as h ˜ e ( t ) at time t :
[Equation]
where l denotes the layer number,  ( · ) denotes the activation function ReLU , ↵ ˜ e,e i denotes the attention weight of entity i to new entity ˜ e , and W is the trainable transformation matrix.
To aggregate from history, ↵ ˜ e,e i is supposed to be aware of entity feature, time delay and topology feature induced by relations.
Thus, we design ↵ ˜ e,i as follows:
[Equation]
where q ˜ e,e i measures the pairwise importance by considering the entity embedding, relation embedding and time embedding, a 2 R 4 d is the shared parameter in the attention mechanism.
Following [8] we adopt random Fourier features as time encoding  (  t ) to reﬂect the time [-difference.3.
-]difference.
3.4 Meta Temporal Reasoning
Let h L ˜ e ( t ) denote the representations of new entity ˜ e produced by f  with L layers.
For each quadruple (˜ e, r, e, t ) , we employ a translation-based score function [2] to measure the correctness: s (˜ e, r, e, t ;  ) =
k
h L ˜ e ( t ) + h r  h
Le ( t ) k 2 .
We ﬁrst ﬁne-tune f  on support
set S ˜ e for entity-speciﬁc parameters f  ˜ e , and then optimize training loss on query set Q ˜ e to learn the global parameters shared by all entities.
To calculate the predictive loss, since each set only contains positive quadruples, we perform negative sampling [2] to update MetaTKGR by training it to rank positive quadruples higher than negative ones.
Speciﬁcally, taking the support set S ˜ e of entity ˜ e as an example, we construct a negative set S  ˜
e = { (˜ e, r, e  , t ) or ( e  , r, ˜ e, t ) } by replace the ground truth entity e with a corrupted entity e  .
We then use empirical hinge loss on the given set as follows:
[Equation]
where  > 0 is a margin value to distinguish positive and negative quadruples.
Inner optimization :
For each task corresponding to new entity ˜
e
⇠ p ( ˜ E ) , we ﬁrst adapt the global parameter  for each new entity ˜ e by minimizing the predictive loss on the support set S ˜ e :
[Equation]
where ⌘ is the inner loop learning rate.
By Eq.
6, we simulate the adaption for new entities.
Updating from an optimal global parameter  , the model is ﬁne-tuned into entity-speciﬁc for new entities.
Thus, it is crucial to design a meta-learning strategy to learn an optimal global parameter  with a robust generalization ability over time.
Outer optimization : Since new entities evolve over time, it is not only Q ˜ e but also each part of Q ˜ e that follows different distributions.
Thus, instead of optimizing the meta-learner on the whole query set Q ˜ e at once by Eq.
2, we ﬁrst adapt entity-speciﬁc parameters  ˜
e to recent facts, then gradually increase the difﬁculties by autoregressively adapting it to farther away future facts.
Through this process, we are able to guide and stablize the training of global parameters via a temporal signal.
Speciﬁcally, we split the time span of query sets into M time intervals, where each new entity has a sequence of query set corresponding to different time intervals Q ˜ e = {Q (1) ˜ e , Q (2) ˜ e , · · · , Q ( M ) ˜
e } .
We ﬁrst adapt and optimize  ˜
e for each new entity on Q (1)˜ e for  (1) encoding global knowledge for predictions in the 1 -st time interval.
Then we gradually adapt each  ˜
e ﬁne-tuned from last time interval on farther away intervals until  ( M ) is learned, which maintain temporal robustness from time interval 1 to M . [Table] [Table] [Table]
[Table]
[Table]
[Table] [Table] [Table] [Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
We then discuss how to measure the feedback ( loss) from each adaptation.
To simulate real scenarios, we assume query sets to follow different and unseen distributions.
Taking adaptation from m -th time interval to m +1 -th time interval as example, we view p (  ( m ) ) as prior parameter distribution and aim to learn the posterior parameter distribution q (  ( m +1) ) conditioning on query set in m + 1 -th interval.
The unseen query set distribution in m + 1 -th interval prevent us to estimate q (  ( m +1) ) by either using unbiased empirical loss or Bayes rules.
To resolve this, we instead adopt the PAC-Bayes method [27], which allows one to learn a parameter posterior that ﬁts the observations without knowing the observations distribution.
We propose the following theorem to relate real predictive loss in new time interval with its empirical verson:
Theorem 3.1 ( PAC-Bayes Generalization Bound on Temporal Adaptation).
Let D ( m +1) =
S [Equation] +1)
˜
e denote all query sets in m + 1 -th time interval of all new entities from ˜ E .
For any  2 (0 , 1) and learned parameter distribution p (  ( m ) ) in last time interval, with probability at least 1   on D ( m +1) :
[Equation]
where L ( f  ( m ) , D ( m +1) )
=
E ˜ e ⇠ p (˜ E ) h L ( f  ( m ) ˜
e , Q ( m +1)
˜ e ) i denotes real predictive loss on new time interval with new and unknown data distribution, ˆ L ( f  ( m ) , D ( m +1) ) denote the empirical version of the loss, and KL ( · k · ) is the Kullback-Leibler divergence.
Readers can refer to Appendix A.1 for proof.
Thus, using Theorem 3.1, we can adapt  ( m ) to m +time interval and estimate the feedback (predictive loss) for our meta-learning framework via the following temporal adaptation regularizer :
[Equation]
Remark .
To interpret the temporal adaptation regularizer R ( f  ( m ) ; D ( m +1) ) , it can be viewed as a combination of empirical risk on the query set in the new time interval as well as a regularizer of parameter distribution across time intervals in form of KL-divergence.
The regularizer along time domain can guarantee that global knowledge  is trained by predictive losses from all time intervals without overﬁtting in speciﬁc time interval.
Thus, we can improve the generalization ability of our meta-learner over time by the following update step by step, from m = 1 to m =
M :
[Equation]
where  (0) can be obtained by training on existing entities.
The meta-training phase of MetaTKGR is summarized in Algorithm 2.
During meta-test phase, given a new entity ˜ e , we can ﬁrst ﬁne-tune  on few-shot links, and then utilize f  ˜ e to represent ˜ e for future predictions.
Experiments
Datasets.
We evaluate the proposed MetaTKGR framework on three public TKGs, where YAGO [26] and WIKI [20] stores time-varying facts and ICEWS18 [3] is event-centric.
They are collected from [Table] [Table] different time ranges and have different time units, which can validate our framework in the context of various types of evolution.
Notably, most new entities appear with few-shot facts, validating the practical value of our proposed setting.
Table 1 shows the detailed statistics.
We report detailed dataset descriptions as well as entity links distribution in the Appendix A.
[Table]
[Table]
1 day
Baselines.
We compare nine state-of-the-art baselines from four related areas: 1) TransE
[2], 2) TransR [25], 3) RotatE
[37]: Translation distance based embedding methods for static knowledge graphs; 4) RE-NET [18], 5) REGCN [23]: Temporal knowledge graph embedding methods; 6) LAN [43]; 7) I-GEN [1]; 8) T-GEN [1]: Few-shot methods on static knowledge graph; 9) MetaDyGNN [56]: A meta-learning framework for few-shot link prediction on homogeneous graphs.
We describe the baselines in detail in Appendix A.3.
Experimental Setup.
Given the temporal knowledge graph, we ﬁrst split the time duration into four with a ratio of 0.4:0.25:0.1:0.25 chronologically, then we collect the entities that ﬁrstly appear in each period as background/meta-training/meta-validation/meta-test entity set.
We train our model on background set as initialization and simulate few-shot tasks on meta-training set.
To construct few-shot tasks, we assume the ﬁrst K = 1 , 2 , 3 quadruples of new entities are known and report the performance of the remaining quadruples in the future.
For fair comparison, we keep the dimension of all embeddings as 128 , and utilize pre-trained 1 -shot TransE embeddings for initialization for models if applicable.
We report detailed experimental setup, especially of MetaTKGR , in the Appendix A.4.
Evaluation Protocol and Metrics.
For each prediction (˜ e, r, ? , t ) or (? , r, ˜ e, t ) , we use ranking scheme to evaluate the performance.
Speciﬁcally, we rank all entities at the missing position in quadruples, and adopt mean reciprocal rank ( MRR ) and Hits at {1,3,10} ( H@{1,3,10} ) as evaluation metrics.
It is worth noting that we measure the ranks in a ﬁltered setting, where we ﬁlter other true quadruples existing in datasets, following [25, 37].
Results.
Table 2 and Table 3 report overall result for K = 3 and K = 1 , 2 few-shot experiments respectively.
On average, MetaTKGR achieves 11 .
4% relative improvement over best baseline model, demonstrating the superiority of MetaTKGR in modeling new entity evolution in low-data regime.
Baselines ( TransE, TransR, RotatE, RE-NET ) that do not optimize for new entities perform poorly on all datasets, although they are trained on both existing entities and new entities with few-shot links.
LAN, I-GEN, T-GEN also produce unsatisfying results, despite the fact that they propose special designs to represent new entities.
Note that they have worse performance in some cases than RE-NET that does not optimize for new entities, as they ignore the temporal information and perform poorly in future predictions.
Compared with MetaDyGNN, MetaTKGR shows consistently better performance, because our temporal encoder can handle multi-relational graphs in low-data regimes better, and our temporal meta-learning framework can produce more robust predictions.
Performance of Prediction over Time .
Next, we study the performance of MetaTKGR over time.
Figure 2 shows the performance comparisons of 3 -shot predictions over different timestamps on the YAGO and ICEWS datasets, measured by ﬁltered H @10 metrics.
MetaTKGR consistently beats all strong baselines.
Although the compared baselines can optimize newly emerging entities, they perform poorly in wide time intervals because they largely ignore the temporal information and the distribution discrepancy caused by evolution.
We notice that the relative gains of our model get more signiﬁcant with increasing time steps.
It illustrates that our temporal meta-learning framework can improve the generalization ability over time.
Performance on ICEWS18 ﬂuctuates more severely.
This is expected since the evolution of
ICEWS18 is not stable due to the much shorter time unit (day).
Ablation Study .
We evaluate performance improvements brought by the temporal meta-learning framework by following ablations: 1) Fine-Tuning is trained on existing entities without using any meta-learning strategy, and then ﬁne-tuned on new entities; 2) Static Meta-Learning utilizes conventional MAML to train models; 3) MetaTKGR w/o Regularizer meta-trains model parameters on each time interval step by step, without explicitly optimizing the temporal adaptation regularizer.
Figurereports the results measured by ﬁltered H @10 .
We can conclude that modeling the distribution discrepancy caused by the temporal evolution and optimizing the temporal adaptation regularizer can improve the performance in the future prediction.
Also, simply ﬁne-tuning the model parameters on new entities leads to poor results, as during background phase, the model does not extract generalized knowledge that can be easily adapted to new entities.
[Table]
[Figure]
[Table]
Cross-shot Learning .
In reality, new entities are usually associated with various numbers of facts initially.
Thus, the robustness of models on different numbers of shots during testing phase is critical.
To simulate such scenario, we evaluate MetaTKGR by varying the number of shots including 1-, 3-, 5-, and random-shot (R-S: between 1 and 5) during meta-training and meta-test phases.
Table 4 reports the cross-shot learning results.
As expected, with the increase of observable shots during testing phase, the performance becomes better.
The differences in the number of shots used for training do not signiﬁcantly affect the results, demonstrating that MetaTKGR trained with a ﬁxed number of shots performs robustly under the various number of shots during testing.
Efﬁciency Analysis .
We train MetaTKGR and baseline models from scratch on both existing entities and new entities and compare the training time, for the 3-shot experiment on YAGO.
Figure 4 shows that MetaTKGR signiﬁcantly outperforms baseline models with reasonable training time.
Compared with slow temporal models RE-NET, MetaDyGNN for knowledge graph reasoning, MetaTKGR is more efﬁcient because 1) our temporal encoder can learn temporal entity embeddings via sampled temporal neighbors at each continuous timestamp without using RNNs; 2) our temporal neighborhood sampler can prevent the size of multi-hop neighbors from increasing exponentially.
Related Work
Few-shot Learning on Knowledge Graph .
Few-shot learning (FSL) [47] aims at learning generalized knowledge from existing tasks to extract transferable priors for new tasks with few labeled samples, including metric learning based approaches [41, 36] and meta-learning based approaches [10, 30, 11].
For knowledge graph reasoning, the success of few-shot learning has facilitated learning the representations of scarce entities [14, 43, 34, 1] and scarce relations [58, 49, 6, 28] respectively.
In this paper, we are primarily interested in works to represent entities with few-shot facts, as relation set is relatively stable along time [35].
Given a new entity linked with few-shot facts, the neighborhood aggregator used in graph neural networks (GNNs) reduces the inductive bias via structural knowledge [19, 15, 32].
[14] computes the representations of few-shot entities by GNN-based neighboring aggregation scheme.
[43, 34, 28] further extend it by utilizing attention mechanisms.
However, those models are usually trained on both many-shot and few-shot entities, ending up being suboptimal for few-shot entities.
To address it, a recent work [1] explores how to mate-train the neighborhood aggregator so as to effectively adapt global knowledge for few-shot knowledge reasoning.
Deep graph learning has been attracting enormous interest recently [19, 15, 42, 52, 54, 55, 53, 51, 21].
More broadly on graphs, Meta-Graph [4], G-Meta
[17] and MetaDyGNN [56] are proposed to utilize meta-learning for link prediction across multiple graphs, on static/temporal homogeneous graphs.
However, most works are designed for few-shot learning on static (knowledge) graphs.
How to aggregate neighbors considering time factors and optimize for long-term performance are unsolved.
MetaDyGNN [56] is a recent framework combining MAML with TGAT [8] on temporal homogeneous graph.
But it did not consider distribution difference between few-shot facts and future facts caused by the evolution of new entities either, leading to increasingly poor performance over time, especially on temporal knowledge graphs with more complicated structures.
Temporal Knowledge Graph Reasoning .
Temporal knowledge graphs (TKGs) store time-varying facts in the real-world.
Temporal knowledge graph reasoning aims to predict missing facts at a certain time in the future.
It is mostly formulated as measuring the correctness of factual samples and negative samples by specially designed score functions [2, 25, 40, 37, 12].
Compared with static KG reasoning tasks, the main challenge lies in how to incorporate time information into the representation process.
Several embedding-based methods have been proposed.
They encode time-dependent information of entities and relations by decoupling embeddings into static component and time-varying component [50, 13], utilizing recurrent neural networks (RNNs) to adaptively learn the dynamic evolution from historical fact sequence [18, 48], or learning a sequence of evolving representations from discrete knowledge graph snapshots [16, 24, 18].
However, all of the existing temporal KG reasoning models aim to extrapolate future facts among existing entities, and how to predict future facts speciﬁcally for new emerging entities is largely under-explored.
Conclusion
We study a realistic but underexplored few-shot temporal knowledge graph reasoning problem, which aims at predicting future facts for newly emerging entities with a few facts.
To this end, we propose a novel Meta Temporal Knowledge Graph Reasoning framework MetaTKGR .
It meta-learns the global knowledge of sampling and aggregating temporal neighbors, which can be adapted quickly to new entities for future prediction.
Such procedure is gradually guided by the performance on predicting future facts, from near time intervals to far away ones.
We further theoretically analyze and propose a temporal adaptation regularizer to stabilize and generalize the learned knowledge on future tasks.
We empirically validate the effectiveness of MetaTKGR on three real-world temporal knowledge graphs, on which the proposed framework signiﬁcantly outperforms an extensive set of SOTA baselines. Acknowledgments and Disclosure of Funding
The authors would like to thank Tianshi Wang, Yuchen Yan, Jialu Wang for their helpful comments and discussion. The authors would also like to thank the anonymous reviewers of NeurIPS for valuable comments and suggestions. Research reported in this paper was sponsored in part by DARPA award HR001121C0165, DARPA award HR00112290105, Basic Research Ofﬁce award HQ00342110002, and the Army Research Laboratory under Cooperative Agreement W911NF-17-20196.