ComplEx (Complex Embeddings for Simple Link Prediction) is a knowledge graph embedding model that extends bilinear factorization into the complex number domain — using complex-valued entity and relation vectors to elegantly model both symmetric and antisymmetric relations simultaneously, achieving state-of-the-art link prediction by exploiting the asymmetry inherent in complex conjugation.
What Is ComplEx?
- Definition: A bilinear KGE model where entities and relations are represented as complex-valued vectors (each dimension has a real and imaginary part), scored by the real part of the trilinear Hermitian product: $Score(h, r, t) = Re(\sum$ of $h_i \times r_i \times \operatorname{conjugate}(t_i)$).
- Key Insight: Complex conjugation breaks symmetry — $Score(h, r, t)$ uses $\operatorname{conjugate}(t)$ but $Score(t, r, h)$ uses $\operatorname{conjugate}(h)$, so the two scores are different for asymmetric relations.
- Trouillon et al. (2016): The original paper demonstrated that this simple extension of DistMult to complex numbers enables modeling the full range of relation types.
- Relation to DistMult: When imaginary parts are zero, ComplEx reduces exactly to DistMult — it is a strict generalization, adding expressive power at $2x$ memory cost.
Why ComplEx Matters
- Full Relational Expressiveness: ComplEx can model symmetric (MarriedTo), antisymmetric (FatherOf), inverse (ChildOf is inverse of ParentOf), and composition patterns — the four fundamental relation types in knowledge graphs.
- Elegant Mathematics: Complex numbers provide a natural geometric framework — symmetric relations correspond to real-valued relation vectors; antisymmetric relations require imaginary components.
- State-of-the-Art: For years, ComplEx held top positions on $FB15k-237$ and WN18RR benchmarks — demonstrating that the complex extension is practically significant, not just theoretically elegant.
- Efficient: Same $O(N \times d)$ complexity as DistMult (treating complex d-dimensional as real 2d-dimensional) — no quadratic parameter growth unlike full bilinear RESCAL.
- Theoretical Completeness: Proven to be a universal approximator of binary relations — given sufficient dimensions, ComplEx can represent any relational pattern.
Mathematical Foundation
Complex Number Representation:
- Each entity embedding: $h = h_{\text{real}} + i \times h_{\text{imag}}$ (two real vectors of dimension d/2).
- Each relation embedding: $r = r_{\text{real}} + i \times r_{\text{imag}}$.
Relation Pattern Modeling:
- Symmetric: When $r_{\text{imag}} = 0, Score(h, r, t) = Score(t, r, h)$ — symmetric relations have zero imaginary part.
- Antisymmetric: $r_{\text{real}} = 0$ — $Score(h, r, t) = -Score(t, r, h)$, perfectly antisymmetric.
- Inverse: For relation $r$ and its inverse $r'$, set $r'_{\text{real}} = r_{\text{real}}$ and $r'_{\text{imag}} = -r_{\text{imag}}$ — the complex conjugate.
- General: Any combination of real and imaginary components models intermediate symmetry levels.
ComplEx vs. Competing Models
| Capability | DistMult | ComplEx | RotatE | QuatE |
|---|---|---|---|---|
| Symmetric | Yes | Yes | Yes | Yes |
| Antisymmetric | No | Yes | Yes | Yes |
| Inverse | No | Yes | Yes | Yes |
| Composition | No | Limited | Yes | Yes |
| Parameters | $d$ per rel | $2d$ per rel | $2d$ per rel | $4d$ per rel |
Benchmark Performance
| Dataset | MRR | Hits@1 | Hits@10 |
|---|---|---|---|
| FB15k-237 | 0.278 | 0.194 | 0.450 |
| WN18RR | 0.440 | 0.410 | 0.510 |
| FB15k | 0.692 | 0.599 | 0.840 |
| WN18 | 0.941 | 0.936 | 0.947 |
Extensions of ComplEx
- TComplEx: Temporal extension — time-dependent ComplEx for facts valid only in certain periods.
- ComplEx-N3: ComplEx with nuclear $3-norm$ regularization — dramatically improves performance with proper regularization.
- RotatE: Constrains relation vectors to unit complex numbers — rotation model that provably subsumes TransE.
- Duality-Induced Regularization: Theoretical analysis showing ComplEx's duality with tensor decompositions.
Implementation
- PyKEEN: ComplExModel with full evaluation pipeline, loss functions, and regularization.
- AmpliGraph: ComplEx with optimized negative sampling and batch training.
- Manual PyTorch: Define complex embeddings as $(N, 2d)$ tensors; implement Hermitian product in 5 lines.
ComplEx is logic in the imaginary plane — a mathematically principled extension of bilinear models into complex space that elegantly handles the full spectrum of relational semantics through the geometry of complex conjugation.