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
| Aspect | ComplEx | RotatE | QuatE |
|---|---|---|---|
| Embedding Space | Complex (2D) | Complex (2D, unit) | Quaternion (4D, unit) |
| Parameters/Entity | 2d | 2d | 4d |
| Relation DoF | 2 per dim | 1 per dim (angle) | 3 per dim (3 angles) |
| Commutative | Yes | Yes | No |
| Composition | Limited | Yes | Yes |
Benchmark Performance
| Dataset | MRR | Hits@1 | Hits@10 |
|---|---|---|---|
| FB15k-237 | 0.348 | 0.248 | 0.550 |
| WN18RR | 0.488 | 0.438 | 0.582 |
| FB15k | 0.833 | 0.800 | 0.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.
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.