A blockchain-based trusted federated learning system and method in an edge computing scenario
Patent Information
- Application Number
- CN202410568866.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2044-05-09
AI Technical Summary
当设置的全局隐私级别足够高,可能会在所有模型梯度中引入较大的噪声量,极大影响全局模型的准确度和收敛速度;设置较低的隐私级别可能会使得隐私保护需求较高的服务器不愿意参与联邦学习
[0085]通过使用区块链技术,由区块链代替中心服务器对模型梯度进行筛选和聚合,避免了中心服务器的不可信问题及单点故障问题,保证边缘计算的可审计性;通过抗攻击的可信激励方法,识别并剔除恶意服务器,准确评估服务器贡献并聚合全局模型,同时激励服务器上传高质量模型梯度,保证边缘计算的可信性。
Smart Images

Figure CN118350451B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of edge computing and blockchain technology, specifically relating to a trusted federated learning system and method based on blockchain in edge computing scenarios. Background Technology
[0002] Edge computing is a distributed, open architecture that integrates core capabilities of networking, computing, storage, and applications at the network edge, close to the source of objects or data. With the advent of the 5G and IoT era, artificial intelligence technology is gradually moving from the central cloud to the edge to leverage the advantages of convenient data collection and real-time processing at the edge. By conducting collaborative inference and training of models at the edge and in the cloud, the "last mile" problem of AI deployment is being solved.
[0003] To ensure key requirements such as auditability, data security, and privacy protection in edge computing, federated learning and blockchain have been introduced. Federated learning, as a distributed machine learning framework, can process data on edge servers to protect privacy. Blockchain, as a distributed ledger technology, possesses auditability and tamper-resistance, and can be used for model aggregation and data auditing. However, blockchain-based federated learning in edge computing still faces challenges such as malicious attacks on edge servers, insufficient training, and varying privacy requirements. Existing trusted federated learning schemes typically only study incentive mechanisms under malicious attacks, neglecting the issues of insufficient training and varying privacy requirements.
[0004] Edge servers might prematurely halt local training due to self-interest, resulting in insufficient model training and the uploading of unconverged models, thus affecting the accuracy and convergence process of the global model. Existing solutions typically allocate rewards based on the accuracy of the models submitted by the servers. However, in the later stages of global iteration in federated learning, when a server has fully trained its model locally to convergence, its accuracy is only slightly improved or nearly the same as that of an insufficiently trained server. This means that the server incurs higher computational costs but receives similar rewards.
[0005] Edge servers may have varying privacy expectations and protection requirements regarding local data. Although federated learning avoids direct data exchange by uploading model gradients, attackers can still infer participants' data distribution and privacy information by analyzing the gradients uploaded by participants. Using a uniform privacy level to protect privacy in existing solutions is impractical. Setting a sufficiently high global privacy level may introduce significant noise into all model gradients, drastically affecting the accuracy and convergence speed of the global model; setting a low privacy level may discourage servers with higher privacy requirements from participating in federated learning. Summary of the Invention
[0006] Based on the above situation, this invention proposes a blockchain-based trusted federated learning system and method for edge computing scenarios.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] A blockchain-based trusted federated learning system for edge computing scenarios, comprising a cloud server, an edge server, and a blockchain;
[0009] The cloud server is used to define federated learning tasks, model structures and training objectives, verify the accuracy of the model and monitor the training process.
[0010] The edge server is divided into computing nodes and committee nodes, which are used for model training and accuracy evaluation.
[0011] The blockchain is used to manage the interaction between cloud servers and edge servers, ensuring the execution of protocols and the security of data.
[0012] In this invention, the cloud server is used to define the federated learning task, model structure, and training objectives, verify the model's accuracy, and monitor the training process. The cloud server acts as the federated learning task requester, responsible for defining the task, model structure, and training objectives. It also verifies the model's accuracy and monitors the training process. The cloud server interacts with the edge server via smart contracts on the blockchain, ensuring secure and reliable information transmission.
[0013] The edge servers are divided into compute nodes and committee nodes, used for model training and accuracy evaluation, respectively. The edge servers are the executors of federated learning and are divided into compute nodes and committee nodes based on a reputation mechanism. Compute nodes use their local datasets as training sets to train the model. They perform local model training and update the model based on global model parameters provided by the cloud server. After training, the generated local model gradients are submitted to the committee nodes after malicious attack detection. The committee nodes use the local dataset as a test set to evaluate the accuracy of the local models generated by the compute nodes and upload the results to the blockchain.
[0014] The blockchain is used to manage the interaction between cloud servers and edge servers, ensuring protocol execution and data security. The blockchain acts as the regulator of federated learning, ensuring protocol execution and data security. Smart contracts are deployed on the blockchain to manage the interaction between cloud servers and edge servers. The blockchain records metadata of the federated learning task, updates to model gradients, and evaluation results from committee nodes to provide traceability and transparency.
[0015] Preferably, the blockchain network in the above system adopts a consortium blockchain model, jointly managed by multiple trusted institutions. The addition of any edge server must be approved by the consortium. All servers act as blockchain nodes, collectively maintaining the blockchain network.
[0016] Preferably, the blockchain deployment includes a malicious attack detection module, a committee-based model aggregation module, and a multi-factor-based dynamic incentive module;
[0017] The malicious attack detection module is used to identify and remove gradients uploaded by malicious servers to prevent malicious attacks on edge servers.
[0018] The committee-based model aggregation module is used to accurately evaluate the contribution of edge servers and obtain the optimal global model through weighted aggregation.
[0019] The multi-factor-based dynamic incentive module provides personalized privacy protection and compensation schemes as well as dynamic reward allocation schemes to incentivize edge servers to reduce injected noise and fully train the model, thereby optimizing the reward distribution at different stages of federated learning.
[0020] Preferably, the malicious attack detection module detects malicious servers by calculating the distance between gradients. If the distance between a participant's gradient and the gradients of other participants exceeds a threshold, it is marked as a malicious server. The malicious attack detection module can promptly detect malicious attacks and take appropriate security measures, removing malicious participants, confiscating their deposits, and rejecting subsequent uploads from the server.
[0021] Preferably, the committee-based model aggregation module cross-distributes model gradients uploaded from non-malicious servers to multiple committee nodes. Each committee node uses its local dataset to test the accuracy of each model, thereby accurately evaluating the contribution of the edge servers. Specifically, this module can be divided into the following five parts:
[0022] ① Selection of committee nodes: First, nodes are selected based on the reputation value of the edge servers. By sorting the reputation values in descending order, the top m nodes with the highest reputation values are selected as committee nodes. These nodes have high trust and reliability in joint training. The remaining nodes are used as computing nodes for model training.
[0023] ② Generation of the allocation scheme: The gradient allocation scheme distributes the model gradients, after removing malicious model gradients, to multiple committee nodes for evaluation. Through reasonable allocation, each model gradient is assigned to multiple committee nodes for cross-evaluation, improving the accuracy of the calculation and the reliability of the results.
[0024] ③ Gradient Evaluation and Upload by Committee Nodes: After the allocation scheme is determined, committee nodes evaluate the gradient accuracy of the models they are assigned according to the scheme. Committee nodes calculate the accuracy of the model by testing it using a local dataset. After evaluation, committee nodes upload their accuracy to the blockchain.
[0025] ④ Calculation of Aggregation Weights: Based on the gradient accuracy uploaded by the committee nodes, the average accuracy of each model gradient is calculated. Then, these average accuracies are normalized to obtain the weight of each model gradient in the aggregation. These weights reflect the contribution of different nodes to the global model and will be used in subsequent aggregation processes.
[0026] ⑤ Global Model Aggregation and Reputation Value Update: Finally, based on the aggregation weights, the model gradients uploaded by committee nodes are aggregated using a weighted average method to obtain the updated global model. The reputation values of the nodes are then updated based on the calculated gradient accuracy to reflect their contributions to federated learning.
[0027] Preferably, the dynamic incentive module based on multiple factors incorporates a personalized privacy protection and compensation scheme. Edge servers can be configured with different privacy parameters to meet the privacy needs of different servers; a smaller privacy parameter indicates a higher level of random noise injected into the model gradient. Simultaneously, the compensation scheme provides more compensation to edge servers with lower levels of injected random noise, incentivizing them to reduce the injected noise. Furthermore, a dynamic reward allocation scheme is designed to optimize the reward distribution at different stages of federated learning, thereby encouraging edge servers to train sufficiently.
[0028] ① Personalized privacy protection and compensation plan, details are as follows:
[0029] Edge servers can set different privacy budgets based on their own privacy needs. A smaller privacy budget indicates a higher degree of random noise in the model gradient injection, thus providing greater privacy protection.
[0030] This invention defines privacy cost as the cost incurred due to the risk of privacy breach, used to measure the privacy protection needs of a server. A linear privacy cost function is employed, namely:
[0031] v i (p i ,ε i ) = p i ×ε i
[0032] Where, p i The cost of privacy leaks to server providers, ε i Privacy budget for server i.
[0033] To incentivize servers to reduce injected noise and improve the performance of the global model, a privacy cost compensation mechanism is introduced. Privacy cost compensation can be expressed as:
[0034] r c =γ×v i (p i ,ε i )
[0035] Here, γ is the privacy compensation coefficient. Specifically, for non-malicious servers with higher privacy budgets, more privacy cost compensation is provided to incentivize them to reduce injected noise, thereby improving the accuracy and convergence speed of the global model.
[0036] ② The dynamic reward distribution scheme is as follows:
[0037] A dynamic reward allocation scheme is proposed to incentivize edge servers to fully participate in training and ensure the accuracy and convergence speed of the global model.
[0038] Edge servers may upload non-converged models due to insufficient model training. Unlike detecting malicious servers, gradient distance is insufficient to filter out non-converged models; however, the accuracy of uploaded models can reflect the server's training status to some extent. Experiments show that increasing the number of iterations before model convergence helps improve model accuracy, meaning that fully trained converged models have higher accuracy. Therefore, rewards are allocated based on aggregated weights to incentivize servers to upload high-quality model gradients.
[0039] While considering aggregate weights, the reward allocation strategy is dynamically adjusted based on the accuracy of the global model to encourage servers to train fully and promote the convergence of the global model. As the accuracy of the global model improves, more rewards are allocated to servers with larger aggregate weights to incentivize them to continue training fully and provide more accurate models.
[0040] The server is divided into committee nodes and compute nodes. For committee nodes, the default reward is r. M For compute nodes, contribution weights are used to measure their relative reward. As mentioned above, contribution weights are calculated based on aggregate weights and global model accuracy, using the following formula:
[0041]
[0042] Where α i Let a(ω) be the aggregate weight of this computation node. i ) represents the global model accuracy evaluated by the cloud server, and k is a preset adjustment parameter. There exists a point in the interval (0, 1) where a(ω) iAs the value of increases, the slope of the curve to the left of the point decreases, and the slope of the curve to the right of the point increases. This formula satisfies the condition that, in the later stages of federated learning training iterations, rewards are concentrated on servers with larger aggregation weights.
[0043] Then, by calculating the contribution weight percentage, the reward percentage is obtained as follows:
[0044]
[0045] The reward for this computing node is then expressed as:
[0046] r i =R×g i
[0047] Where R is the total computational reward for each round of global iteration.
[0048] Furthermore, the edge server needs to register an account with the blockchain's smart contract and upload privacy information.
[0049] Furthermore, the cloud server, acting as a task requester, uploads the unloaded federated learning task and its initialized model information to the blockchain.
[0050] Furthermore, the smart contract selects a suitable edge server as a computing node to train the local model.
[0051] Furthermore, the computing nodes train local models using local datasets and upload the model gradients to the blockchain.
[0052] Furthermore, the smart contract identifies and eliminates malicious gradients, and then weights and aggregates the remaining model gradients to obtain the global model.
[0053] Furthermore, repeat the above process until the number of global iterations or the accuracy of the global model reaches the required level, then return the global model to the cloud server.
[0054] This invention also discloses a blockchain-based trusted federated learning method for edge computing scenarios. Based on the aforementioned blockchain-based trusted federated learning system for edge computing scenarios, the method proceeds according to the following steps:
[0055] S1. The edge server submits a privacy budget and pays a deposit;
[0056] S2. The cloud server initiates a federated learning training task and pays the fees;
[0057] S3. The smart contract elects committee nodes, and the remaining nodes become computing nodes;
[0058] S4. Edge servers read their respective state changes through smart contracts;
[0059] S5. Compute nodes train models using local datasets;
[0060] S6. Add noise to the gradient of the trained model according to the privacy budget and upload it to the blockchain;
[0061] S7. The smart contract collects the model gradients uploaded by all computing nodes and calculates the distance between gradients;
[0062] S8. If the distance exceeds the preset threshold, the smart contract will identify the corresponding edge server as a malicious server, refuse the model gradient uploaded by it, and confiscate the deposit.
[0063] S9. The smart contract distributes the model gradient, after removing malicious gradients, to different committee nodes for cross-evaluation;
[0064] S10. Committee node read allocation scheme;
[0065] S11. The committee nodes calculate the corresponding model accuracy according to the allocation scheme;
[0066] S12. The committee nodes upload the results to the blockchain;
[0067] S13. The smart contract collects the model accuracy uploaded by all committee nodes, calculates the aggregate weight of each edge server, and aggregates the model gradients based on the aggregate weights to update the global model.
[0068] S14. The cloud server reads the global model;
[0069] S15. The cloud server uses a test set in the cloud to evaluate the accuracy of the global model;
[0070] S16. The cloud server uploads the accuracy data to the smart contract;
[0071] S17. Smart contracts use information such as aggregated weights of computing nodes and global model accuracy to calculate rewards for edge servers;
[0072] S18. The smart contract distributes rewards to the edge server;
[0073] Repeat steps S3-S18 until the model accuracy or the number of global iterations reaches the set requirements, at which point the process ends.
[0074] This invention relates to a blockchain-based method for offloading federated learning tasks and an attack-resistant, trusted computing incentive method. The entire task offloading method is deployed on the blockchain and executed by smart contracts to ensure the visibility and traceability of the entire federated learning process.
[0075] This invention leverages blockchain technology to effectively address security and trust issues in federated learning within edge computing scenarios. Through a smart contract-based, attack-resistant, and trustworthy computing incentive method, it achieves decentralized and trustworthy collaborative reasoning and training of models in edge computing. Blockchain technology ensures the immutability and traceability of data, guaranteeing the trustworthiness of federated learning. Furthermore, the smart contract functionality of blockchain technology enables automated management of federated learning, ensuring its security and improving its efficiency.
[0076] This invention also discloses an attack-resistant trusted computing incentive method, comprising the following steps:
[0077] S1. The cloud server, acting as the task requester, uploads the unloaded federated learning task and its model information to the blockchain;
[0078] S2. The smart contract selects a suitable committee node based on a reputation mechanism to verify the model gradient, and the remaining edge servers serve as computing nodes to train the model.
[0079] S3. Compute nodes train models using local datasets and upload them to the blockchain;
[0080] S4. The smart contract calculates the gradient distance between uploaded models, identifies and eliminates malicious servers;
[0081] S5. Committee nodes use local datasets to cross-evaluate the remaining model gradients to obtain their accuracy, and then upload the results to the blockchain.
[0082] S6. The smart contract calculates the aggregate weight based on the model accuracy uploaded by the committee nodes, updates the global model, and calculates and distributes rewards to the edge servers.
[0083] S7. Repeat steps S2 to S6 until the global iteration count or model accuracy meets the requirements, then return the global model to the cloud server.
[0084] Compared with existing technologies, the technical solution of the blockchain-based trusted federated learning system and method in the edge computing scenario of this invention has the following advantages:
[0085] By using blockchain technology, the blockchain replaces the central server in filtering and aggregating model gradients, avoiding the untrustworthiness and single point of failure issues of the central server and ensuring the auditability of edge computing. Through an attack-resistant and trustworthy incentive method, malicious servers are identified and eliminated, server contributions are accurately evaluated and global models are aggregated, and servers are incentivized to upload high-quality model gradients, ensuring the trustworthiness of edge computing. Attached Figure Description
[0086] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings in the embodiments will be briefly described below.
[0087] Figure 1 This is a diagram of the blockchain-based trusted federated learning system architecture proposed in this invention.
[0088] Figure 2 This is a flowchart of the attack-resistant trusted computing incentive method proposed in this invention.
[0089] Figure 3 This is a flowchart illustrating the specific execution of the blockchain-based trusted federated learning system proposed in this invention.
[0090] Figure 4 This is a block diagram of a preferred embodiment of the blockchain deployment of the present invention. Detailed Implementation
[0091] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.
[0092] This invention primarily focuses on the single point of failure, unauditable data, and other issues related to centralized federated learning models in edge computing scenarios, as well as malicious attacks on edge servers, insufficient training, and personalized privacy requirements. It employs the FISCOBCOS consortium blockchain as the underlying blockchain technology to empower edge computing, building a blockchain-based trusted federated learning system and proposing an attack-resistant trusted computing incentive method. Specific examples are provided for illustration.
[0093] A preferred embodiment of the present invention provides a blockchain-based trusted federated learning system and method for edge computing scenarios, which is used to solve the problems of security and trust in edge computing.
[0094] This embodiment provides a blockchain-based trusted federated learning system for edge computing scenarios, such as... Figure 1 As shown, this includes cloud servers, edge servers, and blockchain, as detailed below:
[0095] The cloud server acts as the requester of the federated learning task, responsible for defining the federated learning task, model structure, and training objectives. It also verifies the model's accuracy and monitors the training process. The cloud server interacts with the edge servers via smart contracts on the blockchain, ensuring secure and reliable information transfer.
[0096] Edge servers are the executors of federated learning and are divided into compute nodes and committee nodes based on a reputation mechanism. Compute nodes use their local datasets as training sets to train the model. They perform local model training and update the model based on global model parameters provided by the cloud server. After training, the generated local model gradients are submitted to the committee nodes after malicious attack detection. The committee nodes use their local datasets as test sets to evaluate the accuracy of the local models generated by the compute nodes and upload the results to the blockchain.
[0097] Blockchain acts as the regulator of federated learning, ensuring the execution of protocols and the security of data. Smart contracts are deployed on the blockchain to manage interactions between cloud servers and edge servers. The blockchain records metadata of the federated learning task, updates to model gradients, and evaluation results from committee nodes to provide traceability and transparency.
[0098] like Figure 2 , 4 As shown, in this embodiment, the blockchain is deployed with the following three modules.
[0099] (1) Malicious attack detection module
[0100] By calculating the distance between gradients of the model uploaded to the edge server, abnormal gradient information is filtered out to prevent malicious attacks on the edge server.
[0101] Furthermore, the malicious attack detection module detects malicious servers by calculating the distance between gradients. If the distance between a participant's gradient and the gradients of other participants exceeds a threshold, it is marked as a malicious server. The malicious attack detection module can promptly detect malicious attacks and take appropriate security measures, removing malicious participants, confiscating their deposits, and rejecting subsequent uploads from the server.
[0102] (2) Committee-based model aggregation module
[0103] The model gradients uploaded from non-malicious servers are cross-distributed to multiple committee nodes. Each committee node uses its local dataset to test the accuracy of each model, thus accurately evaluating the contribution of the edge servers. Specifically, this module can be divided into the following five parts:
[0104] Committee node selection: First, nodes are selected based on the reputation value of the edge servers. By sorting the reputation values in descending order, the top m nodes with the highest reputation values are selected as committee nodes. These nodes have high trust and reliability in joint training. The remaining nodes are used as computing nodes for model training.
[0105] The gradient allocation scheme generates the gradients of the model after removing malicious model gradients and distributes them to multiple committee nodes for evaluation. Through reasonable allocation, each model gradient is assigned to multiple committee nodes for cross-evaluation, improving the accuracy of the computation and the reliability of the results.
[0106] Gradient evaluation and uploading by committee nodes: After the allocation scheme is determined, committee nodes evaluate the gradient accuracy of the models they are assigned according to the scheme. Committee nodes calculate the accuracy of the model by testing it using a local dataset. After evaluation, committee nodes upload their accuracy to the blockchain.
[0107] Calculation of aggregation weights: Based on the gradient accuracy uploaded by the committee nodes, the average accuracy of each model's gradient is calculated. Then, these average accuracies are normalized to obtain the weight of each model's gradient in the aggregation. These weights reflect the contribution of different nodes to the global model and will be used in subsequent aggregation processes.
[0108] Global model aggregation and reputation value update: Finally, based on the aggregation weights, the model gradients uploaded by the committee nodes are aggregated using a weighted average method to obtain the updated global model. The reputation value of the nodes is updated based on the calculated gradient accuracy to reflect the node's contribution to federated learning. (3) Dynamic incentive module based on multiple factors
[0109] A personalized privacy protection and compensation scheme was designed, allowing edge servers to be configured with different privacy parameters to meet the privacy needs of different servers. Smaller privacy parameters indicate a higher level of random noise injected into the model gradient. Simultaneously, the compensation scheme provides more compensation to edge servers with lower levels of injected random noise, incentivizing them to reduce the injected noise. Furthermore, a dynamic reward allocation scheme was designed to optimize the reward distribution at different stages of federated learning, encouraging edge servers to train sufficiently.
[0110] ① Personalized privacy protection and compensation plan, details are as follows:
[0111] Edge servers can set different privacy budgets based on their own privacy needs. A smaller privacy budget indicates a higher degree of random noise in the model gradient injection, thus providing greater privacy protection.
[0112] This embodiment defines privacy cost as the cost incurred due to the risk of privacy leakage, used to measure the privacy protection needs of the server. A linear privacy cost function is used, namely:
[0113] v i (p i ,ε i ) = p i ×ε i
[0114] Where, p i The cost of privacy leaks to server providers, ε i Privacy budget for server i.
[0115] To incentivize servers to reduce injected noise and improve the performance of the global model, a privacy cost compensation mechanism is introduced. Privacy cost compensation can be expressed as:
[0116] r c =γ×v i (p i ,ε i )
[0117] Here, γ is the privacy compensation coefficient. Specifically, for non-malicious servers with higher privacy budgets, more privacy cost compensation is provided to incentivize them to reduce injected noise, thereby improving the accuracy and convergence speed of the global model.
[0118] ② The dynamic reward distribution scheme is as follows:
[0119] A dynamic reward allocation scheme is proposed to incentivize edge servers to fully participate in training and ensure the accuracy and convergence speed of the global model.
[0120] Edge servers may upload non-converged models due to insufficient model training. Unlike detecting malicious servers, gradient distance is insufficient to filter out non-converged models; however, the accuracy of uploaded models can reflect the server's training status to some extent. Experiments show that increasing the number of iterations before model convergence helps improve model accuracy, meaning that fully trained converged models have higher accuracy. Therefore, rewards are allocated based on aggregated weights to incentivize servers to upload high-quality model gradients.
[0121] While considering aggregate weights, the reward allocation strategy is dynamically adjusted based on the accuracy of the global model to encourage servers to train fully and promote the convergence of the global model. As the accuracy of the global model improves, more rewards are allocated to servers with larger aggregate weights to incentivize them to continue training fully and provide more accurate models.
[0122] The server is divided into committee nodes and compute nodes. For committee nodes, the default reward is r. M For compute nodes, contribution weights are used to measure their relative reward. As mentioned above, contribution weights are calculated based on aggregate weights and global model accuracy, using the following formula:
[0123]
[0124] Where, α iLet a(ω) be the aggregate weight of this computation node. i ) represents the global model accuracy evaluated by the cloud server, and k is a preset adjustment parameter. There exists a point in the interval (0,1) where a(ω) i As the value of increases, the slope of the curve to the left of the point decreases, and the slope of the curve to the right of the point increases. This formula satisfies the condition that, in the later stages of federated learning training iterations, rewards are concentrated on servers with larger aggregation weights.
[0125] Then, by calculating the contribution weight percentage, the reward percentage is obtained as follows:
[0126]
[0127] The reward for this computing node is then expressed as:
[0128] r i =R×g i
[0129] Where R is the total computational reward for each round of global iteration.
[0130] like Figure 3 As shown, this embodiment provides a blockchain-based trusted federated learning method. Based on the above system embodiment, its specific steps are as follows:
[0131] S1. The edge server submits a privacy budget and pays a deposit;
[0132] S2. The cloud server initiates a federated learning training task and pays the fees;
[0133] S3. The smart contract elects committee nodes, and the remaining nodes become computing nodes;
[0134] S4. Edge servers read their respective state changes through smart contracts;
[0135] S5. Compute nodes train models using local datasets;
[0136] S6. To protect privacy, noise is added to the gradient of the trained model according to the privacy budget and then uploaded to the blockchain;
[0137] S7. The smart contract collects the model gradients uploaded by all computing nodes and calculates the distance between gradients;
[0138] S8. If the distance exceeds the preset threshold, the smart contract will identify the corresponding edge server as a malicious server, refuse the model gradient uploaded by it, and confiscate the deposit.
[0139] S9. The smart contract distributes the model gradient, after removing malicious gradients, to different committee nodes for cross-evaluation;
[0140] S10. Committee node read allocation scheme;
[0141] S11. The committee nodes calculate the corresponding model accuracy according to the allocation scheme;
[0142] S12. The committee nodes upload the results to the blockchain;
[0143] S13. The smart contract collects the model accuracy uploaded by all committee nodes and calculates the aggregate weight for each edge server. Based on the aggregate weight, the model gradients are aggregated to update the global model.
[0144] S14. The cloud server reads the global model;
[0145] S15. The cloud server uses a test set in the cloud to evaluate the accuracy of the global model;
[0146] S16. The cloud server uploads the accuracy data to the smart contract;
[0147] S17. Smart contracts use information such as aggregated weights of computing nodes and global model accuracy to calculate rewards for edge servers;
[0148] S18. The smart contract distributes rewards to the edge server.
[0149] Repeat steps S3-S18 until the model accuracy or the number of global iterations reaches the set requirements, at which point the process ends.
[0150] In summary, this invention proposes a blockchain-based trusted federated learning system and method for edge computing scenarios. This invention uses blockchain technology to ensure the auditability of federated learning data and uses an attack-resistant trusted computing incentive method to ensure the trustworthiness of federated learning results.
[0151] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the spirit of the present invention should fall within the protection scope of the present invention.
Claims
1. A blockchain-based trusted federated learning system for edge computing scenarios, characterized in that, This includes cloud servers, edge servers, and blockchain; The cloud server is used to define federated learning tasks, model structures and training objectives, verify the accuracy of the model and monitor the training process. The edge server is divided into computing nodes and committee nodes, which are used for model training and accuracy evaluation. The blockchain is used to manage the interaction between cloud servers and edge servers, ensuring the execution of protocols and the security of data; The blockchain deployment includes a malicious attack detection module, a committee-based model aggregation module, and a multi-factor-based dynamic incentive module. The malicious attack detection module is used to identify and remove gradients uploaded by malicious edge servers; The committee-based model aggregation module is used to evaluate the contribution of edge servers and obtain the optimal global model through weighted aggregation. The multi-factor-based dynamic incentive module provides personalized privacy protection and compensation schemes as well as dynamic reward allocation schemes to incentivize edge servers and train models. In the dynamic incentive module based on multiple factors: ① Personalized privacy protection and compensation plan, as detailed below: Privacy cost is defined as the cost incurred due to the risk of privacy breaches, used to measure the privacy protection needs of edge servers; a linear privacy cost function is employed, namely: in, For edge servers The cost of privacy breaches by organizations For edge servers Privacy budget; A privacy cost compensation mechanism is introduced, and the privacy cost compensation is expressed as follows: in, It is the privacy compensation coefficient; ② The dynamic reward distribution scheme is as follows: The edge servers are divided into committee nodes and compute nodes. For committee nodes, the preset reward is... For compute nodes, contribution weights are used to measure their relative reward. The contribution weights are calculated based on the aggregate weights and the global model accuracy, using the following formula: in, This is the aggregate weight of the computing node. The accuracy of the global model for evaluating cloud servers. These are the preset adjustment parameters; By calculating the contribution weight percentage, the reward percentage is obtained as follows: Where n represents the number of edge servers; Indicates contribution weight; The reward for this computing node is then expressed as: in, This is the total computational reward for each round of global iteration.
2. The trusted federated learning system based on blockchain in an edge computing scenario as described in claim 1, characterized in that, The malicious attack detection module detects malicious servers by calculating the distance between gradients.
3. The trusted federated learning system based on blockchain in an edge computing scenario as described in claim 1, characterized in that, The committee-based model aggregation module cross-distributes model gradients uploaded from non-malicious servers to multiple committee nodes, which then use their local datasets to test the accuracy of each model.
4. The trusted federated learning system based on blockchain in an edge computing scenario as described in claim 3, characterized in that, The committee-based model aggregation module is as follows: ① Selection of committee nodes: Nodes are selected based on the reputation value of the edge servers; the top m nodes with the highest reputation values are selected as committee nodes by sorting the reputation values in descending order, and the remaining nodes are used as computing nodes for model training; the value of m is greater than 0 and less than the number of edge servers. ② Generation of allocation scheme: The model gradient after removing the gradient of malicious models is allocated to multiple committee nodes for evaluation; ③ Gradient evaluation and uploading by committee nodes: After the allocation scheme is determined, the committee nodes evaluate the gradient accuracy of the models they are assigned according to the allocation scheme; the committee nodes test the models using local datasets, and after the evaluation is completed, the committee nodes upload their accuracy to the blockchain; ④ Calculation of aggregation weights: Based on the gradient accuracy uploaded by the committee nodes, calculate the average accuracy of each model gradient; normalize these average accuracies to obtain the weight of each model gradient in the aggregation; ⑤ Aggregation of the global model and update of reputation values: Based on the aggregation weights, the model gradients uploaded by the committee nodes are aggregated using a weighted average method to obtain the updated global model; based on the calculated gradient accuracy, the reputation values of the nodes are updated to reflect the nodes' contributions to federated learning.
5. A blockchain-based trusted federated learning method for edge computing scenarios, based on the blockchain-based trusted federated learning system for edge computing scenarios described in claims 1-4, characterized in that... The method is performed according to the following steps: S1. The edge server submits a privacy budget and pays a deposit; S2. The cloud server initiates a federated learning training task and pays the fees; S3. The smart contract elects committee nodes, and the remaining nodes become computing nodes; S4. Edge servers read their respective state changes through smart contracts; S5. Compute nodes train models using local datasets; S6. Add noise to the gradient of the trained model according to the privacy budget and upload it to the blockchain; S7. The smart contract collects the model gradients uploaded by all computing nodes and calculates the distance between gradients; S8. If the distance exceeds the preset threshold, the smart contract will identify the corresponding edge server as a malicious server, refuse the model gradient uploaded by it, and confiscate the deposit. S9. The smart contract distributes the model gradient, after removing malicious gradients, to different committee nodes for cross-evaluation; S10. Committee node read allocation scheme; S11. The committee nodes calculate the corresponding model accuracy according to the allocation scheme; S12. The committee nodes upload the results to the blockchain; S13. The smart contract collects the model accuracy uploaded by all committee nodes and calculates the aggregate weight of each edge server; The model gradients are aggregated based on the aggregated weights, thereby updating the global model; S14. The cloud server reads the global model; S15. The cloud server uses a test set in the cloud to evaluate the accuracy of the global model; S16. The cloud server uploads the accuracy data to the smart contract; S17. Smart contracts use information such as aggregated weights of computing nodes and global model accuracy to calculate rewards for edge servers; S18. The smart contract distributes rewards to the edge server; Repeat steps S3-S18 until the model accuracy or the number of global iterations reaches the set requirements, at which point the process ends.
Citation Information
Patent Citations
Block chain enabling federal learning system suitable for edge Internet of Vehicles
CN116663675A