A multi-hop question and answer model training method and device
By iterative training and parameter tuning of the multi-hop question answering model, the impact of noisy data on the training of the multi-hop question answering model was resolved, and the accuracy of the model was improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2026-07-10
AI Technical Summary
In the training of existing multi-hop question answering models, the presence of noisy data affects the model performance and increases the difficulty of convergence. How to reduce the impact of noisy data to improve the accuracy of the model has become an urgent problem to be solved.
By iteratively training the question-and-answer sample data, the first and second multi-hop question-and-answer models are used to identify and adjust the noisy data respectively. Different parameter update formulas are used to train the models, and the loss value is calculated by combining the noise label and the standard answer to optimize the model.
It effectively improved the training effect of multi-hop question answering models, reduced the impact of noisy data on model training, and improved the accuracy of the models.
Smart Images

Figure CN118113819B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method and device for training a multi-hop question-answering model. Background Technology
[0002] To achieve good results, existing deep learning models often require training data on the order of hundreds of thousands. Under such circumstances, data collection typically requires a collaborative effort with a division of labor to ensure rapid results. However, training multi-hop question-answering models based on knowledge graphs requires not only graph data but also question-answering data. The collection of large-scale graph and question-answering data necessitates a collaborative effort, and during this process, noise inevitably arises in the collected data—a mismatch between the graph data and the question-answering data, such as typos or incorrect entity relationships.
[0003] When noisy data is present in the training data, it will affect the training effect of multi-hop question answering models and increase the difficulty of convergence.
[0004] Therefore, how to reduce the impact of noisy data on the training of multi-hop question answering models in order to improve the accuracy of multi-hop question answering models has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a multi-hop question-answering model training method and device to solve the problem that noisy data affects the training effect of multi-hop question-answering models in the prior art.
[0006] Firstly, this application provides a method for training a multi-hop question-answering model, the method comprising:
[0007] The question-and-answer sample data is used for a first set number of iterations. Each iteration includes:
[0008] Obtain question and answer sample data, corresponding standard answers, and noise indicators to determine whether the question and answer sample data is noisy data from the sample set;
[0009] The question-and-answer sample data and the noise identifier are input into the first multi-hop question-and-answer model. If the first multi-hop question-and-answer model determines that the question-and-answer sample data is noise data based on the noise identifier, the first identification answer output by the first multi-hop question-and-answer model is obtained. Based on the first identification answer and the standard answer, the first loss value corresponding to the question-and-answer sample data is determined, and the first multi-hop question-and-answer model is trained based on the first loss value.
[0010] The question-and-answer sample data is input into the second multi-hop question-and-answer model to obtain the second recognized answer output by the second multi-hop question-and-answer model; based on the second recognized answer and the standard answer, the second loss value corresponding to the question-and-answer sample data is determined; and the second multi-hop question-and-answer model is trained based on the second loss value.
[0011] After a second set number of iterations, the parameters of the first multi-hop question answering model are obtained, and the parameters of the second multi-hop question answering model are adjusted using the parameters.
[0012] Secondly, this application provides a multi-hop question-answering model training device, the device comprising:
[0013] The acquisition module is used to acquire question and answer sample data, corresponding standard answers, and noise indicators of whether the question and answer sample data is noisy data from the sample set.
[0014] The first training module is used to input the question-and-answer sample data and the noise label into the first multi-hop question-and-answer model. If the first multi-hop question-and-answer model determines that the question-and-answer sample data is noise data according to the noise label, it obtains the first recognition answer output by the first multi-hop question-and-answer model. Based on the first recognition answer and the standard answer, it determines the first loss value corresponding to the question-and-answer sample data, and trains the first multi-hop question-and-answer model based on the first loss value.
[0015] The second training module is used to input the question-and-answer sample data into the second multi-hop question-and-answer model, obtain the second recognized answer output by the second multi-hop question-and-answer model, determine the second loss value corresponding to the question-and-answer sample data based on the second recognized answer and the standard answer, and train the second multi-hop question-and-answer model based on the second loss value.
[0016] The adjustment module is used to obtain the parameters of the first multi-hop question answering model after a second set number of iterations, and to adjust the parameters of the second multi-hop question answering model using the parameters.
[0017] Thirdly, this application also provides an electronic device, which includes at least a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the steps of any of the above-described multi-hop question-answering model training methods.
[0018] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the above-described multi-hop question-answering model training methods.
[0019] In this embodiment, when training the multi-hop question-answering model, question-answer sample data and corresponding noise labels are input into the first multi-hop question-answering model. If the first multi-hop question-answering model determines the question-answer sample data to be noise based on the noise labels, it obtains the first recognized answer output by the first multi-hop question-answering model. Based on the first recognized answer and the corresponding standard answer, a first loss value is determined. The first multi-hop question-answering model is then trained based on the first loss value. Simultaneously, the question-answer sample data is input into the second multi-hop question-answering model, and the second recognized answer output by the second multi-hop question-answering model is obtained. Based on the second recognized answer and the corresponding standard answer, a second loss value is determined. The second multi-hop question-answering model is then trained based on the second loss value. After a second set number of iterations, the parameters of the second multi-hop question-answering model are adjusted using the parameters of the first multi-hop question-answering model, effectively improving the training effect of the multi-hop question-answering model. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram illustrating the training process of a multi-hop question-answering model provided in an embodiment of this application.
[0022] Figure 2 A schematic diagram illustrating the training process of the first multi-hop question-answering model provided in this application embodiment;
[0023] Figure 3 This is a schematic diagram illustrating the training process of the second multi-hop question-answering model provided in an embodiment of this application.
[0024] Figure 4 This is a schematic diagram of noise estimation rounds provided in an embodiment of this application;
[0025] Figure 5 A schematic diagram of the noise estimation process provided in the embodiments of this application;
[0026] Figure 6 This is a schematic diagram illustrating the training process of the multi-hop question-answering model provided in an embodiment of this application.
[0027] Figure 7 This is a schematic diagram illustrating the training process of another multi-hop question-answering model provided in an embodiment of this application;
[0028] Figure 8 A schematic diagram of each iteration process provided in the embodiments of this application;
[0029] Figure 9 This is a schematic diagram of the structure for training a multi-hop question-answering model provided in an embodiment of this application;
[0030] Figure 10 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art are within the scope of protection of this application.
[0032] This application provides a method and apparatus for training a multi-hop question-answering model. The method involves performing a first predetermined number of iterations on question-answering sample data. Each iteration includes: acquiring question-answering sample data, the corresponding standard answer, and a noise identifier indicating whether the question-answering sample data is noise data from a sample set; inputting the question-answering sample data and the noise identifier into a first multi-hop question-answering model; if the first multi-hop question-answering model determines the question-answering sample data to be noise data based on the noise identifier, acquiring the first identification answer output by the first multi-hop question-answering model; determining the first loss value corresponding to the question-answering sample data based on the first identification answer and the standard answer; training the first multi-hop question-answering model based on the first loss value; inputting the question-answering sample data into a second multi-hop question-answering model; acquiring the second identification answer output by the second multi-hop question-answering model; determining the second loss value corresponding to the question-answering sample data based on the second identification answer and the standard answer; training the second multi-hop question-answering model based on the second loss value; and after a second predetermined number of iterations, acquiring the parameters of the first multi-hop question-answering model and adjusting the parameters of the second multi-hop question-answering model using these parameters.
[0033] Figure 1 This application provides a schematic diagram of a multi-hop question-answering model training process, which includes the following steps:
[0034] S101: Perform a first set number of iterations on the question-and-answer sample data. Each iteration process includes: obtaining the question-and-answer sample data, the corresponding standard answer, and a noise identifier indicating whether the question-and-answer sample data is noise data.
[0035] The multi-hop question-answering model training method provided in this application embodiment is applied to electronic devices, such as servers and PCs.
[0036] In order to train a multi-hop question answering model with higher accuracy, in this embodiment of the application, a sample set is pre-configured, which includes multiple question answering sample data. The model can be trained by performing a first set number of iterations based on each question answering sample data contained in the sample set.
[0037] To facilitate subsequent training of the multi-hop question-answering model, each question-answer sample in the sample set corresponds to a standard answer and a noise identifier indicating whether each sample is noise data. This noise identifier can be manually reviewed and labeled; it can be either "noise" or "non-noise," or it can be a predefined code, such as code "1" representing noise data and code "2" representing non-noise data. In this embodiment, the question-answer sample data, the corresponding standard answer, and the noise identifier indicating whether the question-answer sample data is noise data can be obtained from the sample set.
[0038] S102: Input the question-and-answer sample data and the noise identifier into the first multi-hop question-and-answer model. If the first multi-hop question-and-answer model determines that the question-and-answer sample data is noise data according to the noise identifier, then obtain the first identification answer output by the first multi-hop question-and-answer model. Based on the first identification answer and the standard answer, determine the first loss value corresponding to the question-and-answer sample data, and train the first multi-hop question-and-answer model based on the first loss value.
[0039] When training the multi-hop question answering model, the acquired question answering sample data and the noise labels corresponding to the question answering sample data can be input into the first multi-hop question answering model. The first multi-hop question answering model is a multi-hop question answering model that has already embedded knowledge into the collected knowledge graph data. The relevant technologies have already explained in detail how to perform knowledge embedding, so it will not be repeated here.
[0040] After acquiring the input question-and-answer sample data and its corresponding noise identifier, the first multi-hop question-and-answer model can determine whether the sample data is noisy based on the noise identifier. If so, it trains the model based on the sample data and obtains the first recognized answer output by the model. Since the standard answer corresponding to the sample data is known, a first loss value can be determined based on the standard answer and the first recognized answer. The model is then trained based on this determined loss value.
[0041] In this embodiment, the first multi-hop question-answering model may also include a first sub-model and a second sub-model. The first sub-model identifies the answer to question-answer sample data whose noise label is non-noise data, and the second sub-model identifies the answer to question-answer sample data whose noise label is noise data. That is, after inputting the question-answer sample data and noise label into the first multi-hop question-answering model, the first multi-hop question-answering model determines whether the question-answer sample data is noise data based on the noise label. If so, the question-answer sample data is input into the first sub-model, and the identification answer output by the first sub-model is obtained. Based on the identification answer and the standard answer corresponding to the question-answer sample data, the loss value corresponding to the question-answer sample data is determined, and the first sub-model is trained based on the loss value. Otherwise, the question-answer sample data is input into the second sub-model, and the identification answer output by the second sub-model is obtained. Based on the identification answer and the standard answer corresponding to the question-answer sample data, the loss value corresponding to the question-answer sample data is determined, and the second sub-model is trained based on the loss value.
[0042] In this embodiment of the application, in order to reduce the impact of noisy data on model training, different parameter update formulas can be used for training the first sub-model and the second sub-model. Since the first sub-model is trained based on noisy data, an influence coefficient can be added to the parameter update formula of the first sub-model. The influence coefficient can weaken the impact of noisy data on parameter updates during training. The influence coefficient can be understood as a set weight. Generally, the value range of the influence coefficient is [0,1].
[0043] Specifically, the weight update formula for the first sub-model is:
[0044]
[0045] Among them, w + η is the updated weight, W is the original weight, η is the learning rate, Loss is the loss function, and ζ is the influence coefficient.
[0046] The formula for updating the bias term of the first sub-model is:
[0047]
[0048] Among them, b + η is the updated bias term, b is the original bias term, η is the learning rate, Loss is the loss function, and ζ is the influence coefficient.
[0049] The weight update formula for the second sub-model is:
[0050]
[0051] Among them, w +Let W be the updated weights, W be the original weights, η be the learning rate, and Loss be the loss function.
[0052] The formula for updating the bias term of the second sub-model is:
[0053]
[0054] Among them, b + η is the updated bias term, b is the original bias term, η is the learning rate, and Loss is the loss function.
[0055] In this embodiment of the application, if the first multi-hop question-answering model is only used to train and identify question-answer sample data labeled as noise data, then the parameter update formula of the first multi-hop question-answering model is the formula described above. and
[0056] S103: Input the question-and-answer sample data into the second multi-hop question-and-answer model to obtain the second identification answer output by the second multi-hop question-and-answer model; determine the second loss value corresponding to the question-and-answer sample data based on the second identification answer and the standard answer; and train the second multi-hop question-and-answer model based on the second loss value.
[0057] While training the first multi-hop question-answering model based on the acquired question-answering sample data, the acquired question-answering sample data can also be input into the second multi-hop question-answering model, and the second recognized answer output by the second multi-hop question-answering model can be obtained. Since the standard answer corresponding to each question-answering sample data is known, the second loss value corresponding to the question-answering sample data can be determined based on the second recognized answer and the standard answer, and the second multi-hop question-answering model can be trained.
[0058] S104: After a second set number of iterations, obtain the parameters of the first multi-hop question answering model, and use the parameters to adjust the parameters of the second multi-hop question answering model.
[0059] In this embodiment, a second predetermined number is preset. After this second predetermined number of iterations, the parameters of the first multi-hop question-answering model can be obtained, and the obtained parameters are used to adjust the parameters of the second multi-hop question-answering model. The second predetermined number can be one or more, and it is less than or equal to the first predetermined number. That is, when training the multi-hop question-answering model, the parameters of the first multi-hop question-answering model can be used to adjust the parameters of the second multi-hop question-answering model multiple times.
[0060] In the embodiments of this application, a convergence condition is preset. The convergence condition may be that the number of times the identified answer of each question and answer sample data obtained after training the first multi-hop question and answer model and the second multi-hop question and answer model in the sample set is consistent with the corresponding standard answer is greater than a preset threshold; or it may be that the number of iterations of training the first multi-hop question and answer model and the second multi-hop question and answer model reaches a set first preset number, etc. The specific embodiments of this application do not limit this.
[0061] After the multi-hop question answering model training meets the convergence condition, the trained second multi-hop question answering model can be determined as the target multi-hop question answering model. When the model is applied, the answer is identified based on the target multi-hop question answering model.
[0062] In this embodiment, when training the multi-hop question-answering model, question-answer sample data and corresponding noise labels are input into the first multi-hop question-answering model. If the first multi-hop question-answering model determines the question-answer sample data to be noise based on the noise labels, it obtains the first recognized answer output by the first multi-hop question-answering model. Based on the first recognized answer and the corresponding standard answer, a first loss value is determined. The first multi-hop question-answering model is then trained based on the first loss value. Simultaneously, the question-answer sample data is input into the second multi-hop question-answering model, and the second recognized answer output by the second multi-hop question-answering model is obtained. Based on the second recognized answer and the corresponding standard answer, a second loss value is determined. The second multi-hop question-answering model is then trained based on the second loss value. After a set number of iterations, the parameters of the second multi-hop question-answering model are adjusted using the parameters of the first multi-hop question-answering model, effectively improving the training effect of the multi-hop question-answering model.
[0063] The following is combined with Figure 2 The training process of the first multi-hop question answering model will be explained. Figure 2 This is a schematic diagram of the training process of the first multi-hop question answering model provided in an embodiment of this application. The process includes the following steps:
[0064] S201: Determine whether the corresponding question and answer sample data is noisy based on the noise identifier. If yes, proceed to S202; otherwise, proceed to 204.
[0065] S202: Input the question-and-answer sample data into the first sub-model and obtain the recognition answer output by the first sub-model.
[0066] S203: Determine the loss value based on the recognized answer and the standard answer output by the first sub-model, and train the first sub-model based on the loss value.
[0067] S204: Input the question-and-answer sample data into the second sub-model and obtain the recognition answer output by the second sub-model.
[0068] S205: Determine the loss value based on the recognized answer and the standard answer output by the second sub-model, and train the second sub-model based on the loss value.
[0069] The following is combined with Figure 3 The training process of the second multi-hop question answering model will be explained. Figure 3 This is a schematic diagram of the training process of the second multi-hop question answering model provided in an embodiment of this application. The process includes the following steps:
[0070] S301: Input the obtained question-and-answer sample data into the second multi-hop question-and-answer model.
[0071] S302: Obtain the second recognized answer output by the second multi-hop question answering model.
[0072] S303: Based on the second identification answer and the standard answer, determine the second loss value corresponding to the question-and-answer sample data, and train the second multi-hop question-and-answer model based on the second loss value.
[0073] To further improve the accuracy of the multi-hop question-answering model, based on the above embodiments, in this application embodiment, obtaining the parameters of the first multi-hop question-answering model and adjusting the parameters of the second multi-hop question-answering model using the parameters includes:
[0074] Obtain the weights and biases in the first multi-hop question answering model, and adjust the weights and biases in the second multi-hop question answering model using the weights and biases.
[0075] To further improve the accuracy of the multi-hop question answering model, when obtaining the parameters of the first multi-hop question answering model, the latest weights and biases of the first multi-hop question answering model can be obtained. The obtained weights and biases are then used to adjust the weights and biases in the second multi-hop question answering model. This adjustment can be understood as replacement or modification, that is, replacing the latest weights and biases in the second multi-hop question answering model with the latest weights and biases of the first multi-hop question answering model.
[0076] To further improve the accuracy of the multi-hop question-answering model, based on the above embodiments, in this embodiment, if the noise labels of the question-answering sample data in the sample set are randomly generated, the method further includes:
[0077] If the number of iterations reaches the preset first noise estimation round, for each question and answer sample data, obtain the second loss value of the question and answer sample data in each iteration; and determine the first average loss value of the question and answer sample data based on each second loss value.
[0078] The first classification threshold is determined based on the first average loss value of each question-and-answer sample data.
[0079] Based on the first classification threshold and the first average loss value of each question and answer sample data, determine whether each question and answer sample data is noisy data, and adjust the noise label corresponding to each question and answer sample data according to the determination result.
[0080] Since the sample set contains a large amount of question-and-answer data, manually verifying each collected sample would be labor-intensive and inefficient. Therefore, in this embodiment, the noise identifier for each question-and-answer sample can be randomly generated.
[0081] To further improve the accuracy of the multi-hop question-answering model, multiple noise estimation rounds are pre-stored in this embodiment. When the noise labels for the question-answer sample data in the sample set are randomly generated, if the iteration count reaches the preset first noise estimation round, the electronic device can re-determine the noise label corresponding to each question-answer sample data in the sample set. The first noise estimation round can be understood as the first of the pre-stored multiple noise estimation rounds. In other words, reaching the preset first noise estimation round is the first round of noise estimation for each question-answer sample data in the sample set. Assuming the pre-stored multiple noise estimation rounds are 2, 6, 10, and 14, then the first noise estimation round is 2.
[0082] In this embodiment of the application, for each question and answer sample data, the second loss value of the question and answer sample data in each iteration can be obtained. After obtaining each second loss value of the question and answer sample data, the first average loss value of the question and answer sample data can be determined.
[0083] After determining the first average loss value for each question-and-answer sample data, the first classification threshold can be determined based on the first average loss value. When determining the first classification threshold, the average of each first average loss value can be used as the first classification threshold; alternatively, the mode of the first average loss values can be selected as the first classification threshold; or the median of each first average loss value can be used as the first classification threshold.
[0084] During model training, as the number of iterations increases, the model gradually transitions from underfitting to overfitting. In the early stages of training, the improvement in model accuracy is very significant because the network quickly learns the "simple, correct" sample data, as these samples correspond to smaller loss values. Conversely, "difficult" sample data is typically learned later in the training process. Observation of the training process reveals that noisy data is usually learned later in the training process. Therefore, in the early stages of training, the average loss value for noisy data is much larger than that for clean samples. However, in the later stages of training, as the network gradually learns all samples, the difference in loss values between the two types of samples becomes less significant. Throughout the entire training process, from underfitting to overfitting, the mean and variance of the loss values for noisy data are larger than those for non-noisy data. Therefore, the larger the mean and variance of the sample data, the greater the probability that the sample data belongs to noisy data.
[0085] In this embodiment, after determining the first classification threshold, it is possible to determine whether each question-and-answer sample data is noise data based on the first classification threshold and the first average loss value of each question-and-answer sample data. Specifically, in this embodiment, it can be predefined that question-and-answer sample data with a first average loss value greater than the first classification threshold is noise data, and question-and-answer sample data with a first average loss value less than or equal to the first classification threshold is non-noise data.
[0086] Once it is determined whether each question-and-answer sample data is noisy, the noise label corresponding to each question-and-answer sample data in the sample set can be adjusted based on the determination result.
[0087] Specifically, assuming the first noise estimation round is 3, after 3 iterations of the question-and-answer sample data, and the noise labels of the question-and-answer sample data in the sample set are randomly generated, in this embodiment, for each question-and-answer sample data, the second loss value of that sample data in these 3 iterations can be obtained, and the first average loss value of that sample data can be determined based on each second loss value. Assuming the first average loss values corresponding to each question-and-answer sample data are 1.5, 12.1, 10.2, and 2.7 respectively, then the average value of the first average loss value, 6.625, can be determined as the first classification threshold. Based on the determined first classification threshold and the first average loss value of each question-and-answer sample data, the question-and-answer sample data with first average loss values of 1.5 and 2.7 can be determined as non-noise data, and their noise labels can be adjusted to non-noise. The question-and-answer sample data with first average loss values of 12.1 and 10.2 are determined as noisy data, and their noise labels are adjusted to noise.
[0088] In this embodiment of the application, when determining whether the corresponding question and answer sample data is noisy data based on the first average loss value of each question and answer sample data, it is also possible to determine whether each question and answer sample data is noisy data based on a preset clustering algorithm. The preset clustering algorithm may be the K-Nearest Neighbor (KNN) algorithm.
[0089] To further improve the efficiency of multi-hop question answering model training, based on the above embodiments, in this embodiment, the process of determining the first noise estimation round includes:
[0090] The frequency of noise estimation is determined based on the first ratio of the first set quantity to the set number of noise estimations.
[0091] Half of the value of the frequency is determined as the first noise estimation round.
[0092] Since the number of iterations required during model training is relatively large, it would take a lot of time for staff to manually specify and input the noise estimation rounds. Therefore, in order to further improve the efficiency of multi-hop question answering model training, in this embodiment of the application, the electronic device can determine the frequency of noise estimation based on the preset number of iterations, i.e., the first ratio of the first preset number to the preset number of noise estimations, i.e., determine how many iterations are performed before noise estimation is performed.
[0093] Since it is necessary to determine whether each question-and-answer sample data is noisy data based on the second loss value when performing noise estimation, in this embodiment of the application, half of the determined value of the frequency can be determined as the first noise estimation round.
[0094] Specifically, assuming the first set quantity is 20 and the set number of noise estimations is 5, then the first ratio is 4. It can be determined that noise estimation is performed once every 4 iterations of training. In this embodiment, half of the frequency value of 4 can be determined as the first noise estimation round, so the first noise estimation round is 2.
[0095] To further improve the accuracy of the multi-hop question-answering model, based on the above embodiments, in this embodiment, if the noise labels of the question-answering sample data in the sample set are randomly generated, the method further includes:
[0096] If the number of iterations reaches the preset second noise estimation round, for each question and answer sample data identified as noise data, obtain each first loss value and each second loss value corresponding to the question and answer sample data, determine the second average loss value of each first loss value, and the third average loss value of each second loss value;
[0097] Determine the first sum of the second average loss values and the second sum of the third average loss values for each question-and-answer sample data identified as noisy data;
[0098] The noise coefficient is determined based on the ratio of the first sum and the second sum. The corrected loss value is determined based on the noise coefficient and the third average loss value corresponding to each question and answer sample data. The noise label of each question and answer sample data is adjusted based on the corrected loss value of each question and answer sample data.
[0099] In this embodiment, an influence coefficient is introduced into the parameter update formula of the first multi-hop question answering model. Because the introduction of this influence coefficient weakens the impact of suspected noisy data on the update of weights during training, this will lead to a further expansion of the average and variance of the loss values between noisy data and non-noisy data, and they may even be in different evaluation dimensions. This will cause the noise data suspected to be non-noisy data and the non-noisy data suspected to be noisy data to be incorrectly adjusted for noise labeling due to the introduction of the influence coefficient.
[0100] To further improve the accuracy of the multi-hop question-answering model, if the noise labels of the question-answer sample data in the sample set are randomly generated, and the number of iterations reaches the preset second noise estimation round, noise estimation can be performed again on each question-answer sample data in the sample set. The second noise estimation round is the round in which noise estimation is not performed for the first time. For example, if multiple noise estimation rounds are saved in advance as 2, 6, 10, and 14, then the other noise estimation rounds 6, 10, and 14, except for the first noise estimation round 2, are all second noise estimation rounds.
[0101] When the number of iterations reaches the preset second noise estimation round, in this embodiment of the application, for each question and answer sample data identified as noise data, each first loss value and second loss value corresponding to the question and answer sample data can be obtained, and the second average loss value of each first loss value and the third average loss value of each second loss value can be determined.
[0102] Specifically, assuming the number of iterations is 6, since the number of iterations has reached the preset second noise estimation round, in this embodiment of the application, for each question and answer sample data identified as noise data, each first loss value and second loss value corresponding to the question and answer sample data in the 3rd to 6th iterations can be obtained, and a second average loss value can be determined based on each obtained first loss value, and a third average loss value can be determined based on each obtained second loss value.
[0103] After determining the second and third average loss values for each question-and-answer sample data identified as noise data, the first sum of the second average loss values and the second sum of the third average loss values for each question-and-answer sample data identified as noise data can be determined. Specifically, the question-and-answer sample data identified as noise data are "How long does it take for the symptoms of iron poisoning complications to recover?" and "What are the commonly used drug types for hyperkalemia?". The second average loss value for "How long does it take for the symptoms of iron poisoning complications to recover?" is 12.1, and the third average loss value is 10.3. The second average loss value for "What are the commonly used drug types for hyperkalemia?" is 18.2, and the third average loss value is 4.2. Therefore, the first sum is 12.1 + 18.2 = 30.3, and the second sum is 10.3 + 4.2 = 14.5.
[0104] After determining the first sum and the second sum, in this embodiment of the application, the ratio of the first sum and the second sum can be determined as the noise figure. Specifically, based on the above embodiment, the noise figure is: (18.2+12.1) / (10.3+4.2)=2.05.
[0105] After determining the noise figure, the corrected loss value for each question-and-answer sample can be determined based on the noise figure and the third average loss value corresponding to each question-and-answer sample. In this embodiment, the corrected loss value can be determined as the ratio of the third average loss value corresponding to each question-and-answer sample to the noise figure.
[0106] Specifically, taking the question-and-answer sample data "What are the types of drugs commonly used for hyperkalemia?" as an example, the third mean loss value corresponding to this question-and-answer sample data is 4.2, then the corrected loss value corresponding to the question-and-answer sample data is 4.2 / 2.05 = 2.048.
[0107] After determining the corrected loss value for each question-and-answer sample data, the noise label for each question-and-answer sample data can be adjusted based on the corrected loss value.
[0108] In order to further improve the accuracy of the multi-hop question-answering model, when adjusting the noise label of each question-answering sample data according to the corrected loss value, based on the above embodiments, in this embodiment, the adjustment of the noise label of each question-answering sample data according to the corrected loss value of each question-answering sample data includes:
[0109] Based on the corrected loss value corresponding to each question-and-answer sample data, a second classification threshold is determined; based on the second classification threshold and the corrected loss value corresponding to each question-and-answer sample data, it is determined whether each question-and-answer sample data is noise data, and the noise label corresponding to each question-and-answer sample data is adjusted according to the determination result; or,
[0110] The modified loss value of each question-and-answer sample data is clustered based on a preset clustering algorithm, and the noise label corresponding to each question-and-answer sample data is adjusted according to the clustering results.
[0111] In this embodiment of the application, a second classification threshold can be determined based on the corrected loss value corresponding to each question and answer sample data. The second classification threshold can be the average value of each corrected loss value, the mode of the corrected loss values corresponding to each question and answer sample data, or the median of the corrected loss values corresponding to each question and answer sample data. The specific method of determining the second classification threshold is not limited in this embodiment of the application.
[0112] After determining the second classification threshold, in this embodiment, it is possible to determine whether each question-and-answer sample data is noise data based on the second classification threshold and the corrected loss value corresponding to each question-and-answer data. Specifically, assuming that question-and-answer sample data with a corrected loss value greater than the second classification threshold is predefined as noise data, and question-and-answer sample data with a corrected loss value not greater than the second classification threshold is defined as non-noise data, then in this embodiment, after determining the second classification threshold, it is possible to determine whether the corrected loss value corresponding to each question-and-answer sample data is greater than the second classification threshold. If it is, the question-and-answer sample data corresponding to the corrected loss value is determined as noise data, and the noise identifier corresponding to the question-and-answer sample data is modified to the identifier corresponding to noise data; otherwise, the question-and-answer sample data corresponding to the corrected loss value is determined as non-noise data, and the noise identifier corresponding to the question-and-answer sample data is modified to the identifier corresponding to non-noise data.
[0113] In this embodiment of the application, when adjusting the noise label of each question-and-answer sample data based on the corrected loss value of each question-and-answer sample data, the corrected loss value of each question-and-answer sample data can also be clustered based on a preset clustering algorithm, and the noise label corresponding to each question-and-answer sample data can be adjusted according to the clustering results determined by the clustering algorithm. The preset clustering algorithm can be the KNN algorithm.
[0114] In the embodiments of this application, by performing noise estimation multiple times, the problem of incorrectly identifying non-noise data as noise data due to incomplete model training can be avoided.
[0115] To further improve the efficiency of multi-hop question answering model training, based on the above embodiments, in this embodiment, the process of determining the second noise estimation round includes:
[0116] The frequency of noise estimation is determined based on the second ratio of the first set quantity to the set number of noise estimations.
[0117] Starting from the iteration number corresponding to the first noise estimation round, the second noise estimation round is determined in the set number of iterations according to the frequency interval.
[0118] To further improve the efficiency of training multi-hop question answering models, in this embodiment of the application, the electronic device can determine the frequency of noise estimation based on a pre-set number of iterations, i.e., a first set number of iterations and a second ratio of a set number of noise estimations, i.e., determine how many iterations are performed before noise estimation is performed.
[0119] Starting from the iteration number corresponding to the first noise estimation round, the second noise estimation round is determined in a set number of iterations according to the interval of that frequency.
[0120] Specifically, assuming the first set quantity is 20 and the set number of noise estimation rounds is 5, then the second ratio is 4. Assuming the first noise estimation rounds are 2, then starting from the second iteration, the rounds corresponding to every 4 iterations are determined as the second noise estimation rounds. Therefore, in the process of the first set quantity of 20 iterations, the 6th, 10th, 14th, and 18th can be determined as the second noise estimation rounds.
[0121] To facilitate understanding, the following will be combined with... Figure 4 The noise estimation rounds are explained. Figure 4 This is a schematic diagram of noise estimation rounds provided in an embodiment of this application. Assuming 40 iterations are performed and the noise estimation round is 5, then the first noise estimation round is 4. Starting from the first noise estimation round, the iteration number corresponding to every 8 iterations is determined as the second noise estimation round. Figure 4 The numbers 12, 20, 28, and 36 marked in the middle represent the second noise estimation rounds.
[0122] In this embodiment of the application, the number of rounds for noise estimation can be consistent with the second set number. That is, while performing noise estimation, the parameters of the second multi-hop question-answering model can be adjusted using the parameters of the first multi-hop question-answering model.
[0123] The noise estimation process will be explained below with reference to a specific embodiment. Figure 5 This is a schematic diagram of a noise estimation process provided in an embodiment of this application. The process includes the following steps:
[0124] S501: If the number of iterations reaches any preset noise estimation round, determine whether the number of iterations is the first noise estimation round. If yes, execute S502; otherwise, execute S504.
[0125] S502: Obtain the second loss value for each question-and-answer sample data in each iteration, and determine the first average loss value for each question-and-answer sample data based on each second loss value.
[0126] S503: Based on a preset clustering algorithm, cluster the first average loss value of each question-and-answer sample data to determine whether each question-and-answer sample data is noise data, and adjust the noise label corresponding to each question-and-answer sample data according to the determined result.
[0127] S504: For each question-and-answer sample data identified as noisy data, obtain each first loss value and each second loss value corresponding to the question-and-answer sample data, determine the second average loss value of each first loss value, and the third average loss value of each second loss value.
[0128] S505: Determine the first sum of the second average loss values and the second sum of the third average loss values for each question-and-answer sample data identified as noise data, and determine the noise coefficient based on the ratio of the first sum to the second sum.
[0129] S506: Determine the corrected loss value for each question-and-answer sample based on the noise figure and the third average loss value corresponding to each question-and-answer sample data.
[0130] S507: Based on a preset clustering algorithm, cluster the corrected loss value of each question-and-answer sample data to determine whether each question-and-answer sample data is noise data, and adjust the noise label corresponding to each question-and-answer sample data according to the determined result.
[0131] To further improve the accuracy of the multi-hop question-answering model, based on the above embodiments, the method in this application embodiment further includes:
[0132] If the number of iterations reaches any preset noise estimation round, the target influence coefficient corresponding to the preset noise round is determined according to the pre-saved correspondence between each noise estimation round and the influence coefficient.
[0133] The impact parameters of the first multi-hop question-answering model are updated using the target impact coefficient.
[0134] To further improve the accuracy of the multi-hop question-answering model, in this embodiment, when the number of iterations for the question-answering sample data reaches any preset noise estimation round, the target influence coefficient corresponding to any preset noise round can be determined based on the pre-saved correspondence between each noise estimation round and the influence coefficient.
[0135] To further improve the accuracy of the multi-hop question-answering model, based on the above embodiments, in this embodiment, the process of determining the correspondence between each noise estimation round and the influence coefficient includes:
[0136] Determine the third ratio between the preset value and the set number of noise estimations;
[0137] The first difference between the preset value and the third ratio is determined as the influence coefficient corresponding to the first noise estimation round;
[0138] For each second noise estimation round, obtain the influence coefficient corresponding to the previous noise estimation round adjacent to the second noise estimation round; determine the second difference between the influence coefficient corresponding to the previous noise estimation round and the third ratio as the influence coefficient corresponding to the second noise estimation round.
[0139] In the embodiments of this application, a third ratio of a preset value to a set number of noise estimations can be determined, wherein the preset value can be 1.
[0140] After determining the third ratio, the first difference between the preset value and the third ratio can be determined as the noise influence coefficient corresponding to the first noise estimation round.
[0141] Specifically, assuming the preset value is 1 and the number of noise estimation rounds is set to 5, then the third ratio is 0.2, and therefore the influence coefficient corresponding to the first noise estimation round is 0.8.
[0142] In this embodiment of the application, for each second noise estimation round, the influence coefficient corresponding to the previous noise estimation adjacent to the second noise estimation round can be obtained, and the second difference between the obtained noise coefficient and the third ratio can be determined as the influence coefficient corresponding to the second noise estimation round.
[0143] Specifically, assuming the second noise estimation rounds are 6, 10, 14, and 18, then for the second noise estimation round 6, the preceding noise estimation round adjacent to it is the first noise estimation round. Since the influence coefficient corresponding to the first noise estimation round is 0.8, the influence coefficient corresponding to the second noise estimation round 6 is 0.6. For the second noise estimation round 10, the preceding noise estimation round adjacent to it is the second noise estimation round 6. Since the influence coefficient corresponding to the second noise estimation round 6 is 0.6, the influence coefficient corresponding to the second noise estimation round 10 is 0.4. Similarly, for the second noise estimation round 14, the corresponding influence coefficient is 0.2; and for the second noise estimation round 18, the corresponding influence coefficient is 0.
[0144] Once the target impact coefficient is determined, it can be used to update the impact coefficient of the first multi-hop model.
[0145] The training process of a multi-hop question answering model will be explained below with reference to a specific example. Figure 6 This is a schematic diagram of the multi-hop question-answering model training process provided in an embodiment of this application. The process includes the following steps:
[0146] S601: Based on the number of iterations and the set number of noise estimations, determine the noise estimation rounds and the correspondence between each noise estimation round and the influence coefficient.
[0147] S602: Determine whether the number of iterations has reached any preset noise estimation round. If yes, execute S603; otherwise, execute S604.
[0148] S603: Input each question-and-answer sample data and noise label into the first multi-hop question-and-answer model, train the first multi-hop question-and-answer model according to the corresponding first loss value, and input the question-and-answer sample data into the second multi-hop question-and-answer model, train the second multi-hop question-and-answer model according to the corresponding second loss value.
[0149] S604: Adjust the parameters of the second multi-hop question-answering model using the parameters of the first multi-hop question-answering model, perform noise estimation, adjust the noise label corresponding to each question-answering sample data, and execute S603.
[0150] S605: Determine whether the convergence condition is met. If yes, execute S606; otherwise, execute S602.
[0151] S606: End model training and output a message indicating that training is complete.
[0152] The training process of the first and second multi-hop question answering models will be briefly explained below with reference to a specific embodiment. Figure 7 This is a schematic diagram illustrating the training process of another multi-hop question-answering model provided in an embodiment of this application.
[0153] The training process of this multi-hop question answering model can be divided into two parts: the first part is to train the knowledge embedding on the graph data, and the second part is to train the semantic embedding on the question answering data.
[0154] The knowledge embedding training of the graph data is completed independently. First, the knowledge graph data is processed into high-dimensional vectors that facilitate mathematical operations. The representations of entities, relations, entities, attributes, and attribute values in the knowledge graph are processed into high-dimensional entity vectors and relation vectors, or high-dimensional entity vectors and attribute vectors. Mathematical operations on these vectors yield the corresponding mathematical representations of entity vectors or attribute value vectors. The specific methods for knowledge embedding training of the graph data are existing technologies and will not be elaborated upon in this embodiment.
[0155] After knowledge embedding is completed on the knowledge graph data, semantic embedding is performed on the question-and-answer data. Semantic embedding is the process of realizing multi-hop question-and-answer. In principle, it is the process of representing semantics as vectors, realizing entity vectors in the question, and performing mathematical operations with the question vectors to obtain the answer entity or answer attribute value.
[0156] Based on the knowledge embedding model and the question-answering semantic embedding results, the identified answer is obtained. The loss value is determined based on the identified answer and the standard answer. The semantic embedding model is then adjusted based on the determined loss value.
[0157] The following example illustrates the iterative process of question-answering sample data in a multi-hop question-answering model, assuming prior knowledge embedding of the graph data. Figure 8 This is a schematic diagram of each iteration process provided in an embodiment of this application. The process includes the following steps:
[0158] S801: Extract a preset number of question-and-answer sample data from the sample set, and encode each question-and-answer sample data into a vector.
[0159] S802: The standard answer vector extracted from question-and-answer sample data based on the knowledge embedding model, and the preset vector after multi-hop reasoning.
[0160] How to determine the standard answer vector and the prediction vector is a prior art, and will not be elaborated in the embodiments of this application.
[0161] S803: Determine the loss value between the standard answer vector and the predicted vector, and adjust the weight parameters in the semantic embedding neural network based on this loss value.
[0162] Figure 9 This is a schematic diagram of the structure for training a multi-hop question-answering model provided in an embodiment of this application, as shown below. Figure 9 As shown, the device includes:
[0163] The acquisition module 901 is used to acquire question and answer sample data, corresponding standard answers, and noise indicators of whether the question and answer sample data is noise data in the sample set;
[0164] The first training module 902 is used to input the question-and-answer sample data and the noise identifier into the first multi-hop question-and-answer model. If the first multi-hop question-and-answer model determines that the question-and-answer sample data is noise data according to the noise identifier, it obtains the first recognition answer output by the first multi-hop question-and-answer model; it determines the first loss value corresponding to the question-and-answer sample data according to the first recognition answer and the standard answer, and trains the first multi-hop question-and-answer model according to the first loss value.
[0165] The second training module 903 is used to input the question-and-answer sample data into the second multi-hop question-and-answer model, obtain the second recognition answer output by the second multi-hop question-and-answer model, determine the second loss value corresponding to the question-and-answer sample data based on the second recognition answer and the standard answer, and train the second multi-hop question-and-answer model based on the second loss value.
[0166] The adjustment module 904 is used to obtain the parameters of the first multi-hop question answering model after a second set number of iterations, and to adjust the parameters of the second multi-hop question answering model using the parameters.
[0167] In one possible implementation, if the noise labels of the question-and-answer sample data in the sample set are randomly generated, the acquisition module 901 is further configured to, if the number of iterations reaches a preset first noise estimation round, acquire the second loss value of each question-and-answer sample data in each iteration.
[0168] The determination module 905 is used to determine a first average loss value for the question-and-answer sample data based on each of the second loss values; determine a first classification threshold based on the first average loss value for each question-and-answer sample data; and determine whether each question-and-answer sample data is noisy data based on the first classification threshold and the first average loss value for each question-and-answer sample data.
[0169] The adjustment module 904 is also used to adjust the noise label corresponding to each question and answer sample data according to the determined result.
[0170] In one possible implementation, the determining module 905 is further configured to determine the frequency of noise estimation based on a first ratio of the first set quantity to the set number of noise estimation rounds; and to determine half of the value of the frequency as the first noise estimation round.
[0171] In one possible implementation, if the noise labels of the question-and-answer sample data in the sample set are randomly generated, the acquisition module 901 is further configured to, if the number of iterations reaches a preset second noise estimation round, acquire each first loss value and each second loss value corresponding to each question-and-answer sample data labeled as noise data.
[0172] The determining module 905 is further configured to determine a second average loss value for each first loss value and a third average loss value for each second loss value; determine a first sum of the second average loss values for each question-and-answer sample data identified as noise data and a second sum of the third average loss values; determine a noise coefficient based on the ratio of the first sum to the second sum; and determine a corrected loss value based on the noise coefficient and the third average loss value corresponding to each question-and-answer sample data.
[0173] The adjustment module 904 is also used to adjust the noise label of each question and answer sample data according to the correction loss value of each question and answer sample data.
[0174] In one possible implementation, the adjustment module 904 is specifically configured to: determine a second classification threshold based on the corrected loss value corresponding to each question-and-answer sample data; determine whether each question-and-answer sample data is noise data based on the second classification threshold and the corrected loss value corresponding to each question-and-answer sample data; and adjust the noise label corresponding to each question-and-answer sample data according to the determined result; or, cluster the corrected loss value of each question-and-answer sample data based on a preset clustering algorithm, and adjust the noise label corresponding to each question-and-answer sample data according to the clustering result.
[0175] In one possible implementation, the determining module 905 is further configured to determine the frequency of noise estimation based on the second ratio of the first set quantity to the set number of noise estimations; and to determine the second noise estimation round in the set number of iterations according to the frequency interval, starting from the iteration number corresponding to the first noise estimation round.
[0176] In one possible implementation, the determining module 905 is further configured to, if the number of iterations reaches any preset noise estimation round, determine the target influence coefficient corresponding to the preset noise round reached based on the pre-saved correspondence between each noise estimation round and the influence coefficient;
[0177] The update module 906 is used to update the influence parameters of the first multi-hop question-answering model using the target influence coefficient.
[0178] In one possible implementation, the determining module 905 is specifically configured to: determine a third ratio between a preset value and a set number of noise estimation rounds; determine a first difference between the preset value and the third ratio as the influence coefficient corresponding to the first noise estimation round; for each second noise estimation round, obtain the influence coefficient corresponding to the previous noise estimation round adjacent to the second noise estimation round; and determine a second difference between the influence coefficient corresponding to the previous noise estimation round and the third ratio as the influence coefficient corresponding to the second noise estimation round.
[0179] In one possible implementation, the adjustment module 904 is specifically used to obtain the weights and biases in the first multi-hop question-answering model, and to adjust the weights and biases in the second multi-hop question-answering model using the weights and biases.
[0180] Figure 10 This application provides a schematic diagram of an electronic device structure as an embodiment of the present application. Based on the above embodiments, the present application also provides an electronic device, such as... Figure 10 As shown, it includes: processor 1001, communication interface 1002, memory 1003 and communication bus 1004, wherein processor 1001, communication interface 1002 and memory 1003 communicate with each other through communication bus 1004.
[0181] The memory 1003 stores a computer program, which, when executed by the processor 1001, causes the processor 1001 to perform the following steps:
[0182] The question-and-answer sample data is used for a first set number of iterations. Each iteration includes:
[0183] Obtain question and answer sample data, corresponding standard answers, and noise indicators to determine whether the question and answer sample data is noisy data from the sample set;
[0184] The question-and-answer sample data and the noise identifier are input into the first multi-hop question-and-answer model. If the first multi-hop question-and-answer model determines that the question-and-answer sample data is noise data based on the noise identifier, the first identification answer output by the first multi-hop question-and-answer model is obtained. Based on the first identification answer and the standard answer, the first loss value corresponding to the question-and-answer sample data is determined, and the first multi-hop question-and-answer model is trained based on the first loss value.
[0185] The question-and-answer sample data is input into the second multi-hop question-and-answer model to obtain the second recognized answer output by the second multi-hop question-and-answer model; based on the second recognized answer and the standard answer, the second loss value corresponding to the question-and-answer sample data is determined; and the second multi-hop question-and-answer model is trained based on the second loss value.
[0186] After a second set number of iterations, the parameters of the first multi-hop question answering model are obtained, and the parameters of the second multi-hop question answering model are adjusted using the parameters.
[0187] In one possible implementation, if the noise labels for the question-and-answer sample data in the sample set are randomly generated, the method further includes:
[0188] If the number of iterations reaches the preset first noise estimation round, for each question and answer sample data, obtain the second loss value of the question and answer sample data in each iteration; and determine the first average loss value of the question and answer sample data based on each second loss value.
[0189] The first classification threshold is determined based on the first average loss value of each question-and-answer sample data.
[0190] Based on the first classification threshold and the first average loss value of each question and answer sample data, determine whether each question and answer sample data is noisy data, and adjust the noise label corresponding to each question and answer sample data according to the determination result.
[0191] In one possible implementation, the process of determining the first noise estimation round includes:
[0192] The frequency of noise estimation is determined based on the first ratio of the first set quantity to the set number of noise estimations.
[0193] Half of the value of the frequency is determined as the first noise estimation round.
[0194] In one possible implementation, if the noise labels for the question-and-answer sample data in the sample set are randomly generated, the method further includes:
[0195] If the number of iterations reaches the preset second noise estimation round, for each question and answer sample data identified as noise data, obtain each first loss value and each second loss value corresponding to the question and answer sample data, determine the second average loss value of each first loss value, and the third average loss value of each second loss value;
[0196] Determine the first sum of the second average loss values and the second sum of the third average loss values for each question-and-answer sample data identified as noisy data;
[0197] The noise coefficient is determined based on the ratio of the first sum and the second sum. The corrected loss value is determined based on the noise coefficient and the third average loss value corresponding to each question and answer sample data. The noise label of each question and answer sample data is adjusted based on the corrected loss value of each question and answer sample data.
[0198] In one possible implementation, adjusting the noise label of each question-and-answer sample data based on the corrected loss value of each sample data includes:
[0199] Based on the corrected loss value corresponding to each question-and-answer sample data, a second classification threshold is determined; based on the second classification threshold and the corrected loss value corresponding to each question-and-answer sample data, it is determined whether each question-and-answer sample data is noise data, and the noise label corresponding to each question-and-answer sample data is adjusted according to the determination result; or,
[0200] The modified loss value of each question-and-answer sample data is clustered based on a preset clustering algorithm, and the noise label corresponding to each question-and-answer sample data is adjusted according to the clustering results.
[0201] In one possible implementation, the process of determining the second noise estimation round includes:
[0202] The frequency of noise estimation is determined based on the second ratio of the first set quantity to the set number of noise estimations.
[0203] Starting from the iteration number corresponding to the first noise estimation round, the second noise estimation round is determined in the set number of iterations according to the frequency interval.
[0204] In one possible implementation, the method further includes:
[0205] If the number of iterations reaches any preset noise estimation round, the target influence coefficient corresponding to the preset noise round is determined according to the pre-saved correspondence between each noise estimation round and the influence coefficient.
[0206] The impact parameters of the first multi-hop question-answering model are updated using the target impact coefficient.
[0207] In one possible implementation, the process of determining the correspondence between each noise estimation round and the influence coefficient includes:
[0208] Determine the third ratio between the preset value and the set number of noise estimations;
[0209] The first difference between the preset value and the third ratio is determined as the influence coefficient corresponding to the first noise estimation round;
[0210] For each second noise estimation round, obtain the influence coefficient corresponding to the previous noise estimation round adjacent to the second noise estimation round; determine the second difference between the influence coefficient corresponding to the previous noise estimation round and the third ratio as the influence coefficient corresponding to the second noise estimation round.
[0211] In one possible implementation, obtaining the parameters of the first multi-hop question-answering model and adjusting the parameters of the second multi-hop question-answering model using the parameters includes:
[0212] Obtain the weights and biases in the first multi-hop question answering model, and adjust the weights and biases in the second multi-hop question answering model using the weights and biases.
[0213] The communication bus mentioned in the aforementioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface 1002 is used for communication between the aforementioned electronic device and other devices. The memory can include Random Access Memory (RAM), or Non-Volatile Memory (NVM), such as at least one disk storage device. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor. The aforementioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a Digital Signal Processing (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0214] Based on the above embodiments, this application also provides a computer-readable storage medium storing a computer program executable by a processor. When the program is run on the processor, the processor executes the following steps:
[0215] The question-and-answer sample data is used for a first set number of iterations. Each iteration includes:
[0216] Obtain question and answer sample data, corresponding standard answers, and noise indicators to determine whether the question and answer sample data is noisy data from the sample set;
[0217] The question-and-answer sample data and the noise identifier are input into the first multi-hop question-and-answer model. If the first multi-hop question-and-answer model determines that the question-and-answer sample data is noise data based on the noise identifier, the first identification answer output by the first multi-hop question-and-answer model is obtained. Based on the first identification answer and the standard answer, the first loss value corresponding to the question-and-answer sample data is determined, and the first multi-hop question-and-answer model is trained based on the first loss value.
[0218] The question-and-answer sample data is input into the second multi-hop question-and-answer model to obtain the second recognized answer output by the second multi-hop question-and-answer model; based on the second recognized answer and the standard answer, the second loss value corresponding to the question-and-answer sample data is determined; and the second multi-hop question-and-answer model is trained based on the second loss value.
[0219] After a second set number of iterations, the parameters of the first multi-hop question answering model are obtained, and the parameters of the second multi-hop question answering model are adjusted using the parameters.
[0220] In one possible implementation, if the noise labels for the question-and-answer sample data in the sample set are randomly generated, the method further includes:
[0221] If the number of iterations reaches the preset first noise estimation round, for each question and answer sample data, obtain the second loss value of the question and answer sample data in each iteration; and determine the first average loss value of the question and answer sample data based on each second loss value.
[0222] The first classification threshold is determined based on the first average loss value of each question-and-answer sample data.
[0223] Based on the first classification threshold and the first average loss value of each question and answer sample data, determine whether each question and answer sample data is noisy data, and adjust the noise label corresponding to each question and answer sample data according to the determination result.
[0224] In one possible implementation, the process of determining the first noise estimation round includes:
[0225] The frequency of noise estimation is determined based on the first ratio of the first set quantity to the set number of noise estimations.
[0226] Half of the value of the frequency is determined as the first noise estimation round.
[0227] In one possible implementation, if the noise labels for the question-and-answer sample data in the sample set are randomly generated, the method further includes:
[0228] If the number of iterations reaches the preset second noise estimation round, for each question and answer sample data identified as noise data, obtain each first loss value and each second loss value corresponding to the question and answer sample data, determine the second average loss value of each first loss value, and the third average loss value of each second loss value;
[0229] Determine the first sum of the second average loss values and the second sum of the third average loss values for each question-and-answer sample data identified as noisy data;
[0230] The noise coefficient is determined based on the ratio of the first sum and the second sum. The corrected loss value is determined based on the noise coefficient and the third average loss value corresponding to each question and answer sample data. The noise label of each question and answer sample data is adjusted based on the corrected loss value of each question and answer sample data.
[0231] In one possible implementation, adjusting the noise label of each question-and-answer sample data based on the corrected loss value of each sample data includes:
[0232] Based on the corrected loss value corresponding to each question-and-answer sample data, a second classification threshold is determined; based on the second classification threshold and the corrected loss value corresponding to each question-and-answer sample data, it is determined whether each question-and-answer sample data is noise data, and the noise label corresponding to each question-and-answer sample data is adjusted according to the determination result; or,
[0233] The modified loss value of each question-and-answer sample data is clustered based on a preset clustering algorithm, and the noise label corresponding to each question-and-answer sample data is adjusted according to the clustering results.
[0234] In one possible implementation, the process of determining the second noise estimation round includes:
[0235] The frequency of noise estimation is determined based on the second ratio of the first set quantity to the set number of noise estimations.
[0236] Starting from the iteration number corresponding to the first noise estimation round, the second noise estimation round is determined in the set number of iterations according to the frequency interval.
[0237] In one possible implementation, the method further includes:
[0238] If the number of iterations reaches any preset noise estimation round, the target influence coefficient corresponding to the preset noise round is determined according to the pre-saved correspondence between each noise estimation round and the influence coefficient.
[0239] The impact parameters of the first multi-hop question-answering model are updated using the target impact coefficient.
[0240] In one possible implementation, the process of determining the correspondence between each noise estimation round and the influence coefficient includes:
[0241] Determine the third ratio between the preset value and the set number of noise estimations;
[0242] The first difference between the preset value and the third ratio is determined as the influence coefficient corresponding to the first noise estimation round;
[0243] For each second noise estimation round, obtain the influence coefficient corresponding to the previous noise estimation round adjacent to the second noise estimation round; determine the second difference between the influence coefficient corresponding to the previous noise estimation round and the third ratio as the influence coefficient corresponding to the second noise estimation round.
[0244] In one possible implementation, obtaining the parameters of the first multi-hop question-answering model and adjusting the parameters of the second multi-hop question-answering model using the parameters includes:
[0245] Obtain the weights and biases in the first multi-hop question answering model, and adjust the weights and biases in the second multi-hop question answering model using the weights and biases.
[0246] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0247] For system / device embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to in the description of the method embodiments.
[0248] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1A device that provides the functions specified in one or more boxes.
[0249] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0250] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0251] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0252] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for training a multi-hop question-answering model, characterized in that, The method includes: The question-and-answer sample data is used for a first set number of iterations. Each iteration includes: Obtain question and answer sample data, corresponding standard answers, and noise indicators to determine whether the question and answer sample data is noisy data from the sample set; The question-and-answer sample data and the noise identifier are input into the first multi-hop question-and-answer model. If the first multi-hop question-and-answer model determines that the question-and-answer sample data is noise data based on the noise identifier, the first identification answer output by the first multi-hop question-and-answer model is obtained. Based on the first identification answer and the standard answer, the first loss value corresponding to the question-and-answer sample data is determined, and the first multi-hop question-and-answer model is trained based on the first loss value. The question-and-answer sample data is input into the second multi-hop question-and-answer model to obtain the second recognized answer output by the second multi-hop question-and-answer model; based on the second recognized answer and the standard answer, the second loss value corresponding to the question-and-answer sample data is determined; and the second multi-hop question-and-answer model is trained based on the second loss value. After a second set number of iterations, the parameters of the first multi-hop question answering model are obtained, and the parameters of the second multi-hop question answering model are adjusted using the parameters.
2. The method according to claim 1, characterized in that, If the noise labels for the question-and-answer sample data in the sample set are randomly generated, the method further includes: If the number of iterations reaches the preset first noise estimation round, for each question and answer sample data, obtain the second loss value of the question and answer sample data in each iteration; and determine the first average loss value of the question and answer sample data based on each second loss value. The first classification threshold is determined based on the first average loss value of each question-and-answer sample data. Based on the first classification threshold and the first average loss value of each question and answer sample data, determine whether each question and answer sample data is noisy data, and adjust the noise label corresponding to each question and answer sample data according to the determination result.
3. The method according to claim 2, characterized in that, The process of determining the first noise estimation round includes: The frequency of noise estimation is determined based on the first ratio of the first set quantity to the set number of noise estimations. Half of the value of the frequency is determined as the first noise estimation round.
4. The method according to claim 1, characterized in that, If the noise labels for the question-and-answer sample data in the sample set are randomly generated, the method further includes: If the number of iterations reaches the preset second noise estimation round, for each question and answer sample data identified as noise data, obtain each first loss value and each second loss value corresponding to the question and answer sample data, determine the second average loss value of each first loss value, and the third average loss value of each second loss value; Determine the first sum of the second average loss values and the second sum of the third average loss values for each question-and-answer sample data identified as noisy data; The noise coefficient is determined based on the ratio of the first sum and the second sum. The corrected loss value is determined based on the noise coefficient and the third average loss value corresponding to each question and answer sample data. The noise label of each question and answer sample data is adjusted based on the corrected loss value of each question and answer sample data.
5. The method according to claim 4, characterized in that, The step of adjusting the noise label of each question-and-answer sample data based on the corrected loss value of each question-and-answer sample data includes: Based on the corrected loss value corresponding to each question-and-answer sample data, a second classification threshold is determined; based on the second classification threshold and the corrected loss value corresponding to each question-and-answer sample data, it is determined whether each question-and-answer sample data is noise data, and the noise label corresponding to each question-and-answer sample data is adjusted according to the determination result; or, The modified loss value of each question-and-answer sample data is clustered based on a preset clustering algorithm, and the noise label corresponding to each question-and-answer sample data is adjusted according to the clustering results.
6. The method according to claim 4, characterized in that, The process of determining the second noise estimation round includes: The frequency of noise estimation is determined based on the second ratio of the first set quantity to the set number of noise estimations. Starting from the iteration number corresponding to the first noise estimation round, the second noise estimation round is determined in the set number of iterations according to the frequency interval.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: If the number of iterations reaches any preset noise estimation round, the target influence coefficient corresponding to the preset noise round is determined according to the pre-saved correspondence between each noise estimation round and the influence coefficient. The impact parameters of the first multi-hop question-answering model are updated using the target impact coefficient.
8. The method according to claim 7, characterized in that, The process of determining the correspondence between each noise estimation round and the influence coefficient includes: Determine the third ratio between the preset value and the set number of noise estimations; The first difference between the preset value and the third ratio is determined as the influence coefficient corresponding to the first noise estimation round; For each second noise estimation round, obtain the influence coefficient corresponding to the previous noise estimation round adjacent to the second noise estimation round; determine the second difference between the influence coefficient corresponding to the previous noise estimation round and the third ratio as the influence coefficient corresponding to the second noise estimation round.
9. The method according to claim 1, characterized in that, The step of obtaining the parameters of the first multi-hop question answering model and adjusting the parameters of the second multi-hop question answering model using the parameters includes: Obtain the weights and biases in the first multi-hop question answering model, and adjust the weights and biases in the second multi-hop question answering model using the weights and biases.
10. An electronic device, characterized in that, The electronic device includes at least a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the steps of the multi-hop question-answering model training method according to any one of claims 1-9.
Citation Information
Patent Citations
Partial multi-mark learning method based on complementary mark cooperative training
CN113379037A
Long-tail noise learning method based on cross enhancement matching
CN113869463A