Large language model training method, device, medium, and equipment for privacy protection

By performing reinforced gradient processing on the training data of the large language model, the problems of privacy data leakage and reduced model understanding ability in the existing technology are solved, and high-security and high-accuracy output results are achieved.

CN118095359BActive Publication Date: 2024-10-15ANT GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410506249.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-25
Publication Date
2024-10-15
Estimated Expiration
2044-04-25

AI Technical Summary

Technical Problem

Existing large language model privacy data protection solutions cannot effectively prevent attackers from restoring the original private data through gradients, and filtering or deleting private data will reduce the model's understanding ability and output accuracy.

Method used

By obtaining the original gradient of the training data, performing reinforcement conversion to generate the reinforcement gradient, and updating the model weight of the large language model, the target gradient reinforcement network and the target gradient reduction network are used for deep learning training to ensure that the difference between the reinforcement gradient and the original gradient is small but the attack The user cannot restore private data.

Benefits of technology

It improves the security of private data in large language models, maintains the model's understanding ability and output accuracy, and prevents attackers from restoring the original data through reinforced gradients.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118095359B_ABST
    Figure CN118095359B_ABST
Patent Text Reader

Abstract

The embodiments of this specification disclose a large language model training method and apparatus, medium, and equipment for privacy protection, and relate to the field of artificial intelligence technology. First, by obtaining training data and inputting the training data into the large language model to be trained to determine the original gradient corresponding to the training data, the original gradient is then reinforced and converted to obtain a reinforced gradient, and then the model weights corresponding to the large language model to be trained can be updated through the reinforced gradient to obtain a trained large language model. The technical solution in the embodiments of this specification can ensure that the trained large language model does not lose its ability to understand privacy data, improve the accuracy of the output results of the large language model, and effectively reduce the possibility of attackers restoring the original data through the gradient of the large language model, thereby improving the security of privacy data in the large language model.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the rapid development of science and technology, large language models (LLMs) have attracted more and more attention. Large language models are deep learning models trained based on massive text data. They can generate natural language text or understand the meaning of language text. Such models can perform a variety of natural language processing (NLP) tasks, including but not limited to text classification, question-answering, and dialogue. Large language models are trained based on massive text data and have a strong memory for training data. Once the training data contains private data, such as personal identifiable information (PII) such as email addresses and mobile phone numbers, attackers have a certain probability of restoring some private data from the answers of the large language model through question-answering interactions with the large language model.

[0003] At present, the relevant large language model privacy data protection schemes either detect the request or response content of the large language model, filter or block the requests and responses containing private data; or directly delete or desensitize the private data in the training data. However, by filtering or blocking the requests and responses containing private data, it is easy to bypass the filtering or blocking measures. For example, attackers may restore private data from the gradient of the large language model, which cannot effectively solve the problem of privacy information leakage of the open source large language model; deleting or desensitizing the private data in the training data can solve the problem of privacy information leakage of the large language model, but it may lead to the inability to identify private data such as personal identification information, the inability to understand private data, and reduce the understanding ability of the large language model, resulting in low accuracy of the output results of the large language model.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of this specification, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention

[0005] The embodiments of this specification provide a large language model training method for privacy protection, a large language model training device for privacy protection, a storage medium and an electronic device, the purpose of which is to ensure that the large language model's ability to understand private data is not lost, improve the accuracy of the output results of the large language model, and effectively reduce the possibility of attackers restoring the original data through the gradient of the large language model, thereby improving the security of private data in the large language model.

[0006] According to a first aspect of an embodiment of this specification, a large language model training method for privacy protection is provided, including:

[0007] Get training data;

[0008] Inputting the training data into a large language model to be trained to determine an original gradient corresponding to the training data;

[0009] Performing reinforcement transformation on the original gradient to obtain a reinforcement gradient;

[0010] The model weights corresponding to the large language model to be trained are updated using the reinforcement gradient to obtain a trained large language model.

[0011] Furthermore, in some embodiments, the performing reinforcement conversion on the original gradient to obtain the reinforced gradient includes:

[0012] The original gradient is input into the trained target gradient reinforcement network, so as to perform reinforcement conversion on the original gradient through the target gradient reinforcement network to obtain the reinforced gradient.

[0013] Furthermore, in some embodiments, the method further comprises:

[0014] Constructing gradient sample data according to the training data and the original gradient corresponding to the training data;

[0015] Performing deep learning training on a pre-constructed initial gradient restoration network through the gradient sample data to obtain a trained target gradient restoration network, wherein the target gradient restoration network is used to simulate a process of restoring the training data through the original gradient;

[0016] A connection training network is constructed by using a pre-constructed initial gradient reinforcement network and the target gradient restoration network, and deep learning training is performed on the connection training network using the gradient sample data to complete the deep learning training of the initial gradient reinforcement network and obtain a trained target gradient reinforcement network.

[0017] Further, in some embodiments, the connection training network is constructed by using the output data of the initial gradient reinforcement network as the input data of the target gradient restoration network;

[0018] The method constructs a connection training network by using the pre-constructed initial gradient reinforcement network and the target gradient restoration network, and performs deep learning training on the connection training network through the gradient sample data to complete the deep learning training of the initial gradient reinforcement network and obtain a trained target gradient reinforcement network, including:

[0019] Fixing the network weights of the target gradient restoration network;

[0020] Using the original gradient as input data of the connection training network, using the training data as label data of the connection training network, and performing deep learning training on the connection training network to adjust and update the network weights of the initial gradient reinforcement network;

[0021] After determining that the initial gradient reinforcement network reaches the network training target, a trained target gradient reinforcement network is obtained.

[0022] Further, in some implementations, using the original gradient as input data of the connection training network, using the training data as label data of the connection training network, and performing deep learning training on the connection training network to adjust and update the network weights of the initial gradient reinforcement network includes:

[0023] Inputting the original gradient into the initial gradient reinforcement network to obtain an intermediate reinforcement gradient after reinforcement conversion by the initial gradient reinforcement network;

[0024] Inputting the intermediate reinforcement gradient into the target gradient restoration network to obtain the reconstructed data after the intermediate reinforcement gradient is restored;

[0025] Adjusting and updating the network weights of the initial gradient reinforcement network based on the target loss function of the connection training network;

[0026] The objective loss function includes a first loss function and a second loss function, wherein the first loss function is used to measure the original gradient and the intermediate reinforcement gradient to minimize the difference between the original gradient and the intermediate reinforcement gradient, and the second loss function is used to measure the training data and the reconstructed data to maximize the difference between the training data and the reconstructed data.

[0027] Further, in some embodiments, after determining that the initial gradient reinforcement network reaches the network training target, obtaining a trained target gradient reinforcement network includes:

[0028] If it is detected that the target loss function of the connection training network converges, or the number of rounds of network training reaches a preset threshold, it is determined that the initial gradient reinforcement network completes the network training and obtains a trained target gradient reinforcement network.

[0029] Further, in some embodiments, the pre-constructed initial gradient restoration network is subjected to deep learning training using the gradient sample data to obtain a trained target gradient restoration network, including:

[0030] Inputting the original gradient in the gradient sample data into the initial gradient restoration network to obtain reconstructed data, wherein the initial gradient restoration network includes a third loss function, and the third loss function is used to weigh the training data and the reconstructed data to minimize the difference between the training data and the reconstructed data;

[0031] If it is detected that the third loss function of the initial gradient restoration network converges, or the number of rounds of network training reaches a preset threshold, it is determined that the initial gradient restoration network completes network training and obtains a trained target gradient restoration network.

[0032] Furthermore, in some embodiments, the target gradient reinforcement network and the target gradient restoration network are self-encoding and decoding networks, and the input size and output size of the self-encoding and decoding networks are consistent with the size of the training data or the original gradient.

[0033] Further, in some embodiments, the large language model to be trained includes a model loss function; and the step of inputting the training data into the large language model to be trained to determine an original gradient corresponding to the training data includes:

[0034] Inputting the training data into a large language model to be trained to obtain output data, and determining an error gradient through the model loss function, the training data and the output data;

[0035] The original gradient corresponding to the training data is determined by performing back propagation calculation on the error gradient and the weight parameters of each network layer in the large language model to be trained.

[0036] Further, in some implementations, updating the model weights corresponding to the large language model to be trained by using the reinforcement gradient to obtain the trained large language model includes:

[0037] Obtaining a learning rate of the large language model to be trained;

[0038] Determining a parameter update step size of the large language model to be trained according to the learning rate and the reinforcement gradient;

[0039] The updated model weight is determined by the current model weight of the large language model to be trained and the parameter update step size, thereby completing the updating of the model weight corresponding to the large language model to be trained.

[0040] Furthermore, in some embodiments, the performing reinforcement conversion on the original gradient to obtain the reinforced gradient includes:

[0041] Determining privacy budget parameters and sensitivity of the large language model to be trained;

[0042] Determine random noise using the privacy budget parameter and the sensitivity;

[0043] The reinforcement gradient is determined according to the original gradient and the random noise.

[0044] According to a second aspect of the embodiments of this specification, a large language model training device for privacy protection is also provided, including:

[0045] A training data acquisition module, used to acquire training data;

[0046] An original gradient determination module, used for inputting the training data into a large language model to be trained to determine an original gradient corresponding to the training data;

[0047] An original gradient reinforcement module, used for performing reinforcement conversion on the original gradient to obtain a reinforcement gradient;

[0048] The large language model training module is used to update the model weights corresponding to the large language model to be trained through the reinforcement gradient to obtain a trained large language model.

[0049] According to a third aspect of the embodiments of this specification, a storage medium is provided, wherein the storage medium stores a computer program, wherein the computer program is suitable for being loaded by a processor and executing the method steps in the first aspect.

[0050] According to a fourth aspect of the embodiments of this specification, an electronic device is provided, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps in the first aspect.

[0051] In the embodiment of the present specification, the training data is obtained and input into the large language model to be trained to determine the original gradient corresponding to the training data, and then the original gradient is reinforced and converted to obtain the reinforced gradient, and then the model weight corresponding to the large language model to be trained can be updated through the reinforced gradient to obtain the trained large language model. On the one hand, by reinforcing the original gradient to obtain the reinforced gradient, and then updating the large language model corresponding to the model weight of the large language model to be trained through the reinforced gradient, during use, the attacker cannot restore the original private data through the reinforced gradient in the large language model, thereby effectively reducing the possibility of the attacker restoring the original data through the gradient of the large language model, and improving the security of the private data in the large language model; on the other hand, the reinforced gradient obtained by reinforcing the original gradient has a small difference between the reinforced gradient and the original gradient, so that while ensuring that the attacker cannot restore the private data through the reinforced gradient, the reinforced gradient does not affect the understanding ability of the large language model, and ensures the accuracy of the output result of the large language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the specification, and together with the specification are used to explain the principles of the specification. Obviously, the accompanying drawings described below are only some embodiments of the specification, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0053] Figure 1 A schematic diagram of the system architecture of an exemplary application environment of a large language model training method and apparatus for privacy protection, to which the embodiments of the present disclosure can be applied, is shown.

[0054] Figure 2 A schematic diagram schematically shows a flow chart of a large language model training method for privacy protection in some embodiments of this specification;

[0055] Figure 3 A schematic diagram schematically shows a flow chart of a training process of a target gradient reinforcement network in some embodiments of this specification;

[0056] Figure 4 A schematic diagram schematically shows a flow chart of another training process of a target gradient reinforcement network in some embodiments of the present specification;

[0057] Figure 5 A schematic diagram schematically shows the principle of training a target gradient reinforcement network in some embodiments of this specification;

[0058] Figure 6A schematic diagram of a large language model training device for privacy protection according to some embodiments of the present specification is schematically shown.

[0059] Figure 7 A schematic diagram of the structure of a computer system of an electronic device according to some embodiments of the present specification is schematically shown.

[0060] Figure 8 A schematic diagram of a computer-readable storage medium according to some embodiments of the present specification is schematically shown.

[0061] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

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

[0063] The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit this specification. The singular forms "a", "the" and "the" used in this specification are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items.

[0064] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0065] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of this specification sheet. However, those skilled in the art will appreciate that the technical solutions of this specification sheet may be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of this specification sheet.

[0066] Furthermore, the drawings are only schematic illustrations and are not necessarily drawn to scale. The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0067] Figure 1 A schematic diagram of the system architecture of an exemplary application environment of a large language model training method and apparatus for privacy protection, to which the embodiments of the present disclosure can be applied, is shown.

[0068] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with artificial intelligence (AI) computing capabilities, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.

[0069] The large language model training method for privacy protection provided in the embodiment of the present disclosure is generally executed by the terminal devices 101, 102, and 103, and accordingly, the large language model training device for privacy protection is generally set in the terminal devices 101, 102, and 103. However, it is easy for those skilled in the art to understand that the large language model training method for privacy protection provided in the embodiment of the present disclosure can also be executed by the server 105, and accordingly, the large language model training device for privacy protection can also be set in the server 105, which is not particularly limited in this exemplary embodiment.

[0070] In the embodiments of this specification, a large language model training method for privacy protection is first provided. The large language model training method for privacy protection can be applied to a terminal device or a server. This embodiment is not limited to this. The following description is made by taking a terminal device executing the method as an example. Figure 2 The flowchart of the method for training a large language model for privacy protection according to some embodiments of this specification is schematically shown. Figure 2 As shown, the large language model training method for privacy protection may include the following steps:

[0071] Step S210, obtaining training data;

[0072] Step S220, inputting the training data into the large language model to be trained to determine the original gradient corresponding to the training data;

[0073] Step S230, performing reinforcement conversion on the original gradient to obtain a reinforcement gradient;

[0074] Step S240: updating the model weights corresponding to the large language model to be trained by using the reinforcement gradient to obtain a trained large language model.

[0075] According to the large language model training method for privacy protection in the embodiment of this specification, by obtaining training data and inputting the training data into the large language model to be trained, the original gradient corresponding to the training data is determined, and then the original gradient is reinforced and converted to obtain a reinforced gradient, and then the model weight corresponding to the large language model to be trained can be updated through the reinforced gradient to obtain a trained large language model. On the one hand, by reinforcing the original gradient to obtain a reinforced gradient, and then updating the large language model corresponding to the model weight of the large language model to be trained through the reinforced gradient, during use, the attacker cannot restore the original privacy data through the reinforced gradient in the large language model, thereby effectively reducing the possibility of the attacker restoring the original data through the gradient of the large language model, and improving the security of the privacy data in the large language model; on the other hand, the difference between the reinforced gradient and the original gradient obtained by reinforcing the original gradient is small, so that while ensuring that the attacker cannot restore the privacy data through the reinforced gradient, the reinforced gradient does not affect the understanding ability of the large language model, ensuring the accuracy of the output result of the large language model.

[0076] Below, the large language model training method for privacy protection in this example embodiment will be further explained.

[0077] In step S210, training data is obtained.

[0078] In an example embodiment of the present specification, training data refers to a sample data set used to train a large language model. For example, the training data may be text summary extraction sample data of a large language model used to train a text summary extraction task, or may be intelligent question answering sample data of a large language model used to train an intelligent question answering task. Of course, the training data may also be language translation sample data of a large language model used to train a language translation task. This example embodiment does not specifically limit the type of training data.

[0079] The training data can be obtained by screening and constructing from an open source database through a pre-set regular expression, or by grabbing open source data and constructing the training data through random combination. The embodiments of this specification do not specifically limit the method for obtaining the training data. After the training data is constructed, the training data can be stored in a cloud server or in a local database. When used, it can be directly retrieved from the cloud server or the local database. The embodiments of this specification do not specifically limit the method for obtaining the training data.

[0080] In step S220, the training data is input into the large language model to be trained to determine the original gradient corresponding to the training data.

[0081] In an example embodiment of the present specification, the large language model to be trained refers to a pre-built large language model whose model parameters are initialized parameters. For example, the large language model to be trained can be a pre-built deep learning model for text classification tasks, or a pre-built deep learning model for intelligent question answering tasks. This example embodiment does not specifically limit the type of the large language model to be trained.

[0082] The original gradient refers to the gradient of the loss function of the large language model to be trained with respect to the model parameters (such as weights and biases in the neural network) during the deep learning training process. The gradient gives the local optimal rising direction of the loss function at a given point. By determining the original gradient, the model weights of the large language model to be trained can be updated, thereby realizing deep learning training of the large language model to be trained.

[0083] By inputting the training data into the large language model to be trained, the original gradient corresponding to the training data can be determined. For example, the training data can be input into the large language model to be trained to obtain output data, and the error gradient can be determined through the model loss function of the large language model to be trained, the training data and the output data, and the error gradient and the weight parameters of each network layer in the large language model to be trained are back-propagated to determine the original gradient corresponding to the training data.

[0084] In step S230, the original gradient is reinforced and converted to obtain a reinforced gradient.

[0085] In an example embodiment of the present specification, the reinforced gradient refers to the gradient obtained by converting the original gradient. The reinforced gradient is smaller than the original gradient, but the attacker can restore the original training data through the original gradient, while the original training data cannot be restored through the reinforced gradient.

[0086] The reinforcement conversion of the original gradient can be achieved by training a neural network model dedicated to the reinforcement gradient. For example, the original gradient can be reinforced and converted to obtain the reinforced gradient through a pre-trained generative deep learning model (such as a variational autoencoder VAE, a generative adversarial network GAN, etc.), or the original gradient can be reinforced and converted to obtain the reinforced gradient through a pre-trained autoencoder-decoder network. This example embodiment does not specifically limit the type of neural network model used to reinforce the gradient.

[0087] Of course, the original gradient can also be reinforced by adding random noise to the original gradient. For example, random noise that conforms to the Laplace distribution or Gaussian distribution can be determined, and the random noise can be fused with the original gradient to obtain a reinforced gradient after reinforcement conversion. This example embodiment does not specifically limit the method of reinforcing the original gradient.

[0088] In step S240, the model weights corresponding to the large language model to be trained are updated using the reinforcement gradient to obtain a trained large language model.

[0089] In an example embodiment of the present specification, after obtaining the reinforcement gradient corresponding to the original gradient, the model weight corresponding to the large language model to be trained can be updated through the reinforcement gradient. For example, the parameter update step of the large language model to be trained can be determined by the learning rate of the large language model to be trained and the reinforcement gradient, and then the updated model weight is determined by the current model weight of the large language model to be trained and the parameter update step, so as to complete the update of the model weight corresponding to the large language model to be trained, and when it is determined that the model loss function of the large language model to be trained converges or the deep learning training reaches the maximum number of training rounds, the trained large language model is obtained.

[0090] The reinforced gradient is obtained by reinforcing the original gradient, and then the large language model is obtained by updating the model weights corresponding to the large language model to be trained through the reinforced gradient. During use, the attacker cannot restore the original private data through the reinforced gradient in the large language model, which can effectively reduce the possibility of the attacker restoring the original data through the gradient of the large language model, and improve the security of the private data in the large language model; the reinforced gradient obtained by reinforcing the original gradient has a small difference with the original gradient. In this way, while ensuring that the attacker cannot restore the private data through the reinforced gradient, the reinforced gradient does not affect the understanding ability of the large language model, thereby improving the accuracy of the output results of the large language model.

[0091] Next, steps S210 to S240 are described in detail.

[0092] In an exemplary embodiment of the present specification, the original gradient may be input into a trained target gradient reinforcement network, so that the target gradient reinforcement network may be used to perform reinforcement conversion on the original gradient to obtain a reinforced gradient.

[0093] The target gradient reinforcement network refers to a pre-trained neural network model for reinforcement conversion of the original gradient. By inputting the original gradient into the trained target gradient reinforcement network, the reinforced gradient after reinforcement conversion can be directly obtained. For example, the target gradient reinforcement network can be a generative deep learning model (such as variational autoencoder VAE, generative adversarial network GAN, etc.), or it can be an autoencoder decoder network. This example embodiment does not specifically limit the network type of the target gradient reinforcement network.

[0094] The original gradient is reinforced and converted through the trained target gradient reinforcement network. The reinforced gradient can be obtained by directly inputting the original gradient into the target gradient reinforcement network. The conversion efficiency is high and the reinforced gradient obtained has good effect. It can effectively prevent attackers from restoring the training data that may contain private data through the reinforced gradient, improve the security of private data, and ensure the accuracy of the output results of the large language model.

[0095] Optionally, you can Figure 3 The target gradient reinforcement network is trained by the steps in Figure 3 As shown, it may specifically include:

[0096] Step S310, constructing gradient sample data according to the training data and the original gradient corresponding to the training data;

[0097] Step S320, performing deep learning training on a pre-constructed initial gradient restoration network through the gradient sample data to obtain a trained target gradient restoration network, wherein the target gradient restoration network is used to simulate a process of restoring the training data through the original gradient;

[0098] Step S330, constructing a connection training network through the pre-constructed initial gradient reinforcement network and the target gradient restoration network, and performing deep learning training on the connection training network through the gradient sample data to complete the deep learning training of the initial gradient reinforcement network and obtain a trained target gradient reinforcement network.

[0099] The gradient sample data refers to a data set constructed for training a target gradient reinforcement network, and the gradient sample data may include a data pair of training data and an original gradient corresponding to the training data.

[0100] The target gradient restoration network refers to a neural network model used to simulate the process of an attacker restoring training data through the original gradient. For example, the target gradient restoration network can be a generative deep learning model (such as a variational autoencoder VAE, a generative adversarial network GAN, etc.), or it can be an autoencoder-decoder network. This example embodiment does not specifically limit the network type of the target gradient restoration network.

[0101] It can be understood that the network structure of the target gradient restoration network and the network structure of the target gradient reinforcement network can be the same. By using the target gradient restoration network and the target gradient reinforcement network with the same network structure, the construction difficulty and training difficulty of the connection training network can be effectively reduced, the training efficiency of the target gradient reinforcement network can be improved, and the network performance of the target gradient reinforcement network can be improved. For example, the target gradient restoration network and the target gradient reinforcement network can both be self-encoder-decoder networks or generative deep learning models; of course, the network structure of the target gradient restoration network and the network structure of the target gradient reinforcement network can also be different. By using the target gradient restoration network and the target gradient reinforcement network with different network structures, the accuracy of feature expression during the training process can be effectively improved, the accumulation of the same errors can be avoided, and the generalization of the target gradient reinforcement network obtained by training can be improved. For example, the target gradient restoration network can be a generative deep learning model (or a self-encoder-decoder network), and the target gradient reinforcement network can be a self-encoder-decoder network (or a generative deep learning model). This example embodiment does not specifically limit whether the target gradient restoration network and the target gradient reinforcement network select the same network structure.

[0102] The initial gradient reinforcement network refers to a gradient reinforcement network whose model parameters are initialization parameters. The trained target gradient reinforcement network is obtained by updating the model parameters of the initial gradient reinforcement network, such as model weights.

[0103] The connection training network refers to a network structure obtained by connecting the pre-constructed initial gradient reinforcement network with the trained target gradient restoration network, which is used to realize deep learning training of the initial gradient reinforcement network in combination with the trained target gradient restoration network. It can be constructed by using the output data of the initial gradient reinforcement network as the input data of the target gradient restoration network, that is, the output layer of the initial gradient reinforcement network is spliced ​​with the input layer of the target gradient restoration network to obtain the connection training network.

[0104] By first performing deep learning training on the pre-constructed initial gradient restoration network, a trained target gradient restoration network is obtained, and then the initial gradient reinforcement network and the target gradient restoration network are spliced ​​into a connection training network, and deep learning training is performed on the connection training network through gradient sample data, thereby realizing deep learning training of the initial gradient reinforcement network in the connection training network and obtaining a trained target gradient reinforcement network.

[0105] Optionally, you can Figure 4 The steps in the above code implement deep learning training of the connection training network through gradient sample data to obtain the trained target gradient reinforcement network. Figure 4 As shown, it may specifically include:

[0106] Step S410, fixing the network weights of the target gradient restoration network;

[0107] Step S420, using the original gradient as input data of the connection training network, using the training data as label data of the connection training network, and performing deep learning training on the connection training network to adjust and update the network weights of the initial gradient reinforcement network;

[0108] Step S430, after determining that the initial gradient reinforcement network reaches the network training target, a trained target gradient reinforcement network is obtained.

[0109] Among them, fixing the network weights of the target gradient restoration network means that during the training process, the network weights of the target gradient restoration network remain unchanged, while the network weights of the initial gradient reinforcement network are gradually updated and adjusted as the training process progresses, and finally the deep learning training of the initial gradient reinforcement network is completed to obtain the trained target gradient reinforcement network.

[0110] By using the trained target gradient restoration network to assist the initial gradient reinforcement network in deep learning training, the convergence speed of the initial gradient reinforcement network can be improved, thereby improving the training efficiency of the initial gradient reinforcement network. At the same time, the accuracy and effectiveness of the reinforcement gradient output by the trained target gradient reinforcement network are guaranteed, so that attackers cannot restore private data based on the reinforcement gradient output by the target gradient reinforcement network, thereby improving data security.

[0111] Optionally, the following steps may be used to use the original gradient as input data of the connection training network, use the training data as label data of the connection training network, and perform deep learning training on the connection training network to adjust and update the network weights of the initial gradient reinforcement network, which may specifically include:

[0112] The original gradient can be input into the initial gradient reinforcement network to obtain the intermediate reinforcement gradient after the reinforcement conversion of the initial gradient reinforcement network, and then the intermediate reinforcement gradient can be input into the target gradient restoration network to obtain the reconstructed data after the intermediate reinforcement gradient is restored, and the network weights of the initial gradient reinforcement network can be adjusted and updated based on the target loss function of the connection training network.

[0113] Among them, the target loss function refers to the loss function of the constructed connection training network. The loss function of the connection training network can be composed of the first loss function corresponding to the initial gradient reinforcement network and the second loss function corresponding to the target gradient restoration network. For example, the first loss function can be a mean square error loss function or a cross entropy loss function; the second loss function can be a mean square error loss function or a cross entropy loss function. This example embodiment does not specifically limit the first loss function and the second loss function. For the sake of convenience, the following description will take the first loss function and the second loss function as an example using the mean square error loss function.

[0114] The objective loss function may include a first loss function and a second loss function, wherein the first loss function may be used to weigh the original gradient and the intermediate reinforcement gradient to minimize the difference between the original gradient and the intermediate reinforcement gradient, and the second loss function may be used to weigh the training data and the reconstructed data to maximize the difference between the training data and the reconstructed data.

[0115] For example, the objective loss function of the connection training network can be expressed by equation (1):

[0116]

[0117] Among them, Loss can represent the target loss function of the connection training network, L1 can represent the first loss function, the first loss function L1 can be determined by the mean square error loss MSELoss1 between the original gradient and the intermediate reinforcement gradient to minimize the difference between the original gradient and the intermediate reinforcement gradient, L2 can represent the second loss function, the second loss function L2 can be determined by the inverse of the mean square error loss MSELoss2 between the training data and the reconstructed data output by the target gradient restoration network to maximize the difference between the training data and the reconstructed data. In addition, a and b can represent preset adjustment parameters, which are generally positive real numbers and can be customized according to actual usage.

[0118] Optionally, after determining that the initial gradient reinforcement network has reached the network training target, the trained target gradient reinforcement network can be obtained by the following steps, which may specifically include:

[0119] If it is detected that the target loss function of the connected training network converges, or the number of rounds of network training reaches a preset number threshold, it is determined that the initial gradient reinforcement network completes network training and obtains a trained target gradient reinforcement network. When it is determined that the target loss function of the connected training network converges or the number of rounds of network training reaches a preset number threshold, it can be considered that the initial gradient reinforcement network has reached the network training target, and a trained target gradient reinforcement network can be obtained at this time.

[0120] By taking whether the target loss function converges or whether the number of network training rounds reaches a preset threshold as the network training goal, it is possible to ensure that the reasoning performance of the target gradient reinforcement network is good while avoiding overfitting or underfitting of the target gradient reinforcement network, thereby ensuring the accuracy and robustness of the output results of the target gradient reinforcement network.

[0121] refer to Figure 5 As shown, the training data x can be input into the large language model to be trained, the original gradient g 501 corresponding to the training data x is determined, and the pre-constructed initial gradient restoration network is deep-learned and trained through the original gradient g 501 and the training data x to minimize the difference loss between the training data x and the reconstructed data y 503, thereby obtaining a target gradient restoration network 502 that can simulate an attacker restoring the training data x through the original gradient g 501; the target gradient restoration network 502 may include an encoder M1 and a decoder M2, and the input size of the encoder M1 and the output size of the decoder M2 are consistent with the data size of the original gradient g 501 or the training data x.

[0122] After obtaining the trained target gradient restoration network 502, the input of the target gradient restoration network 502 can be connected to the output of the pre-constructed initial gradient reinforcement network to construct a connection training network 504, and the connection training network 504 is trained for deep learning through the training data x and the original gradient g 501; during the training process, the model weight of the target gradient restoration network 502 can be fixed unchanged, the model weight of the pre-constructed initial gradient reinforcement network can be updated and adjusted, and the difference between the original gradient g 501 and the intermediate reinforcement gradient g'506 can be minimized to maximize the difference between the training data x and the reconstructed data y 503, and the target gradient reinforcement network 505 is trained, and the target gradient reinforcement network 505 is the self-encoder decoder M3. Of course, the above is only an illustrative example and should not cause any special limitation to this exemplary embodiment.

[0123] In an exemplary embodiment of the present specification, deep learning training of a pre-built initial gradient restoration network can be implemented by the following steps to obtain a trained target gradient restoration network, which may specifically include:

[0124] The original gradient in the gradient sample data can be input into the initial gradient restoration network to obtain reconstructed data, and when it is detected that the third loss function of the initial gradient restoration network converges, or the number of network training rounds reaches a preset threshold, it can be determined that the initial gradient restoration network completes network training and obtains a trained target gradient restoration network.

[0125] The initial gradient restoration network may include a third loss function, which may be used to measure the training data and the reconstruction data to minimize the difference between the training data and the reconstruction data. For example, the third loss function may be a mean square error loss function or a cross entropy loss function. This exemplary embodiment does not specifically limit the type of the third loss function.

[0126] It can be understood that the "first loss function", "second loss function" and "third loss function" in the embodiments of this specification are only used to distinguish the loss functions of different network models, have no special meaning, and should not cause any special limitations to this example embodiment.

[0127] The initial gradient restoration network is trained through gradient sample data to obtain the target gradient restoration network. The target gradient restoration network can obtain reconstructed data based on the original gradient inference of the input, and the reconstructed data is as close to the training data as possible. Then, the trained target gradient restoration network can be used to simulate the attacker's behavior of restoring the training data from the original gradient, thereby better assisting the training of the target gradient reinforcement network.

[0128] In an optional embodiment of the present specification, the target gradient reinforcement network and the target gradient restoration network can be a self-encoding and decoding network, and the input size and output size of the self-encoding and decoding network are consistent with the size of the training data or the original gradient.

[0129] In an example embodiment of the present specification, the large language model to be trained may include a model loss function. For example, the model loss function may be an autoregressive cross entropy loss function or a binary cross entropy loss function. This example embodiment does not specifically limit the type of model loss function of the large language model to be trained.

[0130] Optionally, the training data may be input into the large language model to be trained to determine the original gradient corresponding to the training data by the following steps, which may specifically include:

[0131] The training data can be input into the large language model to be trained to obtain output data, and the error gradient can be determined through the model loss function, the training data and the output data. The error gradient and the weight parameters of each network layer in the large language model to be trained are used for back propagation calculation to determine the original gradient corresponding to the training data. The back propagation algorithm is a common technical means in this field and will not be described in detail here.

[0132] In an exemplary embodiment of the present specification, the following steps may be performed to update the model weights corresponding to the large language model to be trained by the reinforcement gradient to obtain the trained large language model, which may specifically include:

[0133] The learning rate of the large language model to be trained can be obtained, and the parameter update step size of the large language model to be trained can be determined according to the learning rate and the reinforcement gradient. Then, the updated model weight can be determined by the current model weight and the parameter update step size of the large language model to be trained, thereby completing the update of the model weight corresponding to the large language model to be trained.

[0134] For example, the update process of the model weights corresponding to the large language model to be trained can be expressed by equation (2):

[0135]

[0136] Among them, w t+1 Can represent the updated model weight, w t It can represent the current model weight of the large language model to be trained, μ can represent the learning rate, It can represent the reinforced gradient of the model loss function with respect to the model weights, It can represent the parameter update step size of the large language model to be trained.

[0137] In an exemplary embodiment of the present specification, the original gradient may be reinforced and converted to obtain a reinforced gradient by the following steps, which may specifically include:

[0138] The privacy budget parameter and sensitivity of the large language model to be trained can be determined, and then the random noise can be determined by the privacy budget parameter and the sensitivity, and then the reinforcement gradient can be determined according to the original gradient and the random noise.

[0139] Among them, the privacy budget parameter refers to a pre-set parameter used to balance privacy protection and model performance. A smaller privacy budget parameter can achieve stronger privacy protection, but may lead to a decrease in model performance. The sensitivity of the model gradient can be determined based on the model structure of the large language model to be trained, the model loss function, and the data distribution of the training data.

[0140] Random noise refers to noise used to perform reinforcement conversion on the original gradient. For example, the random noise may be noise that obeys Laplace distribution or noise that obeys Gaussian distribution. This example embodiment does not specifically limit the type of random noise.

[0141] For example, the reinforcement transformation of the original gradient can be achieved through equation (3):

[0142]

[0143] Among them, g ′ can represent the reinforcement gradient, g can represent the original gradient, Δ can represent the sensitivity of the model gradient, and ε can represent the privacy budget parameter. It can represent random noise that follows a Laplace distribution.

[0144] In summary, by obtaining training data and inputting the training data into the large language model to be trained, the original gradient corresponding to the training data is determined, and then the original gradient is reinforced and converted to obtain a reinforced gradient, and then the model weight corresponding to the large language model to be trained can be updated through the reinforced gradient to obtain a trained large language model. On the one hand, by reinforcing the original gradient to obtain a reinforced gradient, and then updating the model weight corresponding to the large language model to be trained through the reinforced gradient to obtain a large language model, during use, the attacker cannot restore the original private data through the reinforced gradient in the large language model, thereby effectively reducing the possibility of the attacker restoring the original data through the gradient of the large language model, and improving the security of the private data in the large language model; on the other hand, the reinforced gradient obtained by reinforcing the original gradient has a small difference between the reinforced gradient and the original gradient, so that while ensuring that the attacker cannot restore the private data through the reinforced gradient, the reinforced gradient does not affect the understanding ability of the large language model, and improves the accuracy of the output results of the large language model.

[0145] It should be noted that, although the steps of the method in this specification are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0146] In addition, in the embodiments of this specification, a large language model training device for privacy protection is also provided. Figure 6 As shown, the large language model training device 600 for privacy protection includes: a training data acquisition module 610, an original gradient determination module 620, an original gradient reinforcement module 630 and a large language model training module 640. Among them:

[0147] A training data acquisition module 610 is used to acquire training data;

[0148] An original gradient determination module 620, configured to input the training data into a large language model to be trained to determine an original gradient corresponding to the training data;

[0149] The original gradient reinforcement module 630 is used to perform reinforcement conversion on the original gradient to obtain a reinforcement gradient;

[0150] The large language model training module 640 is used to update the model weights corresponding to the large language model to be trained through the reinforcement gradient to obtain a trained large language model.

[0151] In an exemplary embodiment of the present specification, based on the above-mentioned solution, the original gradient reinforcement module 630 includes a target gradient reinforcement network reinforcement unit, and the target gradient reinforcement network reinforcement unit is configured as follows:

[0152] The original gradient is input into the trained target gradient reinforcement network, so as to perform reinforcement conversion on the original gradient through the target gradient reinforcement network to obtain the reinforced gradient.

[0153] In an exemplary embodiment of the present specification, based on the above-mentioned solution, the large language model training device 600 for privacy protection further includes a target gradient reinforcement network training module, which includes:

[0154] A gradient sample data construction unit, used to construct gradient sample data according to the training data and the original gradient corresponding to the training data;

[0155] A target gradient restoration network training unit is used to perform deep learning training on a pre-constructed initial gradient restoration network through the gradient sample data to obtain a trained target gradient restoration network, wherein the target gradient restoration network is used to simulate a process of restoring the training data through the original gradient;

[0156] The connection training network training unit is used to construct a connection training network through a pre-constructed initial gradient reinforcement network and the target gradient restoration network, and perform deep learning training on the connection training network through the gradient sample data to complete the deep learning training of the initial gradient reinforcement network and obtain a trained target gradient reinforcement network.

[0157] In an exemplary embodiment of the present specification, based on the above scheme, the connection training network is constructed by using the output data of the initial gradient reinforcement network as the input data of the target gradient restoration network; the connection training network training unit is configured as follows:

[0158] Fixing the network weights of the target gradient restoration network;

[0159] Using the original gradient as input data of the connection training network, using the training data as label data of the connection training network, and performing deep learning training on the connection training network to adjust and update the network weights of the initial gradient reinforcement network;

[0160] After determining that the initial gradient reinforcement network reaches the network training target, a trained target gradient reinforcement network is obtained.

[0161] In an exemplary embodiment of the present specification, based on the above solution, the connection training network training unit is configured as follows:

[0162] Inputting the original gradient into the initial gradient reinforcement network to obtain an intermediate reinforcement gradient after reinforcement conversion by the initial gradient reinforcement network;

[0163] Inputting the intermediate reinforcement gradient into the target gradient restoration network to obtain the reconstructed data after the intermediate reinforcement gradient is restored;

[0164] Adjusting and updating the network weights of the initial gradient reinforcement network based on the target loss function of the connection training network;

[0165] The objective loss function includes a first loss function and a second loss function, wherein the first loss function is used to measure the original gradient and the intermediate reinforcement gradient to minimize the difference between the original gradient and the intermediate reinforcement gradient, and the second loss function is used to measure the training data and the reconstructed data to maximize the difference between the training data and the reconstructed data.

[0166] In an exemplary embodiment of the present specification, based on the above solution, the connection training network training unit is configured as follows:

[0167] If it is detected that the target loss function of the connection training network converges, or the number of rounds of network training reaches a preset threshold, it is determined that the initial gradient reinforcement network completes the network training and obtains a trained target gradient reinforcement network.

[0168] In an exemplary embodiment of the present specification, based on the above scheme, the target gradient restoration network training unit is configured as follows:

[0169] Inputting the original gradient in the gradient sample data into the initial gradient restoration network to obtain reconstructed data, wherein the initial gradient restoration network includes a third loss function, and the third loss function is used to weigh the training data and the reconstructed data to minimize the difference between the training data and the reconstructed data;

[0170] If it is detected that the third loss function of the initial gradient restoration network converges, or the number of rounds of network training reaches a preset threshold, it is determined that the initial gradient restoration network completes network training and obtains a trained target gradient restoration network.

[0171] In an exemplary embodiment of the present specification, based on the aforementioned scheme, the target gradient reinforcement network and the target gradient restoration network are self-encoding and decoding networks, and the input size and output size of the self-encoding and decoding networks are consistent with the size of the training data or the original gradient.

[0172] In an exemplary embodiment of the present specification, based on the aforementioned solution, the large language model to be trained includes a model loss function; the original gradient determination module is configured as follows:

[0173] Inputting the training data into a large language model to be trained to obtain output data, and determining an error gradient through the model loss function, the training data and the output data;

[0174] The original gradient corresponding to the training data is determined by performing back propagation calculation on the error gradient and the weight parameters of each network layer in the large language model to be trained.

[0175] In an exemplary embodiment of the present specification, based on the above scheme, the large language model training module is configured as follows:

[0176] Obtaining a learning rate of the large language model to be trained;

[0177] Determining a parameter update step size of the large language model to be trained according to the learning rate and the reinforcement gradient;

[0178] The updated model weight is determined by the current model weight of the large language model to be trained and the parameter update step size, thereby completing the updating of the model weight corresponding to the large language model to be trained.

[0179] In an exemplary embodiment of the present specification, based on the above-mentioned solution, the original gradient reinforcement module further includes a random noise reinforcement unit, and the random noise reinforcement unit is configured as follows:

[0180] Determining privacy budget parameters and sensitivity of the large language model to be trained;

[0181] Determine random noise using the privacy budget parameter and the sensitivity;

[0182] The reinforcement gradient is determined according to the original gradient and the random noise.

[0183] The specific details of each module of the above-mentioned large language model training device for privacy protection have been described in detail in the corresponding large language model training method for privacy protection, so they will not be repeated here.

[0184] It should be noted that although several modules or units of the large language model training device for privacy protection are mentioned in the above detailed description, this division is not mandatory. In fact, according to the implementation of this specification, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0185] In addition, in an exemplary embodiment of the present specification, an electronic device capable of implementing the above-mentioned large language model training method for privacy protection is also provided.

[0186] It will be understood by those skilled in the art that various aspects of this specification may be implemented as a system, method or program product. Therefore, various aspects of this specification may be specifically implemented in the following forms, namely: a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which may be collectively referred to herein as a "circuit", "module" or "system".

[0187] Refer to the following Figure 7 An electronic device 700 according to such an embodiment of the present specification is described. Figure 7 The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of this specification.

[0188] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include, but are not limited to: the at least one processing unit 710, the at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), and a display unit 740.

[0189] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 performs the steps according to various exemplary embodiments of the present specification described in the above “Exemplary Method” section of the present specification. For example, the processing unit 710 can perform the following steps: Figure 2 In step S210 shown in the figure, training data is obtained; in step S220, the training data is input into the large language model to be trained to determine the original gradient corresponding to the training data; in step S230, the original gradient is reinforced to obtain a reinforced gradient; in step S240, the model weight corresponding to the large language model to be trained is updated by the reinforced gradient to obtain a trained large language model.

[0190] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 721 and / or a cache memory unit 722 , and may further include a read-only memory unit (ROM) 723 .

[0191] The storage unit 720 may also include a program / utility 724 having a set (at least one) of program modules 725, such program modules 725 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0192] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0193] The electronic device 700 may also communicate with one or more external devices 770 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0194] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of this specification can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of this specification.

[0195] refer to Figure 8As shown, a program product 800 for implementing the above-mentioned large language model training method for privacy protection according to an embodiment of this specification is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of this specification is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0196] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0197] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0198] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0199] Program code for performing the operations of the present specification may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0200] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present specification, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0201] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of this specification can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of this specification.

[0202] Those skilled in the art will readily come up with other embodiments of the present specification after considering the specification and practicing the invention disclosed herein. The embodiments of the present specification are intended to cover any variation, use, or adaptation of the technical solution provided, which follows the general principles of the present specification and includes common knowledge or customary technical means in the art that are not disclosed in the present specification. The description and embodiments are to be regarded as exemplary only.

[0203] It should be understood that the present description is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof.

Claims

1. A large language model training method for privacy protection, the method comprising: Get training data; Inputting the training data into a large language model to be trained to determine an original gradient corresponding to the training data; The original gradient is reinforced and converted to obtain a reinforced gradient, which includes inputting the original gradient into a trained target gradient reinforcement network to reinforce the original gradient through the target gradient reinforcement network to obtain the reinforced gradient; wherein gradient sample data is constructed according to the training data and the original gradient corresponding to the training data; deep learning training is performed on a pre-constructed initial gradient restoration network through the gradient sample data to obtain a trained target gradient restoration network, and the target gradient restoration network is used to simulate the process of restoring the training data through the original gradient; a connection training network is constructed through the pre-constructed initial gradient reinforcement network and the target gradient restoration network, and deep learning training is performed on the connection training network through the gradient sample data to complete the deep learning training of the initial gradient reinforcement network to obtain the trained target gradient reinforcement network; The model weights corresponding to the large language model to be trained are updated using the reinforcement gradient to obtain a trained large language model.

2. According to the large language model training method of claim 1, the connection training network is constructed by using the output data of the initial gradient reinforcement network as the input data of the target gradient restoration network; The method constructs a connection training network by using the pre-constructed initial gradient reinforcement network and the target gradient restoration network, and performs deep learning training on the connection training network through the gradient sample data to complete the deep learning training of the initial gradient reinforcement network and obtain a trained target gradient reinforcement network, including: Fixing the network weights of the target gradient restoration network; Using the original gradient as input data of the connection training network, using the training data as label data of the connection training network, and performing deep learning training on the connection training network to adjust and update the network weights of the initial gradient reinforcement network; After determining that the initial gradient reinforcement network reaches the network training target, a trained target gradient reinforcement network is obtained.

3. According to the large language model training method of claim 2, the method uses the original gradient as input data of the connection training network, uses the training data as label data of the connection training network, and performs deep learning training on the connection training network to adjust and update the network weights of the initial gradient reinforcement network, including: Inputting the original gradient into the initial gradient reinforcement network to obtain an intermediate reinforcement gradient after reinforcement conversion by the initial gradient reinforcement network; Inputting the intermediate reinforcement gradient into the target gradient restoration network to obtain the reconstructed data after the intermediate reinforcement gradient is restored; Adjusting and updating the network weights of the initial gradient reinforcement network based on the target loss function of the connection training network; The objective loss function includes a first loss function and a second loss function, wherein the first loss function is used to measure the original gradient and the intermediate reinforcement gradient to minimize the difference between the original gradient and the intermediate reinforcement gradient, and the second loss function is used to measure the training data and the reconstructed data to maximize the difference between the training data and the reconstructed data.

4. The large language model training method according to claim 2, wherein after determining that the initial gradient reinforcement network reaches the network training target, obtaining a trained target gradient reinforcement network comprises: If it is detected that the target loss function of the connection training network converges, or the number of rounds of network training reaches a preset threshold, it is determined that the initial gradient reinforcement network completes the network training and obtains a trained target gradient reinforcement network.

5. The large language model training method according to claim 1, wherein the pre-constructed initial gradient restoration network is subjected to deep learning training using the gradient sample data to obtain a trained target gradient restoration network, comprising: Inputting the original gradient in the gradient sample data into the initial gradient restoration network to obtain reconstructed data, wherein the initial gradient restoration network includes a third loss function, and the third loss function is used to weigh the training data and the reconstructed data to minimize the difference between the training data and the reconstructed data; If it is detected that the third loss function of the initial gradient restoration network converges, or the number of rounds of network training reaches a preset threshold, it is determined that the initial gradient restoration network completes network training and obtains a trained target gradient restoration network.

6. According to the large language model training method according to any one of claims 1 to 5, the target gradient reinforcement network and the target gradient restoration network are autoencoder-decoder networks, and the input size and output size of the autoencoder-decoder network are consistent with the size of the training data or the original gradient.

7. The large language model training method according to claim 1, wherein the large language model to be trained comprises a model loss function; and the step of inputting the training data into the large language model to be trained to determine the original gradient corresponding to the training data comprises: Inputting the training data into a large language model to be trained to obtain output data, and determining an error gradient through the model loss function, the training data and the output data; The original gradient corresponding to the training data is determined by performing back propagation calculation on the error gradient and the weight parameters of each network layer in the large language model to be trained.

8. The large language model training method according to claim 1, wherein the step of updating the model weights corresponding to the large language model to be trained by using the reinforcement gradient to obtain the trained large language model comprises: Obtaining a learning rate of the large language model to be trained; Determining a parameter update step size of the large language model to be trained according to the learning rate and the reinforcement gradient; The updated model weight is determined by the current model weight of the large language model to be trained and the parameter update step size, thereby completing the updating of the model weight corresponding to the large language model to be trained.

9. According to the large language model training method of claim 1, the step of performing a reinforcement conversion on the original gradient to obtain a reinforced gradient comprises: Determining privacy budget parameters and sensitivity of the large language model to be trained; Determine random noise using the privacy budget parameter and the sensitivity; The reinforcement gradient is determined according to the original gradient and the random noise.

10. A large language model training device for privacy protection, comprising: A training data acquisition module, used to acquire training data; An original gradient determination module, used for inputting the training data into a large language model to be trained to determine an original gradient corresponding to the training data; An original gradient reinforcement module, used for performing reinforcement conversion on the original gradient to obtain a reinforcement gradient; The method comprises: inputting the original gradient into a trained target gradient reinforcement network to perform reinforcement transformation on the original gradient through the target gradient reinforcement network to obtain the reinforced gradient; constructing gradient sample data according to the training data and the original gradient corresponding to the training data; performing deep learning training on a pre-constructed initial gradient restoration network through the gradient sample data to obtain a trained target gradient restoration network, wherein the target gradient restoration network is used to simulate the process of restoring the training data through the original gradient; constructing a connection training network through the pre-constructed initial gradient reinforcement network and the target gradient restoration network, and performing deep learning training on the connection training network through the gradient sample data to complete the deep learning training of the initial gradient reinforcement network to obtain the trained target gradient reinforcement network; The large language model training module is used to update the model weights corresponding to the large language model to be trained through the reinforcement gradient to obtain a trained large language model.

11. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

12. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 9.