Temporal Inductive Path Neural Network for Temporal Knowledge Graph
  Reasoning
Temporal Knowledge Graph (TKG) is an extension of traditional Knowledge Graph
(KG) that incorporates the dimension of time. Reasoning on TKGs is a crucial
task that aims to predict future facts based on historical occurrences. The key
challenge lies in uncovering structural dependencies within historical
subgraphs and temporal patterns. Most existing approaches model TKGs relying on
entity modeling, as nodes in the graph play a crucial role in knowledge
representation. However, the real-world scenario often involves an extensive
number of entities, with new entities emerging over time. This makes it
challenging for entity-dependent methods to cope with extensive volumes of
entities, and effectively handling newly emerging entities also becomes a
significant challenge. Therefore, we propose Temporal Inductive Path Neural
Network (TiPNN), which models historical information in an entity-independent
perspective. Specifically, TiPNN adopts a unified graph, namely history
temporal graph, to comprehensively capture and encapsulate information from
history. Subsequently, we utilize the defined query-aware temporal paths on a
history temporal graph to model historical path information related to queries
for reasoning. Extensive experiments illustrate that the proposed model not
only attains significant performance enhancements but also handles inductive
settings, while additionally facilitating the provision of reasoning evidence
through history temporal graphs.
Hao Dong, Pengyang Wang, Meng Xiao, Zhiyuan Ning, Pengfei Wang, Yuanchun Zhou
# Temporal Inductive Path Neural Network for Temporal Knowledge Graph Reasoning

###### Abstract.

Temporal Knowledge Graph (TKG) is an extension of traditional Knowledge Graph (KG) that incorporates the dimension of time. Reasoning on TKGs is a crucial task that aims to predict future facts based on historical occurrences. The key challenge lies in uncovering structural dependencies within historical subgraphs and temporal patterns. Most existing approaches model TKGs relying on entity modeling, as nodes in the graph play a crucial role in knowledge representation. However, the real-world scenario often involves an extensive number of entities, with new entities emerging over time. This makes it challenging for entity-dependent methods to cope with extensive volumes of entities, and effectively handling newly emerging entities also becomes a significant challenge. Therefore, we propose **T**emporal **I**nductive **P**ath **N**eural **N**etwork (TiPNN), which models historical information in an entity-independent perspective. Specifically, TiPNN adopts a unified graph, namely history temporal graph, to comprehensively capture and encapsulate information from history. Subsequently, we utilize the defined query-aware temporal paths to model historical path information related to queries on history temporal graph for the reasoning. Extensive experiments illustrate that the proposed model not only attains significant performance enhancements but also handles inductive settings, while additionally facilitating the provision of reasoning evidence through history temporal graphs.

**Computing methodologies \(\rightarrow\) Temporal reasoning** +
Footnote †: c) 2018 Association for Computing Machinery.

Manuscript submitted to ACM

## 1. Introduction

Knowledge Graphs (KGs) are powerful representations of structured information that capture a vast array of real-world facts. They consist of nodes, which represent entities such as people, places, and events, and edges that define the relationships between these entities. These relationships are typically represented as triples in the form of \((s,r,o)\), comprising a subject, a relation, and an object, such as _(Tesla, Founded by, Elon Musk)_. Temporal Knowledge Graphs (TKGs) is an extension of a traditional KGs that incorporates the dimension of time. In a TKG, these facts are annotated with timestamps or time intervals to indicate when they are or were valid. Different from KGs, each fact in a TKG is represented as a quadruple, adding a timestamp feature, which can be denoted as \((s,r,o,t)\), including a subject, a relation,
an object, and a timestamp. For example, _(Albert Einstein, Born in, Germany, 03/14/1879)_. The timestamp indicates the specific date or time when this event occurred, providing temporal information to the graph. Such unique representation empowers TKGs to capture the dynamics of multi-relational graphs over time, exhibiting temporal variations. As a result, TKGs have found widespread applications in diverse domains, such as social network analysis [51][13], and event prediction [19][2][50] (e.g. disease outbreaks, natural disasters, and political shifts, _etc._) These applications leverage the temporal information embedded in TKGs to make informed decisions and predictions based on historical knowledge.

Among various tasks, TKG reasoning is one emerging research topic that focuses on inferring missing facts based on known ones. Basically, reasoning over TKG consists two primary settings: interpolation and extrapolation [20]. Given the timestamp scope \([0,T]\) in a TKG, where \(T\) represents the maximum timestamp, in the interpolation setting, the reasoning process is focused on the time range from 0 to \(T\), i.e., completing missing facts within the range of past timestamps based on the given known data [14]. On the other hand, in the extrapolation setting, the reasoning timestamps extend beyond \(T\), focusing on predicting the facts in the future based on the observed historical knowledge encoded in the TKG [27][8][61]. This study particularly emphasizes the extrapolation setting that infers future missing facts.

Existing literature on TKG reasoning mainly focuses on exploring temporal features and structural information to capture complicated variations and logical connections between entities and relations. For example, RE-NET [20] and RE-GCN [27] are representative works that leverage RNN-based and GNN-based approaches to learn both temporal dependencies and structural features from historical sequences in TKGs, serving as the foundation for predicting future facts. xERTE [15] utilizes the entity connection patterns from different temporal subgraphs in TKGs to construct an inference graph with time-aware features, enabling graph reasoning. TITer [41] adopts a different approach by fusing historical subgraph sequences into a unified graph through the addition of extra edges. It employs a reinforcement learning framework and designs a reward function to guide the model learning. These methods rely on entity modeling as nodes in the graph play a crucial role in knowledge representation, and entity modeling is indispensable, as entities serve as important hubs and key components in the graph.

However, the real-world scenario often involves an extensive number of entities, with new entities emerging over time. This makes it challenging for entity-dependent methods to cope with extensive volumes of entities, and effectively handling newly emerging entities also becomes a significant challenge. To address this, we previously introduced an innovative _entity-independent_ modeling approach for temporal knowledge graphs with an evolutionary perspective in our previous work [8], referred to as DaeMon. The entity-independent modeling approach brings several benefits: (i) modeling on graph representation is independent of entities, maintaining stable efficiency even for large-scale datasets with numerous entities. In other words, the memory occupation is independent of the number of entity categories. (ii) the entity-independent nature makes it insensitive to entity-specific features. Hence, when new entities emerge in future timestamps, the model can still handle these unseen nodes, showcasing robust generalization and reasoning capabilities. In essence, DaeMon focuses on learning query-aware latent path representations, incorporating a passing strategy between adjacent timestamps to control the path information flow toward later ones without explicitly modeling individual entities. Specifically, DaeMon introduces the concept of temporal paths to represent the logical paths between a query's head entity and candidate tail entities within the sequence of historical subgraphs. It utilizes path memory units to store aggregated representations of temporal paths along the timeline. The model further employs a path aggregation unit to capture local path information within each subgraph. Finally, DaeMon adopts a memory passing strategy to facilitate cross-temporal information propagation.
Here, we provide a generalized overview of inference based on temporal paths modeling, as illustrated in Figure 1. For a given inference query, it starts from this query and collects the path between the head node and tail node in the historical context. Then, it utilizes a query-aware temporal method to represent the aggregation of temporal paths with temporal information for reasoning. For example, in Figure 1, the red triangular nodes and red circular nodes represent the head entity and candidate tail entity of the query at timestamp \(T\) + 1, respectively. This method, based on temporal paths, iteratively learns the path information between the red triangular and red circular nodes within the historical context. The aggregation of path information corresponding to the query is then utilized to infer the possibility of potential future interactions. Besides, during the learning of path information, the method does not focus on which intermediary nodes (i.e., the blue nodes in Figure 1) are present in the path, but rather employs the relation representations present in the path to express it, showcasing an entity-independent characteristic.

While DaeMon benefits from this entity-independent modeling approach, it still exhibits certain limitations. First, during the learning of historical information, DaeMon independently performs graph learning on local subgraphs and then connects them through memory passing strategy to obtain the final query-aware path features for future fact reasoning. This process requires graph learning on each subgraph separately, leading to difficulties in modeling complex temporal characteristics and a significant increase in time complexity as the historical length grows. Second, the memory passing strategy is adopted to model temporal features in historical sequences, controlling the information flow from one timestamp to the next to achieve temporal evolution modeling. However, this temporal modeling approach is unidirectional, which not only gives rise to the long-term dependency problem but also neglects relative temporal features between timestamps. Third, DaeMon defines temporal paths as virtually connected paths across the sequence of subgraphs. However, in practice, it does not directly learn the representation of these virtual paths. Instead, it independently learns several edges on each timestamp's subgraph and then obtains the path feature by fusing the edge information through memory passing strategy. The independent learning approach without real physical paths creates challenges in providing relevant reasoning evidence during the inference stage, which makes it difficult to present interpretable explanations to users, hindering their understanding of the reasoning process.

To overcome the above challenges, we propose a model, Temporal Inductive Path Neural Network (TiPNN). Specifically, we introduce the concept of _history temporal graphs_ as a replacement for the original historical subgraph sequences to mitigate the complexity of learning historical information independently on multiple subgraphs. It allows us to model historical information more efficiently by combining it into a single unified graph, thereby enabling

Figure 1. A generalized overview of inference based on temporal paths modeling.
the discovery of complex temporal characteristics and reducing the computational burden during model inference. Furthermore, we redefine the notion of _temporal paths_ as a logical semantics path between the query entity and candidate entities in history temporal graph and design _query-aware temporal path processing_ to model the path feature on the single unified graph in the entity-independent manner for the final reasoning. This enhancement enables the model to comprehensively learn both the temporal and structural features present in the history temporal graph. The adoption of the entity-independent modeling approach allows the model to effectively handle the inductive setting on the history temporal graph. By jointly modeling the information within and between different timestamps in a single unified graph, it can capture a more intuitive and holistic view of the temporal reasoning logic, thus facilitating user understanding of the model's reasoning process and can even provide interpretable explanations for the reasoning results, meanwhile providing new insights for this task.

In essence, this work revolves around capturing query-aware temporal path features on the history temporal graphs to enable the inference of missing future facts. Our main contributions are as follows:

* To holistically capture historical connectivity patterns, we introduce a unified graph, namely the history temporal graph, to retain complete features from the historical context. The history temporal graph integrates the relationship of entities, timestamps of historical facts, and temporal characteristics among historical facts.
* We define the concept of temporal paths. Subsequently, we propose the Temporal Inductive Path Neural Network (TiPNN) for the task of temporal extrapolated reasoning over TKGs. Our approach models the temporal path features corresponding to reasoning queries by considering temporal information within and between different timestamps, along with the compositional logical rules of historical subgraph sequences.
* Extensive experiments demonstrate that our model outperforms the existing state-of-the-art results. We analyze the impact and effectiveness of individual components in TiPNN. Additionally, we construct datasets and conduct validation experiments for inductive reasoning tasks on temporal knowledge graphs. Furthermore, we present reasoning evidence demonstrations and analytical experiments based on history temporal graph inference.

## 2. Related Work

We divide the related work into two categories: (i) knowledge graph reasoning methods, and (ii) temporal knowledge graph reasoning methods.

### Knowledge Graph Reasoning

In recent years, knowledge graph representation learning has witnessed significant developments, aiming to embed entities and relations into continuous vector spaces while capturing their semantics (Beng et al., 2015)(Wang et al., 2016)(Wang et al., 2017). These methods can be broadly categorized into three categories: translation-based methods, semantic matching methods, and neural network-based methods. Translation-based methods, such as TransE (Beng et al., 2015). It considers relations as translations from subject entities to object entities in the vector space. Building upon TransE, several improved methods have been proposed, including TransH (Wang et al., 2016), TransR (Wang et al., 2017), TransD (Wang et al., 2018) and TransG (Wang et al., 2018), which introduce various strategies to enhance the modeling of entity-relation interactions. For semantic matching methods, RESCAL (Wang et al., 2016) proposes a tensor-based relational learning approach capable of collective learning. DistMult (Wang et al., 2018) simplifies RESCAL using diagonal matrices for efficiency, while HoIE (Hoi et al., 2017) and ComplEx (Wang et al., 2018) extend the representation capacity by incorporating higher-order interactions and complex-valued embeddings (Wang et al., 2018), respectively. Neural network-based methods have also gained attention, with approaches like GCN (Wang et al., 2016), R-GCN (Wang et al., 2017), WGCN (Wang et al., 2018), VR-GCN (Wang et al., 2018), and CompGCN (Wang et al., 2018), which integrate
content and structural features within the graph, allowing for joint embedding of nodes and relations in a relational graph (Sutton et al., 2015)(Sutton et al., 2016). These methods effectively capture complex patterns and structural dependencies in KGs, pushing the boundary of KG representation learning. Despite the successes of existing methods in reasoning with static KGs, they fall short when it comes to predicting temporal facts due to the lack of temporal modeling.

### Temporal Knowledge Graph Reasoning

An increasing number of studies have started focusing on the representation learning of temporal knowledge graphs, aiming to consider the temporal ordering of facts and capture the temporal knowledge of events. Typically, TKG reasoning methods can be categorized into two main classes based on the range of query timestamps: interpolation reasoning and extrapolation reasoning.

For interpolation reasoning, the objective is to infer missing facts from the past within observed data (Dong et al., 2015)(Chen et al., 2016)(Chen et al., 2017). TTransE (Sutton et al., 2016) extends the TransE (Chen et al., 2016) by incorporating relations and timestamps as translation parameters between entities. TA-TransE (Sutton et al., 2016) integrates the timestamps corresponding to fact occurrences into the relation representations, while HyTE (Dong et al., 2015) associates timestamps with corresponding hyperplanes. Additionally, based on ComplEx (Sutton et al., 2016), TNT-ComplEx (Sutton et al., 2016) adopts a unique approach where the TKGs are treated as a 4th-order tensor, and the representations are learned through canonical decomposition. However, these methods are not effectively applicable for predicting future facts (Kang et al., 2016)(Kang et al., 2016)(Sutton et al., 2016).

In contrast, the extrapolation setting, which this work focuses on, aims to predict facts in future timestamps based on historical TKG sequences. Know-Evolve (Konon et al., 2016) uses the temporal point process to represent facts in the continuous time domain. However, it falls short of capturing long-term dependencies. Similarly, DyREP (Konon et al., 2017) posits representation learning as a latent mediation process and captures the changes of the observed processes. CyGNet (Konon et al., 2018) utilizes a copy-generation mechanism that collects frequently repeated events with the same subject entities and relations to the query for inferring. RE-NET (Kon et al., 2018) conducts GRU and GCN to capture the temporal and structural dependencies in a sequential manner. xERTE (Konon et al., 2018) offers an explainable model for their predictions by searching in the subgraph with attentive propagation. RE-GCN (Sutton et al., 2016) considers both structural dependencies and static properties of entities at the same time, modeling in evolving manner. TANGO (Konon et al., 2018) designs neural ordinary differential equations to represent and model TKGs for continuous-time reasoning. In addition, reinforcement learning methods are used to uncover the most related facts to answer the query, such as TITer (Kang et al., 2016). Most existing methods are primarily transductive in nature, only focusing on modeling the graph features based on entities while overlooking the intrinsic temporal logical rules within TKG reasoning. As a result, there is still a need for more efficient methods that can effectively manage the robustness and scalability requirements in real-world situations.

## 3. Preliminaries

In this section, we provide the essential background knowledge and formally define the context. We also introduce the basics of temporal knowledge graph reasoning task. The details of essential mathematical symbols and the corresponding descriptions of TiPNN are shown in Table 1. It is important to clarify beforehand that we will indicate vector representations in the upcoming context using **bold** items.

### Background of Temporal Knowledge Graph

A temporal knowledge graph \(\mathcal{G}\) is essentially a multi-relational, directed graph that incorporates timestamped edges connecting various entities. It can be formalized as a succession of static subgraphs arranged in chronological order, i.e.,
\(\mathcal{G}=\{G_{1},G_{2},...,G_{t},...\}\). A subgraph in \(\mathcal{G}\) can be denoted as \(G_{t}=(\mathcal{V},\mathcal{R},\mathcal{E}_{t})\) corresponding to the snapshot at timestamp \(t\), where \(\mathcal{V}\) is the set of entities, \(\mathcal{R}\) is the set of relation types, and \(\mathcal{E}_{t}\) is the set of fact edges at timestamp \(t\). Each element in \(\mathcal{E}_{t}\) is a timestamped quadruple \((subject,relation,object,timestamp)\), which can be denoted as \((s,r,o,t)\) or \((s_{t},r_{t},o_{t})\), describing a relation type \(r\in\mathcal{R}\) occurs between subject entity \(s\in\mathcal{V}\) and object entity \(o\in\mathcal{E}\) at timestamp \(t\in\mathcal{T}\), where \(\mathcal{T}\) denote the finite set of timestamps.

### Formulation of Reasoning Task

Temporal knowledge graph reasoning task involves predicting the missing entity by answering a query like \((s,r,?,t_{q})\) using historical known facts \(\{(s,r,o,t_{i})|t_{i}<t_{q}\}\). Note that the facts in the query time period \(t_{q}\) are unknown in this task setting. For the sake of generalization, we assume that the fact prediction at a future time depends on a sequence of historical subgraphs from the closest \(m\) timestamps. That is, in predicting the missing fact at timestamp \(t+1\), we consider the historical subgraph sequence \(\{G_{t-m+1},...,G_{t}\}\) for the inference.

In addition, given an object entity query \((s,r,?,t_{q})\) at a future timestamp \(t_{q}\), we consider all entities in the entity set \(\mathcal{V}\) as candidates for the object entity reasoning. The final prediction is obtained after scoring and ranking all the candidates by a scoring function. When predicting the subject entity, i.e., \((?,r,o,t_{q})\), we can transform the problem into object entity prediction form \((o,r^{-1},?,t_{q})\). Therefore, we also insert the corresponding reverse edge \((o,r^{-1},s,t)\) when processing the history graph. Without loss of generality, the later section will be introduced in terms of object entity predictions.

## 4. Methodology

In this section, we introduce the proposed model, **T**emporal **I**nductive **P**ath **N**eural **N**etwork (TiPNN). We start with a model overview and then discuss each part of the model as well as its training and reasoning process in detail.

\begin{table}
\begin{tabular}{l l} \hline \hline Notations & Descriptions \\ \hline \(\mathcal{G}\) & a temporal knowledge graph \\ \(G_{t}\) & a subgraph corresponding to the snapshot at timestamp \(t\) \\ \(\mathcal{V},\mathcal{R},\mathcal{T}\) & the finite set of entities, relation types and timestamps in the temporal knowledge graph \\ \(\mathcal{E}_{t}\) & the set of fact edges at timestamp \(t\) \\ \((s,r,o,t)\) & a quadruple (fact edge) at timestamp \(t\) \\ \((s,r,?,t+1)\) & a query with the missing object that is to be predicted at timestamp \(t+1\) \\ \hline \(\hat{G}\) & a history temporal graph \\ \(r_{\tau}\) & a temporal relation in history temporal graph \\ \((s,r_{\tau},o)\) & a temporal edge with time attribute \(\tau\) attached in history temporal graph \\ \(m\) & the length of the history used for reasoning \\ \(\omega\) & the number of temporal path aggregation layers \\ \(\mathbf{H},\mathbf{h}\) & the representation of temporal paths (and path) \\ \(\mathbf{R}\) & a learnable representation of relation types in \(\mathcal{R}\) \\ \(\Psi_{r}\) & the query relation \(r\)-aware basic static embedding of temporal edge \\ \(\Upsilon\) & the temporal embedding of temporal edge \\ \(\mathbf{w}_{r}\) & the query-aware temporal representation of a temporal edge \\ \(d\) & the dimension of embedding \\ \hline \hline \end{tabular}
\end{table}
Table 1. Notations and Descriptions.
### Model Overview

The main idea of TiPNN is to model the compositional logical rules on multi-relational temporal knowledge graphs. By integrating historical subgraph information and capturing the correlated patterns of historical facts, we can achieve predictions for missing facts at future timestamps. Given a query \((s,r,?,t+1)\) at future timestamp \(t+1\), our focus is on utilizing historical knowledge derived from \(\{G_{t-m+1},...,G_{t}\}\) to model the connected semantic information between the query subject \(s\) and all candidate objects \(o\in\mathcal{V}\) in history for the query responding.

Each subgraph in a temporal knowledge graph with a different timestamp describes factual information that occurred at different moments. These subgraphs are structurally independent of each other, as there are no connections between the node identifiers within them. And the timestamps are also independently and discretely distributed, which makes it challenging to model the historical subgraphs in a connected manner. To achieve this, we construct a logically connected graph, named _History Temporal Graph_, to replace the originally independent historical subgraphs, allowing a more direct approach to modeling the factual features of the previous timestamp. By utilizing connected relation features and relevant paths associated with the query, it can capture semantic connections between nodes and thus learn potential temporal linking logical rules.

Specifically, for a given query subject entity, most candidate object entities are (directly or indirectly) connected to it in a logically connected history temporal graph. Therefore, _Temporal Path_ is proposed to comprehensively capture the connected edges between the query subject entity and other entities within the history temporal graph in a query-aware manner. By explicitly learning the path information between entities on the history temporal graph, the query-aware representation of the history temporal path between query subject and object candidates can be obtained. Based on the learned path feature, the inference of future missing facts can be made with a final score function. A high-level idea of this approach is to induce the connection patterns and semantic correlations of the historical context.

We introduce the construction of history temporal graph in Section 4.2 and discuss the formulation of temporal path in Section 4.3. Then we present the detail of query-aware temporal path processing in Section 4.4. Additionally, we describe the scoring and loss function in Section 4.5, and finally analyze the complexity in Section 4.6.

### History Temporal Graph Construction

To comprehensively capture the connectivity patterns between entities and complex temporal characteristics in the historical subgraphs, we construct a _history temporal graph_. One straightforward approach is to ignore the temporal information within the historical subgraphs and directly use all triplets from the subgraph sequence to form a complete historical graph. However, it is essential to retain the complete information of the historical subgraph sequence. The timestamps in the historical subgraph sequence are crucial for inferring missing facts for the future. The representations of entities and relationships can vary in semantic information across different timestamps in the historical subgraphs. Additionally, there is a temporal ordering between historical subgraphs at different time periods, which further contributes to the inference process.

Therefore, we consider incorporating the timestamps of historical subgraphs into the history temporal graph to maximize the integrity of the original historical subgraph sequence, which allows us to retain the essential temporal context needed for inferring missing facts effectively. Specifically, given a query \((s,r,?,t+1)\) at future time \(t+1\), we use its corresponding historical subgraph sequence \(\{G_{t-m+1},...,G_{t}\}\) from the previous \(m\) timestamps to generate the history temporal graph \(\hat{G}_{t-m+1:t}\) according to the form specified in Equation 1. Figure 2 illustrates the construction approach of the history temporal graph.
\[\hat{G}_{t-m+1:t}\leftarrow\left\{(s,r_{r},o)\Big{|}(s,r,o)\in G_{r},\tau\in[t-m+1,t ]\right\} \tag{1}\]

Note that \(r_{\tau}\) denotes the _temporal relation_ in history temporal graph \(\hat{G}_{t-m+1:t}\), representing a relation type \(r\) with time attribute \(\tau\) attached. That is, for a temporal edge \((s,r_{r},o)\in\hat{G}_{t-m+1:t}\), it means \((s,r,o)\) occurred in \(G\tau\). For simplicity, we abbreviate the history temporal graph \(\hat{G}_{t-m+1:t}\) as \(\hat{G}_{<t+1}\) for the query at \(t+1\) timestamp. Attaching the timestamp feature to the relation can be understood as expanding the set of relation types into a combined form of _relation-timestamp_, which allows us to capture the temporal aspect of relations among the entities and enables the modeling of the temporal path in history temporal graph.

### Temporal Path Formulation

The prediction of future missing facts relies on the development trends of historical facts. To capture the linkages between the query subject entity and object candidate entities on history temporal graph, the concept of temporal path is put forward.

Definition 1 (Temporal Path).: is a logical path that aggregates the semantics of all connected paths in history temporal graph between a head entity and a tail entity through arithmetic logical operations.

The aggregated temporal path can be used to simultaneously represent the temporal information and comprehensive path information from the head entity to the tail entity. This enables us to obtain a comprehensive query-aware paired representation for the future facts reasoning task by aggregating the information from various paths, which is from query subject node to object candidate nodes in history temporal graph. Note that it is essential to consider the relation type information from the query while learning paired representations. In other words, for a query \((s,r,?,t+1)\), we should also embed the relation type \(r\) into the paired representation (i.e., path representation) as well. This ensures that the relation type is incorporated into the learning process, enhancing the overall modeling of the query and enabling more accurate and context-aware inference of missing facts, and the detail will be discussed in Section 4.4.

We denote the representation of temporal path in history temporal graph \(\hat{G}_{<t+1}\) as \(\mathbf{H}_{(s,r)\rightarrow\mathcal{V}}^{<t+1}\in\mathbb{R}^{|\mathcal{V}| \times d}\) corresponding to the query \((s,r,?)\) at future timestamp \(t+1\), where \(|\mathcal{V}|\) is the cardinality of object candidates set and \(d\) is the dimension of temporal path embedding. That is, \(\mathbf{H}_{(s,r)\rightarrow\mathcal{V}}^{<t+1}\) describes the representations of temporal paths from query subject entity \(s\) to all object candidate entities in \(\mathcal{V}\), considering the specific query \((s,r,?)\). Specifically, each item in

Figure 2. Example of constructing the history temporal graph \(\hat{G}_{t-2t}\) with \(m=3\). For illustrative purposes, we use an undirected graph to demonstrate the construction method and omit the relationship types of edges in the historical subgraph sequence and the constructed history temporal graph. The time labels attached to the edges in the history temporal graph represent the timestamps of the corresponding edges in the historical subgraph sequence.
\(\mathbf{H}_{(s,r)\rightarrow\mathcal{V}}^{<t+1}\), which is denoted as \(\mathbf{h}_{(s,r)\rightarrow o}^{<t+1}\in\mathbb{R}^{d}\), represents a specific temporal path feature that learns the representation of temporal path from subject \(s\) to a particular candidate object \(o\), where \(o\in\mathcal{V}\).

Given query \((s,r,?,t+1)\), we take an object candidate \(o\in\mathcal{V}\) as an example. The temporal path between subject entity \(s\) and \(o\) we consider is the aggregation form of all paths that start with \(s\) and end with \(o\) in the topology of history temporal graph \(\hat{G}_{<t+1}\). Formally, we describe \(\mathbf{h}_{(s,r)\rightarrow o}^{<t+1}\) as follow:

\[\mathbf{h}_{(s,r)\rightarrow o}^{<t+1}=\bigoplus\mathcal{P}_{s \rightarrow o}^{<t+1}=\mathbf{p}_{0}\oplus\mathbf{p}_{1}\oplus\cdots\oplus \mathbf{p}_{|\mathcal{P}_{s\rightarrow o}^{<t+1}|}\Big{|}_{\mathbf{p}_{k} \in\mathcal{P}_{s\rightarrow o}^{<t+1}}, \tag{2}\]

where \(\oplus\) denotes the paths aggregation operator that aggregates paths feature between query subject \(s\) and object candidate \(o\), which will be introduced in the following section; \(\mathcal{P}_{s\rightarrow o}^{<t+1}\) denotes the set of paths from \(s\) to \(o\) in history temporal graph \(\hat{G}_{<t+1}\), and \(|\mathcal{P}_{s\rightarrow o}^{<t+1}|\) denotes the cardinality of the path set. A path feature \(\mathbf{p}_{k}\in\mathcal{P}_{s\rightarrow o}^{<t+1}\) is defined as follow when it contains edges as \((e_{0}\rightarrow e_{1}\rightarrow\cdots\rightarrow e_{|\mathbf{p}_{k}|})\):

\[\mathbf{p}_{k}^{t}=\mathbf{w}_{r}(e_{0})\otimes\mathbf{w}_{r}(e_{1})\otimes \cdots\otimes\mathbf{w}_{r}(e_{|\mathbf{p}_{k}|}), \tag{3}\]

where \(e_{(1,2,\ldots,|\mathbf{p}_{k}|)}\) denotes the temporal edges in path \(p_{k}\), and \(|\mathbf{p}_{k}|\) denotes the number of edges in path \(p_{k}\); \(\mathbf{w}_{r}(e_{*})\) is the query-aware temporal representation of edge \(e_{*}\) and \(\otimes\) denotes the operator of merging temporal edges information within the path.

### Query-aware Temporal Path Processing

In this section, we discuss how to model temporal path representations for the queries at future timestamps based on history temporal graph, as illustrated in Figure 3. It aids in predicting missing facts by providing connection patterns and temporal information into the temporal relation type edges between entities and enabling practical inference for the future facts.

#### 4.4.1. Temporal Path Aggregation Layer

We propose a temporal path aggregation layer for comprehensively aggregating the connected temporal relation type edges between the query subject entity \(s\) and all candidate object entities in \(\mathcal{V}\) within the history temporal graph.

Note that a temporal path representation is specific to a particular query. Different queries can lead to the same path, but they have different representations (e.g. when two queries share the same subject entity but have different query relations). This insight design ensures each path representations are context-dependent and take into account

Figure 3. An illustrative diagram of the proposed TiPNN model for query-aware temporal path processing.
the query's unique characteristics, such as the query subject entity and query relation type, which can influence the meaning and relevance of the path in different contexts.

The entire aggregation process is carried out iteratively based on the sight outlined in Equations 2 and 3. Since the history temporal graph already contains the connection information and temporal feature of historical facts, we can directly capture the temporal path representations from history temporal graph relevant to a given query. We adopt the \(\omega\)-layers message passing approach of graph neural network at history temporal graph to expand the iterative path length and learn query-aware temporal path features, which enables the continuous and simultaneous collection of multiple path information and their corresponding temporal edge features, for the temporal path representations.

Specifically, given a query \((s,r,?)\) at future timestamp \(t+1\), based on the structural and temporal feature of historical facts, the representation of temporal path \(\mathbf{h}_{(s,r)\rightarrow\mathbf{o}}^{<t+1}\) in history temporal graph \(\hat{G}_{<t+1}\) (i.e., the aggregated feature of path set \(\mathcal{P}_{s\rightarrow\mathbf{o}}^{<t+1}\)) is learned by the query-aware \(\omega\)-layers aggregation neural network. That is, \(\mathbf{H}_{(s,r)\rightarrow\mathcal{V}}^{<t+1}\) will be finally updated to represent the temporal paths from query subject \(s\) to all candidate objects \(o\in\mathcal{V}\) within a limited number of hops, after finishing \(\omega\)-th layer aggregation iteration. For the sake of simplicity, in the following text, we will use the query \((s,r,?,t+1)\) as an example, where \(s\) is the query subject entity, \(r\) is the query relation type, and \(t+1\) is the timestamp for the future fact to be predicted. We omit the superscript (and subscript) \(<t+1\) and the indicator of query subject and relation pair \((s,r)\) in notations. \(\mathbf{H}_{\mathcal{V}}^{l}\) is used to denote the status of temporal path representation at the \(l\)-th iteration, and \(\mathbf{h}_{o}^{l}\in\mathbf{H}_{\mathcal{V}}^{l}\) denotes the status of candidate \(o\in\mathcal{V}\) at the \(l\)-th iteration, where \(l\in[0,\omega]\). It should be stressed that \(\mathbf{H}_{\mathcal{V}}^{l}\) (or \(\mathbf{h}_{o}^{l}\)) is still describing the representation of temporal path(s), rather than node(s) representation.

A temporal path is formed by logically aggregating multiple real existing paths from the history temporal graph. Each path consists of multiple temporal edges. Although the temporal edge exists in the form of _relation-timestamp_, it is still based on a specific relationship \(r\in\mathcal{R}\). Therefore, we initialize a trainable representation for the relation set, which serves as a foundational feature when processing temporal edge features during temporal path aggregation with query awareness.

Here, we introduce and discuss the learnable relation representation and initialization of temporal path representation.

* **Learnable Relation Representation** At the very beginning of the processing, we initialize the representation of all relation types, which are in the set of relation types \(\mathcal{R}\), with a learnable parameter \(\mathbf{R}\in\mathbb{R}^{|\mathcal{R}|\times d}\), where \(|\mathcal{R}|\) is the cardinality of relation types set. It is essential to note that the learnable relation types representation \(\mathbf{R}\) is shared throughout the entire model and is not independent between each time step prediction, enabling the model to leverage the learned relationship representations consistently across different time points and queries, enabling better generalization and inference capabilities.
* **Temporal Path Initialization** When \(l=0\), \(\mathbf{H}_{\mathcal{V}}^{0}\) denotes the initial status of iteration that is used to prepare for the subsequent processing of temporal path iterations. Different from the common GNN-based approach and the previous model, we initialize the temporal path feature of \(o\in\mathcal{V}\) as query relation representation \(\mathbf{r}\in\mathbf{R}\) only when \(o\) is the same as the query subject entity \(s\), and a zero embedding otherwise. Formally, for the query \((s,r,?)\), any candidate \(o\in\mathcal{V}\) and query relation representation \(\mathbf{r}\), the temporal path representation \(\mathbf{h}_{o}^{0}\in\mathbf{H}_{\mathcal{V}}^{0}\) is initialized following \[\mathbf{h}_{o}^{0}\leftarrow\begin{cases}\mathbf{r}&if\ o\Leftrightarrow s,\\ \overline{0}&if\ o\Leftrightarrow s.\end{cases}\] (4)
This initialization strategy ensures that the initial state is contextually sensitive to the given query, starting at the query subject with the query relation feature, providing a foundation for subsequent iterations to capture and model the temporal paths.

With the initialization of temporal path representations, now we introduce the iterative aggregation process of the temporal path. Taking \(\mathbf{h}_{\mathbf{o}}^{I}\) as an example,

\[\mathbf{h}_{\mathbf{o}}^{I}=\textsc{Agg}\left(\left\{\mathsf{Tmsg}\big{(} \mathbf{h}_{z}^{I-1},\mathbf{w}_{r}(z,p_{r},o)\big{)}\Big{|}(z,p_{r},o)\in \hat{G}_{<t+1}\right\}\right), \tag{5}\]

where \(\textsc{Agg}(\cdot)\) and \(\textsc{Tmsg}(\cdot)\) are the aggregation and temporal edge merging function, corresponding to the operator in Equation 2 and 3, respectively, which will be introduced in the following section; \(\mathbf{w}_{r}\in\mathbb{R}^{d}\) denotes query-aware temporal representation of a temporal edge type; \((z,p_{r},o)\in\hat{G}_{<t+1}\) is a temporal edge in history temporal graph \(\hat{G}_{<t+1}\) that temporal relation \(p_{r}\) occurs between an entity \(z\) and candidate entity \(o\) at the history time \(\tau\).

#### 4.4.2. Aggregation Operating

Equation 5 describes the iterative aggregation process of \(\mathbf{h}_{\mathbf{o}}\) in the \(l\)-th layer. Here we provide explanations for the temporal edge merging function \(\textsc{Tmsg}(\cdot)\) and path aggregation function \(\textsc{Agg}(\cdot)\), respectively.

Intuitively, the \(\textsc{Tmsg}(\cdot)\) function is responsible for iteratively searching for paths with a candidate object entity \(o\) as the endpoint, continuously propagating information along the temporal edges. On the other hand, the \(\textsc{Agg}(\cdot)\) function is responsible for aggregating the information obtained from each iteration along the temporal edges. Due to the initial state of \(\mathbf{H}_{\mathbf{o}}^{0}\), where only \(\mathbf{h}_{\mathbf{s}}^{0}\) is given the initial information, after \(\omega\) iterations of aggregation, \(\mathbf{h}_{\mathbf{o}}^{\omega}\) captures the comprehensive semantic connection and temporal dependency information of multiple paths from subject node \(s\) to object candidate \(o\) in the history temporal graph \(\hat{G}_{<t+1}\).

* **Temporal Edge Merging Function \(\textsc{Tmsg}(\cdot)\)** It takes the current temporal path representation \(\mathbf{h}_{z}^{I-1}\), query relation representation \(\mathbf{r}\), and the temporal edge information as input and calculates the updated potential path information for the candidate object \(o\). Similar to message passing in knowledge graphs, we have adopted a vectorized multiplication method [57] to achieve feature propagation in history temporal graph, following \[\textsc{Tmsg}\big{(}\mathbf{h}_{z}^{I-1},\mathbf{w}_{r}(z,p_{r},o)\big{)}= \mathbf{h}_{z}^{I-1}\otimes\mathbf{w}_{r}(z,p_{r},o),\] (6) where the operator \(\otimes\) is defined as element-wise multiplication between \(\mathbf{h}_{z}^{I-1}\) and \(\mathbf{w}_{r}(z,p_{r},o)\). The vectorized multiplication can be understood as scaling \(\mathbf{h}_{z}^{I-1}\) by \(\mathbf{w}_{r}(z,p_{r},o)\) in our temporal edges merging [57]. As mentioned earlier, \(\mathbf{w}_{r}(z,p_{r},o)\) represents the query-aware temporal representation of a temporal edge \((z,p_{r},o)\), which needs to ensure its relevance to the query, enabling effective capturing of relation features and temporal characteristics. Therefore, the approach of temporal relation encoding is proposed for the temporal edge representation. _Temporal Relation Encoding_. Temporal edge representation should align with the query's characteristics, facilitating more contextually relevant and informative feature propagation. Specifically, we take into account the temporal edge features from the query relation representation, semantic and temporal characteristics of the temporal edges in the history temporal graph, generating comprehensive embedding with both static and temporal characteristics. Formally, \(\mathbf{w}_{r}(z,p_{r},o)\) can be derived as
\[\mathbf{w}_{r}(z,p_{r},o)=g\Bigg{(}\mathbf{\Psi}_{r}(p)\Bigg{\|}\Upsilon(\Delta r) \Bigg{)},\] (7) where \(\mathbf{\Psi}_{r}(p)\in\mathbb{R}^{d}\) denotes the query relation \(r\)-aware basic static representation of edge type \(p\), \(\Upsilon(\Delta r)\in\mathbb{R}^{d}\) denotes the temporal embedding of the temporal edge type \(p_{r}\), \(\|\) denotes the operator of embedding concatenation, and \(g(\cdot)\) is a feed-forward neural network. For the basic static representation of \(p\), we obtain it through a linear transformation. Based on the query relation representation \(\mathbf{r}\), we map a representation as the static semantic information of the temporal edge type \(p\), following \[\mathbf{\Psi}_{r}(p)=\mathbf{W}_{p}\mathbf{r}+\mathbf{b}_{p},\] (8) where \(\mathbf{W}_{p}\) and \(\mathbf{b}_{p}\) are learnable parameters and serve as the weights and biases of the linear transformation, respectively, which makes the basic static information of the temporal edges derived from the given query relation embedding, ensuring the awareness of the query. And for the temporal embedding of the temporal edge, we use generic time encoding [55] to model the temporal information in temporal edges, following \[\Delta\tau=|\tau-t_{q}|,\] (9) \[\Upsilon(\Delta\tau)=\sqrt{\frac{1}{d}}\ \ \Big{[}cos(\mathbf{w}_{1}\Delta\tau+ \boldsymbol{\phi}_{1}),cos(\mathbf{w}_{2}\Delta\tau+\boldsymbol{\phi}_{2}), \cdots,cos(\mathbf{w}_{d}\Delta\tau+\boldsymbol{\phi}_{d})\ \Big{]},\] (10) where \(t_{q}\) denotes the query timestamp, \(\Delta\tau\) denotes the time interval between the query timestamp \(t_{q}\) and the temporal edge timestamp \(\tau\), which measures how far apart \(\tau\) is from \(t_{q}\), namely _relative time distance_. Moreover, \(\mathbf{w}_{*}\) and \(\boldsymbol{\phi}_{*}\) are learnable parameters, and \(d\) is the dimension of the vector representation, which is the same as the dimension of the static representation. The \(\text{Tmsg}(\cdot)\) function effectively bridges the temporal dependencies and semantic connections between the query subject and the candidate object through propagation along the temporal edges in paths. Besides, in the encoder of temporal relation, considering query relation feature allows to tailor the temporal edge representation to the specific relation type relevant to the query; temporal characteristics of edges help to model chronological order and time-based dependencies between different facts; and simultaneously modeling the basic static and temporal features of the temporal edge make more comprehensive semantics obtained.
* **Path Aggregation Function Agg\((\cdot)\)** It considers the accumulated information from the previous iteration and the newly propagated information along the temporal edge to update the temporal path representation for a candidate object. We adopt principal neighborhood aggregation (PNA) proposed in [5], which leverages multiple aggregators (namely mean, maximum, minimum, and standard deviation) to learn joint feature, since previous work has verified its effectiveness [63][31]. We also consider the traditional aggregation function as a comparison, such as sum, mean, and max, which will be introduced in detail in Section 5.3.

Finally, after the \(\omega\)-th iteration of aggregation, \(\mathbf{H}_{\mathcal{V}}^{\omega}\) will obtain the representation of the temporal paths from query subject \(s\) to all candidate objects in \(\mathcal{V}\), with comprehensive semantic connection and temporal dependency information of multiple paths.
### Learning and Inference

TiPNN models the query-aware temporal path feature by aggregation process within the history temporal graph. By capturing comprehensive embedding with both static and temporal characteristics of temporal edges, and aggregating multiple paths that consist of temporal edges, TiPNN learns a comprehensive representation of temporal path. Different from most previous models, we utilize the temporal edge features in a path from query subject to candidate object, without considering any node embedding during modeling processing, thus TiPNN can solve the inductive setting, which will be presented in Section 5.2 in detail.

#### 4.5.1. Score Function

Here we show how to apply the final learned temporal paths representation to the temporal knowledge graph reasoning.

Given query subject \(s\) and query relation \(r\) at timestamp \(t+1\), after obtaining temporal paths representation \(\mathbf{H}^{\omega}_{(s,r)\rightarrow\mathcal{V}}\), we predict the conditional likelihood of the future object candidate \(o\in\mathcal{V}\) using \(\mathbf{h}^{\omega}_{(s,r)\rightarrow\omega}\in\mathbf{H}^{\omega}_{(s,r) \rightarrow\mathcal{V}}\), following:

\[p(o|s,r)=\sigma\Bigg{(}\mathcal{F}\Big{(}\mathbf{h}^{\omega}_{(s,r)\to \omega}\bigm{\|}\mathbf{r}\Big{)}\Bigg{)}, \tag{11}\]

where \(\mathcal{F}(\cdot)\) is a feed-forward neural network, \(\sigma(\cdot)\) is the sigmoid function and \(||\) denotes embedding concatenation. Note that we append the query relation embedding \(\mathbf{r}\) to the temporal path feature \(\mathbf{h}^{\omega}_{(s,r)\rightarrow\omega}\), and it helps to alleviate the insensitivity to unreachable distances for nodes within a limited number of hops, and also enhances the learning capacity of relation embeddings \(\mathbf{R}\).

As we have added inverse quadruple \((o,r^{-1},s,t)\) corrsponding to \((s,r,o,t)\) into the dataset in advance, without loss of generality, we can also predict subject \(s\in\mathcal{V}\) given query relation \(r^{-1}\) and query object \(o\) with the same model as:

\[p(s|o,r^{-1})=\sigma\Bigg{(}\mathcal{F}\Big{(}\mathbf{h}^{\omega}_{(o,r^{-1}) \rightarrow s}\bigm{\|}\mathbf{r}^{-1}\Big{)}\Bigg{)}. \tag{12}\]

#### 4.5.2. Parameter Learning

Reasoning on a given query can be seen as a binary classification problem. The objective is to minimize the negative log-likelihood of positive and negative triplets, as shown in Equation 13.

In the process of generating negative samples, we follow the Partial Completeness Assumption (Garon et al., 2016). Accordingly, for each positive triplet in the reasoning future triplet set, we create a corresponding negative triplet by randomly replacing one of the entities with a different entity. It ensures that the negative samples are derived from the future triplet set at the same timestamp, allowing the model to effectively learn to discriminate between correct and incorrect predictions at the same future timestamp.

\[\mathcal{L}_{TKG}=-\log p(s,r,o)-\sum_{j=1}^{n}\frac{1}{n}log(1-p(\overline{s_ {j}},r,\overline{o_{j}})), \tag{13}\]

where \(n\) is hyperparameter of negative samples number per positive sample; \((s,r,o)\) and \((\overline{s_{j}},r,\overline{o_{j}})\) are the positive sample and \(j\)-th negative sample, respectively.

Besides, to promote orthogonality in the learnable raltion parameter \(\mathbf{R}\) initialized at the beginning, a regularization term is introduced in the objective function, inspired by the work in (Song et al., 2016). The regularization term is represented following 14, where \(\mathbf{I}\) is the identity matrix, \(\alpha\) is a hyperparameter and \(\|\cdot\|\) denotes the L2-norm.

\[\mathcal{L}_{REG}=\Bigm{\|}\mathbf{R}^{T}\mathbf{R}-\alpha\mathbf{I}\Bigm{\|} \tag{14}\]
Therefore, the final loss of TiPNN is the sum of two losses and can be denoted as:

\[\mathcal{L}=\mathcal{L}_{TKG}+\mathcal{L}_{REG}. \tag{15}\]

### Complexity Analysis

The score of each temporal path from the query subject and candidate object can be calculated in parallel operation. Therefore, to see the complexity of the proposed TiPNN, we analyze the computational complexity of each query. The major operation in TiPNN is query-aware temporal path processing, and each aggregation iteration contains two steps: temporal edge merging function \(\texttt{Tmsg}(\cdot)\) and path aggregation function \(\texttt{Agg}(\cdot)\) (as shown in Equation 5). We use \(|\mathcal{E}|\) to denote the maximum number of concurrent facts in the historical subgraph sequence, and \(|\mathcal{V}|\) to denote the cardinality of the entity set. \(\texttt{Tmsg}(\cdot)\) has the time complexity of \(O(m|\mathcal{E}|)\) since it performs Equation 6 for all edges in the history temporal graph, where \(m\) denotes the length of the history used for reasoning. \(\texttt{Agg}(\cdot)\) has the time complexity of \(O(|\mathcal{V}|)\) since the aggregation method we adopt will perform for every node. And \(\texttt{Agg}(\cdot)\) is executed after \(\texttt{MsG}(\cdot)\) at each aggregation iteration, so the time complexity is finally \(O(\omega(m|\mathcal{E}|+|\mathcal{V}|))\) when the number of aggregation layers is \(\omega\).

## 5. Experiments

In this section, we carry out a series of experiments to assess the effectiveness and performance of our proposed TiPNN. Through these experiments, we aim to address and answer the following research questions:

* **RQ1:** How does the proposed model perform as compared with state-of-the-art knowledge graph reasoning and temporal knowledge graph reasoning methods?
* **RQ2:** How does each component of TiPNN (i.e., temporal relation encoding, temporal edge merging function, path aggregation function) affect the performance?
* **RQ3:** How do the core parameters in history temporal graph construction (i.e., sampling history length) and query-aware temporal path processing (i.e., number of temporal path aggregation layers) affect the reasoning performance?
* **RQ4:** How does the performance efficiency of TiPNN compared with state-of-the-art method for the reasoning?
* **RQ5:** How does the proposed model solve the inductive setting on temporal knowledge graph reasoning?
* **RQ6:** How does the proposed model provide reasoning evidence based on the history temporal path for the reasoning task?

### Experimental Settings

#### 5.1.1. Datasets

We conduct extensive experiments on four representative temporal knowledge graph datasets, namely, ICEWS18 (Zheng et al., 2019), GDELT (Zheng et al., 2019), WIKI (Zheng et al., 2019), and YAGO (Zheng et al., 2019). These datasets are widely used in the field of temporal knowledge reasoning due to their diverse temporal information. The ICEWS18 dataset is collected from the Integrated Crisis Early Warning System (Beng et al., 2019), which records various events and activities related to global conflicts and crises, offering valuable insights into temporal patterns of such events. The GDELT dataset (Gong et al., 2019) is derived from the Global Database of Events, Language, and Tone, encompassing a broad range of events across the world and enabling a comprehensive analysis of global events over time. WIKI (Zheng et al., 2019) and YAGO (Zheng et al., 2019) are two prominent knowledge bases containing factual information with explicit temporal details. WIKI covers a wide array of real-world knowledge with timestamps, while YAGO offers
a structured knowledge base with rich semantic relationships and temporal annotations. And we focus on the subsets of WIKI and YAGO that have yearly granularity in our experiments. The details of the datasets are provided in Table 2. To ensure fair evaluation, we adopt the dataset splitting strategy employed in (Kang et al., 2018). The dataset is partitioned into three sets: training, validation, and test sets, based on timestamps. Specifically, (timestamps of the train) \(<\) (timestamps of the valid) \(<\) (timestamps of the test).

#### 5.1.2. Evaluation Metrics

To evaluate the performance of the proposed model for TKG reasoning, we employ the commonly used task of link prediction on future timestamps. To measure the performance of the method, we report the Mean Reciprocal Rank (MRR) and Hits@[1; 3; 10] metrics. MRR is a measure that evaluates the average reciprocal rank of correctly predicted facts for each query. Hits@k is a set of metrics that measures the proportion of queries for which the correct answer appears in the top-k positions of the ranking list.

In contrast to the traditional filtered setting used in previous works (Beng et al., 2017)(Kang et al., 2018), where all valid quadruples appearing in the training, validation, or test sets are removed from the ranking list of corrupted facts, we consider that this setting is not suitable for TKG reasoning tasks. Instead, we opt for a more reasonable evaluation, namely time-aware filtered setting, where only the facts occurring at the same time as the query are filtered from the ranking list of corrupted facts, which is aligned with recent works (Kang et al., 2018)(Kang et al., 2018).

#### 5.1.3. Compared Methods

We conduct a comprehensive comparison of our proposed model with three categories of baselines: (1) _KG Reasoning Models_. It consists of traditional KG reasoning models that do not consider timestamps, including DistMult(Kang et al., 2018), ComplEx (Kang et al., 2018), ConvE (Chen et al., 2018), and RotatE (Kang et al., 2019). (2) _Interpolated TKG Reasoning models_. We also compare our proposed model with four interpolated TKG reasoning methods, namely TTransE (Kang et al., 2018), TA-DistMult (Kang et al., 2018), DE-SimpLE (Kang et al., 2018), and TNTComplEx (Kang et al., 2018). (3) _Extrapolated TKG Reasoning models_. We include state-of-the-art extrapolated TKG reasoning methods that infers future missing facts, including TANGO-Tucker (Kang et al., 2018), TANGO-DistMult (Kang et al., 2018), CyGNet (Kang et al., 2018), RE-NET (Kang et al., 2018), RE-GCN (Kang et al., 2018), TITer (Kang et al., 2018), xERTE (Kang et al., 2018), CEN (Kang et al., 2018), GHT (Kang et al., 2018), and DaeMon (DaeMon, 2018).

#### 5.1.4. Implementation Details

For history temporal graph construction, we perform a grid search on the history length \(m\) and present overview results with the lengths 25, 15, 10, 8, corresponding to the datasets ICEWS18, GDELT, WIKI, and YAGO in Table 3, which is described in detail presented in Figure 7. The embedding dimension \(d\) is set to 64 for temporal path representation. For query-aware temporal path processing, we set the number of temporal path aggregation layers \(\omega\) to 6 for ICEWS18 and GDELT datasets, and 4 for WIKI and YAGO datasets. We conduct layer normalization and shortcut on the aggregation layers. The activation function \(relu\) is adopted for the aggregation of the temporal path. Similar to (Kang et al., 2018), we use different temporal edge representations in different aggregation layers, that is the learnable parameter in \(\mathbf{\Psi}\) and \(\mathbf{\Upsilon}\) is independent of each aggregation iteration (Kang et al., 2018)(Kang et al., 2018). To facilitate parameter learning, we have set the number of negative sampling to 64 and the hyperparameter \(\alpha\) in the regularization term to 1. We use Adam (Kingmaa et al., 2014)

\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline Datasets & \(|\mathcal{V}|\) & \(|\mathcal{R}|\) & \(\mathcal{E}_{train}\) & \(\mathcal{E}_{valid}\) & \(\mathcal{E}_{test}\) & \(|\mathcal{T}|\) \\ \hline ICEWS18 & 23,033 & 256 & 373,018 & 45,995 & 49,545 & 304 \\ GDELT & 7,691 & 240 & 1,734,399 & 238,765 & 305,241 & 2,976 \\ WIKI & 12,554 & 24 & 539,286 & 67,538 & 63,110 & 232 \\ YAGO & 10,623 & 10 & 161,540 & 19,523 & 20,026 & 189 \\ \hline \hline \end{tabular}
\end{table}
Table 2. Statistics of Datasets (\(\mathcal{E}_{train}\), \(\mathcal{E}_{valid}\), \(\mathcal{E}_{test}\) are the numbers of facts in training, validation, and test sets.).
for parameter learning, with a learning rate of \(1e-4\) for YAGO and \(5e-4\) for others. The maximum epoch of training has been set to 20. We also design an experiment in an inductive setting, which predicts facts with unseen entities in the training set, to demonstrate the inductive ability of our proposed model. All experiments were conducted with EPYC 7742 CPU and 8 TESLA A100 GPUs.

### Experimental Results (RQ1)

The experiment results on the TKG reasoning task are shown in Table 3 in terms of time-aware filtered MRR and Hits@{1,3,10}. The results demonstrate the effectiveness of our proposed model with a convincing performance and validate the superiority of TiPNN in handling temporal knowledge graph reasoning tasks. It consistently outperforms all baseline methods and achieves state-of-the-art (SOTA) performance on the four TKG datasets.

In particular, TiPNN exhibits better performance compared to all static models (listed in the first block of Table 3) and the temporal models in the interpolation setting (presented in the second block of Table 3). This is attributed to TiPNN's incorporation of temporal features of facts and its ability to learn temporal inductive paths, which enables it to effectively infer future missing facts. By leveraging comprehensive historical semantic information, TiPNN demonstrates remarkable proficiency in handling temporal knowledge graph reasoning tasks. Compared with the temporal models under the extrapolation setting (those presented in the third block of Table 3), the proposed model also achieves better results. TiPNN demonstrates its capability of achieving superior results by effectively modeling temporal edges. In contrast to the previous model, it starts from the query and obtains query-specific temporal path representations, allowing for more accurate predictions about the future. Thanks to the message propagation mechanism between

\begin{table}
\begin{tabular}{c|c c c|c c c c|c c c c|c c c c} \hline \hline \multirow{2}{*}{Model} & \multicolumn{4}{c|}{ICEWS18} & \multicolumn{4}{c|}{GDELT} & \multicolumn{4}{c|}{WIKI} & \multicolumn{4}{c}{YAGO} \\ \cline{2-13}  & MRR & H@1 & H@3 & H@10 & MRR & H@1 & H@3 & H@10 & MRR & H@1 & H@3 & H@10 & MRR & H@1 & H@3 & H@10 \\ \hline DistMult & 11.51 & 7.03 & 12.87 & 20.86 & 8.68 & 5.58 & 9.96 & 17.13 & 10.89 & 8.92 & 10.97 & 16.82 & 44.32 & 25.56 & 48.37 & 58.88 \\ ComplEx & 22.94 & 15.19 & 27.05 & 42.11 & 16.96 & 11.25 & 19.52 & 32.35 & 24.47 & 19.69 & 27.28 & 34.83 & 44.38 & 25.78 & 48.20 & 59.01 \\ ConvE & 24.51 & 16.23 & 29.25 & 44.51 & 16.55 & 11.02 & 18.88 & 31.60 & 14.52 & 11.44 & 16.36 & 22.36 & 42.16 & 23.27 & 46.15 & 60.76 \\ RotatE & 12.78 & 4.01 & 14.89 & 31.91 & 13.45 & 6.95 & 14.09 & 25.99 & 46.10 & 41.89 & 49.65 & 51.89 & 41.28 & 22.19 & 45.33 & 58.39 \\ \hline TTransE & 8.31 & 1.92 & 8.56 & 21.89 & 5.50 & 0.47 & 4.94 & 15.25 & 29.27 & 21.67 & 34.43 & 42.39 & 31.19 & 18.12 & 40.91 & 51.21 \\ TA-DistMult & 16.75 & 8.61 & 18.41 & 33.59 & 12.00 & 5.76 & 12.94 & 23.54 & 44.53 & 39.92 & 48.73 & 51.71 & 54.92 & 48.15 & 59.61 & 66.71 \\ DE-SimplE & 19.30 & 11.53 & 21.86 & 34.80 & 19.70 & 12.22 & 21.39 & 33.70 & 45.43 & 42.60 & 47.71 & 49.55 & 54.91 & 51.64 & 57.30 & 60.17 \\ TNTComplEx & 21.23 & 13.28 & 24.02 & 36.91 & 19.53 & 12.41 & 20.75 & 33.42 & 45.03 & 40.04 & 49.31 & 52.03 & 57.98 & 52.92 & 61.33 & 66.69 \\ \hline TANGO-Tucker & 28.68 & 19.35 & 32.17 & 47.04 & 19.42 & 12.34 & 20.70 & 33.16 & 50.43 & 48.52 & 51.47 & 53.58 & 57.83 & 53.05 & 60.78 & 65.85 \\ TANGO-DistMult & 26.65 & 17.92 & 30.08 & 44.09 & 19.20 & 12.17 & 20.40 & 32.78 & 51.15 & 49.66 & 52.16 & 53.35 & 62.70 & 59.18 & 60.31 & 67.90 \\ CyGNet & 24.93 & 15.90 & 28.28 & 42.61 & 18.48 & 11.52 & 19.57 & 31.98 & 33.89 & 29.06 & 36.10 & 41.86 & 52.07 & 45.36 & 56.12 & 63.77 \\ RE-NET & 28.81 & 19.05 & 32.44 & 47.51 & 19.62 & 12.42 & 21.00 & 34.01 & 49.66 & 46.88 & 51.19 & 53.48 & 58.02 & 53.06 & 61.08 & 66.29 \\ RE-GCN & 30.58 & 21.01 & 34.34 & 48.75 & 19.64 & 12.42 & 20.90 & 33.69 & 77.55 & 73.75 & 80.38 & 83.68 & 84.12 & 80.76 & 86.30 & 89.98 \\ TITer & 29.98 & 22.05 & 33.46 & 44.83 & 15.46 & 10.98 & 15.61 & 24.31 & 75.50 & 72.96 & 77.49 & 79.02 & 87.47 & 84.89 & 89.96 & 90.27 \\ xERTE & 29.31 & 21.03 & 33.40 & 45.60 & 18.09 & 12.30 & 20.06 & 30.34 & 71.14 & 68.05 & 76.11 & 79.01 & 84.19 & 80.09 & 88.02 & 89.78 \\ CEN & 30.84 & 21.23 & 34.58 & 49.67 & 20.18 & 12.84 & 21.51 & 34.10 & 78.35 & 74.69 & 81.47 & 84.45 & 83.49 & 79.77 & 85.85 & 89.92 \\ GHT & 29.16 & 18.99 & 33.16 & 48.37 & 20.13 & 12.87 & 21.30 & 34.19 & 48.50 & 45.08 & 50.87 & 53.69 & 57.22 & 51.64 & 60.68 & 67.17 \\ DaeMon & 31.85 & 22.67 & 35.92 & 49.80 & 20.73 & 13.65 & 22.53 & 34.23 & 82.38 & 78.26 & 86.03 & 88.01 & 91.59 & 90.03 & 93.00 & 93.34 \\ \hline
**TiPNN** & **32.17** & **22.74** & **36.24** & **50.72** & **21.17** & **14.03** & **22.98** & **34.76** & **83.04** & **79.04** & **86.45** & **88.54** & **92.06** & **90.79** & **93.15** & **93.58** \\ \hline \hline \end{tabular}
\end{table}
Table 3. Overall Performance Comparison of Different Methods. Evaluation metrics are time-aware filtered MRR and Hits@{1,3,10}. All results are multiplied by 100. The best results are highlighted in **bold**. And the second-best results are highlighted in underline. (Higher values indicate better performance.)
temporal edges, it leverages both temporal and structural information to learn customized representations tailored to each query. This enables TiPNN to make more precise predictions for future missing facts. The impressive performance of DaeMon demonstrated its ability to model relation features effectively. However, we further enhance the integration of relation and temporal features by weakening the barriers between different time-stamped subgraphs using the constructed history temporal graph. It enables us to capture the characteristics of historical facts over a larger span of information and reduces the parameter loss caused by subgraph evolution patterns.

### Ablation Study (RQ2)

Note that TiPNN involves three main operational modules when processing query-aware temporal paths: the temporal relation encoder, the temporal edge merging operation, and the path aggregation operation. The temporal relation encoder is responsible for learning the features of temporal edges. The temporal edge merging operation is used to generate path features for each path from the query subject entity to the candidate object entity. The path aggregation module is responsible for consolidating all path features for pair-wise representations of temporal paths.

To show the impact of these components, we conducted an ablation analysis on the temporal encoder \(\Upsilon\) of temporal relation encoding and discussed the influence of temporal encoding independence on the results. We also compared three variants of the temporal edge merging operation in Tmsg(\(\cdot\)), as well as replacements for the aggregator in the path aggregation module Agg(\(\cdot\)). These comprehensive evaluations allowed us to assess the effectiveness of each component and gain insights into their respective contributions to the overall performance of TiPNN.

#### 5.3.1. Effectiveness of Temporal Relation Encoding

The temporal encoder \(\Upsilon\) plays a crucial role in modeling the temporal order of historical facts and the time factor of temporal edges in the temporal paths. Therefore, in this study, we aim to evaluate the ability of the temporal encoder in predicting future facts. To do so, we conducted an ablation analysis by removing the temporal encoder component from TiPNN and comparing its performance. The results are illustrated in Figure 4, where we present a performance comparison between TiPNN with and without the temporal encoder.

The experimental results demonstrate that when the temporal encoder is removed, the performance of TiPNN decreases across all datasets. This outcome aligns with our expectations since relying solely on the query-aware static representation from the temporal relation modeling cannot capture the temporal information of historical facts. As a consequence, the absence of the temporal encoder hinders the accurate learning of temporal features among past facts.

Furthermore, we also investigated the impact of the independence of parameters in the temporal encoder on all datasets. Specifically, we considered the parameters \(\mathbf{w}*\) and \(\mathbf{\phi}*\) in \(\Upsilon\) of Equation 10, which are responsible for modeling the temporal features of the temporal edge \((z,p_{\tau},o)\), to be independently learned for each static type \(p\). In other words, we assumed that the same relative time distance may have different temporal representations for different relation types. Thus, for each distinct edge type \(p\), we utilized a relation-aware temporal encoder to represent the temporal features for relative time distance \(\Delta\tau\). We conducted experiments on all datasets, as shown in Table 4. We use 'Shared Param.' to indicate that the parameters in \(\Upsilon\) are shared and not learned independently for each edge type \(p\), and 'Specific Param.' to indicate that the parameters are not shared and are learned independently based on the edge types.

Based on Table 4(a), we observe that using shared parameters yields better performance on the ICEWS18 and GDELT datasets. Conversely, from Table 4(b), we find that independently learning the parameters of the temporal encoder is more beneficial on the WIKI and YAGO datasets. We analyze this phenomenon and suggest that WIKI and YAGO have fewer edge types, and independently learning specific parameters for each edge type allows for easier convergence, making this approach more advantageous compared to learning shared parameters.
#### 5.3.2. Variants of Temporal Edge Merging Method

The temporal edge merging operation \(\texttt{Tmsg}(\cdot)\) utilizes the message passing mechanism to iteratively extend the path length while merging the query-relevant path information. As mentioned in Equation 6, we employ the scaling operator from DistMult (Srivastava et al., 2017) for computing the current temporal path representation with the features of temporal edges through element-wise multiplication. Additionally, we have also conducted experiments using the translation operator from TransE (Beng et al., 2019) (i.e., element-wise summation) and the rotation operator from RotatE (Rutah et al., 2019) to provide further evidence supporting the effectiveness of the temporal edge merging operation.

\begin{table}

\end{table}
Table 4. Impact of the Independence Setting of Parameters in Temporal Encoder.

Figure 4. Ablation Results on Temporal Encoding.
We conducted experimental validation and comparison on two types of knowledge graphs: the event-based graph ICEWS18 and the knowledge-based graph YAGO. Figure 5 displays the results obtained with different merging operators. The findings demonstrate that TiPNN benefits from these excellent embedding methods, performing on par with DistMult and RotatE, and outperforming TransE, particularly evident on MRR and H@1 in the knowledge-based graph YAGO.

#### 5.3.3. Variants of Path Aggregation Method

The path aggregation operation Agg\((\cdot)\) is performed after merging the temporal edges at each step, and the aggregated feature serves as the temporal path representation from the query subject entity to the object entity candidates for future fact reasoning. As mentioned in Section 4.4.2, we employ the principal neighborhood aggregation (PNA) [(5)] as the aggregator to aggregate the propagated messages. PNA aggregator considers mean, maximum, minimum, and standard deviation as aggregation features to obtain comprehensive neighbor information. To validate its effectiveness, we compare it with several individual aggregation operations: SUM, MEAN, and MAX.

Similarly, we conduct experiments on both the event-based graph ICEWS18 and the knowledge-based graph YAGO. Figure 6 illustrates the results with different aggregation methods. The findings demonstrate that TiPNN performs optimally with the PNA aggregator and performs the worst with the MEAN aggregator, consistently in both YAGO and ICEWS18, except for the H@3 and H@10 metrics on YAGO, where the differences are less pronounced.

Figure 5. Ablation Results on Temporal Edge Merging Method.

Figure 6. Ablation Results on Path Aggregation Method.
### Parameter Study (RQ3)

To provide more insights on query-aware temporal path processing, we test the performance of TiPNN with different sampling history lengths \(m\), and the number of temporal path aggregation layers \(\omega\).

#### 5.4.1. Sampling History Length

In order to comprehensively capture the interconnection patterns between entities in the historical subgraphs, we constructed a history temporal graph to learn query-aware temporal paths between entities, enabling the prediction of future missing facts. Unlike previous methods based on subgraph sequences (Kang et al., 2017)(Kang et al., 2018), we fuse multiple historical subgraphs for reasoning. However, it may lead to the inclusion of redundant edge information from different timestamps when the historical length is excessively long, resulting in unnecessary space consumption in the learning process. Moreover, facts that are far from the prediction target timestamp have minimal contribution to the prediction, even with the addition of relative distance-aware temporal encoding in the temporal relation encoder. Conversely, if the history length is too short, it can hinder the model's ability to capture cross-time features between entities, thereby reducing the modeling performance for temporal patterns in the history temporal graph. Hence, we conducted a discussion on the sampling history length to find a balance. The experimental results of the history length study are shown in Figure 7.

Since TiPNN initializes the learning of temporal paths based on the query, it requires the history temporal graph's topological structure to include as many entities as possible to ensure that the learned temporal paths from the query subject entity to each candidate object entity capture more temporal connection patterns. We present the density and interval for each dataset, as shown in Table 5, where \(|\mathcal{V}|\) denotes the number of entities in the dataset.

For WIKI and YAGO, which have longer time intervals (i.e., 1 year), each subgraph contains more factual information, and the average number of entities in each subgraph is naturally higher. As a result, these datasets demonstrate relatively stable performance across various history length settings, as shown in Figure 7(c&d). On the other hand, ICEWS18

Figure 7. The Performance of Different History Length Settings.
and GDELT datasets exhibit different behavior, as depicted in Figure 7(a&b). Their time intervals are relatively shorter compared to WIKI and YAGO. Consequently, they require longer history lengths to compensate for data sparsity and incorporate more comprehensive historical information in the history temporal graph.

To assess the impact of different history lengths on the model's performance, we calculate the ratio of \(|\mathcal{V}|\) to \(|\mathcal{V}_{avg}|\) and present it in the last row of Table 5. We observe that the model's performance tends to stabilize around this ratio, providing a useful reference for parameter tuning. Finally, we choose the balanced parameters for ICEWS18, GDELT, WIKI, and YAGO as 25, 15, 10, and 8, respectively.

#### 5.4.2. Number of Temporal Path Aggregation Layers

The temporal path aggregation layer is a fundamental computational unit in TiPNN. It operates on the constructed history temporal graph using the temporal edge merging and path aggregation operation to learn query-aware temporal path representations for future fact inference. The number of layers in the temporal path aggregation layer directly impacts the number of hops in the temporal message passing on the history temporal graph, which corresponds to the logical maximum distance of temporal paths. Therefore, setting the number of layers faces a similar challenge as determining the history length in Section 5.4.1.

When the number of layers is too high, TiPNN captures excessively long path information in temporal paths, leading to increased space consumption. However, these additional paths do not significantly improve TiPNN's performance because distant nodes connected to the target node via multiple hops are less relevant for inference of future facts. Therefore, considering distant nodes in the inference process has limited impact on the accuracy of predictions for future facts. On the other hand, if the number of layers is too low, TiPNN may not effectively capture long-distance logical connections in the history temporal graph. This may result in insufficient learning of comprehensive topological connection information and precise combination rules of temporal paths.

Figure 8. The Performance of Different Numbers of Aggregation Layers.

\begin{table}
\begin{tabular}{c|c c c c} \hline \hline Datasets & ICEWS18 & GDELT & WIKI & YAGO \\ \hline Interval & 24 hours & 15 mins & 1 year & 1 year \\ \(|\mathcal{V}|\) & 23,033 & 7,691 & 12,554 & 10,623 \\ \(|\mathcal{V}_{avg}|\) & 986.44 & 393.18 & 2,817.47 & 1,190.72 \\ \hline \(|\mathcal{V}|\) & 23.35 & 19.56 & 4.46 & 8.92 \\ \hline \hline \end{tabular}
\end{table}
Table 5. Density and Interval of Datasets (\(|\mathcal{V}_{aug}|\) is the average number of entities involved in the subgraph of each timestamp.).
To find an optimal setting for the number of layers in temporal path aggregation, we conducted experiments on ICEWS18 and YAGO as shown in Figure 8, which illustrates the results for varying the number of temporal path aggregation layers. The results indicate that ICEWS18 performs best with 6 layers, and the number of layers has a minor impact on the results. As the number of layers increases, there is no significant improvement in the model's accuracy. On the other hand, YAGO performs best with 4 layers, and beyond 4 layers, the model's performance declines noticeably. We consider that this difference in performance could be attributed to the fact that ICEWS18, as an event-based graph, involves longer-distance logical connections for inferring future facts. On the contrary, YAGO, being a knowledge-based graph, has sparser relation types, resulting in more concise reasoning paths during inference. We finally set the optimal number of layers for ICEWS18 and GDELT to 6, and 4 for WIKI and YAGO.

### Comparison on Prediction Time (RQ4)

To further analyze the efficiency of TiPNN, we compared the inference time of TiPNN with DaeMon (DaeMon, 2018) on the TKG reasoning task. For a fair comparison, we use the test sets of four datasets and align the model parameters under the same setting and environment. The runtime comparison between the two models is illustrated in Figure 9, where we present the ratio of their inference times in terms of multiples of the unit time. The comparative experiments demonstrate that TiPNN achieves significant reductions in runtime compared to DaeMon, with time savings of approximately 80%, 69%, 67%, and 73% on the ICEWS18, GDELT, WIKI, and YAGO datasets, respectively.

The efficiency of TiPNN is mainly attributed to its construction of history temporal graphs, which enables the modeling of logical features between temporal facts and the capture of semantic and temporal patterns from historical moments. In contrast, DaeMon relies on graph evolution methods to handle the potential path representations, while TiPNN employs a reduced number of message-passing layers to learn real existing path features in the history temporal graph. Additionally, TiPNN leverages temporal edges to simultaneously capture relational and temporal features, eliminating the need for separate sequence modeling units to learn temporal representations. As a result, TiPNN exhibits lower complexity and higher learning efficiency compared to DaeMon.

### Inductive Setting (RQ5)

To validate the model's inductive reasoning ability, we also design experiments for TiPNN in an inductive setting.

The inductive setting is a common scenario in knowledge graphs, where during the training process, the model can only access a subset of entities, and during testing, it needs to reason about unseen entities. This setting aims to simulate real-world situations where predictions are required for new facts based on existing knowledge. In the context of the temporal knowledge graph, the inductive setting requires the model to perform reasoning across time, meaning that the learned representations from the historical subgraphs should generalize to future timestamps for predicting

Figure 9. Runtime Comparison (The runtime is proportionally represented as multiples of the unit time.).
missing facts. This demands the model to possess the ability to generalize to unseen entities, leveraging the learned temporal connectivity patterns from the historical subgraphs.

In the inductive setting experiment, we train the model using only a portion of entities and then test its inference performance on the reasoning of the unseen entities. This type of validation allows for a comprehensive evaluation of the model's generalization and inductive reasoning capabilities, validating the effectiveness of TiPNN in predicting future missing facts.

In the context of TKGs, there are few existing datasets suitable for inductive validation. Therefore, we follow the rules commonly used in KG for inductive settings and construct an inductive dataset specifically tailored for TKGs (Krishnan et al., 2017). Finally, we conduct experiments on our proposed model using the inductive dataset to evaluate its inference performance under the inductive setting.

#### 5.6.1. Inductive Datasets

In order to facilitate the inductive setting, we create a fully-inductive benchmark dataset by sampling disjoint entities from the YAGO dataset (Krishnan et al., 2017). Specifically, the inductive dataset consists of a pair of TKGs: YAGO\({}^{1}\) and YAGO\({}^{2}\), satisfying the following conditions: (i) they have non-overlapping sets of entities and (ii) they share the same set of relations. To provide a comprehensive evaluation, we have sampled three different versions of the pair inductive dataset based on varying proportions of entity set cardinality. Table 6 provides the statistical data for these inductive datasets, where \(|\mathcal{V}|\) denotes the number of entities in the dataset, \(|\mathcal{R}|\) denotes the number of relations in the dataset. The labels v1(5:5), v2(6:4), and v3(7:3) in the table correspond to the three different datasets created with different entity set partition ratios.

#### 5.6.2. Results of Inductive Experiment

In the Inductive setting, we conduct inference experiments and validations by cross-utilizing the training and test sets of a pair of TKGs: YAGO\({}^{1}\) and YAGO\({}^{2}\). Specifically, we train on the training set of YAGO\({}^{1}\) and test on the test set of YAGO\({}^{2}\), and vice versa, to achieve cross-validation in each version of the dataset. Additionally, we include experimental results in the transductive setting as a baseline for comparison with the inductive setting. We used 'bias' to display the difference in results between the two settings. As shown in Table 7, the experimental results demonstrate that the bias is within a very small range.

The success of TiPNN in handling the Inductive setting is not surprising. This is because TiPNN models the structural semantics and temporal features of historical facts without relying on any learnable entity-related parameters. Instead, it leverages temporal edge features to model temporal path features relevant to the query. This inherent capability of TiPNN allows it to naturally perform inference on datasets that include unseen entities, making it well-suited for the inductive setting.

\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multicolumn{2}{c}{Datasets} & \(|\mathcal{V}|\) & \(|\mathcal{R}|\) & \(\mathcal{E}_{train}\) & \(\mathcal{E}_{valid}\) & \(\mathcal{E}_{test}\) & Interval \\ \hline \multirow{2}{*}{v1 (5:5)} & YAGO\({}^{1}\) & 3,980 & 10 & 39,588 & 4,681 & 6,000 & 1year \\  & YAGO\({}^{2}\) & 3,963 & 10 & 37,847 & 4,544 & 5,530 & 1year \\ \hline \multirow{2}{*}{v2 (6:4)} & YAGO\({}^{1}\) & 4,590 & 10 & 46,070 & 5,685 & 5,904 & 1year \\  & YAGO\({}^{2}\) & 3,293 & 10 & 33,091 & 4,836 & 4,244 & 1year \\ \hline \multirow{2}{*}{v3 (7:3)} & YAGO\({}^{1}\) & 5,705 & 10 & 64,036 & 7,866 & 9,663 & 1year \\  & YAGO\({}^{2}\) & 2,407 & 10 & 20,884 & 2,545 & 3,180 & 1year \\ \hline \hline \end{tabular}
\end{table}
Table 6. Statistics of Inductive Datasets (\(\mathcal{E}_{train}\), \(\mathcal{E}_{valid}\), \(\mathcal{E}_{test}\) are the numbers of facts in training, validation, and test sets.).
### Reasoning Evidence (RQ6)

Since we have integrated historical information into the constructed history temporal graph and perform inference on future facts by modeling temporal paths, we can use the path in the history temporal graph to provide evidence for the inference process and visualize the reasoning basis. An intuitive idea is that the model should provide important reasoning paths from the history temporal graph that contribute significantly to the inference for the corresponding response. Although the temporal path representation we obtain is a comprehensive representation logically aggregated from multiple paths in the history temporal graph, we can still estimate the importance of each individual path following the local interpretation method (Beng et al., 2017)(Wang et al., 2017). As described in Section 4.5.1, we convert the learned temporal path representation into corresponding scores, and thus, we can estimate the importance of paths through backtracking.

Drawing inspiration from path interpretation (Wang et al., 2017), we define the importance of a path as the weights assigned to it during the iteration process. We achieve this by computing the partial derivative of the temporal path scores with respect to the path's weights. Specifically, for a reasoning response \((s,r,o,t+1)\) of a missing object query \((s,r,?,t+1)\), we consider the top-k paths as the basis for inference, which is defined as shown in Equation 16.

\[\begin{split}\text{P}_{1},\text{P}_{2},\cdots,\text{P}_{k}= \underset{\text{P}\in\mathcal{P}^{-\mathcal{L}+1}_{s\to\infty}}{\text{Top-}k} \ \frac{\partial\ p(s,r,o)}{\partial\ P}\end{split} \tag{16}\]

In practice, since directly computing the importance of an entire path is facing a challenge, we calculate the importance of each individual temporal edge in the history temporal graph, which can be obtained using automatic differentiation. And then, we aggregate the importance of temporal edges with a summation operation within each path to determine the corresponding path's importance. By applying beam search to traverse and compute the importance of each path, we can finally obtain the top-k most important paths as our reasoning evidence.

We selected several queries from the test set of event-based graph ICEWS18 to conduct an analysis and discussion of the reasoning evidence. As shown in Table 8, it presents the responses corresponding to these queries and their top-\(2\) related reasoning evidence. Here, we provide our analysis and interpretation of the reasoning evidence for the first three queries. (I) For the first query (_Shinzo Abe, Make a visit,?, 10/23/2018_), TiPNN's response is China. The most significant reasoning clue is that Shinzo Abe expressed intent to meet or negotiate on 10/22/2018. Additionally, on 10/21/2018, there was also an expression of intent to meet or negotiate, followed by the action of _Make a visit_ on 10/22/2018. These two clues are logically consistent and form a reasoning pathway: _Express intent to meet or negotiate \(\rightarrow\) Make a visit_. (II) For the query (_European Union, Engage in diplomatic cooperation,?, 10/23/2018_), the response is United Kingdom.

\begin{table}
\begin{tabular}{c|c c c c|c c c c|c c c c} \hline \hline Dataset & \multicolumn{4}{c|}{v1} & \multicolumn{4}{c|}{v2} & \multicolumn{4}{c}{v3} \\  & MRR & H@1 & H@3 & H@10 & MRR & H@1 & H@3 & H@10 & MRR & H@1 & H@3 & H@10 \\ \hline YAGO\({}^{1}\) & 90.85 & 89.31 & 92.10 & 92.58 & 91.19 & 89.79 & 92.35 & 92.73 & 91.67 & 90.46 & 92.72 & 93.09 \\ YAGO\({}^{2}\)\(\rightarrow\)YAGO\({}^{1}\) & 90.75 & 89.09 & 92.11 & 92.64 & 91.07 & 89.60 & 92.27 & 92.73 & 91.19 & 89.58 & 92.62 & 92.94 \\ Bias \((\pm)\) & \multicolumn{4}{c|}{\(\leq\) 0.22} & \multicolumn{4}{c|}{\(\leq\) 0.19} & \multicolumn{4}{c}{\(\leq\) 0.88} \\ \hline YAGO\({}^{2}\) & 91.33 & 89.83 & 92.61 & 93.02 & 92.88 & 91.61 & 93.93 & 94.27 & 90.66 & 89.22 & 91.70 & 92.43 \\ YAGO\({}^{1}\)\(\rightarrow\)YAGO\({}^{2}\) & 91.15 & 89.47 & 92.65 & 93.07 & 92.88 & 91.63 & 93.90 & 94.36 & 90.96 & 89.66 & 91.95 & 92.63 \\ Bias \((\pm)\) & \multicolumn{4}{c|}{\(\leq\) 0.36} & \multicolumn{4}{c|}{\(\leq\) 0.09} & \multicolumn{4}{c}{\(\leq\) 0.44} \\ \hline \hline \end{tabular}
\end{table}
Table 7. Inductive Performance of TiPNN (\(\rightarrow\) points from training set to test set corresponding to the inductive setting, and the row results without arrow marked is the corresponding transductive setting as the baseline. ‘Bias’ denotes represents the difference in comparison.).
One of the reasoning clues is that on 10/14/2018, European Union engaged in diplomatic cooperation with the United Kingdom, and on 10/22/2018 (the day before the query time), European Union expressed intent to engage in diplomatic cooperation with the United Kingdom. This is easily understandable as it follows a logical reasoning pathway: _Express intent to engage in diplomatic cooperation -> Engage in diplomatic cooperation._ (III) For the query _(Russia, Host a visit,?, 10/24/2018)_, the response is Head of Government (Italy). One reliable reasoning clue is that on 10/23/2018, Russia was visited by the Head of Government (Italy). This is also not surprising, as it follows a logical reasoning pathway: _Make a visit\({}^{-1}\)\(\sim\) Host a visit_, which is in line with common sense rules.

\begin{table}
\begin{tabular}{r l} \hline \hline
**Query:** & **(Shinzo Abe, Make a visit,?, 10/23/2018)** \\
**Response:** & China \\ \hline
0.784 & \textless{}Shinzo Abe, Express intent to meet or negotiate, China, 10/22/2018\textgreater{}. \\
0.469 & \textless{}Shinzo Abe, Express intent to meet or negotiate, Li Keqiang, 10/21/2018\textgreater{}\
Through these examples of reasoning evidence, we can observe that TiPNN is capable of learning temporal reasoning logic from the constructed history temporal graphs. These reasoning clues provide users with more comprehensible inference results and intuitive evaluation criteria. One can utilize these clues to understand the reasoning process for future temporal facts, thereby increasing confidence in the inference results and enabling potential refinements or improvements when needed.

## 6. Conclusion

In this work, we have introduced TiPNN, an innovative query-aware temporal path reasoning model for TKGs reasoning tasks, addressing the challenge of predicting future missing temporal facts under the temporal extrapolated setting.

First, we presented a unified graph, namely the history temporal graph, which represents the comprehensive features of the historical context. This constructed graph allows for more comprehensive utilization of interactions among entities at different historical instances and the temporal feature between historical facts during graph representation learning. Second, we introduced a novel concept of temporal paths, designed to capture query-relevant logical semantic paths on the history temporal graph, which can provide rich structural and temporal context for reasoning tasks. Third, a query-aware temporal path processing framework was also designed, integrated with the introduced temporal edge merging and path aggregation functions. It enables the modeling of temporal path features over the history temporal graph for future temporal fact reasoning.

Overall, the proposed model avoids the need for separate graph learning on each temporal subgraph, making use of the unified graph to represent the information of historical feature to enhance the efficiency of the reasoning process. By starting from the query, capturing and learning over query-aware temporal paths, TiPNN accounts for both structural information and temporal dependencies between entities of separate subgraphs in historical context, and achieves the prediction of future missing facts while offering interpretable reasoning evidence that facilitates users' analysis of results and model fine-tuning. Besides, in learning historical patterns, the modeling process adopts an entity-independent manner, that means TiPNN doesn't rely on specific entity representations, enabling it to naturally handle TKG reasoning tasks under the inductive setting.

We have conducted extensive experiments on TKG reasoning benchmark datasets to evaluate the performance of TiPNN. The results demonstrate that the proposed model exhibits superior effectiveness and attains new state-of-the-art achievements.
