Composition-based Multi-Relational Graph Convolutional Networks

Shikhar Vashishth, Soumya Sanyal, Vikram Nitin, Partha Talukdar

Introduction

Graphs are one of the most expressive data-structures which have been used to model a variety of problems. Traditional neural network architectures like Convolutional Neural Networks (Krizhevsky et al., 2012) and Recurrent Neural Networks (Hochreiter & Schmidhuber, 1997) are constrained to handle only Euclidean data. Recently, Graph Convolutional Networks (GCNs) (Bruna et al., 2013; Defferrard et al., 2016) have been proposed to address this shortcoming, and have been successfully applied to several domains such as social networks (Hamilton et al., 2017), knowledge graphs (Schlichtkrull et al., 2017), natural language processing (Marcheggiani & Titov, 2017), drug discovery (Ramsundar et al., 2019), crystal property prediction (Sanyal et al., 2018), and natural sciences (Fout et al., 2017).

However, most of the existing research on GCNs (Kipf & Welling, 2016; Hamilton et al., 2017; Veličković et al., 2018) have focused on learning representations of nodes in simple undirected graphs. A more general and pervasive class of graphs are multi-relational graphsIn this paper, multi-relational graphs refer to graphs with edges that have labels and directions.. A notable example of such graphs is knowledge graphs. Most of the existing GCN based approaches for handling relational graphs (Marcheggiani & Titov, 2017; Schlichtkrull et al., 2017) suffer from over-parameterization and are limited to learning only node representations. Hence, such methods are not directly applicable for tasks such as link prediction which require relation embedding vectors. Initial attempts at learning representations for relations in graphs (Monti et al., 2018; Beck et al., 2018) have shown some performance gains on tasks like node classification and neural machine translation.

There has been extensive research on embedding Knowledge Graphs (KG) (Nickel et al., 2016; Wang et al., 2017) where representations of both nodes and relations are jointly learned. These methods are restricted to learning embeddings using link prediction objective. Even though GCNs can learn from task-specific objectives such as classification, their application has been largely restricted to non-relational graph setting. Thus, there is a need for a framework which can utilize KG embedding techniques for learning task-specific node and relation embeddings. In this paper, we propose CompGCN, a novel GCN framework for multi-relational graphs which systematically leverages entity-relation composition operations from knowledge graph embedding techniques. CompGCN addresses the shortcomings of previously proposed GCN models by jointly learning vector representations for both nodes and relations in the graph. An overview of CompGCN is presented in Figure 1. The contributions of our work can be summarized as follows:

We propose CompGCN, a novel framework for incorporating multi-relational information in Graph Convolutional Networks which leverages a variety of composition operations from knowledge graph embedding techniques to jointly embed both nodes and relations in a graph.

We demonstrate that CompGCN framework generalizes several existing multi-relational GCN methods (Proposition 4.1) and also scales with the increase in number of relations in the graph (Section 6.3).

Through extensive experiments on tasks such as node classification, link prediction, and graph classification, we demonstrate the effectiveness of our proposed method.

The source code of CompGCN and datasets used in the paper have been made available at http://github.com/malllabiisc/CompGCN.

Related Work

Graph Convolutional Networks: GCNs generalize Convolutional Neural Networks (CNNs) to non-Euclidean data. GCNs were first introduced by Bruna et al. (2013) and later made scalable through efficient localized filters in the spectral domain (Defferrard et al., 2016). A first-order approximation of GCNs using Chebyshev polynomials has been proposed by Kipf & Welling (2016). Recently, several of its extensions have also been formulated (Hamilton et al., 2017; Veličković et al., 2018; Xu et al., 2019). Most of the existing GCN methods follow Message Passing Neural Networks (MPNN) framework (Gilmer et al., 2017) for node aggregation. Our proposed method can be seen as an instantiation of the MPNN framework. However, it is specialized for relational graphs.

GCNs for Multi-Relational Graph: An extension of GCNs for relational graphs is proposed by Marcheggiani & Titov (2017). However, they only consider direction-specific filters and ignore relations due to over-parameterization. Schlichtkrull et al. (2017) address this shortcoming by proposing basis and block-diagonal decomposition of relation specific filters. Weighted Graph Convolutional Network (Shang et al., 2019) utilizes learnable relational specific scalar weights during GCN aggregation. While these methods show performance gains on node classification and link prediction, they are limited to embedding only the nodes of the graph. Contemporary to our work, Ye et al. (2019) have also proposed an extension of GCNs for embedding both nodes and relations in multi-relational graphs. However, our proposed method is a more generic framework which can leverage any KG composition operator. We compare against their method in Section 6.1.

Knowledge Graph Embedding: Knowledge graph (KG) embedding is a widely studied field (Nickel et al., 2016; Wang et al., 2017) with application in tasks like link prediction and question answering (Bordes et al., 2014). Most of KG embedding approaches define a score function and train node and relation embeddings such that valid triples are assigned a higher score than the invalid ones. Based on the type of score function, KG embedding method are classified as translational (Bordes et al., 2013; Wang et al., 2014b), semantic matching based (Yang et al., 2014; Nickel et al., 2016) and neural network based (Socher et al., 2013; Dettmers et al., 2018). In our work, we evaluate the performance of CompGCN on link prediction with methods of all three types.

Background

In this section, we give a brief overview of Graph Convolutional Networks (GCNs) for undirected graphs and its extension to directed relational graphs.

GCN on Multi-Relational Graphs: For a multi-relational graph G=(V,R,E,X)\mathcal{G}=(\mathcal{V},\mathcal{R},\mathcal{E},\bm{\mathcal{X}}), where R\mathcal{R} denotes the set of relations, and each edge (u,v,r)(u,v,r) represents that the relation r∈Rr\in\mathcal{R} exist from node uu to vv. The GCN formulation as devised by Marcheggiani & Titov (2017) is based on the assumption that information in a directed edge flows along both directions. Hence, for each edge (u,v,r)∈E(u,v,r)\in\mathcal{E}, an inverse edge (v,u,r−1)(v,u,r^{-1}) is included in G\mathcal{G}. The representations obtained after kk layers of directed GCN is given by

Here, Wrk\bm{W}_{r}^{k} denotes the relation specific parameters of the model. However, the above formulation leads to over-parameterization with an increase in the number of relations and hence, Marcheggiani & Titov (2017) use direction-specific weight matrices. Schlichtkrull et al. (2017) address over-parameterization by proposing basis and block-diagonal decomposition of Wrk\bm{W}_{r}^{k}.

CompGCN Details

In this section, we provide a detailed description of our proposed method, CompGCN. The overall architecture is shown in Figure 1. We represent a multi-relational graph by G=(V,R,E,X,Z)\mathcal{G}=(\mathcal{V},\mathcal{R},\mathcal{E},\bm{\mathcal{X}},\bm{\mathcal{Z}}) as defined in Section 3 where Z∈ℜ∣R∣×d0\bm{\mathcal{Z}}\in\real{|\mathcal{R}|\times d_{0}} denotes the initial relation features. Our model is motivated by the first-order approximation of GCNs using Chebyshev polynomials (Kipf & Welling, 2016). Following Marcheggiani & Titov (2017), we also allow the information in a directed edge to flow along both directions. Hence, we extend E\mathcal{E} and R\mathcal{R} with corresponding inverse edges and relations, i.e.,

and R′=R∪Rinv∪{⊤}\mathcal{R}^{\prime}=\mathcal{R}\cup\mathcal{R}_{inv}\cup\{\top\}, where Rinv={r−1∣r∈R}\mathcal{R}_{inv}=\{r^{-1}\hskip 2.0pt|\hskip 2.0ptr\in\mathcal{R}\} denotes the inverse relations and ⊤\top indicates the self loop.

Unlike most of the existing methods which embed only nodes in the graph, CompGCN learns a dd-dimensional representation hr∈ℜd,∀r∈R\bm{h}_{r}\in\real{d},\forall r\in\mathcal{R} along with node embeddings hv∈ℜd,∀v∈V\bm{h}_{v}\in\real{d},\forall v\in\mathcal{V}. Representing relations as vectors alleviates the problem of over-parameterization while applying GCNs on relational graphs. Further, it allows CompGCN to exploit any available relation features (Z)(\bm{\mathcal{Z}}) as initial representations. To incorporate relation embeddings into the GCN formulation, we leverage the entity-relation composition operations used in Knowledge Graph embedding approaches (Bordes et al., 2013; Nickel et al., 2016), which are of the form

As we show in Section 6, the choice of composition operation is important in deciding the quality of the learned embeddings. Hence, superior composition operations for Knowledge Graphs developed in future can be adopted to improve CompGCN’s performance further.

2 CompGCN Update Equation

The GCN update equation (Eq. 1) defined in Section 3 can be re-written as

where N(v)\mathcal{N}(v) is a set of immediate neighbors of vv for its outgoing edges. Since this formulation suffers from over-parameterization, in CompGCN we perform composition (ϕ\phi) of a neighboring node uu with respect to its relation rr as defined above. This allows our model to be relation aware while being linear (O(∣R∣d)\mathcal{O}(|\mathcal{R}|d)) in the number of feature dimensions. Moreover, for treating original, inverse, and self edges differently, we define separate filters for each of them. The update equation of CompGCN is given as:

Further, in CompGCN, after the node embedding update defined in Eq. 2, the relation embeddings are also transformed as follows:

Scaling with Increasing Number of Relations To ensure that CompGCN scales with the increasing number of relations, we use a variant of the basis formulations proposed in Schlichtkrull et al. (2017). Instead of independently defining an embedding for each relation, they are expressed as a linear combination of a set of basis vectors. Formally, let {v1,v2,...,vB}\{\bm{v}_{1},\bm{v}_{2},...,\bm{v}_{\mathcal{B}}\} be a set of learnable basis vectors. Then, initial relation representation is given as:

Here, αbr∈ℜ\alpha_{{}_{br}}\in\real{} is relation and basis specific learnable scalar weight.

On Comparison with Relational-GCN Note that this is different from the basis formulation in Schlichtkrull et al. (2017), where a separate set of basis matrices is defined for each GCN layer. In contrast, CompGCN uses embedding vectors instead of matrices, and defines basis vectors only for the first layer. The later layers share the relations through transformations according to Equation 4. This makes our model more parameter efficient than Relational-GCN.

We can extend the formulation of Equation 2 to the case where we have kk-stacked CompGCN layers. Let hvk+1\bm{h}_{v}^{k+1} denote the representation of a node vv obtained after kk layers which is defined as

Similarly, let hrk+1\bm{h}_{r}^{k+1} denote the representation of a relation rr after kk layers. Then,

Here, hv0\bm{h}_{v}^{0} and hr0\bm{h}_{r}^{0} are the initial node (xv\bm{x}_{v}) and relation (zr\bm{z}_{r}) features respectively.

CompGCN generalizes the following Graph Convolutional based methods: Kipf-GCN (Kipf & Welling, 2016), Relational GCN (Schlichtkrull et al., 2017), Directed GCN (Marcheggiani & Titov, 2017), and Weighted GCN (Shang et al., 2019).

For Kipf-GCN, this can be trivially obtained by making weights (Wλ(r))(\bm{W}_{\lambda(r)}) and composition function (ϕ)(\phi) relation agnostic in Equation 5, i.e., Wλ(r)=W\bm{W}_{\lambda(r)}=\bm{W} and ϕ(hu,hr)=hu\phi(\bm{h}_{u},\bm{h}_{r})=\bm{h}_{u}. Similar reductions can be obtained for other methods as shown in Table 2. ∎

Experimental Setup

In our experiments, we evaluate CompGCN on the below-mentioned tasks.

Link Prediction is the task of inferring missing facts based on the known facts in Knowledge Graphs. In our experiments, we utilize FB15k-237 (Toutanova & Chen, 2015) and WN18RR (Dettmers et al., 2018) datasets for evaluation. Following Bordes et al. (2013), we use filtered setting for evaluation and report Mean Reciprocal Rank (MRR), Mean Rank (MR) and Hits@N.

Node Classification is the task of predicting the labels of nodes in a graph based on node features and their connections. Similar to Schlichtkrull et al. (2017), we evaluate CompGCN on MUTAG (Node) and AM (Ristoski & Paulheim, 2016) datasets.

Graph Classification, where, given a set of graphs and their corresponding labels, the goal is to learn a representation for each graph which is fed to a classifier for prediction. We evaluate on 2 bioinformatics dataset: MUTAG (Graph) and PTC (Yanardag & Vishwanathan, 2015).

A summary statistics of the datasets used is provided in Appendix A.2

2 Baselines

Across all tasks, we compare against the following GCN methods for relational graphs: (1) Relational-GCN (R-GCN) (Schlichtkrull et al., 2017) which uses relation-specific weight matrices that are defined as a linear combinations of a set of basis matrices. (2) Directed-GCN (D-GCN) (Marcheggiani & Titov, 2017) has separate weight matrices for incoming edges, outgoing edges, and self-loops. It also has relation-specific biases. (3) Weighted-GCN (W-GCN) (Shang et al., 2019) assigns a learnable scalar weight to each relation and multiplies an incoming "message" by this weight. Apart from this, we also compare with several task-specific baselines mentioned below.

Link prediction: For evaluating CompGCN, we compare against several non-neural and neural baselines: TransE Bordes et al. (2013), DistMult (Yang et al., 2014), ComplEx (Trouillon et al., 2016), R-GCN (Schlichtkrull et al., 2017), KBGAN (Cai & Wang, 2018), ConvE (Dettmers et al., 2018), ConvKB (Nguyen et al., 2018), SACN (Shang et al., 2019), HypER (Balažević et al., 2019), RotatE (Sun et al., 2019), ConvR (Jiang et al., 2019), and VR-GCN (Ye et al., 2019).

Node and Graph Classification: For node classification, following Schlichtkrull et al. (2017), we compare with Feat (Paulheim & Fümkranz, 2012), WL (Shervashidze et al., 2011), and RDF2Vec (Ristoski & Paulheim, 2016). Finally, for graph classification, we evaluate against PachySAN (Niepert et al., 2016), Deep Graph CNN (DGCNN) (Zhang et al., 2018), and Graph Isomorphism Network (GIN) (Xu et al., 2019).

Results

In this section, we attempt to answer the following questions.

How does CompGCN perform on link prediction compared to existing methods? (6.1)

What is the effect of using different GCN encoders and choice of the compositional operator in CompGCN on link prediction performance? (6.1)

Does CompGCN scale with the number of relations in the graph? (6.3)

How does CompGCN perform on node and graph classification tasks? (6.4)

In this section, we evaluate the performance of CompGCN and the baseline methods listed in Section 5.2 on link prediction task. The results on FB15k-237 and WN18RR datasets are presented in Table 3. The scores of baseline methods are taken directly from the previous papers (Sun et al., 2019; Cai & Wang, 2018; Shang et al., 2019; Balažević et al., 2019; Jiang et al., 2019; Ye et al., 2019). However, for ConvKB, we generate the results using the corrected evaluation codehttps://github.com/KnowledgeBaseCompleter/eval-ConvKB. Overall, we find that CompGCN outperforms all the existing methods in 44 out of 55 metrics on FB15k-237 and in 33 out of 55 metrics on WN18RR dataset. We note that the best performing baseline RotatE uses rotation operation in complex domain. The same operation can be utilized in a complex variant of our proposed method to improve its performance further. We defer this as future work.

2 Comparison of Different GCN Encoders on Link Prediction Performance

Next, we evaluate the effect of using different GCN methods as an encoder along with a representative score function (shown in Figure 3) from each category: TransE (translational), DistMult (semantic-based), and ConvE (neural network-based). In our results, X + M (Y) denotes that method M is used for obtaining entity embeddings (and relation embeddings in the case of CompGCN) with X as the score function as depicted in Figure 3. Y denotes the composition operator in the case of CompGCN. We evaluate CompGCN on three non-parametric composition operators inspired from TransE (Bordes et al., 2013), DistMult (Yang et al., 2014), and HolE (Nickel et al., 2016) defined as

Subtraction (Sub): ϕ(es,er)=es−er.\phi(\bm{e}_{s},\bm{e}_{r})=\bm{e}_{s}-\bm{e}_{r}.

Multiplication (Mult): ϕ(es,er)=es∗er.\phi(\bm{e}_{s},\bm{e}_{r})=\bm{e}_{s}*\bm{e}_{r}.

Circular-correlation (Corr): ϕ(es,er)=es⋆er\phi(\bm{e}_{s},\bm{e}_{r})\text{=}\bm{e}_{s}\star\bm{e}_{r}

The overall results are summarized in Table 4. Similar to Schlichtkrull et al. (2017), we find that utilizing Graph Convolutional based method as encoder gives a substantial improvement in performance for most types of score functions. We observe that although all the baseline GCN methods lead to some degradation with TransE score function, no such behavior is observed for CompGCN. On average, CompGCN obtains around 66%, 44% and 33% relative increase in MRR with TransE, DistMult, and ConvE objective respectively compared to the best performing baseline. The superior performance of CompGCN can be attributed to the fact that it learns both entity and relation embeddings jointly thus providing more expressive power in learned representations. Overall, we find that CompGCN with ConvE (highlighted using ) is the best performing method for link prediction.We further analyze the best performing method for different relation categories in Appendix A.1.

Effect of composition Operator: The results on link prediction with different composition operators are presented in Table 4. We find that with DistMult score function, multiplication operator (Mult) gives the best performance while with ConvE, circular-correlation surpasses all other operators. Overall, we observe that more complex operators like circular-correlation outperform or perform comparably to simpler operators such as subtraction.

3 Scalability of CompGCN

In this section, we analyze the scalability of CompGCN with varying numbers of relations and basis vectors. For analysis with changing number of relations, we create multiple subsets of FB15k-237 dataset by retaining triples corresponding to top-mm most frequent relations, where m={10,25,50,100,237}m=\{10,25,50,100,237\}. For all the experiments, we use our best performing model (ConvE + CompGCN (Corr)).

Effect of Varying Relation Basis Vectors: Here, we analyze the performance of CompGCN on changing the number of relation basis vectors (B\mathcal{B}) as defined in Section 4. The results are summarized in Figure 3. We find that our model performance improves with the increasing number of basis vectors. We note that with B=100\mathcal{B}=100, the performance of the model becomes comparable to the case where all relations have their individual embeddings. In Table 4, we report the results for the best performing model across all score function with B\mathcal{B} set to 5050. We note that the parameter-efficient variant also gives a comparable performance and outperforms the baselines in all settings.

Effect of Number of Relations: Next, we report the relative performance of CompGCN using 55 relation basis vectors (B=5\mathcal{B}=5) against CompGCN, which utilizes a separate vector for each relation in the dataset. The results are presented in Figure 5. Overall, we find that across all different numbers of relations, CompGCN, with a limited basis, gives comparable performance to the full model. The results show that a parameter-efficient variant of CompGCN scales with the increasing number of relations.

Comparison with R-GCN: Here, we perform a comparison of a parameter-efficient variant of CompGCN (B=5\mathcal{B}=5) against R-GCN on different number of relations. The results are depicted in Figure 5. We observe that CompGCN with limited parameters consistently outperforms R-GCN across all settings. Thus, CompGCN is parameter-efficient and more effective at encoding multi-relational graphs than R-GCN.

4 Evaluation on Node and Graph Classification

In this section, we evaluate CompGCN on node and graph classification tasks on datasets as described in Section 5.1. The experimental results are presented in Table 5. For node classification task, we report accuracy on test split provided by Ristoski et al. (2016), whereas for graph classification, following Yanardag & Vishwanathan (2015) and Xu et al. (2019), we report the average and standard deviation of validation accuracies across the 10 folds cross-validation. Overall, we find that CompGCN outperforms all the baseline methods on node classification and gives a comparable performance on graph classification task. This demonstrates the effectiveness of incorporating relations using CompGCN over the existing GCN based models. On node classification, compared to the best performing baseline, we obtain an average improvement of 33% across both datasets while on graph classification, we obtain an improvement of 33% on PTC dataset.

Conclusion

In this paper, we proposed CompGCN, a novel Graph Convolutional based framework for multi-relational graphs which leverages a variety of composition operators from Knowledge Graph embedding techniques to jointly embed nodes and relations in a graph. Our method generalizes several existing multi-relational GCN methods. Moreover, our method alleviates the problem of over-parameterization by sharing relation embeddings across layers and using basis decomposition. Through extensive experiments on knowledge graph link prediction, node classification, and graph classification tasks, we showed the effectiveness of CompGCN over existing GCN based methods and demonstrated its scalability with increasing number of relations.

Acknowledgments

We thank the anonymous reviewers for their constructive comments. This work is supported in part by the Ministry of Human Resource Development (Government of India) and Google PhD Fellowship.

References

Appendix A Appendix

In this section, we investigate the performance of CompGCN on link prediction for different relation categories on FB15k-237 dataset. Following Wang et al. (2014a); Sun et al. (2019), based on the average number of tails per head and heads per tail, we divide the relations into four categories: one-to-one, one-to-many, many-to-one and many-to-many. The results are summarized in Table 6. We observe that using GCN based encoders for obtaining entity and relation embeddings helps to improve performance on all types of relations. In the case of one-to-one relations, CompGCN gives an average improvement of around 1010% on MRR compared to the best performing baseline (ConvE + W-GCN). For one-to-many, many-to-one, and many-to-many the corresponding improvements are 10.510.5%, 7.57.5%, and 44%. These results show that CompGCN is effective at handling both simple and complex relations.

A.2 Dataset Details

In this section, we provide the details of the different datasets used in the experiments. For link prediction, we use the following two datasets:

FB15k-237 (Toutanova & Chen, 2015) is a pruned version of FB15k (Bordes et al., 2013) dataset with inverse relations removed to prevent direct inference.

WN18RR (Dettmers et al., 2018), similar to FB15k-237, is a subset from WN18 (Bordes et al., 2013) dataset which is derived from WordNet (Miller, 1995).

For node classification, similar to Schlichtkrull et al. (2017), we evaluate on the following two datasets:

MUTAG (Node) is a dataset from DL-Learner toolkithttp://www.dl-learner.org. It contains relationship between complex molecules and the task is to identify whether a molecule is carcinogenic or not.

AM dataset contains relationship between different artifacts in Amsterdam Museum (de Boer et al., 2012). The goal is to predict the category of a given artifact based on its links and other attributes.

Finally, for graph classification, similar to Xu et al. (2019), we evaluate on the following datasets:

MUTAG (Graph) Debnath et al. (1991) is a bioinformatics dataset of 188 mutagenic aromatic and nitro compounds. The graphs need to be categorized into two classes based on their mutagenic effect on a bacterium.

PTC Srinivasan et al. (1997) is a dataset consisting of 344 chemical compounds which indicate carcinogenicity of male and female rats. The task is to label the graphs based on their carcinogenicity on rodents.

A summary statistics of all the datasets used is presented in Table 7.

A.3 Hyperparameters

Here, we present the implementation details for each task used for evaluation in the paper. For all the tasks, we used CompGCN build on PyTorch geometric framework (Fey & Lenssen, 2019).

Link Prediction: For evaluation, 200200-dimensional embeddings for node and relation embeddings are used. For selecting the best model we perform a hyperparameter search using the validation data over the values listed in Table 8. For training link prediction models, we use the standard binary cross entropy loss with label smoothing Dettmers et al. (2018).

Node Classification: Following Schlichtkrull et al. (2017), we use 1010% training data as validation for selecting the best model for both the datasets. We restrict the number of hidden units to 3232. We use cross-entropy loss for training our model.

Graph Classification: Similar to Yanardag & Vishwanathan (2015); Xu et al. (2019), we report the mean and standard deviation of validation accuracies across the 10 folds cross-validation. Cross-entropy loss is used for training the entire model. For obtaining the graph-level representation, we use simple averaging of embedding of all nodes as the readout function, i.e.,

where hv\bm{h}_{v} is the learned node representation for node vv in the graph.

For all the experiments, training is done using Adam optimizer (Kingma & Ba, 2014) and Xavier initialization (Glorot & Bengio, 2010) is used for initializing parameters.