Question and answer implementation method and device based on artificial intelligence model

By combining the trained retrieval and ranking models with a large language model, we can autonomously plan question decomposition and answer generation, solving the problems of incomplete information recall and excessive noise, and improving the efficiency and accuracy of question-answering tasks.

CN120654805APending Publication Date: 2025-09-16BEIJING UNIV OF POSTS & TELECOMM
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510515545.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

Existing technologies suffer from incomplete information recall and excessive noise in the process of cross-paragraph or cross-document information retrieval and integration. In addition, large-parameter LLMs are insufficient in inference speed, resulting in low efficiency in question-answering tasks.

Method used

Through the trained retrieval model and ranking model, combined with the large language model, the binding chain is used to autonomously plan question decomposition and answer generation, perform multiple extended retrieval and splicing, prune non-compliant paths, and improve information recall and integration efficiency.

Benefits of technology

It improves the comprehensiveness and integration efficiency of information retrieval, reduces the number of calls to large language models, and improves the speed and accuracy of question-answering tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120654805A_ABST
    Figure CN120654805A_ABST
Patent Text Reader

Abstract

The invention discloses a question and answer implementation method based on an artificial intelligence model, and the method comprises the steps: inputting a to-be-answered question into a trained retrieval model, obtaining an initial retrieval result through the reasoning of the retrieval model, inputting a first number of documents with the highest relevancy in the initial retrieval result and the to-be-answered question into a trained sorting model, obtaining an initial sorting result through reasoning of the sorting model, splicing the to-be-answered question and a second number of documents with the highest sorting evaluation value in the initial sorting result to obtain each current spliced document, and performing extended retrieval on each current spliced document to obtain each current spliced document; and taking the final expansion retrieval result of each current spliced document and the question to be answered as a context, generating a reasoning path according to a set binding chain by utilizing the trained large language model, and reasoning the context according to the reasoning path until the expansion times of each current spliced document reach a set expansion time threshold value, so as to obtain the final expansion retrieval result of each current spliced document. And obtaining an answer result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular, to a question-answering implementation method based on an artificial intelligence model. Background Art

[0002] Modern society's information needs are increasingly complex and diverse. This is especially true in fields like scientific research, education, and healthcare, which often face the challenge of multi-hop information retrieval, requiring the connection of multiple pieces of information within a knowledge base to arrive at a complete answer. For example, researchers need to obtain evidence to verify hypotheses across paragraphs and documents from multiple papers, students need to understand complex concepts across textbook chapters, and doctors need to integrate patient medical records with medical guidelines to develop treatment plans. These multi-hop question-answering tasks often require high levels of human analytical skills and consume significant effort and time.

[0003] Therefore, the use of machine automation technology to efficiently complete cross-paragraph and even cross-document information retrieval and information integration came into being.

[0004] During the information retrieval process, a pre-trained model with bidirectional attention is used as the encoder to semantically encode all knowledge fragments. The same pre-trained model is then used to semantically encode the input question content. The similarity between the semantic encodings of the question and the knowledge fragments is calculated to characterize their relevance. Because the key procedural information required for question-answering tasks is contained in an external knowledge base, directly using the question for retrieval is difficult to retrieve all relevant information.

[0005] During the information integration process, a pre-designed loop based on Large Language Models (LLMs) is used to repeatedly call the encoder and LLMs to address the issue of relevant information not being recalled. For example, after reading a question, the LLMs leverage their extensive internal parameterized knowledge to break it down. These sub-questions are then used to retrieve relevant information. The LLMs then read the relevant information to obtain the Q&A results for the sub-questions, allowing them to then formulate new sub-questions. By gradually answering all sub-questions, the Q&A results are ultimately obtained.

[0006] Regarding information retrieval capabilities, the above technologies have two main shortcomings: on the one hand, since the key procedural information required to answer multi-hop questions is contained in the external knowledge base, it is difficult to recall all the information related to the question by directly using the question for retrieval; on the other hand, due to the lack of comprehensive consideration of information combination, the retrieval results contain noise information that seems relevant but is actually useless.

[0007] Regarding information integration capabilities, the above technology also has two shortcomings: on the one hand, it is extremely dependent on the internal parameterization knowledge of LLMs during the problem decomposition stage, and performs poorly on LLMs with small parameter counts. In practical applications, if LLMs with large parameter counts want to achieve a faster inference speed, higher computing power is required; on the other hand, since multiple calls to LLMs are required to generate the final question-answering results, the efficiency of the question-answering task is greatly reduced. Summary of the Invention

[0008] The present invention provides a question-answering implementation method based on an artificial intelligence model to improve information retrieval and information integration capabilities.

[0009] The first aspect of the present application provides a question-answering implementation method based on an artificial intelligence model, the method comprising:

[0010] The question to be answered is input into the trained retrieval model for extended retrieval. The initial retrieval results are obtained through the reasoning of the retrieval model. The retrieval results represent the relevance between the question to be answered and each document in the corpus.

[0011] Input the first number of documents with the highest relevance in the initial search results and the question to be answered into the trained ranking model for ranking the search results, and obtain an initial ranking result through reasoning of the ranking model, wherein the ranking result represents a ranking evaluation value of the relevance between the input question and the input document of the ranking model.

[0012] The question to be answered is concatenated with the second number of documents with the highest ranking evaluation values ​​in the initial ranking results to obtain the current concatenated documents.

[0013] Perform extended searches on each current spliced ​​document until the number of expansions for each current spliced ​​document reaches the set expansion threshold.

[0014] The final extended retrieval results of each currently spliced ​​document and the question to be answered are used as context. The trained large language model is used to generate an inference path according to the set binding chain. The context is then inferred according to the inference path to obtain the answer to the question to be answered.

[0015] As a possible implementation, the iterative expansion of each current stitched document until the expansion iterations of each current stitched document reach a set expansion times threshold includes:

[0016] For any current stitched document:

[0017] The current spliced ​​document, the spliced ​​documents used in the previous extended questions of the current spliced ​​document, and the question to be answered are used as the current extended question and input into the retrieval model. Through the reasoning of the retrieval model, the current extended retrieval result is obtained.

[0018] The third most relevant document in this extended search result and the question to be answered are input into the ranking model, and the ranking result is obtained through the reasoning of the ranking model.

[0019] The questions to be answered are concatenated with the fourth number of documents with the highest ranking evaluation values ​​in this ranking result to obtain the concatenated documents for this expansion.

[0020] At least one of the spliced ​​documents expanded this time is used as the current spliced ​​document, and the steps for any current spliced ​​document are executed again until the number of expansions reaches a set expansion threshold, thereby obtaining a final expanded search result for the current spliced ​​document.

[0021] As a possible implementation, the retrieval model is fine-tuned in the following manner:

[0022] For each expansion of the problem for each sample in the training set:

[0023] Based on the standard answer document corresponding to the sample question, construct the positive and negative samples of this expansion of the sample question.

[0024] The answer document used in this expansion of the sample question, the answer documents used in previous expansions, and the sample question are used as the expansion question of the sample question, and are input into the preliminarily trained retrieval model to obtain the expansion retrieval result of the sample question.

[0025] Using the positive and negative samples of this extended sample problem, calculate the loss function value of the extended retrieval result of this sample problem.

[0026] Repeat the steps of constructing positive and negative samples for the current expansion of the sample question based on the marked answer document corresponding to the sample question until the loss function value of the current expansion retrieval results of all sample questions in the training set is obtained;

[0027] The loss function values ​​of each extended retrieval result of all sample questions in the training set are accumulated to obtain the total loss function value.

[0028] Fine-tune the preliminarily trained retrieval model according to the total loss function value to obtain a fine-tuned retrieval model;

[0029] The ranking model is fine-tuned as follows:

[0030] Using the fine-tuned retrieval model, we provide negative samples for fine-tuning the ranking model.

[0031] The positive samples used for fine-tuning the retrieval model and the negative samples used for fine-tuning the ranking model are used to fine-tune the initially trained ranking model to obtain a fine-tuned ranking model.

[0032] As a possible implementation method, constructing positive and negative samples for this expansion of the sample question based on the tagged answer document corresponding to the sample question includes:

[0033] If the cumulative number of expansions during this expansion is equal to the total number of hops included in the sample question, all the marked answer documents are regarded as positive samples.

[0034] If the cumulative number of expansions during this expansion is not greater than the total number of hops included in the sample problem, then

[0035] The sample question, the answer document used in this expansion, and the answer documents used in previous expansions are used as the expansion question for this expansion, and are input into the preliminarily trained retrieval model to obtain the first sample retrieval result.

[0036] In the first sample retrieval results, remove the marked answer document from the ninth number of documents with the highest relevance to obtain the negative sample of this expansion of the sample question.

[0037] The standard answer documents used in this extension are used as positive samples;

[0038] The method of using the fine-tuned retrieval model to provide negative samples for fine-tuning the ranking model includes:

[0039] For each expansion of any sample problem:

[0040] If the cumulative number of expansions during this expansion is not greater than the total number of hops included in the sample problem, then

[0041] The sample question, the answer document used in this expansion, and the answer documents used in previous expansions are used as the expansion question for this time, and are input into the fine-tuned retrieval model to obtain the second sample retrieval result.

[0042] In the second sample retrieval results, remove the marked answer document from the tenth most relevant document to obtain the negative sample of this expansion of the sample question, which is used as a negative sample for fine-tuning the ranking model;

[0043] in,

[0044] Each question has a one-to-one correspondence with its standard answer document, and each standard answer document is arranged in the order of each question in the sample questions.

[0045] The answer document used for this extension is: the answer document corresponding to the same number of hops as the cumulative extension times of this extension.

[0046] As a possible implementation, the method further includes:

[0047] For each currently stitched document:

[0048] A branch path is established with the current spliced ​​document and the previous spliced ​​document used in the previous extension adjacent to the current spliced ​​document as endpoints.

[0049] The previous spliced ​​document is used as the current spliced ​​document, and the steps are returned to the previous spliced ​​document and the previous spliced ​​document used in the previous expansion adjacent to the current spliced ​​document as endpoints until the question to be answered is traversed.

[0050] Using the established branch path as the extension path of the current splicing document;

[0051] For each extended path:

[0052] Calculate the average of the ranking evaluation values ​​of all spliced ​​documents in each branch path in the extended path to obtain the extended path evaluation value of the extended path, wherein the extended path evaluation value is used to characterize the quality of the extended path.

[0053] According to the evaluation value of the extended path, the branch paths in the extended path are pruned to remove the splicing documents that do not meet the expectations.

[0054] As a possible implementation, the pruning includes: at least one of pruning within an extended path and pruning between extended paths.

[0055] in,

[0056] Pruning within the extension path is performed as follows: if the ranking evaluation value of any spliced ​​document within the same extension path is lower than the extension path evaluation value, the extended search with the spliced ​​document as the extension question is stopped.

[0057] The pruning among the extension paths is performed in the following manner: among the extension search results obtained with the same number of extensions, the extension path with the highest extension path evaluation value is retained, and the remaining extension paths are deleted;

[0058] The binding chain includes at least one of an explicit question decomposition task, a mandatory document binding task, and a local answer derivation task.

[0059] Generating an inference path according to the set binding chain includes:

[0060] According to the order of explicit question decomposition task, mandatory document binding task, and local answer derivation task, a combination path consisting of explicit question decomposition reasoning path, mandatory document binding reasoning path, and local answer derivation reasoning path is generated in sequence, and multiple such combination paths are generated in sequence.

[0061] As a possible implementation, the large language model is trained in the following manner:

[0062] For any sample problem in the training set:

[0063] The sample question and its final expanded retrieval result are used as sample context. The preliminarily trained large language model is used to perform the selection subtask for selecting binding chains, the decomposition subtask for explicit question decomposition, the binding subtask for enforcing document binding, and the inference subtask for local answer inference on the sample context.

[0064] According to the loss function value of each subtask, adjust the current large language model,

[0065] Repeat the above steps for any sample problem in the training set until the expected result is achieved.

[0066] As a possible implementation, the method of using the preliminarily trained large language model to perform a selection subtask for selecting a binding chain, a decomposition subtask for explicit question decomposition, a binding subtask for enforcing document binding, and a derivation subtask for a local answer derivation task on the sample context includes:

[0067] Perform the merging of decomposition subtasks, binding subtasks, and inference subtasks in the same reasoning process;

[0068] The process of adjusting the current large language model according to the loss function values ​​of each subtask includes:

[0069] Calculate the first loss function value of the merged task, and adjust the current large language model according to the first loss function value of the merged task;

[0070] The final extended search results for the sample question are obtained as follows:

[0071] For any sample problem in the training set:

[0072] Input the sample question into the fine-tuned retrieval model to obtain the sample initial retrieval results.

[0073] Input the fifth most relevant document in the sample initial search results of the sample question and the sample question into the fine-tuned ranking model to obtain the sample initial ranking result.

[0074] Concatenate the sample question with the sixth number of documents with the highest ranking evaluation values ​​in the sample initial ranking results to obtain current concatenated documents;

[0075] For any current stitched document:

[0076] The current spliced ​​document, the spliced ​​documents used in the previous extended questions of the current spliced ​​document, and the sample question are input into the fine-tuned retrieval model as the current extended question to obtain the current extended retrieval result.

[0077] The seventh most relevant document in this extended search result and the sample question are input into the fine-tuned ranking model to obtain the ranking result.

[0078] The sample question is concatenated with the eighth number of documents with the highest ranking evaluation value in this ranking result to obtain the concatenated documents of this expansion.

[0079] At least one of the spliced ​​documents expanded this time is used as the current spliced ​​document, and the steps for any current spliced ​​document are executed again until the number of expansions reaches the set sample expansion number threshold, thereby obtaining the final expanded search result for the current spliced ​​document.

[0080] The final extended retrieval results of each currently spliced ​​document are used as the final extended retrieval results of the sample question.

[0081] As a possible implementation, performing the merging task of decomposing subtasks, binding subtasks, and derivation subtasks in the same reasoning process includes:

[0082] Insert prediction hint texts for separating subtasks in the merged task into the sample context.

[0083] The sample context with the predicted prompt text of each subtask is input into the current large language model to generate the target prompt text and target task label of each subtask.

[0084] Calculate the loss function of the predicted prompt text and the loss function of the target task label,

[0085] Based on the calculated loss function of the target task label and the expectation of the next predicted prompt text, fine-tune the large language model,

[0086] Input the sample context with the target prompt text of each subtask and the target task label into the fine-tuned large language model;

[0087] The step of adjusting the current large language model according to the loss function value of the merged task includes:

[0088] Calculate the second loss function value of the merged task in the sample context with the target prompt text of each subtask and the target task label inserted, and add the second loss function with the calculated loss function of the prompt text to obtain the total loss function of the sample problem.

[0089] Adjust the current large language model based on the total loss function of the sample problem.

[0090] The second aspect of the present application provides a question-answering device based on an artificial intelligence model, comprising:

[0091] The retrieval module is used to input the question to be answered into the trained retrieval model for extended retrieval, and obtain the initial retrieval results through the reasoning of the retrieval model, where the retrieval results represent the relevance between the question to be answered and each document in the corpus.

[0092] A ranking module is configured to input the first number of documents with the highest relevance in the initial search results and the question to be answered into a trained ranking model for ranking the search results, and obtain an initial ranking result through reasoning of the ranking model, wherein the ranking result represents a ranking evaluation value of the relevance between the input question and the input document of the ranking model.

[0093] The expansion module is used to respectively concatenate the question to be answered with the second number of documents with the highest ranking evaluation values ​​in the initial ranking result to obtain each current concatenated document, and return each current concatenated document to the retrieval module, so that the retrieval module performs an extended search on each current concatenated document until the number of expansions for each current concatenated document reaches a set expansion number threshold.

[0094] The text processing module is used to use the final extended retrieval results of each currently spliced ​​document and the question to be answered as context, and use the trained large language model to generate an inference path according to the set binding chain, and reason on the context according to the inference path to obtain the answer result of the question to be answered. The question-answering implementation method based on the artificial intelligence model improved in this application solves the problem of difficulty in recalling relevant articles in the retrieval process by splicing the retrieval results with the question to be answered, thereby providing key process information for the next retrieval. By using the large language model, based on reading the retrieval results, the large language model with a small parameter amount can autonomously plan the three tasks of question decomposition, article binding, and answer generation through the binding chain to complete the answering of the question. BRIEF DESCRIPTION OF THE DRAWINGS

[0095] Figure 1 This is a flowchart of a question-answering implementation method based on an artificial intelligence model in an embodiment of the present application.

[0096] Figure 2Schematic diagram of the model structure of the artificial intelligence model used for question-answering tasks in this embodiment.

[0097] Figure 3 A schematic diagram of a process for fine-tuning the retrieval model in this embodiment.

[0098] Figure 4 The figure is a flowchart for fine-tuning the sorting model in this embodiment.

[0099] Figure 5 The figure is a flow chart of training the large language model of this embodiment.

[0100] Figure 6 This is an example of question answering based on an artificial intelligence model.

[0101] Figure 7 A schematic diagram of a question-answering implementation device based on an artificial intelligence model in an embodiment of the present application.

[0102] Figure 8 Another schematic diagram of the question-answering implementation device based on the artificial intelligence model in an embodiment of the present application. DETAILED DESCRIPTION

[0103] In order to make the purpose, technical means and advantages of this application more clear, this application is further described in detail below with reference to the accompanying drawings.

[0104] See also Figure 1 As shown, Figure 1 This is a flow chart of a method for implementing question-answering based on an artificial intelligence model according to an embodiment of the present application. The method includes:

[0105] Step 101: Input the question to be answered into the trained retrieval model for extended retrieval, and obtain initial retrieval results through inference of the retrieval model, wherein the retrieval results represent the relevance between the question to be answered and each document in the corpus;

[0106] Step 102: Input the first number of documents with the highest relevance in the initial search results and the question to be answered into a trained ranking model for ranking the search results. An initial ranking result is obtained through reasoning by the ranking model. The ranking result represents a ranking evaluation value of the relevance between the input question and the input document of the ranking model.

[0107] Step 103: Concatenate the question to be answered with the second number of documents with the highest ranking evaluation values ​​in the initial ranking results to obtain current concatenated documents;

[0108] Step 104: perform extended search on each currently stitched document until the number of extensions reaches a set threshold.

[0109] As an example,

[0110] For any current stitched document:

[0111] The current spliced ​​document, the spliced ​​documents used in the previous extended questions of the current spliced ​​document, and the question to be answered are used as the current extended question and input into the retrieval model. Through the reasoning of the retrieval model, the current extended retrieval result is obtained.

[0112] The third most relevant document in this extended search result and the question to be answered are input into the ranking model, and the ranking result is obtained through the reasoning of the ranking model.

[0113] The questions to be answered are concatenated with the fourth number of documents with the highest ranking evaluation values ​​in this ranking result to obtain the concatenated documents for this expansion.

[0114] Taking at least one of the currently expanded stitched documents as the current stitched document, returning to execute the steps for any current stitched document until the number of expansions reaches a set threshold, and obtaining a final expanded search result for the current stitched document;

[0115] As an example,

[0116] For each currently stitched document:

[0117] A branch path is established with the current spliced ​​document and the previous spliced ​​document used in the previous extension adjacent to the current spliced ​​document as endpoints.

[0118] The previous spliced ​​document is used as the current spliced ​​document, and the steps are returned to the previous spliced ​​document and the previous spliced ​​document used in the previous expansion adjacent to the current spliced ​​document as endpoints until the question to be answered is traversed.

[0119] Using the established branch path as the extension path of the current splicing document;

[0120] For each extended path:

[0121] Calculate the average of the ranking evaluation values ​​of all spliced ​​documents in each branch path in the extended path to obtain the extended path evaluation value of the extended path, wherein the extended path evaluation value is used to characterize the quality of the extended path.

[0122] According to the evaluation value of the extended path, the branch paths in the extended path are pruned to remove the splicing documents that do not meet the expectations.

[0123] The pruning includes at least one of: pruning within an extended path and pruning between extended paths.

[0124] in,

[0125] Pruning within the extension path is performed as follows: if the ranking evaluation value of any spliced ​​document within the same extension path is lower than the extension path evaluation value, the extended search with the spliced ​​document as the extension question is stopped.

[0126] The pruning among the extension paths is performed in the following manner: among the extension search results obtained with the same number of extensions, the extension path with the highest extension path evaluation value is retained, and the remaining extension paths are deleted;

[0127] In step 105, the final extended retrieval results of each currently concatenated document and the question to be answered are used as context, and the trained large language model is used to generate an inference path according to the set binding chain. Inference is performed according to the inference path to obtain the answer result of the question to be answered.

[0128] The question-answering implementation method based on the artificial intelligence model provided in the embodiment of the present application splices the retrieval results with the questions to be answered during the retrieval process, thereby providing key process information for the next extended retrieval. By pruning the extended path, the problems of difficulty in recalling relevant documents and excessive noise in the retrieval process are solved. Through the binding chain, the large language model can autonomously plan the reasoning path through the binding chain for reasoning, reducing the overhead generated by multiple calls to the large language model during the information integration process.

[0129] In order to facilitate understanding of this application, a specific example is provided below for explanation.

[0130] See also Figure 2 As shown, Figure 2 This is a schematic diagram of the model structure of the artificial intelligence model used for question-answering tasks in this embodiment. The artificial intelligence model includes: a retrieval model for expanded retrieval, a ranking model for sorting retrieval results, and a large language model that understands input question and answer information and outputs question and answer results.

[0131] The retrieval model may be, for example, the bge-m3 model, the ranking model may be, for example, bge-reranker-v2-m3, and the large language model may be, for example, GPT4 or Deepseek-V3. This embodiment does not impose any restrictions on this.

[0132] See also Figure 3 As shown, Figure 3 This is a flow chart for fine-tuning the retrieval model in this embodiment. For each expansion of each sample question in the training set:

[0133] Step 301: construct positive samples and negative samples of the current expansion of the sample problem for fine-tuning the retrieval model.

[0134] Given that any sample question Q includes K-hop questions, and each hop question corresponds to a standard answer document, then the K-hop question corresponds to K standard answer documents, and the K standard answer documents are arranged in the order of the hop questions in the sample question, which can be recorded as Among them, k∈K, K is a natural number greater than 1, so the answer document of the sample question Q is

[0135] For each expansion of the sample problem Q:

[0136] If the cumulative number of expansions during this expansion is greater than the total number of hops K included in the sample question, all the marked answer documents will be regarded as positive samples.

[0137] If the cumulative number of expansions for this expansion is greater than 1 and less than or equal to K, then

[0138] Step 3011: Input the sample question Q, the answer documents used in previous expansions, and the answer documents used in this expansion as the current expansion question into the current retrieval model to obtain the current sample retrieval result, which can be recorded as the first sample retrieval result.

[0139] Without loss of generality, the expansion problem of the t-th expansion can be expressed as:

[0140]

[0141] Among them, 1≤t≤T, T≤K; This is the standard document used in all previous expansions. This is the standard document used for this extension.

[0142] For example,

[0143] When the original question Q of the sample question is used as the retrieval information, since it has not been expanded, it can be regarded as the 0th expansion;

[0144] During the first expansion, the expansion problem is Among them, there is no standard answer document used in previous expansions. The standard answer document used for this extension;

[0145] During the second expansion, the expansion problem is in, This is the standard document used in all previous expansions. The standard answer document used for this extension;

[0146]

[0147] During the tth expansion, the expansion problem is in, This is the standard document used in all previous expansions. This is the answer document used for this extension, which corresponds to the t-th hop question of the sample question. That is to say, the answer document used for this extension is the answer document corresponding to the same number of hops as the cumulative number of extensions of this extension.

[0148] Step 3012: In the sample expansion retrieval results, the marked answer documents are removed from the ninth number of documents with the highest relevance to obtain the negative sample of the sample question Q for this expansion.

[0149] For example, the marked answer documents are removed from the 20 most relevant documents in the sample expansion retrieval results, and the remaining documents are negative samples.

[0150] Step 3013: Use the standard answer document used in this expansion as a positive sample.

[0151] When 1≤t≤K-1, is a positive sample.

[0152] Step 302: Calculate the loss function value of the current expanded retrieval result of the sample question using the positive and negative samples of the current expanded sample question.

[0153] As an example, the positive and negative samples of this extended sample problem are respectively input into the preliminarily trained retrieval model. Based on the current retrieval results, the loss function value of this extended retrieval result of the sample problem is calculated. The loss function expression is:

[0154]

[0155] in, is the extended problem q used in the t-th expansion t is the loss function for training the retrieval model using training samples, The extended problem q used for the t-th expansion t The positive sample of the search results, The extended problem q used for the t-th expansion t The retrieval result negative sample, d is the extended question q t The current search results, τ is a hyperparameter, Represents the extended problem q t The score of the positive sample of the retrieval result obtained when inputting, score(q t ,d) represents the extended problem q t The score of the current search result d obtained during input.

[0156] Step 303: Return to step 301 to perform this expansion on the next sample question until the loss function values ​​of the expanded retrieval results of all sample questions in the training set are obtained. The loss function values ​​of the expanded retrieval results of all sample questions in the training set are accumulated and expressed mathematically as follows:

[0157]

[0158] in, The extended problem q used for the t-th expansion of the i-th sample problem t The loss function value of the extended retrieval result is , and I is the total number of sample questions.

[0159] Step 304: Return to step 301 to perform the next expansion on each sample question. Accumulate the loss function values ​​of each expansion retrieval result of all sample questions in the training set to obtain the total loss function value. The mathematical formula of the total loss function is:

[0160]

[0161] Among them, L is the total loss function value, T is the total number of expansion times,

[0162] Step 305 : Fine-tune the preliminarily trained retrieval model according to the total loss function value to obtain a fine-tuned retrieval model.

[0163] See also Figure 4 As shown, Figure 4 The figure is a flowchart for fine-tuning the sorting model in this embodiment.

[0164] Step 401: Using the fine-tuned retrieval model, provide negative samples for fine-tuning the ranking model.

[0165] After fine-tuning the retrieval model, it is used to provide more valuable negative samples of retrieval results for the ranking model.

[0166] As an example,

[0167] For each expansion of any sample problem:

[0168] If the cumulative number of expansions during this expansion is not greater than the total number of hops included in the sample problem, then

[0169] The sample question, the standard answer document used in this expansion, and the standard answer documents used in previous expansions are used as the expansion question for this expansion, and are input into the fine-tuned retrieval model to obtain the second sample retrieval result.

[0170] In the second sample retrieval results, remove the marked answer document from the tenth most relevant document to obtain the negative sample of this expansion of the sample question, which is used as a negative sample for fine-tuning the ranking model;

[0171] Step 402 : Fine-tune the current ranking model using the positive samples used for fine-tuning the retrieval model and the negative samples used for fine-tuning the ranking model to obtain a fine-tuned ranking model.

[0172] As an example, for each expansion of any sample problem: the positive and negative samples obtained from this expansion of the sample problem are input into the preliminarily trained ranking model, the ranking model is trained based on the comparison of positive and negative samples, and the ranking model is fine-tuned using the cross-entropy loss function value. The loss function can be expressed as:

[0173]

[0174] in, is the loss function for the ranking results of the retrieval results obtained in this expansion of the sample problem, d represents the positive or negative sample input to the sorting model, y d The value range is 0 or 1, indicating and The sorting model is q t The evaluation value for evaluating the correlation with d.

[0175] Step 403: Select the next sample question and return to step 401 until the expansion of all sample questions in the training set is completed.

[0176] Step 404: accumulate the number of extensions for this time, and return to step 401 for execution until the accumulated number of extensions for this time reaches the sample extension number threshold.

[0177] See also Figure 5 As shown, Figure 5 This is a flow chart of training the large language model of this embodiment. For any sample question:

[0178] Step 501: Input the sample question into the fine-tuned retrieval model to obtain the sample initial retrieval result.

[0179] As an example,

[0180] Input the sample question into the fine-tuned retrieval model and obtain the sample initial retrieval result from the output of the model.

[0181] The fine-tuned retrieval model performs semantic encoding on the sample question to obtain the query value of the sample question, and calculates the query value q of the sample question and the query value q of each document d in the external corpus D.s The relevance between the semantic codes is calculated to obtain the retrieval results for each query value, and the retrieval results include: the document corresponding to the query value and the relevance used to characterize the query value and its corresponding document.

[0182] For example, the correlation calculated by cosine similarity is used as the search evaluation value. It can be expressed mathematically as:

[0183]

[0184] Among them, retrieval_score represents the retrieval evaluation value, embedding q is the semantic encoding of the query value q, For document d s The semantic encoding of , cos_sim() represents the cosine similarity function.

[0185] Step 502: Input the query value of the sample question and the fifth highest number of documents among its retrieval evaluation values ​​into the fine-tuned ranking model to obtain the ranking evaluation value of the sample question. Based on the ranking evaluation value, select the sixth highest number of documents as the initial ranking result.

[0186] In this step, the bidirectional attention mechanism of the fine-tuned ranking model is used to enable the query value q to interact directly with its corresponding document, thereby obtaining a more accurate ranking evaluation value. It can be expressed mathematically as:

[0187] rerank_score=Rerank_model(q,d s )

[0188] Among them, rerank_score represents the ranking evaluation value, Rerank_model(q,d s ) represents the ranking model's response to its input query value q and its document d s The reordering results.

[0189] Step 503 : In order to expand the sample question, the sample question is concatenated with the documents in the initial ranking result to enrich the query context and obtain concatenated documents.

[0190] As an example, document concatenation may be performed by string concatenation.

[0191] Step 504 : Perform an extended search on the concatenated documents of the sample question obtained in step 503 to obtain a final extended search result of the sample question.

[0192] In this step, for any current stitching document:

[0193] The current spliced ​​document, the spliced ​​documents used in the previous extended questions of the current spliced ​​document, and the sample question are input into the fine-tuned retrieval model as the current extended question to obtain the current extended retrieval result.

[0194] The seventh most relevant document in this extended search result and the sample question are input into the fine-tuned ranking model to obtain the ranking result.

[0195] The sample question is concatenated with the eighth number of documents with the highest ranking evaluation value in this ranking result to obtain the concatenated documents of this expansion.

[0196] At least one of the spliced ​​documents expanded this time is used as the current spliced ​​document, and the steps for any current spliced ​​document are executed again until the number of expansions reaches the set sample expansion number threshold, thereby obtaining the final expanded search result for the current spliced ​​document.

[0197] The final extended retrieval results of each currently spliced ​​document are used as the final extended retrieval results of the sample question.

[0198] As an example,

[0199] Step 5040: Use the stitched documents obtained in step 503 as current stitched documents and select a current stitched document.

[0200] Step 5041: The current spliced ​​document, the spliced ​​documents used in the previous extended questions of the current spliced ​​document, and the sample question are input into the fine-tuned retrieval model as the current extended question to obtain the current extended retrieval result.

[0201] Step 5042: Input the seventh most relevant document in the expanded search results and the sample question into the fine-tuned ranking model to obtain the ranking result.

[0202] Step 5043: The sample question is concatenated with the eighth number of documents with the highest ranking evaluation values ​​in the current ranking result to obtain the concatenated documents that are currently extended from the current concatenated document.

[0203] As an example, for the tth expansion,

[0204] The fine-tuned retrieval model performs semantic encoding on the input t-1th expanded concatenated document to obtain the query value q of the tth expansion. t , calculate each query value q t The relevance of the documents in the corpus is obtained, and the t-th expanded search result is obtained. The seventh highest number of documents in the search result is input into the fine-tuned ranking model for re-ranking, and the document ranked c is selected. mThe document is used as the spliced ​​document for the t+1th expansion;

[0205] For the spliced ​​document used for the t+1th expansion, it can be expressed as:

[0206]

[0207] In the above formula, c m ∈[1,m], m is the eighth number, Indicates the concatenated document used during the t-th expansion.

[0208] For example, assuming that the eighth quantity is 3, and there are 4 spliced ​​documents in the t-1th expansion, then in the tth expansion, each spliced ​​document in the t-1th expansion can obtain 3 spliced ​​documents, for a total of 12 spliced ​​documents.

[0209] Step 5044, select the next spliced ​​document in each current spliced ​​document, return to step 5041, and perform this extended search on the next spliced ​​document in the document obtained in step 503, until all the spliced ​​documents obtained in step 503 have been subjected to this extended search to obtain the spliced ​​documents of this expansion.

[0210] In step 5045, if the cumulative number of expansions of this expansion does not reach the sample expansion number threshold, each spliced ​​document of this expansion is used as each current spliced ​​document, and a current spliced ​​document is selected, and the process returns to step 5041 to perform the next expansion, until all the spliced ​​documents of this expansion have been expanded and searched.

[0211] Step 5046: Repeat steps 5040 to 5045 until the number of expansions reaches the set sample expansion threshold, and the final expansion search result is obtained.

[0212] Step 5047: The final extended retrieval result of each concatenated document in the initial sorting result is used as the final extended retrieval result of the sample question.

[0213] In each expansion retrieval process, in order to reduce noise and improve computational efficiency, multiple expansion paths are dynamically explored during training or inference, and the value is evaluated according to the expansion path. Dynamic pruning is performed on the extension path to remove the extension results that do not meet the expectations in each extension and retain the best extension retrieval results.

[0214] As an example, at each expansion, for any concatenated document, m different expansion paths of the concatenated document are explored to construct an expansion tree, wherein each expansion path represents a tree node.

[0215] For example, for this current stitching document:

[0216] A branch path is established with the current spliced ​​document and the previous spliced ​​document used in the previous extension adjacent to the current spliced ​​document as endpoints.

[0217] The previous spliced ​​document is used as the current spliced ​​document, and the steps with the current spliced ​​document and the previous spliced ​​document used in the previous extension adjacent to the current spliced ​​document as endpoints are returned until the sample problem is traversed.

[0218] The established branch path is used as the extension path of the current splicing document.

[0219] The extended path evaluation value is used to characterize the quality of the extended path. It can be calculated by taking the average of the ranking evaluation values ​​of all search results in the extended path. The mathematical formula is:

[0220]

[0221] in, Expressed as an expanded problem q t With its spliced ​​document The sorted evaluation value of .

[0222] In this embodiment, pruning is performed in the following manner:

[0223] (1) Pruning within the extension path: traverse all the spliced ​​documents included in the same extension path. If the ranking evaluation value of the current document is lower than the evaluation value of the extension path, it means that the document has a low relevance to the question and historical documents. Splicing it will only introduce more noise, so further expansion of the current document is stopped.

[0224] (2) Pruning between extension paths: traverse all the spliced ​​documents included in the same extension, and only retain the p spliced ​​documents with the best ranking evaluation value to filter out relevant but useless noise spliced ​​documents, and then prune the spliced ​​document set d consisting of the p spliced ​​documents included in the extension path with the highest extension path evaluation value. p As the best extended retrieval result for the sample question.

[0225] In step 505, the final expansion result of the sample question and the sample question are input into the preliminarily trained large language model as a sample context. The preliminarily trained large language model is used to perform the selection subtask for selecting a binding chain, the decomposition subtask for explicit question decomposition, the binding subtask for enforcing document binding, and the derivation subtask for the local answer derivation task on the sample context. The current large language model is adjusted according to the loss function value of each subtask.

[0226] As an example, the best extended retrieval result is taken as the final extended result. According to the sample binding chain included in the set CoG, LLMs uses all the best extended retrieval results as sample context to generate a sample question reasoning path.

[0227] The binding chain includes at least one of: explicit question decomposition, mandatory document binding, and local answer derivation.

[0228] At step j in the sample problem reasoning path, based on the generated historical reasoning path <j , LLMs perform the selection subtask t j At least one of the optional subtasks includes:

[0229] (1) Explicit problem decomposition: LLMs explicitly propose subproblems q j ;

[0230] (2) Mandatory document binding: LLMs are bound by binding information g j The subproblem q j Bind to the corresponding document;

[0231] (3) Local answer derivation: LLMs are sub-problems q j Generate answer a j .

[0232] During the training process, in order to enhance the robustness to noise, the LLMs are trained using the documents obtained in step 504 that are strongly related to the sample question but may contain noise. By shuffling these documents, the impact of the document order on the model performance is reduced.

[0233] The loss function for selecting the subtask and the loss function for executing the three subtasks are defined as follows:

[0234] L t =-log P(t j |d p ,Q,path <j )

[0235] L q =-log P(q j |d p ,Q,path <j )

[0236] L g =-log P(g j |d p ,Q,path <j )

[0237] L a =-log P(a j |dp ,Q,path <j )

[0238] Among them, L t is the loss function for selecting subtasks, L q is the loss function for explicit problem decomposition subtasks, L g is the loss function for enforcing document binding subtask, L a Derives the loss function of the subtask for the local answer, P() represents the probability function, path <j is the historical reasoning path before step j in the current sample problem reasoning path, d p is the sample context, and Q is the sample question.

[0239] Since different subtasks share the same sample context d p Repeatedly reading these contexts will result in a large amount of unnecessary label (token) consumption during training. To reduce resource overhead, we merge instructions and jointly optimize the execution process of the three subtasks so that LLMs can execute all subtasks in the same inference.

[0240] The first loss function of the merged task is:

[0241]

[0242] Among them, path j is the jth path in the sample problem reasoning path, and J is the total number of tasks.

[0243] As an example, in order to distinguish different subtasks, the prediction prompt text l for separating each subtask in the merged task is inserted into the sample context. j To separate these three subtasks, predict the prompt text l j Represents task t j The LLMs are fine-tuned to generate these prediction prompt texts and target task labels, making the LLMs model self-aware of the task it is currently processing.

[0244] For example,

[0245] Insert prediction hint texts for separating subtasks in the merged task into the sample context.

[0246] The sample context with the predicted prompt text of each subtask is input into the current large language model to generate the target prompt text and target task label of each subtask.

[0247] Calculate the loss function of the predicted prompt text and the loss function of the target task label,

[0248] Fine-tune the large language model based on the calculated loss function of the target task label and the expectation of the next predicted prompt text.

[0249] Among them, the loss function of predicting the prompt text is:

[0250]

[0251] Among them, L l is the loss function of all predicted prompt texts, j is the jth path in the sample question reasoning path,

[0252] The loss function for target task labeling can be a cross entropy loss function.

[0253] The sample context with the target prompt text of each subtask and the target task mark is inserted into the fine-tuned large language model, and the second loss function value of the merged task is calculated under the sample context with the target prompt text of each subtask and the target task mark inserted. The second loss function is added to the calculated loss function of the predicted prompt text to obtain the total loss function of the sample problem. According to the total loss function of the sample problem, the current large language model is adjusted.

[0254] The mathematical expression of the second loss function of the merged task is:

[0255]

[0256] The total loss function of the sample problem can be expressed as:

[0257] L f =L l +L′ m

[0258] In the above example, through label-guided multi-task joint training, LLMs can complete the entire CoG process with only one call, greatly reducing the complexity and usage cost of the process.

[0259] In step 506, the next sample question is selected from the training set, and the process returns to step 501 until the large language model reaches the set expectation.

[0260] It should be understood that, before the training of this embodiment, the large language model, the ranking model, and the retrieval model are all models that have undergone preliminary training and have their basic functions.

[0261] See also Figure 6 As shown, Figure 6This is an example of question-answering based on an artificial intelligence model. In this embodiment, after the question to be answered is input into the trained retrieval model, an initial retrieval result is obtained. The question to be answered and the initial retrieval result are input into the trained ranking model to obtain an initial ranking result. The three articles with the highest ranking evaluation values ​​are selected and spliced ​​with the question to be answered to obtain a spliced ​​document, such as d3, d9, and d12 in the figure, where the numerical value represents the ranking evaluation value of the spliced ​​document; these spliced ​​documents are used as extended questions for the first extended retrieval, and the first extended retrieval is performed to obtain the spliced ​​documents of the first extended retrieval, such as the spliced ​​documents d5, dx1, and dy1 obtained by the first extended retrieval of the spliced ​​document d3 in the figure, and the spliced ​​documents d18, d14, and dz1 obtained by the first extended retrieval of the spliced ​​document d9..., through the dynamic extension path. Pruning, d5, dx1, dy1, and dz1 are removed from the spliced ​​documents obtained in the first extended retrieval; in the second extended retrieval, the spliced ​​documents d18 and d14 that have not been removed, the spliced ​​documents used in their previous extensions, and the questions to be answered are used as spliced ​​documents, i.e., the second extended retrieval is performed, that is, d18, d9, and the questions to be answered are input into the retrieval model and the ranking model, and the spliced ​​documents of the second extended retrieval are d14, dx2, and dy2 respectively. Similarly, d14, d9, and the questions to be answered are input into the retrieval model and the ranking model, and the spliced ​​results of the second extended retrieval are d18, dz2, and dr2 respectively, among which dx2, dy2, dz2, and dr2 are removed through dynamic pruning.

[0262] When the number of expansions reaches the set expansion threshold, the concatenated document obtained by the current expansion, the concatenated document extensions used in previous expansions, and the question to be answered are input into the large language model as context. The large language model generates an inference path according to the set binding chain, and performs inference according to the inference path to obtain the final answer.

[0263] See also Figure 7 As shown, Figure 7 A schematic diagram of a device for implementing question-answering based on an artificial intelligence model. The device includes:

[0264] The retrieval module is used to input the question to be answered into the trained retrieval model for extended retrieval, and obtain the initial retrieval results through the reasoning of the retrieval model, where the retrieval results represent the relevance between the question to be answered and each document in the corpus.

[0265] A ranking module is configured to input the first number of documents with the highest relevance in the initial search results and the question to be answered into a trained ranking model for ranking the search results, and obtain an initial ranking result through reasoning of the ranking model, wherein the ranking result represents a ranking evaluation value of the relevance between the input question and the input document of the ranking model.

[0266] The splicing module is used to splice the question to be answered with the second number of documents with the highest ranking evaluation value in the initial ranking result to obtain each current spliced ​​document, and return each current spliced ​​document to the retrieval module, so that the retrieval module performs an extended search on each current spliced ​​document until the expansion iteration of each current spliced ​​document reaches a set expansion number threshold.

[0267] The text processing module is used to use the final extended retrieval results of each currently spliced ​​document and the question to be answered as context, use the trained large language model to generate an inference path according to the set binding chain, and reason on the context according to the inference path to obtain the answer result of the question to be answered.

[0268] See also Figure 8 As shown, Figure 8 This is a schematic diagram of a device for implementing question-answering based on an artificial intelligence model. The device includes a memory and a processor. The memory stores a computer program, and the processor is configured to execute the computer program to implement the steps of the method for implementing question-answering based on an artificial intelligence model according to an embodiment of the present application.

[0269] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0270] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0271] An embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the question-answering implementation method based on the artificial intelligence model in the embodiment of the present application.

[0272] As for the apparatus / network-side device / storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0273] In this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.

[0274] 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 in the scope of protection of the present invention.

Claims

1. A question-answering implementation method based on an artificial intelligence model, characterized in that: The method includes: The question to be answered is input into the trained retrieval model for extended retrieval. The initial retrieval results are obtained through the reasoning of the retrieval model. The retrieval results represent the relevance between the question to be answered and each document in the corpus. Input the first number of documents with the highest relevance in the initial search results and the question to be answered into the trained ranking model for ranking the search results, and obtain an initial ranking result through reasoning of the ranking model, wherein the ranking result represents a ranking evaluation value of the relevance between the input question and the input document of the ranking model. The question to be answered is concatenated with the second number of documents with the highest ranking evaluation values ​​in the initial ranking results to obtain the current concatenated documents. Perform extended searches on each current spliced ​​document until the number of expansions for each current spliced ​​document reaches the set expansion threshold. The final extended retrieval results of each currently spliced ​​document and the question to be answered are used as context. The trained large language model is used to generate an inference path according to the set binding chain. The context is then inferred according to the inference path to obtain the answer to the question to be answered.

2. The question-answering method according to claim 1, wherein: The step of iterating the expansion of each current stitched document until the expansion iteration of each current stitched document reaches a set expansion number threshold includes: For any current stitched document: The current spliced ​​document, the spliced ​​documents used in the previous extended questions of the current spliced ​​document, and the question to be answered are used as the current extended question and input into the retrieval model. Through the reasoning of the retrieval model, the current extended retrieval result is obtained. The third most relevant document in this extended search result and the question to be answered are input into the ranking model, and the ranking result is obtained through the reasoning of the ranking model. The questions to be answered are concatenated with the fourth number of documents with the highest ranking evaluation values ​​in this ranking result to obtain the concatenated documents for this expansion. At least one of the spliced ​​documents expanded this time is used as the current spliced ​​document, and the steps for any current spliced ​​document are executed again until the number of expansions reaches a set expansion threshold, thereby obtaining a final expanded search result for the current spliced ​​document.

3. The question-answering method according to claim 1, wherein: The retrieval model is fine-tuned as follows: For each expansion of the problem for each sample in the training set: Based on the standard answer document corresponding to the sample question, construct the positive and negative samples of this expansion of the sample question. The answer document used in this expansion of the sample question, the answer documents used in previous expansions, and the sample question are used as the expansion question of the sample question, and are input into the preliminarily trained retrieval model to obtain the expansion retrieval result of the sample question. Using the positive and negative samples of this extended sample problem, calculate the loss function value of the extended retrieval result of this sample problem. Repeat the steps of constructing positive and negative samples for the current expansion of the sample question based on the marked answer document corresponding to the sample question until the loss function value of the current expansion retrieval results of all sample questions in the training set is obtained; The loss function values ​​of each extended retrieval result of all sample questions in the training set are accumulated to obtain the total loss function value. Fine-tune the preliminarily trained retrieval model according to the total loss function value to obtain a fine-tuned retrieval model; The ranking model is fine-tuned as follows: Using the fine-tuned retrieval model, we provide negative samples for fine-tuning the ranking model. The positive samples used for fine-tuning the retrieval model and the negative samples used for fine-tuning the ranking model are used to fine-tune the initially trained ranking model to obtain a fine-tuned ranking model.

4. The question-answering method according to claim 3, wherein: The positive and negative samples of the sample question are constructed based on the corresponding standard answer document of the sample question, including: If the cumulative number of expansions during this expansion is equal to the total number of hops included in the sample question, all the marked answer documents are regarded as positive samples. If the cumulative number of expansions during this expansion is not greater than the total number of hops included in the sample problem, then The sample question, the answer document used in this expansion, and the answer documents used in previous expansions are used as the expansion question for this expansion, and are input into the preliminarily trained retrieval model to obtain the first sample retrieval result. In the first sample retrieval results, remove the marked answer document from the ninth number of documents with the highest relevance to obtain the negative sample of this expansion of the sample question. The standard answer documents used in this extension are used as positive samples; The method of using the fine-tuned retrieval model to provide negative samples for fine-tuning the ranking model includes: For each expansion of any sample problem: If the cumulative number of expansions during this expansion is not greater than the total number of hops included in the sample problem, then The sample question, the answer document used in this expansion, and the answer documents used in previous expansions are used as the expansion question for this expansion, and are input into the fine-tuned retrieval model to obtain the second sample retrieval result. In the second sample retrieval results, remove the marked answer document from the tenth most relevant document to obtain the negative sample of this expansion of the sample question, which is used as a negative sample for fine-tuning the ranking model; in, Each question has a one-to-one correspondence with its standard answer document, and each standard answer document is arranged in the order of each question in the sample questions. The answer document used for this extension is: the answer document corresponding to the same number of hops as the cumulative extension times of this extension.

5. The question-answering method according to claim 2 or 3, wherein: The method further comprises: For each currently stitched document: A branch path is established with the current spliced ​​document and the previous spliced ​​document used in the previous extension adjacent to the current spliced ​​document as endpoints. The previous spliced ​​document is used as the current spliced ​​document, and the steps are returned to the previous spliced ​​document and the previous spliced ​​document used in the previous expansion adjacent to the current spliced ​​document as endpoints until the question to be answered is traversed. Using the established branch path as the extension path of the current splicing document; For each extended path: Calculate the average of the ranking evaluation values ​​of all spliced ​​documents in each branch path in the extended path to obtain the extended path evaluation value of the extended path, wherein the extended path evaluation value is used to characterize the quality of the extended path. According to the evaluation value of the extended path, the branch paths in the extended path are pruned to remove the splicing documents that do not meet the expectations.

6. The question-answering method according to claim 5, wherein: The pruning includes at least one of: pruning within an extended path and pruning between extended paths. in, Pruning within the extension path is performed as follows: if the ranking evaluation value of any spliced ​​document within the same extension path is lower than the extension path evaluation value, the extended search with the spliced ​​document as the extension question is stopped. The pruning among the extension paths is performed in the following manner: among the extension search results obtained with the same number of extensions, the extension path with the highest extension path evaluation value is retained, and the remaining extension paths are deleted; The binding chain includes at least one of an explicit question decomposition task, a mandatory document binding task, and a local answer derivation task. Generating an inference path according to the set binding chain includes: According to the order of explicit question decomposition task, mandatory document binding task, and local answer derivation task, a combination path consisting of explicit question decomposition reasoning path, mandatory document binding reasoning path, and local answer derivation reasoning path is generated in sequence, and multiple such combination paths are generated in sequence.

7. The question-answering method according to claim 6, wherein: The large language model is trained as follows: For any sample problem in the training set: The sample question and its final expanded retrieval result are used as sample context. The preliminarily trained large language model is used to perform the selection subtask for selecting binding chains, the decomposition subtask for explicit question decomposition, the binding subtask for enforcing document binding, and the inference subtask for local answer inference on the sample context. According to the loss function value of each subtask, adjust the current large language model, Repeat the above steps for any sample problem in the training set until the expected result is achieved.

8. The question-answering method according to claim 7, wherein: The method utilizes the preliminarily trained large language model to perform a selection subtask for selecting a binding chain, a decomposition subtask for explicit question decomposition, a binding subtask for enforcing document binding, and a derivation subtask for a local answer derivation task on the sample context, including: Perform the merging of decomposition subtasks, binding subtasks, and inference subtasks in the same reasoning process; The process of adjusting the current large language model according to the loss function values ​​of each subtask includes: Calculate the first loss function value of the merged task, and adjust the current large language model according to the first loss function value of the merged task; The final extended search results for the sample question are obtained as follows: For any sample problem in the training set: Input the sample question into the fine-tuned retrieval model to obtain the sample initial retrieval results. Input the fifth most relevant document in the sample initial search results of the sample question and the sample question into the fine-tuned ranking model to obtain the sample initial ranking result. Concatenate the sample question with the sixth number of documents with the highest ranking evaluation values ​​in the sample initial ranking results to obtain current concatenated documents; For any current stitched document: The current spliced ​​document, the spliced ​​documents used in the previous extended questions of the current spliced ​​document, and the sample question are input into the fine-tuned retrieval model as the current extended question to obtain the current extended retrieval result. The seventh most relevant document in this extended search result and the sample question are input into the fine-tuned ranking model to obtain the ranking result. The sample question is concatenated with the eighth number of documents with the highest ranking evaluation value in this ranking result to obtain the concatenated documents of this expansion. At least one of the spliced ​​documents expanded this time is used as the current spliced ​​document, and the steps for any current spliced ​​document are executed again until the number of expansions reaches the set sample expansion number threshold, thereby obtaining the final expanded search result for the current spliced ​​document. The final extended retrieval results of each currently spliced ​​document are used as the final extended retrieval results of the sample question.

9. The question-answering method according to claim 8, wherein: The merging task of performing the decomposition subtask, the binding subtask, and the derivation subtask in the same reasoning process includes: Insert prediction hint texts for separating subtasks in the merged task into the sample context. The sample context with the predicted prompt text of each subtask is input into the current large language model to generate the target prompt text and target task label of each subtask. Calculate the loss function of the predicted prompt text and the loss function of the target task label, Based on the calculated loss function of the target task label and the expectation of the next predicted prompt text, fine-tune the large language model, Input the sample context with the target prompt text of each subtask and the target task label into the fine-tuned large language model; The step of adjusting the current large language model according to the loss function value of the merged task includes: Calculate the second loss function value of the merged task in the sample context with the target prompt text of each subtask and the target task label inserted, and add the second loss function with the calculated loss function of the prompt text to obtain the total loss function of the sample problem. Adjust the current large language model based on the total loss function of the sample problem.

10. A question-answering device based on an artificial intelligence model, characterized in that: include: The retrieval module is used to input the question to be answered into the trained retrieval model for extended retrieval, and obtain the initial retrieval results through the reasoning of the retrieval model, where the retrieval results represent the relevance between the question to be answered and each document in the corpus. A ranking module is configured to input the first number of documents with the highest relevance in the initial search results and the question to be answered into a trained ranking model for ranking the search results, and obtain an initial ranking result through reasoning of the ranking model, wherein the ranking result represents a ranking evaluation value of the relevance between the input question and the input document of the ranking model. The expansion module is used to respectively concatenate the question to be answered with the second number of documents with the highest ranking evaluation values ​​in the initial ranking result to obtain each current concatenated document, and return each current concatenated document to the retrieval module, so that the retrieval module performs an extended search on each current concatenated document until the number of expansions for each current concatenated document reaches a set expansion number threshold. The text processing module is used to use the final extended retrieval results of each currently spliced ​​document and the question to be answered as context, use the trained large language model to generate an inference path according to the set binding chain, and reason on the context according to the inference path to obtain the answer result of the question to be answered.

Citation Information

Patent Citations

  • Retrieval method and device based on multi-hop reasoning

    CN113837386A

  • Intelligent question and answer method and device suitable for open source software supply chain

    CN115658845A

  • Universal adaptive question answering method and system, storage medium and electronic equipment

    CN118643144A

  • Knowledge intensive question reasoning and generating method based on LLM

    CN118798367A

  • Iterative multi-hop question and answer method based on large language model, medium and equipment

    CN119311794A