Plan-on-Graph: Self-Correcting Adaptive Planning of Large Language Model on Knowledge Graphs

Liyi Chen, Panrong Tong, Zhongming Jin, Ying Sun, Jieping Ye, Hui Xiong

Introduction

Large Language Models (LLMs) have manifested outstanding performance in various natural language processing and data science tasks, such as question answering , text generation , recommender systems , and domain-specific applications . They leverage advanced deep learning techniques and immense amounts of pre-existing text data to understand and generate human language with impressive fluency and coherence. Despite their success in numerous applications, LLMs still suffer from out-of-date knowledge, hallucinations, and opaque decision-making, highlighting the ongoing need for further investigation in this rapidly evolving field.

Intuitively, as large-scale structural knowledge bases, Knowledge Graphs (KGs) provide explicit and editable depictions of massive real-world knowledge, which have the potential to be a promising complement to the drawbacks of LLMs. Previous studies manage to integrate KGs into LLM pre-training or fine-tuning stage. However, these methods mainly compress structured knowledge in KGs into LLMs’ parameters in a black-box fashion and still cannot fully enhance the flexibility, reliability, and transparency of LLMs. Therefore, several attempts first retrieve information from KGs and then deliver explicit knowledge into LLMs. Under these circumstances, LLMs do not directly participate in the graph reasoning process, making these methods excessively dependent on the KG completeness. Recently, a KG-augmented LLM paradigm has been proposed to conduct graph reasoning, which treats the LLM as an agent to interactively explore related entities and relations on KGs and perform reasoning based on the retrieved knowledge. For instance, StructGPT and ToG predefine the breadth of reasoning paths explored on the KG, and leverage the LLM to iterate the process of unidirectionally extending along the reasoning paths relevant to the question and reasoning the answer using these reasoning paths. This KG-augmented LLM paradigm offers an opportunity for more comprehensively amalgamating the knowledge from both the KG and LLM by facilitating the step-by-step derivation of further insights.

However, existing paradigm may fail to plan the exploration of correct reasoning paths for many complex questions. Figure 1 illustrates an example of existing paradigm’s limitations when answering the question “Which of Taylor Swift’s songs has won American Music Awards? (AMA)”. These limitations lie in: (1) Predefined path breadth: Existing paradigm requires manually setting the breadth of reasoning paths in KGs, and a fixed breadth may result in all the selected relations or entities being incorrect. When determining the relevance between paths and questions in step ②, due to the limited maximum breadth of three and the uncertainty surrounding the respective awards of songs, the LLM selected maximum numbers of songs, ignoring the correct entity “Blank Space”. (2) Irreversible exploration direction: The path exploration in existing paradigm is unidirectional without the ability to self-correct. Even if the paths are incorrect, the LLM still continues to extend current incorrect paths and lead to the failure of reasoning on the KG. In step ③ and ④, since “The Joker And The Queen”, “Shake It Off”, and “Cruel Summer” were already chosen, the reasoning process continued on incorrect paths and the right answer was not found. (3) Forgetting partial conditions: During reasoning, the LLM may forget partial conditions in the question and cannot provide the answer that satisfies multiple conditions simultaneously. In step ④, the LLM only remembered the condition that the song was by Taylor Swift but forgot the condition about the song winning an AMA award, leading to an incorrect answer, “Love Story”. Therefore, the reasoning of complex questions may heavily rely on adaptive exploration and self-correction of erroneous reasoning paths.

To address these limitations, we propose a novel self-correcting adaptive planning paradigm for KG-augmented LLM named Plan-on-Graph (PoG). To the best of our knowledge, we are the first to design a reflection mechanism for self-correction and adaptive KG exploration into KG-augmented LLMs, effectively improving the ability and efficiency of LLM reasoning. Specifically, PoG first decomposes the question into several sub-objectives as guidance for planning exploration, and then repeats the process of adaptively exploring reasoning paths to access relevant KG data, updating memory to provide dynamic evidence for reflection, and reflecting on the need to self-correct reasoning paths until arriving at the answer. In PoG, three mechanisms are designed for adaptive self-correcting planning: (1) Guidance: To better guide adaptive exploration by harnessing conditions in the question, we employ the LLM to decompose the question into sub-objectives containing conditions, thereby benefiting the identification of relevant paths to each condition with flexible exploration breadth. (2) Memory: The information stored in memory offers historical retrieval and reasoning information for reflection. We record and update the subgraph to provide the LLM with all retrieved entities for initializing new exploration and self-correcting paths, reasoning paths to preserve the relationships between entities for LLM reasoning and allow for path correction, and sub-objective status to make the LLM recognize the known information of each condition and mitigate its forgetting in reflection stage. (3) Reflection: To determine whether to continue or self-correct current reasoning paths, we design a reflection mechanism to employ the LLM to reason whether to consider other entities into new exploration and decide which entities to backtrack to for self-correction based on information in memory. Finally, extensive experiments on three real-world KGQA datasets validate the effectiveness and efficiency of PoG https://github.com/liyichen-cly/PoG. The main contributions of this paper are listed as follows:

We propose a novel self-correcting adaptive planning paradigm for KG-augmented LLM named PoG, which exploits the LLM to plan the adaptive breadth of reasoning paths and reflect to self-correct erroneous paths. To the best of our knowledge, we are the first to incorporate a reflection mechanism for self-correction and adaptive KG exploration into KG-augmented LLMs, effectively augmenting the LLM’s reasoning ability.

We specially design Guidance, Memory, and Reflection mechanisms for PoG. Guidance harnesses question conditions to better plan adaptive exploration by decomposing task into sub-objectives including conditions. Memory records the subgraph, reasoning paths, and sub-objective status to provide historical retrieval and reasoning information for Reflection. Based on Memory, Reflection reasons whether to self-correct reasoning paths and which entity to backtrack to for initiating new exploration.

We conduct extensive experiments on three real-world KGQA datasets, namely CWQ, WebQSP, and GrailQA. The results demonstrate not only the effectiveness but also the efficiency of our proposed novel PoG paradigm for KG-augmented LLM.

Preliminary

Knowledge Graph (KG) stores massive factual knowledge in the form of a set of triplets: G={(e,r,e′) ∣ e,e′∈E,r∈R}G=\{(e,r,e^{\prime})\,|\,e,e^{\prime}\in E,r\in R\}, where EE and RR denote the set of entities and relations, respectively.

Relation Paths are a sequence of relations: z={r1,r2,...,rl}z=\{r_{1},r_{2},...,r_{l}\}, where ri∈Rr_{i}\in R denotes the ii-th relation in the path and ll denotes the length of the path.

Reasoning Paths are the instances of a relation path zz in the KG: pz=e0→r1e1→r2e2→...→rlelp_{z}=e_{0}\rightarrow r_{1}e_{1}\rightarrow r_{2}e_{2}\rightarrow...\rightarrow r_{l}e_{l}, where ei∈Ee_{i}\in E denotes the ii-th entity and rir_{i} denotes the ii-th relation in the relation path zz.

Knowledge Graph Question Answering (KGQA) is the task of answering natural language questions based on a set of facts over the KG. Given a question qq, a knowledge graph GG, and topic entities TqT_{q} mentioned in qq, the target of KGQA is to generate answers AqA_{q} to the question qq. Following previous studies , we assume any entity eq∈Tqe_{q}\in T_{q} mentioned in qq and answers aq∈Aqa_{q}\in A_{q} are labeled and linked to the corresponding entities in GG, i.e., Tq,Aq⊆ET_{q},A_{q}\subseteq E.

Methodology

In this section, we introduce the technical details of the novel self-correcting adaptive planning paradigm for KG-augmented LLM named Plan-on-Graph (PoG). As illustrated in Figure 2, PoG consists of four key components: Task Decomposition, Path Exploration, Memory Updating, and Evaluation. PoG first decomposes the question into several sub-objectives as guidance of planning exploration and then repeats the process of adaptively exploring reasoning paths to access relevant KG data, updating memory to provide historical retrieval and reasoning information for reflection, and reflecting on the need to self-correct reasoning paths until arriving at the answer.

To harness conditions in the question to better guide the adaptive exploration process, PoG decomposes the task of answering the question into multiple sub-objectives containing conditions through semantic analysis of the LLM. Sub-objectives serve as guidance for path exploration, benefiting the identification of relevant paths to each condition outlined in the question with flexible exploration breadth. Specifically, we prompt the LLM to decompose the original question qq into a list of sub-objectives for KG retrieval and reasoning. The prompt is shown in Appendix A.1. The list of sub-objectives can be denoted as O={o1,o2,o3,...}O=\{o_{1},o_{2},o_{3},...\}. It is important to note that sub-objectives in OO may refer to the results obtained from other sub-objectives in OO, allowing for interdependencies in the reasoning process.

2 Path Exploration

We access relevant information from the KG by exploring reasoning paths in the KG. On the initiation of path exploration, we localize the initial entities of reasoning paths, which correspond to the topic entities mentioned in the given question. Similar to prior research , topic entities have been pre-identified and are part of the annotated datasets. Specifically, when presented with a question qq, we use topic entities to serve as the initial elements of the reasoning paths, E0=Tq={e10,e20,...,eN00}E^{0}=T_{q}=\{e^{0}_{1},e^{0}_{2},...,e^{0}_{N_{0}}\}, where N0N_{0} is the number of topic entities.

In the subsequent iterations, we continue exploring reasoning paths most relevant to the question and suspend other reasoning paths. Taking the DD-th iteration as an example, before the iteration starts, each reasoning path pn∈Pp_{n}\in P consists of Dpn(Dpn≤D−1)D_{p_{n}}(D_{p_{n}}\leq D-1) triplets, i.e., pn={(es,nd,rj,nd,eo,nd)}d=1Dpnp_{n}=\{(e^{d}_{s,n},r^{d}_{j,n},e^{d}_{o,n})\}_{d=1}^{D_{p_{n}}}, where es,nde^{d}_{s,n} and eo,nde^{d}_{o,n} denote subject and object entities, rj,ndr^{d}_{j,n} is a specific relation between them, (es,nd,rj,nd,eo,nd)(e^{d}_{s,n},r^{d}_{j,n},e^{d}_{o,n}) and (es,nd+1,rj,nd+1,eo,nd+1)(e^{d+1}_{s,n},r^{d+1}_{j,n},e^{d+1}_{o,n}) are linked to each other. It is noted that the length of each reasoning path may vary, because in the DD-th iteration, we only continue exploring the reasoning paths most semantically relevant to the question, which are identified in the D−1D-1-th iteration. The sets of tail entities and relations to be explored are denoted as ED−1={e1D−1,e2D−1,…,eND−1D−1}E^{D-1}=\{e^{D-1}_{1},e^{D-1}_{2},\dots,e^{D-1}_{N_{D-1}}\} and RD−1={r1D−1,r2D−1,…,rND−1D−1}R^{D-1}=\{r^{D-1}_{1},r^{D-1}_{2},\dots,r^{D-1}_{N_{D-1}}\}, respectively, where ND−1N_{D-1} is the length of ED−1E^{D-1} and RD−1R^{D-1}. We leverage the LLM to identify the most relevant entities EDE^{D} from the neighboring entities of the current entity set ED−1E^{D-1} based on the question qq and extend the reasoning paths PP with EDE^{D}. In order to manage the complexity of dealing with a large number of neighboring entities using the LLM, we propose an adaptive exploration strategy that is not limited by the fixed number of relations and entities. This strategy involves a two-step process of finding relevant relations and utilizing these selected relations to explore entities.

Relation Exploration. Relation exploration is a process to retrieve the relations of all tail entities in ED−1E^{D-1} and identify the most relevant relations to the question qq and the sub-objectives OO. To be specific, we first conduct the search to obtain all relations linked to the tail entities in ED−1E^{D-1} as the candidate relation set RcandD={rcand,1D,rcand,2D,...,rcand,ND−1D}R^{D}_{cand}=\{r^{D}_{cand,1},r^{D}_{cand,2},...,r^{D}_{cand,N_{D-1}}\}. We utilize RcandDR^{D}_{cand} to extend the reasoning paths into candidate reasoning paths PcandP_{cand}. Then, we employ the LLM to select a flexible number of relevant reasoning paths PP ending with the tail relations in RDR^{D} from PcandP_{cand}, based on the semantic information of the question qq, tail entities ED−1E^{D-1}, candidate relations RcandDR^{D}_{cand}, and sub-objectives OO. The prompt is shown in Appendix A.2.1, and the pre-defined query for relation search is shown in Appendix B.1.

Entity Exploration. Analogously, entity exploration is a process to retrieve neighboring entities based on RDR^{D} and ED−1E^{D-1} and detect the most relevant entities to the question qq. From the previous relation exploration, we obtain extended reasoning paths PP and new tail relations RDR^{D}. For each reasoning path pn∈Pp_{n}\in P, we can execute the queries of (enD−1,rnD,?)(e_{n}^{D-1},r_{n}^{D},?) or (?,rnD,enD−1)(?,r_{n}^{D},e_{n}^{D-1}) to retrieve a candidate entity set Ecand,nDE^{D}_{cand,n}, where enD−1e_{n}^{D-1} and rnDr_{n}^{D} are the tail entity and relation in pnp_{n}. When confronted with a large number of candidate entities, we use a small pre-trained DistilBERT https://huggingface.co/sentence-transformers/msmarco-distilbert-base-tas-b, to calculate the similarity between candidate entities and the question for recall. Then, we summarize all candidate entity sets into EcandDE^{D}_{cand} and use EcandDE^{D}_{cand} as the tail entities to expand PP into PcandP_{cand}. With the candidate reasoning paths PcandP_{cand}, we exploit the LLM to choose a flexible number of relevant reasoning paths PP ending with the tail entities EDE^{D} from PcandP_{cand}, based on the semantic information of the question qq and knowledge triplets composed of tail entities ED−1E^{D-1}, tail relations RDR^{D} and candidate entities EcandDE^{D}_{cand}. The prompt is shown in Appendix A.2.2, and the pre-defined query for entity search is shown in Appendix B.2.

3 Memory Updating

The information stored in memory provides historical retrieval and reasoning information for reflection. After a two-step exploration, we dynamically update the searched subgraph GSubG_{Sub}, reasoning paths PP, and sub-objective status SS in memory based on the ongoing reasoning process.

Subgraph. The subgraph includes all retrieved relations and entities from the KG. We update the subgraph in memory, which can be utilized during later reflection to determine which entity to backtrack to for self-correction. In the DD-th iteration, the searched subgraph GSubG_{Sub} is updated by adding the retrieved candidate relation set RcandDR_{cand}^{D} and candidate entity set EcandDE_{cand}^{D}.

Reasoning Paths. In order to ensure that the LLM can understand relationships between entities for better reasoning and allow for path correction in reflection stage, we update reasoning paths PP to preserve the semantic structure within the KG.

Sub-Objective Status. The LLM may forget partial conditions in the reasoning process. Sub-objectives obtained by decomposing the question can help the LLM remember multiple conditions in the question. The status of sub-objectives contains the current known information related to the sub-objectives, which can aid the LLM in remembering the known information of each condition and determining whether to correct the exploration direction in reflection stage. Hence, we leverage the LLM to update the currently known information relevant to sub-objectives into sub-objective status S={s1,s2,s3,...},∣S∣=∣O∣S=\{s_{1},s_{2},s_{3},...\},|S|=|O|, based on the semantic information of the question qq, sub-objectives OO, historical sub-objective status, and reasoning paths PP, along with the LLM’s own knowledge. The prompt is shown in Appendix A.3.

4 Evaluation

After the path exploration and memory updating, PoG prompts the LLM to reason whether the current acquired information, including sub-objective states and reasoning paths recorded in memory, is sufficient to infer an answer. The prompt is shown in Appendix A.4.1. If the LLM determines that the information is sufficient, it will integrate reasoning paths, sub-objective states, and its own knowledge to provide an answer. When information is considered insufficient, there may be two situations. One is that PoG will acquire sufficient information after further extension of current paths, and the other is that current paths are incorrect. Since the reasoning capability of the LLM does not always guarantee the correctness of path exploration, there is a need to self-correct erroneous reasoning paths. Therefore, we design a reflection mechanism to determine whether and how to self-correct reasoning paths. When the LLM believes that the information is insufficient, PoG enters the stage of reflection. Specifically, PoG utilizes the LLM to reflect on whether to correct the current exploration direction based on the question qq, sub-objective status SS, reasoning paths PP, and entities planned for the next iteration of retrieval EDE^{D} from memory. Besides, the LLM will provide the reason for the reflection result. If the LLM judges that it is necessary to incorporate additional entities beyond those in EDE^{D} for exploration, then a self-correction of reasoning paths is needed. Otherwise, PoG will continue exploring along the current reasoning paths with tail entities in EDE^{D}. For self-correction, PoG employs the LLM to decide which entities in Ecand=Ecand1∪Ecand2∪...∪EcandDE_{\text{cand}}=E_{\text{cand}}^{1}\cup E_{\text{cand}}^{2}\cup...\cup E_{\text{cand}}^{D} to backtrack to based on sub-objective states in SS and the reason for additional retrieval obtained from the reflection, and adds new exploration of backtracked entities EaddDE_{\text{add}}^{D} into EDE^{D} for the self-correction, denoted as ED=ED∪EaddDE^{D}=E^{D}\cup E_{\text{add}}^{D}. The prompts for reflection are shown in Appendix A.4.2.

Experiments

To demonstrate the effectiveness of PoG on complex reasoning over knowledge graphs, we adopt three representative multi-hop KGQA datasets: CWQ , WebQSP , and GrailQA . All three datasets rely on the external knowledge graph from Freebase . For the large dataset GrailQA, we utilize the same testing samples as those in ToG to improve computational efficiency. Following prior research , we use exact match accuracy (Hits@1) as the evaluation metric.

1.2 Comparison Methods

Due to variations in the performance of the method across different datasets, we select prior state-of-the-art (SOTA) approaches as baselines for each dataset. They can be categorized into two groups: (1) LLM-only methods, including standard prompting (IO prompt) , Chain-of-Thought prompting

(CoT) , and Self-Consistency (SC) . (2) KG-augmented LLM methods, including fine-tuned and prompting methods. For CWQ and WebQSP, we utilize UniKGQA , TIARA , RE-KBQA , DeCAF , and RoG as fine-tuned baselines and KD-CoT , KB-BINDER , StructGPT , Interactive KBQA , and ToG as prompting baselines. For GrailQA, we utilize RnG-KBQA , TIARA , FC-KBQA , Pangu , FlexKBQA , and GAIN as fine-tuned baselines and KB-BINDER and ToG as prompting baselines. The descriptions of baselines are presented in Appendix D.

2 Performance Comparison

We compare PoG with the SOTA baselines to demonstrate its effectiveness for KG-augmented LLM. Table 1 and Table 2 present the experimental results on CWQ, WebQSP, and GrailQA datasets. Overall, PoG achieves the best performance across all three datasets. Specifically, we can make the following observations. First, compared to all prompting KG-augmented LLM baselines, PoG shows superior performance advantages. Regardless of whether GPT-3.5 or GPT-4 is used as the underlying LLM, PoG substantially outperforms the SOTA baseline, ToG. ToG explores reasoning paths with a fixed exploration breadth and cannot detect or correct the errors, showing limitations in effect and efficiency. Meantime, we specially design self-correction and adaptive planning mechanisms, which can effectively improve both performance and efficiency. Second, although PoG is a training-free prompting method, its performance is highly competitive with fine-tuned KG-augmented LLM baselines. When using GPT-4, the performance of PoG exceeds all fine-tuned KG-augmented LLM baselines across the board. Even with GPT-3.5, the result of PoG on GrailQA surpasses all fine-tuned KG-augmented LLM methods. This suggests that our designed guidance, memory, and reflection mechanisms allow PoG’s effect to surpass most of the fine-tuned methods. Third, the improvement of PoG is obvious when compared to LLM-only baselines, which do not leverage external KGs. Besides, all KG-augmented LLM methods consistently outperform LLM-only methods, indicating the value of incorporating KGs to enhance LLM performance. Moreover, PoG further improves the effectiveness of KG-augmented LLMs through its self-correctable adaptive planning. Additionally, it is worth noting that PoG with GPT-3.5 outperforms other methods on the zero-shot subset of the GrailQA dataset by a large margin, apparently outperforming all fine-tuned KG-augmented LLMs on this category. The self-correction mechanism in PoG allows it to dynamically correct errors during the reasoning process, which is crucial for zero-shot problems.

3 Ablation Study

In order to assess the effectiveness of each mechanism and adaptive exploration in PoG, we conduct the ablation study to remove them on three datasets, respectively. Specifically, w/o Guidance refers to the variant where entire task decomposition as guidance is removed. w/o Memory indicates the variant without the memory mechanism. w/o Reflection refers to the variant where, in the case of insufficient information, it only continues exploring along the original reasoning paths. w/o Adaptive Breadth means that the variant uses a fixed exploration space breadth instead of adapting it based on the situation. Table 3 shows the performance of all variants and the results suggest that each mechanism and adaptive breadth appears to contribute positively to the overall performance, with their removal leading to weaker results on complex question answering tasks across the evaluated datasets. These variations achieve a minimum reduction of 3.0%, 2.1%, and 3.5% on CWQ, WebQSP, and GrailQA, respectively. The performance of w/o Memory drops the most, followed by w/o Reflection, because without the memory there is no information to support PoG in navigating the exploration and achieving self-correction, and PoG cannot self-correct the wrong reasoning paths without the reflection mechanism. Moreover, after setting a fixed maximum breadth for exploration, the performance deteriorates. This indicates that a fixed breadth makes the method lack flexibility and less adaptable to different questions. However, because the mechanisms of memory and reflection ensure that PoG is able to self-correct, the performance of w/o Adaptive Breadth does not decrease a lot.

4 Efficiency Study

We study the efficiency of PoG and the SOTA prompting KG-augmented LLM baseline, ToG. Table 4 presents the average LLM call, token consumption, and time required by both methods to answer a question across three datasets. In all datasets, PoG demonstrates clear advantages over ToG in terms of all metrics. For average number of LLM calls, PoG consistently requires fewer calls to the LLM, and reduces it by at least 40.8%. This highlights PoG’s ability to reason more efficiently with fewer LLM interactions. Regarding token consumption, PoG exhibits a notable advantage in both input and output token usage. On CWQ, compared to ToG’s input tokens, PoG shows a reduction of approximately 4.6% in input token consumption. As for output tokens, PoG produces just 353.159 output tokens, representing a substantial decrease of roughly 76.2%. This indicates the effectiveness of PoG in reducing the overall token consumption during the reasoning process. Most importantly, PoG achieves superior time efficiency compared to ToG. On CWQ and GrailQA, PoG presents a speedup of over 4 times. ToG predefines the breadth of exploration, leading to the exploration of many irrelevant paths. Additionally, ToG lacks a self-correction mechanism, and when there is insufficient information to answer a question, it can only extend the current reasoning paths, sacrificing a lot of efficiency on irrelevant explorations. By contrast, the efficiency advantages of PoG can be attributed to its adaptive exploration and self-correction of reasoning paths based on the semantics of the question. The adaptive breadth reduces unnecessary exploration, and effective correction avoids the extending of wrong current paths.

5 Case Study

Figure 3 shows a typical case from the testing results on CWQ dataset. We compare the results of PoG, ToG, and CoT in answering the question “Who is in control of the place where the movie ‘The Naked and the Dead’ takes place?”. The underlying LLMs they used are all based on GPT-3.5. PoG initially identifies a flexible number of relations related to the topic entities. Specifically, for “The Naked and the Dead”, PoG successfully discovers that the movie takes place in Panama, while for “President of Panama”, the LLM thinks that only the relation “government.government_office_or_title.jurisdiction” is relevant. Upon retrieval, no information is found regarding the person in control of Panama. This triggers reflection as PoG realizes that it lacks sufficient information. With the memory, PoG refers to the sub-objective status and recognizes that it already knows the movie location (Panama) for sub-objective #1 but is unaware of the person in control of Panama for sub-objective #2. Based on the current reasoning paths, PoG makes a decision to execute self-correction and returns to exploring the relation not previously explored for “President of Panama”. Due to the task decomposition, during the self-correction process, it becomes easier to identify the correct relation “government.government_office_or_title.office_holders” according to the sub-objectives. Through the guidance, memory, and reflection mechanisms, PoG successfully finds the correct answer, “Juan Carlos Varela”. In contrast, ToG fails to identify the most relevant relation concerning “President of Panama” and continues exploring incorrect paths. This consumes a significant amount of time and ultimately leads to an erroneous answer due to the hallucination. CoT refuses to answer directly since the LLM realizes its lack of knowledge regarding the answer and requires additional information to be provided. From this analysis, it is evident that PoG outperforms ToG and CoT. PoG successfully leverages sub-objective status to self-correct the exploration path in the reflection stage and finally provides the correct answer.

Related Work

LLM Reasoning. To encourage LLMs to engage in reasoning rather than simply providing answers directly, many researchers instruct LLMs to generate the process of thinking in their outputs . In the early stages, Chain of Thought (CoT) was designed to provide a few examples of intermediate natural language reasoning steps as the prompt. After that, several variants of CoT reasoning with different forms like Tree-of-Thought , Graph-of-Thought , Memory of Thought , and Skeleton-of-Thought were proposed to enhance the thinking process. However, LLMs may make mistakes during the reasoning process. Hence, many works designed self-correction mechanisms based on feedback to rectify flawed reasoning and ensure accuracy. Additionally, large efforts were dedicated to guiding LLMs in understanding complex graph structures and improving their graph reasoning across different graph tasks . However, it is still an open issue to address the outdated knowledge, hallucinations, and opaque decision-making for LLM reasoning.

KG-Augmented LLM. Despite the pre-training of LLMs on massive corpora, they still suffer from limitations such as outdated knowledge, hallucinations, and opaque decision-making. An effective approach to address these limitations is to leverage KGs for explicit and editable knowledge provision to LLMs. Previous studies integrated KGs into LLM pre-training or fine-tuning stage, but they merely inject structured knowledge into LLMs’ parameters and still leave these limitations unexplored. Therefore, several works first retrieved information from KGs and then directly fed explicit knowledge into LLMs. In this way, LLMs do not involve the graph reasoning process and cannot provide potential insights. Then, a novel KG-augmented LLM paradigm was proposed to treat the LLM as an agent to interactively explore related entities and relations on KGs and perform reasoning based on the retrieved knowledge. Although this KG-augmented LLM paradigm has achieved impressive performance, it still faces the challenges of adaptively exploring the KG based on question semantics and self-correcting erroneous reasoning paths. To the best of our knowledge, our work stands out as a pioneering effort in successfully integrating a reflection mechanism for self-correction and adaptive KG exploration into KG-augmented LLMs, effectively enhancing the LLM’s reasoning ability.

Conclusion

In this paper, we proposed a novel self-correcting adaptive planning paradigm for KG-augmented LLM named Plan-on-Graph (PoG). To the best of our knowledge, we were the first to incorporate a reflection mechanism for self-correction and adaptive KG exploration into KG-augmented LLMs, effectively augmenting LLM’s reasoning ability and efficiency. PoG first decomposed the question into several sub-objectives, and then repeated the process of exploring reasoning paths, updating memory, and reflecting on the need to self-correct reasoning paths until arriving at the answer. To be specific, three important mechanisms were designed to work together to guarantee the adaptive breadth of self-correcting planning for graph reasoning, i.e., Guidance, Memory, and Reflection. Finally, extensive experiments on three real-world KGQA datasets validated not only the effectiveness but also the efficiency of the proposed PoG.

Acknowledgments and Disclosure of Funding

This work was supported in part by the National Key Research and Development Program of China (Grant No. 2023YFF0725001), the National Natural Science Foundation of China (Grant No. 92370204, 62306255), the Guangdong Basic and Applied Basic Research Foundation (Grant No. 2023B1515120057, 2024A1515011839), the Guangzhou-HKUST (GZ) Joint Funding Program (Grant No. 2023A03J0008), and the Alibaba Research Intern Program.

References

Appendix

Appendix A Prompts

Here, we provide all the prompts used in PoG. To facilitate the LLM output parsing, we require the LLM to provide answers using specific data structures, such as lists and JSON. Besides, we require the LLM not to output any other irrelevant information to the results. The specific in-context few-shot is shown in code files.

A.2 Path Exploration

A.2.2 Entity Exploration

A.3 Memory Updating

A.4 Evaluation

A.4.2 Reflection

Appendix B Search SPARQL

To automatically process the KG data in PoG, we pre-define the SPARQL for Freebase queries, which can be executed by filling in the entity’s mid and relation.

B.2 Entity Search

B.3 Entity Name Search

Appendix C Datasets

In this paper, we use three complex multi-hop KGQA datasets: ComplexWebQuestions , WebQSP , and GrailQA . The statistics of datasets are shown in Table 5. WebQSP contains questions from WebQuestions that are answerable by Freebase. It tests I.I.D. generalization on questions. ComplexWebQuestions (CWQ) extends WebQSP and encompasses four types of complex questions: conjunction, composition, comparative, and superlative. GrailQA is a diverse KGQA dataset built on Freebase, and is designed to test three levels of generalization of models: I.I.D., compositional, and zero-shot.

Appendix D Baseline Descriptions

The baselines we compare can be categorized into two groups: (1) LLM-only methods; (2) KG-augmented LLM methods, including fine-tuned and prompting methods.

Standard prompting (IO prompt) verifies the ability of LLMs to achieve better performance in task-agnostic, few-shot problems than traditional LMs.

Chain-of-Thought prompting (CoT) generates a series of intermediate reasoning steps in prompts to help LLMs perform better in several NLP tasks.

Self-Consistency (SC) samples multiple, diverse reasoning paths through few-shot CoT, and uses the generations to select the most consistent answer.

UniKGQA unifies the graph retrieval and reasoning process into a single model with LLMs.

TIARA first uses BERT to retrieve a set of schema items, which are further used as the input, together with the question, to T5 for plan generation. They also apply constrained decoding but only for grammaticality.

RE-KBQA capitalizes relations in KGs to enhance entity representations and introduce additional supervision to improve the selection of reasoning paths.

DeCAF combines semantic parsing and LLMs reasoning to jointly generate answers, which also reach salient performance on KGQA tasks.

RoG collaborates LLMs with KGs to achieve trustworthy reasoning to leverage structural information.

RnG-KBQA first uses BERT to rank a set of enumerated candidate programs (up to a limited complexity), and then uses T5 to edit the top programs into more complex programs.

FC-KBQA proposes a fine-to-coarse composition framework to avoid knowledge entanglement and guarantee both generalization ability and logical interpretability.

Pangu considers leveraging the discriminative ability of LLMs. It consists of a symbolic agent with a cooperative neural LLM.

FlexKBQA is a flexible KGQA framework with LLMs. It can utilize a limited set of annotated data to build KGQA for different KGs and query languages.

GAIN pays attention to the robustness of KGQA models. It proposes a data augmentation method to alleviate this problem and further evaluates the distribution shifts including from different aspects.

KB-BINDER is developed to challenge the heterogeneity of items from different KGs. It enables few-shot in-context learning over KGQA tasks.

KD-CoT retrieves relevant knowledge from KGs to generate faithful reasoning plans for LLMs.

StructGPT defines the interface of KG data to implement knowledge access and filtering with finite quantity, and leverage the LLM to infer the answer or subsequent planning repeatedly.

Interactive KBQA interacts with KGs directly and then generates logical forms. The interactions are under three designed universal APIs for KGs.

ToG iteratively retrieves relevant triplets from KGs and employs the LLM to assess whether the reasoning paths in beam search are sufficient for answering the question and if further retrieval of the next hop is necessary.

Appendix E Implementation Details

In our experiments, we use GPT-3.5 and GPT-4 to serve as the underlying LLMs. We call them by the OpenAI official API https://platform.openai.com/docs/api-reference.. We set the temperature parameter to 0.3, frequency penalty to 0, and presence penalty to 0. The maximum token length for generation is 1024. In all experiments, the depth of exploration is set to 4 to avoid endless exploration. The experiments are conducted on a server with two Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz and 256 GB RAM memory.

Appendix F Depth Sensitivity

Since LLMs are not entirely certain about when to stop, we need to manually set the depth of KG exploration to avoid endless exploration. To investigate the impact of exploration depth on PoG performance, we conduct experiments with depth settings ranging from 1 to 5 on CWQ dataset. As shown in Figure 4, increasing the depth will improve the performance of PoG. Beyond a depth of 4, the improvement becomes less noticeable. The increase in depth leads to exponential growth in resource and time consumption. Considering the balance between efficiency and effectiveness, we set the depth to 4.

Appendix G Case Analysis

In PoG, we design a reflection mechanism to provide the opportunity for self-correction for exploring reasoning paths. In Figure 5, we calculate the proportion of cases with reverse occurrences among all questions in CWQ, and the results show that 24% of cases involve reversing during the exploration process to achieve self-correction. This demonstrates that LLMs are indeed not always capable of making correct judgments in KG exploration and that self-correction is necessary for KG-augmented LLMs. Figure 6 presents the proportion of correct answers obtained by PoG after self-correction on three datasets. Overall, the self-correction in PoG appears to have positively impacted the accuracy of KGQA, particularly for the WebQSP and CWQ datasets, where the proportion of correct answers reached 64% and 48% after the self-correction process. This analysis suggests that the reflection mechanism in PoG has the potential to enhance the reasoning capabilities of KG-augmented LLM and improve the performance across various datasets by allowing for self-correction and exploration of alternative reasoning paths.

Besides, Figure 7 shows another typical case from the testing results on CWQ dataset. We compare the results of PoG, ToG, and CoT in answering the question “What genre of music favored by Claude Debussy appears in the movie Suzanne Farrell: Elusive Muse?”. PoG first adaptively identifies the most relevant relation “music.artist.genre” to the topic entity “Claude Debussy”. Without constraining the breadth of reasoning paths, PoG considers multiple candidate entities as potentially relevant to the question. In the subsequent exploration of the topic entity “Suzanne Farrell: Elusive Muse”, PoG adaptively chooses only “Ballet” as the relevant entity, as it records the known information of sub-objective #1 in memory. Through adaptive breadth and memorization of sub-objective status, PoG successfully and efficiently provides the correct answer. In contrast, ToG randomly explores paths when faced with multiple candidate entities, only finding one condition from sub-objective #1. Finally, ToG only remembers the genre of music favored by “Claude Debussy” but forgets the condition from sub-objective #2, answering “Incidental music”. CoT directly hallucinates an irrelevant answer, “Impressionism”. This case indicates the effectiveness of adaptive breadth and memorization of sub-objective status.

Appendix H Broader Impact & Limitation

In the current research landscape, PoG carries a significant broader impact, primarily reflected in its enhancement of complex reasoning capabilities for KG-augmented LLM. By innovatively integrating guidance, memory, and reflection mechanisms, PoG not only strengthens the model’s flexibility and accuracy when facing complex queries but also enhances its ability to self-correct erroneous reasoning paths. This self-correcting adaptive planning paradigm enables the model to backtrack and adjust reasoning directions when faced with invalid initial assumptions or impasses, resulting in an optimal solution search. Additionally, the broader impact of PoG is manifested in several other aspects: (1) Improving Efficiency and Effectiveness in Problem-Solving: By dynamically adjusting exploration breadth and employing self-correction mechanisms, PoG can more efficiently handle complex questions and provide more accurate answers, significantly enhancing the overall performance of KGQA systems. (2) Enhancing the Robustness and Adaptability of LLMs: Through its memory mechanism, which records and tracks the completion status and reasoning paths of each sub-objective, PoG enables the LLM to more robustly deal with the uncertainty and complexity of questions, making it more precise and reliable across a wide range of applications. (3) Fostering Innovation in the Field of Artificial Intelligence: PoG’s integration of meta-cognitive capabilities into reasoning and planning processes represents an innovative attempt that could further propel research and innovation in broader AI technologies within the artificial intelligence field. (4) Improving User Experience and Expanding Application Domains: With PoG’s reasoning capabilities, user experience is greatly improved due to more accurate and quicker responses. Meanwhile, the domains where it can be applied will also expand, particularly in environments that require handling complex queries and responses involving large volumes of data.

There are still limitations in using PoG for addressing more complex problems. Some of the key limitations include: (1) Low Self-Confidence: LLMs are still not entirely certain about what information is needed, how many steps are required to extract the information, when to perform dynamic updates, or if the current information is sufficient. In future work, we will focus on the evaluation of LLM’s self-confidence. For example, this can be alleviated by training a small model specifically for this evaluation task to improve accuracy. (2) Efficiency: Answering complex questions requires multiple steps. In future work, we aim to design strategies to reduce steps and improve task execution efficiency in situations of high self-confidence. (3) Non-Standardized Query: For less standardized queries, semantic understanding might be insufficient due to limitations in the capabilities of the LLM itself, leading to decreased effectiveness. In future work, we will address this issue by employing SOTA query rewriting methods or interacting with the user to refine the query.