Knowledge Graph Embeddings vs GNNs
Published:
The Knowledge Graph Completion Task
A knowledge graph (KG) is a collection of triples (subject, relation, object) — e.g., (John_Lennon, member_of, The_Beatles). It is always incomplete: some true triples are missing. KG completion is the task of predicting missing triples.
Evaluation: given (s, r, ?), rank all candidate objects. Metrics: MRR (mean reciprocal rank), Hits@k.
Shallow KG Embeddings
These methods assign a learned embedding to each entity and relation, then score triples with a simple function.
TransE (Bordes et al., 2013)
Interprets relations as translations in embedding space: e_o ≈ e_s + w_r. Excellent for hierarchical, tree-like relations. Cannot model symmetric (friends_with: s=o) or many-to-many relations well.
DistMult (Yang et al., 2015)
Elementwise interaction. Symmetric (f(s,r,o) = f(o,r,s)) — cannot model antisymmetric relations.
ComplEx (Trouillon et al., 2016)
Uses complex-valued embeddings. Handles both symmetric and antisymmetric relations. Generally outperforms TransE and DistMult on standard benchmarks.
RotatE (Sun et al., 2019)
Relations as rotations in complex space. Handles symmetry, antisymmetry, inversion, composition — a richer relational geometry.
Key Properties of Shallow Methods
| Property | TransE | DistMult | ComplEx | RotatE | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Parameters | E | d + | R | d | E | d + | R | d | 2 | E | d + 2 | R | d | 2 | E | d + 2 | R | d | ||
| Transductive | Yes | Yes | Yes | Yes | ||||||||||||||||
| Inductive | No | No | No | No | ||||||||||||||||
| Symmetric relations | No | Yes | Yes | Yes | ||||||||||||||||
| Antisymmetric | Yes | No | Yes | Yes | ||||||||||||||||
| Composition | Partial | No | No | Yes |
Transductive: requires all entities seen during training. Cannot embed new entities at test time without retraining.
GNN-Based KG Completion
R-GCN and CompGCN use GNNs as encoders — producing entity embeddings that are informed by the graph structure, not just the entity’s identity.
CompGCN (Vashishth et al., 2020)
CompGCN generalises R-GCN by composing entity and relation embeddings during message passing:
Where ∘ is a composition operator (subtraction, multiplication, circular correlation) and z_r is the relation embedding. The composition operator is shared with the decoder.
When to Use Shallow vs GNN Methods
| Scenario | Recommendation |
|---|---|
| Very large KG (millions of entities) | Shallow (RotatE, ComplEx) — scalable |
| New entities at test time (inductive) | GNN (R-GCN, CompGCN) |
| Few triples per entity | GNN (leverages neighbourhood structure) |
| Many triples per entity | Shallow sufficient |
| Multi-hop reasoning required | GNN or neural LP models |
| Production system, speed matters | Shallow (single embedding lookup) |
Multi-Hop Reasoning
Shallow methods score triples in isolation — they cannot directly reason about multi-hop paths (e.g., “X is the sibling of Y’s parent” → X is an aunt/uncle of Y). GNNs propagate information over multiple hops, enabling implicit multi-hop reasoning.
Neural LP (Lao & Cohen) and MINERVA (Das et al.) take this further with explicit path-based reasoning, but are slower.
Summary
Shallow KG embeddings are fast, scalable, and well-understood. GNN-based methods are inductive, structure-aware, and better for multi-hop patterns. The trend in the field is hybrid: use a GNN encoder to produce structure-aware entity embeddings, then score with a shallow decoder (DistMult, RotatE). This combines structural awareness with score function expressiveness.
References
- Bordes, A., Usunier, N., Garcia-Durán, A., Weston, J., & Yakhnenko, O. (2013). Translating Embeddings for Modeling Multi-relational Data. NeurIPS 2013 (TransE).
- Yang, B., Yih, W.-T., He, X., Gao, J., & Deng, L. (2015). Embedding Entities and Relations for Learning and Inference in Knowledge Bases. ICLR 2015 (DistMult).
- Trouillon, T., Welbl, J., Riedel, S., Gaussier, É., & Bouchard, G. (2016). Complex Embeddings for Simple Link Prediction. ICML 2016 (ComplEx).
- Sun, Z., Deng, Z.-H., Nie, J.-Y., & Tang, J. (2019). RotatE: Knowledge Graph Embedding by Relational Rotation in Complex Space. ICLR 2019.
- Vashishth, S., Sanyal, S., Nitin, V., & Talukdar, P. (2020). Composition-based Multi-Relational Graph Convolutional Networks. ICLR 2020 (CompGCN).
