Federal learning method for intelligent power grid data protection

By generating a data sample with a distance of less than the threshold from the local electricity consumption data, combined with the aggregation model to detect anomalies and dynamic aggregation technology, the balance of privacy protection and model efficiency in smart grid data protection is solved, preventing malicious attacks and improving federated learning efficiency.

CN119862942AActive Publication Date: 2025-04-22INNER MONGOLIA RUIYANG INTELLIGENT TECHNOLOGY CO LTD

Patent Information

Application Number
CN202510349287.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-04-22
Estimated Expiration
2045-03-24

AI Technical Summary

Technical Problem

Existing smart grid data protection technologies are difficult to balance between privacy protection and model efficiency, and there is a risk of malicious smart meter attacks.

Method used

Generative model is used to generate data samples whose distance from local electricity consumption data is less than the threshold for local training, and abnormal smart meter is detected through the aggregation model, and combined with attention dynamic aggregation technology to improve the convergence speed of the global model.

Benefits of technology

It effectively improves the privacy protection capabilities of smart grid data, prevents malicious attacks, and improves the efficiency of federated learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862942A_ABST
    Figure CN119862942A_ABST
Patent Text Reader

Abstract

The invention provides a federal learning method for intelligent power grid data protection. A central server issues an initialized neural network model to a plurality of intelligent electric meters; each intelligent electric meter generates a data sample or local power consumption data by using a generative model for training, uploads trained model parameters and scoring indexes to a central server, performs aggregation detection on the trained model parameters and scoring indexes through an aggregation model, and determines an abnormal intelligent electric meter; the central server performs attention dynamic aggregation on all model parameters except the model parameters uploaded by the abnormal intelligent electric meter to obtain a global model, and judges whether the global model meets a preset training termination condition or not; if yes, training is ended, and the global model is used for predicting the electricity consumption; otherwise, issuing the global model serving as an initialized neural network model to the plurality of intelligent electric meters, and returning to execute the step 2; and the federal learning efficiency is improved while the data privacy protection capability of the smart power grid is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power grid data protection, and in particular to a federated learning method for smart grid data protection. Background Art

[0002] Smart grid is a new type of grid based on the physical grid of various power generation equipment, power transmission and distribution networks, power consumption equipment and energy storage equipment. It integrates advanced sensor measurement technology, network technology, communication technology, computing technology, automation and intelligent control technology with the physical grid. The precise control of power resources is mainly based on the effective prediction of power consumption and energy consumption by the collected power data training model, so as to control the power generation strategy of the power generation end to achieve the supply balance of the power system.

[0003] The existing smart grid data is protected by the traditional federated learning framework, but the traditional federated learning framework still has the following limitations when all parties learn together: (1) During operation, a large amount of user electricity consumption data will be collected and processed. This data involves the user's electricity consumption habits, life patterns and other personal privacy. Attackers can bypass traditional privacy protection mechanisms through model inversion attacks or infer part of the original data by analyzing the model's more detailed results. If this data is leaked or abused, it will cause serious damage to the user's privacy rights; (2) If too many privacy protection mechanisms are added, such as differential privacy or homomorphic encryption, the accuracy of the model will decrease, communication efficiency will decrease, and computational complexity will increase. (3) Malicious smart meters do not comply with the protocol and carry out poisoning attacks, which greatly reduces the efficiency of the global model. If the accuracy of the detection system is not high, it may lead to false positives and false negatives. Summary of the invention

[0004] The present invention provides a federated learning method for smart grid data protection, the purpose of which is to improve the efficiency of federated learning while improving the smart grid data privacy protection capability.

[0005] In order to achieve the above object, the present invention provides a federated learning method for smart grid data protection, comprising: Step 1: The central server sends the initialized neural network model to multiple smart meters; Step 2: Each smart meter generates data samples using the generative model, trains the initialized neural network model using the data samples or local electricity consumption data, and uploads the trained model parameters and scoring indicators to the central server; Step 3: The central server performs aggregate detection on the trained model parameters and scoring indicators through the aggregate model to determine the abnormal smart meter; In step 4, the central server dynamically aggregates all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model, and determines whether the global model meets the preset training termination condition; if so, the training ends and the global model is used to predict the power consumption; otherwise, the global model is sent to multiple smart meters as the initialized neural network model, and returns to step 2.

[0006] Further, the generative model includes a generator and a discriminator; Use the generator to transform the noise and class labels to synthesize data samples; The distance between the data sample and the local electricity consumption data is determined by the discriminator. If the distance is greater than a preset threshold, the generator is reused to synthesize the data sample until the distance is less than the preset threshold, and the data sample is used as the data sample.

[0007] Specifically, the distance between the data sample and the local electricity consumption data is calculated as: in, Represents the distribution of data samples Distribution of local electricity consumption data The distance between represents the infimum, which is the smallest upper bound, Represents the distribution of data samples Distribution of local electricity consumption data For all possible joint distributions, express The joint distribution of In the joint distribution Next, randomly select a pair of samples The expected value of the distance, Indicates local electricity consumption data. Represents a data sample.

[0008] More specifically, step 3 includes: The central server treats all model parameters uploaded in each round as a point through the pruned DBScan model and sets the clustering radius; Determine whether the distance between each two adjacent points is less than the cluster radius. When the distances are all less than the cluster radius, it is determined that there are no abnormal smart meters in this training. When the distance is greater than the cluster radius, the smart meters corresponding to the points greater than the cluster radius are regarded as abnormal smart meters.

[0009] Furthermore, the calculation expression of the cluster radius is: in, represents the cluster radius, represents the number of smart meters, Indicates Model parameters for training smart meters With Model parameters for training smart meters The distance between.

[0010] Furthermore, the central server dynamically aggregates all model parameters except those uploaded by abnormal smart meters to obtain a global model, including: When the model parameters other than the model parameters uploaded by the abnormal smart meter are dynamically aggregated for the first time, all model parameters other than the model parameters uploaded by the abnormal smart meter are averaged to generate a global model; When attention is dynamically aggregated for all model parameters except the model parameters uploaded by abnormal smart meters for the first time, all model parameters except the model parameters uploaded by abnormal smart meters are weightedly aggregated by calculating the lift ratio and inverse weight of each smart meter to obtain a global model.

[0011] To go further, the expression for calculating the improvement ratio of each smart meter is: in, Indicates Smart meters in The improvement ratio of the round, Indicates Smart meters in Model improvement for each round.

[0012] Specifically, the expression for calculating the inverse weight of each smart meter is: in, Indicates The inverse weight of a smart meter, Indicates The average distance between the model parameters uploaded by a smart meter and all model parameters in the previous round.

[0013] Furthermore, the calculation expression for weighted aggregation of all model parameters except the model parameters uploaded by abnormal smart meters is: in, Indicates The model parameters of the global model obtained in the round, represents the attention weight, Indicates the number of abnormal smart meters, Indicates the newly added smart meter. Indicates Smart meters in Model parameters for epoch training.

[0014] Furthermore, the preset training termination conditions include: When the training rounds reach the maximum rounds, stop training; When The training round uses data samples, The training round uses local electricity consumption data, and the The evaluation index after round training is greater than that of the first When the evaluation index after the round of training reaches 0, stop training; When the global model converges to the expected level, stop training; When the local electricity consumption data is used for several consecutive rounds of training, the training is stopped.

[0015] The above scheme of the present invention has the following beneficial effects: The present invention sends the initialized neural network model to multiple smart meters through a central server; each smart meter generates data samples using a generation model, and trains the initialized neural network model through the data samples or local electricity consumption data, and uploads the trained model parameters and scoring indicators to the central server; the central server performs aggregation detection on the trained model parameters and scoring indicators through an aggregation model to determine abnormal smart meters; the central server performs dynamic aggregation of attention on all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model, and determines whether the global model meets the preset training termination condition; if so, the training is terminated and the The global model is used to predict electricity consumption; otherwise, the global model is sent to multiple smart meters as an initialized neural network model, and the process returns to step 2. Compared with the prior art, the present invention generates data samples whose distance from local electricity consumption data is less than a threshold through a generation model for local training, and performs aggregation detection on the trained model parameters and scoring indicators through an aggregation model to determine abnormal smart meters, prevent malicious smart meters from attacking local electricity consumption data, and effectively improve the privacy protection capability of smart grid data. At the same time, by dynamically aggregating attention to all model parameters, the convergence speed of the global model is improved, thereby improving the efficiency of federated learning.

[0016] Other beneficial effects of the present invention will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A schematic diagram of a flow chart of an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the federated learning framework in an embodiment of the present invention; Figure 3 It is a schematic diagram of the structure of the generation model in the embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, the following will be described in detail with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than 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.

[0019] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0020] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installation", "connection" and "connection" should be understood in a broad sense, for example, it can be a locking 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, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0021] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0022] In view of the existing problems, the present invention provides a federated learning method for smart grid data protection.

[0023] In an embodiment of the present invention, the framework of federated learning includes: a central server and multiple local clients; The federated learning process is as follows: the local smart meter is used as the local client in the federated learning. In the embodiment of the present invention, the smart meter is used to collect local electricity consumption data or generate data samples using the generation model, and the local electricity consumption data or data samples are used to train the initialized neural network model sent by the central server to obtain a local model, and the model parameters of the local model are uploaded to the central server; In the embodiment of the present invention, the central server in the federated learning can be a computing device such as a desktop computer, a notebook, a PDA, a server, a server cluster, and a cloud server, which is used to construct an initialized neural network model, perform aggregation detection on the trained model parameters and scoring indicators, and perform attention dynamic aggregation on all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model; Finally, the user's electricity consumption is predicted through the global model, and the prediction result can be the user's electricity consumption in the future or the user's electricity consumption during peak or low periods of electricity consumption.

[0024] like Figure 1 and Figure 2 As shown, an embodiment of the present invention provides a federated learning method for smart grid data protection, including: Step 1: The central server sends the initialized neural network model to multiple smart meters; Step 2: Each smart meter generates data samples using the generative model, trains the initialized neural network model using the data samples or local electricity consumption data, and uploads the trained model parameters and scoring indicators to the central server; Step 3: The central server performs aggregate detection on the trained model parameters and scoring indicators through the aggregate model to determine the abnormal smart meter; In step 4, the central server dynamically aggregates all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model, and determines whether the global model meets the preset training termination condition; if so, the training ends and the global model is used to predict the power consumption; otherwise, the global model is sent to multiple smart meters as the initialized neural network model, and returns to step 2.

[0025] Most preferably, Figure 3 As shown, the generative model includes a generator and a discriminator; Use the generator to transform the noise and class labels to synthesize data samples; The distance between the data sample and the local electricity consumption data is determined by the discriminator. If the distance is greater than a preset threshold, the generator is reused to synthesize the data sample until the distance is less than the preset threshold, and the data sample is used as the data sample.

[0026] In the embodiment of the present invention, in the process of generating data samples by the generation model, there are several constraints: Data generation efficiency limitation: Although each smart meter may have hardware heterogeneity, the data generation efficiency cannot be too low, which will affect the efficiency of model training and central server aggregation. Limitation of the amount of data generated: In traditional federated learning, different clients have very different amounts of data. In this case, different weights need to be assigned to different clients based on the amount of data they have, which increases the amount of computation. Therefore, it is necessary to limit the amount of data generated by each smart meter to be the same, so that the weight allocation problem caused by different amounts of data can be considered differently, reducing the computational pressure on the central server. Limitation on the amount of local electricity consumption data used: The amount of local electricity consumption data used for each smart meter must not be too low, resulting in insufficient information contained in the data sample.

[0027] In the embodiment of the present invention, the distance between the data sample and the local power consumption data is determined according to the objective function, and the expression of the objective function is: in, represents the discriminator, represents a generator, Indicates that the real data distribution The expected value under Representation Discriminator In the parameters Next input data The determination of the authenticity of Indicates the noise distribution The expected value under Representation Discriminator In the parameters The functional form is as follows, represents a data sample, Representation Generator In the parameters The following functional form.

[0028] Specifically, the embodiment of the present invention uses the Earth-Mover distance to measure the distance between the local power consumption data and the data sample. Even if the distribution of the two data does not overlap or the overlapping part is very small, it can still reflect the distance between the two data distributions. The calculation expression of the distance between the data sample and the local power consumption data is: in, Represents the distribution of data samples Distribution of local electricity consumption data The distance between represents the infimum, which is the smallest upper bound, Represents the distribution of data samples Distribution of local electricity consumption data For all possible joint distributions, express The joint distribution of In the joint distribution Next, randomly select a pair of samples The expected value of the distance, Indicates local electricity consumption data. Represents a data sample.

[0029] In the embodiment of the present invention, the model parameters received by the central server are recorded as , the rating index is ,The model parameters and scoring indicators received by the central server are saved in the parameter space of the central server.

[0030] In order to make the global model more accurate and prevent model attacks from malicious clients, the central server of the embodiment of the present invention uses the pruned DBScan model to detect whether any smart meter has uploaded abnormal model parameters after receiving the model parameters. The specific process includes: The central server treats all model parameters uploaded in each round as a point through the pruned DBScan model and sets the clustering radius; Determine whether the distance between each two adjacent points is less than the cluster radius. When the distances are all less than the cluster radius, it is determined that there are no abnormal smart meters in this training. When the distance is greater than the cluster radius, the smart meters corresponding to the points greater than the cluster radius are regarded as abnormal smart meters.

[0031] It should be noted that the DBScan algorithm is a density-based clustering algorithm, and the pruned DBScan model eliminates the initialization of the minimum number of points required to form a cluster, and only considers whether the newly uploaded parameters can be located within the clustering radius of other parameters.

[0032] Specifically, the calculation expression of the cluster radius is: in, represents the cluster radius, represents the number of smart meters, Indicates Model parameters for training smart meters With Model parameters for training smart meters The distance between.

[0033] In the embodiment of the present invention, when multiple smart meters upload model parameters to the central server for the first time, the cluster radius It is equal to the average distance between any two model parameters in the parameter space. After that, the clustering radius remains unchanged, which can reduce the amount of calculation of the central server. Secondly, each time a new model parameter is added to the parameter space, the range of the parameter space will become larger and larger, so there is no need to change the clustering radius. The value of .

[0034] Specifically, the central server dynamically aggregates all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model, including: When the model parameters other than the model parameters uploaded by the abnormal smart meter are dynamically aggregated for the first time, all model parameters other than the model parameters uploaded by the abnormal smart meter are averaged to generate a global model; When attention is dynamically aggregated for all model parameters except the model parameters uploaded by abnormal smart meters for the first time, all model parameters except the model parameters uploaded by abnormal smart meters are weightedly aggregated by calculating the lift ratio and inverse weight of each smart meter to obtain a global model.

[0035] In the embodiment of the present invention, when the central server first performs attention dynamic aggregation on all model parameters except the model parameters uploaded by the abnormal smart meter, the model parameters from each smart meter are simply averaged to generate new model parameters, and the model parameters are used as the model parameters of the global model to obtain the global model; When the central server dynamically aggregates all model parameters except the model parameters uploaded by the abnormal smart meter for the first time, the attention mechanism is used to aggregate the model parameters. The specific process is as follows: Assume that there are currently k smart meters undergoing round t aggregation; The model parameters and scoring indicators uploaded in the previous round of operation are recorded as and , No. wheel The model parameters and scoring indicators uploaded by the smart meters are marked as and ; No. In round 1, for smart meters, the model parameters of the previous round are , the scoring index is , the model parameters for this round are , the scoring index is ; In order to make the model parameter aggregation more reasonable and give more weight to smart meters with high accuracy, the model enhancement degree is introduced. The concept of Model improvement of smart meters The calculation method is: From the above formula, we can see that for the If a smart meter If it is greater than 1, it means that in this round of update, the overall effect is positive, otherwise it is negative; at the same time, in order to reflect the model improvement of the smart meter The relationship between the model improvement degree of other smart meters and the concept of improvement degree ratio are defined. In the tth round, the expression for calculating the improvement degree ratio of each smart meter is: in, Indicates Smart meters in The improvement ratio of the round, Indicates Smart meters in Model improvement of the round; The above formula can be used to calculate the ratio of the total model improvement of all smart meters ; Next, calculate the Parameters uploaded by smart meters With the previous The average distance of all model parameters in the wheel parameter space , assuming The total number of rounds is Parameters, average distance The calculation method is: right Smart meters simultaneously calculate the average distance get ,Then the weight of each smart meter based on all the average distances is calculated.

[0036] Different from the normal weight calculation method, the smaller the average distance is, the smaller the gap between the uploaded parameters and the aggregated model parameters is, that is, more weight should be assigned, so the inverse weight is used, based on ,get Smart meters simultaneously calculate the average distance The reciprocal of , so the expression for calculating the inverse weight of each smart meter is: in, Indicates The inverse weight of a smart meter, Indicates The average distance between the model parameters uploaded by a smart meter and all model parameters in the previous round.

[0037] The improvement ratio of k smart meters in round t is calculated. and the reciprocal weight After that, weighted aggregation begins, and the calculation expression for the t-th round of aggregation is: In the above formula, The summation is based on the aggregation of evaluation criteria, The summation is based on the summation of average distances, where The value of represents the weight given by the two aggregation methods. The value of is 0-1. , it means that the two aggregation methods have the same weight. In practical applications, if you value the improvement of model efficiency, you can use a larger If the convergence speed is important, a smaller value can be used. value.

[0038] After the aggregation is completed, the number of parameters in the parameter space needs to be changed , since there are a total of Normal model parameters are uploaded, all In the round .

[0039] The model parameters are aggregated by dynamic attention weighted aggregation. Without denying the role of any smart meter that transmits normal model parameters, the influence of malicious smart meters is excluded. The accuracy of each smart meter and the average distance from the previous parameters are also examined. This is more flexible and not only gives more weight to smart meters with good effects and less weight to smart meters with poor effects, but also allows choices between model accuracy and convergence speed.

[0040] When uploading model parameters, there may be abnormal smart meters uploading model parameters and smart meters that did not participate in the previous round. At this time, the aggregation method will change. An abnormal smart meter uploaded the model parameters. A smart meter rejoins or joins training for the first time. The abnormal smart meters uploaded the model parameters, set their model improvement MLD and average distance is 0, the calculated lift percentage And weight If it is 0, it will not be considered in the calculation The role of an abnormal smart meter. If a smart meter is added, the calculation of model improvement MLD is set. Replaced with the value of the previous round of participation, average distance With weight The calculation method of does not change. Therefore, the calculation expression for weighted aggregation of all model parameters except the model parameters uploaded by abnormal smart meters in the tth round is: in, Indicates The model parameters of the global model obtained in the round, represents the attention weight, Indicates the number of abnormal smart meters, Indicates the newly added smart meter. Indicates Smart meters in Model parameters for epoch training.

[0041] In the embodiment of the present invention, after each aggregation, the central server compares the current model with the previously saved optimal global model. If the model effect is better than the previously saved optimal global model, the optimal global model is replaced by this model and the model parameters and model evaluation indicators are saved.

[0042] After completing one round of learning, the next round of learning begins. The following are the complete steps in one round in the federated learning system: Each smart meter receives the global model sent by the central server; Each smart meter uses data samples or local electricity consumption data to train the global model and obtain new model parameters and evaluation indicators; The smart meter uploads the model parameters and evaluation indicators to the parameter space, and the central server receives them; The central server uses the pruned DBScan model to detect whether there are outliers in the model parameters. If there are outliers, the role of this smart meter will not be considered during aggregation; The central server calculates the model improvement MLD and improvement percentage of each smart meter in this round of training , the average distance , weight ; Perform attention dynamic aggregation according to the above formula to obtain the global model; In the federated learning system, the above process will be repeated for multiple rounds until the global model reaches the predetermined training termination condition.

[0043] Specifically, the preset training termination conditions include: The central server will send the batch of data used in each round of training to each smart meter. The smart meter will calculate the maximum number of rounds it can accept based on this data. The amount of local electricity consumption data owned by a smart meter is Max, and the maximum number of rounds it can accept is , the central server receives the maximum round of each smart meter and selects the final running round as , so when the training round reaches the maximum round, stop training; Secondly, in order to save computing resources and prevent privacy leakage, the model stops running early when the following conditions are met: When The training round uses data samples, The training round uses local electricity consumption data, and the The evaluation index after round training is greater than that of the first When the evaluation index is reached after a round of training, the training is stopped. This result shows that the effect of using the data sample is better than the local electricity consumption data. In order to avoid privacy leakage caused by using local electricity consumption data in subsequent training, the operation is terminated in advance; When the global model converges to the expected degree, the training stops, and the expected degree is jointly determined by all smart meters; The concept of privacy budget Pr is introduced. When the local electricity consumption data is used for several consecutive rounds of training, the training is stopped. Assuming Pr=0.2, when the consecutive rounds of training are When all rounds of training use local electricity data, the training is stopped in advance. The benefit of this setting is that it can protect privacy in anticipation and avoid using too much local electricity data and leaking too much user information. At the same time, the introduction of the privacy budget Pr can make federated learning more flexible. If higher accuracy is required, a larger Pr value can be set; if the accuracy is relatively satisfied, a smaller Pr value can be set to reduce privacy leakage.

[0044] In the embodiment of the present invention, the smart meter determines whether to use local electricity consumption data for training based on the data sent back by the central server. The determination process is as follows: In the first round of training, each smart meter is set to use the generative model and noise to generate data samples. In the second round of training, the generative model is still used to generate data samples. Different from the first round of training, the discriminator in the generative model uses the optimal model learned in the federated learning system. This has the following advantages: 1. Improve discrimination efficiency and accuracy: As a discriminator, the global model can make full use of the global knowledge in federated learning to learn and extract features from the data collected by multiple smart meters, thereby having stronger discrimination capabilities. Compared with the discriminator of a single smart meter, the global model can process more diverse data and improve discrimination efficiency and accuracy; 2. Optimize the training process: The global model, as a discriminator, can perform more efficient interaction and adversarial training with the generators of other smart meters; 3. Improve the generalization ability of the model: The global model learns from the data of multiple smart meters, and the generated data is more diversified, has better adaptability in different scenarios, and has stronger generalization ability.

[0045] In addition, in order to further improve the effect of the generator, when deciding to use data samples in the future, the discriminator in the generative model needs to be replaced with the optimal model in the previous round of federated learning system.

[0046] Although the data samples contain a lot of content in the original data, there are more or less differences between them and the local electricity consumption data. In this case, a mechanism is needed to determine when to use local land use data and when to use data samples.

[0047] In order to further combine federated learning and generative models, the following mechanism is proposed: In the first round of federated learning training, the optimal global model is obtained, and the central server can record The scoring index of a smart meter is At the same time, the scoring index of the global model is set to , since this is the first round of training, Just a simple Take average.

[0048] The second round of training still uses data samples. At this time, the discriminator in the generative model is the global model. In the federated learning of the second round of training, the optimal global model is obtained. The central server can record The scoring index of a smart meter is The scoring metric of the global model is set to .

[0049] The mechanism is set up as follows: Determining whether to use local electricity consumption data or data samples can be done by comparing and is determined by the size relationship between them. The calculation method of The calculation of is obtained through the scoring index of each smart meter; calculate Smart meters compared to local scoring indicators in the previous round The relative change of , among which The scoring index increment and algorithm of each smart meter are as follows: From the above formula, we can get Smart meters The relative change is recorded as , and then calculate the proportion of change of each smart meter in the following way : Finally, through weighted aggregation Smart meters Value, calculate the scoring index of the global model in the second round of training , calculated as: This is the threshold used to determine whether to use local electricity consumption data or data samples.

[0050] The judgment process is as follows: if > , indicating that the model effect obtained by using the data sample has improved, and the data sample will still be used in the next round of training.

[0051] if < , indicating that the model effect obtained by using data samples has not been improved. In order to improve the model effect, the next round of training uses local electricity consumption data.

[0052] Similarly, in the fourth round of training, the optimal model in the federated learning system can be trained according to the second round of training. , the third round of training corresponds to the optimal model in the federated learning system Calculate the global model evaluation index . And by comparing and The size relationship is used to determine which data to use.

[0053] The embodiment of the present invention sends the initialized neural network model to multiple smart meters through a central server; each smart meter generates data samples using a generation model, and trains the initialized neural network model through the data samples or local electricity consumption data, and uploads the trained model parameters and scoring indicators to the central server; the central server performs aggregation detection on the trained model parameters and scoring indicators through an aggregation model to determine abnormal smart meters; the central server performs dynamic aggregation of attention on all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model, and determines whether the global model meets the preset training termination condition; if so, the training is terminated and the The global model is used to predict electricity consumption; otherwise, the global model is sent to multiple smart meters as an initialized neural network model, and the process returns to step 2. Compared with the prior art, the embodiment of the present invention generates data samples whose distance from local electricity consumption data is less than a threshold through a generation model for local training, and performs aggregation detection on the trained model parameters and scoring indicators through an aggregation model to determine abnormal smart meters and prevent malicious smart meters from attacking local electricity consumption data, thereby effectively improving the privacy protection capability of smart grid data. At the same time, by dynamically aggregating attention to all model parameters, the convergence speed of the global model is improved, thereby improving the efficiency of federated learning.

[0054] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A federated learning method for smart grid data protection, characterized in that: include: Step 1: The central server sends the initialized neural network model to multiple smart meters; Step 2, each smart meter generates data samples using the generation model, and trains the initialized neural network model through the data samples or local electricity consumption data, and uploads the trained model parameters and scoring indicators to the central server; Step 3, the central server performs aggregation detection on the trained model parameters and scoring indicators through an aggregation model to determine abnormal smart meters; In step 4, the central server dynamically aggregates all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model, and determines whether the global model meets the preset training termination condition; if so, the training is terminated and the global model is used to predict the power consumption; otherwise, the global model is sent to multiple smart meters as the initialized neural network model, and the process returns to step 2.

2. The federated learning method for smart grid data protection according to claim 1, characterized in that: The generation model includes a generator and a discriminator; Using the generator to transform the noise and the class label to synthesize data samples; The discriminator is used to discriminate the distance between the data sample and the local electricity consumption data. If the distance is greater than a preset threshold, the generator is reused to synthesize the data sample until the distance is less than the preset threshold, and the data sample is used as the data sample.

3. The federated learning method for smart grid data protection according to claim 2, characterized in that: The calculation expression of the distance between the data sample and the local power consumption data is: in, Represents the distribution of data samples Distribution of local electricity consumption data The distance between represents the infimum, which is the smallest upper bound, Represents the distribution of data samples Distribution of local electricity consumption data For all possible joint distributions, express The joint distribution of In the joint distribution Next, randomly select a pair of samples The expected value of the distance, Indicates local electricity consumption data. Represents a data sample.

4. The federated learning method for smart grid data protection according to claim 3 is characterized in that: The step 3 comprises: The central server treats all model parameters uploaded in each round as a point through the pruned DBScan model and sets the clustering radius; Determine whether the distance between each two adjacent points is less than the cluster radius. When the distances are all less than the cluster radius, it is determined that there are no abnormal smart meters in this training. When the distance is greater than the cluster radius, the smart meters corresponding to the points greater than the cluster radius are regarded as abnormal smart meters.

5. The federated learning method for smart grid data protection according to claim 4 is characterized in that: The calculation expression of the cluster radius is: in, represents the cluster radius, represents the number of smart meters, Indicates Model parameters for training smart meters With Model parameters for training smart meters The distance between.

6. The federated learning method for smart grid data protection according to claim 5, characterized in that: The central server dynamically aggregates all model parameters except the model parameters uploaded by the abnormal smart meter to obtain a global model, including: When the model parameters other than the model parameters uploaded by the abnormal smart meter are dynamically aggregated for the first time, all model parameters other than the model parameters uploaded by the abnormal smart meter are averaged to generate a global model; When it is not the first time that attention is dynamically aggregated on all model parameters except the model parameters uploaded by the abnormal smart meter, weighted aggregation is performed on all model parameters except the model parameters uploaded by the abnormal smart meter by calculating the improvement proportion and the inverse weight of each smart meter to obtain a global model.

7. The federated learning method for smart grid data protection according to claim 6, characterized in that: The expression for calculating the improvement ratio of each smart meter is: in, Indicates Smart meters in The improvement ratio of the round, Indicates Smart meters in Model improvement for each round.

8. The federated learning method for smart grid data protection according to claim 7, characterized in that: The expression for calculating the inverse weight of each smart meter is: in, Indicates The inverse weight of a smart meter, Indicates The average distance between the model parameters uploaded by a smart meter and all model parameters in the previous round.

9. The federated learning method for smart grid data protection according to claim 8, characterized in that: The calculation expression for weighted aggregation of all model parameters except the model parameters uploaded by the abnormal smart meter is: in, Indicates The model parameters of the global model obtained in the round, represents the attention weight, Indicates the number of abnormal smart meters, Indicates the newly added smart meter. Indicates Smart meters in Model parameters for epoch training.

10. The federated learning method for smart grid data protection according to claim 9, characterized in that: The preset training termination conditions include: When the training rounds reach the maximum rounds, stop training; When The training round uses data samples, The training round uses local electricity consumption data, and the The evaluation index after the round of training is greater than the When the evaluation index after the round of training reaches 0, stop training; When the global model converges to the expected level, stop training; When the local electricity consumption data is used for several consecutive rounds of training, the training is stopped.

Citation Information

Patent Citations

  • A method for improving power supply reliability

    CN104537569A

  • Power grid industrial control protocol intrusion detection method and system based on federated learning

    CN116260617A

  • Federal learning model training method based on dynamic attention mechanism

    CN116957106A

  • Cluster federated learning method and system for DER power generation and load prediction

    CN118656858A

  • Credit risk assessment method and device based on longitudinal federated learning

    CN119648393A

Cited By

  • Generative adversarial network-based power grid monitoring signal data sample enhancement method and system

    CN121117605A