# Modeling Relational Data with Graph Convolutional Networks

Graph convolutional networks fill gaps in relational knowledge bases

Michael Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, Max Welling · arXiv · 2017-3-17

- **Problem** Knowledge bases such as Yago, DBPedia and Wikidata remain incomplete. Earlier link prediction methods learn a free vector per entity and overfit on the many relation types.
- **Method** R-GCN is a graph convolutional network that sums neighbor messages separately for each relation and edge direction. It acts as an entity classifier, or as the encoder that feeds a DistMult scorer for link prediction.
- **Results** The authors report a filtered MRR of 0.248 on FB15k-237 against 0.191 for DistMult alone, a 29.8% improvement.

## Why missing facts call for neighborhood evidence

Knowledge bases store facts as subject-predicate-object triples and support applications such as question answering and information retrieval, yet even very large ones such as Yago, DBPedia and Wikidata remain incomplete. The study addresses two tasks on such graphs: link prediction, which recovers missing triples, and entity classification, which assigns types or other categorical properties to entities.

The working assumption is that many missing pieces sit in the neighborhood of an entity. An educated-at edge, for instance, implies that the entity has a certain type and probably other facts that are not yet recorded.

Real knowledge bases contain many relation types, and per-relation parameters grow with that number. This tends to overfit rare relations and produces very large models. The model therefore has to be designed for multi-relational data from the start, rather than being a plain graph model applied to a relation-labeled graph.

## How a relation-aware layer aggregates neighbors

A graph convolutional network updates each node by collecting messages from its neighbors and applying an elementwise nonlinearity such as ReLU to the sum. In the simplest case the message is a linear map of the neighbor state. The R-GCN keeps this form but makes the map depend on the relation type and on the direction of the edge. The graph is a directed, labeled multigraph.

The relation set contains both the canonical direction of each relation and its inverse, so information can flow along an edge either way.

For node \\(v\_i\\) in layer \\(l+1\\), equation (2) sums over every relation \\(r\\) and, inside each relation, over the neighbors \\(j\\) in \\(\\mathcal{N}\_i^r\\). Each neighbor state \\(h\_j^{(l)}\\) is multiplied by a relation-specific matrix \\(W\_r^{(l)}\\) and by \\(1/c\_{i,r}\\), so the sum is normalized per node and per relation. A separate term \\(W\_0^{(l)} h\_i^{(l)}\\) carries the node's own state from the previous layer, and the whole sum is passed through the activation \\(\\sigma\\).

This self-connection lets a node keep its earlier representation. The constant \\(c\_{i,r}\\) can be learned or fixed in advance, for example as \\(c\_{i,r}=\|\\mathcal{N}\_i^r\|\\), the number of neighbors under the relation.

Every relation and direction gets its own matrix, so an edge such as born in is handled differently from its inverse. Because the update is a sum of sparse neighbor terms, a whole layer can be evaluated for all nodes at once with sparse matrix products, and stacking layers lets information from several relational steps away reach a node. When no node features exist, each node starts from a unique one-hot vector, and the authors use this featureless input throughout.

When block decomposition is used, the one-hot vector is first mapped to a dense representation by a linear transformation.

## Keeping the number of relation matrices workable

In the basis decomposition, each \\(W\_r^{(l)}\\) is a linear combination \\(W\_r^{(l)}=\\sum\_{b=1}^{B} a\_{rb}^{(l)} V\_b^{(l)}\\) of \\(B\\) basis matrices \\(V\_b^{(l)}\\) of size \\(d^{(l+1)}\\times d^{(l)}\\). Only the coefficients \\(a\_{rb}^{(l)}\\) depend on the relation. Since all relations draw on the same bases, rare relations update the same shared matrices as frequent ones.

The authors expect this to reduce overfitting on rare relations.

The block decomposition builds each \\(W\_r^{(l)}\\) as the block-diagonal matrix \\(\\mathrm{diag}(Q\_{1r}^{(l)},\\dots,Q\_{Br}^{(l)})\\), where each block \\(Q\_{br}^{(l)}\\) is of size \\((d^{(l+1)}/B)\\times(d^{(l)}/B)\\). Within this form, latent features are split into groups that couple more strongly inside each group than across groups. The authors read the block structure as a sparsity constraint on the matrices of each relation.

The entity classification runs and the FB15k and WN18 runs use the basis form, while the FB15k-237 runs use the block form.

## Training the node classifier

For entity classification, layers of the form in equation (2) are stacked, and a softmax is applied to the output of the last layer at each node. The loss is a cross-entropy summed over the labeled nodes only, with unlabeled nodes ignored. It is written as \\(L=-\\sum\_{i\\in Y}\\sum\_{k=1}^{K} t\_{ik}\\ln h^{(L)}\_{ik}\\), where \\(Y\\) is the set of labeled node indices and \\(t\_{ik}\\) is the ground truth label.

Training uses full-batch gradient descent, and the reported entity classification runs use the Adam optimizer.

## Scoring triples with an encoder and a DistMult decoder

The link prediction model is an autoencoder. The encoder maps each entity to a vector \\(e\_i\\), and the decoder scores (subject, relation, object) triples from these vectors. Earlier factorization approaches learn a free vector for every entity during training. Here the entity vectors are the final-layer outputs of the R-GCN, so \\(e\_i=h\_i^{(L)}\\), and they depend on the graph neighborhood.

DistMult gives each relation a diagonal matrix \\(R\_r\\), and a triple is scored as \\(f(s,r,o)=e\_s^{T}R\_r e\_o\\). The authors chose it as a simple and effective decoder, and note that the encoder can in principle be paired with any scoring function.

Training uses negative sampling: for each observed triple, \\(\\omega\\) corrupted triples are drawn by replacing either its subject or its object. The loss is \\(L=-\\frac{1}{(1+\\omega)\|\\hat{E}\|}\\sum\_{(s,r,o,y)\\in T}\\big\[y\\log l(f(s,r,o))+(1-y)\\log(1-l(f(s,r,o)))\\big\]\\), where \\(T\\) contains the observed and corrupted triples, \\(l\\) is the logistic sigmoid, and \\(y=1\\) for observed triples and \\(y=0\\) for corrupted ones.

## Entity classification on four RDF datasets

The four RDF datasets are AIFB, MUTAG, BGS and AM, with 8,285, 23,644, 333,845 and 1,666,764 entities. The labeled subsets contain 176, 340, 146 and 1,000 entities, and the classes number 4, 2, 2 and 11. Relations that were used to create the entity labels were removed before training, for example employs and affiliation for AIFB and isMutagenic for MUTAG.

Feat builds a feature vector from the in-degree and out-degree per relation of each labeled entity. Weisfeiler-Lehman kernels (WL) and RDF2Vec are the other baselines, with RDF2Vec embedding walks through Skipgram. The R-GCN for this task has two layers with 16 hidden units (10 for AM), uses basis decomposition, and is trained with Adam for 50 epochs at a learning rate of 0.01.

The normalization constant is \\(c\_{i,r}=\|\\mathcal{N}\_i^r\|\\), and 20% of the training set is held out for hyperparameter tuning.

## Why FB15k-237 replaces the older benchmarks

FB15k and WN18 contain inverse triple pairs, so a test triple often has its inverse in training. Toutanova and Chen showed that a simple neighbor-based baseline, LinkFeat, can exploit this and outperform existing systems by a large margin. Toutanova and Chen removed the inverse pairs to create FB15k-237, which the study uses as its primary evaluation dataset.

FB15k and WN18 are still reported, using the splits of Bordes et al. The three datasets have 40,943, 14,951 and 14,541 entities. Their training splits contain 141,442, 483,142 and 272,115 edges, respectively.

The baselines are direct optimization of DistMult, LinkFeat, ComplEx, HolE, CP and TransE. The normalization constant for link prediction is \\(c\_i=\\sum\_r \|\\mathcal{N}\_i^r\|\\), chosen because it worked best on validation splits. All models use full-batch optimization and one negative sample per positive (\\(\\omega=1\\)). The factorization baselines use the parameters of Trouillon et al., except for the dimensionality on FB15k-237.

Results are given as raw and filtered mean reciprocal rank (MRR) and as Hits at 1, 3 and 10. The authors note that filtered MRR is typically considered the more reliable of the two.

## Results on FB15k and WN18

On FB15k the R-GCN raised filtered MRR from 0.634 for DistMult to 0.651. The R-GCN+ ensemble reached 0.696, above ComplEx at 0.692. On WN18 the R-GCN reached filtered MRR 0.814 and Hits at 10 of 0.955, against 0.813 and 0.943 for DistMult. Its Hits at 1 of 0.686 was below DistMult's 0.701.

The authors plot FB15k validation MRR against the average degree of the subject and object, and find that R-GCN performs better on high-degree nodes where context is abundant. The authors expect local context from inverse relations to dominate the factorization models on FB15k. Because the two models behave differently, they combine them into R-GCN+.

R-GCN+ is a weighted sum of the R-GCN score and the DistMult score, \\(f(s,r,t)\_{\\text{R-GCN+}}=\\alpha f(s,r,t)\_{\\text{R-GCN}}+(1-\\alpha)f(s,r,t)\_{\\text{DistMult}}\\), with \\(\\alpha=0.4\\) chosen on FB15k development data. The two models were trained separately. On FB15k and WN18, R-GCN and R-GCN+ outperform DistMult but score below LinkFeat, which the authors link to inverse relation pairs in these datasets.

R-GCN+ is above ComplEx on FB15k even though its DistMult decoder does not model asymmetric relations. The authors suggest that pairing the encoder with ComplEx could be a promising direction.

## Gains on FB15k-237

On FB15k-237, DistMult reached raw MRR 0.100 and filtered MRR 0.191, with Hits at 10 of 0.376. The R-GCN reached 0.158 raw, 0.248 filtered and Hits at 10 of 0.414. The authors report that R-GCN outperforms the DistMult baseline by a margin of 29.8% on this dataset. They attribute this to the separate encoder, since the decoder alone performs comparatively weakly.

R-GCN+ reached raw MRR 0.156 and filtered MRR 0.249, and the authors expect the two R-GCN variants to perform similarly here because local information is less salient on this dataset. Among the other factorization methods, filtered MRR was 0.182 for CP, 0.233 for TransE, 0.222 for HolE and 0.201 for ComplEx. The R-GCN scored above each of them on this measure.

## Limits of the evidence

On MUTAG and BGS the labeled entities connect mainly through high-degree hub nodes that encode features. The authors conjecture, without testing it, that the fixed normalization constant is partly to blame, since it weakens messages from high-degree nodes. The authors propose replacing the normalization constant with data-dependent attention weights as future work.

This was not evaluated.

On FB15k and WN18 the R-GCN results trail LinkFeat, so the inverse relation pairs in these datasets remain a strong source of performance for that baseline. The FB15k-237 numbers are not directly comparable with those in Toutanova and Chen, because that work pruned both training and testing with a schema that is not fully specified. The degree analysis uses only the FB15k validation data.

The combination with ComplEx as decoder is suggested but not run. Subsampling for scalability is named as future work and was not tested. Richer message functions than linear maps were left for future work, and only featureless input was used.

## Where R-GCN sits among related work

The decoder uses DistMult, which is a simpler special case of the RESCAL factorization. Many other factorizations for relational data can be viewed as modifications of tensor decompositions such as CP or Tucker. Path-based methods add auxiliary triples or use paths as features. The authors judge the path-as-feature line the closest comparison, and argue that R-GCNs are a computationally cheaper alternative.

The R-GCN is an adaptation of earlier graph convolutional networks to large, highly multi-relational data. Earlier graph neural networks with gating mechanisms are also related. The R-GCN can be seen as a subclass of message passing neural networks, which include GCNs under a differentiable message-passing view.

## Paper info

- **Authors**: Michael Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, Max Welling
- **Venue**: arXiv · Preprint
- **First published**: 2017-3-17
- **Added**: 2026-11-11
- **Updated**: 2017-10-26
- **Version**: v4
- **arXiv**: 1703.06103
- **Category**: stat.ML · cs.AI · cs.DB · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1703.06103v4) · [PDF ↗](https://arxiv.org/pdf/1703.06103v4)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Michael Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, Max Welling (2017). Modeling Relational Data with Graph Convolutional Networks. arXiv:1703.06103v4. https://arxiv.org/abs/1703.06103v4

**BibTeX**

```
@misc{schlichtkrull2017modeling,
  title = {{Modeling Relational Data with Graph Convolutional Networks}},
  author = {Michael Schlichtkrull and Thomas N. Kipf and Peter Bloem and Rianne van den Berg and Ivan Titov and Max Welling},
  year = {2017},
  eprint = {1703.06103},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1703.06103v4}
}
```

## Other paper commentary

- [Graph Neural Networks: A Review of Methods and Applications](https://refivu.com/en/papers/a985ee6a-3fda-41af-b6ea-0451377e5861-graph-neural-networks-a-review-of-methods-and.md)
- [Federated Social Recommendation with Graph Neural Network](https://refivu.com/en/papers/ce54fcd7-f119-4f48-9809-3fe4f5cc05cd-federated-social-recommendation-with-graph-neural-network.md)
- [MixHop: Higher-Order Graph Convolutional Architectures via Sparsified Neighborhood Mixing](https://refivu.com/en/papers/1250a8b5-0d20-48a6-bf8a-8ec6a0c220d1-mixhop-higher-order-graph-convolutional-architectures-via.md)
- [Exact Combinatorial Optimization with Graph Convolutional Neural Networks](https://refivu.com/en/papers/8df34e94-f13d-47fe-92a7-0d3d6b6d4386-exact-combinatorial-optimization-with-graph-convolutional.md)
- [Graph Attention Networks](https://refivu.com/en/papers/9453459f-8cee-4a2b-bdcf-07c59d5154f7-graph-attention-networks.md)
- [Semi-Supervised Classification with Graph Convolutional Networks](https://refivu.com/en/papers/89f4a475-b549-4284-b0c0-d55b805b7f3b-semi-supervised-classification-with-graph-convolutional.md)
- [A Survey Of Methods For Explaining Black Box Models](https://refivu.com/en/papers/e8fafeb3-dfaa-4e9a-b461-dc36765f1ed6-a-survey-of-methods-for-explaining-black-box.md)
- [Image Super-Resolution Using Very Deep Residual Channel Attention Networks](https://refivu.com/en/papers/4d16f8f5-55cc-4ee1-82f5-57e540466eec-image-super-resolution-using-very-deep-residual-channel.md)
- [OpenAI Gym](https://refivu.com/en/papers/0be35f1c-219a-4606-a9f9-894f5c111448-openai-gym.md)
- [OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields](https://refivu.com/en/papers/5a0057d5-5ad8-405d-b3a0-1ddc3220df6c-openpose-realtime-multi-person-2d-pose-estimation-using.md)
- [DETRs Beat YOLOs on Real-time Object Detection](https://refivu.com/en/papers/2872fb04-6c8b-4f48-a976-80e6dd5be309-detrs-beat-yolos-on-real-time-object-detection.md)
- [BPR: Bayesian Personalized Ranking from Implicit Feedback](https://refivu.com/en/papers/e3d177de-9c9b-45b7-bcb5-9ef28bee1dbb-bpr-bayesian-personalized-ranking-from-implicit-feedback.md)

## Terms in this paper

- [Accuracy](https://refivu.com/en/terms/1995c0cd6282-accuracy)
- [ADAM](https://refivu.com/en/terms/0e9ad0199e08-adam)
- [cross-entropy loss](https://refivu.com/en/terms/14067bdf8b9f-cross-entropy-loss)
- [Negative sampling](https://refivu.com/en/terms/1dbdea971d8c-negative-sampling)
- [GCN](https://refivu.com/en/terms/6be0326c6c22-gcn)
- [link prediction](https://refivu.com/en/terms/f029f4345f8f-link-prediction)
- [mean reciprocal rank](https://refivu.com/en/terms/5cee33207fc4-mean-reciprocal-rank)
- [ComplEx](https://refivu.com/en/terms/2ee89a982e60-complex)
- [FB15k](https://refivu.com/en/terms/09c2abe5db4f-fb15k)
- [HolE](https://refivu.com/en/terms/dbc7104c4028-hole)
- [DistMult](https://refivu.com/en/terms/8c76f9cebe58-distmult)
- [Edge Dropout](https://refivu.com/en/terms/04d79396c0cb-edge-dropout)
- [Hits at n](https://refivu.com/en/terms/d77e7932c9d1-hits-at-n)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/0f5e1839-5aad-4ffe-b183-7d735f8896a8-modeling-relational-data-with-graph-convolutional-networks)
