T OWARDS O PEN T EMPORAL G RAPH N EURAL N ETWORKS
A BSTRACT
Graph neural networks (GNNs) for temporal graphs have recently attracted increasing attentions, where a common assumption is that the class set for nodes is closed.
However, in real-world scenarios, it often faces the open set problem with the dynamically increased class set as the time passes by.
This will bring two big challenges to the existing temporal GNN methods: (i) How to dynamically propagate appropriate information in an open temporal graph, where new class nodes are often linked to old class nodes.
This case will lead to a sharp contradiction.
This is because typical GNNs are prone to make the embeddings of connected nodes become similar, while we expect the embeddings of these two interactive nodes to be distinguishable since they belong to different classes.
(ii) How to avoid catastrophic knowledge forgetting over old classes when learning new classes occurred in temporal graphs.
In this paper, we propose a general and principled learning approach for open temporal graphs, called OTGNet with the goal of addressing the above two challenges.
We assume the knowledge of a node can be disentangled into class-relevant and class-agnostic one
, and thus explore a new message passing mechanism by extending the information bottleneck principle to only propagate class-agnostic knowledge between nodes of different classes, avoiding aggregating conflictive information.
Moreover, we devise a strategy to select both important and diverse triad sub-graph structures for effective class-incremental learning.
Extensive experiments on three real-world datasets of different domains demonstrate the superiority of our method
, compared to the baselines.
I NTRODUCTION
Temporal graph (Nguyen et al., 2018) represents a sequence of time-stamped events (e.g. addition or deletion for edges or nodes) (Rossi et al., 2020), which is a popular kind of graph structure in variety of domains such as social networks (Kleinberg, 2007), citations networks (Feng et al., 2022), topic communities (Hamilton et al., 2017), etc.
For instance, in topic communities, all posts can be modelled as a graph, where each node represents one post.
New posts can be continually added into the community, thus the graph is dynamically evolving.
In order to handle this kind of graph structure, many methods have been proposed in the past decade (Wang et al., 2020b; Xu et al., 2020;
Rossi et al., 2020;
Nguyen et al., 2018; Li et al., 2022).
The key to success for these methods is to learn an effective node embedding by capturing temporal patterns based on time-stamped events.
A basic assumption among the above methods is that the class set of nodes is always closed, i.e., the class set is fixed as time passes by.
However, in many real-world applications, the class set is open.
We still take topic communities as an example, all the topics can be regarded as the class set of nodes for a post-to-post graph.
When a new topic is created in the community, it means a new class is involved into the graph.
This will bring two challenges to previous approaches: The first problem is the heterophily propagation issue.
In an open temporal graph, a node belonging to a new class is often t1 t2 t t4 t5 t6 t1 t2 t t4 t5 t6 t7 t10 t11 t13 t8 t9 t12 t14 t15 t16 t8 t9 t12 t14 t15 t
Task 1 Task 2 Task 3 Task 1 Task 2 Task
Task 1 Taskclass 1 class 1 class 2 class 2 class 3 class 3 class 4 class 4 0 t
Task 1 Task
Task 1 Taskclass 1 classclass 2 classclass 3 classclass 4 class0 t Task 1 Task0 t class 1 classclass 2 classclass 3 classclass 4 class
[Figure]
Task Task
[Figure]
Task
Task 2t class 1 classclass 2 class
[Figure]
linked to a node of old class, as shown in Figure 1.
In Figure 1, ‘class 2’ is a new class, and ‘class 1’ is an old class.
There is a link occured at timestamp t 4 connecting two nodes v 4 and v 5 , where v 4 and vbelong to different classes.
Such a connection will lead to a sharp contradiction.
This is because typical
GNNs are prone to learn similar embeddings for vand v 5 due to their connection (Xie et al., 2020; Zhu et al., 2020), while we expect the embeddings of vand v 5 to be distinguishable since they belong to different classes.
We call this dilemma as heterophily propagation.
Someone might argue that we can simply drop those links connecting different class nodes.
However, this might break the graph structure and lose information.
Thus, how and what to transfer between connected nodes of different classes remains a challenge for open temporal graph.
The second problem is the catastrophic forgetting issue.
When learning a new class in an open temporal graph, the knowledge of the old class might be catastrophically forgot, thus degrading the overall performance of the model.
In the field of computer vision, many incremental learning methods have been proposed (Wu et al., 2019; Tao et al., 2020), which focus on convolutional neural networks (CNNs) for non-graph data like images.
If simply applying these methods to graph-structured data by individually treating each node, the topological structure and the interaction between nodes will be ignored.
Recently, Wang et al.
(2020a)
; Zhou & Cao (2021) propose to overcome catastrophic forgetting for graph data.
However, They focus on static graph snapshots, and utilize static GNN for each snapshot, thus largely ignoring fine-grained temporal topological information.
In this paper, we put forward the first class-incremental learning approach towards open temporal dynamic graphs, called OTGNet.
To mitigate the issue of heterophily propagation, we assume the information of a node can be disentangled into class-relevant and class-agnostic one.
Based on this assumption, we design a new message passing mechanism by resorting to information bottleneck (Alemi et al., 2016) to only propagate class-agnostic knowledge between nodes of different classes.
In this way, we can well avoid transferring conflictive information.
To prevent catastrophic knowledge forgetting over old classes, we propose to select representative sub-graph structures generated from old classes, and incorporate them into the learning process of new classes.
Previous works (Zhou et al., 2018; Zignani et al., 2014; Huang et al., 2014) point out triad structure (triangle-shape structure) is a fundamental element of temporal graph and can capture evolution patterns.
Motivated by this, we devise a value function to select not only important but also diverse triad structures, and replay them for continual learning.
Due to the combinational property, optimizing the value function is
NP-hard.
Thus, we develop a simple yet effective algorithm to find its approximate solution, and give a theoretical guarantee to the lower bound of the approximation ratio.
It is worth noting that our message passing mechanism and triad structure selection can benefit from each other.
On the one hand, learning good node embeddings by our message passing mechanism is helpful to select more representative triad structure.
On the other hand, selecting representative triads can well preserve the knowledge of old classes and thus is good for propagating information more precisely.
Our contributions can be summarized as : 1)
Our approach constitutes the first attempt to investigate open temporal graph neural network; 2) We propose a general framework, OTGNet, which can address the issues of both heterophily propagation and catastrophic forgetting; 3) We perform extensive experiments and analyze the results, proving the effectiveness of our method.
R ELATED W ORK
Dynamic GNNs can be generally divided into two groups (Rossi et al., 2020) according to the characteristic of dynamic graph: discrete-time dynamic GNNs (Zhou et al., 2018;
Goyal et al., 2018;
Wang et al., 2020a) and continuous-time dynamic GNNs (a.k.a.
temporal GNNs (Nguyen et al., 2018))
(Rossi et al., 2020; Trivedi et al., 2019).
Discrete-time approaches focus on discrete-time dynamic graph that is a collection of static graph snapshots taken at intervals in time, and contains dynamic information at a very coarse level.
Continuous-time approaches study continuous-time dynamic graph that represents a sequence of time-stamped events, and possesses temporal dynamics at finer time granularity.
In this paper, we focus on temporal GNNs.
We first briefly review related works on temporal GNNs, followed by class-incremental learning.
Temporal GNNs.
In recent years, many temporal GNNs (Kumar et al., 2019; Wang et al., 2021a;
Trivedi et al., 2019) have been proposed.
For instance, DyRep (Trivedi et al., 2019) took the advantage of temporal point process to capture fine-grained temporal dynamics.
CAW (Wang et al., 2021b) retrieved temporal network motifs to represent the temporal dynamics.
TGAT (Xu et al., 2020) proposed a temporal graph attention layer to learn temporal interactions.
Moreover, TGN (Rossi et al., 2020) proposed an efficient model that can memorize long term dependencies in the temporal graph.
However, all of them concentrate on closed temporal graphs, i.e., the class set is always kept unchanged, neglecting that new classes can be dynamically increased in many real-world applications.
Class-incremental learning.
Class-incremental learning have been widely studied in the computer vision community (Li & Hoiem, 2017; Wu et al., 2019).
For example, EWC (Kirkpatrick et al., 2017) proposed to penalize the update of parameters that are significant to previous tasks.
iCaRL (Li & Hoiem, 2017) maintained a memory buffer to store representative samples for memorizing the knowledge of old classes and replaying them when learning new classes.
These methods focus on
CNNs for non-graph data like images.
It is obviously not suitable to directly apply them to graph data.
Recently, a few incremental learning works have been proposed for graph data (Wang et al., 2020a;
Zhou & Cao, 2021).
ContinualGNN (Wang et al., 2020a) proposed a method for closed discrete-time dynamic graph, and trained the model based on static snapshots.
ER-GAT (Zhou & Cao, 2021) selected representative nodes for old classes and replay them when learning new tasks.
Different from them studying discrete-time dynamic graph, we aim to investigate open temporal graph.
P ROPOSED M ETHOD 3. P RELIMINARIES
Notations.
Let G ( t ) =
{V ( t ) , E ( t ) } denote a temporal graph at time-stamp t , where V ( t ) is the set of existing nodes at t , and E ( t ) is the set of existing temporal edges at t .
Each element e ij ( t k ) ∈
E ( t ) represents node i and node j are linked at time-stamp t k ( t k ≤ t ) .
Let N i ( t ) be the neighbor set of node i at t .
We assume x i ( t ) denotes the embedding of node i at t , where x i (0) is the initial feature of node i .
Let Y ( t ) =
{ 1 , 2 , · · · , m ( t ) } be the class set of all nodes at t , where m ( t ) denotes the number of existing classes until time t .
Problem formulation.
In our open temporal graph setting, as new nodes are continually added into the graph, new classes can occur, i.e., the number m ( t ) of classes is increased and thus the class set Y ( t ) is open, rather than a closed one like traditional temporal graph.
Thus, we formulate our problem as a sequence of class-incremental tasks T
= {T 1 , T 2 , · · · , T L , · · · } in chronological order.
Each task T i contains one or multiple new classes which are never seen in previous tasks {T 1 , T 2 , · · · , T i − 1 } .
In our new problem setting, the goal is to learn an open temporal graph neural network based on current task T i , expecting our model to not only perform well on current task but also prevent catastrophic forgetting over previous tasks.
3. F RAMEWORK
[Table]
Task Task Task
Task
Task Task interactions in interactions in interactions in interactions in memory buffer memory buffer memory buffer
Information Bottleneck Based
Message Passing Module
Information Bottleneck Based
Message Passing Module
Information Bottleneck Based
Message Passing Module
Sub-graph Structure Selection Module learning task learning task Sub-graph Structure Selection For Sub-graph Structure Selection For learning task learning task learning task Sub-graph Structure Selection For learning task representative s ub- graph structures of old classes representative s ub- graph structures of old classes interactions of task interactions of task
Information Bottleneck Based
Message Passing Module learning task Sub-graph Structure Selection For learning task representative s ub- graph structures of old classes interactions of task
Information Bottleneck Based
Message Passing Module
Task Task Task
Task Task Task
[Figure]
learning in task learning in task
[Figure]
As aforementioned, there are two key challenges in open temporal graph learning: heterophily propagation and catastrophic forgetting.
To address the two challenges, we propose a general framework,
OTGNet, as illustrated in Figure 2.
Our framework mainly includes two modules : A knowledge preservation module is devised to overcome catastrophic forgetting, which consists of two components: a triad structure selection component is devised to select representative triad structures; a triad structure replay component is designed for replaying the selected triads to avoid catastrophic forgetting.
An information bottleneck based message passing module is proposed to propagate class-agnostic knowledge between different class nodes, which can address the heterophily propagation issue.
Next, we will elaborate each module of our framework.
3. K NOWLEDGE P RESERVATION OVER O LD C LASS
When learning new classes based on current task T i , it is likely for the model to catastrophically forget knowledge over old classes from previous tasks.
If we combine all data of old classes with the data of new classes for retraining, the computational complexities will be sharply increased, and be not affordable.
Thus, we propose to select representative structures from old classes to preserve knowledge, and incorporate them into the learning process of new classes for replay.
Triad Structure Selection.
As previous works (Zhou et al., 2018; Zignani et al., 2014; Huang et al., 2014) point out, the triad structure is a fundamental element of temporal graph and its triad closure process could demonstrate the evolution patterns.
According to Zhou et al.
(2018), the triads have two types of structures: closed triad and open triad, as shown in Figure 3.
A closed triad consists of three vertices connected with each other, while an open triad has two of three vertices not connected with each other.
The closed triad can be developed from an open triad, and the triad closure process is able to model the evolution patterns (Zhou et al., 2018).
Motivated by this point, we propose a new strategy to preserve the knowledge of old classes by selecting representative triad structures from old classes.
However, how to measure the ‘representativeness’ of each triad, and how to select some triads to represent the knowledge of old classes have been not explored so far.
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
To write conveniently, we omit t for all symbols in this section.
Without loss of generality, we denote a closed triad for class k as
g ck =
( v s , v p , v q ) , where all of three nodes v s , v p , v q belong to class k and v s , v p , v q are pairwise connected, i.e., e sp ( t i ) , e sq ( t j ) , e pq ( t l ) ∈
E ( t m ) and t i , t j < t l , t m is the last time-stamp of the graph.
We denote an open triad for class k as g ok
=
( v ˜ s , v ˜ p , v ˜ q ) with v ˜ p and v ˜ q not linked to each other in the last observation of the graph, i.e., e ˜ s ˜ p ( t i ) , e ˜ s ˜ q ( t j ) ∈
E ( t m ) and e ˜ p ˜ q / ∈ E ( t m ) .
Assuming S
ck =
{ g ck, 1 , g ck, 2 , ..., g ck,M } and
S ok
= { g ok, 1 , g ok, 2 , ..., g ok,M } is the selected closed triad set and open triad set for class k , respectively.
M is the memory budget for each class.
Next, we introduce how to measure and select closed triads S ck .
It is analogous to open triads S ok .
In order to measure the ‘representativeness’ of each triad, one intuitive and reasonable thought is to see how the performance of the model is affected if removing this triad from the graph.
However, if we retrain the model once one triad is removed, the time cost is prohibitive.
Inspired by the influence function aiming to estimate the parameter changes of the machine learning model when removing a training sample (Koh & Liang, 2017), we extend the influence function to directly estimate the ‘representativeness’ of each triad structure without retraining, and propose an objective function as:
[Equation]
where L represents the loss function, e.g., cross-entropy used in this paper.
θ is the parameter of the model, and G k is the node set of class k .
θ ε,g ck is the retrained parameter if we upweight three nodes in g ck by ε ( ε → 0) during training.
ε is a small weight added on the three nodes of the triad g ck in the loss function L .
H θ is the Hessian matrix.
∇ θ L ( g ck , θ ) , ∇ θ L ( G k , θ ) are the gradients of the loss to g ck and G k , respectively.
The full derivation of Eq.
(1) is in Appendix A.2.
In Eq.
(1), I loss ( g ck , θ ) estimates the influence of the triad g ck on the model performance for class k .
The more negative I loss ( g ck , θ ) is, the more positive influence on model performance g ck provides, in other words, the more important g ck is.
Thus, we define the ‘representativeness’ of a triad structure as:
[Equation]
In order to well preserve the knowledge of old classes, we expect all g ck in S ck are important, and propose the following objective function to find S c k :
[Equation]
During optimizing (3), we only take the triad g ck,i with positive R ( g ck,i ) as the candidate, since g ck,i with negative R ( g c k,i ) can be thought to be harmful to the model performance.
We note that only optimizing (3) might lead to that the selected g ck,i have similar functions.
Considering this, we hope
S ck should be not only important but also diverse.
To do this, we first define:
[Equation]
where ¯ x ( g ck,j ) denotes the average embedding of three vertices in g ck,j .
N ck denotes all positive closed triad set for class k , and δ is a similar radius.
C ( g ck,i ) measures the number of g ck,j , where the distance of ¯ x ( g ck,j ) and ¯ x ( g ck,i ) is less or equal to δ .
To make the selected triads S ck diverse, we anticipate that {C ( g ck, 1 ) , · · · , C ( g ck,M ) } can cover different triads as many as possible by:
[Equation]
Finally, we combine (5) with (3), and present the final objective function for triad selection as:
[Equation]
where γ is a hyper-parameter.
By (6), we can select not only important but also diverse triads to preserve the knowledge of old classes.
Due to the combinatorial property, solving (6) is NP-hard.
Fortunately, we show that F ( S ck ) satisfies the condition of monotone and submodular.
The proof can be found in Appendix A.3.
Based on this property, (6) could be solved by a greedy algorithm (Pokutta et al., 2020) with an approximation ratio guarantee, by the following Theorem 1 (Krause & Golovin, 2014).
Input: all triads N ck for class k , budget M ;
Output: representative triad set S ck ; 1: Initialize S ck
= ∅ ; 2: while | S ck | <
M do 3: u = argmax u ∈ N ck \ S ck F
( S ck ∪ { u } ) ; 4:
S ck
= S ck ∪ u ; 5: end while 6: return S ck
Theorem 1.
Assuming our value function F : 2 N → R + is monotone and submodular.
If S ck ∗ is an optimal triad set and S ck is a triad set selected by the greedy algorithm (Pokutta et al., 2020), then F ( S ck ) ≥ (1 −e ) F ( S ck ∗ ) holds.
By Theorem 1, we can greedily select closed triads as in Algorithm 1.
As aforementioned, the open triad set
S ok can be chosen by the same method.
The proof of
Theorem 1 can be found in Krause & Golovin (2014).
An Acceleration Solution.
We first provide the time complexity analysis of triad selection.
When counting the triads for class k , we first enumerate the edge that connects two nodes v s and v d of class c .
Then, for each neighbor node of v s that belongs to class k , we check whether this neighbor node links to v d .
If this is the case and the condition of temporal order is satisfied, these three nodes form a closed triad, otherwise these three nodes form an open triad.
Thus, a rough upper bound of the number of closed triad in class k is O ( d k |E k | ) , where |E k | is the number of edges between two nodes of class k , and d k is the max degree of nodes of class k .
When selecting closed triads, finding a closed triad that maximizes the value function takes O ( | N ck | 2 ) , where | N ck | is the number of positive closed triads in class k .
Thus, it is of order O
( M
N ck set S ck , where M is the
To accelerate the selection process, a natural idea is to reduce N ck by only selecting closed triads from g ck with large values of R ( g ck ) .
Specifically, we sort the closed triad g ck based on R ( g ck ) , and use the top- K ones as the candidate set N ck for selection.
The way for selecting open triads is the same.
Triad Structure Replay.
After obtaining representative closed and open triad sets, S ck and S ok , we will replay these triads from old classes when learning new classes, so as to overcome catastrophic forgetting.
First, we hope the model is able to correctly predict the labels of nodes from the selected triad set, and thus use the cross entropy loss L ce for each node in the selected triad set.
Moreover, as mentioned above, the triad closure process can capture the evolution pattern of a dynamic graph.
Thus, we use the link prediction loss L link to correctly predict the probability whether two nodes are connected based on the closed and open triads, to further preserve knowledge:
[Equation]
where N c , N o are the number of closed, open triads respectively, where N c = N o = N t ∗ M .
N t is the number of old classes.
σ is the sigmoid function.
x ip ( t ) , x iq ( t ) are the embeddings of v p , v q of the i th closed triad.
˜ x ip ( t ) , ˜ x iq ( t ) are the embeddings of v ˜ p , v ˜ q of the i th open triad.
Here the closed triads and open triads serve as postive samples and negative samples, respectively.
3. M ESSAGE P ASSING VIA I NFORMATION B OTTLENECK
When new class occurs, it is possible that one edge connects one node of the new class and one node of an old class, as shown in Figure 1.
To avoid aggregating conflictive knowledge between nodes of different classes, one intuitive thought is to extract class-agnostic knowledge from each node, and transfer the class-agnostic knowledge between nodes of different classes To do this, we extend the information bottleneck principle to obtain a class-agnostic representation for each node.
Class-agnostic Representation.
Traditional information bottleneck aims to learn a representation that preserves the maximum information about the class while has minimal mutual information with the input (Tishby et al., 2000).
Differently, we attempt to extract class-agnostic representations from an opposite view, i.e., we expect the learned representation has minimum information about the class, but preserve the maximum information about the input.
Thus, we propose an objective function as:
[Equation]
(8) where β is the Lagrange multiplier.
I ( · , · ) denotes the mutual information.
X ( t ) , Z ( t ) are the random variables of the node embeddings and class-agnostic representations at time-stamp t .
Y is the random variable of node label.
In this paper, we adopt a two-layer MLP for mapping X ( t ) to Z ( t ) .
However, directly optimizing (8) is intractable.
Thus, we utilize CLUB (Cheng et al., 2020) to estimate the upper bound of I ( Z ( t ) , Y ) and utilize MINE (Belghazi et al., 2018) to estimate the lower bound of I ( Z ( t ) , X ( t )) .
Thus, the upper bound of our objective could be written as:
[Equation]
where z ( t ) , x ( t ) , y are the instances of Z ( t ) , X ( t ) , Y respectively.
T ψ : X × Z → R is a neural network parametrized by ψ .
Since p ( y | z ( t )) is unknown, we introduce a variational approximation q µ ( y | z ( t )) to approximate p ( y | z ( t )) with parameter µ .
By minimizing this upper bound L IB , we can obtain an approximation solution to Eq.
The derivation of formula (9) is in Appendix A.1.
It is worth noting that z i ( t ) is an intermediate variable as the class-agnostic representation of node i .
We only use z i ( t ) to propagate information to other nodes having different classes from node i .
If one node j has the same class with node i , we still use x i ( t ) for information aggregation of node j , so as to avoid losing information.
In this way, the heterophily propagation issue can be well addressed.
Message Propagation.
In order to aggregate temporal information and topological information in temporal graph, many information propagation mechanism have been proposed (Rossi et al., 2020;
Xu et al., 2020).
Here, we extend a typical mechanism proposed in TGAT (Xu et al., 2020), and present the following way to learn the temporal attention coefficient as:
[Equation]
where Φ is a time encoding function proposed in TGAT.
|| represents the concatenation operator.
W p and W q are two learnt parameter matrices.
t i is the time of the last interaction of node i .
t j is the time of the last interaction between node i and node j .
t l is the time of the last interaction between node i and node l .
Note that we adopt different h l ( t ) from that in the original TGAT, defined as:
[Equation]
where h l ( t ) is the message produced by neighbor node l ∈ N i ( t ) .
If node l and i have different classes, we leverage its class-agnostic representation z l ( t ) for information aggregation of node i , otherwise we directly use its embedding x l ( t ) for aggregating.
Note that our method supports multiple layers of network.
We do not use the symbol of the layer only for writing conveniently.
Finally, we update the embedding of node i by aggregating the information from its neighbors:
[Equation]
where W h is a learnt parameter matrix for message aggregation.
3. O PTIMIZATION
During training, we first optimize the information bottleneck loss L IB .
Then, we minimize L =
L ce + ρ L link , where ρ is the hyper-parameter and L ce is the node classification loss over both nodes of new classes and that of the selected triads.
We alternatively optimize them until convergence.
The detailed training procedure and pseudo-code could be found in Appendix A.5.
In testing, we extract an corresponding embedding of a test node by assuming its label to be the one that appears the most times among its neighbor nodes in the training set, due to referring to extracting class-agnostic representations.
After that, we predict the label of test nodes based on the extracted embeddings.
E XPERIMENTS 4. E XPERIMENT S ETUP
[Table]
Datasets.
We construct three real-world datasets to evaluate our method: Reddit (Hamilton et al., 2017),
Yelp (Sankar et al., 2020), Taobao (Du et al., 2019).
In Reddit, we construct a post-to-post graph.
Specifically, we treat posts as nodes and treat the subreddit (topic community) a post belongs to as the node label.
When a user comments two posts with the time interval less or equal to a week, a temporal edge between the two nodes will be built.
We regard the data in each month as a task, where July to
December in 2009 are used.
In each month, we sample 3 large communities that do not appear in previous months as the new classes.
For Yelp dataset, we construct a business-to-business temporal graph from 2015 to 2019 in the same way as Reddit.
For Taobao dataset, we construct an item-to-item graph in the same way as Reddit in a 6-days promotion season of Taobao.
Table 1 summarizes the statistics of these datasets.
More information about datasets could be found in Appendix A.4.
Experiment Settings.
For each task, we use 80% nodes for training, 10% nodes for validation, 10% nodes for testing.
We use two widely-used metrics in class-incremental learning to evaluate our method (Chaudhry et al., 2018; Bang et al., 2021): AP and AF.
Average Performance (AP) measures the average performance of a model on all previous tasks.
Here we use accuracy to measure model performance.
Average Forgetting (AF) measures the decreasing extent of model performance on previous tasks compared to the best ones.
More implementation details is in Appendix A.6.
Baselines.
First, we compare with three incremental learning methods based on static GNNs: ERGAT (Zhou & Cao, 2021), TWC-GAT (Liu et al., 2021) and ContinualGNN (Wang et al., 2020a).
For ER-GAT and TWC-GAT, we use the final state of temporal graph as input in each task.
Since
ContinualGNN is based on snapshots, we split each task into 10 snapshots.
In addition, we combine three representative temporal GNN (TGAT (Xu et al., 2020), TGN (Rossi et al., 2020), TREND (Wen & Fang, 2022)) and three widely-used class-incremental learning methods in computer vision (EWC (Kirkpatrick et al., 2017), iCaRL (Rebuffi et al., 2017), BiC (Wu et al., 2019)) as baselines.
For our method, we set M as 10 on all the datasets.
4. R ESULTS AND A NALYSIS
Overall Comparison.
As shown in Table 2, our method outperform other methods by a large margin.
The reasons are as follows.
For the first three methods, they are all based on static GNN that can not capture the fine-grained dynamics in temporal graph.
TGN, TGAT and TREND are three dynamic
GNNs with fixed class set.
When applying three typical class-incremental learning methods to TGN,
[Table]
[Figure]
TGAT and TREND, the phenomenon of catastrophic forgetting is alleviative.
However, they still suffer from the issue of heterophily propagation.
Performance Analysis of Different Task Numbers.
To provide further analysis of our method, we plot the performance changes of different methods along with the increased tasks.
As shown in Figure 4, our method generally achieves better performance than baselines as the task number increases.
Since BiC based methods achieve better performance based on Table 2, we do not report the results of the other two incremental learning based methods.
In addition, the curves of OTGNet are smoother that those of other methods, which indicates our method can well address the issue of catastrophic forgetting.
Because of space limitation, we provide the curves of AF in Appendix A.7.
Ablation Study of our proposed propagation mechanism.
We further study the effectiveness of our information bottleneck based message propagation mechanism.
OTGNet-w.o.-IB represents our method directly transferring the embeddings of neighbor nodes instead of class-agnostic representations.
OTGNet-w.o.-prop denotes our method directly dropping the links between nodes of different classes.
We take GBK-GNN (Du et al., 2022) as another baseline, where GBK-GNN originally handles the heterophily for static graph.
For a fair comparison, we modify GBK-GNN to an open temporal graph: Specifically, we create two temporal message propagation modules with separated parameters as the two kernel feature transformation matrices in GBK-GNN.
We denote
[Table] [Table]
[Table] [Table]
this baseline as OTGNet-GBK.
As shown in Table 3, OTGNet outperforms OTGNet-w.o.-IB and
OTGNet-GBK on the three datasets.
This illustrates that it is effective to extract class-agnostic information for addressing the heterophily propagation issue.
OTGNet-w.o.-prop generally performs better than OTGNet-w.o.-IB.
This tells us that it is inappropriate to directly transfer information between two nodes of different classes.
OTGNet-w.o.-prop is inferior to OTGNet, which means that the information is lost if directly dropping the links between nodes of different nodes.
An interesting phenomenon is AF score decreases much without using information bottleneck.
This indicates that learning better node embeddings by our message passing module is helpful to triad selection.
Triad Selection Strategy Analysis.
First, we design three variants to study the impact of our triad selection strategy.
OTGNet-w.o.-triad means our method does not use any triad (i.e. M = 0 ).
OTGNet-random represents our method selecting triads randomly.
OTGNet-w.o.-diversity means our method selecting triads without considering the diversity.
As shown in Table 4, The performance of our method decreases much when without using triads, which shows the effectiveness of using triads to prevent catastrophic forgetting.
OTGNet achieves better performance than OTGNet-random and
OTGNet-w.o.-diversity, indicating the proposed triads selection strategy is effective.
Evolution Pattern Preservation Analysis.
We study the effectiveness of evolution pattern preservation.
OTGNet-w.o.-pattern represents our method without evolution pattern preservation (i.e. ρ = 0 ).
As shown in Table 5, OTGNet has superior performance over OTGNet-w.o.-pattern, which illustrates the evolution pattern preservation is beneficial to memorize the knowledge of old classes.
Acceleration Performance of Triad Selection.
As stated aforementioned, to speed up the triad selection, we can sort triads g ck based on the values of R ( g ck ) , and use top K triads as the candidate set N ck for selection.
We perform experiments with different K , fixing M = 10 .
Table 6 shows the results.
We notice that when using smaller K , the selection time drops quickly but the performance of our model degrades little.
This illustrates our acceleration solution is efficient and effective.
Besides, the reason for performance dropping is that the total diversities of the triad candidates decreases.
C ONCLUSION
In this paper, we put forward a general framework, OTGNet, to investigate open temporal graph.
We devise a novel message passing mechanism based on information bottleneck to extract classagnostic knowledge for aggregation, which can address heterophily propagation issue.
To overcome catastrophic forgetting, we propose to select representative triads to memorize knowledge of old classes, and design a new value function to realize the selection.
Experimental results on three real-world datasets demonstrate the effectiveness of our method.
A CKNOWLEDGEMENTS
This work was supported by the National Natural Science Foundation of China (NSFC) under Grants 62122013, U2001211.
A A PPENDIX A. D ERIVATION OF O UR I NFORMATION B OTTLENECK O BJECTIVE
Our message passing mechanism is motivated by traditional information bottleneck (Alemi et al., 2016; Tishby et al., 2000).
The objective of traditional information bottleneck is max Z I ( Z, Y ) − βI ( Z, X ) , which attempts to maximize the mutual information between label Y and latent representation Z , and minimize the mutual information between input feature X and latent representation Z .
Different from that, we intend to extract class-agnostic information from node embeddings.
Thus, we aim to minimize the mutual information between node label Y and class-agnostic
representation Z ( t ) , and maximize the mutual information between input embedding X ( t ) and class-agnostic representation Z ( t ) .
Our objective could be written as: J IB =
min Z ( t ) I ( Z ( t ) , Y ) − βI ( Z, X ( t )) .
First, we give a proof of the upper bound of I ( Z ( t ) , Y ) , motivated by Cheng et al.
Let I club ( Z ( t ) , Y ) =
E p ( Z ( t ) ,Y ) [log p ( y | z ( t ))]
− E p ( Z ( t ))
E p ( Y ) [log p ( y | z ( t ))] .
Let o =
I club ( Z ( t ) , Y ) −
I
( Z ( t ) , Y ) , then we have:
[Equation]
Since log ( · ) is a concave function, according to Jensen’s Inequality (Kian, 2014)
[Equation]
we have:
[Equation]
Then, we have:
[Equation]
Thus, we derive the upper bound of I ( Z ( t ) , Y ) :
[Equation]
Since p ( y | z ( t )) is unknown, we introduce a variational approximation distribution q µ ( y | z ( t )) to approximate p ( y | z ( t )) , following Cheng et al.
Next, we give a proof to the lower bound of I ( X ( t ) , Z ( t )) , based on Belghazi et al.
According to Donsker-Varadhan representation (Donsker & Varadhan, 1975), we know:
[Equation]
where Ω = X
× Z is the input space.
Let F be any class of functions T : Ω → R , we have:
[Equation]
We could choose F to be the family of functions T ψ : X ×Z → R parameterized by a neural network ψ :
[Equation]
Thus, we have:
[Equation]
Therefore, we could derive an upper bound of J IB :
[Equation]
In order to minimize J IB , we attempt to minimize its upper bound, i.e., L IB , and utilize the Monte
Carlo sampling to approximate the expectations in L IB , motivated by (Wan et al., 2021;
Alemi et al., 2016).
Therefore, the final loss function of L IB can be expressed as:
[Equation]
where S d is a batch of nodes and | S d | is the size of S d .
x i ( t ) ,
z i ( t ) are the embedding, the classagnostic representation of node
i respectively at time-stamp t .
y i is the label of node i .
A. D ERIVATION OF T RIAD I NFLUENCE F UNCTION
In this section, we prove that our triad influence function I loss ( g ck , θ ) could estimate the influence of the triad g ck on the model performance for class k .
The triad influence function I loss ( g ck , θ ) is defined as:
[Equation]
where θ is the parameter of the model and G k is the training node set of class k .
H θ is the Hessian matrix.
∇ θ L ( g ck , θ ) , ∇ θ L ( G k , θ ) are the gradient of loss to g ck and G k , respectively.
The basic idea of the influence function (Cook & Weisberg, 1980; Koh & Liang, 2017) is to estimate the parameter change if a training sample is upweighted by some small ε ( ε → 0 ).
Thus, we add a small weight ε on three nodes of the triad g ck in the loss function
L ( θ ) .
The new loss function could be written as:
[Equation]
where l ( v, θ ) is the loss of node v .
With the new loss function, the parameter of model is changed to ˆ θ ε,g ck = arg min θ L ε,g ck ( θ ) .
According to Cook & Weisberg (1980), we know that the influence of upweighting ε could be evaluated by d ˆ
[Equation]
Since the new loss function (24) is minimized by ˆ θ ϵ,g ck , we examine the first-order optimality condition:
[Equation] [Equation]
Then, since we have ˆ θ ε,g ck
→ θ as ε → 0 , we perform a Taylor expansion on the right-hand side of
Eq.
(25) and the higher order infinitesimal o (ˆ θ ε,g ck − θ ) terms are dropped :
[Equation]
From Eq.
(26), we could derive that
[Equation]
Because θ minimizes L ( G k , θ ) , ∇ θ L ( G k , θ ) equals 0.
By dropping the higher order infinitesimal o ( ε ) terms, we have:
[Equation]
[Equation]
We denote the H θ = ∇ 2 θ L ( G k , θ ) , and thus have:
[Equation]
Then
[Equation]
we could estimate the change of parameters influenced by a triad as follows:
[Equation]
Finally
[Equation]
we could derive the triad influence function I loss ( g ck , θ ) by the chain rule:
[Equation]
A. P ROOF OF M ONOTONICITY AND S UBMODULARITY
Our proposed value function is defined as:
[Equation]
where C g ck,
i = { g ck,j |
|| ¯ x ( g ck,j ) − ¯ x ( g ck,i )
||
2 ≤ δ, g ck,j ∈ N ck }
and N ck is the set containing all triads with positive R ( g ck ) .
As stated before, finding a fixed size set S ck ( S ck ⊆ N ck ) that maximizes F ( S ck ) is NP-hard due to the combinatorial complexity.
Thus, we first prove that our value function F is monotone and submodular.
Then our optimization problem could be solved by a greedy algorithm with an approximation ratio guarantee according to Krause & Golovin (2014).
Definition 1.
(Monotonicity)
A function f : 2 N → R is monotone if for ∀ A ⊆ B ⊆ N , it holds that
F ( A ) ≤ F ( B ) .
Lemma 1.
Our value function F in Eq.
(32) is monotone.
Proof.
We define two triad sets A, B that satisfy A ⊆ B ⊆
N ck .
Let ∆ =
F ( B ) − F ( A ) .
We have:
[Equation]
Thus
[Equation]
we have:
[Equation] [Equation]
Definition 2.
(Submodularity)
A function f : 2 N → R is submodular if for ∀ A ⊆ B ⊆ N and ∀ x ∈ N \ B , it holds that F ( A ∪ { x } ) − F ( A ) ≥ F ( B ∪ { x } ) − F ( B ) .
Lemma 2.
Our value function F in Eq.
(32) is submodular.
Proof.
We define two triad sets A
[Equation]
B that satisfy A ⊆ B ⊆
N ck .
Let T =
B \ A .
Define ∆ =
( F ( A ∪ { x } ) − F ( A )) − ( F ( B ∪ { x } ) − F ( B )) .
Then we have:
[Equation]
|
[Equation] [Equation]
=
[Equation]
[Table]
=
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table] [Table]
[Table]
[Equation] [Equation]
For convenience, we denote (cid:83) g ck,i ∈
Q C g
ck,i = C ∗ Q .
We have:
[Equation]
Then, we can derive:
[Equation]
F ( A ∪ { x } ) − F ( A )) − ( F ( B ∪ { x } ) − F ( B )) ≥ 0 .
(40) ⇒ F ( A ∪ { x } ) − F ( A ) ≥ F
( B ∪ { x } ) − F ( B ) .
A. D ATASET D ETAILS
Reddit Dataset Reddit is a large platform of topic communities where people could write and upload their posts to share their opinions.
For the Reddit dataset 1 , we construct a post-to-post graph, similar to Hamilton et al.
We omit the top 20 largest communities, because they are large and generic default communities, which could skew the class distribution (Hamilton et al., 2017).
From the rest of communities, in each month we sample 3 largest communities that doesn’t appear in previous months as new classes for each task.
We take the data from July to November in 2009 and construct 6 tasks based on the selected data.
In the graph, the posts are regarded as nodes and their corresponding communities are regarded as node labels.
When a user comments a post at time t , the temporal edges at timestamp t will be built, connecting this post to other posts this user has commented within a week.
We initialize the feature representation of a node by averaging 300-dimensional GloVe word embeddings of all comments in this post, following Hamilton et al.
Yelp Dataset Yelp is a large business review website where people could upload their reviews for commenting business, and find their interested business by others’ reviews.
For the Yelp dataset 2 , we construct a business-to-business temporal graph, in the same way as Reddit.
Specifically, we take the data from 2015 to 2019, and treat the data in each year as a task, thus forming 5 tasks in total.
In each year, we sample 3 largest business categories as three classes in each task.
Note that the business categories in each task have never occurred in previous tasks.
We regard each business as a node and set the business’s category as its node label.
The temporal edge will be formed, once a user reviews the corresponding two businesses within a month.
We initialize the feature representation for each node by averaging 300-dimensional GloVe word embeddings of all reviews for this business.
Taobao Dataset Taobao is a large online shopping platform where items (products) could be viewed and purchased by people online.
For the Taobao dataset 3 (Du et al., 2019), we construct an item-to-item graph, in the same way as Reddit.
The data in the Taobao dataset is a 6-days promotion season of Taobao in 2018.
We set the time duration for each task as 2 days.
In each two days, we take the top 30 largest item categories according to the number of items as the new classes for this task.
The categories in each task have never occurred in previous tasks.
We regard the items as nodes and take the categories of items as the node labels.
The temporal edge will be built if a user purchases two corresponding items in the promotion season.
We use the 128-dimensional embedding provided by the original dataset as the initial feature of the node.
A. P SEUDO - CODE OF P ROPOSED M ETHOD
We provide the pseudo-code of our training procedure, as shown in Algorithm 2.
When learning task
T i , we input the interactions in current task and triads of previous tasks together into our proposed message passing framework.
All nodes in current interactions and previous triads are used to calculate node classification loss for training.
The closed triads and open triads serve as positive and negative samples to preserve evolution patterns, respectively.
After learning task T i , we select representative triads for the classes in T i and then begin to learn task T i +1 .
Note that our algorithm does not guarantee that the selected triads must be connected with the nodes in the new task.
This is because the selected triads play two roles in our method: on one hand, when the nodes in the triads are connected with the nodes in a new task, it will propagate knowledge among these nodes by extracting class-agnostic representations; on the other hand, triads are used to preserve the knowledge of old classes, so as to avoid catastrophic knowledge forgetting when learning new classes.
Even though the selected triad does not connect with the nodes in the new task, we think it still is important for learning old classes by simultaneously considering both importance and diversity.
A. I MPLEMENTATION DETAILS
We perform our experiments using GeForce RTX 3090 Ti GPU.
We use the Adam optimizer for training with learning rate η = 0 .
0001 on the Reddit dataset, learning rate η = 0 .
005 on the Yelp
[Table] [Table]
do 6: let H set all interactions b ; 7: if i
= T
8: let H pre be the set containing the interactions for all triads in S ; 9: if 11: extract class-agnostic embeddings for and their neighbors in H ; 12: propagate message for all interactive nodes in H ; 13: calculate node classification loss L ce for all interactive nodes in H ; 14: let L = L ce ; 15: if T i
= T 1 then 16: calculate link prediction loss L link for all triads in S ; 17:
L ρ
; 18: end if 19: minimize the information bottleneck loss L IB ; 20: minimize the training loss L ; 21: end for 22: end for 23: for each k in do 24: select representative closed set S by Algorithm 1; 25: select representative open triad set for class k by Algorithm 1; 26:
27: end for 28: for each task T j from T to T do 29: evaluate the performance of our model on the unseen test data of T j ; 30: end for 31: end for datasets and learning rate η = 0 .
001 on the Taobao datasets.
For all baselines and our method, we train each new task until convergence, and then evaluate the performance of the model on current task and all previous tasks.
For the Reddit dataset and the Yelp dataset, we train each task 500 epochs.
For the Taobao dataset, we train each task 100 epochs.
We set the dropout rate to 0.5 on all the datasets.
The node classification head is a two-layer MLP with hidden size 128.
The selected triad pairs per class M is set to 10 on all datasets.
The hyper-parameter for evolution pattern preservation ρ is set to 0 .
5 on all the datasets.
The sub-network extracting class-agnostic information is a two-layer MLP with hidden size 100.
We set γ as 20 and set β as 0.3 on all the datasets.
Note that we do not use a whole graph in the forward pass computation.
For replaying the triads, we sample 5 neighbors of each node in the triad for forward propagation, motivated by the sampling strategy in TGAT and
TGN.
For the nodes on the current new task, we also sample 5 neighbor nodes (maybe from old class nodes) for each node to aggregate the neighborhood information.
A. A DDITIONAL E XPERIMENTS
Forgetting Analysis of Different Task Numbers.
We study the average forgetting (AF) changes of different methods along with the increased tasks.
As stated in the main body of this paper, AF measures the decreasing extent of model performance on previous tasks compared to the best ones.
Note that AF does not count the last task since the forgetting for the last task has not yet happened.
As shown in Figure 5, AF of our method is generally smaller than that of other methods.
This indicates that our method generally suffers from less catastrophic forgetting than other methods.
[Figure] [Figure]
Convergence Analysis.
We analyze the convergence of our method.
We plot the loss curves (including the total training loss L and the information bottleneck loss L IB on the largest dataset,
Taobao.
As shown in Figure 6, our method can be eventually convergent when learning for each task.
Sensitivity Analysis of M .
We analyze the influence of the number M of selected triads when fixing K = 1000 .
As shown in Figure 7(a)(b)
[Figure]
it could be observed that when we fix K = 1000 , our method obtains good performance when M ≥ 10 .
This is because with a relatively large K , we could select not only important but also diverse triads to preserve knowledge for achieving good performance.
Thus, we set M = 10 throughout the experiment.
Sensitivity Analysis of ρ .
We analyze the sensitiveness of ρ .
ρ is the hyper-parameter on the link prediction loss for evolution pattern preservation.
As shown in Figure 8(a)(b), we observe that our method is not sensitive to ρ in a relatively large range.
Sensitivity Analysis of γ .
We analyze the sensitivity of γ in our method.
Recall that γ is a trade-off parameter for balancing the contributions between diversity and importance when selecting representative triads.
As shown in Figure 9, our method is not sensitive to γ in a relatively large range.
[Figure] [Figure]
[Figure] [Figure]
[Figure]
Sensitivity Analysis of β .
We analyze the sensitivity of β in our method.
β is the Lagrange multiplier in the objective of information bottleneck.
As shown in Figure 10, we observe that our method has stable performance when changing β in a certain range.
Sensitivity Analysis of δ .
We further analyze the sensitivity of δ in our method.
δ is a hyperparameter for measuring the diversity of a triad set.
As shown in Figure 11, our method is not sensitive to δ in a relatively large range.
A. AP AND AF FOR E ACH T ASK .
Here we provide the AP and AF metric for each task of our method and two baselines (TGAT+BiC,
TGN+BiC) which generally perform well among all baselines.
As shown in Table 7 8 9, our method generally outperforms two baselines for most tasks.
[Table] [Table]
[Table] [Table]
A. R UNNING T IME A NALYSIS
When new classes occur
[Table]
if we combine all data of old classes with the data of new classes for retraining, the computational complexities will be sharply increased
[Table]
and be not affordable.
Here, we compare the running time of our method with the retraining methods (TGAT-retrain, TGN-retrain) and two baselines (TGAT+BiC, TGN+BiC) which generally perform well among baseline methods.
For the retraining methods, we use all data of old tasks for training when learning new tasks.
As shown in in Table
[Table]
the running time of our method is comparable to the two incremental learning baselines (TGAT+BiC, TGN+BiC), while our model outperforms them on AP and AF metric with a large margin.
For the retraining methods (TGAT-retrain, TGN-retrain), we can see the running time is increased by several times.
In real-world applications, new classes might frequently occur.
If we use all history data for training once a new class occurs, the time consuming could be unaffordable.
Note that their Average Forgetting (AF) are better than our model.
This is because they use all training data for learning each time, and thus can avoid forgetting.
A. L IMITATIONS AND F UTURE W ORKS
The quadratic time complexity of triad selection is a limitation of our method.
Although only considering partial triads could be efficient, the performance of our model would be degraded to some extent.
How to develop a more efficient and effective algorithm for representative triad selection is our future work.
For example, we could design a hierarchical selection policy to reduce the time complexity, or develop a divide-and-conquer method for efficient triad selection.
What’s more, we can design better practical approximations to the theoretical optimal solution of our value function to select representative triads.
A. V ISUALIZATIONS
[Figure]
Different colors denote different classes.
[Figure]
To qualitatively demonstrate the effectiveness of our class-agnostic representations, we adopt t-SNE (Van der Maaten & Hinton, 2008) to visualize the learned node embeddings of our OTGNet.
For comparison, we also visualize the node embeddings of OTGNet-w.o.-IB (i.e., OTGNet directly transferring the embeddings of neighbor nodes instead of class-agnostic representations).
Figureshows the results of their learned node embeddings on Reddit when task 1 is finished, and Figuredemonstrates the results after a new task is added.
We can clearly observe that OTGNet possesses better representation ability by considering class-agnostic representations.