arXiv:2604.12651cs.CLcs.AI2026-04

用提示词学习预测知识图谱中的实体、关系和属性值,提升模型泛化能力。

Learning Chain Of Thoughts Prompts for Predicting Entities, Relations, and even Literals on Knowledge Graphs

  • 将链接预测转化为提示词学习,通过字符串链式思维提示评分三元组。
  • 仅需30个训练样本,在多个数据集上超越当前最优嵌入模型5%以上MRR。
  • 适用于动态异构图,尤其擅长复杂逻辑推理任务,适合研究推理与提示工程者。

知识图谱嵌入(KGE)模型在链接预测上表现良好,但在未见实体、关系及属性值(literals)上表现不佳,限制了其在动态、异构图中的应用。相比之下,预训练大语言模型(LLM)可通过提示实现有效泛化。本文将链接预测重新定义为提示学习问题,提出RALP方法,学习基于字符串的链式思维(CoT)提示作为三元组的评分函数。通过MIPRO算法的贝叶斯优化,RALP在无梯度访问的情况下,仅需少于30个训练样本即可识别有效提示。推理时,RALP可预测缺失的实体、关系或完整三元组,并基于学习到的提示生成置信度分数。我们在归纳式、数值型及OWL实例检索基准上进行评估,结果显示RALP在各数据集上均使当前最优的KGE模型提升超过5% MRR,通过高质量推断三元组增强泛化能力。在包含复杂类表达式的OWL推理任务中(如∃hasChild.Female,≥5 hasChild.Female),Jaccard相似度超过88%。结果表明,基于提示的LLM推理是嵌入方法的灵活替代方案。我们已开源实现、训练与评估流程:https://github.com/dice-group/RALP。

原文摘要 · Abstract (English)

Knowledge graph embedding (KGE) models perform well on link prediction but struggle with unseen entities, relations, and especially literals, limiting their use in dynamic, heterogeneous graphs. In contrast, pretrained large language models (LLMs) generalize effectively through prompting. We reformulate link prediction as a prompt learning problem and introduce RALP, which learns string-based chain-of-thought (CoT) prompts as scoring functions for triples. Using Bayesian Optimization through MIPRO algorithm, RALP identifies effective prompts from fewer than 30 training examples without gradient access. At inference, RALP predicts missing entities, relations or whole triples and assigns confidence scores based on the learned prompt. We evaluate on transductive, numerical, and OWL instance retrieval benchmarks. RALP improves state-of-the-art KGE models by over 5% MRR across datasets and enhances generalization via high-quality inferred triples. On OWL reasoning tasks with complex class expressions (e.g., $\exists hasChild.Female$, $\geq 5 \; hasChild.Female$), it achieves over 88% Jaccard similarity. These results highlight prompt-based LLM reasoning as a flexible alternative to embedding-based methods. We release our implementation, training, and evaluation pipeline as open source: https://github.com/dice-group/RALP .

知识图谱提示学习链式思维大模型推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。