Large Language Models (LLMs) as interactive agents show significant promise in Knowledge Graph Question Answering (KGQA) but often struggle with the semantic gap between natural language queries and structured knowledge graph (KG) representations. This leads to suboptimal planning and inefficient exploration on KG, while training-free approaches often underutilize valuable reasoning patterns in training data. To address these limitations, we propose a novel framework, Exemplar-Guided Planning (EGP), which enhances the planning capabilities of LLM agents for KGQA. EGP first preprocesses the training set questions via entity templating to normalize semantic variations. It then retrieves highly similar exemplary questions and their successful reasoning paths from this preprocessed set using semantic embeddings and an efficient FAISS index. These retrieved exemplars dynamically guide the LLM's planning process in two key phases: (1) Task Decomposition, by aligning generated sub-objectives with proven reasoning steps, and (2) Relation Exploration, by providing high-quality auxiliary information to improve relation pruning accuracy. Additionally, we introduce a Smart Lookahead mechanism during relation exploration to improve efficiency by preemptively exploring promising paths and potentially terminating exploration earlier. We apply EGP to the Plan-on-Graph (PoG) framework, termed PoG-EGP. Extensive experiments on two real-world KGQA datasets, WebQSP and CWQ, demonstrate that PoG-EGP significantly improves over the baseline PoG system and other compared methods.
翻译:大型语言模型(LLM)作为交互式智能体在知识图谱问答(KGQA)中展现出巨大潜力,但其在处理自然语言查询与结构化知识图谱(KG)表示之间的语义鸿沟时仍面临挑战。这导致其在知识图谱上的规划能力欠佳、探索效率低下,而免训练方法往往未能充分利用训练数据中宝贵的推理模式。为克服这些局限,本文提出一种新颖框架——范例引导规划(EGP),以增强LLM智能体在KGQA任务中的规划能力。EGP首先通过实体模板化对训练集问题进行预处理,以统一语义表达差异;随后利用语义嵌入与高效FAISS索引,从预处理集中检索高度相似的范例问题及其成功推理路径。这些检索到的范例通过两个关键阶段动态引导LLM的规划过程:(1)任务分解阶段,通过将生成的子目标与已验证的推理步骤对齐;(2)关系探索阶段,通过提供高质量辅助信息以提升关系剪枝精度。此外,我们在关系探索阶段引入智能前瞻机制,通过预先探索潜在有效路径并可能提前终止探索来提升效率。我们将EGP应用于图规划(PoG)框架,形成PoG-EGP系统。在WebQSP和CWQ两个真实世界KGQA数据集上的大量实验表明,PoG-EGP相较于基准PoG系统及其他对比方法均有显著提升。