Toward Understanding The Effect Of Loss function On Then Performance Of Knowledge Graph Embedding

Mojtaba Nayyeri, Chengjin Xu, Yadollah Yaghoobzadeh, Hamed Shariat Yazdi, Jens Lehmann · DOI

Abstract

Knowledge graphs (KGs) represent facts in structured forms, and KG completion aims to discover new facts from existing ones. While the Translation-based embedding model (TransE) is efficient, it is often criticized for its inability to encode complex relation patterns like symmetry or reflexivity. This paper challenges that notion, demonstrating that these limitations are largely a byproduct of ignoring the role of the loss function. By analyzing the "region of truth" defined by various loss functions, we show that proper selection can mitigate these theoretical constraints. We introduce TransComplEx, a model that leverages complex space and specific loss functions to achieve state-of-the-art performance with high efficiency.

Introduction

Knowledge Graph Embedding (KGE) models represent entities and relations as low-dimensional vectors to predict missing links. The classic TransE model ($h + r \approx t$) is favored for its simplicity but is mathematically argued to fail at encoding logical patterns like symmetry. For instance, in a symmetric relation, TransE's logic traditionally forces the relation vector to zero, collapsing the embedding space.

This research argues that these perceived limitations only exist if one assumes a perfect score of zero is required for a fact to be true. In practice, models are trained with loss functions that allow for a margin of error. By reinvestigating these boundaries through the lens of the loss function, we reveal that simpler models possess greater representational capacity than previously assumed.

The Role of Loss Functions and the "Region of Truth"

The core theoretical contribution of this work is the categorization of loss functions based on how they bound the scores of positive and negative samples. If a loss function defines a "region of truth"—a sphere of radius $\gamma_1$ around the target rather than a single point—the classic limitations of translation-based models vanish.

Visualization of the 'Region of Truth' defined by different loss function constraints.

By reformulating training as a constrained optimization problem, the loss function becomes a fundamental part of the model's representational capacity. This visualization shows how truth can be represented as a volume, allowing symmetric relations to be encoded even within a translation-based framework.

The TransComplEx Model

To build on these insights, we propose TransComplEx, which performs translation in complex space. Specifically, it translates the head entity vector to the conjugate of the tail entity vector. This approach allows the model to distinguish between subject and object roles while remaining computationally leaner than models like ComplEx, requiring only four vector operations instead of eight. Additionally, we derive algebraic formulae for symmetry, inversion, and implication to be used as regularization terms, explicitly injecting these patterns into the model.

Experimental Evaluation

We evaluated TransComplEx on four standard benchmarks: FB15k, WN18, and their more challenging counterparts, FB15k-237 and WN18RR (which remove inverse relations to prevent data leakage).

Performance comparison on FB15k-237 and WN18RR datasets, highlighting the effectiveness of TransComplEx with optimized loss functions.

Key Results

  • Superior Performance: TransComplEx, paired with a "limit-based" loss function (e.g., RPTransComplEx6), significantly outperformed standard TransE and complex models like TorusE and R-GCN on challenging datasets.
  • Efficiency: The model achieved competitive results using smaller embedding dimensions ($d=200$) compared to RotatE ($d=1,000$) or TorusE ($d=10,000$).
  • Theoretical Validation: Experiments confirmed that the choice of loss function directly impacts the model's ability to handle specific relation patterns, validating our theoretical proofs.

Conclusion

This paper rehabilitates the translation-based class of KGE models by highlighting the critical role of the loss function. By defining a "region of truth," we show that models like TransE and the proposed TransComplEx can overcome traditional theoretical hurdles. Future work will explore automated loss selection and extending these theories to other distance-based models like RotatE to further mitigate the challenges of Many-to-Many (M-N) relations.

Summary updated

Abstract

Knowledge graphs (KGs) represent world's facts in structured forms. KG completion exploits the existing facts in a KG to discover new ones. Translation-based embedding model (TransE) is a prominent formulation to do KG completion. Despite the efficiency of TransE in memory and time, it suffers from several limitations in encoding relation patterns such as symmetric, reflexive etc. To resolve this problem, most of the attempts have circled around the revision of the score function of TransE i.e., proposing a more complicated score function such as Trans(A, D, G, H, R, etc) to mitigate the limitations. In this paper, we tackle this problem from a different perspective. We show that existing theories corresponding to the limitations of TransE are inaccurate because they ignore the effect of loss function. Accordingly, we pose theoretical investigations of the main limitations of TransE in the light of loss function. To the best of our knowledge, this has not been investigated so far comprehensively. We show that by a proper selection of the loss function for training the TransE model, the main limitations of the model are mitigated. This is explained by setting upper-bound for the scores of positive samples, showing the region of truth (i.e., the region that a triple is considered positive by the model). Our theoretical proofs with experimental results fill the gap between the capability of translation-based class of embedding models and the loss function. The theories emphasise the importance of the selection of the loss functions for training the models. Our experimental evaluations on different loss functions used for training the models justify our theoretical proofs and confirm the importance of the loss functions on the performance.
BibTeX
@misc{nayyeri2019toward,
  author = {Mojtaba Nayyeri and Chengjin Xu and Yadollah Yaghoobzadeh and Hamed Shariat Yazdi and Jens Lehmann},
  title = {{Toward Understanding The Effect Of Loss function On Then Performance Of Knowledge Graph Embedding}},
  year = {2019},
  eprint = {1909.00519},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1909.00519},
}
Figure