Question and answer model training method, data processing method, text processing method and video processing method
By generating and using training data based on raw and slicing training data to train the initial question-and-answer model, the problem of poor model prediction effect under training data of different lengths is solved, and efficient model training and labor cost savings are achieved.
Patent Information
- Application Number
- CN202411379497.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, pre-trained models trained using training data of different lengths have low prediction effects when processing data of different lengths, resulting in a single model performance. Due to the high cost of labeling long text data, the cost of retraining the model is also very high.
By obtaining the original training data and its segmented training data, the first answer data and the second answer data are generated using the initial question and answer model, the first training data pair and the second training data pair are generated based on these data, the initial question and answer model is trained to obtain the target question and answer model.
The annotation training data can be obtained without high manual annotation costs, saving labor costs, and improving the model's processing accuracy for different data lengths.
Smart Images

Figure CN119539071A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular to a question-answering model training method, a data processing method, a text processing method, and a video processing method. Background Art
[0002] With the outstanding performance of large models in command following ability, large models are gradually widely used in various technical fields. In practical applications, pre-trained models trained under training data of different lengths are not universal. For example, in the field of text prediction, labeled sample data is expensive and scarce. Models trained on short text data often have poor prediction effects on long text data, and vice versa. This makes the performance of the trained model relatively simplistic. Therefore, if a model trained based on short text data is used to predict long text data, the accuracy of the prediction result is low. Therefore, it is necessary to retrain the model using long text data and use the retrained model to process the long text data. However, due to the high cost of labeling long text data, it still costs a lot to retrain the model using the labeled long text data. Therefore, there is an urgent need for a method to solve the technical problem of low accuracy caused by using a trained model to process different data. Summary of the invention
[0003] In view of this, the embodiments of this specification provide a question-answering model training method, a data processing method, a text processing method, and a video processing method. One or more embodiments of this specification also relate to a question-answering model training device, a data processing device, a text processing device, and a video processing device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a question-answering model training method is provided, comprising: Obtaining original training data, segmented training data of the original training data, and a to-be-trained problem of the segmented training data, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; Inputting the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; Inputting the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; Generate a first training data pair based on the segmented training data, the question to be trained, the first answer data, and the second answer data; and generate a second training data pair based on the original training data, the question to be trained, the first answer data, and the second answer data; The initial question-answering model is trained according to the first training data pair and the second training data pair to obtain a target question-answering model.
[0005] According to a second aspect of an embodiment of this specification, a question-answering model training device is provided, comprising: an acquisition module, configured to acquire original training data, segmented training data of the original training data, and a to-be-trained problem of the segmented training data, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; A first input module is configured to input the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; A second input module is configured to input the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; A generating module configured to generate a first training data pair based on the segmented training data, the problem to be trained, the first answer data and the second answer data, and to generate a second training data pair based on the original training data, the problem to be trained, the first answer data and the second answer data; The training module is configured to train the initial question-answering model based on the first training data pair and the second training data pair to obtain a target question-answering model.
[0006] According to a third aspect of an embodiment of this specification, another question-answering model training method is provided, which is applied to a cloud-side device, including: In response to the question-answering model training instruction, original training data, segmented training data of the original training data, and questions to be trained of the segmented training data are obtained, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; Inputting the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; Inputting the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; Generate a first training data pair based on the segmented training data, the question to be trained, the first answer data, and the second answer data; and generate a second training data pair based on the original training data, the question to be trained, the first answer data, and the second answer data; Training the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model; The target model parameters of the target question-answering model are fed back to the target terminal.
[0007] According to a fourth aspect of an embodiment of this specification, another question-answering model training device is provided, which is applied to a cloud-side device, including: A response module is configured to obtain original training data, segmented training data of the original training data, and questions to be trained of the segmented training data in response to a question-answering model training instruction, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; A first data input module is configured to input the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; A second data input module is configured to input the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; a data pair generating module configured to generate a first training data pair based on the segmented training data, the problem to be trained, the first answer data and the second answer data, and to generate a second training data pair based on the original training data, the problem to be trained, the first answer data and the second answer data; A model training module is configured to train the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model; The feedback module is configured to feed back the target model parameters of the target question-answering model to the target terminal.
[0008] According to a fifth aspect of the embodiments of this specification, a data processing method is provided, including: Obtaining business data to be processed and issues to be determined for the business data to be processed; The business data to be processed and the question to be determined are input into a target question-answering model to obtain a target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0009] According to a sixth aspect of an embodiment of this specification, there is provided a data processing device, including: A business data acquisition module is configured to acquire business data to be processed and problems to be determined for the business data to be processed; The business data input module is configured to input the business data to be processed and the question to be determined into the target question-answering model to obtain the target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0010] According to a seventh aspect of the embodiments of this specification, a text processing method is provided, including: Acquire a text to be processed and a text problem to be determined for the text to be processed, wherein the text to be processed includes a long text to be processed or a short text to be processed; The text to be processed and the text question to be determined are input into a target question-answering model to obtain a target text answer to the text question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0011] According to an eighth aspect of the embodiments of this specification, there is provided a text processing device, including: A text acquisition module is configured to acquire a text to be processed and a text problem to be determined for the text to be processed, wherein the text to be processed includes a long text to be processed or a short text to be processed; The text input module is configured to input the text to be processed and the text question to be determined into the target question-answering model to obtain the target text answer to the text question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0012] According to a ninth aspect of the embodiments of this specification, a video processing method is provided, including: Obtaining a video to be processed and a question to be determined for the video to be processed, wherein the video to be processed includes a long video to be processed or a short video to be processed; The video to be processed and the question to be determined are input into a target question-answering model to obtain a target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0013] According to a tenth aspect of the embodiments of this specification, a video processing device is provided, including: A video acquisition module is configured to acquire a video to be processed and a problem to be determined for the video to be processed, wherein the video to be processed includes a long video to be processed or a short video to be processed; The video input module is configured to input the video to be processed and the question to be determined into the target question-answering model to obtain the target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0014] According to an eleventh aspect of the embodiments of this specification, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned question-answering model training method, data processing method, text processing method or video processing method are implemented.
[0015] According to the twelfth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned question and answer model training method, data processing method, text processing method or video processing method are implemented.
[0016] According to the thirteenth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned question and answer model training method, data processing method, text processing method or video processing method.
[0017] An embodiment of the present specification realizes that, through the initial question-answering model, the first answer data of the question to be trained under the segmented training data and the second answer data under the original training data are obtained, and the first training data pair is constructed based on the segmented training data, the question to be trained, the first answer data and the second answer data, respectively, and the second training data pair is constructed based on the original training data, the question to be trained, the first answer data and the second answer data, so that the first training data pair and the second training data pair can be used to train the initial question-answering model, without the need to spend high manual annotation costs to obtain annotated training data, thus saving labor costs. Since the original training data and the segmented training data are training data of different data lengths, the initial question-answering model is trained using the second answer data corresponding to the original training data and the first answer data corresponding to the segmented training data, so that the target question-answering model obtained through training has both the ability to process the original training data and the ability to process the segmented training data, thereby improving the accuracy of processing data of different data lengths. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flowchart of a question-answering model training method provided by an embodiment of this specification; Figure 2 is a process flow chart of a question-answering model training method provided by an embodiment of this specification; Figure 3 It is a structural schematic diagram of a question-answering model training device provided by an embodiment of this specification; Figure 4 is a flowchart of another question-answering model training method provided by an embodiment of this specification; Figure 5 It is a structural schematic diagram of another question-answering model training device provided by an embodiment of this specification; Figure 6 is a flow chart of a data processing method provided by an embodiment of this specification; Figure 7 is a structural schematic diagram of a data processing device provided by an embodiment of this specification; Figure 8 is a flowchart of a text processing method provided by an embodiment of this specification; Fig. 9 is a structural schematic diagram of a text processing device provided by an embodiment of this specification; Fig.10 is a flow chart of a video processing method provided by an embodiment of this specification; Fig.11 is a structural schematic diagram of a video processing device provided by an embodiment of this specification; Fig.12 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0019] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0020] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0021] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0022] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0023] First, the terms involved in one or more embodiments of this specification are explained.
[0024] Pre-trained Language Models: Pre-training is done by learning commonalities and acquiring general knowledge from a large amount of text data obtained at low cost through a certain pre-training method. Pre-trained models can be fine-tuned on a small amount of target task data to transfer general knowledge to the fine-tuned model and enable it to handle the target task well.
[0025] Large Language Models: Large-scale pre-trained language models with billions to hundreds of billions of parameters, trained using more than one trillion pieces of text data.
[0026] Supervised Fine-Tuning: Train the model with labeled data of a specific format and type to give a specific form of answer based on the context, so as to enhance the instruction-obeying ability of the large language model.
[0027] Direct Preference Optimization: Direct Preference Optimization is a method for training language models that aims to directly guide the model's generation behavior through user preferences. Unlike traditional supervised learning methods, direct preference optimization emphasizes using user preference information for multiple generation options to optimize the model, which can better reflect the user's actual needs and expectations. This method usually collects comparative data generated by samples and then uses this data to improve the model's performance in tasks that meet user preferences, thereby achieving higher quality and more relevant text generation.
[0028] In this specification, a question-answering model training method, a data processing method, a text processing method and a video processing method are provided. This specification also involves a question-answering model training device, a data processing device, a text processing device and a video processing device, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0029] See also Figure 1 , Figure 1 A flowchart of a question-answering model training method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0030] Step 102: Obtain original training data, segmented training data of the original training data, and problems to be trained of the segmented training data, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold.
[0031] In practical applications, if the model is required to have the ability to process data of different lengths at the same time, the model can be trained using training data of different data lengths to improve the model's data processing capabilities.
[0032] Among them, the original training data refers to the training data whose data length is greater than the preset length threshold. The original training data can specifically be a long text or a long video used for training. If the original training data is a long text, the preset length threshold is a preset character threshold, for example, the preset character threshold can be 512 characters, etc.; if the original training data is a long video, the preset length threshold is a preset duration threshold, for example, the preset duration threshold can be 1 minute, 2 minutes, etc. The segmented training data refers to the training data in the original training data whose data length is less than or equal to the preset length threshold. Accordingly, the segmented training data can be a short text or a short video, etc. The problem to be trained refers to the problem generated based on the original training data or the segmented training data.
[0033] Specifically, the initial question-answering model can be subsequently trained by obtaining the original training data, the segmented training data of the original training data, and the questions to be trained to generate the target question-answering model. In practical applications, the original training data can be directly obtained, and the segmented training data can be obtained by manual segmentation and then input into the terminal for processing, or it can be obtained by segmenting the original training data after the terminal obtains the original training data. The specific implementation method of the terminal segmenting the original training data to obtain the segmented training data is as follows: In a specific implementation manner provided in this specification, obtaining the segmented training data of the original training data includes: According to a preset length threshold, the original training data is segmented to obtain at least two segmented training data; or According to the problem to be trained, the original training data is segmented to obtain at least two segmented training data.
[0034] Specifically, the original training data can be segmented according to a preset length threshold, so that a plurality of segmented training data can be obtained. Taking the original training data as a long text and the preset length threshold as 512 characters as an example, the obtained long text is segmented into a plurality of short texts with a data length less than or equal to 512 characters. In this case, after obtaining the segmented training data, a corresponding to-be-trained question can be generated for each segmented training data.
[0035] In actual applications, when the terminal obtains the original training data, it can also obtain multiple problems to be trained for the original training data. Based on this, in addition to the above method, the data content corresponding to each problem to be trained can be screened in the original training data according to the obtained multiple problems to be trained, and segmented based on this, so as to obtain the segmented training data corresponding to each problem to be trained. It should be noted that if the data length of the segmented training data is greater than the preset length threshold at this time, the segmented training data needs to be segmented again according to the preset length threshold to obtain segmented training data with a data length less than or equal to the preset length threshold. Take the original training data as a long video, and the length of the long video is 3 minutes. For example, for the long video, the questions to be trained 1, 2 and 3 are obtained, and the video clips corresponding to the three questions to be trained are determined in the long video respectively: the video clip corresponding to the question to be trained 1 is video clip 1, and the length of video clip 1 is 10 seconds; the video clip corresponding to the question to be trained 2 is video clip 2, and the length of video clip 2 is 30 seconds; the video clip corresponding to the question to be trained 3 is video clip 3, and the length of video clip 3 is 1 minute. If the preset length threshold is 1 minute, since the lengths of video clip 1, video clip 2 and video clip 3 are all less than 1 minute, it can be determined that video clip 1, video clip 2 and video clip 3 are all short videos under the long video (i.e., segmented training data).
[0036] In one embodiment provided in this specification, original training data can be segmented in different segmentation methods to obtain segmented training data less than or equal to a preset data length, thereby improving the diversity and flexibility of obtaining segmented training data.
[0037] Further, as described above, if the problem to be trained has not been determined after the segmented training data is obtained, the problem to be trained corresponding to each segmented training data can be generated respectively. In practical applications, the problem to be trained can be generated by manual labeling, or by the following implementation method: In a specific implementation manner provided in this specification, obtaining the problem to be trained of the segmented training data includes: The segmented training data is input into a question generation model to obtain the to-be-trained question corresponding to the segmented training data.
[0038] The question generation model is used to generate questions for segmented training data or original training data. Specifically, after segmenting the original training data according to a preset length threshold and obtaining a plurality of segmented training data, the segmented training data can be input into the question generation model, and the questions to be trained output by the question generation model can be obtained.
[0039] In one embodiment provided in the present specification, after the original training data is segmented, corresponding questions to be trained can be generated for each segmented training data by manual labeling or by using a question generation model.
[0040] Step 104: Input the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data for the question to be trained.
[0041] The initial question-answering model refers to a model that has been trained to generate answers to questions under data whose length is less than or equal to a preset length threshold. In practical applications, the initial question-answering model can be used to generate answers to questions under short texts or short videos. The first answer data is the answer data to the question to be trained under the segmented training data generated by the initial question-answering model.
[0042] Specifically, after obtaining the segmented training data and the question to be trained, the segmented training data and the question to be trained can be input into the initial question-answering model to obtain the first answer data of the question to be trained under the segmented training data. Based on this, the paired training data of <segmented training data, question to be trained, first answer data> can be obtained.
[0043] Step 106: Input the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained.
[0044] Among them, the second answer data is the answer data of the question to be trained under the original training data generated by the initial question-answering model. Specifically, after obtaining the original training data and the question to be trained, the original training data and the question to be trained are input into the initial question-answering model, and the second answer data of the question to be trained generated by the initial question-answering model under the original training data can be obtained. Based on this, the paired training data of <original training data, question to be trained, second answer data> can be obtained. It should be noted that the first answer data and the second answer data are specifically the answer data of the same question to be trained under the segmented training data and the original training data, respectively.
[0045] Since the initial question-answering model is a trained question-answering model, and the initial question-answering model is used to generate answer data for questions corresponding to data whose data length is less than or equal to a preset length threshold, the accuracy of the first answer data obtained based on the initial question-answering model will be higher than that of the second answer data. Based on the difference between the original training data and the split training data, and the difference in accuracy between the first answer data and the second answer data, the original training data, the split training data, the first answer data, and the second answer data can be used to construct a data set for further training of the initial question-answering model.
[0046] Step 108: Generate a first training data pair based on the segmented training data, the question to be trained, the first answer data and the second answer data; generate a second training data pair based on the original training data, the question to be trained, the first answer data and the second answer data.
[0047] After obtaining the paired training data of <segmented training data, questions to be trained, first answer data> and <original training data, questions to be trained, second answer data>, a data set for training the initial question-answering model can be constructed based on these two paired training data, so that the trained initial question-answering model can further have the ability to generate more accurate answers to questions with data length greater than a preset length threshold.
[0048] Among them, the first training data pair specifically refers to a training data pair consisting of segmented training data, questions to be trained, first answer data and second answer data; the second training data pair specifically refers to a training data pair consisting of original training data, questions to be trained, first answer data and second answer data.
[0049] Specifically, after obtaining the split training data, original training data, questions to be trained, first answer data and second answer data, i.e., paired training data of <segmented training data, questions to be trained, first answer data> and <original training data, questions to be trained, second answer data>, preference optimization alignment is performed between the original training data and the segmented training data based on these two paired training data.
[0050] Since the data lengths of the original training data and the split training data are different, the answer data obtained by using the initial question-answering model for the training questions in the original training data and the split training data will also be different. Therefore, corresponding training data pairs can be constructed for the original training data and the split training data respectively.
[0051] In a specific implementation provided in this specification, generating a first training data pair based on the segmented training data, the question to be trained, the first answer data, and the second answer data includes: Determine the first answer data as the segmented positive training sample of the to-be-trained question under the segmented training data; Determine the second answer data as the segmented negative training sample of the to-be-trained question under the segmented training data; A first training data pair is generated based on the segmented training data, the problem to be trained, the segmented positive training samples, and the segmented negative training samples.
[0052] As described above, there is a difference in accuracy between the first answer data and the second answer data obtained based on the initial question-answering model, and the accuracy of the first answer data is higher than that of the second answer data. In order to enable the initial question-answering model to learn the corresponding first answer data and second answer data in the subsequent process, on the basis of improving the accuracy of the second answer data and ensuring the accuracy of the first answer data, the positive and negative samples corresponding to the question to be trained can be determined based on the first answer data and the second answer data, and the initial question-answering model can be trained.
[0053] For the split training data, the first answer data of the problem to be trained under the split training data already has a high accuracy. Therefore, the first answer data can be determined as a positive sample of the problem to be trained under the split training data, that is, a split positive training sample. Since the accuracy of the second answer data is relatively low, the second answer data can be determined as a negative sample of the problem to be trained under the split training data, that is, a split negative training sample. Based on this, the first training data pair can be obtained, that is, <split training data, problem to be trained, first answer data, second answer data>, that is, <split training data, problem to be trained, split positive training sample, split negative training sample>.
[0054] Further, in another specific implementation manner provided in this specification, generating a second training data pair based on the original training data, the question to be trained, the first answer data, and the second answer data includes: Determine the first answer data as the original positive training sample of the to-be-trained question under the original training data; Determine the second answer data as the original negative training sample of the to-be-trained question under the original training data; A second training data pair is generated based on the original training data, the problem to be trained, the original positive training sample and the original negative training sample.
[0055] In the case of the original training data, the first answer data under the split training data can be regarded as the answer data with higher accuracy under the original training data. Similar to the construction process of the first training data pair of the split training data, the first answer data is determined as the positive sample of the problem to be trained under the original training data, that is, the original positive training sample, and the second answer data of the problem to be trained under the original training data is determined as the negative sample, that is, the original negative training sample. Based on this, the second training data pair of the original training data can be constructed, that is, <original training data, problem to be trained, first answer data, second answer data>, that is, <original training data, problem to be trained, original positive training sample, original negative training sample>.
[0056] In one embodiment provided in this specification, the answer data of the question to be trained under the original training data and the split training data are generated using the initial question-answering model, and the second training data pair of the question to be trained under the original training data and the second training data pair of the question to be trained under the split training data are constructed based on the first answer data and the second answer data, so as to train the initial question-answering model using the first training data pair and the second training data pair. Thus, a large number of training data pairs can be obtained without manual annotation, reducing the labor cost of obtaining the training data pairs and the training cost of training the initial question-answering model.
[0057] Step 110: Train the initial question-answering model based on the first training data pair and the second training data pair to obtain a target question-answering model.
[0058] After the first training data pair and the second training data pair are constructed, the initial question-answering model can be trained using the first training data pair and the second training data pair to obtain the target question-answering model. The target question-answering model refers to the question-answering model after training. The target question-answering model can process data of different data lengths and output answer data with higher accuracy. The target question-answering model can be obtained by training using the following method: In a specific implementation manner provided in this specification, training the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model includes: Determine a reference output distribution of the initial question-answering model according to the first training data pair, wherein the reference output distribution is used to constrain an output distribution of the initial question-answering model; Acquire the original training data and the problem to be trained in the second training data pair; Inputting the original training data and the question to be trained into the initial question-answering model to obtain predicted answer data for the question to be trained; Calculating a model loss value of the initial question-answering model according to the reference output distribution, the first answer data, the second answer data, and the predicted answer data; The model parameters of the initial question-answering model are adjusted according to the model loss value, and the initial question-answering model is continued to be trained until the training stop condition is reached to obtain the target question-answering model.
[0059] Among them, the reference output distribution refers to the probability distribution of the first answer data output by the reference training model for the segmented training data and the questions to be trained, which is used to constrain the output distribution of the second answer data output by the initial question-answering model for the original training data and the questions to be trained.
[0060] The predicted answer data refers to the answer data output by inputting the original training data and the questions to be trained into the initial question-answering model. The first answer data is the positive training sample used to train the initial question-answering model, and the second answer data is the negative training sample used to train the initial question-answering model. The model loss value refers to the difference between the predicted answer data and the first answer data and the second answer data when the reference output distribution is followed. It is used to measure the difference between the predicted answer data and the first answer data and the second answer data when the reference output distribution is followed. The calculation of the model loss value can be found in the following formula 1: Formula 1 in, represents the original training data, represents the split training data, Represents the first answer data given by the model under the segmentation training data, Represents the second answer data given by the model under the original training data, represents the reference training model, that is, the initial question-answering model that has been trained. Represents the initial question-answering model during the training process. represents the reference output distribution.
[0061] Specifically, after obtaining the first training data pair, a reference output distribution for constraining the output distribution of the initial question-answering model is determined based on the first training data pair, and the original training data and the question to be trained are obtained in the second training data pair. The original training data and the question to be trained are input into the initial question-answering model, so that the initial question-answering model determines the answer data of the question to be trained in the original training data and generates the predicted answer data of the question to be trained. At this time, the initial question-answering model is an untrained model, and there will be a deviation between the predicted answer data under the determined original training data and the first answer data, and the model parameters of the initial question-answering model need to be adjusted accordingly. Specifically, according to the reference output distribution, the first answer data, the second answer data and the predicted answer data, the model loss value of the initial question and answer model is calculated by the above formula 1. The loss function for calculating the model loss value can be a 0-1 loss function, a square loss function, a cross entropy loss function, etc. in actual applications. In this specification, preferably, a cross entropy loss function or a square loss function is selected as the loss function for calculating the model loss value, and the model parameters of the initial question and answer model are adjusted according to the calculated model loss value. The adjusted model parameters are used for the next batch of first training data pairs and second training data pairs to continue training the initial question and answer model until the training stop condition of the model is reached to obtain the target question and answer model.
[0062] Specifically, the model training stopping conditions include that the model loss value is less than a preset threshold and / or the training rounds reach a preset round.
[0063] In a specific implementation provided in this specification, taking the training stop condition of the model loss value being less than a preset threshold as an example, the preset threshold is 0.2. When the model loss values are all less than 0.2, it is considered that the initial question-answering model training is completed and the target question-answering model is obtained.
[0064] In another specific implementation provided in the present specification, taking the preset number of training rounds as the training stop condition as an example, the preset number of training rounds is 30 rounds. When the training rounds of the first training data pair and the second training data pair reach 30 rounds, the initial question-answering model training is considered completed and the target question-answering model is obtained.
[0065] In another specific implementation manner provided in the present specification, two training stop conditions, a preset threshold and a preset training round, are set, and the model loss value and the training round are determined at the same time. When either the model loss value or the training round meets the training stop condition, the initial question-answering model training is considered completed and the target question-answering model is obtained.
[0066] An embodiment provided in the present specification determines a reference output distribution that constrains the output distribution of the initial question-answering model, so that the initial question-answering model can maintain the accuracy of predicting and processing the segmented training data and the questions to be trained during the training process. The first answer data and the second answer data are used as positive and negative samples for training the initial question-answering model, thereby improving the accuracy of the target question-answering model obtained after training in predicting and processing the original training data and the questions to be trained.
[0067] Furthermore, the reference distribution of the initial question-answering model can be determined by the following implementation method: In a specific implementation manner provided in this specification, determining the reference output distribution of the initial question-answering model according to the first training data pair includes: Determining the initial question-answering model as a reference training model for the initial question-answering model; Determining a reference output distribution of the reference training model according to the segmented training data, the first answer data, and the second answer data in the first training data pair; The reference output distribution is determined as a reference output distribution of the initial question-answering model.
[0068] The reference training model refers to the reference model used in the process of training the initial question-answering model, which is used to constrain the training of the initial question-answering model. In order to ensure that the accuracy of the target question-answering model obtained by training in processing the segmented training data and the questions to be trained will not be reduced, the initial question-answering model itself can be determined as the reference training model of the initial question-answering model.
[0069] Specifically, before training the initial question-answering model, the initial question-answering model is determined as the reference training model of the initial question-answering model. The training data, the first answer data and the second answer data are divided according to the first training data pair, and the reference output distribution of the reference training model is determined, that is, the reference output distribution of the initial question-answering model. For details, please refer to the above formula 1.
[0070] An embodiment provided in this specification determines the initial question-answering model itself as a reference training model of the initial question-answering model, and determines a reference output distribution that constrains the output distribution of the initial question-answering model, so that the initial question-answering model maintains the accuracy of predictive processing of segmented training data and questions to be trained during the training process.
[0071] The question-answering model training method provided in the present specification includes: obtaining original training data, segmented training data of the original training data, and questions to be trained of the segmented training data, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; inputting the segmented training data and the questions to be trained into an initial question-answering model to obtain first answer data of the questions to be trained; inputting the original training data and the questions to be trained into the initial question-answering model to obtain second answer data of the questions to be trained; generating a first training data pair based on the segmented training data, the questions to be trained, the first answer data, and the second answer data, and generating a second training data pair based on the original training data, the questions to be trained, the first answer data, and the second answer data; training the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model.
[0072] One embodiment of the present specification realizes that, through the initial question-answering model, the first answer data of the question to be trained under the segmented training data and the second answer data under the original training data are obtained, and the first training data pair is constructed based on the segmented training data, the question to be trained, the first answer data and the second answer data, respectively, and the second training data pair is constructed based on the original training data, the question to be trained, the first answer data and the second answer data, so that the first training data pair and the second training data pair can be used to train the initial question-answering model, without the need to incur high manual annotation costs to obtain annotated training data, thus saving labor costs. Determining the reference output distribution that constrains the output distribution of the initial question-answering model can enable the initial question-answering model to maintain the accuracy of predicting the segmented training data and the question to be trained during the training process, and the first answer data and the second answer data are used as positive and negative samples for training the initial question-answering model, thereby improving the accuracy of the target question-answering model obtained after training in predicting the original training data and the question to be trained.
[0073] The following combination Figure 2 , taking the application of the question-answering model training method provided in this specification in text processing as an example, the question-answering model training method is further described. Among them, Figure 2 FIG. 1 shows a flowchart of a question-answering model training method provided by an embodiment of the present specification. Figure 2 As shown in the figure, after obtaining the long text, the long text can be segmented to obtain multiple short texts ( Figure 2 Take 4 short texts as an example), determine the question corresponding to each short text. Figure 2 Taking short text 1 as an example, input the trained initial question-answering model (used to process questions under short text) to obtain the short text answer of the question in the short text. For the same question, input the question and the original long text into the initial question-answering model to obtain the long text answer of the question in the long text. Based on this, the paired training data of <short text, question, short text answer> and <long text, question, long text answer> can be obtained. Then, the short text-long text preference optimization is performed on the above paired training data, and the training data pairs under the short text and the training data pairs under the long text are constructed.
[0074] Since the initial question-answering model is a question-answering model that has been trained to handle questions under short texts, the accuracy of the short text answers obtained above will be higher than that of the long text answers. Based on this, for the case of long texts, the short text answers under short texts can be determined as positive training samples under long texts, and the long text answers under long texts can be determined as negative training samples under long texts, thereby constructing a training data pair <long text, question, short text answer, long text answer> under long texts. For the case of short texts, the long text answers under long texts can also be determined as negative training samples under short texts, and the short text answers under short texts can be determined as positive training samples under short texts, thereby constructing a training data pair <short text, question, short text answer, long text answer> under short texts.
[0075] In practical applications, if the initial question-answering model is trained directly using the training data under long text, the performance of the initial question-answering model will deviate from the pre-trained model during the training process, resulting in a decrease in the model's short text performance. Therefore, before training the initial question-answering model, the initial question-answering model itself can be determined as the reference training model of the initial question-answering model, and the reference output distribution during the initial question-answering model training process can be determined based on the output of the reference training model, and then the initial question-answering model can be trained.
[0076] Specifically, the question and the long text are input into the initial question-answering model, and the predicted answer output by the initial question-answering model can be obtained. According to the reference output distribution, the short text answer, the long text answer and the predicted answer, the model loss value of the initial question-answering model is calculated. The specific calculation method can be found in the above formula 1. The model parameters of the initial question-answering model are adjusted according to the calculated model loss value, and the initial question-answering model is continuously trained until the training stop condition is reached to obtain the target question-answering model. The target question-answering model obtained at this time can maintain the accuracy of processing short texts while improving the accuracy of processing long texts.
[0077] An embodiment of the present specification realizes that, through the initial question-answering model, the short text answer under the short text and the long text answer under the long text for the same question are obtained, and the training data pairs under the short text are constructed based on the short text, the question, the short text answer and the long text answer, respectively, and the training data pairs under the long text are constructed based on the long text, the question, the short text answer and the long text answer, so that the initial question-answering model can be trained using the training data pairs under the short text and the training data pairs under the long text, without the need to incur high manual annotation costs to obtain annotated training data, thus saving labor costs. By determining the reference output distribution that constrains the output distribution of the initial question-answering model with reference to the training model, the initial question-answering model can maintain the accuracy of processing short texts and questions during the training process, and the short text answers and long text answers are used as positive and negative training samples for training the initial question-answering model, which can improve the accuracy of the target question-answering model obtained after training in processing long texts and questions.
[0078] Corresponding to the above method embodiment, this specification also provides a question-answering model training device embodiment, Figure 3 FIG. 1 is a schematic diagram showing a structure of a question-answering model training device provided by an embodiment of the present specification. Figure 3 As shown, the device comprises: An acquisition module 302 is configured to acquire original training data, segmented training data of the original training data, and a to-be-trained problem of the segmented training data, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; A first input module 304 is configured to input the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; The second input module 306 is configured to input the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; A generating module 308 is configured to generate a first training data pair based on the segmented training data, the problem to be trained, the first answer data and the second answer data, and to generate a second training data pair based on the original training data, the problem to be trained, the first answer data and the second answer data; The training module 310 is configured to train the initial question-answering model based on the first training data pair and the second training data pair to obtain a target question-answering model.
[0079] Optionally, the generating module 308 is further configured to: Determine the first answer data as the segmented positive training sample of the to-be-trained question under the segmented training data; Determine the second answer data as the segmented negative training sample of the to-be-trained question under the segmented training data; A first training data pair is generated based on the segmented training data, the problem to be trained, the segmented positive training samples, and the segmented negative training samples.
[0080] Optionally, the generating module 308 is further configured to: Determine the first answer data as the original positive training sample of the to-be-trained question under the original training data; Determine the second answer data as the original negative training sample of the to-be-trained question under the original training data; A second training data pair is generated based on the original training data, the problem to be trained, the original positive training sample and the original negative training sample.
[0081] Optionally, the training module 310 is further configured to: Determine a reference output distribution of the initial question-answering model according to the first training data pair, wherein the reference output distribution is used to constrain an output distribution of the initial question-answering model; Acquire the original training data and the problem to be trained in the second training data pair; Inputting the original training data and the question to be trained into the initial question-answering model to obtain predicted answer data for the question to be trained; Calculating a model loss value of the initial question-answering model according to the reference output distribution, the first answer data, the second answer data, and the predicted answer data; The model parameters of the initial question-answering model are adjusted according to the model loss value, and the initial question-answering model is continued to be trained until the training stop condition is reached to obtain the target question-answering model.
[0082] Optionally, the training module 310 is further configured to: Determining the initial question-answering model as a reference training model for the initial question-answering model; Determining a reference output distribution of the reference training model according to the segmented training data, the first answer data, and the second answer data in the first training data pair; The reference output distribution is determined as a reference output distribution of the initial question-answering model.
[0083] Optionally, the acquisition module 302 is further configured to: According to a preset length threshold, the original training data is segmented to obtain at least two segmented training data; or According to the problem to be trained, the original training data is segmented to obtain at least two segmented training data.
[0084] Optionally, the acquisition module 302 is further configured to: The segmented training data is input into a question generation model to obtain the to-be-trained question corresponding to the segmented training data.
[0085] The question-answering model training device provided in the present specification includes: an acquisition module, configured to acquire original training data, segmented training data of the original training data, and questions to be trained of the segmented training data, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; a first input module, configured to input the segmented training data and the questions to be trained into an initial question-answering model to obtain first answer data of the questions to be trained; a second input module, configured to input the original training data and the questions to be trained into the initial question-answering model to obtain second answer data of the questions to be trained; a generation module, configured to generate a first training data pair based on the segmented training data, the questions to be trained, the first answer data, and the second answer data, and to generate a second training data pair based on the original training data, the questions to be trained, the first answer data, and the second answer data; a training module, configured to train the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model.
[0086] One embodiment of the present specification realizes that, through the initial question-answering model, the first answer data of the question to be trained under the segmented training data and the second answer data under the original training data are obtained, and the first training data pair is constructed based on the segmented training data, the question to be trained, the first answer data and the second answer data, respectively, and the second training data pair is constructed based on the original training data, the question to be trained, the first answer data and the second answer data, so that the first training data pair and the second training data pair can be used to train the initial question-answering model, without the need to incur high manual annotation costs to obtain annotated training data, thus saving labor costs. Determining the reference output distribution that constrains the output distribution of the initial question-answering model can enable the initial question-answering model to maintain the accuracy of predicting the segmented training data and the question to be trained during the training process, and the first answer data and the second answer data are used as positive and negative samples for training the initial question-answering model, thereby improving the accuracy of the target question-answering model obtained after training in predicting the original training data and the question to be trained.
[0087] The above is a schematic scheme of a question-answering model training device of this embodiment. It should be noted that the technical scheme of the question-answering model training device and the technical scheme of the question-answering model training method mentioned above belong to the same concept, and the details not described in detail in the technical scheme of the question-answering model training device can be found in the description of the technical scheme of the question-answering model training method mentioned above.
[0088] See also Figure 4 , Figure 4 A flowchart of another question-answering model training method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0089] Step 402: In response to a question-answering model training instruction, original training data, segmented training data of the original training data, and questions to be trained of the segmented training data are obtained, wherein a data length of the original training data is greater than a preset length threshold, and a data length of the segmented training data is less than or equal to the preset length threshold.
[0090] The question-answering model training instruction refers to an instruction generated by the target terminal for obtaining the model parameters of the target question-answering model. In actual applications, the target terminal can generate a question-answering model training instruction and send the question-answering model training instruction to the cloud-side device, so that the cloud-side device responds to the question-answering model training instruction to obtain the original training data, the segmented training data, and the questions to be trained.
[0091] Step 404: input the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data for the question to be trained.
[0092] Step 406: Input the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained.
[0093] Step 408: Generate a first training data pair based on the segmented training data, the question to be trained, the first answer data and the second answer data; generate a second training data pair based on the original training data, the question to be trained, the first answer data and the second answer data.
[0094] Step 410: Train the initial question-answering model based on the first training data pair and the second training data pair to obtain a target question-answering model.
[0095] Step 412: Feedback the target model parameters of the target question-answering model to the target terminal.
[0096] Specifically, after the target question-answering model is obtained through training, the target model parameters of the target question-answering model are sent to the target terminal.
[0097] An embodiment provided in this specification can realize that a target terminal can generate a question-and-answer model training instruction and send it to a cloud-side device, and the cloud-side device can train the initial question-and-answer model, and after obtaining the target question-and-answer model, the target model parameters are fed back to the target terminal, thereby eliminating the need for users to train the question-and-answer model on the target terminal themselves, thereby improving user experience.
[0098] It should be noted that the specific implementation process of the question-answering model training method is the same as the implementation process of the above-mentioned question-answering model training method, and this specification will not repeat it here.
[0099] Corresponding to the above method embodiment, this specification also provides another question-answering model training device embodiment, Figure 5 FIG. 2 shows a schematic diagram of another question-answering model training device provided by an embodiment of the present specification. Figure 5 As shown, the device is applied to a cloud-side device, including: A response module 502 is configured to obtain original training data, segmented training data of the original training data, and questions to be trained of the segmented training data in response to a question-answering model training instruction, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; A first data input module 504 is configured to input the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; A second data input module 506 is configured to input the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; A data pair generating module 508 is configured to generate a first training data pair based on the segmented training data, the problem to be trained, the first answer data and the second answer data, and to generate a second training data pair based on the original training data, the problem to be trained, the first answer data and the second answer data; A model training module 510 is configured to train the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model; The feedback module 512 is configured to feed back the target model parameters of the target question-answering model to the target terminal.
[0100] An embodiment provided in this specification can realize that a target terminal can generate a question-and-answer model training instruction and send it to a cloud-side device, and the cloud-side device can train the initial question-and-answer model, and after obtaining the target question-and-answer model, the target model parameters are fed back to the target terminal, thereby eliminating the need for users to train the question-and-answer model on the target terminal themselves, thereby improving user experience.
[0101] The above is a schematic scheme of another question-answering model training device of this embodiment. It should be noted that the technical scheme of the question-answering model training device and the technical scheme of the question-answering model training method mentioned above belong to the same concept, and the details not described in detail in the technical scheme of the question-answering model training device can be found in the description of the technical scheme of the question-answering model training method mentioned above.
[0102] See also Figure 6 , Figure 6 A flow chart of a data processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0103] Step 602: Obtain the business data to be processed and the problem to be determined for the business data to be processed.
[0104] Step 604: Input the business data to be processed and the question to be determined into a target question-answering model to obtain a target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0105] Among them, the business data to be processed refers to the data used to provide corresponding answers to the questions to be determined. The data length of the business data to be processed can be greater than the preset length threshold, or less than or equal to the preset length threshold, and this specification does not limit it here. The business data to be processed can specifically be text, such as short text or long text, etc., or it can be a video, such as a long video or a short video. The question to be determined refers to the question that needs to be answered from the business data to be processed. The target answer refers to the answer to the question to be determined generated by the target question-answering model after processing the business data to be processed and the question to be determined.
[0106] Specifically, after obtaining the business data to be processed and the questions to be determined, the business data to be processed and the questions to be determined are input into the target question-answering model to obtain the target answer output by the target question-answering model.
[0107] An embodiment provided in this specification realizes processing of business data to be processed and questions to be determined through a target question and answer model. Since the target question and answer model is trained based on the above-mentioned question and answer model training method, the target question and answer model has the ability to process data with longer lengths as well as data with shorter lengths, thereby making the generated target answer have higher accuracy.
[0108] Corresponding to the above method embodiment, this specification also provides a data processing device embodiment, Figure 7 FIG. 1 is a schematic diagram showing the structure of a data processing device provided by an embodiment of the present specification. Figure 7 As shown, the device comprises: A business data acquisition module 702 is configured to acquire business data to be processed and problems to be determined for the business data to be processed; The business data input module 704 is configured to input the business data to be processed and the question to be determined into the target question-answering model to obtain the target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0109] An embodiment provided in this specification realizes processing of business data to be processed and questions to be determined through a target question and answer model. Since the target question and answer model is trained based on the above-mentioned question and answer model training method, the target question and answer model has the ability to process data with longer lengths as well as data with shorter lengths, thereby making the generated target answer have higher accuracy.
[0110] The above is a schematic scheme of a data processing device of this embodiment. It should be noted that the technical scheme of the data processing device and the technical scheme of the above data processing method belong to the same concept, and the details of the technical scheme of the data processing device that are not described in detail can be referred to the description of the technical scheme of the above data processing method.
[0111] See also Figure 8 , Figure 8 A flowchart of a text processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0112] Step 802: Acquire a text to be processed and a text problem to be determined for the text to be processed, wherein the text to be processed includes a long text to be processed or a short text to be processed.
[0113] Step 804: input the text to be processed and the text question to be determined into a target question-answering model to obtain a target text answer to the text question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0114] The text processing method is specifically an application method of the above-mentioned data processing method in a text processing scenario. Its specific implementation method is the same as the above-mentioned data processing method, and this specification will not repeat it here.
[0115] Corresponding to the above method embodiment, this specification also provides a text processing device embodiment, Fig. 9 FIG. 1 shows a schematic diagram of the structure of a text processing device provided by an embodiment of the present specification. Fig. 9 As shown, the device comprises: The text acquisition module 902 is configured to acquire a text to be processed and a text problem to be determined for the text to be processed, wherein the text to be processed includes a long text to be processed or a short text to be processed; The text input module 904 is configured to input the text to be processed and the text question to be determined into the target question-answering model to obtain the target text answer to the text question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0116] The above is a schematic scheme of a text processing device of this embodiment. It should be noted that the technical scheme of the text processing device and the technical scheme of the above text processing method belong to the same concept, and the details not described in detail in the technical scheme of the text processing device can be referred to the description of the technical scheme of the above text processing method.
[0117] See also Fig.10 , Fig.10A flow chart of a video processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0118] Step 1002: Obtain a video to be processed and a question to be determined for the video to be processed, wherein the video to be processed includes a long video to be processed or a short video to be processed.
[0119] Step 1004: Input the video to be processed and the question to be determined into a target question-answering model to obtain a target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0120] The video processing method is specifically an application method of the above-mentioned data processing method in a video processing scenario. Its specific implementation method is the same as the above-mentioned data processing method, and this specification will not repeat it here.
[0121] Corresponding to the above method embodiment, this specification also provides a video processing device embodiment, Fig.11 FIG. 2 shows a schematic diagram of the structure of a video processing device provided by an embodiment of the present specification. Fig.11 As shown, the device comprises: The video acquisition module 1102 is configured to acquire a video to be processed and a problem to be determined for the video to be processed, wherein the video to be processed includes a long video to be processed or a short video to be processed; The video input module 1104 is configured to input the video to be processed and the question to be determined into the target question-answering model to obtain the target answer to the question to be determined, wherein the target question-answering model is obtained according to the above-mentioned question-answering model training method.
[0122] The above is a schematic scheme of a video processing device of this embodiment. It should be noted that the technical scheme of the video processing device and the technical scheme of the above video processing method belong to the same concept, and the details not described in detail in the technical scheme of the video processing device can be referred to the description of the technical scheme of the above video processing method.
[0123] Fig.12 The block diagram of a computing device 1200 according to one embodiment of the present specification is shown. The components of the computing device 1200 include but are not limited to a memory 1210 and a processor 1220. The processor 1220 is connected to the memory 1210 via a bus 1230, and the database 1250 is used to store data.
[0124] The computing device 1200 also includes an access device 1240 that enables the computing device 1200 to communicate via one or more networks 1260. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1240 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0125] In one embodiment of the present specification, the above components of the computing device 1200 and Fig.12 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.12 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0126] The computing device 1200 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1200 may also be a mobile or stationary server.
[0127] Among them, processor 1220 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-mentioned question and answer model training method, data processing method, text processing method or video processing method.
[0128] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the question-answering model training method, data processing method, text processing method or video processing method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the question-answering model training method, data processing method, text processing method or video processing method embodiment.
[0129] An embodiment of the present specification also provides a computer-readable storage medium storing a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned question-and-answer model training method, data processing method, text processing method or video processing method.
[0130] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the question-answering model training method, data processing method, text processing method or video processing method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the question-answering model training method, data processing method, text processing method or video processing method embodiment.
[0131] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned question-answering model training method, data processing method, text processing method or video processing method.
[0132] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the question-answering model training method, data processing method, text processing method or video processing method mentioned above belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be found in the description of the technical scheme of the question-answering model training method, data processing method, text processing method or video processing method mentioned above.
[0133] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0134] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0135] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0136] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0137] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A question-answering model training method, comprising: Obtaining original training data, segmented training data of the original training data, and a to-be-trained problem of the segmented training data, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; Inputting the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; Inputting the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; Generate a first training data pair based on the segmented training data, the question to be trained, the first answer data, and the second answer data; and generate a second training data pair based on the original training data, the question to be trained, the first answer data, and the second answer data; The initial question-answering model is trained according to the first training data pair and the second training data pair to obtain a target question-answering model.
2. The method according to claim 1, generating a first training data pair based on the segmented training data, the question to be trained, the first answer data and the second answer data, comprising: Determine the first answer data as the segmented positive training sample of the to-be-trained question under the segmented training data; Determine the second answer data as the segmented negative training sample of the to-be-trained question under the segmented training data; A first training data pair is generated based on the segmented training data, the problem to be trained, the segmented positive training samples, and the segmented negative training samples.
3. The method according to claim 1, generating a second training data pair based on the original training data, the question to be trained, the first answer data and the second answer data, comprising: Determine the first answer data as the original positive training sample of the to-be-trained question under the original training data; Determine the second answer data as the original negative training sample of the to-be-trained question under the original training data; A second training data pair is generated based on the original training data, the problem to be trained, the original positive training sample and the original negative training sample.
4. The method according to claim 1, training the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model, comprising: Determine a reference output distribution of the initial question-answering model according to the first training data pair, wherein the reference output distribution is used to constrain an output distribution of the initial question-answering model; Acquire the original training data and the problem to be trained in the second training data pair; Inputting the original training data and the question to be trained into the initial question-answering model to obtain predicted answer data for the question to be trained; Calculating a model loss value of the initial question-answering model according to the reference output distribution, the first answer data, the second answer data, and the predicted answer data; The model parameters of the initial question-answering model are adjusted according to the model loss value, and the initial question-answering model is continued to be trained until the training stop condition is reached to obtain the target question-answering model.
5. The method of claim 4, wherein determining a reference output distribution of the initial question-answering model based on the first training data pair comprises: Determining the initial question-answering model as a reference training model for the initial question-answering model; Determining a reference output distribution of the reference training model according to the segmented training data, the first answer data, and the second answer data in the first training data pair; The reference output distribution is determined as a reference output distribution of the initial question-answering model.
6. The method according to claim 1, obtaining the segmented training data of the original training data, comprising: According to a preset length threshold, the original training data is segmented to obtain at least two segmented training data; or According to the problem to be trained, the original training data is segmented to obtain at least two segmented training data.
7. The method according to claim 1, obtaining the problem to be trained of the segmented training data, comprising: The segmented training data is input into a question generation model to obtain the to-be-trained question corresponding to the segmented training data.
8. A question-answering model training method, applied to a cloud-side device, comprising: In response to the question-answering model training instruction, original training data, segmented training data of the original training data, and questions to be trained of the segmented training data are obtained, wherein the data length of the original training data is greater than a preset length threshold, and the data length of the segmented training data is less than or equal to the preset length threshold; Inputting the segmented training data and the question to be trained into an initial question-answering model to obtain first answer data of the question to be trained; Inputting the original training data and the question to be trained into the initial question-answering model to obtain second answer data for the question to be trained; Generate a first training data pair based on the segmented training data, the question to be trained, the first answer data, and the second answer data; and generate a second training data pair based on the original training data, the question to be trained, the first answer data, and the second answer data; Training the initial question-answering model according to the first training data pair and the second training data pair to obtain a target question-answering model; The target model parameters of the target question-answering model are fed back to the target terminal.
9. A data processing method, comprising: Obtaining business data to be processed and issues to be determined for the business data to be processed; The business data to be processed and the question to be determined are input into a target question-answering model to obtain a target answer to the question to be determined, wherein the target question-answering model is obtained according to the method described in any one of claims 1 to 7 above.
10. A text processing method, comprising: Acquire a text to be processed and a text problem to be determined for the text to be processed, wherein the text to be processed includes a long text to be processed or a short text to be processed; The text to be processed and the text question to be determined are input into a target question-answering model to obtain a target text answer to the text question to be determined, wherein the target question-answering model is obtained according to the method described in any one of claims 1 to 7 above.
11. A video processing method, comprising: Obtaining a video to be processed and a question to be determined for the video to be processed, wherein the video to be processed includes a long video to be processed or a short video to be processed; The video to be processed and the question to be determined are input into a target question-answering model to obtain a target answer to the question to be determined, wherein the target question-answering model is obtained according to the method described in any one of claims 1 to 7 above.
12. A computing device comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 11 are implemented.
13. A computer-readable storage medium storing a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
14. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
Citation Information
Cited By
Text processing model training method and device and storage medium
CN120012942A
Text processing model training method, device and storage medium
CN120012942B