Private data protection model training method in open environment
By dividing the training data set into subsets in an open environment and performing local gradient quantization and noise-added processing, the privacy data leakage problem is solved, the efficiency and security of model training is achieved, and the accuracy and privacy of the machine learning model is ensured. Protect.
Patent Information
- Application Number
- CN202411256322.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-12-31
AI Technical Summary
In an open environment, data exchange and sharing between multiple participants frequently occur, resulting in an intensified risk of privacy data leakage. How to effectively protect private data in an open environment while ensuring the accuracy and effectiveness of machine learning models has become an urgent problem. Important question.
By dividing the training data set into different subsets and distributing it to different servers for model gradient calculation, local gradient quantization and noise addition processing are performed, and the correlation of noise addition local gradient vectors is calculated and filtered, and only the filtered gradient vector is uploaded for Global optimization model parameter updates to achieve the protection of privacy data and model parameters.
It effectively avoids private data leakage in the training dataset, improves model training efficiency, and ensures the security and accuracy of model training parameters through filtering and aggregation and update of gradient vectors.
Smart Images

Figure CN119226794A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of model training in an open environment, and in particular to a privacy data protection model training method in an open environment. Background Art
[0002] In today's era of rapid development of information technology, massive data has become a key driving force for the development of artificial intelligence and machine learning. However, with the continuous expansion of data scale and the increase in data sharing needs, the issue of privacy data protection has become increasingly prominent. Especially in an open environment, data exchange and sharing between multiple participants frequently occur, and the risk of privacy data leakage is further aggravated. Therefore, how to effectively protect privacy data in an open environment while ensuring the accuracy and effectiveness of machine learning models has become an important issue that needs to be solved urgently. In response to this problem, the present invention proposes a privacy data protection model training method in an open environment, which balances data privacy protection and data utilization efficiency through dynamic privacy computing and federated fusion, and promotes cross-organizational cooperation and model training in an open environment. Summary of the invention
[0003] In view of this, the present invention provides a privacy data protection model training method in an open environment, the purpose of which is to: 1) divide the training data set into different subsets and distribute them to different servers for training, so as to avoid the leakage of all privacy data in the training data set, use the computing resources of multiple servers for model training, improve the model training efficiency, and in order to protect the training results of model training parameters from being leaked, the server only retains the gradient corresponding to the model parameter during the local training process to form a local gradient vector, and quantizes and noises the local gradient vector in combination with a preset gradient quantization level and a gradient quantization threshold, so as to facilitate the transmission of the gradient vector, realize the protection of privacy data and model parameters, and realize the joint training of multiple servers in an open environment; 2) according to the correlation between the noisy local gradient vectors transmitted by different servers, calculate the association probability of any noisy local gradient vector, and then calculate the gradient correlation of different noisy local gradient vectors, reset the noisy local gradient vector with a gradient correlation less than a specified threshold to a zero vector for filtering, filter out abnormal vectors, and upload the filtered noisy local gradient vector to the global optimization model for gradient vector aggregation, update the model training parameters based on the gradient vector aggregation result, and realize the update of model training parameters based on multiple gradient vectors.
[0004] To achieve the above object, the present invention provides a privacy data protection model training method in an open environment, comprising the following steps:
[0005] S1: Divide the training data set into different subsets and distribute them to the servers participating in the training. The servers perform model gradient calculations locally.
[0006] S2: Perform local gradient quantization on the model gradient calculation result of the server and add noise to form a noisy local gradient vector;
[0007] S3: Randomly upload the noisy local gradient vectors to the processor, calculate the gradient correlation of different noisy local gradient vectors, reset the noisy local gradient vectors with gradient correlation less than a specified threshold to 0 vectors for filtering, and obtain the filtered noisy local gradient vectors;
[0008] S4: Upload the filtered noisy local gradient vector to the global optimization model for gradient vector aggregation, and update the model training parameters based on the gradient vector aggregation result.
[0009] As a further improvement method of the present invention:
[0010] Optionally, in step S1, the training data set is divided into different subsets and distributed to servers participating in the training, including:
[0011] The training data set is divided into different subsets, where the subsets are:
[0012]
[0013]
[0014] in:
[0015] data k represents the kth subset obtained by division, Represents the kth subset data k The i-th group of training data in, i∈[1,num k ],num k Represents the kth subset data k The total number of training data in, K represents the total number of servers participating in the training;
[0016] Sum represents the total number of training data in the training data set, Tps k represents the number of transactions processed per second by the kth server, B k represents the bandwidth of the kth server, RT k Indicates the response time of the kth server;
[0017] Represents training data The data points in Represents data points The corresponding data label;
[0018] Distribute the divided subsets to the servers participating in the training in the open environment, where the subset received by the kth server is data k ;
[0019] The server calculates the model gradient locally based on the received subset.
[0020] Optionally, the server performs model gradient calculation locally based on the received subset, including:
[0021] The kth server receives the subset data based on k , the process of calculating the model gradient locally on the server is:
[0022] S11: The kth server initializes the training parameters θ of the model to be trained k (0), and set the current iteration number of the model training parameters to d, the initial value of d is 0, and the maximum value is D. Then the dth iteration result of the training iteration of the model training parameters by the kth server is θ k (d); The kth server builds the model gradient training function;
[0023] S12: Use the model training parameters obtained in the dth iteration as the input value of the model gradient training function:
[0024]
[0025] in:
[0026] F k (·) represents the model gradient training function constructed by the kth server;
[0027] Indicates the use of model training parameters θ k (d) For data points Perform label prediction, and the predicted labels and data points The corresponding data label The difference between
[0028] The predicted label and the data label There are two ways to calculate the difference:
[0029]
[0030] in:
[0031] exp(·) represents an exponential function with a natural constant as the base;
[0032] The kth server randomly selects a calculation method to build a model gradient training function;
[0033] S13: Calculate the model training parameters θ k (d) Gradient:
[0034]
[0035] in:
[0036] grad k (d) represents the model training parameter θ k (d) gradient; Indicates F k (θ k (d)) gradient value; In the embodiment of the present invention, the present invention uses the model training parameter as a variable to derive the model gradient training function constructed by the k-th server, and the model training parameter θ k (d) Substitute into the derivative result to get the gradient value
[0037] S14: Gradient-based k (d) Model training parameters θ k (d) Iterate:
[0038] θ k (d+1)=θ k (d) αgrad k (d)
[0039] in:
[0040] α represents the learning rate;
[0041] S15: Let d=d+1, return to step S12, until the maximum number of iterations is reached, and then go to step S16;
[0042] S16: Model gradient calculation result of the k-th server:
[0043] grad k =(grad k (0),grad k (1),...,grad k (d),...,grad k (D)
[0044] in:
[0045] grad k Represents the model gradient calculation result of the kth server.
[0046] Optionally, in step S2, the local gradient quantization of the model gradient calculation result of the server includes:
[0047] The model gradient calculation result of the server is locally quantized, where the model gradient calculation result grad k The local gradient quantization process is:
[0048] Set the gradient quantization level to b and the gradient quantization threshold to S;
[0049] The model gradient calculation result grad for the kth server k Perform local gradient quantization:
[0050] g k =(g k (0),g k (1),...,g k (d),...,g k (D)
[0051]
[0052] in:
[0053] g k (d) represents the gradient grad k (d) quantified value;
[0054] g k Represents the model gradient calculation result grad of the kth server k The local gradient quantization result of ;
[0055] Add noise to the local gradient quantization result to form a noisy local gradient vector, where the noisy local gradient vector of the kth server is G k :
[0056] G k =(G k (0),G k (1),...,G k (d),...,G k (D)
[0057] G k (d) = g k (d)+noise k (d)
[0058] noise k (d)~N(0,σ 2 )
[0059] in:
[0060] G k (d) represents the quantized value g k (d) Noise result;
[0061] noise k (d) represents the quantized value g k (d) is the noise added, where noise k (d)~N(0,σ 2 ), indicating that the noise has a mean of 0 and a variance of σ 2 Gaussian distribution N(0,σ 2 ).
[0062] Optionally, in the step S3, the noisy local gradient vector is randomly uploaded to the processor, and the gradient correlation between different noisy local gradient vectors is calculated, including:
[0063] The noisy local gradient vector is randomly uploaded to the processor, where the noisy local gradient vector G k The upload probability is:
[0064]
[0065] in:
[0066] ε represents the probability control parameter, and ε is set to 0.4;
[0067] ―F k (θ k (D)) represents the data label prediction accuracy of the final model training parameters generated by the kth server;
[0068] The processor receives the noisy local gradient vector and calculates the gradient correlation between different noisy local gradient vectors, wherein the calculation process of the gradient correlation is:
[0069] S31: Arrange and obtain the noisy local gradient vector set received by the processor:
[0070] {G c |c∈[1,C]}
[0071] in:
[0072] G c represents the cth group of noisy local gradient vectors received by the processor, and C represents the total number of noisy local gradient vectors received by the processor;
[0073] S32: For any noisy local gradient vector received by the processor, calculate the gradient correlation between the noisy local gradient vector and other noisy local gradient vectors, where the noisy local gradient vector G c The gradient correlation is:
[0074]
[0075] in:
[0076] Hc represents the noisy local gradient vector G c The gradient correlation of
[0077] P(G c ,G j ) represents the noisy local gradient vector G c With the noisy local gradient vector G j The correlation between them, j∈[1,C];
[0078] ||·||2 represents the L2 norm;
[0079] The noisy local gradient vectors whose gradient correlation is less than a specified threshold are reset to zero vectors for filtering to obtain filtered noisy local gradient vectors.
[0080] Optionally, resetting the noisy local gradient vectors whose gradient correlation is less than a specified threshold to zero vectors for filtering to obtain filtered noisy local gradient vectors includes:
[0081] For any noisy local gradient vector G c , if the noisy local gradient vector G c If the corresponding gradient correlation Hc is less than the specified threshold, the local gradient vector G will be noisy. c Reset to 0 vector for filtering to form a filtered noisy local gradient vector set:
[0082] {f m =(f m (0),f m (1),...,f m (d),...,f m (D))|m∈[1,M]}
[0083] in:
[0084] f m represents the noisy local gradient vector after filtering of the mth group, f m (d) indicates f m The quantized noise-added result of the gradient value of the corresponding server during the dth iteration of model training parameters;
[0085] M represents the total number of filtered noisy local gradient vectors.
[0086] Optionally, in step S4, uploading the filtered noisy local gradient vector to the global optimization model for gradient vector aggregation and updating the model training parameters includes:
[0087] The filtered noisy local gradient vector is uploaded to the global optimization model for gradient vector aggregation, where the gradient vector aggregation formula is:
[0088] Grad=(Grad(0),Grad(1),...,Grad(d),...,Grad(D))
[0089]
[0090] in:
[0091] Grad represents the gradient vector aggregation result;
[0092] The model training parameters are updated based on the gradient vector aggregation results, where the update result of the model training parameter θ is:
[0093]
[0094] in:
[0095] θ represents the model training parameters generated by initialization;
[0096] Represents the updated model training parameters corresponding to the model training parameters θ, The training results as model training parameters.
[0097] In order to solve the above problem, the present invention provides an electronic device, the electronic device comprising:
[0098] A memory storing at least one instruction;
[0099] Communication interface, enabling electronic equipment to communicate; and
[0100] A processor executes instructions stored in the memory to implement the privacy data protection model training method in an open environment as described above.
[0101] In order to solve the above problems, the present invention also provides a computer-readable storage medium, which stores at least one instruction, and the at least one instruction is executed by a processor in an electronic device to implement the privacy data protection model training method in an open environment described above.
[0102] Compared with the prior art, the present invention proposes a privacy data protection model training method in an open environment, which has the following advantages:
[0103] First, this scheme proposes a multi-server model gradient calculation method and gradient vector quantization method. The kth server is based on the received subset data k , the process of calculating the model gradient locally on the server is as follows: the kth server initializes the training parameters θ of the model to be trained k(0), and set the current iteration number of the model training parameters to d, the initial value of d is 0, and the maximum value is D. Then the dth iteration result of the training iteration of the model training parameters by the kth server is θ k (d); The k-th server constructs a model gradient training function; the model training parameters obtained in the d-th iteration are used as the input values of the model gradient training function:
[0104]
[0105] Among them: F k (·) represents the model gradient training function constructed by the kth server; Indicates the use of model training parameters θ k (d) For data points Perform label prediction, and the predicted labels and data points The corresponding data label The difference between the predicted label and the data label There are two ways to calculate the difference:
[0106]
[0107] Where: exp(·) represents an exponential function with a natural constant as the base; the kth server randomly selects a calculation method to construct a model gradient training function; the model training parameter θ is calculated k (d) Gradient:
[0108]
[0109] Among them: grad k (d) represents the model training parameter θ k (d) gradient; Indicates F k (θ k (d)) Gradient value; based on the gradient grad k (d) Model training parameters θ k (d) Iterate:
[0110] θ k (d+1)=θ k (d) αgrad k (d)
[0111] Where: α represents the learning rate; let d = d + 1 until the maximum number of iterations is reached; the model gradient calculation result of the k-th server is:
[0112] grad k =(grad k (0),grad k(1),...,grad k (d),...,grad k (D)
[0113] Among them: grad k Represents the model gradient calculation result of the kth server. The model gradient calculation result of the server is locally quantized, where the model gradient calculation result grad k The local gradient quantization process is as follows: set the gradient quantization level to b, the gradient quantization threshold to S; calculate the model gradient result grad k Perform local gradient quantization:
[0114] g k =(g k (0),g k (1),...,g k (d),...,g k (D)
[0115]
[0116] Where: g k (d) represents the gradient grad k (d) Quantized value; g k Represents the model gradient calculation result grad of the kth server k The local gradient quantization result is obtained by adding noise to the local gradient quantization result to form a noisy local gradient vector, where the noisy local gradient vector of the kth server is G k :
[0117] G k =(G k (0),G k (1),...,G k (d),...,G k (D)
[0118] G k (d) = g k (d)+noise k (d)
[0119] noise k (d)~N(0,σ 2 )
[0120] Where: G k (d) represents the quantized value g k (d) The noise result; noise k (d) represents the quantized value g k (d) is the noise added, where noisek (d)~N(0,σ 2 ), indicating that the noise has a mean of 0 and a variance of σ 2 Gaussian distribution N(0,σ 2 ). This solution divides the training data set into different subsets and distributes them to different servers for training, so as to avoid the leakage of all private data in the training data set. It uses the computing resources of multiple servers for model training to improve the efficiency of model training. In order to protect the training results of model training parameters from being leaked, the server only retains the gradients corresponding to the model parameters during the local training process to form a local gradient vector. The local gradient vector is quantized and denoised in combination with the preset gradient quantization level and gradient quantization threshold to facilitate the transmission of gradient vectors, realize the protection of private data and model parameters, and realize the joint training of multiple servers in an open environment.
[0121] At the same time, this solution proposes a gradient vector filtering method, where the processor receives the noisy local gradient vector and calculates the gradient correlation between different noisy local gradient vectors, where the calculation process of the gradient correlation is: sorting out the noisy local gradient vector set received by the processor:
[0122] {G c |c∈[1,C]}
[0123] Where: G c represents the cth group of noisy local gradient vectors received by the processor, C represents the total number of noisy local gradient vectors received by the processor; for any noisy local gradient vector received by the processor, the gradient correlation between the noisy local gradient vector and other noisy local gradient vectors is calculated, where the noisy local gradient vector G c The gradient correlation is:
[0124]
[0125] Where: H c Represents the noisy local gradient vector G c Gradient correlation degree; P(G c ,G j ) represents the noisy local gradient vector G c With the noisy local gradient vector G jThe correlation between them, j∈[1,C]; ||·||2 represents the L2 norm; the noisy local gradient vectors whose gradient correlation is less than the specified threshold are reset to the 0 vector for filtering, and the filtered noisy local gradient vectors are obtained. This scheme calculates the correlation probability of any noisy local gradient vector according to the correlation between the noisy local gradient vectors transmitted by different servers, and then calculates the gradient correlation of different noisy local gradient vectors, resets the noisy local gradient vectors whose gradient correlation is less than the specified threshold to the 0 vector for filtering, filters out abnormal vectors, and uploads the filtered noisy local gradient vectors to the global optimization model for gradient vector aggregation, updates the model training parameters based on the gradient vector aggregation results, and realizes the model training parameter update based on multiple gradient vectors. BRIEF DESCRIPTION OF THE DRAWINGS
[0126] Figure 1 A flowchart of a privacy data protection model training method in an open environment provided by an embodiment of the present invention;
[0127] Figure 2 A schematic diagram of the structure of an electronic device for implementing a privacy data protection model training method in an open environment provided by an embodiment of the present invention.
[0128] In the figure: 1 electronic device, 10 processor, 11 memory, 12 program, 13 communication interface.
[0129] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0130] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0131] The embodiment of the present application provides a privacy data protection model training method in an open environment. The execution subject of the privacy data protection model training method in an open environment includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the privacy data protection model training method in an open environment can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0132] Embodiment 1:
[0133] S1: Divide the training data set into different subsets and distribute them to the servers participating in the training. The servers perform model gradient calculations locally.
[0134] In the step S1, the training data set is divided into different subsets and distributed to the servers participating in the training, including:
[0135] The training data set is divided into different subsets, where the subsets are:
[0136]
[0137] in:
[0138] data k represents the kth subset obtained by division, Represents the kth subset data k The i-th group of training data in, i∈[1,num k ],num k Represents the kth subset data k The total number of training data in, K represents the total number of servers participating in the training;
[0139] Sum represents the total number of training data in the training data set, Tps k represents the number of transactions processed per second by the kth server, B k represents the bandwidth of the kth server, RT k Indicates the response time of the kth server;
[0140] Represents training data The data points in Represents data points The corresponding data label;
[0141] Distribute the divided subsets to the servers participating in the training in the open environment, where the subset received by the kth server is data k ;
[0142] The server calculates the model gradient locally based on the received subset.
[0143] The server performs model gradient calculation locally based on the received subset, including:
[0144] The kth server receives the subset data based on k , the process of calculating the model gradient locally on the server is:
[0145] S11: The kth server initializes the training parameters θ of the model to be trained k (0), and set the current iteration number of the model training parameters to d, the initial value of d is 0, and the maximum value is D. Then the dth iteration result of the training iteration of the model training parameters by the kth server is θ k(d); The kth server builds the model gradient training function;
[0146] S12: Use the model training parameters obtained in the dth iteration as the input value of the model gradient training function:
[0147]
[0148] in:
[0149] F k (·) represents the model gradient training function constructed by the kth server;
[0150] Indicates the use of model training parameters θ k (d) For data points Perform label prediction, and the predicted labels and data points The corresponding data label The difference between
[0151] The predicted label and the data label There are two ways to calculate the difference:
[0152]
[0153] in:
[0154] exp(·) represents an exponential function with a natural constant as the base;
[0155] The kth server randomly selects a calculation method to build a model gradient training function;
[0156] S13: Calculate the model training parameters θ k (d) Gradient:
[0157]
[0158] in:
[0159] grad k (d) represents the model training parameter θ k (d) gradient; Indicates F k (θ k (d)) gradient value; In the embodiment of the present invention, the present invention uses the model training parameter as a variable to derive the model gradient training function constructed by the k-th server, and the model training parameter θ k (d) Substitute into the derivative result to get the gradient value
[0160] S14: Gradient-based k(d) Model training parameters θ k (d) Iterate:
[0161] θ k (d+1)=θ k (d) -agrad k (d)
[0162] in:
[0163] α represents the learning rate;
[0164] S15: Let d=d+1, return to step S12, until the maximum number of iterations is reached, and then go to step S16;
[0165] S16: Model gradient calculation result of the k-th server:
[0166] grad k =(grad k (0),grad k (1),...,grad k (d),...,grad k (D)
[0167] in:
[0168] grad k Represents the model gradient calculation result of the kth server.
[0169] S2: Perform local gradient quantization on the model gradient calculation result of the server and add noise to form a noisy local gradient vector.
[0170] In the step S2, the local gradient quantization of the model gradient calculation result of the server is performed, including:
[0171] The model gradient calculation result of the server is locally quantized, where the model gradient calculation result grad k The local gradient quantization process is:
[0172] Set the gradient quantization level to b and the gradient quantization threshold to S;
[0173] The model gradient calculation result grad for the kth server k Perform local gradient quantization:
[0174]
[0175] in:
[0176] g k (d) represents the gradient grad k (d) quantified value;
[0177] g k Represents the model gradient calculation result grad of the kth server k The local gradient quantization result of ;
[0178] Add noise to the local gradient quantization result to form a noisy local gradient vector, where the noisy local gradient vector of the kth server is G k :
[0179] G k =(G k (0),G k (1),...,G k (d),...,G k (D)
[0180] G k (d) = g k (d)+noise k (d)
[0181] noise k (d)~N(0,σ 2 )
[0182] in:
[0183] G k (d) represents the quantized value g k (d) Noise result;
[0184] noise k (d) represents the quantized value g k (d) is the noise added, where noise k (d)~N(0,σ 2 ), indicating that the noise has a mean of 0 and a variance of σ 2 Gaussian distribution N(0,σ 2 ).
[0185] S3: Randomly upload the noisy local gradient vectors to the processor, calculate the gradient correlation of different noisy local gradient vectors, reset the noisy local gradient vectors with gradient correlation less than a specified threshold to 0 vectors for filtering, and obtain the filtered noisy local gradient vectors.
[0186] In the step S3, the noisy local gradient vector is randomly uploaded to the processor, and the gradient correlation between different noisy local gradient vectors is calculated, including:
[0187] The noisy local gradient vector is randomly uploaded to the processor, where the noisy local gradient vector G k The upload probability is:
[0188]
[0189] in:
[0190] ε represents the probability control parameter, and ε is set to 0.4;
[0191] ―F k (θ k (D)) represents the data label prediction accuracy of the final model training parameters generated by the kth server;
[0192] The processor receives the noisy local gradient vector and calculates the gradient correlation between different noisy local gradient vectors, wherein the calculation process of the gradient correlation is:
[0193] S31: Arrange and obtain the noisy local gradient vector set received by the processor:
[0194] {G c |c∈[1,C]}
[0195] in:
[0196] G c represents the cth group of noisy local gradient vectors received by the processor, and C represents the total number of noisy local gradient vectors received by the processor;
[0197] S32: For any noisy local gradient vector received by the processor, calculate the gradient correlation between the noisy local gradient vector and other noisy local gradient vectors, where the noisy local gradient vector G c The gradient correlation is:
[0198]
[0199] in:
[0200] Hc represents the noisy local gradient vector G c The gradient correlation of
[0201] P(G c ,G j ) represents the noisy local gradient vector G c With the noisy local gradient vector G j The correlation between them, j∈[1,C];
[0202] ||·||2 represents the L2 norm;
[0203] The noisy local gradient vectors whose gradient correlation is less than a specified threshold are reset to zero vectors for filtering to obtain filtered noisy local gradient vectors.
[0204] The step of resetting the noisy local gradient vectors whose gradient correlation is less than a specified threshold to zero vectors for filtering to obtain the filtered noisy local gradient vectors includes:
[0205] For any noisy local gradient vector G c , if the noisy local gradient vector G c The corresponding gradient correlation H c If it is less than the specified threshold, the local gradient vector G will be noisy c Reset to 0 vector for filtering to form a filtered noisy local gradient vector set:
[0206] {f m =(f m (0),f m (1),...,f m (d),...,f m (D))|m∈[1,M]}
[0207] in:
[0208] f m represents the noisy local gradient vector after filtering of the mth group, f m (d) indicates f m The quantized noise-added result of the gradient value of the corresponding server during the dth iteration of model training parameters;
[0209] M represents the total number of filtered noisy local gradient vectors.
[0210] S4: Upload the filtered noisy local gradient vector to the global optimization model for gradient vector aggregation, and update the model training parameters based on the gradient vector aggregation result.
[0211] In the step S4, the filtered noisy local gradient vector is uploaded to the global optimization model for gradient vector aggregation, and the model training parameters are updated, including:
[0212] The filtered noisy local gradient vector is uploaded to the global optimization model for gradient vector aggregation, where the gradient vector aggregation formula is:
[0213] Grad=(Grad(0),Grad(1),...,Grad(d),...,Grad(D))
[0214]
[0215] in:
[0216] Grad represents the gradient vector aggregation result;
[0217] The model training parameters are updated based on the gradient vector aggregation results, where the update result of the model training parameter θ is:
[0218]
[0219] in:
[0220] θ represents the model training parameters generated by initialization;
[0221] Represents the updated model training parameters corresponding to the model training parameters θ, The training results as model training parameters.
[0222] Embodiment 2:
[0223] like Figure 2 , is a schematic diagram of the structure of an electronic device for implementing a privacy data protection model training method in an open environment provided by an embodiment of the present invention.
[0224] The electronic device 1 may include a processor 10 , a memory 11 , a communication interface 13 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a program 12 .
[0225] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. The memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 may be used not only to store application software and various types of data installed in the electronic device 1, such as the code of the program 12, etc., but also to temporarily store data that has been output or is to be output.
[0226] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, and executes or executes the programs or modules stored in the memory 11 (such as the program 12 for implementing the training of the privacy data protection model in an open environment), and calls the data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
[0227] The communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices, and to achieve connection and communication between internal components of the electronic device.
[0228] The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0229] Figure 2 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 2 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0230] For example, although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, etc. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0231] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0232] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0233] The program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0234] The training data set is divided into different subsets and distributed to the servers participating in the training. The servers perform model gradient calculations locally.
[0235] Perform local gradient quantization on the model gradient calculation results of the server and add noise to form a noisy local gradient vector;
[0236] Randomly upload the noisy local gradient vectors to the processor, calculate the gradient correlation of different noisy local gradient vectors, reset the noisy local gradient vectors with gradient correlation less than a specified threshold to 0 vectors for filtering, and obtain the filtered noisy local gradient vectors;
[0237] The filtered noisy local gradient vector is uploaded to the global optimization model for gradient vector aggregation, and the model training parameters are updated based on the gradient vector aggregation results.
[0238] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to Figure 1 to Figure 2 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0239] It should be noted that the serial numbers of the above-mentioned embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0240] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0241] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A privacy data protection model training method in an open environment, characterized in that: The method comprises: S1: Divide the training data set into different subsets and distribute them to the servers participating in the training. The servers perform model gradient calculations locally. S2: Perform local gradient quantization on the model gradient calculation result of the server and add noise to form a noisy local gradient vector; S3: Randomly upload the noisy local gradient vectors to the processor, calculate the gradient correlation of different noisy local gradient vectors, reset the noisy local gradient vectors with gradient correlation less than a specified threshold to 0 vectors for filtering, and obtain the filtered noisy local gradient vectors; S4: Upload the filtered noisy local gradient vector to the global optimization model for gradient vector aggregation, and update the model training parameters based on the gradient vector aggregation result.
2. The privacy data protection model training method in an open environment as claimed in claim 1, characterized in that: In the step S1, the training data set is divided into different subsets and distributed to the servers participating in the training, including: The training data set is divided into different subsets, where the subsets are: in: data k represents the kth subset obtained by division, Represents the kth subset data k The i-th group of training data in, i∈[1,num k ],num k Represents the kth subset data k The total number of training data in, K represents the total number of servers participating in the training; Sum represents the total number of training data in the training data set, Tps k represents the number of transactions processed per second by the kth server, B k represents the bandwidth of the kth server, RT k Indicates the response time of the kth server; Represents training data The data points in Represents data points The corresponding data label; Distribute the divided subsets to the servers participating in the training in the open environment, where the subset received by the kth server is data k ; The server calculates the model gradient locally based on the received subset.
3. The privacy data protection model training method in an open environment as claimed in claim 2, characterized in that: The server performs model gradient calculation locally based on the received subset, including: The kth server receives the subset data based on k , the process of calculating the model gradient locally on the server is: S11: The kth server initializes the training parameters θ of the model to be trained k (0), and set the current iteration number of the model training parameters to d, the initial value of d is 0, and the maximum value is D. Then the dth iteration result of the training iteration of the model training parameters by the kth server is θ k (d); The kth server builds the model gradient training function; S12: Use the model training parameters obtained in the dth iteration as the input value of the model gradient training function: in: F k (·) represents the model gradient training function constructed by the kth server; Indicates the use of model training parameters θ k (d) For data points Perform label prediction, and the predicted labels and data points The corresponding data label The difference between The predicted label and the data label There are two ways to calculate the difference: in: exp(·) represents an exponential function with a natural constant as the base; The kth server randomly selects a calculation method to build a model gradient training function; S13: Calculate the model training parameters θ k (d) Gradient: in: grad k (d) represents the model training parameter θ k (d) gradient; Indicates F k (θ k (d)) Gradient value; S14: Gradient-based k (d) Model training parameters θ k (d) Iterate: i k (d+1)=θ k (d)―agrad k (d) in: α represents the learning rate; S15: Let d=d+1, return to step S12, until the maximum number of iterations is reached, and then go to step S16; S16: Model gradient calculation result of the k-th server: city k =(degree k (0),degree k (1),...,city k (d),...,grad k (D)) in: grad k Represents the model gradient calculation result of the kth server.
4. The privacy data protection model training method in an open environment as claimed in claim 3, characterized in that: In the step S2, the local gradient quantization of the model gradient calculation result of the server is performed, including: The model gradient calculation result of the server is locally quantized, where the model gradient calculation result grad k The local gradient quantization process is: Set the gradient quantization level to b and the gradient quantization threshold to S; The model gradient calculation result grad for the kth server k Perform local gradient quantization: g k =(g k (0),g k (1),...,g k (d),...,g k (D)) in: g k (d) represents the gradient grad k (d) quantified value; g k Represents the model gradient calculation result grad of the kth server k The local gradient quantization result of ; Add noise to the local gradient quantization result to form a noisy local gradient vector, where the noisy local gradient vector of the kth server is G k : G k =(G k (0),G k (1),...,G k (d),...,G k (D)) G k (d)=g k (d)+noise k (d) noise k (d)~N(0,σ 2 ) in: G k (d) represents the quantized value g k (d) Noise result; noise k (d) represents the quantized value g k (d) is the noise added, where noise k (d)~N(0,σ 2 ), indicating that the noise has a mean of 0 and a variance of σ 2 Gaussian distribution N(0,σ 2 ).
5. The privacy data protection model training method in an open environment as claimed in claim 1, characterized in that: In the step S3, the noisy local gradient vector is randomly uploaded to the processor, and the gradient correlation between different noisy local gradient vectors is calculated, including: The noisy local gradient vector is randomly uploaded to the processor, where the noisy local gradient vector G k The upload probability is: in: ε represents the probability control parameter, and ε is set to 0.4; ―F k (θ k (D)) represents the data label prediction accuracy of the final model training parameters generated by the kth server; The processor receives the noisy local gradient vector and calculates the gradient correlation between different noisy local gradient vectors, wherein the calculation process of the gradient correlation is: S31: Arrange and obtain the noisy local gradient vector set received by the processor: {G c |c∈[1,C]} in: G c represents the cth group of noisy local gradient vectors received by the processor, and C represents the total number of noisy local gradient vectors received by the processor; S32: For any noisy local gradient vector received by the processor, calculate the gradient correlation between the noisy local gradient vector and other noisy local gradient vectors, where the noisy local gradient vector G c The gradient correlation is: in: H c Represents the noisy local gradient vector G c The gradient correlation of P(G c ,G j ) represents the noisy local gradient vector G c With the noisy local gradient vector G j The correlation between them, j∈[1,C]; ||·||2 represents the L2 norm; The noisy local gradient vectors whose gradient correlation is less than a specified threshold are reset to zero vectors for filtering to obtain filtered noisy local gradient vectors.
6. The privacy data protection model training method in an open environment as claimed in claim 5, characterized in that: The step of resetting the noisy local gradient vectors whose gradient correlation is less than a specified threshold to zero vectors for filtering to obtain the filtered noisy local gradient vectors includes: For any noisy local gradient vector G c , if the noisy local gradient vector G c The corresponding gradient correlation H c If it is less than the specified threshold, the local gradient vector G will be noisy c Reset to 0 vector for filtering to form a filtered noisy local gradient vector set: {f m =(f m (0),f m (1),...,f m (d),...,f m (D))|m∈[1,M]} in: f m represents the noisy local gradient vector after filtering of the mth group, f m (d) indicates f m The quantized noise-added result of the gradient value of the corresponding server during the dth iteration of model training parameters; M represents the total number of filtered noisy local gradient vectors.
7. The privacy data protection model training method in an open environment as claimed in claim 6, characterized in that: In the step S4, the filtered noisy local gradient vector is uploaded to the global optimization model for gradient vector aggregation, and the model training parameters are updated, including: The filtered noisy local gradient vector is uploaded to the global optimization model for gradient vector aggregation, where the gradient vector aggregation formula is: Grad=(Grad(0),Grad(1),...,Grad(d),...,Grad(D)) in: Grad represents the gradient vector aggregation result; The model training parameters are updated based on the gradient vector aggregation results, where the update result of the model training parameter θ is: in: θ represents the model training parameters generated by initialization; Represents the updated model training parameters corresponding to the model training parameters θ, The training results as model training parameters.
