quate

QuatE (Quaternion Embeddings) is a knowledge graph embedding model that extends RotatE from 2D complex rotations to 4D quaternion space — representing each relation as a quaternion rotation operator, leveraging the non-commutativity of quaternion multiplication to capture rich, asymmetric relational patterns that cannot be fully expressed in the complex plane.

What Is QuatE?

  • Definition: An embedding model where entities and relations are represented as d-dimensional quaternion vectors, with triple scoring based on the Hamilton product between the head entity and normalized relation quaternion, measuring proximity to the tail entity in quaternion space.
  • Quaternion Algebra: Quaternions extend complex numbers to 4D: q = a + bi + cj + dk, where i, j, k are imaginary units satisfying i² = j² = k² = ijk = -1 and the non-commutative multiplication rule ij = k but ji = -k.
  • Zhang et al. (2019): QuatE demonstrated that 4D rotation spaces capture richer relational semantics than 2D rotations, achieving state-of-the-art performance on WN18RR and FB15k-237.
  • Geometric Interpretation: Each relation applies a 4D rotation (parameterized by 4 numbers) to the head entity — more degrees of freedom than RotatE's 2D rotations means more expressive relation representations.

Why QuatE Matters

  • Higher Expressiveness: 4D quaternion rotations can represent any 3D rotation plus additional transformations — more degrees of freedom capture subtler relational distinctions.
  • Non-Commutativity: Quaternion multiplication is non-commutative (q1 × q2 ≠ q2 × q1) — this inherently captures ordered, directional relations without special constraints.
  • State-of-the-Art Performance: QuatE consistently achieves higher MRR and Hits@K than ComplEx and RotatE on standard benchmarks — the additional geometric expressiveness translates to empirical gains.
  • Disentangled Representations: Quaternion components may disentangle different aspects of relational semantics (scale, rotation axes, angles) — richer structural representations.
  • Covers All Patterns: Like RotatE, QuatE models symmetry, antisymmetry, inversion, and composition — but with richer parameterization.

Quaternion Mathematics for KGE

Quaternion Representation:
- Entity h: h = (h_0, h_1, h_2, h_3) where each component is a d/4-dimensional real vector.
- Relation r: normalized to unit quaternion — |r| = 1 (analogous to RotatE's unit modulus constraint).
- Hamilton Product: h ⊗ r = (h_0r_0 - h_1r_1 - h_2r_2 - h_3r_3) + (h_0r_1 + h_1r_0 + h_2r_3 - h_3r_2)i + ...

Scoring Function:
- Score(h, r, t) = (h ⊗ r) · t — inner product between the rotated head and the tail entity.
- Normalization: relation quaternion r normalized to |r| = 1 before computing Hamilton product.

Non-Commutativity Advantage:
- h ⊗ r ≠ r ⊗ h — applying relation then checking tail differs from applying relation to tail.
- Naturally encodes directional asymmetry without explicit constraints.

QuatE vs. RotatE vs. ComplEx

AspectComplExRotatEQuatE
Embedding SpaceComplex (2D)Complex (2D, unit)Quaternion (4D, unit)
Parameters/Entity2d2d4d
Relation DoF2 per dim1 per dim (angle)3 per dim (3 angles)
CommutativeYesYesNo
CompositionLimitedYesYes

Benchmark Performance

DatasetMRRHits@1Hits@10
FB15k-2370.3480.2480.550
WN18RR0.4880.4380.582
FB15k0.8330.8000.900

QuatE Extensions

  • DualE: Dual quaternion embeddings — extends QuatE with dual quaternions encoding both rotation and translation in one algebraic structure.
  • BiQUEE: Biquaternion embeddings combining two quaternion components — further extends expressiveness.
  • OctonionE: Extension to 8D octonion space — maximum geometric expressiveness at significant computational cost.

Implementation

  • PyKEEN: QuatEModel with Hamilton product implemented efficiently using real-valued tensors.
  • Manual PyTorch: Implement Hamilton product explicitly — compute four real vector products, combine per quaternion multiplication rules.
  • Memory: 4x parameters compared to real-valued models — ensure sufficient GPU memory for large entity sets.

QuatE is high-dimensional geometric reasoning — harnessing the rich algebra of 4D quaternion rotations to encode the full complexity of real-world relational patterns, pushing knowledge graph embedding expressiveness beyond what 2D complex rotations can achieve.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account