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 × r_i × conjugate(t_i)).
  • Key Insight: Complex conjugation breaks symmetry — Score(h, r, t) uses conjugate(t) but Score(t, r, h) uses 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 × 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_real + i × h_imag (two real vectors of dimension d/2).
- Each relation embedding: r = r_real + i × r_imag.
- Score: Re(h · r · conj(t)) = h_real · (r_real · t_real + r_imag · t_imag) + h_imag · (r_real · t_imag - r_imag · t_real).

Relation Pattern Modeling:
- Symmetric: When r_imag = 0, Score(h, r, t) = Score(t, r, h) — symmetric relations have zero imaginary part.
- Antisymmetric: r_real = 0 — Score(h, r, t) = -Score(t, r, h), perfectly antisymmetric.
- Inverse: For relation r and its inverse r', set r'_real = r_real and r'_imag = -r_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
Parametersd per rel2d per rel2d per rel4d 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.

Take complex further

Ask the copilot about this term, or have our engineers assess it against your process.