Training method and device for data-to-text generation model

By adjusting the parameters of the neural network model by combining the deviation between the predicted text and the target text and the loss value of the fidelity between the predicted text and the structured data, the problem of semantic inconsistency in the data-to-text generation model in the existing technology is solved, and the accuracy of the generated text is improved. Semantic fidelity and fluency.

CN115017178BActive Publication Date: 2024-10-29ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210589921.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2024-10-29
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

When the existing end-to-end generation model generates data from data, the semantic fidelity between the generated text and the input data is not high, making it difficult to effectively improve it.

Method used

By obtaining structured data and target text, inputting the neural network model to generate predictive text, and calculating the loss value between the predicted text and the target text and the loss value between the structured data after the predicted text conversion and the original structured data, These two loss values ​​are combined to adjust the parameters of the neural network model to optimize the semantic consistency between the text output by the model and the structured data.

Benefits of technology

It significantly improves the semantic fidelity between generated text and input structured data, and improves the accuracy and fluency of the text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115017178B_ABST
    Figure CN115017178B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a training method and device for a data-to-text generation model. The training method includes: obtaining first training data, the first training data including first structured data and a target text corresponding to the first structured data; obtaining the predicted text output by the first preset neural network model after the first structured data is input into the first preset neural network model; obtaining a first loss value between the predicted text and the target text; obtaining a second loss value between the predicted structured data and the first structured data, and determining a target loss value based on the first loss value and the second loss value; adjusting the parameters of the first preset neural network model based on the target loss value to obtain a target neural network model; and sending the target neural network model to a target device. The technical solution provided by the present application can improve the semantic fidelity of the generated text to the input structured data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a training method and device for a data-to-text generation model. Background Art

[0002] The data-to-text generation task is one of the important research tasks of text generation, and its goal is to automatically generate relevant descriptive text based on the input structured data.

[0003] Currently, text is usually generated from structured data based on an end-to-end generative model, where the end-to-end model can be considered as a black box model, which can generate text information corresponding to the input data after a graph structure (input data) corresponding to the structured data is given.

[0004] However, when generating data to text based on an end-to-end generative model, the semantic fidelity between the generated text and the input data is not high. Therefore, how to improve the semantic fidelity between the generated text and the input structured data has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides a method and device for training a data-to-text generation model, which can improve the semantic fidelity of generated text and input structured data.

[0006] In a first aspect, the present application provides a training method for a data-to-text generation model, comprising: obtaining first training data, the first training data comprising first structured data and a target text corresponding to the first structured data; obtaining predicted text output by a first preset neural network model after the first structured data is input into a first preset neural network model; obtaining a first loss value between the predicted text and the target text; obtaining a second loss value between the predicted structured data and the first structured data, the predicted structured data being structured data after the predicted text is converted based on a preset conversion algorithm, the preset conversion algorithm being used to convert text information into structured data; determining a target loss value based on the first loss value and the second loss value; adjusting parameters of the first preset neural network model based on the target loss value to obtain a target neural network model; and sending the target neural network model to a target device.

[0007] In this embodiment, the parameters of the first preset neural network model are adjusted based on the target loss value, that is, the first loss value and the second loss value are simultaneously optimized to adjust the parameters of the preset network model.

[0008] It should be understood that since the first loss value can reflect the degree of deviation between the current predicted text and the target text, and the second loss value can reflect the fidelity between the predicted text and the first structured data, therefore, in this embodiment, compared with the method of adjusting the parameters of the first preset neural network model by only considering the degree of deviation between the current predicted text and the target text, since the task of optimizing the fidelity between the predicted text and the first structured data is added, it is possible to improve the semantic fidelity between the text predicted by the trained target neural network model and the input structured data in the process of adjusting the parameters of the first preset neural network model based on the target loss value.

[0009] In combination with the first aspect, in a possible implementation manner, the target device is a second server.

[0010] In combination with the first aspect, in a possible implementation manner, the target device is a terminal device.

[0011] In combination with the first aspect, in a possible implementation, the method further includes: receiving the first preset neural network model sent by the target device.

[0012] In combination with the first aspect, in a possible implementation, the first training data also includes a target order for each data in the first structured data, and the target order is the arrangement order of the text corresponding to each data in the target text; accordingly, the method also includes: obtaining the predicted order of each data in the first structured data output by the first preset neural network model after the first structured data is input into the first preset neural network model, and the predicted order is the arrangement order of the text corresponding to each data in the predicted text; determining a third loss value according to the predicted order and the target order; accordingly, determining the target loss value according to the first loss value and the second loss value includes: determining the target loss value according to the first loss value, the second loss value and the third loss value.

[0013] In this implementation, a training task is additionally introduced to optimize the loss value between the predicted position and the target position of each data in the first structure data, so as to improve the fluency of the text output by the model after adjusting the parameters of the first preset neural network model.

[0014] In combination with the first aspect, in a possible implementation manner, the target loss value is equal to the sum of the first loss value, the second loss value and the third loss value.

[0015] In combination with the first aspect, in a possible implementation, the method also includes: obtaining M1 second structured data, the M1 second structured data including at least two types of data: tabular data, structured data query SQL data, and logical data, M1 is a positive integer greater than 1; preprocessing the M1 second structured data to obtain M1 second training data corresponding one-to-one to the M1 second structured data, the second training data corresponding to the j-th second structured data in the M1 second training data including: the j-th second structured data and the target text corresponding to the j-th second structured data, j is a positive integer and j ranges from 1 to M1; using the M1 second training data to train a second preset neural network model to obtain the first preset neural network model.

[0016] In this embodiment, the first preset neural network model is obtained by training the second preset neural network model based on the training data corresponding to various structured data. It can be understood that the first preset neural network model obtained by this implementation is trained based on the training data corresponding to various structured data, and therefore, the obtained first preset neural network model already has a partial ability to generate text from structured data.

[0017] In combination with the first aspect, in a possible implementation, the second preset neural network model includes N1 encoders and N2 decoders, the N1 encoders are used to obtain the feature vectors of each structured data in the M1 structured data, and the N2 decoders are used to predict the predicted text corresponding to each structured data based on the feature vector of each structured data, and N1 and N2 are positive integers greater than 1.

[0018] In a second aspect, the present application provides a training device for a data-to-text generation model, comprising: an acquisition module, used to acquire first training data, wherein the first training data includes first structured data and a target text corresponding to the first structured data; the acquisition module is also used to acquire a predicted text output by the first preset neural network model after the first structured data is input into a first preset neural network model; the acquisition module is also used to acquire a first loss value between the predicted text and the target text; the acquisition module is also used to acquire a second loss value between the predicted structured data and the first structured data, wherein the predicted structured data is structured data after the predicted text is converted based on a preset conversion algorithm, and the preset conversion algorithm is used to convert text information into structured data; a processing module is used to determine a target loss value based on the first loss value and the second loss value; the processing module is also used to adjust the parameters of the first preset neural network model based on the target loss value to obtain a target neural network model; the processing module is also used to send the target neural network model to a target device.

[0019] In combination with the first aspect, in a possible implementation manner, the target device is a second server.

[0020] In combination with the first aspect, in a possible implementation manner, the target device is a terminal device.

[0021] In combination with the first aspect, in a possible implementation, the processing module is also used to: receive the first preset neural network model sent by the target device. In combination with the second aspect, in a possible implementation, the first training data also includes a target order for each data in the first structured data, and the target order is the arrangement order of the text corresponding to each data in the target text; accordingly, the acquisition module is also used to: acquire the predicted order of each data in the first structured data output by the first preset neural network model after the first structured data is input into the first preset neural network model, and the predicted order is the arrangement order of the text corresponding to each data in the predicted text; the processing module is also used to determine a third loss value based on the predicted order and the target order, and determine a target loss value based on the first loss value, the second loss value and the third loss value.

[0022] In combination with the second aspect, in a possible implementation manner, the target loss value is equal to the sum of the first loss value, the second loss value and the third loss value.

[0023] In combination with the second aspect, in a possible implementation, the acquisition module is also used to: acquire M1 second structured data, the M1 second structured data include at least two types of data: tabular data, structured data query SQL data, logical data, M1 is a positive integer greater than 1; the processing module is also used to: pre-process the M1 second structured data to obtain M1 second training data corresponding one-to-one to the M1 second structured data, the second training data corresponding to the j-th second structured data in the M1 second training data include: the j-th second structured data and the target text corresponding to the j-th second structured data, j is a positive integer and j ranges from 1 to M1; the processing module is also used to: use the M1 second training data to train a second preset neural network model to obtain the first preset neural network model.

[0024] In combination with the second aspect, in a possible implementation, the second preset neural network model includes N1 encoders and N2 decoders, the N1 encoders are used to obtain the feature vectors of each structured data in the M1 structured data, and the N2 decoders are used to predict the predicted text corresponding to each structured data based on the feature vector of each structured data, and N1 and N2 are positive integers greater than 1.

[0025] In a third aspect, a training device for a data-to-text generation model is provided, comprising a processor for calling a computer program from a memory, wherein when the computer program is executed, the processor is for executing the method described in the first aspect or any possible implementation of the first aspect.

[0026] In a fourth aspect, a communication device is provided, which includes the apparatus described in the second aspect or any possible implementation manner thereof.

[0027] In a fifth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program includes a code for executing the method described in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A structural schematic diagram of an application scenario provided by an embodiment of the present application;

[0029] Figure 2 A schematic diagram of the process of training a data-to-text generation model provided in one embodiment of the present application;

[0030] Figure 3 A structural schematic diagram of a graph-to-text pre-training model provided in one embodiment of the present application;

[0031] Figure 4 A schematic diagram of converting first structured data into a graph structure provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of converting first structured data into a graph structure provided in another embodiment of the present application;

[0033] Figure 6 A structural schematic diagram of a method for training a data-to-text generation model provided in one embodiment of the present application;

[0034] Figure 7 A schematic diagram of the structure of an encoder provided by one embodiment of the present application;

[0035] Figure 8 A structural schematic diagram of a training device for a data-to-text generation model provided in one embodiment of the present application;

[0036] Fig. 9 A structural schematic diagram of a data-to-text generation model training device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0038] To facilitate understanding, several terms involved in the embodiments of the present application are first introduced.

[0039] 1. Text Generation

[0040] Text generation is a very important but challenging task in the field of natural language processing. It aims to generate reasonable and readable text in natural language mode from input data (e.g., sequences and keywords). Its purpose is to generate readable natural language text. Representative applications include dialogue systems, text summarization, and machine translation.

[0041] 2. Neural Networks

[0042] Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is also the study of the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0043] The key technology of artificial intelligence today is neural networks (NN). Neural networks simulate the connections between nerve cells in the human brain and widely interconnect a large number of simple processing units (called neurons) to form a complex network system.

[0044] A simple neural network consists of three layers: input layer, output layer and hidden layer (also called middle layer). The connection between each layer corresponds to a weight (its value is called weight, parameter). The reason why neural networks can perform well in computer vision, natural language processing and other fields is that the weights are adjusted through training algorithms to make the prediction results of the neural network optimal.

[0045] The training of neural networks generally includes two calculation steps, the first step is forward calculation, and the second step is reverse calculation. Among them, the forward calculation is: after the input value and the parameter are calculated, they are passed through a nonlinear function to generate the output value. The output value is either the final output of the network or will be used as the subsequent input value to continue to perform similar calculations. The deviation between the output value of the network and the actual label value of the corresponding sample is measured by the loss function. The loss function is expressed as a function f(x,w) of the input sample x and the network parameter w. In order to minimize the loss function, it is necessary to continuously adjust the network parameter w, and the reverse calculation is to obtain the updated value of the parameter w. In the algorithm based on gradient descent, the reverse calculation starts from the last layer of the neural network, calculates the partial derivative of the loss function with respect to the parameters of each layer, and finally obtains the partial derivative of all parameters, which is called the gradient. In each iteration, the parameter w is updated in the opposite direction of the gradient with a certain step size η to obtain a new parameter w, that is, one step of training is completed. The update process is expressed as follows:

[0046]

[0047] Among them, w t represents the parameter used in the tth iteration, w t+1 represents the updated parameters, η is called the learning rate, B t Represents the sample set input at the tth iteration.

[0048] The process of training a neural network is the process of learning the weights corresponding to neurons. Its ultimate goal is to obtain the weights corresponding to each layer of neurons in the trained neural network.

[0049] In recent years, with the rapid development of artificial intelligence technology, text generation has become an important technology in natural language processing. Applicants can use established information and text generation models to generate text sequences that meet specific goals. The application scenarios of text generation models are very rich, such as reading comprehension, human-computer dialogue, or intelligent writing, etc. Among them, in text generation technology, the task of generating data from text is one of the important research tasks of text generation technology, and its goal is to automatically generate relevant descriptive text based on the input structured data. Among them, structured data is, for example, table data, structured query language (SQL) data, logic data, etc. It should be noted here that the concepts of Table data, SQL data, and Logic data can be referred to the introduction in the relevant technology, and will not be repeated here.

[0050] For example, Figure 1 This is a structural diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, in this application scenario, the training server 101 can use a classification algorithm to train the structured data in the structured database to obtain a trained model. Afterwards, the training server 101 can send the trained model to the target device 102, so that the target device 102 can use the trained model to generate text information corresponding to the new sample data when receiving new sample data.

[0051] It is noted that the specific generation task type in the application scenario is not limited in the embodiment of the present application. For example, the text generation system can complete the generation task type based on table (Table) data to text (Text), also known as Table-to-Text generation; or, it can complete the generation task type based on structured query language (structured query language, SQL) data to Text, also known as SQL-to-Text generation; or, it can complete the generation task type based on logic (Logic) data to text (Text), also known as Logic-to-Text generation; or, it can also complete the generation task type based on response natural language generation (ResponseNLG) data to text (Text).

[0052] Usually, in Figure 1In the application scenario shown, when the training server 101 performs training based on structured data in a structured database, the preset model used is a generative model based on autoregression, for example, a GPT model or a T5 model is used to generate text from data. The GPT model or the T5 model can be considered as a black box model, which can generate text information corresponding to the data after given input data.

[0053] However, when generating text from data based on the GPT model or the T5 model, there is usually a semantic deviation between the generated text and the original input data, resulting in low accuracy of the generated text.

[0054] In view of this, an embodiment of the present application provides a data-to-text generation model training method and device. In the data-to-text generation model training method provided by the present application, in addition to the original training tasks, other training tasks are additionally introduced when training a preset neural network model, wherein the additional training tasks are used to make the text output by the preset neural network model closer to the input structured data, so that when the trained neural network model predicts real-time structured data, the semantic fidelity between the generated text and the real-time structured data is improved.

[0055] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0056] Figure 2 FIG. 1 is a flow chart of a method for training a data-to-text generation model according to an embodiment of the present application. Figure 2 As shown, the method of this embodiment may include S201, S202, S203, S204, S205, S206 and S207. The method may be Figure 1 The training server 101 is shown executing.

[0057] It should be noted that, in this embodiment, the training server 101 is also referred to as the first server.

[0058] S201: Acquire first training data, where the first training data includes first structured data and a target text corresponding to the first structured data.

[0059] It should be understood that if a neural network model is to be trained, the first step is to obtain samples used to train the neural network model, that is, training data.

[0060] In this embodiment, the first training data includes first structured data and a target text corresponding to the first structured data.

[0061] It should be noted that the embodiments of the present application do not limit the specific type of the trained neural network model. For example, a neural network model based on table data to text is to be trained, that is, a neural network model for Table-to-Text; a neural network model based on structured query language (SQL) data to text is to be trained, that is, a neural network model for SQL-to-Text; a neural network model based on logic data to text is to be trained, that is, a neural network model for Logic-to-Text; or a neural network model based on response natural language generation (ResponseNLG) data to text is to be trained.

[0062] It should be understood that when the neural network model to be trained in the present application is Table-to-Text, the first structured data included in the first training data in this embodiment refers to Table data, when the neural network model to be trained in the present application is SQL-to-Text, the first structured data included in the first training data in this embodiment refers to SQL data, when the neural network model to be trained in the present application is Logic-to-Text, the first structured data included in the first training data in this embodiment refers to Logic data, and when the neural network model to be trained in the present application is a generation task of response natural language generation (ResponseNLG) data to text (Text), the first structured data included in the first training data in this embodiment refers to response natural language generation data, wherein the response natural language generation data includes Table data and SQL data.

[0063] In this embodiment, the first training data includes the target text corresponding to the first structured data. It should be understood that the target text is used to indicate the target value that the neural network to be trained is expected to output after the first structured data is input into the neural network to be trained, that is, it can be considered as the ideal text information to be output.

[0064] S202, obtaining the predicted text output by the first preset neural network model after the first structured data is input into the first preset neural network model.

[0065] It should be noted that in this embodiment, the specific form of the first preset neural network model is not limited. For example, the first preset neural network model can be a model that has been trained on some large data sets, or it can be a redesigned model. It should also be understood that the first preset neural network model in this embodiment refers to a model that can output text information.

[0066] Generally, when certain data is input into a neural network, the neural network model can output a predicted value corresponding to the certain data. Therefore, in this embodiment, when the first structured data is input into the first preset neural network model, the first preset neural network model can output a predicted text.

[0067] It should be noted that in the field of text generation, in order to quickly obtain a model for a specific type, some models that have been trained on large data sets (also called pre-trained models) are usually used as basic models. It should be understood that when using a pre-trained model as a basic model, it is necessary to unify the training data used to train a specific type of model with the basic model.

[0068] In one embodiment, the pre-trained model used is Figure 3 The graph-to-text model shown in Figure 1 is also called the graph-to-text model. Figure 3 As shown, the Graph-to-Text model includes an encoder and a decoder. The encoder is used to obtain a feature vector C corresponding to a certain graph structure data, and the decoder is used to predict the predicted text corresponding to the certain structure data based on the feature vector C.

[0069] It should be understood that if the pre-trained model used in this embodiment is a model based on graph to text, also called Graph-to-Text, then it is necessary to preprocess the first structured data to convert the first structured data into a graph structure.

[0070] For example, when the first structured data is SQL data: Select fixed increase year, additional issuance purpose Where latest price <'10', Figure 4 A schematic diagram of converting first structured data into a graph structure is provided for one embodiment of the present application. Figure 4As shown, the first node of the graph structure is the root node, and then the root node is connected to the Select node and the Where node respectively. The Select node is connected to two "AGG:none" nodes respectively, one of which is connected to the fixed increase year node, and the other "AGG:none" node is connected to the additional issuance purpose node. The Where node is connected to the operation "Op:<" node, and the "Op:<" node is connected to the latest price node and 10 respectively.

[0071] Exemplarily, when the first structured data is the Table data shown in Table 1:

[0072] Table 1 Table data

[0073] Fixed increase year Purpose of additional issuance 2016 Financing other assets 2016 Project Financing

[0074] Figure 5 A schematic diagram of converting first structured data into a graph structure is provided in another embodiment of the present application. Figure 5 As shown, the converted graph structure includes 5 nodes. Among them, the node Fixed Increase Year is connected to the node 2016, the node Increase Issuance Purpose is connected to the node Financing Other Assets and the node Project Financing, the node 2016 is connected to the node Financing Other Assets and the node Project Financing, and the node Financing Other Assets is connected to the node Project Financing.

[0075] It is to be noted here that Figure 4 and Figure 5 The diagram structure shown is only an example and does not constitute a limitation of the present application.

[0076] S203: Obtain a first loss value between the predicted text and the target text.

[0077] The predicted text refers to the text information output by the first preset neural network model after the first structured data is input into the first preset neural network model. The target text is the ideal text output by the preset neural network to be trained after the first structured data is input into the preset neural network.

[0078] It should be understood that when training a neural network, the smaller the deviation between the target text and the predicted text, the better. Therefore, in this embodiment, after obtaining the target text and the predicted text, the first loss value between the predicted text and the target text can be calculated first. It can be understood that the first loss value can reflect the degree of deviation between the current predicted text and the target text.

[0079] S204, obtaining a second loss value between the predicted structured data and the first structured data, wherein the predicted structured data is structured data after the predicted text is converted based on a preset conversion algorithm, and the preset conversion algorithm is used to convert text information into structured data.

[0080] It is understandable that when a neural network model is used to generate predicted text based on the first structured data, the predicted text should be as semantically faithful to the first structured data as possible. In other words, the predicted text is required to be as semantically consistent with the first structured data as possible.

[0081] Therefore, in this embodiment, during the training process, after the predicted text is obtained, the predicted text is first converted into structured data using a preset conversion algorithm, and then the converted structured data is compared with the first structured data, that is, the second loss value between the predicted structured data and the first structured data is calculated. It can be understood that the second loss value can reflect the fidelity between the predicted text and the first structured data.

[0082] S205: Determine a target loss value according to the first loss value and the second loss value.

[0083] In a possible implementation, the target loss value is the sum of the first loss value and the second loss value.

[0084] In another possible implementation, the target loss value is a weighted sum of the first loss value and the second loss value.

[0085] S206, adjusting the parameters of the first preset neural network model according to the target loss value to obtain a target neural network model.

[0086] In a possible implementation, the first preset neural network model is a neural network model sent by the target device.

[0087] The target device is, for example, a terminal device or a server (also referred to as a second server in this embodiment) on which a first preset neural network model is deployed.

[0088] It should be noted that this embodiment does not limit the specific form of the parameters in the first preset neural network model. For example, the first preset neural network model is an initialization model (that is, it can be considered that the parameters in the first preset neural network model have not been trained), or the first preset neural network model is a trained model (that is, it can be considered that the parameters in the first preset neural network model have been trained).

[0089] In this embodiment, the parameters of the first preset neural network model are adjusted based on the target loss value. That is, the first loss value and the second loss value are optimized simultaneously to adjust the parameters of the preset network model. It should be understood that since the first loss value can reflect the degree of deviation between the current predicted text and the target text, and the second loss value can reflect the fidelity between the predicted text and the first structured data, therefore, in this embodiment, compared with the method of adjusting the parameters of the first preset neural network model by only considering the degree of deviation between the current predicted text and the target text, the task of optimizing the fidelity between the predicted text and the first structured data is added. Therefore, in the process of adjusting the parameters of the first preset neural network model based on the target loss value, the semantic fidelity between the text predicted by the trained target neural network model and the input structured data can be improved.

[0090] S207, sending the target neural network model to the target device.

[0091] Exemplarily, the target device is a server (also referred to as a second server in this embodiment) on which a neural network model can be deployed, or a terminal device on which a neural network model can be deployed.

[0092] It should be understood that when the target device is the second server, if the target neural network model is to be used to generate text information, the terminal device can first send the structured data (such as new sample data) that needs to generate text information to the second server, and then the second server generates the text information of the new sample data. That is, in this scenario, the terminal device can obtain the text information corresponding to the new sample data by accessing the second server.

[0093] It should be understood that when the target device is a terminal device, if the target neural network model is to be used to generate text information, the terminal device can directly input the structured data required to generate text information (for example, called new sample data) into the target neural network model, and then generate the text information of the new sample data.

[0094] As an optional embodiment, in Figure 2On the basis of the illustrated embodiment, in a possible implementation method, the first training data in the present application may also include a target order for each data in the first structured data, wherein the target order is the arrangement order of the text corresponding to each data in the target text; accordingly, the training method of the present application also includes: obtaining the predicted order of each data in the first structured data output by the first preset neural network model after the first structured data is input into the first preset neural network model, wherein the predicted order is the arrangement order of the text corresponding to each data in the predicted text; determining a third loss value according to the predicted order and the target order; accordingly, determining the target loss value according to the first loss value and the second loss value, including: determining the target loss value according to the first loss value, the second loss value and the third loss value.

[0095] It should be understood that the first structured data usually includes multiple data. For example, for a certain table data, the table data includes several attributes, such as name information, date of birth information, occupation information, etc.

[0096] It should also be understood that, generally, when training a generative model from structured data to text, the generated text should be as fluent as possible, and whether the generated text is fluent is related to the order of each data in the structured data in the generated text. For example, when generating text for the above-mentioned tabular data including name information, date of birth information, and occupation information, it may be more fluent to describe the name first, then the date of birth, and finally the occupation information, but if other descriptions are used, the generated text may be more confusing.

[0097] Therefore, in this embodiment, the first training data also includes the target order of each data in the first structured data, wherein the target order refers to the arrangement order of the text corresponding to each data in the target text, that is, the target order describes the ideal position of each data in the first structured data when generating text.

[0098] Afterwards, during specific training, this embodiment obtains the predicted order of each data in the first structured data output by the first preset neural network model after the first structured data is input into the first preset neural network model, wherein the predicted order can be considered as the arrangement order of the text corresponding to each data in the text predicted by the first preset neural network model (called predicted text) under the parameters of the current first preset neural network model, that is, the predicted order describes the position information of each data in the first structured data predicted by the first preset neural network model.

[0099] It should be understood that the smaller the deviation between the predicted order and the target order, the smoother the generated text. Therefore, in this embodiment, after the predicted order is obtained, the deviation between the predicted order and the target order is calculated, that is, the third loss value is determined according to the predicted order and the target order; accordingly, after the third loss value is determined, the target loss value is determined according to the first loss value, the second loss value and the third loss value, and then the target loss value is used to adjust the parameters of the first preset neural network model. Specifically, when adjusting the parameters of the first preset neural network model according to the target loss value, minimizing the target loss value can be used as the optimization goal.

[0100] In this implementation, in the process of training the first preset neural network model based on the first structure data, in addition to Figure 2 In addition to the training task of optimizing the loss value between the predicted structured data corresponding to the predicted text and the first structured data, the illustrated embodiment also introduces a training task of optimizing the loss value between the predicted position and the target position of each data in the first structured data, thereby also improving the fluency of the text output by the model after adjusting the parameters of the first preset neural network model.

[0101] It is understandable that neural network models have made significant progress in text generation research. The advantage of neural network models is that they can learn the semantic mapping from input data to output text end-to-end without the need for human intervention in feature engineering. However, neural network models often have a large number of parameters, and most text generation task datasets are very small.

[0102] In view of this, when training a model for a specific text generation task, this embodiment may first use structured data of multiple types of text generation tasks to pre-train the neural network model. For example, M1 second structured data may be obtained first, wherein the M1 second structured data include at least two types of data: table data, structured data query SQL data, and logical data, and M1 is a positive integer greater than 1. Afterwards, the obtained M1 second structured data are pre-processed to obtain M1 second training data that correspond one-to-one to the M1 second structured data, wherein the second training data corresponding to the jth second structured data in the M1 second training data include: the jth second structured data and the target text corresponding to the jth second structured data; finally, the M1 second training data are used to train the second preset neural network model to obtain the first preset neural network model.

[0103] In other words, in this embodiment, the first preset neural network model is obtained by training the second preset neural network model based on the training data corresponding to various structured data. It can be understood that the first preset neural network model obtained by this implementation is trained based on the training data corresponding to various structured data, and therefore, the obtained first preset neural network model already has a partial ability to generate text from structured data.

[0104] For ease of understanding, the following describes a detailed implementation of a data-to-text generation model training method provided in an embodiment of the present application.

[0105] Figure 6 The present invention provides a method for training a data-to-text generation model in accordance with the implementation method in accordance with an embodiment of the present invention. Figure 6 As shown, the first preset model used includes an encoder and a decoder, wherein the encoder is used to encode the input structured data into a feature vector C, and then C is input into the decoder and the decoder outputs a predicted text based on C. In addition, in this embodiment, the first preset model also includes a text planning module and an optimal transmission module. The text planning module is used to predict the predicted position of each data included in the structured data in the generated text, and determine the third loss value according to the predicted position and ideal position of each data in the generated text, which is recorded as L planning The optimal transmission module is used to calculate the second loss value between the structured data corresponding to the generated text and the input structured data, denoted as L OT It should be understood that the present embodiment also includes a first loss value, wherein the first loss value is the loss value between the predicted text generated by the encoder and the ideal text, denoted as L LM .

[0106] In one implementation, for L OT , which can be equal to and The sum of . Represents the semantic distance between the structured data corresponding to the generated text and all the data in the input structured data. and They respectively represent the semantic distance between the structured data corresponding to the generated text and the columns where column names need to appear and the columns where column names do not need to appear.

[0107] Then, in the specific optimization, the target loss value to be optimized can be recorded as L = L LM +L OT +L planning , and then adjust the parameters in the first preset model based on the target loss value.

[0108] More specifically, for Figure 6In the first preset model shown, since the data received by the encoder in the first preset model is a graph structure, the structured data should also be converted into a graph structure before inputting the structured data into the first preset model. For the description of converting the structured data into a graph structure, reference can be made to the description in the above embodiment of the present application, which will not be repeated here.

[0109] In the above Figure 6 Based on the above, the embodiments of the present application do not limit the specific structures of the encoder and the decoder. For example, the encoder described in this embodiment includes N1 encoder modules. Figure 7 As shown, the encoder is composed of N1 encoder modules. Each encoder module includes a migration encoding block (transformer encoder block), a regularization module after the transformer encoder block, and a graph attention network module after the regularization module. The concepts of the transformer encoder block, the regularization module, and the graph attention network module can be referred to the description in the relevant technology, which will not be repeated here.

[0110] Figure 8 8 is a schematic diagram of a data-to-text generation model training device 800 provided in an embodiment of the present application. Figure 8 As shown, the device 800 includes: an acquisition module 801 and a processing module 802.

[0111] Among them, the acquisition module 801 is used to acquire first training data, and the first training data includes first structured data and a target text corresponding to the first structured data; the acquisition module 801 is also used to acquire the predicted text output by the first preset neural network model after the first structured data is input into the first preset neural network model; the acquisition module 801 is also used to acquire a first loss value between the predicted text and the target text; the acquisition module 801 is also used to acquire a second loss value between the predicted structured data and the first structured data, and the predicted structured data is structured data after the predicted text is converted based on a preset conversion algorithm, and the preset conversion algorithm is used to convert text information into structured data; the processing module 802 is used to determine a target loss value based on the first loss value and the second loss value; the processing module 802 is also used to adjust the parameters of the first preset neural network model according to the target loss value, and the processing module 802 is also used to send the target neural network model to the target device.

[0112] In a possible implementation manner, the target device is a second server.

[0113] In a possible implementation manner, the target device is a terminal device.

[0114] In a possible implementation, the processing module 802 is further used to: receive the first preset neural network model sent by the target device.

[0115] In a possible implementation, the first training data also includes a target order for each data in the first structured data, and the target order is the order in which the text corresponding to each data in the target text is arranged in the target text; accordingly, the acquisition module 801 is also used to: obtain the predicted order of each data in the first structured data output by the first preset neural network model after the first structured data is input into the first preset neural network model, and the predicted order is the order in which the text corresponding to each data in the predicted text is arranged in the predicted text; the processing module 802 is also used to determine a third loss value based on the predicted order and the target order, and to determine a target loss value based on the first loss value, the second loss value and the third loss value.

[0116] In a possible implementation manner, the target loss value is equal to the sum of the first loss value, the second loss value, and the third loss value.

[0117] In a possible implementation, the acquisition module 801 is also used to: acquire M1 second structured data, the M1 second structured data include at least two types of data: table data, structured data query SQL data, logical data, M1 is a positive integer greater than 1; the processing module 802 is also used to: pre-process the M1 second structured data to obtain M1 second training data corresponding one-to-one to the M1 second structured data, the second training data corresponding to the j-th second structured data in the M1 second training data include: the j-th second structured data and the target text corresponding to the j-th second structured data, j is a positive integer and j ranges from 1 to M1; the processing module 802 is also used to: use the M1 second training data to train a second preset neural network model to obtain the first preset neural network model.

[0118] In one possible implementation, the second preset neural network model includes N1 encoders and N2 decoders, the N1 encoders are used to obtain the feature vectors of each structured data in the M1 structured data, and the N2 decoders are used to predict the predicted text corresponding to each structured data based on the feature vector of each structured data, and N1 and N2 are positive integers greater than 1.

[0119] Fig. 91 is a schematic diagram of the structure of a data-to-text generation model training device 900 according to an embodiment of the present application. The device 900 is used to execute the method described above.

[0120] The device 900 includes a processor 910, and the processor 910 is used to execute a computer program or instruction stored in a memory 920, or read data stored in the memory 920, so as to execute the method in each method embodiment above. Optionally, there are one or more processors 910.

[0121] Alternatively, if Fig. 9 As shown, the device 900 also includes a memory 920, which is used to store computer programs or instructions and / or data. The memory 920 can be integrated with the processor 910, or can also be separately set. Optionally, the memory 920 is one or more.

[0122] Alternatively, if Fig. 9 As shown, the device 900 further includes a communication interface 930, which is used to receive and / or send signals. For example, the processor 910 is used to control the communication interface 930 to receive and / or send signals.

[0123] Optionally, the device 900 is used to implement the operations described in each method embodiment above.

[0124] For example, the processor 910 is used to execute the computer program or instructions stored in the memory 920 to implement the relevant operations described in the above various method embodiments. For example, the processor 910 can be used to: obtain first training data, the first training data includes first structured data and a target text corresponding to the first structured data; obtain the predicted text output by the first preset neural network model after the first structured data is input into the first preset neural network model; obtain a first loss value between the predicted text and the target text; obtain a second loss value between the predicted structured data and the first structured data, the predicted structured data is structured data after the predicted text is converted based on a preset conversion algorithm, and the preset conversion algorithm is used to convert text information into structured data; determine a target loss value based on the first loss value and the second loss value; adjust the parameters of the first preset neural network model based on the target loss value; obtain a target neural network model; send the target neural network model to a target device.

[0125] In some examples, the target device is a second server.

[0126] In some examples, the target device is a terminal device.

[0127] In some examples, processor 910 is also used to: receive the first preset neural network model sent by the target device.

[0128] In some examples, processor 910 is also used to: when the first training data also includes a target order for each data in the first structured data, and the target order is the arrangement order of texts corresponding to each data in the target text, obtain a predicted order for each data in the first structured data output by the first preset neural network model after the first structured data is input into the first preset neural network model, and the predicted order is the arrangement order of texts corresponding to each data in the predicted text; determine a third loss value based on the predicted order and the target order; accordingly, determining the target loss value based on the first loss value and the second loss value includes: determining the target loss value based on the first loss value, the second loss value and the third loss value.

[0129] In some examples, the target loss value is equal to the sum of the first loss value, the second loss value, and the third loss value.

[0130] In some examples, the processor 910 is also used to: obtain M1 second structured data, the M1 second structured data including at least two types of data: tabular data, structured data query SQL data, and logical data, where M1 is a positive integer greater than 1; preprocess the M1 second structured data to obtain M1 second training data corresponding one-to-one to the M1 second structured data, the second training data corresponding to the j-th second structured data in the M1 second training data including: the j-th second structured data and the target text corresponding to the j-th second structured data, where j is a positive integer and ranges from 1 to M1; use the M1 second training data to train a second preset neural network model to obtain the first preset neural network model.

[0131] In some examples, the second preset neural network model includes N1 encoders and N2 decoders, the N1 encoders are used to obtain the feature vectors of each structured data in the M1 structured data, and the N2 decoders are used to predict the predicted text corresponding to each structured data based on the feature vector of each structured data, and N1 and N2 are positive integers greater than 1.

[0132] In the embodiment of the present application, the processor is a circuit with the ability to process signals. In one implementation, the processor can be a circuit with the ability to read and run instructions, such as a central processing unit (CPU), a microprocessor, a graphics processing unit (GPU) (which can be understood as a microprocessor), or a digital signal processing (DSP), etc.; in another implementation, the processor can realize certain functions through the logical relationship of the hardware circuit, and the logical relationship of the hardware circuit is fixed or reconfigurable, such as the processor is a hardware circuit implemented by an application specific integrated circuit (ASIC) or a programmable logic device (PLD), such as a field programmable gate array (FPGA). In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the functions of some or all of the above units. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as a neural-network processing unit (NPU), a tensor processing unit (TPU), a data processing unit (DPU), etc.

[0133] It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.

[0134] In addition, all or part of the units in the above device can be integrated together, or can be implemented independently. In one implementation, these units are integrated together and implemented in the form of a system-on-a-chip (SOC). The SOC may include at least one processor for implementing any of the above methods or implementing the functions of each unit of the device. The type of the at least one processor may be different, for example, including a CPU and an FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, etc.

[0135] Accordingly, the embodiment of the present application also provides a computer-readable storage medium storing a computer program, which, when the computer program / instruction is executed by a processor, causes the processor to implement Figure 2 The steps in the method are described.

[0136] Accordingly, the embodiment of the present application also provides a computer-readable storage medium storing a computer program, which, when the computer program / instruction is executed by a processor, causes the processor to implement Figure 2 The steps in the method are described.

[0137] Accordingly, the embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, causes the processor to implement Figure 2 The steps in the method are described.

Claims

1. A method for training a data-to-text generation model, characterized in that: Applied to the first server, comprising: Acquire first training data, where the first training data includes first structured data and a target text corresponding to the first structured data; Obtaining predicted text output by the first preset neural network model after the first structured data is input into the first preset neural network model; Obtaining a first loss value between the predicted text and the target text; Obtaining a second loss value between predicted structured data and the first structured data, wherein the predicted structured data is structured data after the predicted text is converted based on a preset conversion algorithm, and the preset conversion algorithm is used to convert text information into structured data; Determine a target loss value according to the first loss value and the second loss value; Adjusting the parameters of the first preset neural network model according to the target loss value to obtain a target neural network model; The target neural network model is sent to a target device.

2. The method according to claim 1, characterized in that: The target device is a second server.

3. The method according to claim 1, characterized in that The target device is a terminal device.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Receive the first preset neural network model sent by the target device.

5. The method according to claim 4, characterized in that The first training data also includes a target order of each data in the first structured data, where the target order is the order in which texts corresponding to each data in the target text are arranged in the target text; Accordingly, the method further comprises: Obtaining a predicted order of each data in the first structured data output by the first preset neural network model after the first structured data is input into the first preset neural network model, wherein the predicted order is an arrangement order of texts corresponding to each data in the predicted text; Determining a third loss value according to the predicted order and the target order; Accordingly, determining a target loss value according to the first loss value and the second loss value includes: A target loss value is determined according to the first loss value, the second loss value, and the third loss value.

6. The method according to claim 5, characterized in that The target loss value is equal to the sum of the first loss value, the second loss value and the third loss value.

7. The method according to claim 6, characterized in that The method further includes: acquiring M1 second structured data, wherein the M1 second structured data include at least two types of data: table data, structured data query SQL data, and logical data, and M1 is a positive integer greater than 1; Preprocessing the M1 second structured data to obtain M1 second training data corresponding to the M1 second structured data one by one, wherein the second training data corresponding to the j-th second structured data in the M1 second training data includes: the j-th second structured data and the target text corresponding to the j-th second structured data, where j is a positive integer and ranges from 1 to M1; The second preset neural network model is trained using the M1 second training data to obtain the first preset neural network model.

8. The method according to claim 7, characterized in that The second preset neural network model includes N1 encoders and N2 decoders, the N1 encoders are used to obtain the feature vectors of each structured data in the M1 structured data, and the N2 decoders are used to predict the predicted text corresponding to each structured data based on the feature vector of each structured data, and N1 and N2 are positive integers greater than 1.

9. A training device for a data-to-text generation model, characterized in that: include: An acquisition module, configured to acquire first training data, wherein the first training data includes first structured data and a target text corresponding to the first structured data; The acquisition module is further used to acquire the predicted text output by the first preset neural network model after the first structured data is input into the first preset neural network model; The acquisition module is further used to acquire a first loss value between the predicted text and the target text; The acquisition module is further used to acquire a second loss value between the predicted structured data and the first structured data, wherein the predicted structured data is structured data after the predicted text is converted based on a preset conversion algorithm, and the preset conversion algorithm is used to convert text information into structured data; a processing module, configured to determine a target loss value according to the first loss value and the second loss value; The processing module is further used to adjust the parameters of the first preset neural network model according to the target loss value to obtain a target neural network model; The processing module is also used to send the target neural network model to the target device.

10. A training device for data-to-text generation, comprising a processor, the processor being used to call a computer program from a memory, and when the computer program is executed, the processor being used to execute the method according to any one of claims 1 to 8.

11. A computer-readable storage medium for storing a computer program, the computer program comprising codes for executing the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Text generation model training method and device and electronic equipment

    CN111709248A

  • Authenticator-integrated generative adversarial network (GAN) for secure deepfake generation

    US20210319090A1