Abstract
Knowledge Graph (KG) embeddings are essential for tasks like link prediction but suffer from "memory bloat" as KGs scale, making them unsuitable for edge devices. We present DKGE (Discrete Knowledge Graph Embedding), a framework that learns compact binary codes directly through discrete optimization. By utilizing Hadamard translation in Hamming space and a mixed-integer alternating optimization strategy, DKGE achieves state-of-the-art accuracy with significantly reduced storage requirements. Our results on WN18RR and FB15k-237 show that DKGE outperforms post-hoc quantization and remains competitive with continuous models.
Introduction
Traditional Knowledge Graph embedding models represent entities and relations as high-dimensional vectors of floating-point numbers. While effective, these models are memory-intensive; for instance, applying TransE to large datasets can require tens of gigabytes. This prevents deployment on mobile or IoT devices. Previous "Learning to Hash" approaches—which binarize pre-trained continuous models—suffer from significant quantization loss. DKGE addresses this by learning discrete codes directly, preserving the structural geometry of the graph in binary space.
Methodology
DKGE skips the continuous representation phase and optimizes for discrete bits $\{ \pm 1 \}^k$ from the outset.
Hadamard Translation
In continuous models, relations are often modeled as translations ($h + r \approx t$). DKGE adapts this to binary space using the Hadamard product ($h \odot r \approx t$). In a space of 1s and -1s, the Hadamard product acts as a bit-flip operation, effectively "moving" the head entity toward the tail entity along axes defined by the relation.
Discrete Optimization
Optimizing over discrete bits is NP-hard. DKGE employs a mixed-integer alternating optimization strategy, softening constraints during training to maintain tractability while ensuring the final output is strictly binary.
Information Entropy Constraints
To maximize the efficiency of the binary codes, DKGE imposes two constraints:
- Balanced Partition: Each bit splits the dataset roughly in half to avoid constant bits.
- Decorrelation: Different bits are encouraged to be uncorrelated to minimize redundancy.
Experimental Results
The model was evaluated on the WN18RR and FB15k-237 benchmarks for KG link prediction.
Performance vs. Memory
As illustrated in the performance curves above, DKGE maintains high accuracy even at extremely low memory footprints. While traditional models like TransE and DistMult degrade rapidly under memory constraints, DKGE's direct discrete optimization preserves predictive power.
Key Findings
- Superiority over Hashing: DKGE significantly outperforms post-hoc quantization methods like Lloyd-Max or sign-functions applied to TransE and DistMult.
- Competitive Accuracy: On FB15k-237, DKGE (256 bits) achieved an MRR of 0.416, outperforming state-of-the-art continuous models such as ConvE (0.312) and TransE (0.279) despite the massive reduction in memory usage.
- Efficiency: Scoring triplets in DKGE involves fast bitwise XOR and bit-counting operations, which are natively supported by modern hardware, leading to significant computational speedups.
Discussion and Conclusion
DKGE demonstrates that optimizing for binary representations during training is superior to post-hoc binarization. The model performs particularly well on dense datasets where relations must distinguish between small groups of entities. While performance on very sparse datasets remains a challenge, the efficiency gains of DKGE make it a compelling choice for real-time applications on edge devices. Future work will explore more complex discrete operations and disentangled embeddings for improved interpretability.
Summary updated