Question and answer model training method and device, electronic equipment and storage medium

By performing specific training methods on the Q&A model, including obtaining and filtering answer pairs, determining loss information and model training, the problem of low answer accuracy of existing Q&A models is solved, and more efficient answer generation quality is achieved.

CN119476533APending Publication Date: 2025-02-18BEIJING SOGOU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411588384.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing question-and-answer model training methods generate low answers and are difficult to effectively understand and generate accurate answers.

Method used

By obtaining the target sample question information and its corresponding answer information set, we generate the answer to be analyzed, and filter the abnormal answers according to the answer selection results, obtain the answers of the target answer to generate indicator data, determine the target loss information, and then use the preset question and answer. The model is trained to obtain the target question and answer model.

Benefits of technology

The accuracy of the question-and-answer model is improved, the difference between the probability of generating high-quality answer information and the probability of generating inferior answer information is increased, and the quality of the model's answer generation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119476533A_ABST
    Figure CN119476533A_ABST
Patent Text Reader

Abstract

The invention relates to a question and answer model training method and device, electronic equipment and a storage medium, and relates to the technical field of artificial intelligence, and the method comprises the steps: obtaining target sample question information and an answer information set corresponding to the target sample question information; generating a plurality of to-be-analyzed answer pairs based on the answer information set; obtaining answer selection results corresponding to the plurality of to-be-analyzed answer pairs; on the basis of the answer selection result, abnormal answer pairs in the to-be-analyzed answer pairs are filtered, and at least one target answer pair is obtained; obtaining answer generation index data corresponding to each piece of target answer information in the at least one target answer pair; based on the answer generation index data and an answer selection result corresponding to each target answer pair, determining target loss information corresponding to the target sample question information; and training a preset question and answer model based on the target loss information to obtain a target question and answer model. According to the embodiment of the invention, the answer precision generated by the question-answer model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a question-answering model training method, device, electronic device and storage medium. Background Art

[0002] Artificial intelligence is a technology that simulates human intelligence and aims to create intelligent machines that can learn and process information autonomously. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning. Specifically, natural language processing is mainly used in machine translation, automatic summarization, text classification, question answering, text semantic comparison, and speech recognition.

[0003] Specifically, as an important branch of artificial intelligence, question-answering models can understand complex questions and generate accurate and valuable answers by using advanced natural language processing technology. These models are gradually changing the way we obtain information and knowledge. Through deep learning and a large amount of data training, question-answering models can understand questions more accurately and generate answers to questions. In the current model training method, the answer generated by the question-answering model is compared with the labeled answer to obtain loss information, so that the question-answering model can be trained based on the loss information. However, the answers generated by the question-answering model trained by the above method are less accurate. Summary of the invention

[0004] In view of the above-mentioned technical problems, the present disclosure proposes a question-answering model training method, device, electronic device and storage medium.

[0005] According to one aspect of an embodiment of the present disclosure, a question-answering model training method is provided, including:

[0006] Obtain target sample question information and a set of answer information corresponding to the target sample question information; the answer information set is obtained by answering the target sample question information based on a preset question-answering model;

[0007] Based on the answer information set, generating a plurality of answer pairs to be analyzed corresponding to the target sample question information;

[0008] Obtaining answer selection results corresponding to each of the plurality of answer pairs to be analyzed; the answer selection results are used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information;

[0009] Based on the answer selection results, abnormal answer pairs among the multiple answer pairs to be analyzed are filtered to obtain at least one target answer pair; the abnormal answer pairs are answer pairs to be analyzed whose corresponding answer selection results among the multiple answer pairs to be analyzed contradict each other;

[0010] Obtain answer generation indicator data corresponding to each target answer information in the at least one target answer pair; the answer generation indicator data is used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is each target answer information;

[0011] Based on the answer generation indicator data and the answer selection result corresponding to each target answer pair, determine the target loss information corresponding to the target sample question information; the target loss information is used to characterize the difference between the generation probability of the selected answer information and the generation probability of the rejected answer information in the at least one target answer pair;

[0012] Based on the target loss information, the preset question-answering model is trained to obtain a target question-answering model.

[0013] According to another aspect of an embodiment of the present disclosure, there is provided a method for generating an answer, including:

[0014] Get information about questions to be answered;

[0015] Inputting the question information to be answered into the target question answering model for answer generation processing to obtain the answer generation result corresponding to the question information to be answered;

[0016] Among them, the target question and answer model is obtained based on the above-mentioned question and answer model training method.

[0017] According to another aspect of an embodiment of the present disclosure, a question-answering model training device is provided, comprising:

[0018] A first information acquisition module is used to acquire target sample question information and an answer information set corresponding to the target sample question information; the answer information set is obtained by answer processing of the target sample question information based on a preset question-answering model;

[0019] An answer pair generation module, used to generate a plurality of answer pairs to be analyzed corresponding to the target sample question information based on the answer information set;

[0020] A selection result acquisition module is used to obtain the answer selection results corresponding to each of the plurality of answer pairs to be analyzed; the answer selection results are used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information;

[0021] A filtering module, configured to filter abnormal answer pairs among the plurality of answer pairs to be analyzed based on the answer selection results to obtain at least one target answer pair; the abnormal answer pairs are answer pairs to be analyzed whose corresponding answer selection results among the plurality of answer pairs to be analyzed contradict each other;

[0022] A first data acquisition module is used to acquire answer generation index data corresponding to each target answer information in the at least one target answer pair; the answer generation index data is used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is each target answer information;

[0023] A target loss determination module, configured to determine target loss information corresponding to the target sample question information based on the answer generation indicator data and the answer selection result corresponding to each target answer pair; the target loss information is used to characterize the degree of difference between the generation probability of the selected answer information and the generation probability of the rejected answer information in at least one target answer pair;

[0024] A training module is used to train the preset question-answering model based on the target loss information to obtain a target question-answering model.

[0025] Optionally, each target answer pair includes target selection answer information and target rejection answer information; and the target loss determination module includes:

[0026] A first loss determination module, configured to determine first loss information corresponding to each target answer pair based on answer generation indicator data of the target selection answer information; the first loss information represents the degree of difference between the generation probability of the target selection answer information and a maximum probability threshold;

[0027] A second loss determination module is used to determine the second loss information corresponding to each target answer pair based on the answer generation index data of the target selection answer information and the answer generation index data of the target rejection answer information; the second loss information represents the deviation between the difference degree between the generation probability of the target selection answer information and the generation probability of the target rejection answer information and the preset difference degree;

[0028] A target loss acquisition module is used to determine the target loss information based on the first loss information corresponding to each target answer pair and the second loss information corresponding to each target answer pair.

[0029] Optionally, the second loss determination module includes:

[0030] A first indicator determination module is used to determine first target indicator data of the target selected answer information based on the answer generation indicator data of the target selected answer information; the first target indicator data represents the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding selected answer information;

[0031] A second indicator determination module is used to determine first difference indicator data based on the answer generation indicator data of the target selection answer information and the first target indicator data of the target selection answer information; the first difference indicator data represents the ratio between the answer generation indicator data of the target selection answer information and the first target indicator data;

[0032] A third indicator determination module is used to determine second target indicator data of the target rejected answer information based on the answer generation indicator data of the target rejected answer information; the second target indicator data represents the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding rejected answer information;

[0033] A fourth indicator determination module is used to determine second difference indicator data based on the answer generation indicator data of the target rejection answer information and the second target indicator data of the target rejection answer information; the second difference indicator data represents the ratio between the answer generation indicator data of the target rejection answer information and the second target indicator data;

[0034] The second loss acquisition module is used to determine the second loss information based on the first difference indicator data, the second difference indicator data and the preset difference indicator data.

[0035] Optionally, the device further comprises:

[0036] A second data acquisition module is used to acquire the answer content length data of the target selected answer information;

[0037] Accordingly, the first loss determination module includes:

[0038] A first loss acquisition module is used to determine the first loss information based on the answer content length data and the answer generation indicator data of the target selection answer information.

[0039] Optionally, the target loss acquisition module includes:

[0040] A third loss acquisition module, configured to scale down the first loss information corresponding to each target answer pair based on the first preset ratio information, to obtain third loss information corresponding to each target answer pair;

[0041] a fourth loss acquisition module, configured to perform a proportional reduction process on the second loss information corresponding to each target answer pair based on the second preset proportional information, so as to obtain fourth loss information corresponding to each target answer pair;

[0042] A fusion processing module is used to fuse the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair to obtain the target loss information.

[0043] Optionally, the fusion processing module includes:

[0044] A superposition processing module, used for superimposing the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair to obtain the fifth loss information corresponding to each target answer pair;

[0045] The mean processing module is used to perform mean processing on the fifth loss information corresponding to the at least one target answer pair to obtain the target loss information.

[0046] Optionally, the device further comprises:

[0047] An answer selection processing module is used to perform high-quality answer selection processing on each answer pair to be analyzed based on the target sample question information and a preset text processing model, and obtain selected answer information corresponding to each answer pair to be analyzed;

[0048] The selection result generating module is used to generate the answer selection result based on the selected answer information corresponding to each answer pair to be analyzed.

[0049] Optionally, the first data acquisition module includes:

[0050] The answer prediction and analysis module is used to input each target answer information, the answer selection result corresponding to each target answer information and the target sample question information into the preset question and answer model for answer prediction analysis to obtain the answer generation indicator data.

[0051] Optionally, the answer information set includes non-reference answer information, rejected answer information and multiple reference answer information; the device further includes:

[0052] A preset answer acquisition module is used to obtain preset rejection answer information;

[0053] A first answer generation module, configured to input preset answer reference information and the target sample question information into the preset question-answering model, so that the preset question-answering model uses the preset answer reference information as reference information, performs answer generation processing on the target sample question information, and obtains the plurality of reference answer information;

[0054] A second answer generation module is used to input the target sample question information into the preset question-answering model for answer generation processing to obtain the non-reference answer information;

[0055] A set generation module is used to take the non-reference answer information, the preset rejected answer information and the multiple reference answer information as the answer information set.

[0056] According to another aspect of an embodiment of the present disclosure, there is provided an answer generating device, comprising:

[0057] The second information acquisition module is used to obtain the question information to be answered;

[0058] The answer generation processing module is used to input the question information to be answered into the target question and answer model for answer generation processing to obtain the answer generation result corresponding to the question information to be answered; wherein, the target question and answer model is obtained based on the above-mentioned question and answer model training method.

[0059] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing a computer program; wherein the processor is configured to execute the computer program to implement the above-mentioned question-and-answer model training method or the above-mentioned answer generation method.

[0060] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When a computer program in the storage medium is executed by a processor of an electronic device, the electronic device is enabled to perform the above-mentioned question-and-answer model training method or the above-mentioned answer generation method.

[0061] According to another aspect of an embodiment of the present disclosure, a computer program product including a computer program is provided, which, when executed on a computer, enables the computer to execute the above-mentioned question-answering model training method or the above-mentioned answer generation method.

[0062] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0063] By obtaining target sample question information and a set of answer information corresponding to the target sample question information, wherein the answer information set is obtained by answer processing of the target sample question information based on a preset question-answering model, it is possible to obtain multiple different answer information for the target sample question information, and then combine the answer information set to generate multiple answer pairs to be analyzed corresponding to the target sample question information, so as to generate answer pairs corresponding to the answer information set. Secondly, obtain answer selection results corresponding to each of the multiple answer pairs to be analyzed, wherein the answer selection results are used to indicate whether to select any answer information as the answer information corresponding to the target sample question information, so as to obtain the advantages and disadvantages of the answer information in each answer pair to be analyzed. Then, combined with the answer selection results, filter the abnormal answer pairs in the multiple answer pairs to be analyzed to obtain at least one target answer pair, wherein the abnormal answer pairs are the answer pairs to be analyzed whose corresponding answer selection results in the multiple answer pairs to be analyzed contradict each other, so as to filter the abnormal answer pairs in the answer pairs to be analyzed, and then obtain the answer selection results corresponding to the multiple answer pairs to be analyzed. The answer generation indicator data corresponding to each target answer information in one less target answer pair, the answer generation indicator data is used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question and answer model is each target answer information, so as to achieve the acquisition of the answer generation indicator data corresponding to each target answer information, and then, the answer generation indicator data and the answer selection result corresponding to each target answer pair are combined to determine the target loss information corresponding to the target sample question information, so that the target loss information can more accurately describe the difference between the generation probability of selecting answer information and the generation probability of rejecting answer information in at least one target answer pair, and thus increase the difference between the generation probability of high-quality answer information and the generation probability of low-quality answer information for the trained target question and answer model, and then, combined with the target loss information, the preset question and answer model is trained to obtain the target question and answer model, which can increase the difference between the generation probability of high-quality answer information and the generation probability of low-quality answer information for the trained target question and answer model, and thus improve the accuracy of the answer generated by the question and answer model.

[0064] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0066] Figure 1 is a schematic diagram of an application system according to an exemplary embodiment;

[0067] Figure 2is a flowchart of a question-answering model training method according to an exemplary embodiment;

[0068] Figure 3 is a flow chart of a method for generating an answer according to an exemplary embodiment;

[0069] Figure 4 is a schematic diagram of an architecture of a question-answering model training method according to an exemplary embodiment;

[0070] Figure 5 is a schematic diagram showing a result of answer generation according to an exemplary embodiment;

[0071] Figure 6 is a block diagram of a question-answering model training device according to an exemplary embodiment;

[0072] Figure 7 is a block diagram of an answer generating device according to an exemplary embodiment;

[0073] Figure 8 is a block diagram of an electronic device for training a target question-answering model or generating an answer generation result corresponding to question information to be answered according to an exemplary embodiment;

[0074] Fig. 9 It is a block diagram of another electronic device for training a target question-answering model or generating an answer generation result corresponding to question information to be answered according to an exemplary embodiment. DETAILED DESCRIPTION

[0075] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0076] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0077] In addition, in order to better illustrate the present application, numerous specific details are provided in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0078] See also Figure 1 , Figure 1is a schematic diagram of an application system according to an exemplary embodiment. The application system can be used in the question-answering model training method or answer generation method of the present application. Figure 1 As shown, the application system may at least include a server 01 and a terminal 02 .

[0079] In the embodiment of the present application, the server 01 can be used to generate a target question-answering model. Specifically, the server 01 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0080] In the embodiment of the present application, the terminal 02 can be used to generate an answer generation result corresponding to the question information to be answered. The terminal 02 may include physical devices such as smart phones, desktop computers, tablet computers, laptops, smart TVs, smart speakers, car terminals, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, etc., and may also include software running in physical devices, such as applications. The operating system running on the terminal 02 in the embodiment of the present application may include but is not limited to Android system, IOS system, Linux, Windows, etc.

[0081] In addition, it should be noted that Figure 1 What is shown is only one application environment provided by the present disclosure. In actual applications, other application environments may also be included. For example, the generation process of the target question-answering model may also be implemented on the terminal 02.

[0082] In the embodiments of this specification, the terminal 02 and the server 01 may be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0083] It should be noted that Figure 2 and Figure 3 The sequence of steps shown in FIG. 1 is a possible sequence of steps, and is not actually limited to this sequence. Some steps can be executed in parallel without relying on each other.

[0084] Specifically, Figure 2 FIG. 1 is a flowchart of a question-answering model training method according to an exemplary embodiment. Figure 2 As shown, the question-answering model training method can be used in electronic devices such as terminals or servers, and can specifically include the following steps:

[0085] S201: Obtain target sample question information and a set of answer information corresponding to the target sample question information.

[0086] In a specific embodiment, the target sample question information can be used to train a preset question-answering model. Specifically, the target sample question information can be a preset question information. Optionally, the target sample question information of the present application can be combined with different actual application scenarios to correspond to question information in different scenarios, such as medical consultation question information in a medical consultation scenario, product consultation question information in a shopping scenario, etc. Exemplarily, the target sample question information can be "What is the most beloved constellation of Sagittarius in his life?".

[0087] In a specific embodiment, the answer information set may refer to a set of multiple different answer information for answering the above-mentioned target sample question information. The answer information set may include non-reference answer information, rejected answer information and multiple reference answer information. Among them, non-reference answer information may refer to the answer information of the target sample question information generated by the preset question and answer model without reference information. Reference answer information may refer to the answer information of the target sample question information generated by the preset question and answer model with reference information. Rejected answer information may be used to indicate that the answer cannot be answered at present or there is no answer information that can be used to answer the target sample question information. Exemplarily, the rejected answer information may be "I'm sorry". Specifically, the answer information set may be obtained by processing the answer to the target sample question information based on the preset question and answer model.

[0088] In a specific embodiment, the answer information set may be obtained in the following manner:

[0089] Obtain preset rejection answer information;

[0090] Inputting the preset answer reference information and the target sample question information into the preset question answering model, so that the preset question answering model uses the preset answer reference information as reference information, performs answer generation processing on the target sample question information, and obtains multiple reference answer information;

[0091] Input the target sample question information into the preset question-answering model for answer generation processing to obtain non-reference answer information;

[0092] The non-reference answer information, the preset rejected answer information and the multiple reference answer information are taken as the answer information set.

[0093] In a specific embodiment, the preset rejection answer information may be used to indicate that the answer cannot be answered or does not exist to answer the target sample question information. Specifically, the preset rejection answer information may be set according to actual application needs, and the present disclosure does not limit this. Exemplarily, the preset rejection answer information may be "It seems that this question is a bit tricky, and we may need to explore it from another angle."

[0094] In a specific embodiment, the preset answer reference information may be a reference document containing knowledge of multiple different application fields.

[0095] In a specific embodiment, the preset question-answering model can be used to answer the input question information. Specifically, the preset question-answering model may include a natural language processing model. The preset question-answering model may include a ChatGPT (ChatGenerative Pre-trained Transformer) or a BERT (Bidirectional Encoder Representation from Transformers) model, etc.

[0096] In a specific embodiment, the multiple reference answer information may be multiple different answer information.

[0097] In a specific embodiment, the preset answer reference information, the target sample question information and the first preset answer instruction can be input into the preset question and answer model; the preset question and answer model can use the preset answer reference information as reference information based on the first preset answer instruction, perform answer generation processing for the target sample question information, and obtain multiple different reference answer information. The first preset answer instruction is used to instruct the preset question and answer model to answer the target sample question information in combination with the preset answer reference information to generate multiple different answer information.

[0098] In a specific embodiment, the target sample question information and the second preset answer instruction can be input into the preset question-answering model so that the preset question-answering model generates non-reference answer information corresponding to the target sample question information without reference information. The second preset answer instruction can be used to instruct the preset question-answering model to answer the target sample question information to generate non-reference answer information.

[0099] In a specific embodiment, an answer information set may be generated based on non-reference answer information, preset rejected answer information, and multiple reference answer information.

[0100] In the above embodiment, by obtaining preset rejection answer information, it is possible to avoid the problem of inaccurate answers caused by forcibly giving answers to unanswerable situations. The preset answer reference information and the target sample question information are then input into the preset question-and-answer model, so that the preset question-and-answer model uses the preset answer reference information as reference information, performs answer generation processing on the target sample question information, and obtains multiple reference answer information. It is possible to quickly generate a variety of different reference answer information as samples for the training model. Next, the target sample question information is input into the preset question-and-answer model for answer generation processing to obtain non-reference answer information, which can achieve the expansion of answer information and thereby improve the diversity of answer information. Using non-reference answer information, preset rejection answer information and multiple reference answer information as a set of answer information can improve the sample diversity of the answer information set, thereby enabling the trained model to reduce hallucinations and improve accuracy.

[0101] S203: Based on the answer information set, generate a plurality of answer pairs to be analyzed corresponding to the target sample question information.

[0102] In a specific embodiment, any answer pair to be analyzed may be any two answer information in the answer information set. Any answer pair to be analyzed may include two target answer information. Among them, the target answer information corresponding to any answer pair to be analyzed may refer to one of the answer information in any of the above answer pairs to be analyzed.

[0103] In a specific embodiment, a plurality of answer pairs to be analyzed may be obtained by combining every two pieces of answer information in the answer information set.

[0104] S205: Obtain answer selection results corresponding to each of the multiple answer pairs to be analyzed.

[0105] In a specific embodiment, the answer selection result can be used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information. The answer selection result corresponding to any answer pair to be analyzed may include the answer selection indication information corresponding to each target answer information in any of the answer pairs to be analyzed. Among them, the answer selection indication information corresponding to any of the target answer information can be used to indicate whether any of the target answer information is selected as the answer information corresponding to the target sample question information. The answer selection indication information may include the first selection indication information or the second selection indication information. The first selection indication information can be used to indicate that the corresponding target answer information is selected as the answer information corresponding to the target sample question information; the second selection indication information can be used to indicate that the corresponding target answer information is not selected as the answer information corresponding to the target sample question information. It can be understood that the answer selection result corresponding to any answer pair to be analyzed can be used to characterize the comparison between the two target answer information in any of the answer pairs to be analyzed; the target answer information corresponding to the first selection indication information in any of the answer pairs to be analyzed can be better than the target answer information corresponding to the second selection indication information.

[0106] In a specific embodiment, any answer pair to be analyzed can be displayed on the development terminal of the model developer; the model developer can perform an answer selection operation on the development terminal so that the development terminal obtains the answer selection result corresponding to any answer pair to be analyzed. Accordingly, the answer selection results corresponding to each of the multiple answer pairs to be analyzed can be obtained.

[0107] In a specific embodiment, the answer selection result may be obtained in the following manner:

[0108] Based on the target sample question information and the preset text processing model, each answer pair to be analyzed is processed for high-quality answer selection to obtain the selected answer information corresponding to each answer pair to be analyzed;

[0109] Based on the selected answer information corresponding to each answer pair to be analyzed, an answer selection result is generated.

[0110] In a specific embodiment, the preset text processing model can be used to perform high-quality answer selection processing on any answer pair to be analyzed. Specifically, the preset text processing model may include a natural language processing model. The preset text processing model may include a ChatGPT (Chat Generative Pre-trained Transformer) or a BERT (Bidirectional Encoder Representation from Transformers) model, etc.

[0111] In a specific embodiment, the selected answer information corresponding to any answer pair to be analyzed may refer to the target answer information selected by a preset text processing model from any of the answer pairs to be analyzed.

[0112] In a specific embodiment, each answer pair to be analyzed and the target sample question information can be input into a preset text processing model, so that the preset text processing model selects high-quality target answer information from each answer pair to be analyzed to obtain selected answer information. Specifically, any answer pair to be analyzed and the target sample question information can be input into a preset text processing model to obtain the selection probability corresponding to each target answer information in any of the answer pairs to be analyzed; the target answer information with the largest selection probability corresponding to any of the answer pairs to be analyzed can be used as the selected answer information corresponding to any of the answer pairs to be analyzed.

[0113] In a specific embodiment, the first selection indication information can be used as the answer selection indication information corresponding to the selected answer information in any answer pair to be analyzed; the second selection indication information can be used as the answer selection indication information corresponding to the non-selected answer information in any answer pair to be analyzed. The non-selected answer information corresponding to any answer pair to be analyzed can refer to the target answer information other than the selected answer information in any answer pair to be analyzed.

[0114] In the above embodiment, high-quality answer selection processing is performed on each answer pair to be analyzed through target sample question information and a preset text processing model to obtain the selected answer information corresponding to each answer pair to be analyzed, and the answer selection result is generated based on the selected answer information corresponding to each answer pair to be analyzed. This can achieve fast and accurate answer selection processing for each answer pair to be analyzed, thereby achieving rapid acquisition of the advantages and disadvantages between the answer information in each answer pair to be analyzed.

[0115] S207: Based on the answer selection result, filter abnormal answer pairs among the multiple answer pairs to be analyzed to obtain at least one target answer pair.

[0116] In a specific embodiment, an abnormal answer pair may refer to an answer pair to be analyzed in which corresponding answer selection results among multiple answer pairs to be analyzed contradict each other.

[0117] In a specific embodiment, at least one target answer pair may refer to an answer pair to be analyzed among multiple answer pairs to be analyzed that is used as a reference for model training. It is understandable that at least one target answer pair may be an answer pair to be analyzed among multiple answer pairs to be analyzed that has a credibility higher than a preset credibility.

[0118] In a specific embodiment, abnormal answer pairs can be determined from multiple answer pairs to be analyzed based on the answer selection results; and at least one target answer pair can be obtained by deleting the abnormal answer pairs from the multiple answer pairs to be analyzed.

[0119] In a specific embodiment, based on the answer selection results corresponding to the multiple answer pairs to be analyzed, a loop detection can be performed on the multiple answer pairs to be analyzed to obtain a loop detection result; when the loop detection result indicates that there is a loop between the answer selection results corresponding to the multiple target answer pairs to be analyzed among the multiple answer pairs to be analyzed, it can be determined that the above multiple answer pairs to be analyzed are abnormal answer pairs. Exemplarily, assuming that the answer information set contains 4 answer information, the answer pairs to be analyzed corresponding to the above answer information set include {(a1, a2), (a2, a3), (a1, a3), (a1, a4)}, and when the answer selection results corresponding to the above multiple answer pairs to be analyzed include {(rejected: a1, chosen: a2), (rejected: a2, chosen: a3), (chosen: a1, rejected: a3), (chosen: a1, rejected: a4)}, it can be determined that the answer selection results therein are abnormal. There is a cycle between the results (rejected: a1, chosen: a2), (rejected: a2, chosen: a3), and (chosen: a1, rejected: a3). Accordingly, it can be determined that the answer pair to be analyzed (a1, a2), the answer pair to be analyzed (a2, a3), and the answer pair to be analyzed (a1, a3) are abnormal answer pairs; among them, when the answer selection result is "(rejected: a1, chosen: a2)", it can be determined that the target answer information a2 is the selected answer information, and the target answer information a1 is the non-selected answer information.

[0120] In the above embodiment, based on the answer selection results, abnormal answer pairs among multiple answer pairs to be analyzed are filtered to obtain at least one target answer pair, which can achieve the filtering of abnormal answer pairs among the answer pairs to be analyzed, thereby improving the quality of sample information used to train the model, and further improving the accuracy of the answers generated by the question and answer model.

[0121] S209: Obtain answer generation indicator data corresponding to each target answer information in at least one target answer pair.

[0122] In a specific embodiment, the answer generation indicator data can be used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is each target answer information.

[0123] In a specific embodiment, the obtaining of answer generation indicator data corresponding to each target answer information in at least one target answer pair may include:

[0124] Each target answer information, the answer selection result corresponding to each target answer information, and the target sample question information are input into the preset question-answering model for answer prediction analysis to obtain answer generation indicator data.

[0125] In a specific embodiment, the two target answer information in any target answer pair, the answer selection indication information corresponding to each of the two target answer information, and the target sample question information can be input into a preset question and answer model for answer prediction analysis, so that the preset question and answer model can predict the probability that the answer information of the generated target sample question information is the target answer information based on the answer selection indication information corresponding to each of the two target answer information and the target sample question information. Accordingly, the answer generation indicator data corresponding to each of the two target answer information in any of the above target answer pairs can be obtained.

[0126] In the above embodiment, by inputting each target answer information, the answer selection result corresponding to each target answer information, and the target sample question information into the preset question and answer model for answer prediction analysis, answer generation index data can be obtained. This can enable the preset question and answer model to perform answer prediction analysis based on richer input information, thereby improving the accuracy of the answer prediction analysis, thereby improving the accuracy of the answer generation index data corresponding to each target answer information, and further improving the accuracy of the answers generated by the trained question and answer model.

[0127] S211: Determine target loss information corresponding to the target sample question information based on the answer generation indicator data and the answer selection result corresponding to each target answer pair.

[0128] In a specific embodiment, the target loss information may be used to characterize the degree of difference between the generation probability of the selected answer information and the generation probability of the rejected answer information in at least one target answer pair.

[0129] In a specific embodiment, each target answer pair includes target selection answer information and target rejection answer information. The target selection answer information in any target answer pair may refer to the corresponding answer selection indication information in any target answer pair as the first selection indication information. The target rejection answer information in any target answer pair may refer to the corresponding answer selection indication information in any target answer pair as the second selection indication information.

[0130] In a specific embodiment, the target selection answer information and the target rejection answer information in each target answer pair can be determined based on the answer selection results corresponding to each target answer pair; accordingly, the target loss information can be determined based on the answer generation indicator data corresponding to the target selection answer information in each target answer pair and the answer generation indicator data corresponding to the target rejection answer information in each target answer pair.

[0131] In a specific embodiment, the above-mentioned determination of the target loss information corresponding to the target sample question information based on the answer generation indicator data and the answer selection result corresponding to each target answer pair may include:

[0132] Generating indicator data based on the answer of the target selection answer information, determining first loss information corresponding to each target answer pair;

[0133] Determine second loss information corresponding to each target answer pair based on the answer generation indicator data of the target selection answer information and the answer generation indicator data of the target rejection answer information;

[0134] Target loss information is determined based on first loss information corresponding to each target answer pair and second loss information corresponding to each target answer pair.

[0135] In a specific embodiment, the first loss information may characterize the degree of difference between the generation probability of the target selection answer information and the maximum probability threshold. Specifically, the relationship between the degree of difference between the generation probability of the target selection answer information and the maximum probability threshold and the first loss information is in direct proportion; that is, the smaller the degree of difference between the generation probability of the target selection answer information and the maximum probability threshold, the smaller the corresponding first loss information; the greater the degree of difference between the generation probability of the target selection answer information and the maximum probability threshold, the greater the corresponding first loss information. Among them, the maximum probability threshold may refer to the maximum value in the value range of the generation probability. Exemplarily, when the value range of the generation probability is [0 to 1], the maximum probability threshold may be 1. It can be understood that model training based on the above-mentioned first loss information can make the generation probability of the target selection answer information of the preset question and answer model after training higher and higher, that is, it is expected that the preset question and answer model after training can output the target selection answer information when the question information is the target sample question information.

[0136] In the above embodiment, the first loss information corresponding to each target answer pair is determined based on the answer generation indicator data of the target selection answer information. The first loss information represents the degree of difference between the generation probability of the target selection answer information and the maximum probability threshold. Model training is performed based on the first loss information. The trained preset question and answer model can have a higher probability of generating better-quality answer information, thereby improving the accuracy of the answers generated by the question and answer model.

[0137] In a specific embodiment, the above method may further include:

[0138] Get the answer content length data of the target selection answer information;

[0139] Accordingly, the answer generation indicator data based on the target selection answer information and determining the first loss information corresponding to each target answer pair may include:

[0140] The first loss information is determined based on the answer content length data and the answer generation indicator data of the target selection answer information.

[0141] In a specific embodiment, the answer content length data of the target selection answer information can be used to characterize the content length of the target selection answer information. Specifically, the answer content length data of the target selection answer information can include the number of text characters of the target selection answer information. Exemplarily, assuming that the target selection answer information is "tomorrow is expected to be sunny", it can be determined that the answer content length data of the target selection answer information is "7".

[0142] In a specific embodiment, the first loss information can be obtained by the following formula:

[0143]

[0144] Among them, p θ (y w |x) is the first loss information; π θ (y w |x) Generate indicator data for the answer of the target selection answer information; |y w | is the length of the answer content.

[0145] In the above embodiment, by combining the answer content length data and the answer generation indicator data of the target selection answer information to determine the first loss information, the loss information can be standardized, so that the losses of answer information of different lengths can be comparable, and the trained model can be prevented from being biased towards generating shorter or longer answers, which in turn helps to improve the model's generalization ability for answer information of different content lengths.

[0146] In a specific embodiment, the second loss information may characterize the deviation between the degree of difference between the generation probability of the target selection answer information and the generation probability of the target rejection answer information and a preset degree of difference. Specifically, the greater the deviation between the degree of difference between the generation probability of the target selection answer information and the generation probability of the target rejection answer information and the preset degree of difference, the smaller the second loss information; correspondingly, the smaller the deviation between the degree of difference between the generation probability of the target selection answer information and the generation probability of the target rejection answer information and the preset degree of difference, the larger the second loss information. It can be understood that model training based on the above-mentioned second loss information can increase the difference between the generation probability of the target selection answer information and the generation probability of the target rejection answer information for the trained preset question-and-answer model, and the model will be more inclined to generate target selection answer information.

[0147] In a specific embodiment, the above-mentioned determination of the second loss information corresponding to each target answer pair based on the answer generation indicator data of the target selection answer information and the answer generation indicator data of the target rejection answer information may include:

[0148] Based on the answer generation indicator data of the target selection answer information, determine the first target indicator data of the target selection answer information;

[0149] Determining first difference indicator data based on the answer generation indicator data of the target selection answer information and the first target indicator data of the target selection answer information;

[0150] Based on the answer generation indicator data of the target rejection answer information, determine the second target indicator data of the target rejection answer information;

[0151] determining second difference indicator data based on the answer generation indicator data of the target rejection answer information and the second target indicator data of the target rejection answer information;

[0152] Based on the first difference indicator data, the second difference indicator data and the preset difference indicator data, second loss information is determined.

[0153] In a specific embodiment, the first target indicator data may represent the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding selected answer information.

[0154] In a specific embodiment, the first target indicator data can be obtained by the following formula:

[0155] p θ (y' w |x)=1-p θ (y w |x)

[0156] Among them, pθ (y' w |x) is the first target indicator data of the target selection answer information; p θ (y w |x) Generate indicator data for the answer to the above target selection answer information.

[0157] In a specific embodiment, the first difference indicator data may represent the ratio between the answer generation indicator data of the target selection answer information and the first target indicator data.

[0158] In a specific embodiment, the first difference index data of the target selection answer information can be obtained by the following formula:

[0159]

[0160] Wherein, k1 is the first difference index data of the above target selection answer information; p θ (y w |x) Generate indicator data for the answer to the above target selection answer information; p θ (y' w |x) is the first target indicator data for the above target selection answer information.

[0161] In a specific embodiment, the second target indicator data may represent the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding rejection answer information.

[0162] In a specific embodiment, the second target indicator data of the target rejection answer information can be obtained by the following formula:

[0163] p θ (y' L |x)=1-p θ (y L |x)

[0164] Among them, p θ (y' L |x) is the second target indicator data for the above target rejection answer information; p θ (y L |x) Generate indicator data for the answer to the above target rejection answer information.

[0165] In a specific embodiment, the second difference indicator data may represent the ratio between the answer generation indicator data of the target rejection answer information and the second target indicator data.

[0166] In a specific embodiment, the second difference indicator data of the target rejection answer information can be obtained by the following formula:

[0167]

[0168] Wherein, k2 is the second difference index data of the above target rejection answer information; p θ (y L |x) Generate indicator data for the answer to the above target rejection answer information; p θ (y' L |x) is the second target indicator data of the above target rejection answer information.

[0169] In a specific embodiment, the preset difference index data may represent the expected minimum difference between the preset first difference index data and the second difference index data. Specifically, the preset difference index data may be set according to actual application needs, and the present disclosure does not limit this.

[0170] In a specific embodiment, the second loss information can be obtained by the following formula:

[0171] OR θ (y w |y L )=logσ(logk1-logk2-γ)

[0172] Among them, OR θ (y w |y L ) is the second loss information; k1 is the first difference index data of the target selection answer information; k2 is the second difference index data of the target rejection answer information; γ is the preset difference index data.

[0173] In the above embodiment, by determining the first target indicator data of the target selection answer information based on the answer generation indicator data of the target selection answer information, determining the first difference indicator data based on the answer generation indicator data of the target selection answer information and the first target indicator data of the target selection answer information, determining the second target indicator data of the target rejection answer information based on the answer generation indicator data of the target rejection answer information, determining the second difference indicator data based on the answer generation indicator data of the target rejection answer information and the second target indicator data of the target rejection answer information, and determining the second loss information based on the first difference indicator data, the second difference indicator data and the preset difference indicator data, the second loss information can be made to more accurately express the deviation between the degree of difference between the generation probability of the target selection answer information and the generation probability of the target rejection answer information and the preset degree of difference, and then combining the above second loss information for model training, the difference between the generation probability of the target selection answer information and the generation probability of the target rejection answer information for the trained preset question and answer model can be increased, and the model will be more inclined to output the target selection answer information, that is, the probability of generating better-quality answer information for the trained preset question and answer model can be higher, thereby improving the accuracy of the answers generated by the question and answer model.

[0174] In a specific embodiment, the target loss information may be determined based on the first loss information corresponding to each target answer pair. Specifically, the first loss information corresponding to each target answer pair may be fused to obtain the target loss information.

[0175] In a specific embodiment, the target loss information may be determined based on the second loss information corresponding to each target answer pair. Specifically, the second loss information corresponding to each target answer pair may be fused to obtain the target loss information.

[0176] In a specific embodiment, when at least one target answer pair is a target answer pair, the first loss information corresponding to the target answer pair and the second loss information corresponding to the target answer pair may be superimposed to obtain the target loss information.

[0177] In a specific embodiment, the determining of the target loss information based on the first loss information corresponding to each target answer pair and the second loss information corresponding to each target answer pair may include:

[0178] Based on the first preset ratio information, the first loss information corresponding to each target answer pair is scaled down to obtain the third loss information corresponding to each target answer pair;

[0179] Based on the second preset ratio information, the second loss information corresponding to each target answer pair is scaled down to obtain fourth loss information corresponding to each target answer pair;

[0180] The third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair are fused to obtain the target loss information.

[0181] In a specific embodiment, the first preset ratio information can be used to indicate the reduction ratio for the first loss information. Specifically, the first preset ratio information can be set according to actual application needs, and the present disclosure does not limit it. Optionally, the value range of the first preset ratio information can be [0-1].

[0182] In a specific embodiment, the third loss information corresponding to any target answer pair can be obtained by the following formula:

[0183] L1=-αp θ (y w |x)

[0184] Wherein, L1 is the third loss information corresponding to any target answer pair; α is the first preset ratio information; p θ (y w |x) is the first loss information corresponding to any of the above target answer pairs.

[0185] In a specific embodiment, the second preset ratio information can be used to indicate the reduction ratio for the second loss information. Specifically, the second preset ratio information can be set according to actual application needs, and the present disclosure does not limit it. Optionally, the value range of the second preset ratio information can be [0-1].

[0186] In a specific embodiment, the fourth loss information corresponding to any target answer pair can be obtained by the following formula:

[0187] L2=-βOR θ (y w |y l )

[0188] Wherein, L2 is the fourth loss information corresponding to any target answer pair; β is the second preset ratio information; OR θ (y w |y l ) is the second loss information.

[0189] In a specific embodiment, when at least one target answer pair is a target answer pair, the third loss information corresponding to the target answer pair and the fourth loss information corresponding to the target answer pair may be fused to obtain the target loss information. Specifically, the target loss information may be obtained by superimposing the third loss information and the fourth loss information.

[0190] In a specific embodiment, when at least one target answer pair is a plurality of target answer pairs, the above-mentioned fusion processing of the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair to obtain the target loss information may include:

[0191] Superimposing the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair to obtain the fifth loss information corresponding to each target answer pair;

[0192] Perform mean processing on the fifth loss information corresponding to at least one target answer pair to obtain target loss information.

[0193] In a specific embodiment, the third loss information corresponding to any target answer pair and the fourth loss information corresponding to any of the above target answer pairs may be added together to obtain the fifth loss information corresponding to any of the above target answer pairs.

[0194] In a specific embodiment, the fifth loss information corresponding to at least one target answer pair is summed to obtain a summation result; then, the summation result can be divided by the number of answer pairs corresponding to the above multiple target answer pairs to obtain the target loss information.

[0195] In the above embodiment, by combining the first preset ratio information, the first loss information corresponding to each target answer pair is scaled down to obtain the third loss information corresponding to each target answer pair, so that the model can be fine-tuned based on the third loss information with a smaller ratio. By combining the second preset ratio information, the second loss information corresponding to each target answer pair is scaled down to obtain the fourth loss information corresponding to each target answer pair, so that the model can be fine-tuned based on the fourth loss information with a smaller ratio. The third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair are fused to obtain the target loss information. Fine-tuning the model through the target loss information can keep the model stable during the training process.

[0196] In the above embodiment, the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair are superimposed to obtain the fifth loss information corresponding to each target answer pair, and the fifth loss information corresponding to at least one target answer pair is averaged to obtain the target loss information. This allows the target loss information to more accurately express the differences described by the first loss information of multiple target answer pairs and the differences described by the corresponding second loss information, thereby improving the accuracy of the answers generated by the trained question-and-answer model.

[0197] S213: Based on the target loss information, the preset question-answering model is trained to obtain a target question-answering model.

[0198] In a specific embodiment, the target question-answering model may refer to a trained preset question-answering model.

[0199] In a specific embodiment, the preset question-answering model may be fine-tuned based on the target loss information to obtain the target question-answering model. Specifically, the preset question-answering model may be fine-tuned once based on the target loss information to obtain the target question-answering model.

[0200] In a specific embodiment, an update gradient can be determined based on the target loss information; based on the above-mentioned update gradient, the model parameters in the above-mentioned preset question and answer model can be updated to obtain an updated preset question and answer model; accordingly, the updated preset question and answer model can be used as the target question and answer model.

[0201] In the above embodiment, by obtaining target sample question information and a set of answer information corresponding to the target sample question information, wherein the answer information set is obtained by answer processing the target sample question information based on a preset question-answering model, it is possible to obtain a plurality of different answer information for the target sample question information, and then combine the answer information set to generate a plurality of answer pairs to be analyzed corresponding to the target sample question information, so as to generate answer pairs corresponding to the answer information set, and then obtain answer selection results corresponding to each of the plurality of answer pairs to be analyzed, wherein the answer selection results are used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information, so as to obtain the advantages and disadvantages of the answer information in each answer pair to be analyzed, and then, combined with the answer selection results, filter the abnormal answer pairs in the plurality of answer pairs to be analyzed to obtain at least one target answer pair, wherein the abnormal answer pairs are answer pairs to be analyzed whose corresponding answer selection results in the plurality of answer pairs to be analyzed contradict each other, so as to filter the abnormal answer pairs in the answer pairs to be analyzed, and then , obtain answer generation indicator data corresponding to each target answer information in at least one target answer pair, the answer generation indicator data is used to characterize the probability of each target answer information in the answer information corresponding to the target sample question information generated by the preset question and answer model, which can realize the acquisition of the answer generation indicator data corresponding to each target answer information, and then, combine the answer generation indicator data and the answer selection result corresponding to each target answer pair to determine the target loss information corresponding to the target sample question information, so that the target loss information can more accurately describe the difference between the generation probability of selecting answer information and the generation probability of rejecting answer information in at least one target answer pair, thereby increasing the difference between the generation probability of high-quality answer information and the generation probability of low-quality answer information for the trained target question and answer model, and then, combined with the target loss information, train the preset question and answer model to obtain the target question and answer model, which can increase the difference between the generation probability of high-quality answer information and the generation probability of low-quality answer information for the trained target question and answer model, thereby improving the accuracy of the answer generated by the question and answer model.

[0202] Specifically, Figure 3 FIG. 1 is a flow chart of a method for generating an answer according to an exemplary embodiment. Figure 3 As shown, the answer generation method can be used in electronic devices such as terminals or servers, and can specifically include the following steps:

[0203] S301: Obtaining information of questions to be answered;

[0204] S303: Input the question information to be answered into the target question-answering model for answer generation processing to obtain the answer generation result corresponding to the question information to be answered.

[0205] In a specific embodiment, the question information to be answered may refer to the question information that currently needs to be answered. For example, taking a shopping scenario as an example, the question information to be answered may be "How do I cancel an order?".

[0206] In a specific embodiment, the target object can perform a question input operation on the user terminal so that the user terminal obtains the question information to be answered. Further, when the answer generation method is applied to a server, the user terminal can send the question information to be answered to the server.

[0207] In a specific embodiment, the target question-answering model may be obtained based on the question-answering model training method.

[0208] In a specific embodiment, the answer generation result may be answer information corresponding to the question information to be answered generated by the target question-answering model.

[0209] In a specific embodiment, when the server receives the unanswered question information sent by the user terminal, it can input the unanswered question information into the target question-answering model for answer generation processing to obtain the answer generation result corresponding to the unanswered question information. Correspondingly, the server can send the answer generation result to the user terminal so that the user terminal displays the answer generation result.

[0210] In the above embodiment, by obtaining the question information to be answered, inputting the question information to be answered into the target question and answer model for answer generation processing, and obtaining the answer generation result corresponding to the question information to be answered, the accuracy of the answer generation result can be improved, thereby improving the user experience.

[0211] Figure 4 is a schematic diagram of an architecture of a question-answering model training method according to an exemplary embodiment; Figure 5 FIG. 1 is a schematic diagram showing a display result of an answer generation according to an exemplary embodiment. Specifically, Figure 4As shown, the target sample question information and the answer information set corresponding to the target sample question information can be obtained, wherein the answer information set is obtained by answering the target sample question information based on a preset question-answering model; based on the answer information set, a plurality of answer pairs to be analyzed corresponding to the target sample question information can be generated; based on the target sample question information and the preset text processing model, each answer pair to be analyzed can be processed for high-quality answer selection to obtain selected answer information corresponding to each answer pair to be analyzed; based on the selected answer information corresponding to each answer pair to be analyzed, an answer selection result can be generated, wherein the answer selection result is used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information; based on the answer selection result, abnormal answer pairs in the plurality of answer pairs to be analyzed can be filtered to obtain at least a target answer pair, wherein an abnormal answer pair is an answer pair to be analyzed in which the corresponding answer selection results in multiple answer pairs to be analyzed contradict each other; answer generation indicator data corresponding to each target answer information in at least one target answer pair can be obtained, wherein the answer generation indicator data is used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question and answer model is each target answer information; based on the answer generation indicator data and the answer selection results corresponding to each target answer pair, the target loss information corresponding to the target sample question information can be determined, wherein the target loss information is used to characterize the degree of difference between the generation probability of selecting answer information and the generation probability of rejecting answer information in at least one target answer pair; the preset question and answer model can be trained based on the target loss information to obtain the target question and answer model; accordingly, Figure 5 As shown in Figure 2, the question information to be answered can be obtained based on the target question-answering model trained. Figure 5 The question information to be answered is input into the target question-answering model for answer generation processing, and the answer generation result corresponding to the question information to be answered is obtained (such as Figure 5 The answer information displayed in "Based on the search results...").

[0212] Figure 6 FIG. 1 is a block diagram of a question-answering model training device according to an exemplary embodiment. Figure 6 As shown, the device may include:

[0213] The first information acquisition module 610 may be used to acquire target sample question information and an answer information set corresponding to the target sample question information; the answer information set is obtained by processing the answer to the target sample question information based on a preset question-answering model;

[0214] The answer pair generation module 620 may be used to generate a plurality of answer pairs to be analyzed corresponding to the target sample question information based on the answer information set;

[0215] The selection result acquisition module 630 may be used to obtain the answer selection results corresponding to each of the multiple answer pairs to be analyzed; the answer selection results are used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information;

[0216] The filtering module 640 may be used to filter abnormal answer pairs among the multiple answer pairs to be analyzed based on the answer selection results to obtain at least one target answer pair; the abnormal answer pairs are answer pairs to be analyzed whose corresponding answer selection results among the multiple answer pairs to be analyzed contradict each other;

[0217] The first data acquisition module 650 may be used to acquire answer generation indicator data corresponding to each target answer information in at least one target answer pair; the answer generation indicator data is used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is each target answer information;

[0218] The target loss determination module 660 may be used to determine target loss information corresponding to the target sample question information based on the answer generation indicator data and the answer selection result corresponding to each target answer pair; the target loss information is used to characterize the difference between the generation probability of the selected answer information and the generation probability of the rejected answer information in at least one target answer pair;

[0219] The training module 670 can be used to train the preset question-answering model based on the target loss information to obtain the target question-answering model.

[0220] In a specific embodiment, each target answer pair includes target selection answer information and target rejection answer information; the target loss determination module 660 may include:

[0221] A first loss determination module may be used to determine first loss information corresponding to each target answer pair based on answer generation indicator data of target selection answer information; the first loss information represents the degree of difference between the generation probability of the target selection answer information and the maximum probability threshold;

[0222] The second loss determination module can be used to determine the second loss information corresponding to each target answer pair based on the answer generation index data of the target selection answer information and the answer generation index data of the target rejection answer information; the second loss information represents the deviation between the difference degree between the generation probability of the target selection answer information and the generation probability of the target rejection answer information and the preset difference degree;

[0223] The target loss acquisition module can be used to determine the target loss information based on the first loss information corresponding to each target answer pair and the second loss information corresponding to each target answer pair.

[0224] In a specific embodiment, the second loss determination module may include:

[0225] The first indicator determination module can be used to generate indicator data based on the answer of the target selection answer information, and determine the first target indicator data of the target selection answer information; the first target indicator data represents the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding selection answer information;

[0226] The second indicator determination module may be used to determine first difference indicator data based on the answer generation indicator data of the target selection answer information and the first target indicator data of the target selection answer information; the first difference indicator data represents the ratio between the answer generation indicator data of the target selection answer information and the first target indicator data;

[0227] The third indicator determination module can be used to generate indicator data based on the answer to the target rejection answer information to determine the second target indicator data of the target rejection answer information; the second target indicator data represents the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding rejection answer information;

[0228] A fourth indicator determination module may be used to determine second difference indicator data based on the answer generation indicator data of the target rejection answer information and the second target indicator data of the target rejection answer information; the second difference indicator data represents the ratio between the answer generation indicator data of the target rejection answer information and the second target indicator data;

[0229] The second loss acquisition module can be used to determine the second loss information based on the first difference indicator data, the second difference indicator data and the preset difference indicator data.

[0230] In a specific embodiment, the above device may further include:

[0231] The second data acquisition module can be used to obtain the answer content length data of the target selection answer information;

[0232] Accordingly, the first loss determination module may include:

[0233] The first loss acquisition module can be used to determine the first loss information based on the answer content length data and the answer generation indicator data of the target selection answer information.

[0234] In a specific embodiment, the target loss acquisition module may include:

[0235] The third loss acquisition module may be used to scale down the first loss information corresponding to each target answer pair based on the first preset ratio information to obtain the third loss information corresponding to each target answer pair;

[0236] The fourth loss acquisition module may be used to scale down the second loss information corresponding to each target answer pair based on the second preset ratio information to obtain the fourth loss information corresponding to each target answer pair;

[0237] The fusion processing module can be used to fuse the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair to obtain the target loss information.

[0238] In a specific embodiment, the above fusion processing module may include:

[0239] A superposition processing module may be used to perform superposition processing on the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair to obtain the fifth loss information corresponding to each target answer pair;

[0240] The mean processing module can be used to perform mean processing on the fifth loss information corresponding to at least one target answer pair to obtain target loss information.

[0241] In a specific embodiment, the above device may further include:

[0242] The answer selection processing module can be used to perform high-quality answer selection processing on each answer pair to be analyzed based on the target sample question information and the preset text processing model, and obtain the selected answer information corresponding to each answer pair to be analyzed;

[0243] The selection result generation module can be used to generate answer selection results based on the selection answer information corresponding to each answer pair to be analyzed.

[0244] In a specific embodiment, the first data acquisition module 650 may include:

[0245] The answer prediction and analysis module can be used to input each target answer information, the answer selection result corresponding to each target answer information, and the target sample question information into the preset question-answering model for answer prediction analysis to obtain answer generation indicator data.

[0246] In a specific embodiment, the answer information set includes non-reference answer information, rejected answer information and multiple reference answer information; the above device may also include:

[0247] The preset answer acquisition module can be used to obtain the preset rejection answer information;

[0248] The first answer generation module can be used to input the preset answer reference information and the target sample question information into the preset question answering model, so that the preset question answering model uses the preset answer reference information as reference information, performs answer generation processing on the target sample question information, and obtains multiple reference answer information;

[0249] The second answer generation module can be used to input the target sample question information into the preset question-answering model for answer generation processing to obtain non-reference answer information;

[0250] The set generation module can be used to collect non-reference answer information, preset rejected answer information and multiple reference answer information as an answer information set.

[0251] Figure 7 FIG. 1 is a block diagram of an answer generation device according to an exemplary embodiment. Figure 7 As shown, the device may include:

[0252] The second information acquisition module 710 can be used to obtain the question information to be answered;

[0253] The answer generation processing module 720 can be used to input the question information to be answered into the target question and answer model for answer generation processing to obtain the answer generation result corresponding to the question information to be answered; wherein, the target question and answer model is obtained based on the above-mentioned question and answer model training method.

[0254] Regarding the device in the above embodiment, the specific manner in which each module and unit performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0255] Figure 8 is a block diagram of an electronic device for training a target question-answering model or generating an answer generation result corresponding to a question to be answered according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The electronic device includes a processor, a memory and a network interface connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a question-answering model training method or an answer generation method is implemented.

[0256] Fig. 9is a block diagram of another electronic device for training a target question-answering model or generating an answer generation result corresponding to a question to be answered according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig. 9 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a question-and-answer model training method or an answer generation method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0257] Those skilled in the art will understand that Figure 8 or Fig. 9 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0258] In an exemplary embodiment, an electronic device is also provided, including: a processor; a memory for storing a computer program; wherein the processor is configured to execute the computer program to implement the question-answering model training method or answer generation method as in the embodiment of the present disclosure.

[0259] In an exemplary embodiment, a computer-readable storage medium is also provided. When the computer program in the storage medium is executed by a processor of an electronic device, the electronic device can execute the question-and-answer model training method or answer generation method in the embodiment of the present disclosure.

[0260] In an exemplary embodiment, a computer program product including a computer program is also provided, which, when executed on a computer, enables the computer to execute the question-answering model training method or answer generation method in the embodiments of the present disclosure.

[0261] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0262] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0263] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0264] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0265] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A question-answering model training method, characterized in that: The method comprises: Obtain target sample question information and a set of answer information corresponding to the target sample question information; the answer information set is obtained by answering the target sample question information based on a preset question-answering model; Based on the answer information set, generating a plurality of answer pairs to be analyzed corresponding to the target sample question information; Obtaining answer selection results corresponding to each of the plurality of answer pairs to be analyzed; the answer selection results are used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information; Based on the answer selection results, abnormal answer pairs among the multiple answer pairs to be analyzed are filtered to obtain at least one target answer pair; the abnormal answer pairs are answer pairs to be analyzed whose corresponding answer selection results among the multiple answer pairs to be analyzed contradict each other; Obtain answer generation indicator data corresponding to each target answer information in the at least one target answer pair; the answer generation indicator data is used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is each target answer information; Based on the answer generation indicator data and the answer selection result corresponding to each target answer pair, determine the target loss information corresponding to the target sample question information; the target loss information is used to characterize the difference between the generation probability of the selected answer information and the generation probability of the rejected answer information in the at least one target answer pair; Based on the target loss information, the preset question-answering model is trained to obtain a target question-answering model.

2. The method according to claim 1, characterized in that Each target answer pair includes target selection answer information and target rejection answer information; the step of determining target loss information corresponding to the target sample question information based on the answer generation indicator data and the answer selection result corresponding to each target answer pair includes: Based on the answer generation indicator data of the target selection answer information, determining the first loss information corresponding to each target answer pair; the first loss information represents the degree of difference between the generation probability of the target selection answer information and the maximum probability threshold; Based on the answer generation index data of the target selection answer information and the answer generation index data of the target rejection answer information, determining the second loss information corresponding to each target answer pair; the second loss information represents the deviation between the difference between the generation probability of the target selection answer information and the generation probability of the target rejection answer information and the preset difference degree; The target loss information is determined based on the first loss information corresponding to each target answer pair and the second loss information corresponding to each target answer pair.

3. The method according to claim 2, characterized in that The determining the second loss information corresponding to each target answer pair based on the answer generation indicator data of the target selection answer information and the answer generation indicator data of the target rejection answer information comprises: Based on the answer generation indicator data of the target selected answer information, determine the first target indicator data of the target selected answer information; the first target indicator data represents the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding selected answer information; Determine first difference index data based on the answer generation index data of the target selection answer information and the first target index data of the target selection answer information; the first difference index data represents the ratio between the answer generation index data of the target selection answer information and the first target index data; Based on the answer generation indicator data of the target rejection answer information, determine the second target indicator data of the target rejection answer information; the second target indicator data represents the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is not the corresponding rejection answer information; Determine second difference indicator data based on the answer generation indicator data of the target rejection answer information and the second target indicator data of the target rejection answer information; the second difference indicator data represents the ratio between the answer generation indicator data of the target rejection answer information and the second target indicator data; The second loss information is determined based on the first difference indicator data, the second difference indicator data and preset difference indicator data.

4. The method according to claim 2, characterized in that: The method further comprises: Obtaining the answer content length data of the target selection answer information; The answer generation indicator data based on the target selection answer information, and determining the first loss information corresponding to each target answer pair, comprises: The first loss information is determined based on the answer content length data and the answer generation index data of the target selection answer information.

5. The method according to claim 2, characterized in that: The determining the target loss information based on the first loss information corresponding to each target answer pair and the second loss information corresponding to each target answer pair includes: Based on the first preset ratio information, the first loss information corresponding to each target answer pair is scaled down to obtain the third loss information corresponding to each target answer pair; Based on the second preset ratio information, the second loss information corresponding to each target answer pair is scaled down to obtain the fourth loss information corresponding to each target answer pair; The third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair are fused to obtain the target loss information.

6. The method according to claim 5, characterized in that In the case where the at least one target answer pair is a plurality of target answer pairs, the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair are fused to obtain the target loss information, including: Superimposing the third loss information corresponding to each target answer pair and the fourth loss information corresponding to each target answer pair to obtain the fifth loss information corresponding to each target answer pair; Perform mean processing on the fifth loss information corresponding to the at least one target answer pair to obtain the target loss information.

7. The method according to claim 1, characterized in that The answer selection results include the following ways to obtain: Based on the target sample question information and the preset text processing model, a high-quality answer selection process is performed on each answer pair to be analyzed to obtain selected answer information corresponding to each answer pair to be analyzed; The answer selection result is generated based on the selected answer information corresponding to each answer pair to be analyzed.

8. The method according to claim 1, characterized in that: The obtaining of answer generation indicator data corresponding to each target answer information in the at least one target answer pair includes: Each target answer information, the answer selection result corresponding to each target answer information and the target sample question information are input into the preset question-answer model for answer prediction analysis to obtain the answer generation indicator data.

9. The method according to claim 1, characterized in that: The answer information set includes non-reference answer information, rejected answer information and multiple reference answer information; the answer information set includes the following acquisition methods: Obtain preset rejection answer information; Inputting the preset answer reference information and the target sample question information into the preset question-answering model, so that the preset question-answering model uses the preset answer reference information as reference information, performs answer generation processing on the target sample question information, and obtains the plurality of reference answer information; Inputting the target sample question information into the preset question-answering model for answer generation processing to obtain the non-reference answer information; The non-reference answer information, the preset rejected answer information and the plurality of reference answer information are taken as the answer information set.

10. A question-answering model training device, characterized in that: The device comprises: A first information acquisition module is used to acquire target sample question information and an answer information set corresponding to the target sample question information; the answer information set is obtained by answer processing of the target sample question information based on a preset question-answering model; An answer pair generation module, used to generate a plurality of answer pairs to be analyzed corresponding to the target sample question information based on the answer information set; A selection result acquisition module is used to obtain the answer selection results corresponding to each of the plurality of answer pairs to be analyzed; the answer selection results are used to indicate whether any answer information is selected as the answer information corresponding to the target sample question information; A filtering module, configured to filter abnormal answer pairs among the plurality of answer pairs to be analyzed based on the answer selection results to obtain at least one target answer pair; the abnormal answer pairs are answer pairs to be analyzed for which the corresponding answer selection results among the plurality of answer pairs to be analyzed contradict each other; A first data acquisition module is used to acquire answer generation indicator data corresponding to each target answer information in the at least one target answer pair; the answer generation indicator data is used to characterize the probability that the answer information corresponding to the target sample question information generated by the preset question-answering model is each target answer information; A target loss determination module, configured to determine target loss information corresponding to the target sample question information based on the answer generation indicator data and the answer selection result corresponding to each target answer pair; the target loss information is used to characterize the degree of difference between the generation probability of the selected answer information and the generation probability of the rejected answer information in the at least one target answer pair; A training module is used to train the preset question-answering model based on the target loss information to obtain a target question-answering model.

11. An electronic device, characterized in that: include: processor; memory for storing computer programs; Wherein, the processor is configured to execute the computer program to implement the question-answering model training method described in any one of claims 1 to 9.

12. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the question-answering model training method described in any one of claims 1 to 9 is implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by an electronic device, the question-answering model training method described in any one of claims 1 to 9 is implemented.