arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.03705cs.AI
收藏

图上的代码:通过大型语言模型在知识图谱上进行迭代式程序化推理

Code-on-Graph: Iterative Programmatic Reasoning via Large Language Models on Knowledge Graphs

Key Laboratory of AI Safety, Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所人工智能安全重点实验室);Shandong University(山东大学);Shandong University-Weihai Research Institute of Industrial Technology(山东大学威海工业技术研究院)

Weiwei Ding, Zixuan Li, Long Bai, Zhuo Chen, Kun Su, Fei Wang, Xiaolong Jin, Jin Zhang, Jiafeng Guo, Xueqi Cheng

AI总结:

提出Code-on-Graph (CoG)框架,通过将知识图谱模式表示为Python类并生成可执行代码,解决现有LLM-KG集成中操作符不灵活和知识注入不可扩展的问题,在WebQSP、CWQ和GrailQA上提升高达10.5%。

摘要:

知识图谱(KGs)被广泛用于缓解大型语言模型(LLMs)的局限性,如知识过时和幻觉。现有的LLM-KG集成框架通常依赖预定义操作符从知识图谱中检索事实知识,并将其注入提示以生成答案。这种范式面临两个关键瓶颈:1)不灵活性:预定义操作符范围有限,因此缺乏足够的组合表达能力来完全捕捉知识图谱问题所需的复杂语义。2)不可扩展性:将事实知识直接注入提示限制了处理大规模事实知识的可扩展性。为了解决这两个瓶颈,我们提出了Code-on-Graph(CoG),一个用于LLM-KG集成的程序化推理框架。具体来说,给定每个推理步骤检索到的事实知识,CoG首先识别相应的知识图谱模式,并将这些模式表示为Python类,这些类作为检索事实的抽象接口。然后,它生成基于这些类的可执行代码,在执行过程中,检索到的事实被实例化为相应类的对象。这种设计实现了灵活的基于代码的推理,同时避免将大规模事实知识直接注入提示。在WebQSP、CWQ和GrailQA上的实验表明,CoG比之前的最先进模型性能提升高达10.5%。

英文摘要:

Knowledge Graphs (KGs) are widely used to mitigate the limitations of Large Language Models (LLMs), such as outdated knowledge and hallucinations. Existing LLM-KG integration frameworks typically rely on predefined operators to retrieve factual knowledge from KGs and inject it into prompts for answer generation. This paradigm faces two critical bottlenecks: 1) Inflexibility: The predefined operators are limited in scope and thus lack sufficient compositional expressiveness to fully capture the complex semantics required by KG questions. 2) Unscalability: Direct injection of factual knowledge into prompts limits scalability in handling large-scale factual knowledge. To address these two bottlenecks, we propose Code-on-Graph (CoG), a programmatic reasoning framework for LLM-KG integration. Specifically, given the factual knowledge retrieved at each reasoning step, CoG first identifies the corresponding KG schemas and represents these schemas as Python classes, which serve as abstract interfaces to the retrieved facts. It then generates executable code grounded in these classes, with the retrieved facts instantiated as objects of the corresponding classes during execution. This design enables flexible code-based reasoning while avoiding the direct injection of large-scale factual knowledge into prompts. Experiments on WebQSP, CWQ, and GrailQA demonstrate that CoG outperforms prior state-of-the-art models by up to 10.5%.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑