Large-model multi-hop reasoning optimization method fusing psychological cognitive mechanism
By integrating psychological and cognitive mechanisms, this method optimizes multi-hop reasoning in large models, solving the problem of insufficient reasoning ability of small-parameter models in complex multi-hop reasoning tasks, and achieving efficient information processing and accurate answers under limited resource conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-03-27
AI Technical Summary
When building retrieval-enhanced generative applications, small-parameter, large-model approaches exhibit insufficient reasoning capabilities when faced with complex multi-hop reasoning tasks. In particular, they tend to output irrelevant information when processing text blocks containing redundant information, resulting in poor response quality.
By drawing on the concepts of "metacognition" and "externalization of knowledge" in psychology, and combining them with cueing engineering techniques, the model's information processing and multi-hop reasoning capabilities are optimized through iterative reflective learning processes and the externalization of the model's internal reasoning processes.
Under limited computing resources, it significantly improves the model's ability to process redundant information and its multi-hop inference performance, providing more accurate and intelligent responses while reducing computational costs.
Smart Images

Figure CN121745296A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of Natural Language Processing (NLP) and Psychology, and in particular to a method for optimizing multi-hop reasoning in large models that integrates psychological cognitive mechanisms. Background Technology
[0002] With the development of artificial intelligence, the emergence of ChatGPT marks the beginning of the era of Large Language Models (LLMs). LLMs have demonstrated powerful performance in context learning, semantic understanding, and generation capabilities. LLMs have also spurred the rapid development of Retrieval Augmented Generation (RAG) research. Currently, RAG research focuses on large models, providing them with additional knowledge to address issues such as illusions and insufficient timeliness inherent in LLMs. RAGs enable LLMs to process external knowledge without fine-tuning, reducing training costs. The advent of LLMs has also broadened the application scenarios of RAGs. Traditional RAG techniques may only be suitable for simple question answering and text summarization, while RAGs combined with LLMs can handle complex dialogues, multi-turn interactions, and report generation. As real-world applications become more complex, the accuracy of the technology is further enhanced. For example, in the process of building a RAG-based question-answering system in a real enterprise, local deployment of the model is often necessary for data security reasons. However, due to limited computing resources in real enterprises, only models with smaller parameters can usually be supported. These models suffer from weak reasoning ability and poor answering results when faced with complex questions requiring multi-hop reasoning. Multi-hop reasoning problems refer to complex problems that require the integration of multiple related knowledge fragments, logical connections, and multiple queries to solve. Taking the document retrieval of personal foreign exchange business in a bank as an example, when a user enters the question "Among the remittance companies you support, which remittance company can handle outward remittance business through mobile banking?", from a human cognitive perspective, this question needs to be broken down into two sub-questions: first, "Which remittance companies does your bank support?", and second, "Among these remittance companies, which remittance company can handle outward remittance business through mobile banking?" Obviously, this is a question that requires two searches to complete the reasoning, because the answers to these two questions may not be on the same page in the document, resulting in different text blocks. The recall rate of a single search is low, and the corresponding text blocks may contain a lot of redundant information. Furthermore, the knowledge retrieved in these two steps is logically related, meaning the result of the previous step influences the reasoning in the next step. Due to the limited reasoning ability of large models with small parameters, optimization methods such as chain-of-thought approaches perform poorly when decomposing multi-hop reasoning problems. Moreover, such models tend to output irrelevant information when processing text blocks containing redundant data, interfering with subsequent reasoning. Therefore, designing a low-cost augmentation algorithm that can optimize the quality of the model's input context and effectively guide the model to progressively decompose and reason about the problem has significant research and application value.
[0003] This invention addresses the multi-hop reasoning problem faced by retrieval enhancement generation techniques in the field of natural language processing, proposing a large-scale model multi-hop reasoning optimization method that integrates psychological cognitive mechanisms. This method draws on the concepts of "metacognition" and "knowledge externalization" from psychology, combined with cueing engineering techniques, to effectively improve the model's ability to process redundant information and its multi-hop reasoning performance under limited computational resources, achieving significant performance improvements. Summary of the Invention
[0004] The purpose of this invention is to address the problem of insufficient reasoning ability exhibited by small-parameter, large-model approach when constructing retrieval-enhanced generative applications, especially when faced with complex multi-hop inference tasks. By solving this problem, the model can be applied to various complex business scenarios, deeply understand user questions, and provide more accurate and intelligent responses.
[0005] This invention references the human brain's thinking patterns and draws upon the concept of "metacognition" in cognitive psychology, applying its "planning-evaluation-monitoring" thinking model to the RAG scenario. Through repeated iterations, the model develops an adaptive reflective learning process. Furthermore, this invention also incorporates the psychological strategy of "knowledge externalization," which involves displaying the model's internal reasoning process, specifically recording omitted information and modifying reasoning steps, to further improve the model's reasoning ability. Therefore, this invention provides a method for optimizing multi-hop reasoning in large models that integrates psychological cognitive mechanisms. By constructing prompt word templates based on the human brain's thinking patterns, this invention effectively enhances the model's ability to handle information redundancy and problem decomposition, not only improving the reasoning performance of RAG systems but also providing a new paradigm for the interdisciplinary integration of cognitive science and AI engineering.
[0006] To achieve the above objectives, this invention provides a method for optimizing multi-hop reasoning in large models that integrates psychological cognitive mechanisms, comprising the following steps: S1: The large language model decomposes the user's original question into several sub-questions and outputs the model reasoning steps, and determines the retrieval order of the sub-questions based on the model reasoning steps; S2: Retrieve the Top-K1 text information items related to the first sub-problem from the local knowledge base and / or user-provided documents; The local knowledge base / user-provided documents are a collection of locally stored text data used to provide a reliable knowledge source for large language models. It should be noted that, during the iteration process, the first sub-problem refers to the first sub-problem in the current model inference step; S3: Input the first sub-question and the Top-K1 text information into the large language model, filter out the most relevant Top-K2 text information from the Top-K1 text information, and output the reason for the citation; K2 < K1; The goal is to have the large model extract the top-K2 text information most relevant to the current retrieval question from the top-K1 text information, thereby reducing redundant information and optimizing the model's contextual input; and to have the large model output the reason for citing this text fragment, thereby reducing model illusions and improving information accuracy. S4: Input the original question, the current model reasoning steps, the text information filtered by the large language model and the reasons for the citation into the large language model, and determine whether the current text information is sufficient to complete the answer; if it is not sufficient to complete the answer, output the final answer; if it is determined that the current text information is insufficient to complete the answer, let the large language model output the content of the missing information and modify the reasoning steps obtained in step S1. S5: Input the missing information output in step S4 and the modified reasoning steps into the large language model to generate sub-problems, and return to step S2 until the final answer is generated or the maximum number of iterations is reached.
[0007] It also includes building a problem decomposition example library, which includes the original problem, its decomposed subproblems, and model reasoning steps.
[0008] Furthermore, it also includes real-time updates to the problem decomposition example library: if the final answer is correct, the original problem and its decomposed subproblems and model reasoning steps are saved as sample examples.
[0009] Furthermore, in step S1, the prompt words of the large language model include: Few-shot hints: at least one example; by providing the large model with several examples, the large model can better understand the task to be performed; Thought Chain: Add the text "Step-by-Step Thinking"; add text such as "Step-by-Step Thinking" to the prompts so that the large model can output the thinking process.
[0010] Further, step S2 includes: Vectorize the text in the local knowledge base and / or user-provided documents and the currently retrieved sub-question, calculate the vector similarity between the two, and select the Top-K1 text information with the highest similarity.
[0011] Further, step S2 includes: Text chunking: The document to be retrieved is divided into text chunks using a chunking method; the document can be a document in a local knowledge base or a document provided by the user. Vector representation: Text blocks and sub-problems are vectorized using a text embedding model, converting natural language into dense vectors; Building an index: The text after being divided into blocks is indexed using a vector database; Similarity calculation: When selecting the top-K related text blocks, the cosine similarity is used to calculate the similarity between the user question vector and the text block vector, and the top K1 related text blocks with the highest similarity are returned.
[0012] This invention also provides a large-scale multi-hop reasoning optimization device that integrates psychological cognitive mechanisms, comprising: The problem decomposition module is configured to: decompose the user's original problem into several sub-problems by the large language model and output the model reasoning steps, which include the sub-problems and their retrieval order; The retrieval module is configured to retrieve the Top-K text information related to the first sub-question from the local knowledge base; The evidence filtering module is configured to: input the first sub-question and the Top-K text information into the large language model, filter out the most relevant text information from the Top-K text information, and output the reasons for the citation; The dynamic evaluation module is configured to: input the original question, the current model reasoning steps, the text information filtered by the large language model and the reasons for the citation into the large language model, and determine whether the current text information is sufficient to complete the answer; if it is insufficient to complete the answer, output the final answer; if it is determined that the current text information is insufficient to complete the answer, then let the large language model output the content of the missing information and modify the reasoning steps obtained in step S1. The sub-problem reconstruction module is configured to: input the missing information output in step S4 and the modified reasoning steps into the large language model, generate sub-problems, and return to step S2 until the final answer is generated or the maximum number of iterations is reached.
[0013] The present invention also provides an electronic device, including a memory and a processor, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-described optimization method for large-scale multi-hop reasoning that integrates psychological cognitive mechanisms.
[0014] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-described method for optimizing large-scale multi-hop reasoning that integrates psychological cognitive mechanisms.
[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method for optimizing large-scale multi-hop inference by incorporating psychological cognitive mechanisms.
[0016] The beneficial effects of this invention are as follows: In a retrieval-enhanced question-answering system, this invention addresses complex user-generated questions with multi-hop reasoning. Based on prompting engineering, it introduces the metacognitive learning mechanism from psychology into the RAG framework and draws upon the cognitive science principle of "externalizing knowledge to enhance thinking" in psychology to construct prompt word templates. This effectively enhances the model's ability to handle information redundancy and problem decomposition, and strengthens the logical coherence of reasoning. Compared to existing RAG optimization methods, this invention can improve the model's reasoning ability under limited computing resources without constructing data to train the model or using resource-intensive methods such as knowledge graphs. This reduces costs in actual enterprise development, provides a more intelligent consultation and question-answering experience, and improves the practicality of the retrieval-enhanced generation system. Attached Figure Description
[0017] Figure 1 This is a flowchart of the method designed in this invention; Figure 2 This is a mind map of the "metacognition" in this invention; Figure 3 This is a model framework diagram of the present invention; Figure 4 This is a schematic diagram of an electronic device structure provided in an embodiment of the present invention. Detailed Implementation
[0018] The method proposed in this invention will be further described in detail below with reference to the accompanying drawings and specific examples.
[0019] This invention provides a method for optimizing multi-hop reasoning in large models that integrates psychological and cognitive mechanisms, comprising the following steps: S1: Problem Decomposition: Design prompts, generate initial sub-problems based on the user's original question, and output model reasoning steps; the model reasoning steps are reasoning descriptions of several sub-problems, and determine the retrieval order of the sub-problems based on the model reasoning steps; S2: Retrieval Enhancement: Vectorize the knowledge in the local knowledge base and / or user-provided documents using a text embedding model, and also vectorize the first sub-question. Calculate the vector similarity between the two and select the Top-K text blocks with the highest similarity. The first sub-question is determined based on the current model's inference steps. S3: Evidence Selection: Input the K text blocks obtained in step S2 and the first sub-question obtained in step S1 into the large model, design prompt word templates, and let the large model extract relevant sentences from the K text blocks and output the reasons for citation; S4: Dynamic evaluation: Input the current model reasoning step and the relevant statements and citation reasons obtained in step S3, as well as the original question, into the large model, and let the large model judge whether the retrieved information is sufficient to complete the answer. If the information is sufficient to support the answer, the final answer is output and the current reasoning step is saved. If the information is insufficient to support the answer, proceed to step S5. S5: Knowledge Externalization and Correction: If step S4 determines that the currently obtained information is insufficient to support the answer, then the model outputs the missing information and modifies the reasoning steps obtained in step S1. S6: Sub-problem reconstruction: Combine the missing information obtained in step S5 with the modified reasoning steps, design a prompt word template, input it into the large model, and let the model raise sub-problems in a targeted manner. Then return to step S2 until the final answer is generated or the maximum number of iterations is reached.
[0020] Specifically, in step S1 of this invention, decomposing the problem using a large model is the first step in achieving multi-hop reasoning. This step mainly involves designing prompt word templates for the large model, allowing the large model to initially generate sub-problems based on the original question. The generated sub-problems should contain a clear single-click search intent, thus improving the retrieval recall rate. In step S1, model generation needs to include the following: (1) Reasoning steps. Through few-sample prompts (see the prompt template in step 1.1 for details), the thinking chain technology, and the historically saved reasoning steps, the large model outputs the reasoning process for the user's original question, determining what to do in the first step and what to do in the second step.
[0021] (2) Initial sub-question. Through few-shot hints and thought chain technology, see the hint template in step 1.1 for specific few-shot hints, the large model generates an initial sub-question based on the user's original question. This sub-question needs to accurately describe the information of the first hop that needs to be retrieved in the original question.
[0022] Specifically, step S2 aims to perform a retrieval based on the current first sub-question. The purpose of this step is to retrieve the text chunks most relevant to the sub-question from the local knowledge base, providing additional knowledge to the large model for subsequent reasoning. This includes: (1) Text segmentation. Use a complex document parsing tool (such as MinerU) to parse the document, including parsing page size, font type, bounding box type, chapters and lists, etc. Then, according to some heuristic rules, merge the title with the following content, merge the content of the item list, etc., to segment the complex document content into blocks, and save the metadata information of each text block, such as page number, title of the page, etc.
[0023] (2) Vector representation. An open-source text embedding model trained on a dataset of tens of millions of Chinese sentences was used to encode sub-problems and text blocks, converting natural language into dense vectors.
[0024] (3) Similarity retrieval. First, an index of text blocks is constructed using a vector database. Then, the similarity between the user question vector and the text block vector is calculated using cosine similarity, and the top K1 related text blocks are returned.
[0025] Specifically, step S3 of this invention is one of the key steps in optimizing the model context. It utilizes a large model to perform deep filtering on the first K1 text blocks obtained in step S2, thereby achieving efficient filtering of redundant information. The main tasks of step S3 include: (1) Relevant text fragments. Since the results after segmentation often contain some redundant information, the purpose of this step is to allow the large model to filter out this redundant information and select the text fragments that can solve the problem.
[0026] (2) Reasons for citation. In order to prevent the "illusion" of large models, the large models should have a logical basis when citing relevant text fragments, which also improves the accuracy of retrieval.
[0027] Specifically, step S4 of the present invention is one of the key steps in realizing enhanced multi-hop reasoning capabilities, and specifically includes: (1) Information support. If the text fragment obtained in step S3, combined with the current model reasoning steps, can support the completion of the answer after the large model's judgment, then the large model outputs the final answer and saves the current reasoning steps.
[0028] (2) Missing information. If the text fragment obtained in step S3, combined with the reasoning steps in step S1, cannot support the completion of the answer after being judged by the large model, proceed to step S5.
[0029] Specifically, step S5 of this invention is a key step in the large-scale multi-hop reasoning optimization method that integrates psychological cognitive mechanisms. Cognitive psychology has verified that knowledge externalization utilizes our perceptual abilities in a highly intelligent way. By transforming our internal thought processes into external forms, externalization essentially allows us to re-input information into our brains through different channels. This provides us with additional cognitive resources, enabling us to process the same information in a different way. By introducing this thinking pattern into artificial intelligence, this invention, when step S4 determines that the currently obtained information is insufficient to support the answer, instructs the model to output the missing information and modifies the current model's reasoning steps. The outputs of these two parts serve as the input for step S6.
[0030] Furthermore, step S6 of the present invention is the final key step of a large-scale multi-hop reasoning optimization method that integrates psychological cognitive mechanisms. Its input is the content of the missing information obtained in step S5 and the modified reasoning steps. Then, a prompt template is designed and given to the large model to generate sub-problems based on the current reasoning steps, and then it continues to return to step S2 until the final answer is generated or the maximum number of iterations is reached.
[0031] Example 1: This invention proposes a large-scale multi-hop reasoning optimization method that integrates psychological cognitive mechanisms. Specifically, it mainly references the concept of "metacognition" in cognitive psychology, a concept proposed by American psychologist John H. Flavell in 1976. Figure 2 As shown, the core function of metacognition is manifested in a cyclical mechanism of "planning-monitoring-evaluation." Planning refers to clarifying goals, breaking down steps, and selecting strategies before a task begins; monitoring refers to tracking progress in real time during task execution, including self-reflection; and evaluation refers to adjusting strategies or goals based on monitoring results to better facilitate the next stage of learning. Secondly, in the adjustment strategy for monitoring, this invention draws on the psychological concept of "externalization of knowledge," which means transforming the internal thinking processes of the human brain into external forms (such as notes, drawings, etc.). This process essentially allows the brain to re-input information from different channels, obtain additional cognitive resources, and then process information in a different way, thereby improving the ability to deeply analyze information. Based on these two concepts, such as... Figure 3 As shown, this invention first uses prompting engineering to allow a large model to output reasoning steps and generate initial sub-questions based on complex multi-hop reasoning problems. Then, a document parsing tool is used to segment the document into blocks, vectorizing the text blocks, and retrieving the K most relevant text blocks based on the sub-questions. Next, the large model filters out relevant text fragments and outputs citation reasons. Then, based on prompting engineering, the large model evaluates whether this information is sufficient to support the answer; if so, it outputs the final answer; if not, it outputs the missing information and modifies the reasoning steps. Finally, the missing information and modified reasoning steps are re-inputted into the large model to generate sub-questions for the next search target, and the search is performed again. In a specific implementation scenario, a PDF of a bank's personal foreign exchange business is used as an example, such as... Figure 1 As shown, it consists of 5 steps in total, including the following stages: Step 1: Problem Breakdown In the embodiments of this invention, the problem first needs to be decomposed. A prompt word template is designed and provided to the large model, allowing the large model to initially generate sub-problems and reasoning steps based on the original problem. The following are specific steps and examples, using a smart customer service system for personal foreign exchange business in a bank as an example: Step 1.1: Prompt Project To guide the large model to better decompose the problem, a prompt template is designed using a few-sample prompting approach. The prompt template can be: Since the original multi-hop inference contains multiple query intents, it results in a low retrieval recall rate. The prompt template designed in this invention contains only one query after the question is decomposed, resulting in higher accuracy.
[0032] Step 1.2: Model Generation Subsequently, based on the prompt template designed in step 1.1, the input is given to the large model, allowing the model to output the reasoning steps and initial sub-problems. The following is an example from a bank's intelligent customer service system: Step 2: Search Enhancement In this embodiment of the invention, step 2 aims to retrieve relevant text blocks from the knowledge base based on the generated initial question. The following are the specific data processing steps, using a bank's personal foreign exchange business PDF as an example: Step 2.1: Text Segmentation First, MinerU (a third-party library) is used for text segmentation. It uses OCR, layout detection models, formula detection and recognition models, and table recognition models to parse multimodal documents. Then, a dynamic grid scanning algorithm is used to sort text blocks, tables, formulas, and other elements. Based on geometric and semantic corrections, the problem of overlapping bounding boxes is handled, duplicate elements and invalid information are deleted, and then the text blocks are concatenated.
[0033] Step 2.2: Vector Representation The vector representation in this step is divided into user vector representation and text block vector representation. To facilitate subsequent model retrieval, this invention needs to represent the text as high-dimensional vectors, thereby calculating the distance between vectors to represent their similarity. The M3E text embedding model, trained on a dataset containing tens of millions of Chinese sentences, is used to encode the initial question obtained in step 1.1 and the text blocks obtained in step 2.1. Natural language is then converted into dense vectors.
[0034] Step 2.3: Similar Search In this sub-step, we need to index the text vectors obtained in step 2.2 into the Faiss vector database, and then use cosine similarity to represent the distance between the question vector and the text block vector. The Faiss vector database uses the inverted product quantization algorithm to build the index.
[0035] Specifically, this includes two approaches: Inverted File (IVF) and Product Quantization (PQ). PQ, simply put, first defines an M, representing the number of segments into which a given vector is divided. Then, it performs clustering on each segment, resulting in 256 cluster centers per segment, ultimately yielding 256*M cluster centers across all vectors. Next, it assigns these cluster centers to all vectors. Taking a 128-dimensional vector as an example, it first divides the vector into M segments, and then each segment can find its nearest cluster center ID, thus transforming a 128-dimensional vector into an M-dimensional vector, achieving vector compression. IVF, on the other hand, locks the global traversal into a subspace traversal, thereby eliminating unnecessary global computation and sorting. Specifically, it first performs K-Means clustering on all vectors, dividing them into K clusters, and then uses PQ to calculate distances.
[0036] Taking a bank's personal foreign exchange business PDF as an example, the text retrieved based on the initial question obtained in step 1.2 is as follows: In this specific implementation, K1 is set to 3, meaning the top 3 text blocks with the highest similarity are selected and their contents are returned. Each relevant document is a text block returned by the retrieval. As you can see, the most relevant Document1 contains the answer to the question.
[0037] Step 3: Selection of Evidence In an embodiment of the present invention, step 3 is evidence selection, which mainly involves further filtering text fragments related to the user's question from the text blocks returned in step 2.3 using a large model, and outputting the reasons for citing these fragments to optimize the contextual input for the final reasoning. The prompt template designed in this invention is shown below. The prompt template designed in this invention prevents the model from outputting text other than the reference document by using a quotation at the end of the sentence, and restricts the output format for easy subsequent use. The following is an implementation example of this prompt template in a bank's intelligent customer service for personal foreign exchange. Step 4: Dynamic Evaluation In this embodiment of the invention, step 4 is dynamic evaluation. The current model reasoning step and the relevant statements and citation reasons obtained in step 3, along with the original question, are input into the large model. The large model then determines whether the retrieved information is sufficient to complete the answer. If the information is sufficient to support the answer, the final answer is output, and the current reasoning step is saved. If the information is insufficient to support the answer, the information omitted in the current answer to the question is output, and the current reasoning step is modified. The prompt template designed in this invention is shown below. The original question, the current model reasoning steps, and the *referenced content* obtained in step 3 are used as inputs to allow the large model to evaluate whether they are sufficient to support the answer. Taking the bank's personal foreign exchange smart customer service as an example, currently only remittance companies are found, and it is also necessary to clarify which remittance companies can use mobile banking to handle outward remittance business. A specific case is shown below. Step 5: Correction and Reconstruction In an embodiment of the present invention, step 5 draws on the concept of "knowledge externalization" to re-input the missing information and the revised reasoning plan into the large model, allowing it to generate targeted sub-problems based on the current reasoning stage. The prompt template designed in this invention is shown below. Taking the bank's intelligent customer service for personal foreign exchange as an example, step 4 determines that the current information is insufficient to support an answer. The missing information and the revised reasoning plan are then re-inputted into the model to generate sub-questions with logical relationships. A specific example is shown below. The sub-problems generated in this step are returned to step 2 for iterative retrieval until the final answer is output or the maximum number of iterations is reached. Experiments have shown that setting the number of iterations to 4 is more appropriate.
[0038] By following the above five steps, we can achieve multiple reasoning optimization methods that integrate psychological and cognitive mechanisms.
[0039] This invention also provides a large-scale multi-hop reasoning optimization device that integrates psychological cognitive mechanisms, comprising: The problem decomposition module is configured to: decompose the user's original problem into several sub-problems by the large language model and output the model reasoning steps, which include the sub-problems and their retrieval order; The retrieval module is configured to retrieve the Top-K text information related to the first sub-question from the local knowledge base; The evidence filtering module is configured to: input the first sub-question and the Top-K text information into the large language model, filter out the most relevant text information from the Top-K text information, and output the reasons for the citation; The dynamic evaluation module is configured to: input the original question, the current model reasoning steps, the text information filtered by the large language model and the reasons for the citation into the large language model, and determine whether the current text information is sufficient to complete the answer; if it is insufficient to complete the answer, output the final answer; if it is determined that the current text information is insufficient to complete the answer, then let the large language model output the content of the missing information and modify the reasoning steps obtained in step S1. The sub-problem reconstruction module is configured to: input the missing information output in step S4 and the modified reasoning steps into the large language model, generate sub-problems, and return to step S2 until the final answer is generated or the maximum number of iterations is reached.
[0040] It should be noted that the device embodiment shown in this embodiment matches the content of the above method embodiment, and the content of the above method embodiment can be referred to, and will not be repeated here.
[0041] Figure 4 This is a schematic diagram of an electronic device structure provided in an embodiment of the present invention. Please refer to... Figure 4 The electronic device provided in this embodiment includes a memory and a processor. The memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, they realize a large-model multi-hop reasoning optimization method that integrates psychological cognitive mechanisms according to the present invention.
[0042] It should be noted that, in addition to Figure 4 In addition to the memory and processor shown, electronic devices may include other hardware depending on their actual functions, which will not be elaborated further.
[0043] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-described method for optimizing large-scale multi-hop reasoning that integrates psychological cognitive mechanisms.
[0044] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method for optimizing large-scale multi-hop inference by incorporating psychological cognitive mechanisms.
[0045] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0046] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0047] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0048] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0049] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0050] The above embodiments are only used to illustrate the design concept and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, all equivalent changes or modifications made based on the principles and design ideas disclosed in the present invention are within the protection scope of the present invention.
Claims
1. A method for optimizing multi-hop reasoning in a large-scale model that integrates psychological cognitive mechanisms, characterized in that, Includes the following steps: S1: The large language model decomposes the user's original question into several sub-questions and outputs the model reasoning steps, and determines the retrieval order of the sub-questions based on the model reasoning steps; S2: Retrieve the Top-K1 text information items related to the first sub-question from the local knowledge base and / or user-provided documents; S3: Input the first sub-problem and the Top-K1 text information into the large language model, filter out the most relevant Top-K2 text information from the Top-K1 text information, and output the reason for the citation; S4: Input the original question, the current model reasoning steps, the text information filtered by the large language model and the reasons for the citation into the large language model, and determine whether the current text information is sufficient to complete the answer; If the current text information is insufficient to complete the answer, output the final answer; if it is determined that the current text information is insufficient to complete the answer, have the large language model output the missing information and modify the reasoning steps obtained in step S1. S5: Input the missing information output in step S4 and the modified reasoning steps into the large language model to generate sub-problems, and return to step S2 until the final answer is generated or the maximum number of iterations is reached.
2. The method according to claim 1, characterized in that, It also includes building a problem decomposition example library, which includes the original problem, its decomposed subproblems, and model reasoning steps.
3. The method according to claim 2, characterized in that, It also includes a real-time updated problem decomposition example library: if the final answer is correct, the original problem, its decomposed subproblems, and the model reasoning steps are saved as sample examples.
4. The method according to claim 2 or 3, characterized in that, In step S1, the prompt words of the large language model include: Few samples hint: at least one example; Mind Chain: Add "Step-by-Step Thinking" text.
5. The method according to claim 1, characterized in that, Step S2 includes: Vectorize the text in the local knowledge base and / or user-provided documents and the currently retrieved sub-question, calculate the vector similarity between the two, and select the Top-K1 text information with the highest similarity.
6. The method according to claim 1, characterized in that, Step S2 includes: Text chunking: The document to be retrieved is divided into text chunks using chunking methods; Vector representation: Text blocks and sub-problems are vectorized using a text embedding model, converting natural language into dense vectors; Building an index: The text after being divided into blocks is indexed using a vector database; Similarity calculation: When selecting the top-K related text blocks, the cosine similarity is used to calculate the similarity between the user question vector and the text block vector, and the top K1 related text blocks with the highest similarity are returned.
7. A large-scale multi-hop reasoning optimization device integrating psychological cognitive mechanisms, characterized in that, include: The problem decomposition module is configured to: decompose the user's original problem into several sub-problems by the large language model and output the model reasoning steps, which include the sub-problems and their retrieval order; The retrieval module is configured to retrieve the Top-K text information related to the first sub-question from the local knowledge base; The evidence filtering module is configured to: input the first sub-question and the Top-K text information into the large language model, filter out the most relevant text information from the Top-K text information, and output the reasons for the citation; The dynamic evaluation module is configured to input the original question, the current model reasoning steps, the text information filtered by the large language model and the reasons for the citation into the large language model, and determine whether the current text information is sufficient to complete the answer. If the current text information is insufficient to complete the answer, output the final answer; if it is determined that the current text information is insufficient to complete the answer, have the large language model output the missing information and modify the reasoning steps obtained in step S1. The sub-problem reconstruction module is configured to: input the missing information output in step S4 and the modified reasoning steps into the large language model, generate sub-problems, and return to step S2 until the final answer is generated or the maximum number of iterations is reached.
8. An electronic device comprising a memory and a processor, characterized in that, The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the large-model multi-hop reasoning optimization method that integrates psychological cognitive mechanisms as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements a large-model multi-hop reasoning optimization method that integrates psychological cognitive mechanisms as described in any one of claims 1-6.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements a large-model multi-hop inference optimization method that integrates psychological cognitive mechanisms, as described in any one of claims 1-6.