A power data distributed federated learning system and method based on data similarity aggregation
By employing blockchain technology and data similarity aggregation in distributed federated learning of power data, decentralized model generation and aggregation are achieved, solving the security threats and model monotony problems of traditional federated learning, improving the system's security, accuracy, and flexibility, and making it suitable for multiple scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2026-04-07
AI Technical Summary
Traditional federated learning relies on a central server, which poses security threats and problems with model simplification, making it unsuitable for multiple scenarios. Furthermore, the unreliability of the central server leads to unreliable training results.
A distributed federated learning method for power data based on data similarity aggregation is adopted. Blockchain technology is used to achieve decentralization. The correlation between model parameters is calculated by cosine similarity to perform local personalized model generation and aggregation, eliminating the central server and aggregating model parameters based on model data similarity.
It improves system security and accuracy, is applicable to different scenarios, reduces computing and communication costs, protects data privacy, and is flexible and scalable.
Smart Images

Figure CN116796864B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine learning, distributed computing, blockchain, and data privacy protection, and in particular to a distributed federated learning method for power data based on data similarity aggregation. Background Technology
[0002] With the development of IoT technology and edge computing, federated learning has received increasing attention and research. Federated learning refers to multiple clients collaborating to solve machine learning problems under the coordination of a central server. During this process, each client's original data is kept locally and not exchanged or transmitted. This concept was first proposed by McMahan et al. in 2016. Using federated learning, multiple clients can jointly train the same model without uploading the original dataset. Participants receive the latest global model and iteratively train it locally using their own datasets. After training, the local model parameters are uploaded to the central server. The central server aggregates the received model parameters to obtain a new set of global model parameters. Therefore, federated learning decomposes the entire machine learning process into the smallest modular units, providing a degree of privacy protection for participating users through data minimization. Participants submit the trained model parameters to the central server instead of submitting the original data. This keeps the original data locally, minimizing participant privacy. Furthermore, multi-party collaborative model training improves model performance more than training a model using only local datasets.
[0003] However, existing federated learning suffers from the problem of model exclusivity. All participants train their local models based on the same global model, and the final aggregated global model is the same. In real-world scenarios, data distribution often varies—whether it's the distribution of data features, labels, or the amount of data—so using a single model for all participants does not achieve optimal performance. Furthermore, existing federated learning uses a centralized structure, and this model, entirely reliant on the reliability of a central server, presents significant security vulnerabilities. If the central server becomes unreliable or is compromised, the entire model update process will be disrupted, training results will be unreliable, and malicious actions by the central server during model parameter collection and updates can ruin the entire federated learning process.
[0004] Blockchain technology has attracted widespread attention due to its distributed, immutable, and traceable properties. Currently, besides its use in the financial sector for cryptocurrencies, blockchain is also widely used in the supply chain field. Its traceability perfectly matches supply chain scenarios, enabling real-time tracking of the distribution of goods such as pharmaceuticals and food. With the emergence of blockchain technology, researchers have begun exploring the possibility of combining it with federated learning. Recent research has addressed the security challenges of multi-party collaborative data sharing in Industrial Internet of Things (IIoT) scenarios, proposing a secure data sharing architecture based on blockchain. This architecture leverages blockchain technology to share data among multiple parties, reducing the risk of data leakage. Furthermore, blockchain technology can achieve system decentralization, preventing training disruptions caused by malicious behavior from a central server.
[0005] Federated learning's aggregation technique is the process of aggregating local model parameters into a global model, with the core objective of reducing communication overhead while maintaining model accuracy. How to aggregate multi-party model parameters is also a key research focus in federated learning; a good aggregation algorithm can reduce model parameter loss and improve training efficiency. The federated averaging algorithm aggregates the global model by determining the weight based on the number of samples each participant possesses and then performing a weighted average. Addressing the issue that federated averaging only focuses on sample quantity, a later optimization objective algorithm, q-Fair Federated Learning, was proposed to solve the fairness problem in federated learning. This scheme introduces a q-parameter to re-weight different devices, giving higher-loss devices a larger weight, achieving a fairer allocation method. Subsequent federated matching averaging algorithms construct a shared global model in a hierarchical manner by matching and averaging hidden elements with similar features, but still suffer from dependence on a central server and model homogeneity.
[0006] This invention addresses the problems of federated learning by proposing a distributed federated learning method for power data based on data similarity aggregation, which combines blockchain technology. Compared with traditional federated learning methods, this method no longer relies on a central server, reducing the risk of single point of failure. At the same time, it aggregates model parameters based on model data similarity, realizing local model personalization and improving the accuracy and precision of models in different application scenarios. Summary of the Invention
[0007] Purpose of the invention: In order to overcome the shortcomings of the existing technology, the distributed federated learning method for power data based on data similarity aggregation solves the security threats caused by the dependence on central servers in traditional federated learning and the problem that the model is singular and cannot be universally applied to multiple scenarios, thus effectively improving the security and accuracy of the system.
[0008] Technical solution: To achieve the above objectives, the technical solution adopted by this invention is as follows:
[0009] A distributed federated learning system for power data based on data similarity aggregation mainly includes the following three aspects:
[0010] Distributed federated learning model based on local model aggregation: This model moves the aggregation work from a central server to each participant's local machine, eliminating the need for a central server and achieving system decentralization. Participants can generate local personalized models based on corresponding aggregation algorithms, solving the problem of single-model architecture in traditional federated learning. Federated learning aggregation process based on model data similarity: By using cosine similarity to calculate the correlation between participant model parameters, the weight of each model in the aggregation process is determined, enabling more learning between models in similar application scenarios.
[0011] The transaction-based local model update and aggregation process mainly includes: local model update, transaction production, transaction propagation, and transaction verification.
[0012] Among them, the distributed federated learning model based on local model aggregation has the following characteristics:
[0013] This model utilizes blockchain technology to achieve system decentralization. The entire model architecture can be mainly divided into two parts: the blockchain network and local servers. The local servers include blockchain node servers and model computation server nodes. The blockchain node servers are primarily responsible for communicating with other nodes in the blockchain network, generating or inspecting transactions, executing consensus mechanisms, and locally storing blockchain copies. The model computation servers are primarily responsible for training the model using local data and uploading the generated local model parameters to the blockchain server. A single local server can possess all the functions of both types of nodes simultaneously, or two local servers can be connected via a local area network. The computation server and the blockchain node server have a one-to-one relationship; the aggregation process occurs locally, generating their respective local models suitable for different application scenarios. See the appendix for details. Figure 1 As shown.
[0014] The principle of federated learning aggregation methods based on model data similarity is as follows:
[0015] If participants with similar application scenarios can learn more from their respective models and generate personalized models tailored to their specific application scenarios, the model performance will be better. Therefore, addressing the problem in traditional federated learning aggregation algorithms where model weight is calculated based on sample size, hindering collaboration among participants with similar scenarios, this invention proposes a decentralized federated learning aggregation algorithm based on model data similarity. This algorithm calculates the model aggregation weight based on the relevance between participant models, using the following formula:
[0016]
[0017] Where N represents the number of participants in the entire network. Let k represent the model parameters for participant i in round t. i,j This represents the proportion of participant j's model in the aggregation process when participant i generates the aggregation model. α is a hyperparameter. express The cosine correlation between them.
[0018] This formula is used to calculate the model correlation between participant i and participant j. and The smaller the difference between them, the better. i,j The larger the value, the greater the proportion of participant j when calculating the aggregation parameters for participant i, and the greater the impact on the generated model. In addition, to address the lack of model personalization among participants in traditional federated learning aggregation algorithms, a decentralized federated learning aggregation algorithm based on model data similarity has been improved. To achieve system decentralization, the generation of the global model is no longer handled by the central server, but by the participants. Through this operation, model personalization is achieved. Participants use formula (2) to aggregate and generate a new model locally and continue the next step of training.
[0019]
[0020] in, Let represent the local personalized model parameters of participant i at round t. The decentralized federated learning aggregation algorithm based on model relevance proposed in this paper is specifically represented as follows:
[0021] Input the number of participants N, the number of local epochs E, the loss function loss, the number of iterations T, and the learning rate η, and perform the following process:
[0022] 1) Participant i trains a local model Iterate E times;
[0023] 2) Set local parameters Send it to the other participants via the blockchain node server;
[0024] 3) After the system reaches a consensus, obtain the model parameters of the remaining participants from the latest block content;
[0025] 4) Calculate the local personalized model using formula (2) and assign it to the appropriate value.
[0026] 5) Repeat the above steps until the number of iterations is T;
[0027] The transaction-based local model update and aggregation process mainly includes the following parts:
[0028] Step 1: Local Model Update. The model computation server sends a request to the blockchain node server to obtain the latest block content. Based on the transaction information stored in the block, it retrieves the model parameters of other participants from the previous training round. A decentralized federated learning aggregation algorithm based on model data similarity is used to calculate personalized local model parameters, which are then set as the initial parameters for the next round of local model training. During the local model update process, participants train their local models using local datasets and relevant algorithms for different scenarios.
[0029] Step 2: Transaction Production. After completing the local model update and obtaining the model parameters, the model computation server will upload its relevant parameters to the blockchain node server and generate a transaction. The transaction includes its own model parameters and model accuracy.
[0030] Step 3: Transaction Propagation. Blockchain node servers propagate transactions throughout the network.
[0031] Step 4: Transaction Verification. Upon receiving the transaction, the remaining nodes will verify its correctness according to the agreed-upon method. If verification is successful, the transaction will be stored in its local transaction pool. When the number of transactions in the pool reaches a certain number or a certain time interval is exceeded, the master node will initiate a request to build a block. A consensus will be reached among the nodes based on a high-performance Byzantine fault-tolerant consensus mechanism that considers model accuracy. After consensus is reached, the new block will contain all transactions from the current transaction pool; that is, all training model parameters of the participants in this round can be found in the block. The new block will then be broadcast, and all nodes in the network will add it to the end of their local blockchain upon receiving it.
[0032] The overall process of the distributed federated learning method for power data based on data similarity aggregation is as follows:
[0033] Step one initializes the entire network, determines the initialization parameters, and writes them into the genesis block of the blockchain.
[0034] Step two involves the model computation server obtaining the latest block content from the blockchain node server, using a decentralized federated learning aggregation algorithm based on model data similarity to calculate personalized local model parameters, obtaining a new round of training model parameters, and determining whether the model has converged. If it has converged, the training process ends; otherwise, proceed to step three.
[0035] Step 3: Train the model using local data. After training is complete and the local model parameters are obtained, upload them to the blockchain node server.
[0036] Step three involves the blockchain node server generating a transaction based on local model parameters and broadcasting it to the remaining nodes in the network. The remaining nodes accept the transaction, verify its correctness, and then add it to the transaction pool.
[0037] Step five involves generating a block when the number of transactions in the master node transaction pool of the blockchain network reaches a threshold, and then executing the corresponding consensus mechanism across the entire network to achieve network-wide consistency.
[0038] Step Six: Once consensus is reached, all blockchain node servers save the blocks in their local blockchain, and then continue with Step Two. This process is repeated until the entire training process is complete.
[0039] Beneficial effects:
[0040] This invention provides a distributed federated learning method for power data based on data similarity aggregation, which has the following advantages:
[0041] 1. Decentralized design avoids the security threats posed by centralized servers, thereby improving system security and reliability. Especially in power data federated learning applications, traditional centralized server architectures face many security and privacy issues, such as the possibility of attacks on the central server and data theft. Decentralized design effectively avoids these problems, improving system security and reliability.
[0042] 2. The generation of locally personalized models can solve the problem of the limited range of traditional federated learning models, making the models applicable to different scenarios and data types, thus improving the accuracy and universality of the models. For example, in federated learning applications for electricity data, electricity consumption data may vary in different regions. Using traditional federated learning methods may lead to a decrease in model accuracy, while using locally personalized models can solve this problem, improving the accuracy and universality of the models.
[0043] 3. Flexibility and scalability. Since local model updates and aggregations are based on data similarity, new participants can be easily added to the federated learning system without changing existing models and algorithms. This greatly improves the system's scalability and flexibility, enabling it to adapt to constantly changing data and participants.
[0044] 4. The local model update and aggregation process is performed locally on the participants, thus eliminating the need for extensive computation and communication on the central server, thereby reducing the system's computation and communication costs and improving the system's efficiency and performance.
[0045] 5. It offers good privacy protection because it avoids sending data to a central server, thus preventing data leaks and privacy issues. Especially in applications involving private data, the use of local model updates and aggregation methods can effectively protect data privacy. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0047] Figure 1 This is a diagram of the distributed federated learning model based on local model aggregation in the distributed federated learning method for power data based on data similarity aggregation of the present invention.
[0048] Figure 2 This is a flowchart of the transaction-based local model update and aggregation process in a distributed federated learning method for power data based on data similarity aggregation.
[0049] Figure 3 This is a flowchart illustrating the overall process of decentralized federated learning in the distributed federated learning method for power data based on data similarity aggregation.
[0050] The accompanying drawings have illustrated specific embodiments of the present invention, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concept of the invention to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Example 1: A distributed federated learning system for power data based on data similarity aggregation, mainly including the following three aspects:
[0053] Distributed federated learning model based on local model aggregation: This model moves the aggregation work from a central server to each participant's local machine, eliminating the need for a central server and achieving system decentralization. Participants can generate local personalized models based on corresponding aggregation algorithms, solving the problem of single-model architecture in traditional federated learning. Federated learning aggregation process based on model data similarity: By using cosine similarity to calculate the correlation between participant model parameters, the weight of each model in the aggregation process is determined, enabling more learning between models in similar application scenarios.
[0054] The transaction-based local model update and aggregation process mainly includes: local model update, transaction production, transaction propagation, and transaction verification.
[0055] Among them, the distributed federated learning model based on local model aggregation has the following characteristics:
[0056] This model utilizes blockchain technology to achieve system decentralization. The entire model architecture can be mainly divided into two parts: the blockchain network and local servers. The local servers include blockchain node servers and model computation server nodes. The blockchain node servers are primarily responsible for communicating with other nodes in the blockchain network, generating or inspecting transactions, executing consensus mechanisms, and locally storing blockchain copies. The model computation servers are primarily responsible for training the model using local data and uploading the generated local model parameters to the blockchain server. A single local server can possess all the functions of both types of nodes simultaneously, or two local servers can be connected via a local area network. The computation server and the blockchain node server have a one-to-one relationship; the aggregation process occurs locally, generating their respective local models suitable for different application scenarios. See the appendix for details. Figure 1 As shown.
[0057] 2. The principle of federated learning aggregation method based on model data similarity is as follows:
[0058] If participants with similar application scenarios can learn more from their respective models and generate personalized models tailored to their specific application scenarios, the model performance will be better. Therefore, addressing the problem in traditional federated learning aggregation algorithms where model weight is calculated based on sample size, hindering collaboration among participants with similar scenarios, this invention proposes a decentralized federated learning aggregation algorithm based on model data similarity. This algorithm calculates the model aggregation weight based on the relevance between participant models, using the following formula:
[0059]
[0060] Where N represents the number of participants in the entire network. Let k represent the model parameters for participant i in round t. i,jThis represents the proportion of participant j's model in the aggregation process when participant i generates the aggregation model. α is a hyperparameter. express The cosine correlation between them.
[0061] This formula is used to calculate the model correlation between participant i and participant j. and The smaller the difference between them, the better. i,j The larger the value, the greater the proportion of participant j when calculating the aggregation parameters for participant i, and the greater the impact on the generated model. In addition, to address the lack of model personalization among participants in traditional federated learning aggregation algorithms, a decentralized federated learning aggregation algorithm based on model data similarity has been improved. To achieve system decentralization, the generation of the global model is no longer handled by the central server, but by the participants. Through this operation, model personalization is achieved. Participants use formula (2) to aggregate and generate a new model locally and continue the next step of training.
[0062]
[0063] in, Let represent the local personalized model parameters of participant i at round t. The decentralized federated learning aggregation algorithm based on model relevance proposed in this paper is specifically represented as follows:
[0064] Input the number of participants N, the number of local epochs E, the loss function loss, the number of iterations T, and the learning rate η, and perform the following process:
[0065] 1) Participant i trains a local model Iterate E times;
[0066] 2) Set local parameters Send it to the other participants via the blockchain node server;
[0067] 3) After the system reaches a consensus, obtain the model parameters of the remaining participants from the latest block content;
[0068] 4) Calculate the local personalized model using formula (2) and assign it to the appropriate value.
[0069] 5) Repeat the above steps until the number of iterations is T;
[0070] The transaction-based local model update and aggregation process mainly includes the following parts:
[0071] Step 1: Local Model Update. The model computation server sends a request to the blockchain node server to obtain the latest block content. Based on the transaction information stored in the block, it retrieves the model parameters of other participants from the previous training round. A decentralized federated learning aggregation algorithm based on model data similarity is used to calculate personalized local model parameters, which are then set as the initial parameters for the next round of local model training. During the local model update process, participants train their local models using local datasets and relevant algorithms for different scenarios.
[0072] Step 2: Transaction Production. After completing the local model update and obtaining the model parameters, the model computation server will upload its relevant parameters to the blockchain node server and generate a transaction. The transaction includes its own model parameters and model accuracy.
[0073] Step 3: Transaction Propagation. Blockchain node servers propagate transactions throughout the network.
[0074] Step 4: Transaction Verification. Upon receiving the transaction, the remaining nodes will verify its correctness according to the agreed-upon method. If verification is successful, the transaction will be stored in its local transaction pool. When the number of transactions in the pool reaches a certain number or a certain time interval is exceeded, the master node will initiate a request to build a block. A consensus will be reached among the nodes based on a high-performance Byzantine fault-tolerant consensus mechanism that considers model accuracy. After consensus is reached, the new block will contain all transactions from the current transaction pool; that is, all training model parameters of the participants in this round can be found in the block. The new block will then be broadcast, and all nodes in the network will add it to the end of their local blockchain upon receiving it.
[0075] Example 2: The overall process of the distributed federated learning method for power data based on data similarity aggregation is as follows:
[0076] Step one initializes the entire network, determines the initialization parameters, and writes them into the genesis block of the blockchain.
[0077] Step two involves the model computation server obtaining the latest block content from the blockchain node server, using a decentralized federated learning aggregation algorithm based on model data similarity to calculate personalized local model parameters, obtaining a new round of training model parameters, and determining whether the model has converged. If it has converged, the training process ends; otherwise, proceed to step three.
[0078] Step 3: Train the model using local data. After training is complete and the local model parameters are obtained, upload them to the blockchain node server.
[0079] Step three involves the blockchain node server generating a transaction based on local model parameters and broadcasting it to the remaining nodes in the network. The remaining nodes accept the transaction, verify its correctness, and then add it to the transaction pool.
[0080] Step five involves generating a block when the number of transactions in the master node transaction pool of the blockchain network reaches a threshold, and then executing the corresponding consensus mechanism across the entire network to achieve network-wide consistency.
[0081] Step Six: After consensus is reached, all blockchain node servers save the block in their local blockchain, and then continue with Step Two. This cycle continues until the entire training process is complete.
[0082] Example 3: The specific implementation plan for power companies should be divided into the following steps:
[0083] Step 1: Data Preprocessing and Feature Selection: In distributed federated learning of power data, the first step is to clean the data from each power company, including removing outliers and imputing missing values, to ensure data quality. Then, the data is transformed, such as through normalization and standardization, to reduce model training errors. Finally, features need to be extracted from the power data, such as power load, temperature, humidity, and time, to enable effective data aggregation. For feature selection, methods such as correlation analysis and principal component analysis can be used to select appropriate feature sets based on feature importance and relevance.
[0084] Step 2: Model Building: When building a distributed federated learning model, the characteristics of the power data and the target requirements need to be considered. Based on application scenarios such as power load forecasting and fault prediction, appropriate machine learning models can be selected, such as decision tree models and deep neural network models. The model computation server obtains the latest block content from the blockchain node server, calculates the parameters for a new round of training, and determines whether the model has converged. If it has converged, training ends.
[0085] Step 3: Federated Learning Training: During the distributed federated learning training process, each power company can train its model locally and upload the obtained local model parameters to the blockchain node server. The blockchain node server generates transactions based on the local model parameters and broadcasts them to the remaining nodes in the network. The remaining nodes accept the transactions, check their correctness, and then put them into the transaction pool. When the number of transactions in the master node's transaction pool in the blockchain network reaches a threshold, a block is generated, and the corresponding consensus mechanism is executed across the network to achieve network-wide consistency. After consensus is achieved, all blockchain node servers save the block in their local blockchain and then continue to execute Step 2. This process is repeated until the entire training process is completed. Each participant uses the federated learning algorithm and gradient descent algorithm to train and obtain local model parameters. The model data similarity aggregation method proposed in this invention is used to determine the aggregation weight of the model parameters based on the similarity between each power company. Local personalized model parameters are generated according to formula (2) and used as the initial parameters for the next round of model training, thereby obtaining the final federated learning model.
[0086] Step 4: Model Evaluation and Optimization: In evaluating and optimizing the federated learning model, metrics such as model accuracy and generalization ability need to be considered. Methods such as cross-validation and test sets can be used to evaluate model performance. Furthermore, regularization and learning rate adjustment can be employed to optimize the federated learning model, thereby improving its performance and stability.
[0087] Step 5: Deployment and Application: The optimized federated learning model needs to be deployed to the power company's servers for applications such as power load forecasting and fault prediction. During application, data security and privacy protection must be considered, and a series of security measures, such as encrypted communication and differential privacy methods, should be implemented to ensure data security and privacy.
[0088] This solution can help power companies jointly build efficient, reliable and secure federated learning models, thereby improving the operational efficiency and stability of the power system.
[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A distributed federated learning system for power data based on data similarity aggregation, characterized in that, The system includes: a distributed federated learning model based on local model aggregation, a federated learning aggregation process based on model data similarity, and a transaction-based local model update and aggregation process; Among them, the distributed federated learning model based on local model aggregation: This model moves the aggregation work from the central server to each participant's local machine, eliminating the central server setting and realizing the decentralization of the system. Participants can generate local personalized models according to the corresponding aggregation algorithm, solving the problem of the single nature of traditional federated learning models. Federated learning aggregation process based on model data similarity: By using cosine similarity to calculate the correlation between the parameters of the participating models, the proportion of each model in the aggregation process is determined, so as to achieve more learning between models with similar application scenarios. The transaction-based local model update and aggregation process mainly includes: local model update, transaction production, transaction propagation, and transaction verification. The distributed federated learning model based on local model aggregation is as follows: This model utilizes blockchain technology to achieve system decentralization. Its architecture can be mainly divided into two parts: the blockchain network and local servers. The local servers include blockchain node server nodes and model computing server nodes. The blockchain node server is mainly responsible for communicating with other nodes in the blockchain network, generating or checking transactions, executing consensus mechanisms, and storing blockchain copies locally. The model computing server is mainly responsible for training the model using local data and uploading the generated local model parameters to the blockchain server. The same local server can have all the functions of the above two types of nodes at the same time, or two local servers can be connected through a local area network. The computing server and the blockchain node server have a one-to-one relationship. The aggregation process is carried out locally, generating their respective local models to suit different application scenarios. The federated learning aggregation process based on model data similarity is as follows: In decentralized federated learning aggregation algorithms based on model data similarity, the aggregation weight of a model is calculated according to the relevance between the participant models. The specific calculation formula is as follows: Where N represents the number of participants in the entire network. Let k represent the model parameters for participant i in round t. i,j α represents the proportion of participant j's model in the aggregation process when participant i generates the aggregation model, and α is a hyperparameter. express Cosine correlation between them This formula is used to calculate the model correlation between participant i and participant j. and The smaller the difference between them, the better. i,j The larger the value, the greater the proportion of participant j when calculating the aggregation parameters for participant i, and the greater the impact on the generated model. In addition, to address the lack of model personalization among participants in traditional federated learning aggregation algorithms, a decentralized federated learning aggregation algorithm based on model data similarity has been improved. To achieve system decentralization, the generation of the global model is no longer handled by the central server, but by the participants. Through this operation, model personalization is achieved. Participants use formula (2) to aggregate and generate a new model locally and continue the next step of training. in, Let represent the local personalized model parameters of participant i at round t. The decentralized federated learning aggregation algorithm based on model relevance proposed in this paper is represented as follows: Input the number of participants N, the number of local epochs E, the loss function loss, the number of iterations T, and the learning rate η, and perform the following process: 1) Participant i trains a local model Iterate E times; 2) Set local parameters Send it to the other participants via the blockchain node server; 3) After the system reaches a consensus, obtain the model parameters of the remaining participants from the latest block content; 4) Calculate the local personalized model using formula (2) and assign it to the appropriate value. 5) Repeat the above operations until the number of iterations is T.
2. The distributed federated learning system for power data based on data similarity aggregation according to claim 1, characterized in that, The transaction-based local model update and aggregation process is as follows: Step 1, Local Model Update, involves the model computation server sending a request to the blockchain node server to obtain the latest block content. Based on the transaction information stored in the block, it retrieves the model parameters of other participants from the previous training round. Then, it calculates personalized local model parameters using a decentralized federated learning aggregation algorithm based on model data similarity and sets these parameters as the initial parameters for the next round of local model training. During the local model update process, participants train their local models using local datasets and relevant algorithms for different scenarios. Step 2: Transaction Production. After completing the local model update and obtaining the model parameters, the model computation server will upload the relevant parameters to the blockchain node server and generate a transaction. The transaction includes its own model parameters and model accuracy. Step 3: Transaction propagation. The blockchain node servers propagate the transaction throughout the network. Step 4: Transaction Verification. After receiving the transaction, the other nodes will verify its correctness according to the agreed-upon method. Once verified, it will be stored in the local transaction pool. When the number of transactions in the transaction pool reaches a certain number or exceeds a certain time, the master node will initiate a request to build a block. Based on the high-performance Byzantine fault-tolerant consensus mechanism based on model accuracy, consensus will be reached among the nodes. After consensus is reached, the new block will contain all transactions in the transaction pool of this round. That is, all training model parameters of the participants in this round can be found in the block. Subsequently, the new block will be broadcast, and all nodes in the network will add it to the end of their local blockchain after receiving the new block.
3. A learning method for a distributed federated learning system for power data based on data similarity aggregation, as described in any one of claims 1-2, characterized in that... Includes the following steps: Step 1: Initialize the entire network, determine the initialization parameters, and write them into the genesis block of the blockchain; Step Two: The model computation server obtains the latest block content from the blockchain node server, uses a decentralized federated learning aggregation algorithm based on model data similarity to calculate personalized local model parameters, obtains new training model parameters, and determines whether the model has converged. If it has converged, the training process ends; otherwise, proceed to Step Three. Step 3: Train the model using local data. After training is complete and the local model parameters are obtained, upload them to the blockchain node server. Step 4: The blockchain node server generates a transaction based on local model parameters and broadcasts it to the remaining nodes in the network. The remaining nodes accept the transaction, check its correctness, and then place it in the transaction pool. Step 5: When the number of transactions in the master node's transaction pool in the blockchain network reaches a threshold, a block is generated, and the corresponding consensus mechanism is executed across the entire network to achieve network-wide consistency. Step Six: Once consensus is reached, all blockchain node servers will save the blocks in their local blockchains, and then continue executing Step Two, repeating this process until the entire training process is complete.
Citation Information
Patent Citations
Federal learning load prediction method based on dynamic weighted aggregation
CN114707765A
Decentralized federated learning method and system based on block chain
CN114978893A