Model training method, data processing method, electronic equipment and computer storage medium

By combining forward and reverse training methods, different types of training sample data are used to improve the creative ability and text data quality of the generative language model, and the problem of insufficient creative ability and data quality in traditional model training is solved.

CN119179891APending Publication Date: 2024-12-24UC MOBILE CHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411000788.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-12-24

AI Technical Summary

Technical Problem

The generative basic model obtained by traditional training at this stage has poor creative ability. The text data obtained is usually short text with a small number of words, and the text data quality is also poor.

Method used

Using a combination of forward training and reverse training, the model is trained separately by obtaining forward training sample data and reverse training sample data, using prompt information and long text data in the forward training sample, as well as the reverse training sample Long text data and prompt information in the middle improve the robustness and creative ability of the model.

Benefits of technology

The long text creation ability and text data quality of the generative language model are improved, and the robustness and accuracy of the model are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119179891A_ABST
    Figure CN119179891A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a model training method, a data processing method, electronic equipment and a computer storage medium, the model training method comprises the following steps: obtaining forward training sample data and reverse training sample data, the forward training sample data comprising first prompt information and corresponding first long text data; the reverse training sample data comprises second prompt information and corresponding second long text data; taking the first prompt information as model input, taking the first long text data as a training label, and performing generative language model training to obtain a transition model; and training the transition model by taking the second long text data as model input and taking the second prompt information as a training label to obtain a generative basic model. Through the embodiment of the invention, the robustness of the model can be improved, meanwhile, the long text creation capability of the model is enhanced, and the data quality of the created long text data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a model training method, a data processing method, an electronic device, and a computer storage medium. Background Art

[0002] With the rapid development of natural language processing and artificial intelligence technologies, more and more people are beginning to use artificial intelligence to generate texts that meet their needs.

[0003] Text creation usually uses semantic understanding to identify the creation topic, creation requirements and other information input by the user, and then searches the knowledge base, so as to create text based on the search results through a pre-trained generative basic model to generate text data corresponding to the question.

[0004] At present, the generative basic model trained by traditional methods has poor creative ability, and the text data obtained is usually short text with fewer words, and the quality of the text data is also poor. Summary of the invention

[0005] In view of this, an embodiment of the present application provides a model training solution to at least partially solve the above-mentioned problems.

[0006] According to a first aspect of an embodiment of the present application, a model training method is provided, comprising:

[0007] Acquire positive training sample data and negative training sample data, wherein the positive training sample data includes: first prompt information and corresponding first long text data; and the negative training sample data includes: second prompt information and corresponding second long text data;

[0008] Using the first prompt information as a model input and the first long text data as a training label, performing generative language model training to obtain a transition model;

[0009] The transition model is trained using the second long text data as a model input and the second prompt information as a training label to obtain a generative basic model.

[0010] According to a second aspect of an embodiment of the present application, a data processing method is provided, including:

[0011] Get input data;

[0012] Initiate a search for the input data to obtain search results;

[0013] Parsing the input data and the search results to generate target prompt information, and performing generation processing on the target prompt information through a generative basic model to obtain target long text data corresponding to the input data;

[0014] Wherein, the generative basic model is trained based on forward training sample data and reverse training sample data, the forward training sample data includes first prompt information as model input, and first long text data as training label; the reverse training sample data includes: second long text data as model input, and second prompt information as training label.

[0015] According to the third aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method described in the first aspect or the second aspect.

[0016] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect or the second aspect is implemented.

[0017] According to the model training method, data processing method, electronic device and computer storage medium provided in the embodiments of the present application, the generative basic model for generating text data is obtained by using two different training sample data, namely forward training sample data and reverse training sample, and adopting two different training processes, namely forward training and reverse training, wherein the forward training process is the process of inputting prompt information into the model to obtain long text data, and the reverse training process is the process of inputting long text data into the model to reversely infer the corresponding prompt information through the model.

[0018] In the embodiments of the present application, on the one hand, through the forward training process using long text data as training labels, the generative language model can have the ability to create long texts with a long length; on the other hand, in addition to the forward long text creation training, a reverse training process using long text data as model input and prompt information as training labels is added. Through the combination of these two different training processes, forward training and reverse training, the generative language model can learn knowledge from different types of training data and training processes, thereby helping to improve the robustness and accuracy of the model. In summary, the embodiments of the present application can improve the robustness of the model, while enhancing the long text creation capability of the model and improving the data quality of the long text data created. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0020] Figure 1 A flowchart of the steps of a model training method according to Embodiment 1 of the present application;

[0021] Figure 2 for Figure 1 A schematic diagram of an example scenario in the illustrated embodiment;

[0022] Figure 3 is a flowchart of a data processing method according to Embodiment 2 of the present application;

[0023] Figure 4 is a structural block diagram of a model training device according to Embodiment 3 of the present application;

[0024] Figure 5 is a structural block diagram of a data processing device according to Embodiment 4 of the present application;

[0025] Figure 6 This is a schematic diagram of the structure of an electronic device according to Embodiment 5 of the present application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.

[0027] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.

[0028] Embodiment 1

[0029] Reference Figure 1 , Figure 1 The following is a flowchart of a model training method according to the first embodiment of the present application. The model training method provided in the embodiment of the present application may include the following steps:

[0030] Step 102, obtaining forward training sample data and reverse training sample data, the forward training sample data including: first prompt information and corresponding first long text data; the reverse training sample data including: second prompt information and corresponding second long text data.

[0031] Specifically, when performing intelligent creation through a generative language model, in order to enable the model to create data that meets the requirements, prompt information can usually be input into the model to guide the model to create data that meets the requirements. The prompt information can be obtained by integrating information based on creation requirement information, creation material information, etc.

[0032] The creation requirement information may include at least one of the following: creation theme, creation requirements (such as word count requirements, creation style requirements), etc.; the creation material information may be the content data based on which the model is created. The creation requirement information may be information set by the user according to his or her own needs. The creation material information may be content data provided by the user, or may be content data associated with the creation requirement obtained by searching the preset database according to the creation requirement information.

[0033] The long text data corresponding to the prompt information can be the content data with a longer length created according to the prompt information. Specifically, the character quantity threshold can be set in advance according to the actual scenario, so that the content data containing more characters than the above character quantity threshold is called long text data. Furthermore, the embodiment of the present application does not limit the specific form of the characters, and can also be customized according to the actual application scenario. For example: in the scenario involving Chinese text creation, long text data can be defined from the perspective of the number of Chinese characters. For example, text data containing more Chinese characters than the preset Chinese character quantity threshold can be called long text data, wherein the preset Chinese character quantity threshold can be 1000, 2000 or any other suitable value. For another example: in the scenario of English creation, long text data can be defined from the perspective of the number of English characters. For example, text data containing more English characters than the preset English character quantity threshold can be called long text data, wherein the preset English character quantity threshold can also be 1000, 2000 or any other suitable value.

[0034] In addition, in addition to defining long text data from the perspective of the number of characters contained, the specific content of long text data can also be further limited from the perspective of text structure, etc. For example, text data containing a number of characters greater than a preset character number threshold and a number of chapters (or paragraphs, subsections, etc.) greater than a preset chapter (or paragraph, subsection, etc.) number threshold can be defined as long text data, and so on.

[0035] In the embodiment of the present application, the training sample data is divided into two different categories: forward training sample data, and reverse training sample data. Among them, the forward training sample data includes the first prompt information and the corresponding first long text data, and the reverse training sample data includes the second prompt information and the corresponding second long text data. In the embodiment of the present application, the first prompt information and the second prompt information can be the same data or different data; correspondingly, the first long text data and the second long text data can be the same data or different data. That is to say, with respect to the forward training sample data and the reverse sample data in the embodiment of the present application, there can be the following situations: in the first situation, the first prompt information and the second prompt information are the same, and correspondingly, the first long text data and the second long text data are also the same; in the second situation, the first prompt information and the second prompt information are the same, but the first long text data and the second long text data are different; in the third situation, the first prompt information and the second prompt information are different, but the first long text data and the second long text data are the same; in the fourth situation, the first prompt information and the second prompt information are different, and the first long text data and the second long text data are also different.

[0036] For the first three cases, the forward training sample data and the reverse sample data contain duplicate data. Therefore, in the sample construction process, a larger number of training samples can be obtained with less investment, that is, the construction cost of the training samples is reduced. For the fourth case, the forward training sample data and the reverse sample data are different sample data. Model training based on the different training sample data can improve the prediction effect of the generative basic model that is finally trained.

[0037] During the model training process, the first prompt information in the above-mentioned forward training sample data is used as the model input, and the corresponding first long text data is used as the training label for forward training; in addition, the second long text data in the reverse training sample data is used as the model input, and the second prompt information is used as the training label for reverse training.

[0038] Step 104 , using the first prompt information as a model input and the first long text data as a training label, performs generative language model training to obtain a transition model.

[0039] Specifically, after the positive training sample data is obtained through step 102, the generative language model can be subjected to traditional forward training based on the positive training sample data, that is: taking the first prompt information in the positive training sample data as input, the long text prediction result is obtained by predicting the generative language model, and then the loss value is calculated based on the long text prediction result and the first long text data, and the model parameters in the generative language model are adjusted based on the loss value, so as to obtain a transition model.

[0040] The generative language model in the embodiment of the present application can be any model that can generate text data, and the specific structure of the generative language model is not limited. For example, it can be an open source model, or a model customized according to actual conditions, etc. Further, in order to improve the efficiency of model training, a pre-trained generative language model can also be used in the above step 104.

[0041] Step 106, using the second long text data as a model input and the second prompt information as a training label, training the transition model to obtain a generative basic model.

[0042] Specifically, after the transition model is obtained through forward training in step 104, in an embodiment of the present application, the transition model is also reversely trained based on the reverse training sample data, that is: the second long text data in the reverse training sample data is used as input, and a prediction prompt result is obtained through transition model prediction, and then the loss value is calculated based on the prediction prompt result and the second prompt information, and the model parameters in the transition model are adjusted based on the loss value, so as to obtain the final trained generative basic model.

[0043] According to the model training method provided in the embodiment of the present application, on the one hand, through the forward training process using long text data as training labels, the model can have the ability to create long texts with a longer length; on the other hand, in addition to the forward long text creation training, a reverse training process using long text data as model input and prompt information as training labels is added. Through the combination of these two different training processes, forward training and reverse training, the model can learn knowledge from different types of training data and training processes, thereby helping to improve the robustness and accuracy of the model. In summary, the embodiment of the present application can improve the robustness of the model, while enhancing the long text creation capability of the model and improving the data quality of the long text data created.

[0044] The model training method provided in the embodiment of the present application can be executed by any appropriate device with data processing capabilities, including but not limited to: PCs and servers.

[0045] See also Figure 2 , Figure 2 This is a schematic diagram of a scene corresponding to the first embodiment of the present application. Figure 2 The schematic diagram shown in the figure illustrates an embodiment of the present application by taking a specific scenario as an example:

[0046] The model training process provided in the embodiment of the present application may include the following two stages:

[0047] The first stage is the forward training stage. After obtaining the forward training sample data, the first prompt information therein is input into the generative language model to be trained, and the long text prediction result is output through the generative language model; then based on the long text prediction result and the first long text data in the forward training sample data, the first loss value is calculated, and the parameters of the generative language model are adjusted according to the first loss value, so as to obtain a transition model.

[0048] The second stage is the reverse training stage. After the transition model is obtained through forward training, the second long text data in the reverse training sample data is input into the transition model, and the prediction prompt result is output through the transition model; then based on the prediction prompt result and the second prompt information in the reverse training sample data, the second loss value is calculated, and the parameters of the transition model are adjusted again according to the second loss value, so as to obtain the trained generative basic model.

[0049] Optionally, in some embodiments, the process of training a generative language model using the first prompt information as a model input and the first long text data as a training label to obtain a transition model may include:

[0050] Inputting the first prompt information into a generative language model, and outputting a first prediction result through the generative language model;

[0051] Calculating a first loss value based on the first prediction result and the first long text data, and adjusting a model parameter of the generative language model based on the first loss value;

[0052] The first prediction result is used as the updated first long text data, and the step of inputting the first prompt information into the generative language model and outputting the first prediction result through the generative language model is returned until the first training stop condition is met, thereby obtaining a transition model.

[0053] Specifically, in the process of forward training based on the forward training sample data, for each first prompt information input into the generative language model, a prediction result will be output by the generative language model. For the sake of distinction, the prediction result is referred to as the first prediction result in the embodiment of the present application.

[0054] The generative language model to be trained in the embodiments of the present application is usually a language model obtained after a pre-training operation, which means that before executing the above embodiments of the present application for model training, the generative language model has a certain creative ability. Therefore, the first prediction result obtained during the training process also has a certain reference significance.

[0055] Based on the above analysis, in the above embodiment of the present application, after obtaining the first prediction result, in addition to calculating the loss value based on the first prediction result and the first long text data of the training label and adjusting the model parameters, the first prediction result is used as the updated first long text data, and the first prompt information is used to form new positive training sample data, and the new positive training sample data is applied to model training until the pre-set first training stop condition is met to obtain a transition model. The above method makes full use of the model prediction results to realize enhanced processing of the training sample data, and can obtain a larger number of training samples with a smaller annotation cost, thereby improving the prediction ability of the transition model.

[0056] In the embodiment of the present application, the specific content of the first training stop condition is not limited and can be customized according to actual conditions. For example, the number of iterations reaching a preset number threshold can be set as satisfying the first training stop condition, or the difference in loss values ​​obtained from two adjacent iterations being less than a preset difference threshold can be set as satisfying the first training stop condition, and so on.

[0057] Optionally, in some of the embodiments, taking the first prediction result as the updated first long text data includes:

[0058] Determine whether the first prediction result satisfies a first preset condition, and if so, use the first prediction result as the updated first long text data;

[0059] If not, then the editing information of the first prediction result is received, the first prediction result is modified according to the editing information, and the modified first prediction result is used as the updated first long text data.

[0060] Specifically, the first preset condition can be a condition set for the first prediction result from the perspective of text quality. For example, it can be: whether the similarity between the first prediction result and the first long text data reaches a preset similarity threshold; or whether the number of characters contained in the first prediction result reaches a preset number threshold; or whether the quality assessment result obtained by evaluating the first prediction result by a preset quality assessment method meets the preset quality requirements, etc. In the embodiment of the present application, the specific content of the first preset condition is not limited, and can be customized according to actual conditions.

[0061] In the above embodiment, after obtaining the first prediction result, the text quality of the first prediction result is first determined and screened. When the first preset condition is met, the first prediction result is used as the updated first long text data to perform model training again. If the first preset condition is not met, the first prediction result is modified based on the editing information, and then the modified first prediction result is used as the updated first long text data to perform model training. Through the above screening process, a higher quality result can be selected from the first prediction result output by the model to form a training sample again, which can effectively improve the accuracy of the final transition model.

[0062] Optionally, in some embodiments, the second long text data is used as a model input, the second prompt information is used as a training label, and the transition model is trained to obtain a generative basic model, including:

[0063] Inputting the second long text data into the transition model, and outputting a second prediction result through the transition model;

[0064] Calculating a second loss value based on the second prediction result and the second prompt information, and adjusting a model parameter of the transition model based on the second loss value;

[0065] The second prediction result is used as the updated second prompt information, and the step of inputting the second long text data into the transition model and outputting the second prediction result through the transition model is returned until the second training stop condition is met, thereby obtaining a generative basic model.

[0066] Specifically, similar to the above-mentioned process of obtaining the transition model through forward training, in the above-mentioned embodiment of the present application, in the process of obtaining the generative basic model through reverse training of reverse training sample data, after obtaining the second prediction result of the model output, on the one hand, based on the second prediction result and the second prompt information of the training label, the loss value is calculated and the model parameters are adjusted, and the second prediction result is used as the updated second prompt information to form new reverse training sample data with the second long text data, and the new reverse training sample data is applied to the model training until the pre-set second training stop condition is met to obtain the generative basic model. The above-mentioned method makes full use of the model prediction results to realize the enhanced processing of the training sample data, and can obtain a larger number of training samples at a lower label annotation cost, thereby improving the prediction ability of the generative basic model.

[0067] In the embodiment of the present application, the specific content of the second training stop condition is not limited and can be customized according to actual conditions. For example, the number of iterations reaching a preset number threshold can be set as satisfying the second training stop condition, or the difference in loss values ​​obtained from two adjacent iterations being less than a preset difference threshold can be set as satisfying the second training stop condition, and so on.

[0068] Optionally, in some of the embodiments, using the second prediction result as updated second prompt information includes:

[0069] Determine whether the second prediction result satisfies the second preset condition, and if so, use the second prediction result as the updated second prompt information;

[0070] If not, then the editing information of the second prediction result is received, the second prediction result is modified according to the editing information, and the modified second prediction result is used as the updated second prompt information.

[0071] Specifically, the second preset condition may also be a condition set for the second prediction result from the perspective of text quality. For example, it may be: whether the similarity between the second prediction result and the second prompt information reaches a preset similarity threshold; or whether the quality assessment result obtained by evaluating the second prediction result by a preset quality assessment method meets the preset quality requirements, etc. In the embodiment of the present application, the specific content of the second preset condition is not limited and can be customized according to actual conditions.

[0072] In the above embodiment, after obtaining the second prediction result, the text quality of the second prediction result is first determined and screened. When the second preset condition is met, the second prediction result is used as the updated second prompt information to perform model training again; if the second preset condition is not met, the second prediction result is modified based on the editing information, and then the modified second prediction result is used as the updated second prompt information to perform model training. Through the above screening process, a higher quality result can be selected from the second prediction result output by the model to form a training sample again, which can effectively improve the accuracy of the final generative basic model.

[0073] Optionally, in some embodiments, the forward training sample data further includes: first intermediate data; the reverse training sample data further includes: second intermediate data;

[0074] The first prompt information is used as the model input, and the first long text data is used as the training label to perform model training to obtain a transition model, including:

[0075] Taking the first prompt information as model input and the first intermediate data as training labels, the model is trained to obtain a first intermediate model; taking the first intermediate data as model input and the first long text data as training labels, the intermediate model is trained to obtain a transition model;

[0076] The second long text data is used as the model input, and the second prompt information is used as the training label to train the transition model to obtain the generative basic model, including:

[0077] The second long text data is used as the model input, and the second intermediate data is used as the training label to train the transition model to obtain the second intermediate model; the second intermediate data is used as the model input, and the second prompt information is used as the training label to train the second intermediate model to obtain the generative basic model.

[0078] Specifically, in the above-mentioned embodiment of the present application, based on the thought chain technology, the text creation process is decomposed into two logical reasoning steps: the first step is to generate intermediate data based on the prompt information, and the second step is to create and generate text data based on the intermediate data. Correspondingly, in the model training stage, whether it is the forward training stage or the reverse training stage, the training process can be divided into two training steps: the first step is to generate intermediate data based on the prompt information (or long text data), and the second step is to create and generate long text data (or prompt information) based on the intermediate data.

[0079] In the embodiments of the present application, the specific content of the intermediate data is not limited. For example, in the case of long text creation, the intermediate data may be long text outline data, and secondary creation may be performed based on the long text outline data to obtain the long text data that the user ultimately wants to obtain. With respect to the above training process, optionally, in some of the embodiments, the first intermediate data may be text outline data corresponding to the first long text data, and the second intermediate data may be text outline data corresponding to the second long text data.

[0080] The reason for decomposing the training process and the actual creation process into two logical steps is that: on the one hand, the intermediate data generated based on the prompt information usually involves content that the prompt information does not cover. Therefore, secondary creation is performed on the intermediate data, which can make the generated content data richer and more comprehensive. On the other hand, decomposing the training process and the actual creation process into different steps through the thinking chain technology can help the model to more clearly demonstrate its thinking process, thereby generating more accurate and reasonable text data, that is, it helps to improve the accuracy and rationality of text generation.

[0081] Embodiment 2

[0082] Reference Figure 3 , Figure 3 The following is a flowchart of a data processing method according to Embodiment 2 of the present application. Specifically, the data processing method provided in this embodiment includes the following steps:

[0083] Step 302, obtaining input data.

[0084] Specifically, the input data may be data used for intelligent creation. For example, the input data may include one or more of the following: creation theme, creation requirements (such as word count requirements, creation style requirements), etc. In the embodiment of the present application, there is no limitation on the amount and specific content of the input data, and the setting may be customized according to the actual situation.

[0085] Step 304: initiate a search for the input data to obtain search results.

[0086] Specifically, after the input data is obtained, data retrieval can be performed in a preset database based on the input data to recall the retrieval results associated with the input data. In the embodiment of the present application, there is no limitation on the retrieval method used to obtain the retrieval results, the specific content of the preset database, and the construction method, and any appropriate retrieval method can be used according to the actual situation.

[0087] Optionally, in some of the embodiments, the search results may be obtained by the following search method:

[0088] For the input data, a browser search is performed through a preset interface to obtain a first sub-search result; and based on the embedding corresponding to the input data, a search enhancement generation process based on an external knowledge base is performed to obtain a second sub-search result;

[0089] The first sub-search result and the second sub-search result are integrated to obtain the search result.

[0090] Specifically, in the above-mentioned embodiments of the present application, on the one hand, by calling the preset interface in the browser, data retrieval is performed in the web page data with high real-time performance and large data volume, thereby obtaining a first sub-search result for the input data; on the other hand, through the RAG (Retrieval-Augmented Generation) operation, data retrieval is performed from a pre-built external database with higher matching degree and accuracy, thereby obtaining a second sub-search result for the input data; thereafter, based on the first sub-search result with high real-time performance and the second sub-search result with high matching degree and accuracy, a retrieval result that takes into account real-time performance, matching degree and accuracy can be obtained.

[0091] Optionally, in some of the embodiments, the process of performing a browser search through a preset interface for the input data to obtain the first sub-search result may include:

[0092] Extract key information from input data to obtain corresponding key information of input data;

[0093] Expanding key information of input data to obtain at least one input data expansion result;

[0094] Based on the key information of the input data and the extended result of the input data, a browser search is performed through a preset interface to obtain a first sub-search result.

[0095] Specifically, similar to the above-mentioned process of extracting key information from input data, when extracting key information from input data, it is possible to extract keywords from the input data, or it is possible to extract semantic information from the input data, thereby using the extracted keywords or semantic information as key information; thereafter, synonym expansion is performed on the above-mentioned key information to obtain an input data expansion result, and a browser search is performed on the obtained input data expansion result and key information, thereby obtaining a first sub-search result.

[0096] In the process of obtaining the first sub-search result, the key information of the input data is extracted, so that the non-key information in the input data that has little impact on the data search can be effectively filtered, so that the input information of the browser search is more lightweight and the search efficiency is improved. In addition, after the key information is obtained through the key information extraction, the key information is also expanded, so that the subsequent browser search is performed based on the key information and the input data expansion results at the same time. The advantage of the above expansion processing is that it can enrich the search expression to make it more comprehensive. The intention corresponding to the input data, and through the expansion of synonyms or related words, it can also effectively reduce the search deviation caused by the deviation of the word meaning, and increase the number of the first sub-search results retrieved.

[0097] Step 306 , parse the input data and the search results, generate target prompt information, and generate and process the target prompt information through the generative basic model to obtain the target long text data corresponding to the input data.

[0098] Among them, the generative basic model is trained based on forward training sample data and reverse training sample data. The forward training sample data includes the first prompt information as the model input and the first long text data as the training label; the reverse training sample data includes: the second long text data as the model input and the second prompt information as the training label.

[0099] Specifically, in order to improve the accuracy of the data generated by the model and ensure that the generated data has a high correlation with the input data and the retrieval results, before using the generative basic model to generate data, it is usually possible to first generate target prompt information for guiding the model generation process based on the input data and the retrieval results. Therefore, in an embodiment of the present application, after obtaining the retrieval results, target prompt information for guiding the generative basic model to generate intermediate data is generated based on the input data and the retrieval results. The target prompt information may be information including material information, generation requirements and other information required for the generative basic model to generate data. For example: in terms of long text creation, the target prompt information may be information including: creation theme, creation requirements (word count requirements, style requirements) and other content. Exemplarily, the target prompt information may be "Please generate a target long text content of 2,000 words based on the following materials."

[0100] The generative basic model in the embodiment of the present application is obtained by using two different training sample data, forward training sample data and reverse training sample, and two different training processes, forward training and reverse training. The forward training process is the process of inputting prompt information into the model to obtain long text data, and the reverse training process is the process of inputting long text data into the model to reversely infer the corresponding prompt information through the model.

[0101] The generative basic model in the embodiment of the present application is obtained by training using any one of the methods in the above-mentioned model training method embodiment 1, and the specific process of model training in the embodiment of the present application will not be repeated.

[0102] The generative basic model used in the embodiment of the present application, on the one hand, can enable the model to have the ability to create long texts with a long length through a forward training process using long text data as training labels; on the other hand, in addition to the forward long text creation training, a reverse training process using long text data as model input and prompt information as training labels is added. Through the combination of these two different training processes, forward training and reverse training, the generative language model can learn knowledge from different types of training data and training processes, thereby helping to improve the robustness and accuracy of the model. By creating long texts based on the above-mentioned generative basic model, the data quality of the long text data created can be improved.

[0103] The data processing method provided in the embodiment of the present application can be executed by any appropriate device with data processing capabilities, including but not limited to: a PC and a server.

[0104] Optionally, in some of the embodiments, the input data and the search results are parsed to generate target prompt information, and the target prompt information is generated and processed by the generative basic model to obtain target long text data corresponding to the input data, including:

[0105] Parse the input data and the search results to generate target prompt information, and then generate and process the target prompt information through the generative basic model to obtain target intermediate data;

[0106] Initiate a search for the target intermediate data and obtain the intermediate results;

[0107] Parse the target intermediate data and intermediate results, generate intermediate prompt information, and generate and process the intermediate prompt information through the generative basic model to obtain the target long text data corresponding to the input data.

[0108] Specifically, corresponding to the model training stage, in the above-mentioned embodiment of the present application, in the model reasoning stage, based on the thought chain technology, the text creation process is decomposed into two logical reasoning steps: the first step is to generate target intermediate data based on the target prompt information, and the second step is to create and generate target long text data based on the target intermediate data.

[0109] In the embodiments of the present application, there is no limitation on the specific content of the target intermediate data. For example, in terms of long text creation, the target intermediate data may be long text outline data generated for the input data, and subsequent secondary creation may be performed based on the long text outline data to obtain the target long text data that the user ultimately wants to obtain.

[0110] The reason for decomposing the actual creative process into two logical steps is that, on the one hand, the target intermediate data generated based on the target prompt information usually involves content that the target prompt information does not cover. Therefore, a secondary search is initiated for the target intermediate data to obtain intermediate results and then generate intermediate prompt information. The generative basic model is used to perform secondary creation based on the intermediate prompt information. This can make the target long text data generated by the creation richer and more comprehensive. On the other hand, decomposing the creative process into different steps through the thinking chain technology can help the model to more clearly display its thinking process, thereby generating more accurate and reasonable target long text data, that is, it helps to improve the accuracy and rationality of long text generation.

[0111] Optionally, in some of the embodiments, initiating a search for target intermediate data to obtain intermediate results includes:

[0112] Receiving modified target intermediate data generated by performing a modification operation on the target intermediate data;

[0113] Initiate a search for the modified target intermediate data to obtain the intermediate results.

[0114] Specifically, in the embodiment of the present application, considering that the target intermediate data is generated by the generative basic model, there may be a certain gap between the target intermediate data and the user's expectations. In order to make the long text data finally generated more in line with the user's needs, after the target intermediate data is generated, the target intermediate data can be displayed to the user first, so that the user can modify the target intermediate data generated by the model according to his own needs, thereby obtaining the modified target intermediate data that meets the creation needs.

[0115] Optionally, in some of the embodiments, initiating a search for input data and obtaining search results includes:

[0116] For the input data, a browser search is performed through a preset interface to obtain browser search results; and based on the embedding corresponding to the input data, a search enhancement generation process based on an external knowledge base is performed to obtain knowledge base search results;

[0117] Parse input data and search results to generate target prompt information, including:

[0118] Parse input data, browser search results, and knowledge base search results to generate target prompt information.

[0119] Specifically, in the above-mentioned embodiments of the present application, when a search is initiated for input data, on the one hand, by calling the preset interface in the browser, data search is performed in the web page data with high real-time performance and large data volume, thereby obtaining the browser search result for the input data; on the other hand, through the RAG operation, data search is performed from a pre-built external database with higher matching degree and accuracy, thereby obtaining the knowledge base search result for the input data; thereafter, based on the input data, the browser search results with high real-time performance and the knowledge base search results with high matching degree and accuracy, the target prompt information that takes into account real-time performance, matching degree and accuracy can be generated.

[0120] Optionally, in some of the embodiments, initiating a search for target intermediate data to obtain intermediate results includes:

[0121] For the target intermediate data, a browser search is performed through a preset interface to obtain a browser intermediate result; and based on the embedding corresponding to the target intermediate data, a search enhancement generation process based on an external knowledge base is performed to obtain a knowledge base intermediate result;

[0122] Parse the target intermediate data and intermediate results, and generate intermediate prompt information, including:

[0123] Parse target intermediate data, browser intermediate results, and knowledge base intermediate results to generate intermediate prompt information.

[0124] Specifically, similar to initiating a search for input data, in the embodiment of the present application, when initiating a search for the target intermediate data to obtain the intermediate results, it can also be done based on two different methods, specifically: on the one hand, by calling the preset interface in the browser, data retrieval is performed in the web page data with high real-time performance and large data volume, thereby obtaining the browser intermediate results for the target intermediate data; on the other hand, through the RAG operation, data retrieval is performed from a pre-built external database with higher matching degree and accuracy, thereby obtaining the knowledge base intermediate results for the target intermediate data; thereafter, based on the target intermediate data, the browser intermediate results with high real-time performance and the knowledge base intermediate results with high matching degree and accuracy, intermediate prompt information that takes into account real-time performance, matching degree and accuracy can be generated.

[0125] Embodiment 3

[0126] Figure 4 The model training device provided in the embodiment of the present application includes:

[0127] The sample acquisition module 402 is used to acquire forward training sample data and reverse training sample data, wherein the forward training sample data includes: first prompt information and corresponding first long text data; the reverse training sample data includes: second prompt information and corresponding second long text data;

[0128] A first training module 404 is used to perform generative language model training using the first prompt information as a model input and the first long text data as a training label to obtain a transition model;

[0129] The second training module 406 is used to train the transition model using the second long text data as the model input and the second prompt information as the training label to obtain the generative basic model.

[0130] Optionally, in some embodiments, the first training module 404 is specifically configured to:

[0131] Inputting the first prompt information into a generative language model, and outputting a first prediction result through the generative language model;

[0132] Calculating a first loss value based on the first prediction result and the first long text data, and adjusting a model parameter of the generative language model based on the first loss value;

[0133] The first prediction result is used as the updated first long text data, and the step of inputting the first prompt information into the generative language model and outputting the first prediction result through the generative language model is returned until the first training stop condition is met, thereby obtaining a transition model.

[0134] Optionally, in some embodiments, the first training module 404, when executing the step of using the first prediction result as the updated first long text data, is specifically configured to:

[0135] Determine whether the first prediction result satisfies a first preset condition, and if so, use the first prediction result as the updated first long text data;

[0136] If not, then the editing information of the first prediction result is received, the first prediction result is modified according to the editing information, and the modified first prediction result is used as the updated first long text data.

[0137] Optionally, in some embodiments, the second training module 406 is specifically configured to:

[0138] Inputting the second long text data into the transition model, and outputting a second prediction result through the transition model;

[0139] Calculating a second loss value based on the second prediction result and the second prompt information, and adjusting a model parameter of the transition model based on the second loss value;

[0140] The second prediction result is used as the updated second prompt information, and the step of inputting the second long text data into the transition model and outputting the second prediction result through the transition model is returned until the second training stop condition is met, thereby obtaining a generative basic model.

[0141] Optionally, in some embodiments, the second training module 406, when executing the step of using the second prediction result as the updated second prompt information, is specifically configured to:

[0142] Determine whether the second prediction result satisfies the second preset condition, and if so, use the second prediction result as the updated second prompt information;

[0143] If not, then the editing information of the second prediction result is received, the second prediction result is modified according to the editing information, and the modified second prediction result is used as the updated second prompt information.

[0144] Optionally, in some embodiments, the forward training sample data further includes: first intermediate data; the reverse training sample data further includes: second intermediate data;

[0145] The first training module 404 is specifically used for:

[0146] Taking the first prompt information as model input and the first intermediate data as training labels, the model is trained to obtain a first intermediate model; taking the first intermediate data as model input and the first long text data as training labels, the intermediate model is trained to obtain a transition model;

[0147] The second training module 406 is specifically used for:

[0148] The second long text data is used as the model input, and the second intermediate data is used as the training label to train the transition model to obtain the second intermediate model; the second intermediate data is used as the model input, and the second prompt information is used as the training label to train the second intermediate model to obtain the generative basic model.

[0149] Optionally, in some embodiments, the first intermediate data is text outline data corresponding to the first long text data; and the second intermediate data is text outline data corresponding to the second long text data.

[0150] The model training device of this embodiment is used to implement the corresponding model training method in the aforementioned embodiment 1, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here. In addition, the functional implementation of each module in the model training device of this embodiment can refer to the description of the corresponding part in the aforementioned method embodiment 1, which will not be repeated here.

[0151] Embodiment 4

[0152] Figure 5 1 is a structural block diagram of a data processing device according to Embodiment 4 of the present application. The data processing device provided in the embodiment of the present application includes:

[0153] An input data acquisition module 502, used to acquire input data;

[0154] Retrieval module 504, used to initiate a search for input data and obtain search results;

[0155] The long text data obtaining module 506 is used to parse the input data and the search results, generate target prompt information, and generate and process the target prompt information through the generative basic model to obtain the target long text data corresponding to the input data;

[0156] Among them, the generative basic model is trained based on forward training sample data and reverse training sample data. The forward training sample data includes the first prompt information as the model input and the first long text data as the training label; the reverse training sample data includes: the second long text data as the model input and the second prompt information as the training label.

[0157] Optionally, in some embodiments, the long text data obtaining module 506 is specifically used to:

[0158] Parse the input data and the search results to generate target prompt information, and then generate and process the target prompt information through the generative basic model to obtain target intermediate data;

[0159] Initiate a search for the target intermediate data and obtain the intermediate results;

[0160] Parse the target intermediate data and intermediate results, generate intermediate prompt information, and generate and process the intermediate prompt information through the generative basic model to obtain the target long text data corresponding to the input data.

[0161] Optionally, in some embodiments, the long text data obtaining module 506, when executing the step of initiating a search for target intermediate data and obtaining intermediate results, is specifically used to:

[0162] Receiving modified target intermediate data generated by performing a modification operation on the target intermediate data;

[0163] Initiate a search for the modified target intermediate data to obtain the intermediate results.

[0164] Optionally, in some of the embodiments, the target intermediate data is text outline data generated for the input data.

[0165] Optionally, in some embodiments, the retrieval module 504 is specifically configured to:

[0166] For the input data, a browser search is performed through a preset interface to obtain browser search results; and based on the embedding corresponding to the input data, a search enhancement generation process based on an external knowledge base is performed to obtain knowledge base search results;

[0167] The long text data obtaining module 506, when executing the step of parsing the input data and the search results and generating the target prompt information, is specifically used for:

[0168] Parse input data, browser search results, and knowledge base search results to generate target prompt information.

[0169] Optionally, in some embodiments, the long text data obtaining module 506, when executing the step of initiating a search for target intermediate data and obtaining intermediate results, is specifically used to:

[0170] For the target intermediate data, a browser search is performed through a preset interface to obtain a browser intermediate result; and based on the embedding corresponding to the target intermediate data, a search enhancement generation process based on an external knowledge base is performed to obtain a knowledge base intermediate result;

[0171] Parse the target intermediate data and intermediate results, and generate intermediate prompt information

[0172] The long text data obtaining module 506, when executing the step of parsing the target intermediate data and intermediate results and generating intermediate prompt information, is specifically used for:

[0173] Parse target intermediate data, browser intermediate results, and knowledge base intermediate results to generate intermediate prompt information.

[0174] The data processing device of this embodiment is used to implement the corresponding data processing method in the aforementioned embodiment 2, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here. In addition, the functional implementation of each module in the data processing device of this embodiment can refer to the description of the corresponding part in the aforementioned method embodiment 2, which will not be described in detail here.

[0175] Embodiment 5

[0176] Reference Figure 6 , shows a schematic diagram of the structure of an electronic device according to Embodiment 5 of the present application. The specific embodiments of the present application do not limit the specific implementation of the electronic device.

[0177] like Figure 6 As shown, the electronic device may include: a processor (processor) 602 , a communication interface (Communications Interface) 604 , a memory (memory) 606 , and a communication bus 608 .

[0178] in:

[0179] The processor 602 , the communication interface 604 , and the memory 606 communicate with each other via a communication bus 608 .

[0180] The communication interface 604 is used to communicate with other electronic devices or servers.

[0181] The processor 602 is used to execute the program 610, and specifically can execute the relevant steps in the above method embodiment.

[0182] Specifically, the program 610 may include program codes, which include computer operation instructions.

[0183] The processor 602 may be a CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0184] The memory 606 is used to store the program 610. The memory 606 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.

[0185] The program 610 may include multiple computer instructions. Specifically, the program 610 may enable the processor 602 to execute operations corresponding to the method described in any of the aforementioned method embodiments through the multiple computer instructions.

[0186] The specific implementation of each step in program 610 can refer to the corresponding description of the corresponding steps and units in the above method embodiment, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above method embodiment, which will not be repeated here.

[0187] The present application also provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned multiple method embodiments is implemented. The computer storage medium includes but is not limited to: a compact disk (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.

[0188] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any one of the above-mentioned multiple method embodiments.

[0189] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to 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.

[0190] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.

[0191] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an Application Specific Integrated Circuit (ASIC) or a Field Programmable Gate Array (FPGA)). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (for example, a random access memory (RAM), a read-only memory (ROM), a flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general purpose computer accesses code for implementing the methods shown herein, the execution of the code transforms the general purpose computer into a special purpose computer for executing the methods shown herein.

[0192] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.

[0193] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.

Claims

1. A model training method, comprising: Acquire positive training sample data and negative training sample data, wherein the positive training sample data includes: first prompt information and corresponding first long text data; and the negative training sample data includes: second prompt information and corresponding second long text data; Using the first prompt information as a model input and the first long text data as a training label, performing generative language model training to obtain a transition model; The transition model is trained using the second long text data as a model input and the second prompt information as a training label to obtain a generative basic model.

2. The method according to claim 1, wherein: The step of taking the first prompt information as a model input and the first long text data as a training label to perform generative language model training to obtain a transition model includes: Inputting the first prompt information into a generative language model, and outputting a first prediction result through the generative language model; Calculating a first loss value based on the first prediction result and the first long text data, and adjusting a model parameter of the generative language model based on the first loss value; The first prediction result is used as the updated first long text data, and the step of inputting the first prompt information into the generative language model and outputting the first prediction result through the generative language model is returned until the first training stop condition is met to obtain a transition model.

3. The method according to claim 2, wherein: The taking the first prediction result as the updated first long text data includes: Determine whether the first prediction result satisfies a first preset condition, and if so, use the first prediction result as the updated first long text data; If not, then receiving editing information of the first prediction result, modifying the first prediction result according to the editing information, and using the modified first prediction result as the updated first long text data.

4. The method according to any one of claims 1 to 3, wherein: The step of taking the second long text data as a model input and the second prompt information as a training label to train the transition model to obtain a generative basic model includes: Inputting the second long text data into the transition model, and outputting a second prediction result through the transition model; Calculating a second loss value based on the second prediction result and the second prompt information, and adjusting a model parameter of the transition model based on the second loss value; The second prediction result is used as the updated second prompt information, and the step of inputting the second long text data into the transition model and outputting the second prediction result through the transition model is returned until the second training stop condition is met to obtain the generative basic model.

5. The method according to claim 4, wherein: The taking the second prediction result as updated second prompt information includes: Determine whether the second prediction result satisfies a second preset condition, and if so, use the second prediction result as updated second prompt information; If not, then receiving editing information of the second prediction result, modifying the second prediction result according to the editing information, and using the modified second prediction result as the updated second prompt information.

6. The method according to claim 1, wherein: The forward training sample data also includes: first intermediate data; the reverse training sample data also includes: second intermediate data; The step of taking the first prompt information as a model input and the first long text data as a training label to perform model training to obtain a transition model includes: Taking the first prompt information as model input and the first intermediate data as training labels, model training is performed to obtain a first intermediate model; taking the first intermediate data as model input and the first long text data as training labels, the intermediate model is trained to obtain a transition model; The step of taking the second long text data as a model input and the second prompt information as a training label to train the transition model to obtain a generative basic model includes: The transition model is trained using the second long text data as model input and the second intermediate data as training labels to obtain a second intermediate model; the second intermediate data is trained using the second prompt information as training labels to obtain a generative basic model.

7. The method according to claim 6, wherein: The first intermediate data is text outline data corresponding to the first long text data; the second intermediate data is text outline data corresponding to the second long text data.

8. A data processing method, comprising: Get input data; Initiate a search for the input data to obtain search results; Parsing the input data and the search results to generate target prompt information, and performing generation processing on the target prompt information through a generative basic model to obtain target long text data corresponding to the input data; Wherein, the generative basic model is trained based on forward training sample data and reverse training sample data, the forward training sample data includes first prompt information as model input, and first long text data as training label; the reverse training sample data includes: second long text data as model input, and second prompt information as training label.

9. The method according to claim 8, wherein: The step of parsing the input data and the search results to generate target prompt information, and performing generation processing on the target prompt information through a generative basic model to obtain target long text data corresponding to the input data includes: Parsing the input data and the search results to generate target prompt information, and performing generation processing on the target prompt information through a generative basic model to obtain target intermediate data; Initiate a search for the target intermediate data to obtain intermediate results; The target intermediate data and the intermediate result are parsed to generate intermediate prompt information, and the intermediate prompt information is generated and processed through a generative basic model to obtain target long text data corresponding to the input data.

10. The method according to claim 9, wherein: The initiating a search for the target intermediate data to obtain an intermediate result includes: receiving modified target intermediate data generated by performing a modification operation on the target intermediate data; Initiate a search for the modified target intermediate data to obtain the intermediate results.

11. The method according to claim 9 or 10, wherein: The target intermediate data is text outline data generated for the input data.

12. The method according to any one of claims 8 to 10, wherein: The initiating a search for the input data and obtaining a search result includes: For the input data, a browser search is performed through a preset interface to obtain a browser search result; and based on the embedding corresponding to the input data, a search enhancement generation process based on an external knowledge base is performed to obtain a knowledge base search result; The step of parsing the input data and the search results to generate target prompt information includes: The input data, the browser search results, and the knowledge base search results are analyzed to generate target prompt information.

13. The method according to claim 9, wherein: The initiating a search for the target intermediate data to obtain an intermediate result includes: For the target intermediate data, a browser search is performed through a preset interface to obtain a browser intermediate result; and based on the embedding corresponding to the target intermediate data, a search enhancement generation process based on an external knowledge base is performed to obtain a knowledge base intermediate result; The step of parsing the target intermediate data and the intermediate result to generate intermediate prompt information includes: The target intermediate data, the browser intermediate result, and the knowledge base intermediate result are parsed to generate intermediate prompt information.

14. An electronic device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method according to any one of claims 1-13.

15. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.

16. A computer program product, comprising computer instructions, wherein the computer instructions instruct a computing device to perform operations corresponding to the method according to any one of claims 1 to 13.