Question and answer method, question and answer model training method and related device

By training the Q&A model for iterative training based on multiple predicted answers, and using the classification model to adjust the parameters of the Q&A model, the problem of generating answers that do not meet the user's expectations is solved by large language models, and the accuracy and compliance of the answers are improved.

CN119917608APending Publication Date: 2025-05-02IFLYTEK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411763276.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

Large language models sometimes generate answers that do not match the user's expectations, such as fabricating facts, generating biased or harmful texts, or failing to follow user's instructions, resulting in low accuracy in answers.

Method used

By training the Q&A model for iterative training based on at least two predicted answers, the classification model gives the score of the predicted answers, thereby adjusting the network parameters of the Q&A model to tend to generate answers with higher scores.

Benefits of technology

The accuracy of the answers generated by the question and answer model is improved, making them more in line with human preferences and expectations, and the accuracy and reliability of the answers are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917608A_ABST
    Figure CN119917608A_ABST
Patent Text Reader

Abstract

The invention discloses a question-answering method, a question-answering model training method and a related device. The method comprises the following steps: acquiring a target question; giving a target answer based on the target question by using the trained question and answer model; wherein the question and answer model performs iterative training based on at least two predicted answers of the first sample question, and the scores of the at least two predicted answers are different; the score of the prediction answer is obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer of the second sample question and the sample prediction answer of the second sample question. In this way, the accuracy of the target answer can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language technology, and in particular to a question-answering method, a question-answering model training method, and related devices. Background Art

[0002] In recent years, large language models (LLMs) have made remarkable achievements in self-supervised pre-training. After pre-training, through instruction fine-tuning technology, LLMs can respond to questions raised by humans more effectively and handle tasks that require complex multi-step reasoning, such as solving math problems. However, despite these advances, a key problem remains unsolved: large language models may sometimes generate responses that do not match user expectations, such as fabricating facts, generating biased or harmful text, or not following user instructions. Based on this, how to improve the accuracy of model responses so that the model responses are more in line with user expectations has become one of the problems to be solved. Summary of the invention

[0003] The main technical problem solved by this application is to provide a question-answering method, a question-answering model training method and related devices, which can improve the accuracy of the target answer and make the target answer more in line with user expectations.

[0004] To solve the above technical problems, the first aspect of the present application provides a question-answering method, which includes: obtaining a target question; using a trained question-answering model to give a target answer based on the target question; wherein the question-answering model is iteratively trained based on at least two predicted answers to a first sample question, and the scores of at least two predicted answers are different; the score of the predicted answer is obtained by a trained classification model, and the classification model is iteratively trained based on a sample reference answer to a second sample question and a sample predicted answer to the second sample question.

[0005] To solve the above technical problems, the second aspect of the present application provides a question-answering model training method, the method comprising: obtaining a first sample question; using the question-answering model to make predictions based on the first sample question to obtain at least two predicted answers; wherein the scores of at least two predicted answers are different, and the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer of the second sample question and the sample predicted answer of the second sample question; based on the at least two predicted answers, determining the target loss; and adjusting the network parameters of the question-answering model based on the target loss.

[0006] In order to solve the above technical problems, the third aspect of the present application provides a question-answering device, which includes: a first acquisition module and a first question-answering module. The first acquisition module is used to acquire a target question; the first question-answering module is used to give a target answer based on the target question using a trained question-answering model; wherein the question-answering model is iteratively trained based on at least two predicted answers to the first sample question, and the scores of the at least two predicted answers are different; the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question.

[0007] To solve the above technical problems, the fourth aspect of the present application provides a question-answering model training device, which includes: a second acquisition module, a second question-answering module, a loss determination module and a parameter adjustment module, the second acquisition module is used to acquire a first sample question; the second question-answering module is used to use the question-answering model to make predictions based on the first sample question to obtain at least two predicted answers; wherein the scores of at least two predicted answers are different, and the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer of the second sample question and the sample predicted answer of the second sample question; the loss determination module is used to determine the target loss based on at least two predicted answers; the parameter adjustment module is used to adjust the network parameters of the question-answering model based on the target loss.

[0008] To solve the above technical problems, the fifth aspect of the present application provides an electronic device, which includes a processor and a memory, wherein program instructions are stored in the memory, and the processor is used to execute the program instructions to implement the method provided in the first aspect or the second aspect.

[0009] In order to solve the above technical problems, the sixth aspect of the present application provides a computer-readable storage medium, which stores program instructions, and the program instructions are used to implement the method provided by the first aspect or the second aspect above.

[0010] The beneficial effect of the present application is that, different from the prior art, the present application uses a trained question-answering model to give a target answer based on a target question. The question-answering model is iteratively trained based on at least two predicted answers to the first sample question, and the scores of at least two predicted answers are different; the score of the predicted answer is obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question. By training the classification model, it is able to distinguish between the model predicted answer and the reference answer, and give the score of the predicted answer, and then the question-answering model is trained using at least two predicted answers with different scores, so that the question-answering model tends to generate answers with higher scores, which can make the target answer given by the question-answering model more in line with human preferences, so as to improve the accuracy of the target answer. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is a flowchart of an implementation method of the question-answering method provided by this application;

[0012] Figure 2 It is a flowchart of an implementation method of a question-answering model training method provided in this application;

[0013] Figure 3 It is a schematic diagram of the framework structure of an implementation method of a question-answering device provided by the present application;

[0014] Figure 4 It is a schematic diagram of the framework structure of an implementation method of a question-answering model training device provided by the present application;

[0015] Figure 5 It is a schematic diagram of the framework structure of an embodiment of an electronic device provided by the present application;

[0016] Figure 6 It is a schematic diagram of the framework structure of an implementation scheme of a computer-readable storage medium provided in this application. DETAILED DESCRIPTION

[0017] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 without creative work are within the scope of protection of this application.

[0018] It should be noted that in the embodiments of the present application, there are descriptions involving "first," "second," etc., which are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first," "second" may explicitly or implicitly include at least one of the features.

[0019] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0020] See also Figure 1 , Figure 1 It is a flowchart of an implementation method of the question-answering method provided by the present application, and the method comprises:

[0021] S11: Get the target question.

[0022] In one embodiment, the target question may be a question in any field. For example, the target question may be in the fields of medicine, education, etc. In a specific embodiment, the target question may be a question related to the knowledge in the supplementary teaching materials.

[0023] S12: Use the trained question-answering model to give the target answer based on the target question.

[0024] The target question is input into the question-answering model, which processes the target question and outputs the target answer.

[0025] In one embodiment, the question-answering model is iteratively trained based on at least two predicted answers to a first sample question, and the scores of the at least two predicted answers are different; the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on a sample reference answer to a second sample question and a sample predicted answer to the second sample question.

[0026] Specifically, the first sample question and the second sample question may belong to the same field as the target question. The first sample question is input into the question-answering model to be trained. The question-answering model outputs at least two predicted answers. Each predicted answer has a score. The score of the predicted answer is obtained by a trained classification model. The scores of each predicted answer may be different. The classification model is iteratively trained based on the sample reference answer of the second sample question and the sample predicted answer of the second sample question.

[0027] The above method uses a trained question-answering model to give a target answer based on the target question. The question-answering model is iteratively trained based on at least two predicted answers to the first sample question, and the scores of at least two predicted answers are different; the score of the predicted answer is obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question. By training the classification model, it can distinguish between the model predicted answer and the reference answer, and give the score of the predicted answer, and then use at least two predicted answers with different scores to train the question-answering model, so that the question-answering model tends to generate answers with higher scores, so that the target answer given by the question-answering model can be more in line with human preferences, so as to improve the accuracy of the target answer.

[0028] In one embodiment, the training process of the question-answering model includes: obtaining a first sample question, and inputting the first sample question into the question-answering model of the current round of training and the question-answering model of the first round of training respectively. The question-answering model of the current round of training and the question-answering model of the first round of training respectively give at least two predicted answers for the first sample question. Among them, in the first round of training, the question-answering model of the current round of training is the question-answering model of the first round of training; in the second round of training, the question-answering model of the current round of training is the question-answering model after the parameters are adjusted by the first round of training; in the third round of training, the question-answering model of the current round of training is the question-answering model after the parameters are adjusted by the second round of training. The question-answering model of the first round of training can be a large language model that has been fine-tuned with supervision. Based on at least two predicted answers obtained by the question-answering model of the current round of training and at least two predicted answers obtained by the question-answering model of the first round of training, the target loss is determined; based on the target loss, the network parameters of the question-answering model of the current round of training are adjusted.

[0029] In a specific implementation, taking the case where the predicted answers include two, the question-answering model of the current round of training outputs the first predicted answer and the second predicted answer for the first sample question, and the question-answering model of the first round of training outputs the third predicted answer and the fourth predicted answer for the first sample question, and the score of one of the first predicted answer and the second predicted answer is higher than the score of the other, and the score of one of the third predicted answer and the fourth predicted answer is higher than the score of the other. Based on the first predicted answer, the second predicted answer, the third predicted answer, and the fourth predicted answer, the target loss is determined. Among them, the loss function for determining the target loss can be shown in the following formula 1.

[0030]

[0031] in, is the target loss, represents the question-answering model of the current round of training, represents the question-answering model in the first round of training, represents the first predicted answer, represents the third predicted answer, represents the second predicted answer, Indicates the fourth predicted answer, the score of the first predicted answer is higher than the second predicted answer, and the score of the third predicted answer is higher than the fourth predicted answer. Express expectations, Represents the preference data set The data triplet sampled from , where x represents the problem, y w indicates the predicted answer with a higher score, y l indicates a predicted answer with a lower score. β is a temperature parameter that adjusts the effect of the log scale.

[0032] By minimizing the loss function in Formula 1, the question-answering model in the current round of training can be optimized to tend to generate answers with higher scores. In this way, the quality of the answers generated by the model will gradually improve, and ultimately achieve better decisions.

[0033] It can be understood that during the first round of training, only the first predicted answer and the second predicted answer can be used to adjust the parameters of the question-answering model. At this time, the loss function can be shown as shown in the following formula 2.

[0034]

[0035] In one embodiment, at least two predicted answers can be selected from a number of predicted answers. For example, the top five answers with higher scores can be selected from a number of predicted answers as predicted answers. In a specific embodiment, taking the case where the predicted answers include two, the question-answering model trained in the current round is obtained to predict the first sample question and obtain the predicted answers; or the question-answering model trained in the first round is obtained to predict the first sample question and obtain the predicted answers, and then the classification model is used to score each predicted answer to obtain the scores of the predicted answers, and the target predicted answer is selected from the predicted answers according to the scores of the predicted answers. Assuming that the predicted answers are output by the question-answering model trained in the current round, the selected target predicted answers may be the first predicted answer and the second predicted answer; assuming that the predicted answers are output by the question-answering model trained in the first round, the selected target predicted answers may be the third predicted answer and the fourth predicted answer.

[0036] In one embodiment, two predicted answers with the highest scores can be selected from a number of predicted answers as target predicted answers. In another embodiment, the predicted answer with the highest score and the predicted answer with the lowest score can also be selected as target predicted answers.

[0037] In the above implementation, the score of the predicted answer is given by a classification model. The classification model can be a module in the question-answering model or a separate model, which is not specifically limited here.

[0038] The training process of the classification model may include: obtaining a second sample question, a sample predicted answer to the second sample question, and a sample reference answer to the second sample question. The second sample question may be the same as or different from the first sample question. The sample predicted answer to the second sample question is predicted by the question-answering model obtained by the previous round of training for the second sample question. When the classification model is trained for the first round, the sample predicted answer is predicted by the question-answering model trained in the first round for the second sample question. Based on the sample reference answer and the sample predicted answer, the cross entropy loss is determined; based on the cross entropy loss, the parameters of the classification model are adjusted. The cross entropy loss function is shown in Formula 3.

[0039]

[0040] in, represents the cross entropy loss; N represents the number of second sample questions; r φ represents a classifier that receives questions and answers as input and then outputs a real score; σ(·) is a sigmoid function that maps values ​​to the (0,1) interval. For sample reference answers with high accuracy, we hope that the classification model will output a higher score, that is, σ(r φ (y i ,x i )) is close to 1; for the answers generated by the model with lower accuracy, we hope that the classification model outputs a lower score, that is, Close to 0. By minimizing the loss function, the optimal parameters of the classification model can be obtained.

[0041] After training the classification model, when we input a new question and answer, the output size of the classification model can directly reflect the closeness between the distribution of the input answer and the distribution of the reference answer. When the classification model outputs a higher score, it means that the distribution of the input answer is closer to the distribution of the reference answer, and its accuracy is higher, that is, it is more in line with human preferences; on the contrary, when the classification model outputs a lower score, it means that the distribution of the input answer is more different from the distribution of the reference answer, and its accuracy is lower, that is, it is less in line with human preferences. Therefore, we use the output score of the classification model to reflect the quality of the predicted answer generated by the question-answering model, which can be directly used as a reward signal for reinforcement learning.

[0042] In one embodiment, the first sample question and the second sample question both belong to the field of education, and the first sample question, the second sample question and the sample reference answer can be extracted from teaching materials. The sample reference answer does not need to be manually annotated, which can save manual annotation costs.

[0043] See also Figure 2 , Figure 2 It is a flowchart of an implementation method of a question-answering model training method provided by the present application, and the method includes:

[0044] S21: Obtain the first sample question.

[0045] S22: Use the question-answering model to make predictions based on the first sample question to obtain at least two predicted answers.

[0046] Among them, the scores of at least two predicted answers are different, and the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question.

[0047] S23: Determine a target loss based on at least two predicted answers.

[0048] S24: Adjust the network parameters of the question-answering model based on the target loss.

[0049] In a specific implementation, a binary classification data set can be first constructed to train the classification model, and the second sample question and the sample reference answer of the second sample question can be extracted from the supplementary teaching materials. In the first round of training, the second sample question is input into the question-answering model of the first round of training, and the question-answering model of the first round of training outputs the sample predicted answer of the second sample question; a binary classification data set is constructed based on the second sample question, the sample reference answer of the second sample question, and the sample predicted answer of the second sample question, and the data in the binary classification data set is input into the classification model, and the classification model outputs the cross entropy loss. The loss function used by the classification model is referred to the above description, which is not repeated here. The network parameters of the classification model are adjusted using the cross entropy loss, and the first round of training of the classification model is completed. The reference answers in the supplementary teaching materials are used as positive samples, and the predicted answers output by the model are used as negative samples. The collection cost of supplementary teaching materials is much lower than that of manually annotated data, which makes it an efficient resource. More importantly, the reference answers in these supplementary teaching materials contain information that is aligned with human preferences, and the existing technology has not yet fully utilized this information to achieve the ideal alignment effect.

[0050] Furthermore, a first sample question is obtained. The first sample question is different from the second sample question, and the first sample question can also be extracted from supplementary teaching materials. The first sample question is input into the question-answering model of the first round of training. The question-answering model outputs several predicted answers. The classification model that has completed the first round of training is used to score the several predicted answers, and the two predicted answers with the highest scores are selected as the first predicted answer and the second predicted answer, respectively. According to the first predicted answer and the second predicted answer, the target loss is determined. Please refer to the above description for the determination of the target loss, which will not be repeated here. The network parameters of the question-answering model are adjusted using the target loss. At this point, the first round of training of the question-answering model is completed.

[0051] In the initial iteration stage, the reliability of the classification model in evaluating different answers generated by the model is reduced due to the large difference in distribution between the answers generated by the question-answering model and the reference answers. In order to improve the alignment quality, the classification model can be updated multiple times. If the classification model is not optimized for multiple iterations, and only the question-answering model is optimized multiple times, the answers generated by the question-answering model after multiple iterations are closer to the reference answers in distribution, which makes it difficult for the classification model to distinguish between the predicted answers and the reference answers by simple methods. On the contrary, the classification model needs to rely on more detailed features to distinguish between the answers generated by the model and the reference answers, so that the classification model can more accurately judge the quality of the answers generated by the model and provide more reliable reward signals. In addition, if the classification model trained in the initial stage continues to be used in subsequent reinforcement learning iterations, it may cause the old classification model to be unable to accurately evaluate the quality of the answers output by the new question-answering model, and thus cannot reliably optimize the strategy. Therefore, in order to improve the model accuracy, the classification model and the question-answering model can be iteratively trained.

[0052] In the second round of training, the second sample question can be input into the question-answering model that has completed the first round of training to obtain a new sample prediction answer. The classification model is trained based on the second sample question, the sample reference answer and the new sample prediction answer to complete the second round of training of the classification model. Further, after the question-answering model outputs several prediction answers for the first sample question, the classification model that has completed the second round of training is used to score the several prediction answers to obtain a new first prediction answer and a new second prediction answer. In addition, the first sample question is input into the question-answering model that has completed the first round of training. The question-answering model also outputs several prediction answers. The classification model that has completed the second round of training is used to score the several prediction answers, and the two prediction answers with the highest scores are selected as the third prediction answer and the fourth prediction answer, respectively. The target loss is determined based on the new first prediction answer, the new second prediction answer, the third prediction answer and the fourth prediction answer, and the network parameters of the question-answering model are adjusted using the target loss. At this point, the second round of training of the question-answering model is completed. Repeat the above steps for multiple iterative trainings.

[0053] See also Figure 3 , Figure 3 It is a schematic diagram of the framework structure of an implementation method of the question-answering device provided in this application.

[0054] The question-answering model 30 includes a first acquisition module 31 and a first question-answering module 32. The first acquisition module 31 is used to acquire the target question; the first question-answering module 32 is used to use the trained question-answering model to give a target answer based on the target question; wherein the question-answering model is iteratively trained based on at least two predicted answers to the first sample question, and the scores of at least two predicted answers are different; the score of the predicted answer is obtained by the trained classification model, and the classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question.

[0055] In one embodiment, the question-answering model 30 may also include a training module, which is used to perform iterative training based on at least two predicted answers to the first sample question. Specifically, the training module obtains the question-answering model of the current round of training to predict the first sample question and obtains at least two predicted answers; and obtains the question-answering model of the first round of training to predict the first sample question and obtains at least two predicted answers; determines the target loss based on the at least two predicted answers obtained by the question-answering model of the current round of training and the at least two predicted answers obtained by the question-answering model of the first round of training; and adjusts the network parameters of the question-answering model of the current round of training based on the target loss.

[0056] In one embodiment, the at least two predicted answers given by the question-answering model in the current round of training include a first predicted answer and a second predicted answer, and the at least two predicted answers given by the question-answering model in the first round of training include a third predicted answer and a fourth predicted answer.

[0057] In one embodiment, the training module obtains at least two predicted answers from the question-answering model of the current round of training for the first sample question; or obtains at least two predicted answers from the question-answering model of the first round of training for the first sample question, including: obtaining several predicted answers from the target question-answering model for the first sample question; selecting a target predicted answer from the several predicted answers; wherein the target question-answering model is the question-answering model of the current round of training, and the target predicted answer is the first predicted answer and the second predicted answer; or, the target question-answering model is the question-answering model of the first round of training, and the target predicted answer is the third predicted answer and the fourth predicted answer.

[0058] In one embodiment, selecting a target predicted answer from a plurality of predicted answers includes: obtaining scores of the plurality of predicted answers, and selecting two predicted answers with top scores as the target predicted answers.

[0059] In one embodiment, the training module is further used to perform iterative training based on the sample reference answer of the second sample question and the sample predicted answer of the second sample question. Specifically, the training module determines the cross entropy loss based on the second sample question, the sample reference answer and the sample predicted answer; and adjusts the parameters of the classification model based on the cross entropy loss.

[0060] In one embodiment, the sample prediction answer is predicted by the question-answering model obtained by the previous round of training for the second sample question; wherein, when the classification model is trained for the first round, the sample prediction answer is predicted by the question-answering model trained in the first round for the second sample question.

[0061] In one embodiment, the second sample question and the sample reference answer are extracted from supplementary teaching materials.

[0062] See also Figure 4 , Figure 4 It is a schematic diagram of the framework structure of an implementation method of the question-answering model training device provided in this application.

[0063] The question-answering model training device 40 includes a second acquisition module 41, a second question-answering module 42, a loss determination module 43 and a parameter adjustment module 44. The second acquisition module 41 is used to obtain a first sample question; the second question-answering module 42 is used to use the question-answering model to make predictions based on the first sample question to obtain at least two predicted answers; wherein the scores of at least two predicted answers are different, and the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer of the second sample question and the sample predicted answer of the second sample question; the loss determination module 43 is used to determine the target loss based on at least two predicted answers; the parameter adjustment module 44 is used to adjust the network parameters of the question-answering model based on the target loss.

[0064] See also Figure 5 , Figure 5 It is a schematic diagram of the framework structure of an embodiment of an electronic device provided in the present application.

[0065] The electronic device 50 includes a memory 51 and a processor 52 coupled to each other, the memory 51 stores program instructions, and the processor 52 is used to execute the program instructions stored in the memory 51 to implement the steps of any of the above method implementations. In a specific implementation scenario, the electronic device 50 may include, but is not limited to: a microcomputer, a server, and in addition, the electronic device 50 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0066] Specifically, the processor 52 is used to control itself and the memory 51 to implement the steps of any of the above-mentioned method implementation methods. The processor 52 can also be called a CPU (Central Processing Unit). The processor 52 may be an integrated circuit chip with signal processing capabilities. The processor 52 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 52 can be implemented by an integrated circuit chip.

[0067] See also Figure 6 , Figure 6 It is a schematic diagram of the framework structure of an implementation scheme of a computer-readable storage medium provided in this application.

[0068] The computer-readable storage medium 60 stores program instructions 61 , and when the program instructions 61 are executed by a processor, they are used to implement the steps of any of the above-mentioned method implementations.

[0069] The computer-readable storage medium 60 may specifically be a medium that can store computer programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server that stores the computer program. The server may send the stored computer program to other devices for execution, or may also execute the stored computer program itself.

[0070] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0071] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0073] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0074] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0075] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0076] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A question-answering method, characterized in that: include: Get the target question; A target answer is given based on the target question using a trained question-answering model; wherein the question-answering model is iteratively trained based on at least two predicted answers to a first sample question, and the scores of the at least two predicted answers are different; the score of the predicted answer is obtained by a trained classification model, and the classification model is iteratively trained based on a sample reference answer to a second sample question and a sample predicted answer to the second sample question.

2. The method according to claim 1, characterized in that The question-answering model is iteratively trained based on at least two predicted answers to the first sample question, including: Obtain the question-answering model of the current round of training to make predictions for the first sample question, and obtain the at least two predicted answers; and obtain the question-answering model of the first round of training to make predictions for the first sample question, and obtain the at least two predicted answers; Determine a target loss based on the at least two predicted answers obtained by the question-answering model in the current round of training and the at least two predicted answers obtained by the question-answering model in the first round of training; Based on the target loss, adjust the network parameters of the question-answering model in the current round of training.

3. The method according to claim 2, characterized in that The at least two predicted answers given by the question-answering model of the current round of training include a first predicted answer and a second predicted answer, and the at least two predicted answers given by the question-answering model of the first round of training include a third predicted answer and a fourth predicted answer; The obtaining of the at least two predicted answers obtained by performing prediction on the first sample question by the question-answering model trained in the current round; Alternatively, the question-answering model obtained through the first round of training performs prediction on the first sample question, and obtains at least two predicted answers, including: Obtaining a number of predicted answers obtained by the target question-answering model for the first sample question; Selecting a target predicted answer from the plurality of predicted answers; Among them, the target question and answer model is the question and answer model of the current round of training, and the target predicted answer is the first predicted answer and the second predicted answer; or, the target question and answer model is the question and answer model of the first round of training, and the target predicted answer is the third predicted answer and the fourth predicted answer.

4. The method according to claim 3, characterized in that The step of selecting a target predicted answer from the plurality of predicted answers comprises: The scores of the plurality of predicted answers are obtained, and the two predicted answers with the highest scores are selected as the target predicted answers.

5. The method according to claim 1, characterized in that The classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question, including: Determining a cross entropy loss based on the second sample question, the sample reference answer, and the sample predicted answer; Based on the cross entropy loss, parameters of the classification model are adjusted.

6. The method according to claim 1 or 5, characterized in that: The sample predicted answer is predicted by the question-answering model obtained in the previous round of training for the second sample question; wherein, when the classification model undergoes the first round of training, the sample predicted answer is predicted by the question-answering model in the first round of training for the second sample question.

7. The method according to claim 1, characterized in that The second sample question and the sample reference answer are extracted from supplementary teaching materials.

8. A question-answering model training method, characterized in that: include: Get the first sample problem; Using the question-answering model to make predictions based on the first sample question, obtaining at least two predicted answers; wherein the scores of the at least two predicted answers are different, and the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question; determining a target loss based on the at least two predicted answers; Based on the target loss, network parameters of the question-answering model are adjusted.

9. A question-answering device, characterized in that: include: The first acquisition module is used to acquire the target problem; The first question-and-answer module is used to use a trained question-and-answer model to give a target answer based on the target question; wherein the question-and-answer model is iteratively trained based on at least two predicted answers to a first sample question, and the scores of the at least two predicted answers are different; the score of the predicted answer is obtained by a trained classification model, and the classification model is iteratively trained based on a sample reference answer to a second sample question and a sample predicted answer to the second sample question.

10. A question-answering model training device, characterized in that: include: A second acquisition module, used for acquiring a first sample question; A second question-answering module is configured to use the question-answering model to make predictions based on the first sample question to obtain at least two predicted answers; wherein the scores of the at least two predicted answers are different, and the scores of the predicted answers are obtained by a trained classification model, and the classification model is iteratively trained based on the sample reference answer to the second sample question and the sample predicted answer to the second sample question; a loss determination module, configured to determine a target loss based on the at least two predicted answers; A parameter adjustment module is used to adjust the network parameters of the question-answering model based on the target loss.

11. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the method according to any one of claims 1 to 8.

12. A computer-readable storage medium, characterized in that: The storage medium stores program instructions, and the program instructions are used to implement the method according to any one of claims 1 to 8.