Security federal learning method and device of power grid system, terminal equipment and storage medium
By adopting a secure federated learning method in the power grid system and selecting clients to perform federated learning through clustering and grouping, the shortcomings of federated learning solutions in the existing technology in protecting the privacy of power users and improving the federated learning security of the power grid system.
Patent Information
- Application Number
- CN202411866179.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-03-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing federated learning schemes have shortcomings in protecting the privacy of power users. Attackers can invert the original data information through model parameters, resulting in the inability to effectively protect the privacy of user data.
By adopting the security federated learning method in the power grid system, the initial global model parameters of the central server are obtained and sent to the client. The client calculates the local update parameters based on the initial global model parameters and transmits them to the central server. The central server clusters the received local update parameters, forms several clustering groups, and selects a client as the selected client for federated learning with the central server.
By selecting clients after clustering and grouping, the federated learning security of the power grid system is improved, and the risk of attackers inversely pushing out the original data information through model parameters is avoided, thereby protecting the information security of the client.
Smart Images

Figure CN119646883A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power data security and sharing technology, and in particular to a secure federated learning method, device, terminal equipment and storage medium for a power grid system. Background Art
[0002] With the rapid development of smart grids, power grid systems are gradually integrating more smart devices, sensors, and big data analysis capabilities to improve operational efficiency, enhance power supply reliability, and optimize resource allocation. In this context, federated learning, as a distributed machine learning method, provides a new idea for data processing and model training in power grids. It not only helps to protect user data privacy, but also crosses the data barriers between different power grid entities to promote knowledge sharing and collaborative decision-making. However, in the special application scenario of power grids, federated learning also faces the problem of privacy protection. Although the original data of federated learning never leaves the local device during its training process, such as the power grid user-side device, it reduces the risk of data leakage at the source of the data. However, studies have shown that attackers can infer the original data information through model parameters. In practical applications, the privacy of power user data cannot be guaranteed. This shows that the existing federated learning scheme still has certain shortcomings in protecting the privacy of power users. Therefore, how to solve the privacy protection problem in federated learning has become an urgent problem to be solved in the current field of federated learning. Summary of the invention
[0003] Embodiments of the present invention provide a method, apparatus, terminal device and storage medium for secure federated learning of a power grid system, which can improve the security of federated learning of the power grid system.
[0004] An embodiment of the present invention provides a secure federated learning method for a power grid system, comprising:
[0005] Acquire the initial global model parameters of the central server of the power grid system, and send the initial global model parameters to all clients, so that each client that receives the initial global model parameters determines the local update parameters of the current client according to the initial global model parameters, and transmits the local update parameters to the central server;
[0006] After the central server receives the local update parameters transmitted by each client, the central server clusters each client according to the local update parameters transmitted by each client to obtain a number of cluster groups;
[0007] For each cluster grouping, a client is selected as a selected client;
[0008] Federated learning is performed based on selected clients and a central server.
[0009] Further, determining the local update parameters of the current client according to the initial global model parameters includes:
[0010] Calculate the gradient of the current client local model based on the initial global model parameters;
[0011] Add Gaussian noise to the gradient of the local model of the current client to generate a perturbation gradient, and update the local model of the current client according to the perturbation gradient to obtain the local model parameters of the current client;
[0012] The local update parameters of the current client are determined according to the initial global model parameters and the local model parameters.
[0013] Further, the step of calculating the gradient of the current client local model according to the initial global model parameters includes:
[0014] Get the local dataset of the current client and calculate the gradient of the local model of the current client based on the initial global model parameters and the local dataset.
[0015] Furthermore, after calculating the gradient of the current client local model according to the initial global model parameters and the local data set, it also includes:
[0016] The gradient of the current client local model is clipped according to the preset gradient clipping formula to obtain the clipped gradient of the current client local model.
[0017] Furthermore, the client terminals are clustered according to the local update parameters transmitted by the client terminals to obtain a number of cluster groups, including:
[0018] Clustering each client according to the local update parameters transmitted by each client to obtain a number of initial cluster groups;
[0019] Obtain the total amount of data of all clients included in each initial cluster group;
[0020] Initial cluster groups with the same total amount of data are merged to obtain several cluster groups.
[0021] Furthermore, the federated learning based on each selected client and central server includes:
[0022] Obtain the training rounds of federated learning, and repeatedly perform global model and local model parameter update operations between each selected client and the central server until the maximum training rounds are reached or the global model converges, completing the federated learning;
[0023] The global model and local model parameter updating operation includes:
[0024] Get the global model parameters of the current training round from the central server;
[0025] Send the global model parameters of the current training round to each selected client, so that after each selected client receives the global model parameters of the current training round, the local model of the current selected client is trained according to the local data set of the current selected client and the global model parameters of the current training round. After the local model training of the current selected client is completed, the local model parameters of the current training round are obtained, and the local model parameters of the current training round are fed back to the central server;
[0026] Calculate the local model update parameters of each selected client according to the local model parameters of the current training round of each selected client and the global model parameters of the current training round;
[0027] The global model update parameters are determined according to the local model update parameters of each selected client and the global model parameters of the current training round, and the global model update parameters are used as the global model parameters of the next training round.
[0028] Furthermore, after the local model training of the currently selected client is completed, the loss value of the current training round is obtained, and the loss value of the current training round is fed back to the central server;
[0029] After calculating the local model update parameters of each selected client according to the local model parameters of the current training round of each selected client and the global model parameters of the current training round, the method further includes:
[0030] Generate a first array in ascending order of loss values according to the loss values of the current training round of each selected client;
[0031] Update parameters of the local model of the current training round of each selected client, and generate a second array in the order of the cluster grouping to which the selected client belongs;
[0032] It is determined whether there is an internal conflict in the local model update parameters of each selected client according to the first array. If so, orthogonal projection of the corresponding local model update parameters is performed according to the first array and the second array to obtain the corrected local model update parameters of the current training round of each selected client.
[0033] Based on the above method embodiment, the present invention provides a corresponding device embodiment;
[0034] An embodiment of the present invention provides a secure federated learning device for a power grid system, including: a first federated learning module, a clustering module, and a second federated learning module;
[0035] The first federated learning module is used to obtain the initial global model parameters of the central server of the power grid system, and send the initial global model parameters to all clients, so that each client that receives the initial global model parameters determines the local update parameters of the current client according to the initial global model parameters, and transmits the local update parameters to the central server;
[0036] The clustering module is used to cluster the clients according to the local update parameters transmitted by the clients after the central server receives the local update parameters transmitted by the clients, so as to obtain a number of cluster groups; for each cluster group, select a client as the selected client;
[0037] The second federated learning module is used to perform federated learning based on each selected client and central server.
[0038] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method for secure federated learning of a power grid system described in the above-mentioned embodiment of the invention is implemented.
[0039] Another embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a secure federated learning method for a power grid system described in the above-mentioned embodiment of the invention.
[0040] The following beneficial effects are achieved by implementing the present invention:
[0041] The present invention provides a secure federated learning method, apparatus, terminal device and storage medium for a power grid system. The secure federated learning method obtains the initial global model parameters of a central server of the power grid system and sends the initial global model parameters to all clients, so that each client that receives the initial global model parameters determines the local update parameters of the current client according to the initial global model parameters, and transmits the local update parameters to the central server, thereby realizing initial federated learning of the central server of the power grid system and all clients associated with it, and then clustering each client according to the local update parameters transmitted by each client to obtain a plurality of cluster groups, and then selecting a client from each cluster group as a selected client, and performing federated learning based on each selected client and the central server. By clustering based on the local update parameters transmitted by each client, the clients in the resulting cluster grouping can have higher similarity characteristics, and then a client is selected to represent the cluster grouping for federated learning with the central server. This avoids the problem of client information leakage caused by attackers being able to reversely infer the original data information through model parameters when the existing technology directly conducts federated learning based on all clients and the central server. By clustering and then selecting a client, it can be ensured that when an attack is received, the information security of the remaining clients in the same cluster grouping is protected, thereby improving the federated learning security of the power grid system. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flow chart of a secure federated learning method for a power grid system provided in one embodiment of the present invention.
[0043] Figure 2 It is a schematic diagram of a secure federated learning framework for a power grid system provided in one embodiment of the present invention.
[0044] Figure 3 This is an accuracy trend graph provided by an embodiment of the present invention.
[0045] Figure 4 This is a loss value trend graph provided by an embodiment of the present invention.
[0046] Figure 5 It is a structural diagram of a secure federated learning device for a power grid system provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0050] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0051] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0052] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0053] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).
[0054] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0055] In order to better understand the technical content of the present invention, we first explain the differential privacy related content in deep learning: In the initial deep learning, differential privacy can be deployed in the following three locations:
[0056] 1. Differential privacy is achieved by adding noise to the original data at the input data layer. Noise is added to the original data, and then the noisy data is used to train the neural network model. The disadvantage of this method is that the injection of noise may greatly damage the validity of the data, thereby affecting the performance and accuracy of the model.
[0057] 2. Implement differential privacy in the loss function layer, that is, implement differential privacy by adding noise to the loss function using a function mechanism. While increasing privacy protection, this method processes the data by truncating the Taylor expansion of the loss function, which can lead to a decrease in prediction accuracy.
[0058] 3. Implement differential privacy in the gradient layer, that is, implement differential privacy by adding noise to the gradient during the gradient descent process. This method can protect privacy and maintain data validity to a certain extent, but it is necessary to select appropriate noise parameters to achieve a balance between privacy protection and model accuracy. Currently, adding noise to the gradient is widely used.
[0059] like Figure 1 As shown, a secure federated learning method for a power grid system provided by an embodiment of the present invention includes:
[0060] Step S1: Acquire the initial global model parameters of the central server of the power grid system, and send the initial global model parameters to all clients, so that each client that receives the initial global model parameters determines the local update parameters of the current client according to the initial global model parameters, and transmits the local update parameters to the central server;
[0061] Step S2: After the central server receives the local update parameters transmitted by each client, the central server clusters each client according to the local update parameters transmitted by each client to obtain a number of cluster groups;
[0062] Step S3: For each cluster group, select a client as a selected client;
[0063] Step S4: Perform federated learning based on each selected client and the central server.
[0064] For step S1, Figure 2 The figure shows a schematic diagram of the structure of a power grid system provided by the present invention. The power grid system includes a central server and several clients. Each central server includes a global model, and each client includes a local model, that is, a local model of the client. The global model of the central server is initialized to obtain an initialized global model of the central server, and the initial global model parameter ω is obtained from the initialized global model. 0 . Set the initial global model parameter ω 0 Each client receives the initial global model parameter ω 0 The client, according to the initial global model parameter ω 0 Determine the local update parameters of the client itself.
[0065] In a preferred embodiment, the method of determining the local update parameters of the current client based on the initial global model parameters includes: calculating the gradient of the local model of the current client based on the initial global model parameters; adding Gaussian noise to the gradient of the local model of the current client to generate a perturbation gradient, and updating the local model of the current client based on the perturbation gradient to obtain the local model parameters of the current client; and determining the local update parameters of the current client based on the initial global model parameters and the local model parameters.
[0066] In a preferred embodiment, the step of calculating the gradient of the local model of the current client according to the initial global model parameters includes: obtaining a local data set of the current client, and calculating the gradient of the local model of the current client according to the initial global model parameters and the local data set.
[0067] Specifically, for each client, after receiving the initial global model parameter ω 0Afterwards, the local data set of the client is obtained. In the present invention, the client mainly refers to the user-side device of the power grid system. The local data set may include user power consumption data, device status data and smart meter data collected by the user-side device; wherein the user power consumption data may include power consumption, power consumption time and power consumption mode, etc., the device status data may include device rated voltage, rated current, rated power, device real-time operation status and historical fault records, etc., and the smart meter data may include real-time voltage, real-time current, real-time power and historical power consumption data, etc. After the model parameters of the local model of the client are updated according to the initial global model parameters of the client, the local model is locally trained with the local data set of the client. Exemplarily, a local model for device status classification is trained with the device status data in the local data set. In each iterative training, the real-time operation status, rated voltage, rated current and rated power of the device are used as input, and the device status classification is used as output, thereby training a device status classification model. The device status classification includes normal operation, abnormal operation and failure.
[0068] In addition, during training, the gradient of the loss function of the current local model with respect to the model parameters is calculated through the local data set. The gradient calculation is expressed as:
[0069]
[0070] Among them, x is the training sample of the local model, each training sample x∈S; ω is the local model parameter; b is the batch size; l(ω; x) represents the loss function of the local model.
[0071] In a preferred embodiment, after calculating the gradient of the current client local model according to the initial global model parameters and the local data set, it also includes: clipping the gradient of the current client local model according to a preset gradient clipping formula to obtain the clipped gradient of the current client local model.
[0072] Specifically, the gradient of the loss function of the current local model with respect to the model parameters is clipped according to the preset gradient clipping formula to obtain the clipped gradient of the current client local model The steps of clipping the gradient of the loss function of the current local model with respect to the model parameters according to the preset gradient clipping formula include calculating the L2 norm of the gradient, determining the clipping threshold, calculating the scaling factor, and applying clipping. When calculating the L2 norm of the gradient, first calculate the gradient of the loss function with respect to the model parameters. The L2 norm (i.e., Euclidean norm) of is expressed as Compare the L2 norm of the gradient to the clipping threshold C, where the clipping threshold C is a pre-set value that controls the maximum allowed size of the gradient. Calculate the scaling factor The effect of this scaling factor is that if the L2 norm of the gradient exceeds the clipping threshold C, the scaling factor is greater than 1, otherwise it is 1. Divide by the scaling factor to get the clipped gradient If the L2 norm of the original gradient exceeds C, the size of the gradient is reduced by dividing by a number greater than 1; if the L2 norm of the original gradient does not exceed C, the gradient remains unchanged. In this way, gradient clipping ensures that the size of the gradient vector does not exceed the preset threshold C, which helps prevent the gradient explosion problem and improves the stability of model training. The preset gradient clipping formula is as follows:
[0073]
[0074] in, is the L2 norm of the gradient; the clipped gradient Will be used to update the model parameters. The key to this formula is that when the L2 norm of the gradient is greater than the threshold C, the gradient is scaled to C. In this way, the size of the clipped gradient will not exceed C. By limiting the size of the gradient, the model can be trained while protecting privacy.
[0075] It should be noted that when differential privacy is applied in deep learning, in order to limit the size of the gradient, it is usually necessary to clip the noisy gradient. This is because gradients that are too large or too small may have an adverse effect on model training. The size of the noise in differential privacy is determined by the privacy budget ∈ and the size of the dataset, so a balance needs to be struck between the gradient and the noise size. Too large a gradient leads to relatively small noise, which may affect the differential privacy effect and cause the model to overfit; too small a gradient increases the proportion of noise, making the model training slow or even unable to converge. Therefore, through gradient clipping, the gradient size can be ensured to be moderate, while ensuring the effectiveness of differential privacy and the stability of model training.
[0076] Calculate the privacy budget ∈ according to the current client's data volume i ,in, ∈ i is the privacy budget of client i. In deep learning, model training requires many rounds of iterations, and each round of iteration requires a portion of the privacy budget to be allocated. Suppose there are t rounds of training, and ∈ is evenly divided into each round, then ∈=∈ 1 +∈ 2 +∈ 3 +…+∈ t ; Δf is the sensitivity. The larger the amount of data on the client, the smaller the sensitivity. σ represents the standard deviation of the noise.
[0077] It should be noted that the above privacy budget allocation method makes the training effect of the model closely related to the preset round t. If t is set too large, the privacy budget allocated in each round will be relatively small, which may affect the convergence of the model. If t is set too small, there are too few training rounds and the model training is not optimal. In addition, according to the law of gradient descent, at the beginning of training, the gradient is large and the global sensitivity to noise is small; as the number of training rounds increases, the change in gradient becomes smaller, and a little noise will have a great impact on it. Therefore, during the model training process, the privacy budget should be gradually increased, rather than evenly divided.
[0078] Add Gaussian noise N(0,σ 2 ) generates the perturbation gradient and obtains:
[0079]
[0080] The local model of the client is updated according to the perturbation gradient to obtain the local model parameters of the client, which are expressed as:
[0081]
[0082] Among them, η is the step size.
[0083] The local update parameters of the current client are determined according to the initial global model parameters and local model parameters, which are expressed as:
[0084]
[0085] Among them, Δω i Represents the local update parameters of client i.
[0086] Each client updates the local parameter Δω i Sent to the central server.
[0087] In step S2, the central server receives the local update parameter Δω uploaded by each client. i After that, the local update parameter Δω is uploaded by each client. i Perform clustering and obtain several cluster groups.
[0088] In a preferred embodiment, the method of clustering each client according to the local update parameters transmitted by each client to obtain a number of cluster groups includes: clustering each client according to the local update parameters transmitted by each client to obtain a number of initial cluster groups; obtaining the total amount of data of all clients included in each initial cluster group; merging initial cluster groups with the same total amount of data to obtain a number of cluster groups.
[0089] Specifically, according to the local update parameter Δω transmitted by each client i Clustering is performed as the feature input of hierarchical clustering to obtain C initial cluster groups and the total amount of data Num owned by all clients contained in each initial cluster group j ,j={1,2,3,…,C}. Group the C initial clusters according to their total data Num j Arrange in descending order, and merge the C initial cluster groups into m cluster groups according to the rule that the total amount of data in each class is the same.
[0090] In step S3, for each cluster group, a client is selected as the selected client. Preferably, before selecting the client, the probability p of the client being selected in each cluster group is calculated. k In each cluster grouping, according to the probability p k Extract 1 client, and extract m clients in total, and use these m clients as selected clients.
[0091] For step S4, federated learning is performed based on the m selected clients and the central server.
[0092] In a preferred embodiment, the federated learning based on each selected client and the central server includes: obtaining the training round of federated learning, repeatedly performing global model and local model parameter update operations between each selected client and the central server until the maximum training round is reached or the global model converges, and the federated learning is completed; wherein the global model and local model parameter update operations include: obtaining the global model parameters of the current training round of the central server; sending the global model parameters of the current training round to each selected client, so that each selected client receives the global model parameters of the current training round, and updates the local model parameters according to the local The local model of the currently selected client is trained using the data set and the global model parameters of the current training round. After the local model training of the currently selected client is completed, the local model parameters of the current training round are obtained, and the local model parameters of the current training round are fed back to the central server. The local model update parameters of each selected client are calculated based on the local model parameters of the current training round of each selected client and the global model parameters of the current training round. The global model update parameters are determined based on the local model update parameters of each selected client and the global model parameters of the current training round, and the global model update parameters are used as the global model parameters of the next training round.
[0093] In a preferred embodiment, after the local model training of the currently selected client is completed, it also includes obtaining the loss value of the current training round and feeding back the loss value of the current training round to the central server; after calculating the local model update parameters of each selected client according to the local model parameters of the current training round of each selected client and the global model parameters of the current training round, it also includes: generating a first array in the order of loss values from small to large according to the loss values of the current training round of each selected client; generating a second array in the order of cluster grouping to which the selected clients belong according to the local model update parameters of the current training round of each selected client; determining whether there is an internal conflict in the local model update parameters of each selected client according to the first array, and if so, performing orthogonal projection of the corresponding local model update parameters according to the first array and the second array to obtain the corrected local model update parameters of the current training round of each selected client.
[0094] Specifically, the privacy budget ∈ of each selected client is determined according to the amount of data of each selected client. ′ i , set the local data of each selected client to D = [D 1 ,…,D n ], the loss function is l(ω; x), the clipping threshold C, the learning rate η, and the training rounds T. According to the above-mentioned set parameters, federated learning is performed between each selected client and the central server, that is, the global model and local model parameter update operations are repeatedly performed between each selected client and the central server to realize the federated training of each local model and the global model. When the maximum training rounds are reached or the global model converges, the federated learning is completed, and the model parameters of the global model at the time of convergence are obtained.
[0095] During the iterative training process of a training round, the global model parameter ω of the current training round t of the central server is obtained t , and ω t For each selected client, upon receiving ω t After that, the local model of the selected client is trained by the gradient descent method using their respective local data. During the training process, the gradient of the loss function with respect to the model parameters is first calculated using the local data set. Then the gradient is clipped according to the preset gradient clipping formula to prevent the gradient from being too large and affecting the availability of the data. i , add the corresponding Gaussian noise N(0,σ 2 ) perturbs the gradient, and obtains Before adding the corresponding Gaussian noise, it is necessary to determine the privacy budget ∈ ′iAfter that, the sum of the privacy budget added during the training process is compared with the set total privacy budget. If it is greater than the total privacy budget, noise of the remaining privacy budget size is added, and no noise is added in subsequent training. After the local data iterative training is completed, the local model parameters of the tth round are obtained. and the value of the loss function at round t And the local model parameters of the tth round and the value of the loss function at round t Sent to the central server.
[0096] The central server calculates the local model update parameters of each selected client in round t, and the calculation is shown as follows:
[0097]
[0098] in, represents the local model update parameters of the i-th selected client in the t-th round;
[0099] Generate the second array W in the order of the cluster groups to which the selected clients belong:
[0100]
[0101] In order of corresponding loss value from small to large, Stored in the first array WO.
[0102]
[0103] Order examine Is it established, that is and Is there a conflict between From WO and i≠i j ,like If established, it means and There is an internal conflict between Perform orthogonal projection to alleviate internal conflicts. Will As the modified local model update parameter. Calculate the sum of the modified local model update parameters WD t To scale, The central server updates the global model parameters ω t+1 =ω t -WD t .
[0104] It should be added that in order to analyze the impact of adding differential privacy on the accuracy and fairness of the federated learning method (FedDPFS algorithm) of the present invention, for the MNIST dataset, noise with different privacy budget sizes is added to observe its impact on the accuracy and fairness of the FedDPFS algorithm. When different privacy budgets are set, the accuracy change trend of the FedDPFS algorithm on the test set is as follows: Figure 3 As shown in the figure, the accuracy change curve of the FedCSGP algorithm on the MNIST dataset is obtained without adding noise and the other parameters are set the same as the FedCSGP algorithm. It can be seen from the figure that as the privacy budget increases, the added noise decreases, the corresponding FedDPFS algorithm accuracy improves, and the number of training rounds required for the global model to begin to converge becomes less. Compared with the trend chart of the FedCSGP algorithm, it can be seen that adding noise will affect the accuracy of the model, and as the privacy budget increases, the impact on the model becomes smaller. The loss value change trend of the FedDPFS algorithm on the test set is shown in the figure. Figure 4 As shown in the figure, after adding differential privacy, the rate of decrease of the loss value slows down, and more rounds of model iterations are required to start convergence. The larger the privacy budget, the faster the loss value decreases. Therefore, in practical applications, a privacy budget value that achieves a balance can be selected based on the accuracy of the model and the need for privacy protection. The fairness-related performance indicators of the FedDPFS algorithm on the MNIST dataset are shown in the following table. From the value of the variance Var(ω), it can be concluded that after adding differential privacy, the fairness of the algorithm is affected to a certain extent, but from the perspective of numerical changes, the fairness of the FedDPFS algorithm is less affected by differential privacy. Therefore, in practical applications, a balanced value that guarantees fairness and protects privacy security can be found, thereby adding corresponding noise to achieve a balance between accuracy, fairness and privacy protection.
[0105] Performance Indicators FedDPFS_0.7 FedDPFS_0.8 FedAvg FedCSGP Var(ω) 0.0013 0.0011 0.0008 0.0006 Minimum accuracy 0.6632 0.7021 0.8667 0.8696 Highest accuracy 1 1 1 1 Average accuracy 0.8183 0.8621 0.9752 0.9770 The best 5% 0.8932 0.9041 1 1 Worst 5% 0.7962 0.8058 0.8921 0.9051
[0106] For the CIFAR-10 dataset, noise with the same privacy budget is added to the four algorithms to analyze the impact of adding noise on the accuracy and fairness of the FedDPFS algorithm. Federated Averaging Algorithm (FedAvg), Federated Learning with Fair Averaging (FedFV), and Clustered_Sampling algorithms are recorded as DPFedAvg, DPFedFV, and DPClustered_Sampling algorithms after adding differential privacy. The following table shows the fairness-related indicators of the four algorithms FedDPFS, DPFedAvg, DPFedFV, and DPClustered_Sampling on the CIFAR-10 dataset. It can be seen from the results in the table that although the variance Var(ω) of the Clustered_Sampling algorithm is the lowest, its maximum accuracy, average accuracy, and are all much lower than those of the FedDPFS algorithm. From the perspective of variance Var(ω) alone, the FedDPFS algorithm does not have an advantage, but considering the highest accuracy, average accuracy, and the accuracy of the best 5% of clients, the FedDPFS algorithm's index results are significantly higher than the other three algorithms, and its variance is only 0.03-0.06 lower than the DPFedAvg and DPFedFV algorithms. Therefore, it can be concluded that the FedDPFS algorithm can protect privacy and security while ensuring the accuracy and fairness of the global model.
[0107] Performance Indicators FedDPFS DPFedAvg DPFd DPClustered_Sampling Var(ω) 0.0393 0.0364 0.0330 0.0186 Minimum accuracy 0 0 0 0 Highest accuracy 0.9958 0.8088 0.6296 0.6818 Average accuracy 0.0587 0.1433 0.1631 0.1613 The best 5% 0.8611 0.7523 0.5862 0.4985 Worst 5% 0 0 0 0
[0108] To sum up, in practical applications, we can select an appropriate privacy budget based on the requirements for algorithm fairness, accuracy, and privacy security, so that the FedDPFS algorithm can achieve a balance between accuracy, fairness, and privacy protection.
[0109] Based on the above method embodiment, the present invention provides a corresponding device embodiment.
[0110] like Figure 5 As shown, an embodiment of the present invention provides a secure federated learning device for a power grid system, comprising: a first federated learning module, a clustering module, and a second federated learning module;
[0111] The first federated learning module is used to obtain the initial global model parameters of the central server of the power grid system, and send the initial global model parameters to all clients, so that each client that receives the initial global model parameters determines the local update parameters of the current client according to the initial global model parameters, and transmits the local update parameters to the central server;
[0112] The clustering module is used to cluster the clients according to the local update parameters transmitted by the clients after the central server receives the local update parameters transmitted by the clients, so as to obtain a number of cluster groups; for each cluster group, select a client as the selected client;
[0113] The second federated learning module is used to perform federated learning based on each selected client and central server.
[0114] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0115] Those skilled in the art can clearly understand that for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0116] Based on the above method item embodiments, the present invention provides corresponding terminal device item embodiments.
[0117] An embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a secure federated learning method for a power grid system as described in any one of the present invention is implemented.
[0118] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0119] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0120] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0121] Based on the above method item embodiments, the present invention provides a corresponding storage medium item embodiment.
[0122] An embodiment of the present invention provides a storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a secure federated learning method for a power grid system as described in any one of the present inventions.
[0123] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium.
[0124] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A secure federated learning method for a power grid system, characterized in that: include: Acquire the initial global model parameters of the central server of the power grid system, and send the initial global model parameters to all clients, so that each client that receives the initial global model parameters determines the local update parameters of the current client according to the initial global model parameters, and transmits the local update parameters to the central server; After the central server receives the local update parameters transmitted by each client, the central server clusters each client according to the local update parameters transmitted by each client to obtain a number of cluster groups; For each cluster grouping, a client is selected as a selected client; Federated learning is performed based on selected clients and a central server.
2. A secure federated learning method for a power grid system as claimed in claim 1, characterized in that: Determining the local update parameters of the current client according to the initial global model parameters includes: Calculate the gradient of the current client local model based on the initial global model parameters; Add Gaussian noise to the gradient of the local model of the current client to generate a perturbation gradient, and update the local model of the current client according to the perturbation gradient to obtain the local model parameters of the current client; The local update parameters of the current client are determined according to the initial global model parameters and the local model parameters.
3. A secure federated learning method for a power grid system as claimed in claim 2, characterized in that: The step of calculating the gradient of the current client local model according to the initial global model parameters includes: Get the local dataset of the current client and calculate the gradient of the local model of the current client based on the initial global model parameters and the local dataset.
4. A secure federated learning method for a power grid system as claimed in claim 3, characterized in that: After calculating the gradient of the current client local model based on the initial global model parameters and the local dataset, it also includes: The gradient of the current client local model is clipped according to the preset gradient clipping formula to obtain the clipped gradient of the current client local model.
5. A secure federated learning method for a power grid system as claimed in claim 1, characterized in that: The client terminals are clustered according to the local update parameters transmitted by the client terminals to obtain a number of cluster groups, including: Clustering each client according to the local update parameters transmitted by each client to obtain a number of initial cluster groups; Obtain the total amount of data of all clients included in each initial cluster group; Initial cluster groups with the same total amount of data are merged to obtain several cluster groups.
6. A secure federated learning method for a power grid system as claimed in claim 1, characterized in that: The method of performing federated learning based on each selected client and the central server includes: Obtain the training rounds of federated learning, and repeatedly perform global model and local model parameter update operations between each selected client and the central server until the maximum training rounds are reached or the global model converges, completing the federated learning; The global model and local model parameter updating operation includes: Get the global model parameters of the current training round from the central server; Send the global model parameters of the current training round to each selected client, so that after each selected client receives the global model parameters of the current training round, the local model of the current selected client is trained according to the local data set of the current selected client and the global model parameters of the current training round. After the local model training of the current selected client is completed, the local model parameters of the current training round are obtained, and the local model parameters of the current training round are fed back to the central server; Calculate the local model update parameters of each selected client according to the local model parameters of the current training round of each selected client and the global model parameters of the current training round; The global model update parameters are determined according to the local model update parameters of each selected client and the global model parameters of the current training round, and the global model update parameters are used as the global model parameters of the next training round.
7. A secure federated learning method for a power grid system as claimed in claim 6, characterized in that: After the local model training of the currently selected client is completed, the loss value of the current training round is obtained, and the loss value of the current training round is fed back to the central server; After calculating the local model update parameters of each selected client according to the local model parameters of the current training round of each selected client and the global model parameters of the current training round, the method further includes: Generate a first array in ascending order of loss values according to the loss values of the current training round of each selected client; Update parameters of the local model of the current training round of each selected client, and generate a second array in the order of the cluster grouping to which the selected client belongs; It is determined whether there is an internal conflict in the local model update parameters of each selected client according to the first array. If so, orthogonal projection of the corresponding local model update parameters is performed according to the first array and the second array to obtain the corrected local model update parameters of the current training round of each selected client.
8. A secure federated learning device for a power grid system, characterized in that: include: A first federated learning module, a clustering module, and a second federated learning module; The first federated learning module is used to obtain the initial global model parameters of the central server of the power grid system, and send the initial global model parameters to all clients, so that each client that receives the initial global model parameters determines the local update parameters of the current client according to the initial global model parameters, and transmits the local update parameters to the central server; The clustering module is used to cluster the clients according to the local update parameters transmitted by the clients after the central server receives the local update parameters transmitted by the clients, so as to obtain a number of cluster groups; for each cluster group, select a client as the selected client; The second federated learning module is used to perform federated learning based on each selected client and central server.
9. A terminal device, characterized in that: It comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a secure federated learning method for a power grid system as described in any one of claims 1 to 7 is implemented.
10. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a secure federated learning method for a power grid system as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Federal learning method and system
CN114781545A
Client selection method, system and device in federated learning and storage medium
CN115600691A
Personalized federal learning method and system based on adaptive clustering layering
CN115840900A