Previous knowledge graph embedding approaches usually map entities to representations and utilize score functions to predict the target entities, yet they typically struggle to reason rare or emerging unseen entities. In this paper, we propose kNN-KGE, a new knowledge graph embedding approach with pre-trained language models, by linearly interpolating its entity distribution with k-nearest neighbors. We compute the nearest neighbors based on the distance in the entity embedding space from the knowledge store. Our approach can allow rare or emerging entities to be memorized explicitly rather than implicitly in model parameters. Experimental results demonstrate that our approach can improve inductive and transductive link prediction results and yield better performance for low-resource settings with only a few triples, which might be easier to reason via explicit memory. Code is available at https://github.com/zjunlp/KNN-KG.
翻译:以往的知识图谱嵌入方法通常将实体映射为表征,并利用评分函数预测目标实体,但这类方法难以对稀有或未见过的新实体进行推理。本文提出kNN-KGE——一种结合预训练语言模型的新知识图谱嵌入方法,通过线性插值其实体分布与k近邻实现推理。我们基于知识存储中实体嵌入空间的距离计算近邻。该方法可显式记忆稀有或新出现的实体,而非将其隐式存储于模型参数中。实验结果表明,本方法能提升归纳式与传导式链接预测结果,并在仅含少量三元组的低资源场景下取得更优性能——此类场景可能更易通过显式记忆进行推理。代码已开源至https://github.com/zjunlp/KNN-KG。