RotatE: Knowledge Graph Embedding by Relational Rotation in Complex Space

Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, Jian Tang

TL;DR

RotatE is a knowledge graph embedding (KGE) model that represents relations as rotations in a complex vector space. This simple yet powerful geometric intuition allows the model to simultaneously capture four fundamental relational patterns: symmetry, antisymmetry, inversion, and composition. By doing so, RotatE significantly outperforms previous state-of-the-art models in predicting missing links within knowledge graphs.

The Challenge of Incomplete Knowledge Graphs

Knowledge Graphs (KGs), such as Freebase or WordNet, are massive repositories of facts represented as triplets: (head entity, relation, tail entity), or $(h, r, t)$. Despite their size, these graphs are notoriously incomplete. The goal of Knowledge Graph Embedding is to map these entities and relations into a low-dimensional space to accurately predict and fill in missing links.

The core challenge in this task is that relations exhibit diverse logical properties. For example:

  • Symmetry: If $A$ is married to $B$, then $B$ is married to $A$.
  • Inversion: "Hypernym" is the inverse relation of "Hyponym."
  • Composition: My mother’s husband is my father.

Previous models struggled to capture all these patterns simultaneously. For instance, TransE treats relations as linear translations, while ComplEx uses complex numbers for dot products. Both fall short of providing a unified approach capable of modeling the full spectrum of these logical patterns.

Methods: Relations as Rotations

To address these limitations, the authors introduce RotatE, which maps entities and relations to a complex vector space $\mathbb{C}^k$.

Comparison of TransE and RotatE, including how RotatE models symmetric relations.
  1. Relational Rotation: For a given triplet $(h, r, t)$, the model expects the tail entity to be a rotation of the head entity: $\mathbf{t} = \mathbf{h} \circ \mathbf{r}$, where $\circ$ is the Hadamard (element-wise) product.
  2. Unit Modulus Constraint: To ensure the relation acts strictly as a rotation, each element $r_i$ of the relation vector is constrained to have a modulus of 1 ($|r_i| = 1$). This means $r_i$ is effectively an angle $e^{i\theta_{r,i}}$ that shifts the phase of the head entity.
  3. Distance Function: The score of a triplet is defined by the distance $d_r(\mathbf{h}, \mathbf{t}) = \|\mathbf{h} \circ \mathbf{r} - \mathbf{t}\|$. A smaller distance indicates a more likely fact.
  4. Self-Adversarial Negative Sampling: Training KGE models requires "negative" (fake) triplets. Standard uniform sampling is inefficient because many fake triplets are "too easy" for the model to distinguish. RotatE introduces a technique that weights negative samples based on their current model score, forcing the model to focus on "hard" negatives that are more informative for learning.

Key Insights and Ideas

  • The Power of Phase: By treating relations as rotations, the model uses the phase (angle) of complex numbers to encode logic. Symmetry is modeled by a rotation of $\pi$ radians ($180^\circ$), inversion by a rotation in the opposite direction (complex conjugate), and composition by the addition of angles.
  • Unified Modeling: RotatE is the first model shown to theoretically and empirically satisfy symmetry, antisymmetry, inversion, and composition simultaneously.
  • Adversarial Efficiency: The self-adversarial sampling provides the benefits of Generative Adversarial Networks (GANs) but without the instability and computational overhead of training a separate generator network.
  • Modulus Matters: While the relation has a fixed modulus of 1, the entities do not. The authors found that allowing entity moduli to vary is crucial for modeling composition patterns effectively.

Key Results

RotatE was evaluated on several benchmark knowledge graphs (including FB15k, WN18, FB15k-237, WN18RR, Countries, and YAGO3-10) and set a new state-of-the-art across the board:

  • WN18RR: Achieved a Mean Reciprocal Rank (MRR) of 0.476, significantly higher than the previous best, ConvE (0.43).
  • FB15k-237: Improved MRR to 0.338 from ConvE's 0.325.
  • Countries Dataset: On the most difficult "S3" task (which requires complex composition), RotatE achieved an AUC-PR of 0.95, whereas DistMult and ComplEx struggled at 0.52 and 0.43, respectively.
  • Visual Confirmation: Histograms of the learned phases for symmetric relations showed clear peaks at $0$ and $\pi$, proving the model successfully learned the intended geometric logic.

Limitations and Future Work

  • Uncertainty: The current model is deterministic. The authors suggest that incorporating a probabilistic framework (like KG2E) to model the uncertainty of entities and relations could be a valuable future direction.
  • Complex Logic: While RotatE handles basic patterns well, more complex logical rules or hierarchical structures might require further extensions of the geometric intuition.
  • Scalability: While linear in time and memory, very large-scale graphs still pose a challenge for high-dimensional complex embeddings.

Summary updated

BibTeX
@inproceedings{sun2019rotate,
  author = {Zhiqing Sun and Zhi-Hong Deng and Jian-Yun Nie and Jian Tang},
  title = {{RotatE: Knowledge Graph Embedding by Relational Rotation in Complex Space}},
  booktitle = {International Conference on Learning Representations},
  year = {2019},
  url = {https://openreview.net/forum?id=oJoRk8jpFxc},
}
Figure