Question and answer model training method and device
By splitting complex questions into sub-questions and performing recursive reasoning and iterative retrieval, combined with feedback information to optimize training, the problem of inaccurate answers in existing technologies is solved, and the accuracy and adaptability of the question-answering model are improved.
Patent Information
- Application Number
- CN202410289094.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-13
- Publication Date
- 2025-09-19
AI Technical Summary
In the existing technology, retrieval enhancement models rely on the semantic similarity between questions and external corpora, making it difficult to search for appropriate and accurate answers, especially for complex questions, with low flexibility and accuracy.
By splitting the sample question into multiple sub-questions, and performing recursive reasoning and iterative retrieval based on the order of the sub-questions, the training is optimized using memory modules and feedback information, providing sufficient context and situational basis, and narrowing the retrieval scope to obtain the final answer.
It significantly improves the accuracy and precision of predicted answers, enhances the learning efficiency and flexibility of the question-answering model, adapts to changes in real-world knowledge, and enhances generalization and adaptability.
Smart Images

Figure CN120670537A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and more particularly to a method and apparatus for training a question-answering model. Background Art
[0002] Communicative Learning AI (CLAI) can dynamically update its knowledge through interactive conversations, enabling lifelong learning. Many research efforts have attempted to leverage LLMs to build complex CLAIs to perform a range of tasks, such as conversation, contextual reasoning, and scenario planning. However, current retrieval enhancement models rely solely on semantic similarity between questions and external corpora for retrieval, making it difficult to find appropriate and accurate answers. Summary of the Invention
[0003] This application aims to solve at least one of the technical problems existing in the prior art. To this end, this application proposes a question-answering model training method and device that can effectively search for appropriate and accurate answers and significantly improve the accuracy of the final predicted answers.
[0004] In a first aspect, the present application provides a question-answering model training method, the method comprising:
[0005] Get sample questions;
[0006] Inputting the sample question into a question-answering model, and if the sample question is a complex question, the question-answering model sequentially splits the sample question into multiple sub-questions;
[0007] Based on the predicted answers corresponding to the sub-questions, the question-answering model generates a predicted answer corresponding to the sample question.
[0008] According to the question-answering model training method of the present application, by performing recursive reasoning retrieval and utilizing iterative retrieval to provide sufficient context and situational basis for forward reasoning, and by planning and decomposing complex retrieval tasks and narrowing the retrieval scope to obtain the final answer, it is possible to effectively search for appropriate and accurate answers, significantly improving the accuracy of the final predicted answer.
[0009] According to one embodiment of the present application, the question-answering model generates a predicted answer corresponding to the sample question based on the predicted answer corresponding to each of the sub-questions, including:
[0010] Based on the target sub-question and the first sub-answer information in the multiple sub-questions, a predicted answer corresponding to the target sub-question is predicted; wherein,
[0011] The first sub-answer information is a predicted answer corresponding to the sub-question located before the target sub-question obtained by searching for a sub-question located before the target sub-question among the multiple sub-questions.
[0012] According to one embodiment of the present application, the step of searching based on the target sub-question and the first sub-answer information among the multiple sub-questions to predict a predicted answer corresponding to the target sub-question includes:
[0013] Searching the target sub-question in the first module to obtain candidate answer information corresponding to the current prediction round;
[0014] If the candidate answer information is determined to be a correct answer, the candidate answer information is determined as a predicted answer corresponding to the target sub-question;
[0015] When it is determined that the candidate answer information is not a correct answer, performing additional information retrieval based on the memory module, and obtaining a predicted answer corresponding to the target sub-question based on the retrieval result;
[0016] The memory module is a module different from the first module.
[0017] According to an embodiment of the present application, after searching the target sub-question and the first sub-answer information among the multiple sub-questions and predicting the predicted answer corresponding to the target sub-question, the method further includes:
[0018] Obtaining target feedback information corresponding to the target sub-problem;
[0019] Based on the target feedback information and the predicted answer, the question-answering model is optimized and trained.
[0020] According to one embodiment of the present application, the target feedback information includes at least one of first feedback information, second feedback information, and third feedback information;
[0021] The first feedback information is used to indicate whether the predicted answer is correct or not, the second feedback information includes prompt information for answering the target sub-question, and the third feedback information includes correct answer information corresponding to the target sub-question.
[0022] According to an embodiment of the present application, after searching the target sub-question and the first sub-answer information among the multiple sub-questions and predicting the predicted answer corresponding to the target sub-question, the method further includes:
[0023] A memory module is updated based on the target sub-problem, the predicted answer corresponding to the target sub-problem, and the target feedback information corresponding to the target sub-problem.
[0024] According to one embodiment of the present application, after the question-answering model generates a predicted answer corresponding to the sample question based on the predicted answers corresponding to each of the sub-questions, the method further includes:
[0025] Get questions to be asked and answered;
[0026] The question to be asked and answered is input into the question-answering model, and the target answer corresponding to the question to be asked and answered output by the question-answering model is obtained.
[0027] In a second aspect, the present application provides a question-answering model training device, which includes:
[0028] The first processing module is used to obtain sample questions;
[0029] A second processing module is configured to input the sample question into a question-answering model. If the sample question is a complex question, the question-answering model sequentially splits the sample question into multiple sub-questions.
[0030] The third processing module is used to generate a predicted answer corresponding to the sample question by the question-answering model based on the predicted answer corresponding to each of the sub-questions.
[0031] According to the question-answering model training device of the present application, by performing recursive reasoning retrieval and utilizing iterative retrieval to provide sufficient context and situational basis for forward reasoning, and by planning and decomposing complex retrieval tasks and narrowing the retrieval scope to obtain the final answer, it is possible to effectively search for appropriate and accurate answers, significantly improving the accuracy of the final predicted answer.
[0032] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the question-answering model training method as described in the first aspect above is implemented.
[0033] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the question-answering model training method described in the first aspect above.
[0034] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the question-answering model training method as described in the first aspect above.
[0035] The above one or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
[0036] By performing recursive reasoning retrieval and using iterative retrieval to provide sufficient context and situational basis for forward reasoning, and by planning and decomposing complex retrieval tasks and narrowing the retrieval scope to obtain the final answer, we can effectively search for appropriate and accurate answers and significantly improve the accuracy of the final predicted answer.
[0037] Furthermore, by setting up multiple feedback forms such as unexplained feedback, feedback with prompts, and correct answers, the question-answering model can be trained and optimized from different angles, allowing the question-answering model to better learn the connections between multiple related knowledge blocks, continuously improve its complex reasoning ability, and improve the precision and accuracy of the question-answering model, with higher learning efficiency, higher flexibility and lower cost.
[0038] Furthermore, by utilizing a RAM system similar to the fast-updated memory cache in computer systems, without training, it can build a continuously updated memory with fresh knowledge and historical experience through interactive learning, dynamically update its knowledge and memory through current observations and user feedback, adapt to and absorb the ever-changing knowledge in the real world, modify or discard outdated data, and further self-improve, which can improve the generalization and adaptability of the question-answering model.
[0039] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become obvious from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0041] Figure 1 Schematic diagram of the process of question-answering model training method provided in the embodiment of the present application;
[0042] Figure 2 Schematic diagram of the structure of the question-answering model training device provided in an embodiment of the present application;
[0043] Figure 3 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0045] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0046] Below, in combination with the accompanying drawings, the question-answering model training method, question-answering model training device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0047] Among them, the question-answering model training method can be applied to the terminal, and can be specifically executed by hardware or software in the terminal.
[0048] The terminal includes but is not limited to portable communication devices such as mobile phones or tablet computers. It should also be understood that in some embodiments, the terminal may not be a portable communication device, but a desktop computer.
[0049] In the following embodiments, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, a mouse, and a joystick.
[0050] The question-answering model training method provided in the embodiment of the present application may be executed by an electronic device or a functional module or functional entity in the electronic device that can implement the question-answering model training method. The electronic devices mentioned in the embodiment of the present application include but are not limited to mobile phones, tablet computers, computers, cameras, and wearable devices. The question-answering model training method provided in the embodiment of the present application is described below using an electronic device as an example of the execution subject.
[0051] like Figure 1 As shown, the question-answering model training method includes: step 110, step 120 and step 130.
[0052] Step 110: Obtain sample questions;
[0053] In this step, the sample questions can be any questions that need to be answered.
[0054] The question can be a simple question, such as "What's the weather like today?", or a complex question.
[0055] It can be understood that for each sample question, there is a correct answer corresponding to it.
[0056] Step 120: Input the sample question into the question-answering model. If the sample question is a complex question, the question-answering model will sequentially split the sample question into multiple sub-questions.
[0057] In this step, the question-answering model is used to answer the input questions to obtain the corresponding answers.
[0058] The question-answering model can be an artificial intelligence model, and this application does not limit its specific type.
[0059] In the case where the sample question is a complex question, the sample question may include multiple core elements, which are indispensable elements for answering the question.
[0060] For example, taking the sample question "What school does the son of the current US president attend?", this sample question contains multiple elements such as "current", "US president", "son", and school. When predicting the answer, if any element cannot be accurately matched, the final answer may be wrong.
[0061] The sub-questions are the questions corresponding to the core elements included in the sample question.
[0062] Continuing with the sample question "What school does the son of the current president of the United States attend?" as an example, by splitting this sample question, we can get the following sub-questions: a. "Who is the current president of the United States?"; b. "Who is the son?"; c. "What is the school?"
[0063] It is understandable that there may be a sequence relationship between the sub-problems, and the correct answer to the next sub-problem can only be obtained based on the solution of the previous sub-problem.
[0064] For example, for the sub-questions: a, "Who is the current president of the United States?"; b, "Who is the son?"; c, "What is school?", sub-question b should be placed after sub-question a, and sub-question c should be placed after sub-question b.
[0065] In the actual implementation process, a retrieval module based on recursive reasoning can be set to perform this step.
[0066] For any sample question Q, the retrieval module is required to gradually think, retrieve and reason to solve the current problem based on previous observations. First, the sample question Q is decomposed into multiple sub-steps to obtain multiple sub-problems.
[0067] In some embodiments, the question-answering model sequentially splits the sample question into multiple sub-questions, which may include:
[0068] By explicitly asking the question-answering model to split the sample questions;
[0069] and / or,
[0070] The sample questions are split based on the reflective ability of the question-answering model itself.
[0071] In this embodiment, the question-answering model can be trained based on manual pre-labeling, or it can be trained using the autonomous learning ability of the question-answering model to achieve automatic splitting of sample questions by the question-answering model.
[0072] Of course, in other embodiments, any other feasible method may be used to split the sample questions, and this application does not limit this.
[0073] In some embodiments, the complexity of the input sample question can be automatically judged based on a pre-trained model, or the complexity of the sample question can be judged by identifying the number of core elements included in the sample question.
[0074] Step 130: Based on the predicted answers corresponding to each sub-question, the question-answering model generates a predicted answer corresponding to the sample question.
[0075] In this step, the predicted answer corresponding to the sub-question is the answer corresponding to the sub-question obtained by the question-answering model based on autonomous thinking and prediction of the sub-question, or key information related to the answer.
[0076] The predicted answer corresponding to the sample question is the final answer used to answer the sample question.
[0077] Continuing with the sample question "What school does the son of the current US president attend?" as an example, by splitting the sample question in a certain order, we can get multiple sub-questions, such as: a. "Who is the current US president?"; b. "Who is the son?"; c. "What is the school?"; based on the splitting order, the question-answering model can get the predicted answers corresponding to each sub-question in turn, and thus get the final predicted answer. For example, the answers obtained in turn are: The US president is A, A's son is B, and B's school is C, and C is determined as the final predicted answer.
[0078] In the actual execution process, the reasoning path involved in the entire prediction process is RT = (s i1 , s i2 ,...,s in ), where 1≤i≤N, and the values of n and N can be preset by the user.
[0079] During the research and development process, the inventors discovered that most related technologies rely on semantic similarity between questions and external corpora for retrieval. For complex scenarios or more complex questions, this method finds it difficult to search for appropriate and accurate answers. In addition, traditional retrieval augmented generation (RAG) systems mainly use static and external knowledge to enhance LLMs, which has low flexibility and accuracy.
[0080] In the present application, by splitting the sample question into multiple sub-questions and retrieving the corresponding answers in sequence based on the order of the sub-questions to obtain the final predicted answer, it is possible to implement recursive reasoning retrieval. When there is only limited knowledge in the vector-based storage memory M, iterative retrieval provides sufficient context and situational basis for forward reasoning; in addition, interweaving complex reasoning during retrieval helps to clarify the search direction. By planning and decomposing complex retrieval tasks, narrowing the retrieval scope to obtain the final answer, it is possible to effectively search for appropriate and accurate answers, significantly improving the accuracy of the final predicted answer, and improving the accuracy and effect of the question-answering model, which is especially suitable for problem reasoning in complex scenarios.
[0081] According to the question-answering model training method provided in the embodiment of the present application, by performing recursive reasoning retrieval, using iterative retrieval to provide sufficient context and situational basis for forward reasoning, and by planning and decomposing complex retrieval tasks, narrowing the retrieval scope to obtain the final answer, it is possible to effectively search for appropriate and accurate answers, significantly improving the accuracy of the final predicted answer.
[0082] The implementation of step 130 is described in detail below.
[0083] In some embodiments, step 130 may include:
[0084] Based on the target sub-question and the first sub-answer information in multiple sub-questions, the predicted answer corresponding to the target sub-question is predicted; wherein,
[0085] The first sub-answer information is a predicted answer corresponding to a sub-question preceding the target sub-question obtained by searching for a sub-question preceding the target sub-question among the multiple sub-questions.
[0086] In this embodiment, the target subproblem may be any subproblem among the multiple subproblems.
[0087] It can be understood that the order corresponding to the multiple sub-problems can be expressed as the order corresponding to when the sample problem is split.
[0088] When the target subproblem is the first subproblem, it can be considered that there is no subproblem before it. In this case, the first sub-answer information is defaulted to be empty.
[0089] When the target subproblem is the last subproblem, the predicted answer corresponding to the target subproblem can be approximately considered as the final predicted answer corresponding to the sample question.
[0090] Continuing with the sample question "What school does the son of the current US president attend?" as an example, by splitting the sample question in a certain order, we can sequentially obtain the following sub-questions: a) "Who is the current US president?"; b) "Who is the son?"; c) "What is the school?";
[0091] First, the first sub-problem a is determined as the target sub-problem. Based on sub-problem a and "Who is the current president of the United States?", a search is performed to obtain the predicted answer corresponding to sub-problem a, such as "The president of the United States is A"; then the second sub-problem b is determined as the target sub-problem. Combined with sub-problem b and the first sub-answer information "The president of the United States is A" retrieved based on the first sub-problem a, the predicted answer corresponding to sub-problem b is obtained, such as "A's son is B"; finally, the third sub-problem c is determined as the target sub-problem. Combined with sub-problem c and the first sub-answer information "A's son is B" retrieved based on the second sub-problem b, the predicted answer corresponding to sub-problem c is further retrieved, such as "B's school is C", thereby obtaining the final predicted answer corresponding to the sample question "What school does the son of the current president of the United States attend?": "School C".
[0092] In this embodiment, for a given Q, the question-answering model is able to split the answer to Q into multiple steps of answering sub-questions through multiple rounds of question-answering; by gradually reasoning and answering each sub-question based on the information and knowledge searched externally, the answer to Q is completed, thereby realizing a reliable forward search process.
[0093] According to the question-answering model training method provided in the embodiment of the present application, by breaking down complex questions and gradually reasoning to obtain intermediate results of sub-steps, the accuracy of the final answer is further guaranteed.
[0094] In some embodiments, searching based on the target sub-question and the first sub-answer information among the multiple sub-questions to predict the predicted answer corresponding to the target sub-question may include:
[0095] Based on the target sub-question, search in the first module to obtain the corresponding candidate answer information in the current prediction round;
[0096] When the candidate answer information is determined to be the correct answer, the candidate answer information is determined as the predicted answer corresponding to the target sub-question;
[0097] If the candidate answer information is determined to be an incorrect answer, additional information retrieval is performed based on the memory module, and the predicted answer corresponding to the target sub-question is obtained based on the retrieval results;
[0098] The memory module is a module different from the first module.
[0099] In this embodiment, for each sub-question, a maximum threshold N of answer rounds for answering the sub-question may be set.
[0100] Wherein, N is a positive integer and N≥1. For example, N can be set to 5 or 6, etc., which is not limited in this application.
[0101] The memory module may be a database pre-built by the user for storing other information in addition to the relevant information in the first module.
[0102] For example, given a sample question Q and a vector-based storage memory M, the question-answering model is required to think and retrieve step by step based on previous observations;
[0103] For each sub-question s, the question answering model determines whether the subset has enough information to answer the sub-question s.
[0104] If it is determined that the answer can be given (for example, the question-answering model believes that the current candidate answer information is the correct answer), the question-answering model uses the predicted candidate answer information Pred i As the current round tr i (1≤i≤N) The predicted answer to the target sub-problem s, and the end of the current round tr i (1≤i≤N).
[0105] In some embodiments, if it is determined that the question cannot be answered and the current round has not reached the maximum threshold N, the next round may be entered to perform a new search based on the target sub-question.
[0106] In some embodiments, when it is determined that the question cannot be answered (such as the question-answering model believes that the current candidate answer information is not the correct answer) and the current round has not reached the maximum threshold N, additional information is further retrieved as context, and reliable inferences and observations are made through context learning to obtain the predicted answer corresponding to the target sub-question.
[0107] According to the question-answering model training method provided in the embodiments of the present application, when the predicted answer corresponding to the target sub-question cannot be accurately retrieved, additional information is retrieved as context, and reliable inferences and observations are made through context learning to further improve the answer prediction ability, thereby improving the functionality of the question-answering model.
[0108] In some embodiments, after searching based on the target sub-question and the first sub-answer information among the multiple sub-questions and predicting the predicted answer corresponding to the target sub-question, the method may further include:
[0109] Obtain target feedback information corresponding to the target sub-problem;
[0110] Optimize and train the question-answering model based on target feedback information and predicted answers.
[0111] In this embodiment, the target feedback information is relevant information used to provide feedback on the results output by the question-answering model.
[0112] The target feedback information may include feedback information on the final predicted answer corresponding to the sample question, or may also include feedback information on the predicted answers corresponding to each sub-question obtained by splitting the sample question.
[0113] Target feedback information can be determined based on the correct answers corresponding to the sample questions.
[0114] It is understandable that, during the actual execution process, the target feedback information and the predicted answer may be consistent or inconsistent.
[0115] Optimizing and training the question-answering model based on target feedback information and predicted answers can further improve the learning ability of the question-answering model and improve the model's precision and accuracy.
[0116] In some embodiments, the target feedback information may include at least one of first feedback information, second feedback information, and third feedback information.
[0117] In this embodiment, the first feedback information is used to indicate whether the predicted answer is correct or not.
[0118] For example, the first feedback information may include true or false.
[0119] Continuing with the sample question "What school does the son of the current US president attend?" as an example, for the first sub-question a, "Who is the current US president?", the correct answer is "The US president is A";
[0120] When the question-answering model predicts that the corresponding answer is: "The President of the United States is D", the corresponding first feedback information is "wrong".
[0121] When the question-answering model predicts that the corresponding answer is: "The American president is A", the corresponding first feedback information is "correct".
[0122] As the predicted answer Pred i In the current round tr iAutomatic evaluation in the Q&A model is used for further self-reflection and experimentation; based on a predefined threshold, the semantic similarity sim between the predicted answer and the embedding of the correct answer is calculated; compared to traditional n-gram matching, using automatic similarity as feedback provides greater flexibility, while maintaining higher accuracy and lower cost compared to using LLM as an evaluator.
[0123] The second feedback information includes prompt information for answering the target sub-question.
[0124] It should be noted that the second feedback information is not the answer itself for answering the target sub-question, but is relevant information for guiding the question-answering model to find the correct answer.
[0125] Continuing with sub-question a, "Who is the current president of the United States?" as an example, when the question-answering model predicts the corresponding answer as: "The president of the United States is D", its corresponding second feedback information may include: "Who will be the next president of D?" Based on the second feedback information and its predicted answer, the question-answering model can further search to obtain the correct answer.
[0126] The second feedback information can adaptively provide additional factual knowledge, or a new direction for better retrieval based on the correct answers and historical retrieval paths RT.
[0127] The second feedback information not only allows the question-answering model to learn the connections between multiple related knowledge blocks in a single question, but also teaches the question-answering model how to think, and continuously improves its complex reasoning ability from historical experience.
[0128] The third feedback information includes the correct answer information corresponding to the target sub-question.
[0129] Continuing with sub-question a, “Who is the current president of the United States?” as an example, the corresponding third feedback information includes “The president of the United States is A.”
[0130] Using the correct answer directly as the third feedback information can provide a clear and unambiguous response to the question-answering model; after several rounds of recursive thinking and action, this feedback can speed up the learning process, eliminate model confusion, and improve learning efficiency.
[0131] During the research and development process, the inventors also discovered that in related technologies, user feedback is relatively simple, only providing correct / incorrect signals or correct answers as feedback, which makes it difficult to further improve the learning and thinking ability of the model.
[0132] According to the question-answering model training method provided in the embodiment of the present application, by setting various feedback forms such as unexplained feedback, feedback with prompts, and correct answers, the question-answering model can be trained and optimized from different angles, allowing the question-answering model to better learn the connections between multiple related knowledge blocks, continuously improve its complex reasoning ability, improve the precision and accuracy of the question-answering model, and have higher learning efficiency, higher flexibility and lower cost.
[0133] In some embodiments, after searching based on the target sub-question and the first sub-answer information among the multiple sub-questions and predicting the predicted answer corresponding to the target sub-question, the method may further include:
[0134] Based on the target sub-problem, the predicted answer corresponding to the target sub-problem, and the target feedback information corresponding to the target sub-problem, the memory module is updated.
[0135] In this embodiment, the memory module may be a data module pre-built by the user for storing other information in addition to the relevant information in the first module.
[0136] During the actual execution process, for each round of prediction, the sub-questions involved, the predicted answers corresponding to the sub-questions, and the target feedback information corresponding to the sub-questions can be obtained to update the memory module; semantic similarity is used to locate the most relevant facts in the retrieved document.
[0137] The question-answering model locally updates these facts based on new knowledge injected by self-reflection, and the knowledge learned from experience is stored and used for future tasks.
[0138] In this application, a memory cache RAM system similar to the fast-updated one in a computer system is utilized to build a continuously updated memory with fresh knowledge and historical experience through interactive learning, and to perform retrieval of recursive reasoning.
[0139] Among them, the RAM system is a RAG system that does not require training.
[0140] According to the question-answering model training method provided in the embodiment of the present application, a memory cache RAM system similar to the fast update in a computer system is utilized. Without training, a continuously updated memory is constructed through interactive learning with fresh knowledge and historical experience. Its knowledge and memory are dynamically updated through current observations and user feedback, adapting to and absorbing the ever-changing knowledge in the real world, modifying or discarding outdated data, and further self-improving can improve the generalization and adaptability of the question-answering model.
[0141] In some embodiments, after step 130, the method may further include:
[0142] Get questions to be asked and answered;
[0143] Input the question to be asked and answered into the question-answering model, and obtain the target answer corresponding to the question to be asked and answered output by the question-answering model.
[0144] In this embodiment, the questions to be asked and answered are questions that need to be answered during the actual application process.
[0145] The target answer is the answer predicted by the question-answering model.
[0146] After the question-answering model training is completed, you only need to input the question to be answered into the question-answering model, and the question-answering model will perform autonomous retrieval and output the target answer.
[0147] The question-answering model training method provided in the embodiment of the present application can be executed by a question-answering model training device. In the embodiment of the present application, the question-answering model training method is executed by a question-answering model training device as an example to illustrate the question-answering model training device provided in the embodiment of the present application.
[0148] The inventors have confirmed through multiple experiments that the training method of the present application can improve the accuracy of the predicted answers by 30%-40% compared with traditional methods, and can significantly reduce the probability of unreasonable or ambiguous answers.
[0149] An embodiment of the present application also provides a question-answering model training device.
[0150] like Figure 2 As shown, the question-answering model training device includes: a first processing module 210, a second processing module 220 and a third processing module 230.
[0151] A first processing module 210 is used to obtain sample questions;
[0152] The second processing module 220 is used to input the sample question into the question-answering model. If the sample question is a complex question, the question-answering model will sequentially split the sample question into multiple sub-questions;
[0153] The third processing module 230 is used to generate a predicted answer corresponding to the sample question based on the predicted answer corresponding to each sub-question by the question-answering model.
[0154] According to the question-answering model training device provided in the embodiment of the present application, by performing recursive reasoning retrieval, iterative retrieval is used to provide sufficient context and situational basis for forward reasoning, and by planning and decomposing complex retrieval tasks, the retrieval scope is narrowed to obtain the final answer. It can effectively search for appropriate and accurate answers, and significantly improve the accuracy of the final predicted answer.
[0155] In some embodiments, the third processing module 230 may also be used to:
[0156] Based on the target sub-question and the first sub-answer information in multiple sub-questions, the predicted answer corresponding to the target sub-question is predicted; wherein,
[0157] The first sub-answer information is a predicted answer corresponding to a sub-question preceding the target sub-question obtained by searching for a sub-question preceding the target sub-question among the multiple sub-questions.
[0158] In some embodiments, the third processing module 230 may also be used to:
[0159] Based on the target sub-question, search in the first module to obtain the corresponding candidate answer information in the current prediction round;
[0160] When the candidate answer information is determined to be the correct answer, the candidate answer information is determined as the predicted answer corresponding to the target sub-question;
[0161] If the candidate answer information is determined to be an incorrect answer, additional information retrieval is performed based on the memory module, and the predicted answer corresponding to the target sub-question is obtained based on the retrieval results;
[0162] The memory module is a module different from the first module.
[0163] In some embodiments, the apparatus may further include a fourth processing module configured to:
[0164] After searching the target sub-problem and the first sub-answer information among the multiple sub-problems and predicting the predicted answer corresponding to the target sub-problem, target feedback information corresponding to the target sub-problem is obtained;
[0165] Optimize and train the question-answering model based on target feedback information and predicted answers.
[0166] In some embodiments, the apparatus may further include a fifth processing module configured to:
[0167] After searching the target subproblem and the first sub-answer information among the multiple subproblems and predicting the predicted answer corresponding to the target subproblem, the memory module is updated based on the target subproblem, the predicted answer corresponding to the target subproblem, and the target feedback information corresponding to the target subproblem.
[0168] In some embodiments, the apparatus may further include a sixth processing module configured to:
[0169] After the question-answering model generates the predicted answer corresponding to the sample question based on the predicted answer corresponding to each sub-question, the question to be asked and answered is obtained;
[0170] Input the question to be asked and answered into the question-answering model, and obtain the target answer corresponding to the question to be asked and answered output by the question-answering model.
[0171] The question-answering model training device in the embodiment of the present application can be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other device other than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. It can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.
[0172] The question-answering model training device in the embodiment of the present application can be a device having an operating system. The operating system can be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0173] The question-answering model training device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0174] In some embodiments, as Figure 3 As shown, an embodiment of the present application also provides an electronic device 300, including a processor 301, a memory 302, and a computer program stored in the memory 302 and executable on the processor 301. When the program is executed by the processor 301, each process of the above-mentioned question-answering model training method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0175] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0176] An embodiment of the present application also provides a non-transitory computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the various processes of the above-mentioned question-answering model training method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0177] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0178] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned question-answering model training method when executed by a processor.
[0179] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0180] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned question-answering model training method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0181] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0182] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0183] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0184] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
[0185] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0186] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and intent of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A question-answering model training method, characterized in that: include: Get sample questions; Inputting the sample question into a question-answering model, and if the sample question is a complex question, the question-answering model sequentially splits the sample question into multiple sub-questions; Based on the predicted answers corresponding to the sub-questions, the question-answering model generates a predicted answer corresponding to the sample question.
2. The question-answering model training method according to claim 1, characterized in that: The question-answering model generates a predicted answer corresponding to the sample question based on the predicted answer corresponding to each of the sub-questions, including: Based on the target sub-question and the first sub-answer information in the multiple sub-questions, a predicted answer corresponding to the target sub-question is predicted; wherein, The first sub-answer information is a predicted answer corresponding to the sub-question located before the target sub-question obtained by searching for a sub-question located before the target sub-question among the multiple sub-questions.
3. The question-answering model training method according to claim 2, characterized in that: The searching based on the target sub-question and the first sub-answer information among the multiple sub-questions to predict a predicted answer corresponding to the target sub-question includes: Searching the target sub-question in the first module to obtain candidate answer information corresponding to the current prediction round; If the candidate answer information is determined to be a correct answer, the candidate answer information is determined as a predicted answer corresponding to the target sub-question; When it is determined that the candidate answer information is not a correct answer, performing additional information retrieval based on the memory module, and obtaining a predicted answer corresponding to the target sub-question based on the retrieval result; The memory module is a module different from the first module.
4. The question-answering model training method according to claim 2, characterized in that: After searching the target sub-question and the first sub-answer information among the multiple sub-questions and predicting a predicted answer corresponding to the target sub-question, the method further includes: Obtaining target feedback information corresponding to the target sub-problem; Based on the target feedback information and the predicted answer, the question-answering model is optimized and trained.
5. The question-answering model training method according to claim 4, characterized in that: The target feedback information includes at least one of first feedback information, second feedback information and third feedback information; The first feedback information is used to indicate whether the predicted answer is correct or not, the second feedback information includes prompt information for answering the target sub-question, and the third feedback information includes correct answer information corresponding to the target sub-question.
6. The question-answering model training method according to claim 2, characterized in that: After searching the target sub-question and the first sub-answer information among the multiple sub-questions and predicting a predicted answer corresponding to the target sub-question, the method further includes: A memory module is updated based on the target sub-problem, the predicted answer corresponding to the target sub-problem, and the target feedback information corresponding to the target sub-problem.
7. The question-answering model training method according to any one of claims 1 to 6, characterized in that: After the question-answering model generates a predicted answer corresponding to the sample question based on the predicted answer corresponding to each of the sub-questions, the method further includes: Get questions to be asked and answered; The question to be asked and answered is input into the question-answering model, and the target answer corresponding to the question to be asked and answered output by the question-answering model is obtained.
8. A question-answering model training device, characterized in that: include: The first processing module is used to obtain sample questions; A second processing module is configured to input the sample question into a question-answering model. If the sample question is a complex question, the question-answering model sequentially splits the sample question into multiple sub-questions. The third processing module is used to generate a predicted answer corresponding to the sample question by the question-answering model based on the predicted answer corresponding to each of the sub-questions.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the question-answering model training method as described in any one of claims 1-7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the question-answering model training method as described in any one of claims 1 to 7 is implemented.