Chip Foundry Services Request Assessment

Complex

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}}$.

$$- Score: Re(h \cdot r \cdot \operatorname{conj}(t)) = h_{\text{real}} \cdot (r_{\text{real}} \cdot t_{\text{real}} + r_{\text{imag}} \cdot t_{\text{imag}}) + h_{\text{imag}} \cdot (r_{\text{real}} \cdot t_{\text{imag}} - r_{\text{imag}} \cdot t_{\text{real}}).$$

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

CapabilityDistMultComplExRotatEQuatE
SymmetricYesYesYesYes
AntisymmetricNoYesYesYes
InverseNoYesYesYes
CompositionNoLimitedYesYes
Parameters$d$ per rel$2d$ per rel$2d$ per rel$4d$ per rel

Benchmark Performance

DatasetMRRHits@1Hits@10
FB15k-2370.2780.1940.450
WN18RR0.4400.4100.510
FB15k0.6920.5990.840
WN180.9410.9360.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.