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 。