Data generation method and device and computer program product

By identifying specific information through the first neural network model and utilizing a weighted loss function and fine-tuning techniques, the problem of generating specific information in a large model was solved, and high-quality output data generation was achieved.

CN121835754APending Publication Date: 2026-04-10NTT DOCOMO INC
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NTT DOCOMO INC
Filing Date
2024-10-10
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies suffer from high training costs and reduced quality of generated results when suppressing the generation of specific information by large models. In particular, these issues are difficult to completely resolve through model retraining and rule design, and the generated text after fine-tuning may contain grammatical errors and repetitive sentences.

Method used

A first neural network model is used to identify specific basic units in the input data, and a second neural network model is used to generate output data that does not contain specific information. Weighted loss function and fine-tuning techniques are used to ensure output quality.

Benefits of technology

It effectively suppresses the generation of specific information by large models while maintaining the quality of the generated results, avoiding syntax errors and duplicate statements, and improving the accuracy and reliability of the generated results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121835754A_ABST
    Figure CN121835754A_ABST
Patent Text Reader

Abstract

The invention relates to a data generation method and device and a computer program product. The data generation method includes: for input data including one or more input basic units, using a first neural network model to generate, for each input basic unit, an indicator indicating whether the input basic unit is a specific basic unit including specific information; and generating output data based on the input data and the indicator using a second neural network model, where the output data includes one or more output base units, each output base unit being different from the particular base unit. According to the data generation method disclosed by the invention, the second neural network model can be inhibited from generating the result containing the specific information, and the quality of the result generated by the second neural network model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to a data generation method, device and computer program product, which can be used to suppress a large model from generating data including specific information. BACKGROUND

[0002] In recent years, large model technology has developed rapidly. Based on deep learning and other technologies, large models can generate realistic text, images, audio and other content. However, since training a large model requires using a large amount of data, these training data may include, for example, private, biased or copyright-infringing content, which can result in the large model trained from these data generating results that include such content. Once it is found that the results generated by the large model include such content, the model needs to be quickly suppressed from outputting such content.

[0003] Existing techniques for suppressing a large model from outputting specific content include, for example, retraining the model, pre / post processing, etc. Retraining the model requires deleting or blurring specific data in the training data set and retraining the model, which makes the training cost of the model huge. Pre / post processing of the model suppresses the model from outputting specific content by limiting the prompt words (Prompt) of the model (i.e., pre-processing) or filtering the output of the model (i.e., post-processing), which relies on complex rule design and is also difficult to completely solve the problem of suppressing the model from outputting specific content.

[0004] To address these problems, there are techniques for suppressing the model from outputting specific content based on fine-tuning of the large model, which can reduce the training cost of the model and do not require manual rule design. However, fine-tuning of the large model reduces the quality of the results generated by the large model. For example, a fine-tuned language large model may generate text containing grammatical errors, repetitive statements and other problems. SUMMARY

[0005] The present disclosure is made in view of the above problems. The purpose of the present disclosure is to provide a data generation method, device and computer program product, which suppresses a large model from generating results containing specific information and improves the quality of the results generated by the large model.

[0006] According to one aspect of the present disclosure, a data generation method is provided, which includes: using a first neural network model to generate, for each input basic unit, an indicator indicating whether the input basic unit is a specific basic unit including specific information; and using a second neural network model to generate output data based on the input data and the indicators, wherein the output data includes one or more output basic units, each of which is different from the specific basic unit.

[0007] According to one embodiment of the present disclosure, the first neural network model comprises: a first sub-model generating the indicators for each of the input basic units; and a second sub-model generating output data of the second sub-model based on the one or more input basic units and the indicators of each of the input basic units.

[0008] According to one embodiment of the present disclosure, a loss function used during training of the first neural network model is a weighted sum of a first loss function and a second loss function, the first loss function representing the number of the particular basic units, and the second loss function representing a difference between the output data of the second sub-model and the input data.

[0009] According to one embodiment of the present disclosure, for each input basic unit, the indicator value of 1 indicates that the input basic unit is the particular basic unit, the indicator value of 0 indicates that the input basic unit is not the particular basic unit, and the first loss function is a sum of the indicators of each of the input basic units.

[0010] According to one embodiment of the present disclosure, the second loss function is a vector distance between the output data of the second sub-model and the input data.

[0011] According to one embodiment of the present disclosure, the second neural network model is a pre-trained generative neural network model.

[0012] According to one embodiment of the present disclosure, the second neural network model is fine-tuned such that, at each key time step, a probability of the particular basic unit in a probability distribution used for selecting an output basic unit is minimized, and probabilities of other candidate output basic units different from the particular basic unit in the probability distribution are changed minimally before and after the fine-tuning, the key time step being a time step of generating an output basic unit corresponding to a position of the particular basic unit indicated by the indicator.

[0013] According to one embodiment of the present disclosure, in the fine-tuning, a loss function composed of a weighted sum of a third loss function and a fourth loss function is calculated at the key time step, the third loss function representing a probability that an output basic unit generated at the key time step is the particular basic unit, and the fourth loss function representing a difference between a probability distribution of the other candidate output basic units before the fine-tuning and a probability distribution after the fine-tuning in the key time step.

[0014] According to one embodiment of the present disclosure, the third loss function is a log-likelihood of a probability that the particular basic unit is generated in the key time step.

[0015] According to one embodiment of the present disclosure, the fourth loss function is a KL divergence between a probability distribution of the other candidate output basis units before the fine-tuning and a probability distribution of the other candidate output basis units after the fine-tuning in the key time step.

[0016] According to one embodiment of the present disclosure, the input data is text, and the input basis unit is a wordpiece.

[0017] According to one embodiment of the present disclosure, the input data is an image, and the input basis unit is an image block of the image.

[0018] According to one embodiment of the present disclosure, the input data is audio, and the input basis unit is a frame of the audio.

[0019] According to another aspect of the present disclosure, a data generation apparatus is provided, including a processor, and a memory storing one or more computer programs, when the one or more computer programs are run by the processor, the processor performs the data generation method described above.

[0020] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, when the computer program is run by a processor, the data generation method described above is implemented.

[0021] The method, apparatus, and computer program product provided by the present disclosure can inhibit a large model from generating a result containing specific information, and improve the quality of the result generated by the large model. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 A flowchart of a data generation method according to an embodiment of the present disclosure is shown.

[0023] Figure 2 The structure of a first neural network model according to an embodiment of the present disclosure is schematically shown.

[0024] Figure 3 A schematic diagram of a data generation method according to an embodiment of the present disclosure is shown.

[0025] Figure 4 A schematic diagram of the structure of a data generation apparatus according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0026] Embodiments of the present disclosure will be described below in greater detail with reference to the accompanying drawings. While some embodiments of the present disclosure are illustrated in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be interpreted as being limited to the embodiments set forth herein; rather, these embodiments are provided so that the present disclosure can be more thoroughly and completely understood. It should be understood that the drawings and embodiments of the present disclosure are only for illustrative purposes and are not intended to limit the scope of protection of the present disclosure.

[0027] It should be understood that each step described in the method embodiments of the present disclosure can be performed in different orders and / or in parallel. In addition, the method embodiments can include other steps and / or omit certain steps.

[0028] As used herein, the term "comprising" and variations thereof, are intended to mean "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Related definitions of other terms will be given in the description below.

[0029] It should be understood that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules, units, models, data, etc., and are not intended to limit the order of functions performed by these devices, modules, units, models, data, or the generation order or mutual dependency relationship.

[0030] It should be noted that the modification of "one" or "multiple" mentioned in the present disclosure is illustrative and not limiting, and those skilled in the art should understand that, unless otherwise explicitly indicated in the context, it should be understood as "one or more".

[0031] The results generated by the large model can include privacy, bias, and infringing copyright content, and it is necessary to suppress the large model from outputting such content. In the existing technology for suppressing the large model from outputting specific content, the large model can be fine-tuned so that the loss function is maximized when outputting specific content, forcing the large model not to output such specific content. However, the large model is a generative model that generates results according to a conditional probability distribution, and although fine-tuning and other operations suppress the generation of specific content, they also destroy the probability distribution of other content in the hidden layer, resulting in a decrease in the quality of the results generated by the large model.

[0032] The present disclosure is made in view of the above problems. The idea of the present disclosure is that, for data including information such as private information, biased information, infringing information, etc. (hereinafter referred to as specific information) which is not desired to appear in the output result of a second neural network model (e.g., a pre-trained large model), the input data including the specific information is processed by a first neural network model, the specific basic units in the input data are identified, and the second neural network model is fine-tuned based on the identification result of the first neural network model, so that the output data generated by the second neural network model based on the input data does not include such specific basic units, and the probability distribution of the second neural network model in generating other basic units before and after fine-tuning is kept from being destroyed, thereby guaranteeing the quality of the large model generation result. Here, the basic unit is the smallest unit of data processed by a neural network model, and the input data and the output data of the neural network model are both composed of basic units. For example, for text data, the basic unit can be a token. In addition, the specific basic unit can be a basic unit including specific information, and the input data is considered to include specific information due to the inclusion of the specific basic unit.

[0033] In the following, the processed data of the first neural network model and the second neural network model is taken as an example of text data, but obviously, the data processed by the first neural network model and the second neural network model is not limited to text, but can also process other types of data such as images, audio, etc. In addition, the method of converting data into basic units can adopt any appropriate existing method. In addition, the basic unit processed by the neural network model is actually a vector form of the basic unit, which is a common understanding in the art, and the specific method of converting the basic unit into a vector form is omitted here.

[0034] The data generation method according to the embodiment of the present disclosure is specifically described below. Figure 1 A flowchart of a data generation method 100 according to an embodiment of the present disclosure is shown. The data generation method 100 can include step S110 and step S120. In step S110, for input data including one or more input basic units, a first neural network model is used to generate an indicator for each of the input basic units indicating whether the input basic unit is a specific basic unit including specific information.

[0035] As an example, a sentence "His phone number is 717-823-8477" as text data is taken as input data, the input data is divided into 4 input basic units (i.e., 4 Tokens) of "His", "phone number", "is", "717-823-8477" in advance and enters the first neural network model. Among the 4 input basic units, assuming that "717-823-8477" is a real phone number of a person, if "717-823-8477" is included in the generation result of the large model, it may lead to the leakage of personal privacy, while "His", "phone number", "is" will not lead to the leakage of specific information such as privacy. The first neural network model can automatically identify that "717-823-8477" includes specific information, i.e., automatically identify "717-823-8477" as a specific basic unit, and generate an indicator indicating the specific basic unit, and in addition, generate an indicator indicating that the basic units "His", "phone number", "is" are not specific basic units.

[0036] Here, the input data "His phone number is 717-823-8477" is only an example, and the 4 input basic units divided therefrom are also only simplified examples for ease of explanation, and the input basic units may actually be different from the above examples.

[0037] In step S120, the second neural network model is used to generate output data based on the input data and the indicators, wherein the output data includes one or more output basic units, and each output basic unit is different from the specific basic unit.

[0038] That is, the second neural network model, according to the indicators indicating the specific basic units, suppresses the specific basic units from appearing in the results when generating the results based on the input data. Still taking the input data "His phone number is 717-823-8477" as an example. The second neural network model knows that "717-823-8477" is a specific basic unit according to the indicators generated by the first neural network model, and will not output results including the specific basic unit such as "His phone number is 717-823-8477, please call this phone number to contact him…", but will output results such as "His phone number is 617-923-5437, please call this phone number to contact him…" which do not contain the specific basic unit but still guarantee the quality of the output, where 617-923-5437 is assumed to be a random fake number and not a real phone number.

[0039] Thus, the specific information will not appear in the results generated by the second neural network model, but the second neural network model can still generate realistic results.

[0040] Here, the input data is taken as an example in which the input data includes a plurality of input basic units, and one of the plurality of input basic units is a specific basic unit. However, it is obvious that the data input can also include one input basic unit. In addition, there can be a plurality of specific basic units among the plurality of input basic units.

[0041] The first neural network model 200 and the second neural network model 300 used in the data generation method 100 are described below.

[0042] Figure 2 The structure of the first neural network model 200 according to an embodiment of the present disclosure is schematically shown. As shown in the figure, the first neural network model 200 can be a neural network model trained in a self-supervised manner, including: a first sub-model 210 for generating an indicator indicating whether each input basic unit is a specific basic unit; and a second sub-model 220 for generating output data of the second sub-model 220 based on one or more input basic units and the indicator of each input basic unit. Figure 2

[0043] The first sub-model 210 and the second sub-model 220 can be neural network models constituting self-supervised learning. In an implementation, the first sub-model 210 and the second sub-model 220 can be Transformer models respectively, but the implementation of the first sub-model 210 and the second sub-model 220 is obviously not limited to this, and other suitable autoregressive models can also be used.

[0044] Specifically, one or more input basic units of the input data are input into the first sub-model 210. The first sub-model 210 determines whether each input basic unit is a specific basic unit, and generates an indicator indicating the specific basic unit for the specific basic unit, and indicates a different indicator for the input basic unit that is not a specific basic unit. The second sub-model 220 can reconstruct the input data according to the specific basic unit determined by the first sub-model 210.

[0045] In an implementation, the indicator indicating the specific basic unit can be "1", and the indicator indicating the input basic unit that is not a specific basic unit can be "0". In this case, the indicator can be regarded as a mask of the input basic unit and used to reconstruct the input data in the second sub-model 220. More specifically, each input basic unit (in vector form) can be multiplied by the corresponding indicator, and the multiplied input basic units can be input into the second sub-model 220.

[0046] The indicators corresponding to each input basic unit of the input data are also used for subsequent processing of the second neural network model, which will be described later.

[0047] As an example, in the case of the input data including a plurality of input basic units, and one of the plurality of input basic units being a specific basic unit, the input data can be input into the first sub-model 210, and the first sub-model 210 can determine whether each input basic unit is a specific basic unit, and generate an indicator indicating the specific basic unit for the specific basic unit, and indicate a different indicator for the input basic unit that is not a specific basic unit. Figure 2 ​In the input data, "His phone number is 717-823-8477" is used as the input data. Among the four basic units of this input data, "his", "phone number", "is", and "717-823-8477", the first sub-model 210 determines that "717-823-8477" is a specific basic unit and generates a corresponding indicator (in Figure 2 (where "1" represents the value in the middle), and for "his", "phone number", and "is", which are not specific basic units, different indicators are generated than those for specific basic units (in...). Figure 2 (where "0" represents the base value). In this case, "his", "phone number", and "is", which are not specific basic units, are multiplied by "0" to form a vector of zeros. Figure 2 The second sub-model 220 does not reconstruct the input data based on them, but instead reconstructs (or restores) "his phone number is 717-823-8477" based on "717-823-8477".

[0048] Here, if the first sub-model 210 identifies too many specific basic units, these units will be suppressed from appearing in the generated results of the second neural network model 300, thus affecting the quality of the generated results. Conversely, if the first sub-model 210 identifies too few specific basic units, it may miss specific basic units in the input data, causing the second sub-model 220 to be unable to accurately reconstruct the input data. Furthermore, the generated results of the subsequent second neural network model 300 may still contain specific information that is considered to be private, biased, or infringing.

[0049] In one embodiment, the loss function used in training the first neural network model 200 can be a weighted sum of a first loss function and a second loss function, wherein the first loss function represents the number of specific basic units and the second loss function represents the difference between the output data and the input data of the second sub-model 220.

[0050] Specifically, for each input basic unit, an indicator value of "1" can be used to indicate that an input basic unit is a specific basic unit, and an indicator value of "0" can be used to indicate that an input basic unit is not a specific basic unit. The first loss function described above can then be the sum of the indicator values ​​for each input basic unit.

[0051] More specifically, the first loss function can be expressed as equation (1):

[0052]

[0053] wherein L1 represents the first loss function, i represents the serial number of the current input basic unit, j represents the number of all input basic units in the input data, M i,j represents the value of the indicator of the i-th input basic unit.

[0054] Thus, if the number of specific basic units judged by the first sub-model 210 is large, the value of the loss function L1 becomes large, and through such a first loss function L1, the number of specific basic units can be supervised so that the judged specific basic units are more accurate.

[0055] In addition, the second loss function described above can be the vector distance between the data output by the second sub-model 220 and the input data. Here, the data output by the second sub-model 220 according to the specific basic units is of course also composed of basic units, so the difference between the data output by the second sub-model 220 and the original input data can be measured by the vector distance. The vector distance here can be the Euclidean distance, Manhattan distance, Hamming distance, etc., but is not limited thereto.

[0056] In one implementation, the second loss function can be represented as the following formula (2):

[0057]

[0058] wherein L2 represents the second loss function, X represents the input data, represents the data output by the second sub-model 220.

[0059] Through such a loss function L2, the comprehensiveness of the specific basic units judged by the first sub-model 210 can be supervised. That is, if the first sub-model 210 misses specific basic units, the second sub-model 220 is difficult to reconstruct the input data, at this time the vector distance between the output result and the input data is large, that is, the value of L2 becomes large.

[0060] On this basis, the overall loss function used in the training of the first neural network model 200 can be represented as the following formula (3):

[0061] L M1 = w1*L1 + w2*L2 (3)

[0062] wherein L M1 represents the overall loss function used in the training of the first neural network model 200, w1 and w2 are the weights of the first loss function L1 and the second loss function L2, respectively, and these weights are used to adjust the proportional relationship of the first loss function L1 and the second loss function L2, and can be manually set before training.

[0063] By constructing such a loss function L M1and optimized in the training, so that the first neural network model 200 after the training can balance the accuracy and comprehensiveness of the identified specific basic unit. In addition, since the first neural network model 200 can determine whether to include specific information in the input basic unit, which is a more granular unit than the input data, the generation quality of the second neural network model 300 is less affected compared to the existing method of suppressing specific information output by the large model.

[0064] Of course, the first loss function L1, the second loss function L2, and the loss function L M1 Only one example, as long as the first neural network model 200 can balance the accuracy and comprehensiveness of the specific basic unit, any suitable loss function can be used. For example, the second loss function L2 described above is not limited to the vector distance between the output data of the second sub-model 220 and the input data represented by formula (2). The second loss function can be based on other indicators that measure the difference between the output data of the second sub-model 220 and the input data, such as log likelihood, mean square error (MSE), root mean square error (RMSE), correlation coefficient, etc. In addition, the loss function L M1 Also not limited to the formula (3) described above, for example, a regularization term or the like for controlling the complexity of the first neural network model 200 can also be added based on formula (3).

[0065] In addition, the indicator generated by the first neural network model 200 for each input basic unit is not limited to 1 and 0, nor is it limited to a numerical value. As long as the specific basic unit can be clearly distinguished, various suitable indicators can be used. For example, the first neural network model 200 can also generate an indicator in the form of a certain character or string for the specific basic unit in the input basic unit, and generate an indicator in the form of another character or string for the non-specific basic unit. In this case, the second sub-model 220 can only input the input basic unit indicated by the indicator representing the specific basic unit. And the first loss function L1 described above can only count the indicators indicating the specific basic unit.

[0066] Figure 3 A schematic diagram of a data generation method according to an embodiment of the present disclosure is shown. As Figure 3As shown, the first neural network model 200 generates an indicator for each input basic unit in the input data based on the input data. The second neural network model 300 is fine-tuned based on the input data and the indicators generated by the first neural network model 200, such that the second neural network model 300 generates output data that does not include the specific basic unit based on the input data and the indicators. The second neural network model 300 is described below.

[0067] In one embodiment, the second neural network model 300 can be a pre-trained generative neural network model. For example, the second neural network 300 can be a language large model, a multi-modal large model, etc. Such a large model can be pre-trained and fine-tuned to adapt the large model to a new task with relatively less training. Also, the second neural network model 300 can be a generative model that can capture the probability distribution of the training data in a hidden space and determine the output based on conditional probability when generating data. In addition, when generating sequence data such as text, image, speech, etc., the second neural network model 300 can generate one output basic unit at each time step, and the output basic unit to be generated at each time step can be determined based on the conditional probability conditioned on the output basic units generated at the previous time steps. For example, assuming that there are 5000 different possibilities of the output basic units that the large model can generate at time step t (i.e., there are 5000 candidate output basic units at time step t), each of the 5000 different candidate output basic units corresponds to a conditional probability, forming a probability distribution at time step t, under the condition that the output basic units x1, x2, x t-1 In one implementation, the second neural network model 300 selects the candidate output basic unit with the maximum probability in the probability distribution as the output basic unit at time step t. The method of generating the output basic unit at time step t by the second neural network model 300 described above is well known, and here is only an example, and the second neural network model 300 can also determine the output basic unit at time step t by using any appropriate method.

[0068] In one embodiment, the second neural network model 300 is fine-tuned such that at each key time step, the probability of the specific basic unit in the probability distribution used to select the output basic unit is minimized, and the probabilities of other candidate output basic units different from the specific basic unit in the probability distribution are changed minimally before and after fine-tuning.

[0069] Here, the key time step can be a time step of generating an output basic unit corresponding to a position of a particular basic unit indicated by the indicator. Specifically, the key time step can be determined by the indicator generated by the first neural network model 200 for each input basic unit. In each time step in which the second neural network model 300 generates an output basic unit according to each input basic unit of the input data, the order (position) of the key time step in all time steps corresponds to the position of the indicator indicating the particular basic unit in the indicators generated by the first neural network model 200 for each input basic unit of the input data. As described above, one or more particular basic units can be included in the input data, and therefore, the key time step can also be one or more.

[0070] For example, it is assumed that the first neural network model 200 generates an indicator M = [0, 0, 0, 1] for input data including four input basic units "his", "phone number", "is", and "717-823-8477", in which "717-823-8477" is a particular basic unit. In this case, the second neural network model 300 can determine that the fourth input basic unit is a particular basic unit according to the indicator, and set the fourth time step as a key time step in a plurality of time steps in which an output basic unit is generated according to the input data, and perform the fine-tuning described above to minimize the probability of the particular basic unit in the probability distribution for selecting an output basic unit at the fourth time step. i,4 i,4 For example, it is assumed that the first neural network model 200 generates an indicator M = [0, 0, 0, 1] for input data including four input basic units "his", "phone number", "is", and "717-823-8477", in which "717-823-8477" is a particular basic unit. In this case, the second neural network model 300 can determine that the fourth input basic unit is a particular basic unit according to the indicator, and set the fourth time step as a key time step in a plurality of time steps in which an output basic unit is generated according to the input data, and perform the fine-tuning described above to minimize the probability of the particular basic unit in the probability distribution for selecting an output basic unit at the fourth time step.

[0071] By minimizing the probability of the particular basic unit in the probability distribution for selecting an output basic unit at each key time step, the second neural network model 300 can be inhibited from outputting the particular basic unit at the key time step. However, at the same time, since changing the probability of the particular basic unit also changes the probabilities of other candidate output basic units in the probability distribution, the subsequent generation process of the large model is affected, resulting in problems such as grammatical errors, disordered syntax, and quality degradation in the output of the large model. Therefore, by minimizing the change in the probability of other candidate output basic units in the probability distribution before and after the fine-tuning of the particular basic unit, the quality of the results generated by the second neural network model 300 can be ensured.

[0072] Therefore, in the fine-tuning of the second neural network model 300 according to the embodiments of the present disclosure, the probability of the particular basic unit in the probability distribution at the key time step is minimized, and the change in the probability of other candidate output basic units in the probability distribution before and after the fine-tuning of the probability of the particular basic unit is also minimized.

[0073] That is, in one embodiment, in fine-tuning, a loss function composed of a weighted sum of a third loss function and a fourth loss function at the key time steps is calculated, the third loss function representing a probability that the output base cell generated at the key time step is the specific base cell, and the fourth loss function representing a difference between a probability distribution of other candidate output base cells before fine-tuning and a probability distribution after fine-tuning at the key time step.

[0074] Thus, the large model can be inhibited from outputting the specific base cell at the key time step, and the quality of the generation result of the large model can be ensured.

[0075] Specifically, in one embodiment, the third loss function can be a log-likelihood of a probability that the specific base cell is generated at the key time step. For example, the third loss function can be represented as the following formula (4):

[0076]

[0077] where L3 represents the third loss function, θ represents the parameters of the second neural network model, t represents the key time step, S represents a set of key time steps, x represents the output base cell, P θ (x t |x1,…,x t-1 ) represents the output base cell x t generated by the second neural network model at the time step t.

[0078] Thus, by optimizing the third loss function in the training process, the probability that the generated output base cell is the specific base cell can be minimized, so as to inhibit the second neural network model 300 from outputting the specific base cell.

[0079] In addition, in one embodiment, the fourth loss function is a Kullback-Leibler Divergence between the probability distribution of the other candidate output base cells before fine-tuning and the probability distribution of the other candidate output base cells after fine-tuning at the key time step. The Kullback-Leibler Divergence is a measure of the difference between two probability distributions. Illustratively, the fourth loss function can be represented as the following formula (5):

[0080]

[0081] where L4 represents the fourth loss function, θ represents the parameters of the second neural network model, t represents the key time step, D KL () represents the calculation of the Kullback-Leibler Divergence. x t 1 ,…,x t n represent different output base cells from the specific base cell xt * The other candidate output basic units, where n is the number of other candidate output basic units at time step t. Mask(x) t * ) represents a specific basic unit x in the mask probability distribution. t * The probability, This means minimizing a specific basic unit x. t * Before the probability (i.e., before fine-tuning), masking a specific basic unit x. t * The probability (in other words, without considering a specific basic unit x) t * The probability of the output is determined by other candidate output basic units x. t 1 ,…,x t n The probability distribution formed by the probabilities of , This means minimizing a specific basic unit x. t * After determining the probability (i.e., after fine-tuning), the specific basic unit x is masked. t * The probability of other candidate output basic units x is determined by the probability of x. t 1 ,…,x t n The probability distribution formed by the probabilities of other candidate output basic units. Here, "the probability distribution of other candidate output basic units" is the same as "the probability distribution formed by the probabilities of other candidate output basic units".

[0082] Therefore, by optimizing the fourth loss function L4 during training, the probability distribution formed by the probabilities of other candidate output basic units in the corresponding time step can be minimized before and after the probability of a specific basic unit is minimized. This minimizes the impact on the second neural network model 300 when selecting the output basic unit of the current time step and the output basic unit of subsequent time steps based on the probability distribution, thereby ensuring the generation quality of the second neural network model 300.

[0083] Based on this, the overall loss function used in the training (fine-tuning) of the second neural network model 300 can be expressed as the following equation (6):

[0084] L M2 = w 3* L3+ w 4* L4 (6)

[0085] Among them, L M2The loss function L used in the training of the second neural network model 300, w3 and w4 are the weights of the third loss function L3 and the fourth loss function L4, respectively, which are used to adjust the proportional relationship of the third loss function L3 and the fourth loss function L4, and can be manually set before training.

[0086] Thus, by constructing such a loss function L M2 and optimizing the loss function in training, the output of the second neural network model 300 can be inhibited, and the quality of the generated results can be ensured.

[0087] Of course, the third loss function L3, the fourth loss function L4, and the loss function L M2 is only an example, and any suitable loss function can be used as long as it can achieve the second neural network 300 model to balance the inhibition of the output of the specific basic unit and the quality of the generated results. The third loss function L3 can also not use the log likelihood of the probability of generating a specific basic unit, for example, it can simply use 1-the probability of generating a specific basic unit as the third loss function L3. In addition, the fourth loss function L4 is not limited to using the KL divergence, for example, it can also be based on cross-entropy, JS divergence, etc. The loss function L M2 used in the fine-tuning of the second neural network model 300 is also not limited to the above formula (6), for example, it can also add a regularization term for controlling the complexity of the second neural network model 300, etc. on the basis of formula (6).

[0088] Continue to use the specific example in the above description to explain the fine-tuning of the second neural network model in detail. For the four input basic units "his", "phone number", "is", "717-823-8477" included in the input data, the second neural network model 300 received the indicator M i,4= [0, 0, 0, 1]. Since time steps t1-t3 are not key time steps, the second neural network model 300 does not perform fine-tuning and generates output basic units "his", "phone number", and "is" at t1-t3, respectively. Time step t4 is a key time step, and thus the second neural network model 300 fine-tunes the probability of the specific basic unit "717-823-8477" in the probability distribution of time step t4. That is, assuming that the candidate output basic units of time step t4 are "717-823-8477", "617-923-5437", "Zhang San", and "A city" and the corresponding probability distribution is {0.4, 0.3, 0.25, 0.05}, in the fine-tuning, the probability 0.4 of the specific basic unit "717-823-8477" is minimized, and the probabilities {0.3, 0.25, 0.05} of "617-923-5437", "Zhang San", and "A city" in the probability distribution are changed as little as possible before and after the fine-tuning. For example, the probability distribution after the fine-tuning can become {0.5, 0.3, 0.19, 0.01}, in which the probabilities are those of "617-923-5437", "Zhang San", "A city", and "717-823-8477", respectively. At this time, if the second neural network model 300 is to select the candidate output basic unit with the largest probability in the probability distribution, it can generate "617-923-5437" to replace the specific basic unit "717-823-8477" at the key time step t4. Thereafter, the second neural network model 300 can continue to generate output basic units at subsequent time steps t5 and later based on the output basic unit "617-923-5437" generated after the fine-tuning of the key time step t4. Thus, the second neural network model 300 is inhibited from generating a result including the specific basic unit, and the privacy of the real phone number "717-823-8477" is avoided from being leaked.

[0089] In the above description, the data processed by the first neural network model 200 and the second neural network model 300 are all texts as examples, but as described above, the data processed by the first neural network model 200 and the second neural network model 300 are not limited to texts, and other types of data such as images and audio can also be processed.

[0090] For example, the following case can be envisaged. The second neural network model 300 is a model capable of receiving a prompt word to output an image. When it is found that the image generated by the second neural network model 300 includes infringing content, the image can be segmented into image patches, the first neural network model 200 is used to generate specific information indicating which image patch or image patches in the image include infringing content, and when the second neural network model 300 receives the same prompt word again, the generated image no longer includes the image patch including the specific information of infringing content. At this time, the input data of the first neural network model 200 and the second neural network model 300 can both be images (the second neural network model 300 additionally needs to receive a prompt word), and the basic unit in the above embodiment can be an image patch, which is the smallest unit of image data processed by the neural network model.

[0091] For example, the following case can be envisaged. The second neural network model 300 is a model capable of receiving a prompt word to output an image. When it is found that the image generated by the second neural network model 300 includes infringing content, the image can be segmented into image patches, the first neural network model 200 is used to generate specific information indicating which image patch or image patches in the image include infringing content, and when the second neural network model 300 receives the same prompt word again, the generated image no longer includes the image patch including the specific information of infringing content. At this time, the input data of the first neural network model 200 and the second neural network model 300 can both be images (the second neural network model 300 additionally needs to receive a prompt word), and the basic unit in the above embodiment can be an image patch, which is the smallest unit of image data processed by the neural network model.

[0092] The above processing of multi-modal data can be realized by existing technologies. Such technologies can convert the basic unit of input data into latent features, so that the model is not limited by the type of input data. That is, a module for type conversion processing of input data of different data types, such as converting image patches of an image or frames of audio into word pieces of text, can be added to the first neural network model 200 and the second neural network model 300.

[0093] The data generation method according to the embodiment of the present disclosure is described in detail above.

[0094] According to one aspect of the present disclosure, a data generation apparatus 400 is also provided. Figure 4 is a schematic diagram showing the structure of the data generation apparatus 400 according to the embodiment of the present disclosure.

[0095] As shown in Figure 4 the data generation apparatus 400 of the present embodiment includes a processor 410 and a memory 420. The memory 420 stores one or more computer programs.

[0096] The processor 410 is a program control device such as a microprocessor, for example, which operates in accordance with a program installed in the memory 420. The memory 420 is, for example, a storage element such as a ROM or a RAM, and the like. The program to be executed by the processor 410 or the like is stored in the memory 420. Figure 4 The illustrated data generation apparatus 400 can be used to implement the data generation method according to the embodiments of the present disclosure.

[0097] According to one aspect of the present disclosure, there is also provided a computer program product comprising a computer program which, when executed by a processor, can implement the data generation method according to the embodiments of the present disclosure.

[0098] The overall or parts of the hardware computing apparatus described in the present disclosure can be implemented by various suitable hardware means, including but not limited to FPGA, ASIC, SoC, discrete gate or transistor logic, discrete hardware components, or any combination thereof. The apparatuses, devices, methods, systems involved in the present disclosure are not limited to any particular hardware architecture or configuration. The components in the disclosed apparatuses, devices, systems can be separate or integrated, can be combined in different ways and / or replaced or supplemented by other components. It should be understood that the teachings of the present disclosure can be implemented in various forms of hardware, software, firmware, special purpose processors, or combinations thereof.

[0099] The block diagrams of the apparatuses, devices, methods, systems, etc. involved in the present disclosure are only exemplary and are not intended to require or imply that the connection, arrangement, configuration must be as shown in the block diagrams. As those skilled in the art will recognize, these circuits, devices, apparatuses, systems can be connected, arranged, configured in any way as long as the desired purpose can be achieved.

[0100] In the above description, the present application has been described based on embodiments. The present embodiments are merely illustrative, and those skilled in the art should understand that the combination of constituent elements and processes of the present embodiments can be modified in various ways, and such modifications are also within the scope of the present application.

Claims

1. A data generation method, comprising: generating, for input data comprising one or more input basic units, an indicator for each of the input basic units indicating whether the input basic unit is a particular basic unit comprising a particular information, using a first neural network model; and generating output data based on the input data and the indicators, using a second neural network model, wherein the output data comprises one or more output basic units, each of which is different from the particular basic unit.

2. The data generation method of claim 1, wherein the first neural network model comprises: a first sub-model generating the indicators for each of the input basic units; and a second sub-model generating output data of the second sub-model based on the one or more input basic units and the indicators for each of the input basic units.

3. The data generation method of claim 2, wherein a loss function used during training of the first neural network model is a weighted sum of a first loss function and a second loss function, the first loss function represents a number of the particular basic units, the second loss function represents a difference between the output data of the second sub-model and the input data.

4. The data generation method of claim 3, wherein for each of the input basic units, a value of the indicator being 1 indicates that the input basic unit is the particular basic unit, and a value of the indicator being 0 indicates that the input basic unit is not the particular basic unit, the first loss function is a sum of the indicators for each of the input basic units.

5. The data generation method of claim 3, wherein the second loss function is a vector distance between the output data of the second sub-model and the input data.

6. The data generation method of claim 1, wherein the second neural network model is a pre-trained generative neural network model.

7. The data generation method of claim 6, wherein the second neural network model is fine-tuned such that, at each key time step, in a probability distribution for selecting an output basic unit, a probability of the particular basic unit is minimized, and probabilities of other candidate output basic units different from the particular basic unit in the probability distribution are minimized in changes before and after the fine-tuning, the key time step is a time step at which an output basic unit corresponding to a position of the particular basic unit indicated by the indicators is generated.

8. The data generation method of claim 7, wherein in the fine-tuning, a loss function is calculated as a weighted sum of a third loss function and a fourth loss function at the key time step, the third loss function represents a probability that an output basic unit generated at the key time step is the particular basic unit, the fourth loss function represents a difference between a probability distribution of the other candidate output basic units before the fine-tuning and a probability distribution after the fine-tuning in the key time step.

9. The data generation method of claim 8, wherein ​ the third loss function is a log-likelihood of a probability of generating the particular basic unit in each key time step. 10.The data generation method of claim 8, wherein, the fourth loss function is a KL divergence between a probability distribution of the other candidate output basic unit before the fine-tuning and a probability distribution of the other candidate output basic unit after the fine-tuning in the key time step. 11.The data generation method of any one of claims 1-10, wherein, the input data is text, and the input basic unit is a token. 12.The data generation method of any one of claims 1-10, wherein, the input data is an image, and the input basic unit is an image patch of the image. 13.The data generation method of any one of claims 1-10, wherein, the input data is audio, and the input basic unit is a frame of the audio. 14.A data generation apparatus comprising: a processor, and a memory storing one or more computer programs, when the one or more computer programs are run by the processor, the processor performs the data generation method of any one of claims 1-13. 15.A computer program product comprising a computer program which, when run by a processor, implements the data generation method of any one of claims 1-13.