作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2025, Vol. 51 ›› Issue (5): 124-132. doi: 10.19678/j.issn.1000-3428.0069130

• 人工智能与模式识别 • 上一篇    下一篇

基于图神经网络与元学习的小样本关系推理模型

刘文杰1,2, 陈亮1, 任智杰1   

  1. 1. 南京信息工程大学软件学院, 江苏 南京 210044;
    2. 南京信息工程大学数字取证教育部工程研究中心, 江苏 南京 210044
  • 收稿日期:2023-12-29 修回日期:2024-03-07 出版日期:2025-05-15 发布日期:2024-06-03
  • 通讯作者: 刘文杰,E-mail:wenjiel@163.com E-mail:wenjiel@163.com
  • 基金资助:
    国家自然科学基金(62071240);江苏省自然科学基金(BK20231142)。

Few-shot Relation Reasoning Model Based on Graph Neural Network and Meta-Learning

LIU Wenjie1,2, CHEN Liang1, REN Zhijie1   

  1. 1. School of Software, Nanjing University of Information Science and Technology, Nanjing 210044, Jiangsu, China;
    2. Engineering Research Center of Digital Forensics, Ministry of Education, Nanjing University of Information Science and Technology, Nanjing 210044, Jiangsu, China
  • Received:2023-12-29 Revised:2024-03-07 Online:2025-05-15 Published:2024-06-03

摘要: 知识图谱关系推理旨在推理实体间缺失的链接,当前知识图谱关系推理模型在小样本关系推理上表现不佳,且难以对训练集中未出现的实体进行关系推理。针对以上问题,提出一种基于图神经网络(GNN)与损失权重元学习的知识图谱小样本关系归纳推理模型。模型利用图神经网络学习目标实体间的子图模式,从而泛化到新实体的关系推理。通过路径掩码策略降低模型对特定子图模式的依赖,捕捉数据中的关键特征和模式,从而提高模型归纳推理泛化能力。基于元学习方法引入分布均衡的元数据集来学习一个自适应损失函数,调整不同样本的损失权重,使模型更关注难以预测的小样本关系,从而提高模型对小样本关系预测的准确度。最后,在归纳链接预测基准数据集FB15k-237和NELL-995中过滤掉没有子图的三元组,并进行链接预测和三元组分类任务,同时对测试集中属于小样本关系的三元组进行评价。实验结果表明,所提模型在归纳推理基准数据集上具有较好的表现,并且在7个小样本数据集上的性能比目前最优的模型平均提升1%左右。

关键词: 知识图谱, 图神经网络, 小样本关系预测, 路径掩码, 损失权重元学习

Abstract: Knowledge graph relation reasoning aims to infer missing links between entities. Current knowledge graph relation reasoning models perform poorly when reasoning with few-shot relations and struggle to reason for entities that are not seen during training. To address these issues, this study proposes a knowledge graph few-shot relation inductive reasoning model based on Graph Neural Network (GNN) and loss-weight meta-learning. The model utilizes GNN to learn the subgraph patterns between target entities, thereby generalizing to relation reasoning for new entities. The path-wise masking strategy reduces the reliance of the model on specific subgraph patterns and captures the key features and patterns in the data, thereby enhancing the inductive reasoning and generalization capabilities of the model. A distribution-balanced meta-dataset based on meta-learning is introduced to learn the adaptive loss function. The loss weights of different samples are adjusted, enabling the model to focus more on challenging few-shot relations, thereby improving the accuracy of the few-shot relation prediction. Finally, triplets without subgraphs in inductive link prediction benchmark datasets FB15k-237 and NELL-995 are filtered out, and link prediction and triplet classification tasks are performed. Simultaneously, triplets belonging to few-shot relations in the test set are evaluated. Experimental results show that the proposed model exhibits the best performance on the inductive reasoning benchmark datasets and achieves an average improvement of approximately 1% over current state-of-the-art models on seven few-shot datasets.

Key words: knowledge graph, Graph Neural Network (GNN), few-shot relation prediction, path-wise masking, loss-weight meta-learning

中图分类号: