Knowledge intensive question reasoning and generating method based on LLM
By introducing the thinking chain structure and the double-layer retrieval evaluation mechanism of the external knowledge base into LLM, the insufficient reasoning ability and 'illusion' phenomenon of traditional systems when dealing with knowledge-intensive problems are solved, and more accurate and reliable answer generation is achieved.
Patent Information
- Application Number
- CN202411272971.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-09-12
AI Technical Summary
When traditional search engines and information retrieval systems deal with knowledge-intensive problems with rich semantic context and high complexity, their reasoning and solving capabilities are limited, and large language models (LLM) may suffer from 'hallucination' phenomena, resulting in the generation of content. Inaccuracy.
Adopt the knowledge-intensive problem reasoning and generation method based on LLM, decompose the problem through the thinking chain structure, combine the double-layer searcher and retrieval evaluation module of the external knowledge base, dynamically obtain information, verify and correct the intermediate reasoning steps, and improve the logic of generated content Accuracy and reliability.
Through interactive verification and correction of intermediate reasoning steps, the problem of insufficient knowledge and error propagation is overcome, the logical accuracy and reliability of the content generated by the large language model is improved, and the authenticity and reliability of the generated answers are ensured.
Smart Images

Figure CN118798367A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of natural language processing and retrieval enhancement generation, and specifically relates to a knowledge-intensive problem reasoning and generation method based on LLM. Background Art
[0002] In today's era of information explosion, people are faced with the challenge of processing and utilizing massive amounts of knowledge. In particular, traditional search engines and information retrieval systems often face many limitations when dealing with knowledge-intensive problems. These systems usually rely on keyword matching and statistical methods, but their reasoning and solving capabilities are significantly limited when dealing with problems with rich semantic context and high complexity.
[0003] In recent years, with the rapid development of artificial intelligence and natural language processing (NLP) technology, large language models (LLMs) trained on massive corpora have performed well in various NLP tasks. LLMs are able to answer complex questions by generating step-by-step natural language reasoning steps under appropriate prompts. However, for many open-domain problems, LLMs still encounter some problems in the process of solving the problems: first, the model parameters do not always contain all the required knowledge, and second, LLMs may experience "hallucination" phenomena. Therefore, it becomes very necessary to retrieve additional information from external sources (i.e., retrieval enhancement), which can greatly improve the reliability and accuracy of the content generated by the model.
[0004] A simple way to combine LLM and retrieval enhancement generation is to perform a one-time retrieval from an external knowledge base based on the question, and then directly input a large amount of retrieval information into the LLM, converting the question-answering task into a reading comprehension task. For knowledge-intensive questions, although this method can successfully enhance many relevant fact-based knowledge for LLM, the large amount of retrieval information may not only make it difficult for LLM to fully understand, but the irrelevance of the retrieval information to the question may also cause misunderstandings of LLM. For such questions, humans usually break down complex questions into multiple simple questions, and then retrieve and answer them step by step. Therefore, the interaction between the retrieval and reasoning steps is particularly important. However, recent studies either enhance the ability of the retriever to retrieve external knowledge or improve the ability of LLM to extract answers from the retrieval information. Few studies have utilized the understanding and reasoning capabilities of LLM and combined external knowledge to improve the intermediate reasoning steps to promote the answering effect of LLM.
[0005] Therefore, it is necessary to design a knowledge-intensive problem reasoning and generation method based on LLM, which can verify and modify the intermediate reasoning steps of LLM by interacting with external knowledge, so as to overcome the "hallucination" and error propagation and solve the above problems. Summary of the invention
[0006] To solve the above problems, the present invention discloses a method for reasoning and generating knowledge-intensive problems based on LLM, in order to meet the demand for difficult to retrieve answers to knowledge-intensive problems. This method relies on the powerful reasoning ability of the large language model, realizes problem decomposition and step-by-step reasoning through the thought chain structure, and combines the retrieval enhancement mechanism to dynamically obtain the required information from the external knowledge source to optimize the reasoning process; this method greatly improves the authenticity and reliability of the retrieved information through the double-layer retriever of the knowledge base retrieval module and the multiple verifications of the retrieval evaluation module; this method not only overcomes the limitations of traditional methods caused by insufficient knowledge or error propagation, but also improves the logical accuracy and reliability of the content generated by the large language model by driving the thought chain with external knowledge, interactive verification and correction of the intermediate reasoning steps.
[0007] To achieve the above object, the technical solution of the present invention is as follows: A method for reasoning and generating knowledge-intensive problems based on LLM, comprising the following steps: S1: For user questions to be answered , processed by the knowledge assessment module to determine the problem Can the problem be solved using the internal knowledge of the large language model? If so, the large language model will directly generate the answer. Otherwise, the problem will be solved by Incoming knowledge base retrieval module and CoT-LLM reasoning module; S2: Knowledge base retrieval module targets questions Retrieve relevant factual information, CoT-LLM reasoning module combines questions and retrieved information to generate a structured dynamic reasoning chain ; S3: The knowledge base retrieval module uses a two-layer retriever to target sub-questions in the reasoning chain. Search the knowledge base to obtain information that is helpful in answering sub-questions relevant information; S4: The retrieval evaluation module re-evaluates the retrieved information. If the retrieved information is consistent with the sub-question If the matching degree is higher than the threshold, it will enter the generation module, otherwise it will skip the sub-question Modification, return to the knowledge base search stage, search relevant information; S5: Generate module based on the retrieved relevant information and sub-questions , generate candidate answers ; S6: Verification module from the original answer and candidate answers Select a more appropriate answer from the options as an improvement to the CoT reasoning chain. If a sub-chain in the reasoning chain is modified, enter the CoT-LLM reasoning module to adjust the subsequent sub-chains accordingly based on this modification, obtain a new reasoning chain, and then process the next sub-question in the current reasoning chain. ; S7: Repeat steps S2 - S6 in a loop until the CoT reasoning chain is completed. Then, determine whether the final answer can be obtained through the <final answer>< / final answer> tag. If this tag exists, output the answer in the tag; otherwise, it means the question cannot be answered.
[0008] Furthermore, the specific method for constructing the knowledge evaluation module in S1 is as follows: (1) Collect question - answer pair data D that conforms to the characteristics of multi - hop questions (i.e., questions that require two or more steps of reasoning to complete the answer). Among them, D contains questions and their corresponding correct answers for multiple question - answer pairs; (2) Construct a question - answer pair dataset for training the knowledge evaluation model ; Specifically, first extract the questions in D and input them to the large language model LLM. Through few - shot prompting and in - context learning, enable the model LLM to generate answers for each question , where the generated answers at this time are completely dependent on the internal knowledge of the model; then, according to the comparison result with the correct answer , divide the questions into two groups. If is the same as , then these questions belong to , that is, questions that the model can solve by itself; otherwise, they belong to , that is, questions that the model cannot solve by itself; finally, form the final training dataset , where, for the answers are all: know, and for the answers are all: don't know; (3) Use the standard conditional language modeling objective to train the large language model LLM on the dataset to obtain a knowledge evaluation model for judging whether a question can be solved by the internal knowledge of the model.
[0009] Furthermore, the specific method for constructing the knowledge base retrieval module in S2 is as follows: (1) Use bge-large-zh as a dense retriever to capture deeper semantic information of text paragraphs to retrieve relevant text. Specifically, dense vectors are used to represent text, and the similarity scores between vectors are calculated using cosine similarity, which is calculated as follows: ; in is the vectorized representation of the query statement. is the vectorized representation of the document; (2) Use BM25 as a sparse retriever to capture vocabulary information in text paragraphs. Specifically, relevant text is retrieved by calculating the similarity score between the document and the query condition. The calculation formula is as follows: ; in, Indicates the problem, Represents a document, Represents the i-th word in the query statement, is the number of words in the query, is the inverse document frequency, is the number of occurrences of the i-th word in the document, and To adjust the parameters, is the length of the document, is the average length of documents in the document collection; (3) In order to consider both vocabulary and semantic information, a hybrid method is used to combine the sparse retriever and the dense retriever, that is, the implementation of a two-layer retriever. The combined similarity score calculation formula is as follows: ; in, and It is to balance the weights of the two retrievers and adjust them according to actual needs and experimental results; Based on the above combined similarity scores, the top-3 text fragments are selected as the retrieved relevant texts, thereby obtaining a knowledge base retrieval module. Compared with a retriever that only relies on vocabulary or semantic information, the content retrieved by the double-layer retriever will be more closely matched with the user's question.
[0010] Furthermore, the specific method for constructing the CoT-LLM reasoning module of S2 is as follows: (1)Construct a CoT demonstration set for in-context learning of large language models: Specifically, first, manually write several accurate CoT demonstrations as a benchmark set, and use these demonstrations as the starting point for constructing the complete set; then, use the multi-hop questions collected in S1 as the training set; then, use an iterative algorithm to gradually expand the benchmark set until the construction of the complete CoT set is finally completed. Specifically, in each iteration, select the demonstration with the highest cosine similarity to the question in the training set from the benchmark set as the context prompt, and use ChatGPT to generate a structured CoT reasoning chain, and append the question and the generated reasoning chain to the benchmark set until each question in the training set has completed the iteration; finally, the complete CoT set is presented in the format of <Q, CoT reasoning chain>. (2)For each question proposed by the user , screen out the demonstration with the highest cosine similarity to the question from the above-mentioned completed CoT complete set (the role of the demonstration is to help the large language model LLM understand how to generate a suitable CoT reasoning chain); the large language model LLM performs reasoning and generates a reasoning chain according to the complete instruction combining the question , the demonstration and the retrieved information.
[0011] Further, the specific method for constructing the retrieval and evaluation module in S4 is as follows: (1)Select bge-raranker-large as the base model of the retrieval and evaluation module, which has good text matching and evaluation capabilities; (2)Set the matching degree threshold threshold: used to determine whether the retrieved information meets the requirements, ensuring that only high-quality matching results are selected. This threshold can be optimized and adjusted through experiments and verification to meet the needs of specific application scenarios; (3)Preprocessing of input information: Standardize the retrieved information, including preprocessing steps such as removing extra spaces and punctuation handling, to ensure the consistency of the input information format; (4)Calculation of matching degree scores: Input the preprocessed retrieved information into the bge-reranker-large model, and calculate the matching degree scores of each piece of information; (5)Screening of retrieved information: Screen the retrieved information according to the matching degree scores. Only the retrieved information with a score higher than the threshold will be selected as the reference document for modifying the CoT sub-chain. If the matching degree scores of all the retrieved information are lower than the threshold, skip the modification of the current sub-chain.
[0012] Further, the specific method for constructing the generation module in S5 is as follows: (1)Construct a training dataset. In the training data, each data point contains a question, a set of reference documents, and an answer. The answer consists of two parts: one is the cited document (marked with the <citation>< / citation> tag), and the other is the question answer (marked with the <answer>< / answer> tag). There needs to be a certain reasoning process between these two parts (i.e., the explanation for obtaining the answer based on the cited document); The reference documents are divided into two categories: "relevant documents" (documents containing the question answer) and "distracting documents" (documents not containing the question answer); In the entire dataset, the data contains both "relevant documents" and "distracting documents", while the data
[0013] only contains "distracting documents"; (2) Use the method of supervised fine-tuning to train the large language model LLM on the training dataset. The model is trained to answer questions in the presence of distracting documents, enabling it to ignore retrieval documents that are not helpful for answering the given question. This helps improve the robustness of the model to inaccurate retrieval results during generation, and finally obtains a generation model that can accurately answer relevant questions based on the retrieved information.
[0014] The beneficial effects of the present invention are: (1) The CoT-LLM reasoning module selects appropriate demonstrations from the constructed CoT complete set as the context learning examples for the LLM. This method enables the LLM to better understand the task and generate more accurate reasoning chains; By intertwining retrieval with the chain of thought (CoT), the present invention realizes the two-way interaction between retrieval and reasoning. Even when encountering insoluble problems during the reasoning process, it can use the retrieval results to dynamically improve the reasoning trajectory in the chain of thought, thereby perfecting the chain of thought and enhancing the flexibility and accuracy of the chain of thought; (2) The knowledge base retrieval module adopts a two-layer retriever, which takes into account the lexical information and deeper semantic information of the text paragraph at the same time, so as to search for sub-questions in the reasoning chain and retrieve information that is highly relevant to the question; on this basis, the retrieval information is further evaluated and matched through the retrieval evaluation module to ensure that only high-quality retrieval information is used to improve the thinking chain. At the same time, skipping the modification of the sub-chain according to the matching degree can also improve the reasoning efficiency of the entire framework to a certain extent; the generation module trains the model through supervised fine-tuning so that the generation model acquires the ability to distinguish interference information, which helps to improve the robustness of the model to inaccurate retrieval results during generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is an overall framework diagram of a knowledge-intensive problem reasoning and generation method based on LLM.
[0016] Figure 2 The core flow chart for dynamically improving the CoT reasoning chain. DETAILED DESCRIPTION
[0017] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0018] like Figure 1 As shown, the present invention proposes a knowledge-intensive problem reasoning and generation method based on LLM, which includes the following steps: S1: For user questions to be answered , processed by the knowledge assessment module to determine the problem Can the problem be solved using the internal knowledge of the large language model? If so, the large language model will directly generate the answer. Otherwise, the problem will be solved by Incoming knowledge base retrieval module and CoT-LLM reasoning module; Specifically, building a knowledge assessment module can be divided into the following steps: (1) Collect question-answer pairs D that meet the characteristics of multi-hop questions (i.e., questions that require two or more steps of reasoning to complete the answer), where D contains the question and its corresponding correct answer Multiple question-answer pairs; (2) Constructing a question-answer pair dataset for training the knowledge evaluation model ; Specifically, first extract the questions in D The input is given to the large language model LLM, which can generate answers for each question through few sample prompts and context learning. , the answer generated at this time is completely dependent on the internal knowledge of the model; then, according to With the correct answer The comparison results will be Divided into two groups, if and The same, then these questions belong to , that is, problems that the model can solve by itself, otherwise it belongs to , that is, problems that the model cannot solve by itself; finally, the final training data set is formed , among which, for The answers are: Yes, The answers are: I don’t know; (3) Using the standard conditional language modeling objective on the dataset The large language model LLM is trained to obtain a knowledge evaluation model that is used to determine whether a problem can be solved by the internal knowledge of the model.
[0019] S2: Knowledge base retrieval module targets questions Retrieve relevant factual information, CoT-LLM reasoning module combines questions and retrieved information to generate a structured dynamic reasoning chain ; Specifically, building a knowledge base retrieval module can be divided into the following steps: (1) Use bge-large-zh as a dense retriever to capture deeper semantic information of text paragraphs to retrieve relevant text. Specifically, dense vectors are used to represent text, and the similarity scores between vectors are calculated using cosine similarity, which is calculated as follows: ; in is the vectorized representation of the query statement. is the vectorized representation of the document; (2) Use BM25 as a sparse retriever to capture vocabulary information in text paragraphs. Specifically, relevant text is retrieved by calculating the similarity score between the document and the query condition. The calculation formula is as follows: ; in, Indicates the problem, Represents a document, Represents the i-th word in the query statement, is the number of words in the query, is the inverse document frequency, is the number of occurrences of the i-th word in the document, and To adjust the parameters, is the length of the document, is the average length of documents in the document collection; (3) To consider both lexical and semantic information simultaneously, a hybrid method is used to combine the sparse retriever and the dense retriever, namely the implementation of a two-layer retriever. The formula for calculating the combined similarity score is as follows: ; where and are the weights for balancing the two retrievers, which are adjusted according to actual needs and experimental results; Based on the above combined similarity score, the top-3 text fragments are selected as the retrieved relevant texts, thus obtaining the knowledge base retrieval module. Compared with the retrievers that rely only on lexical or semantic information, the content retrieved by the two-layer retriever will match the user's question better.
[0020] Constructing the CoT-LLM inference module can be divided into the following steps: (1) Construct a CoT demonstration set for the context learning of the large language model. Specifically, first, several accurate CoT demonstrations are manually written as the benchmark set, and these demonstrations are used as the starting point for constructing the complete set; then, the multi-hop questions collected in S1 are used as the training set; then, an iterative algorithm is used to gradually expand the benchmark set until the construction of the complete CoT set is finally completed. Specifically, in each iteration, the demonstration with the highest cosine similarity to the question in the training set is selected from the benchmark set as the context prompt, and ChatGPT is used to generate a structured CoT inference chain, and the question and the generated inference chain are appended to the benchmark set together until each question in the training set has completed the iteration; finally, the complete CoT set is presented in the format of <Q, CoT inference chain>; (2) For each question raised by the user , select the demonstration with the highest cosine similarity to the question from the above constructed complete CoT set (the role of the demonstration is to help the large language model LLM understand how to generate a suitable CoT inference chain); the large language model LLM executes inference and generates an inference chain according to the complete instruction combined with the question , the demonstration and the retrieved information. An example of the complete instruction is as follows: Complete command example: <Task>Please refer to the "Demonstration" and combine it with the "Reference Document", and use the alternating steps of "Sub-question" and "Sub-answer" to think about how to answer the "Original Question". Based on the thinking, obtain the "Final Answer". Among them, "Sub-question": Raise a sub-question with a unique answer to help solve the original question; "Sub-answer": The answer to the sub-question.< / Task><Demonstration><Original Question>…< / Original Question><Sub-question1>…<Sub-question1><Sub-answer1>…<Sub-answer1><Sub-question2>…<Sub-question2><Sub-answer2>…<Sub-answer2><Final Answer>…< / Final Answer>< / Demonstration><Reference Document>…< / Reference Document><Original Question>Who is the author of the novel "Life and Death Are Wearing Me Out"?< / Original Question>
[0021] S3: The knowledge base retrieval module uses the two-layer retriever to retrieve in the knowledge base for the sub-question in the inference chain to obtain relevant information beneficial to answering the sub-question ; S4: The retrieval evaluation module re-evaluates the retrieved information. If the retrieved information is related to the sub-question If the matching degree is higher than the threshold, it enters the generation module; otherwise, it skips the modification of the sub-question and returns to the knowledge base retrieval stage to retrieve relevant information; Specifically, constructing the retrieval evaluation module can be divided into the following steps: (1) Select bge-raranker-large as the basic model of the retrieval evaluation module. This model has good text matching and evaluation capabilities; (2) Set the matching degree threshold threshold: used to determine whether the retrieved information meets the requirements, ensuring that only high-quality matching results are selected. This threshold can be optimized and adjusted through experiments and verification to meet the needs of specific application scenarios; (3) Preprocessing of the input information: Standardize the retrieved information, including preprocessing steps such as removing redundant spaces and punctuation mark processing, to ensure the consistency of the input information format; (4) Calculation of the matching degree score: Input the preprocessed retrieved information into the bge-reranker-large model to calculate the matching degree score of each piece of information; (5) Screening of the retrieved information: Screen the retrieved information according to the matching degree score. Only the retrieved information with a score higher than the threshold will be selected as the reference document for modifying the CoT sub-chain. If the matching degree scores of all the retrieved information are lower than the threshold, the modification of the current sub-chain will be skipped.
[0022] S5: The generation module generates candidate answers based on the retrieved relevant information and the sub-question ; ; Specifically, constructing the generation module can be divided into the following steps: (1) Construct the training dataset. In the training data, each data point contains a question, a set of reference documents, and an answer. Among them, the answer contains two parts: one is the cited document (marked with the <citation>< / citation> tag), and the other is the question answer (marked with the <answer>< / answer> tag), and there needs to be a certain reasoning process between these two parts (that is: the explanation for obtaining the answer based on the cited document); the reference documents are divided into two categories, namely "relevant documents" (documents containing the question answer) and "distracting documents" (documents not containing the question answer); in the entire dataset, the data contains both "relevant documents" and "distracting documents", while the data only contains "distracting documents"; (2) The large language model LLM is trained on the training dataset using the method of supervised fine-tuning. The model is trained to answer questions in the presence of interfering documents, enabling it to ignore retrieval documents that are not helpful for answering the given question, which helps improve the robustness of the model to inaccurate retrieval results during generation, and finally a generation model that can accurately answer relevant questions based on the retrieved information is obtained.
[0023] S6: The verification module selects a more appropriate answer from the original answer and the candidate answer as an improvement to the CoT reasoning chain. If a sub-chain in the reasoning chain is modified, then enter the CoT-LLM reasoning module to adjust the subsequent sub-chains accordingly based on this modification to obtain a new reasoning chain, and then process the next sub-question in the current reasoning chain ; Specifically, constructing the verification module can be divided into the following steps: Build a validator through prompt engineering. During the reasoning process, take the original sub-answer generated by the CoT-LLM module and the candidate sub-answer generated by the generation module as inputs, and then, through prompt instructions, guide the validator to select one of the two answers as the preferred answer. If neither answer is selected, it is determined that the correct answer cannot be obtained. Specific examples of prompt instructions are shown as follows: Example of prompt word command: <Task>Please select a better answer from the original answer and the candidate answer in combination with the reference document to answer the question. When selecting an answer, consider the logical consistency, information integrity, and clarity of language expression of the answer.< / Task><Reference document>…< / Reference document><Question>Who is the author of the full-length novel "Life and Death Are Wearing Me Out"?< / Question><Original answer>Zhang San< / Original answer><Candidate answer>M莫言< / Candidate answer>
[0024] S7: Loop and repeat steps S2 - S6 until the CoT reasoning chain is completed. Then, determine whether the final answer can be obtained through the <final answer>< / final answer> tag. If this tag exists, output the answer in the tag; otherwise, it means the question cannot be answered.
Claims
1. A method for reasoning and generating knowledge-intensive problems based on LLM, characterized in that: Including the following steps: S1: For user questions to be answered , processed by the knowledge assessment module to determine the problem Can the problem be solved using the internal knowledge of the large language model? If so, the large language model will directly generate the answer. Otherwise, the problem will be solved by Incoming knowledge base retrieval module and CoT-LLM reasoning module; S2: Knowledge base retrieval module targets questions Retrieve relevant factual information, CoT-LLM reasoning module combines questions and retrieved information to generate a structured dynamic reasoning chain ; S3: The knowledge base retrieval module uses a two-layer retriever to target sub-questions in the reasoning chain. Search the knowledge base to obtain information that is helpful in answering sub-questions relevant information; S4: The retrieval evaluation module re-evaluates the retrieved information. If the retrieved information is consistent with the sub-question If the matching degree is higher than the threshold, it will enter the generation module, otherwise it will skip the sub-question Modification, return to the knowledge base search stage, search relevant information; S5: Generate module based on the retrieved relevant information and sub-questions , generate candidate answers ; S6: Verification module from the original answer and candidate answers Select a more appropriate answer as an improvement to the CoT reasoning chain. If a subchain in the reasoning chain is modified, the CoT-LLM reasoning module will be entered to adjust the subsequent subchains according to this modification to obtain a new reasoning chain, and then process the next subproblem in the current reasoning chain. ; S7: Repeat steps S2 - S6 in a loop until the CoT inference chain is completed. Then, determine whether the final answer can be obtained through the <final answer>< / final answer> tag. If this tag exists, output the answer in the tag; otherwise, it means the question cannot be answered.
2. The method for reasoning and generating knowledge-intensive problems based on LLM according to claim 1, characterized in that: The specific method for constructing the knowledge evaluation module of S1 is as follows: (1) Collect question-answer pair data D that meet the characteristics of multi-hop questions, where D contains the question and its corresponding correct answer Multiple question-answer pairs; (2) Constructing a question-answer pair dataset for training the knowledge evaluation model Specifically, first extract the questions in D The input is given to the large language model LLM, which can generate answers for each question through few sample prompts and context learning. , the answer generated at this time is completely dependent on the internal knowledge of the model; then, according to With the correct answer The comparison results will be Divided into two groups, if and The same, then these questions belong to , that is, problems that the model can solve by itself, otherwise it belongs to , that is, problems that the model cannot solve by itself; finally, the final training data set is formed , among which, for The answers are: Yes, The answers are: I don’t know; (3) Using the standard conditional language modeling objective on the dataset The large language model LLM is trained to obtain a knowledge evaluation model that is used to determine whether a problem can be solved by the internal knowledge of the model.
3. The method for reasoning and generating knowledge-intensive problems based on LLM according to claim 1, characterized in that: The specific method for constructing the knowledge base retrieval module of S2 is as follows: (1) Use bge-large-zh as the dense retriever to capture deeper semantic information of text paragraphs for retrieving relevant texts. Specifically, represent texts using dense vectors, and calculate the similarity scores between vectors using cosine similarity. The calculation formula is as follows: ; in is the vectorized representation of the query statement. is the vectorized representation of the document; (2) Use BM25 as the sparse retriever to capture lexical information in text paragraphs. Specifically, retrieve relevant texts by calculating the similarity scores between documents and query conditions. The calculation formula is as follows: ; in, Indicates the problem, Represents a document, Represents the i-th word in the query statement, is the number of words in the query, is the inverse document frequency, is the number of occurrences of the i-th word in the document, and To adjust the parameters, is the length of the document, is the average length of documents in the document collection; (3) To consider both lexical and semantic information simultaneously, use a hybrid method to combine the sparse retriever and the dense retriever, that is, the implementation of a two-layer retriever. The calculation formula for the combined similarity score is as follows: ; in, and It is to balance the weights of the two retrievers and adjust them according to actual needs and experimental results; Based on the above combined similarity scores, select the top-3 text fragments as the retrieved relevant texts, thereby obtaining the knowledge base retrieval module.
4. The method for reasoning and generating knowledge-intensive problems based on LLM according to claim 1, characterized in that: The specific method for constructing the CoT-LLM inference module of S2 is as follows: (1) Construct a CoT demonstration set for the in-context learning of the large language model: Specifically, first manually write several accurate CoT demonstrations as the benchmark set, and use these demonstrations as the starting point for constructing the complete set; then, use the multi-hop questions collected in S1 as the training set; Then, use an iterative algorithm to gradually expand the benchmark set until the construction of the complete CoT set is finally completed. Specifically, in each iteration, select the demonstration with the highest cosine similarity to the question in the training set from the benchmark set as the context prompt, and use ChatGPT to generate a structured CoT inference chain. Append the question and the generated inference chain to the benchmark set until each question in the training set has completed the iteration; finally, the complete CoT set is presented in the format of <Q, CoT inference chain>; (2) For each question raised by the user , filter out the relevant issues from the complete set of CoTs that have been built The demo with the highest cosine similarity; Large Language Model LLM according to the problem , complete instructions for combining presentation and retrieval information, performing reasoning and generating reasoning chains.
5. The method for reasoning and generating knowledge-intensive problems based on LLM according to claim 1, characterized in that: The specific method for constructing the retrieval evaluation module of S4 is as follows: (1) Select bge-raranker-large as the base model of the retrieval evaluation module. This model has good text matching and evaluation capabilities; (2) Set the matching threshold threshold: used to determine whether the retrieved information meets the requirements, ensuring that only high-quality matching results are selected. This threshold is optimized and adjusted through experiments and validations to meet the needs of specific application scenarios; (3) Preprocessing of the input information: Standardize the retrieved information, including removing redundant spaces and punctuation handling. These preprocessing steps are used to ensure the consistency of the input information format; (4) Calculation of the matching score: Input the preprocessed retrieved information into the bge-reranker-large model to calculate the matching score for each piece of information; (5) Filtering of search information: The search information is filtered according to the matching score. Only the search information with a score higher than the threshold will be selected as the reference document for modifying the CoT subchain. If the matching scores of the search information are all lower than the threshold, the modification of the current subchain will be skipped.
6. The method for reasoning and generating knowledge-intensive problems based on LLM according to claim 1, characterized in that: The specific method of constructing the generation module of S5 is as follows: (1) Constructing a training data set: In the training data, each data point contains a question, a set of reference documents, and an answer. The answer consists of two parts: one is the reference document, and the other is the answer to the question. The two parts need to include a reasoning process, that is, the explanation of the answer based on the reference document. Reference documents are divided into two categories, namely "relevant documents" and "interference documents". "Relevant documents" are documents that contain the answer to the question, and "interference documents" are documents that do not contain the answer to the question. In the entire data set, The data contains both "relevant documents" and "noise documents", while The data contains only "noise documents"; (2) The large language model (LLM) is trained using the supervised fine-tuning method on the training dataset: the model is trained to answer questions in the presence of interference documents, enabling it to ignore retrieved documents that are not helpful in answering the given question. This helps to improve the model's robustness to inaccurate retrieval results during generation, and ultimately obtains a generative model that can accurately answer relevant questions based on the retrieved information.
7. The method for reasoning and generating knowledge-intensive problems based on LLM according to claim 1, characterized in that: The specific method of constructing the verification module of S6 is as follows: The verifier is constructed through the prompt word technology; during the reasoning process, the original sub-answer generated by the CoT-LLM module and the candidate sub-answer generated by the generation module are taken as input, and then the prompt word instruction is used to guide the verifier to choose one of the two answers as the preferred answer; if neither answer is selected, it is determined that the correct answer cannot be obtained.
Citation Information
Patent Citations
Knowledge question and answer method, device and equipment and storage medium
CN116561276A
METHODS AND APPARATUS FOR COMBINING CODE LARGE LANGUAGE MODELS (LLMs) WITH COMPILERS
US20240143296A1
Cited By
Generative question answering method and system based on knowledge graph and document retrieval integration
CN119046448A
Automobile intelligent question-answering system and method based on large model and retrieval enhancement
CN119202206A
Large-model multi-agent collaborative machine manufacturing knowledge question-answering method
CN119227817A
Retrieval enhancement method and system based on structure entropy hierarchical knowledge tree
CN119381009A
A Retrieval Enhancement Method and System Based on Structural Entropy Hierarchical Knowledge Tree
CN119381009B
