Decentralized collaborative machine learning method and system for protecting power data privacy
Patent Information
- Application Number
- CN202311494414.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-09
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-11-09
AI Technical Summary
然而除了在1)中提到的隐私考虑外,这类数据通常实时产生,且数据量巨大,如果直接传输会对网络带宽和中央服务器的计算能力带来很大的压力,如果因此产生延迟,整个系统的时效性会受到影响
[0066]本发明面向电力负荷预测场景,为了实现在保护用户电力数据的同时,使电力公司能够预测出电力负荷,提出了一种基于多密钥同态的去中心化且高效的电力负荷预测模型训练架构。通过多密钥同态加密和随机置换的盲化方法,在两个聚合节点之间保护模型的参数,避免了恶意的参与方通过观察训练中间参数窃取原始信息的问题。
Smart Images

Figure CN117439796B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cryptographic technology applications, and in particular to a decentralized collaborative machine learning method and system for protecting the privacy of electricity data. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] Current electricity load forecasting technologies typically employ machine learning algorithms, predicting upcoming loads by learning the correlation between past electricity data characteristics and load values. However, data security and privacy protection are critical issues during this learning process, especially with the increasing use of smart meters and other smart appliances by consumers, aided by big data and internet technologies. While these devices facilitate electricity consumption and regulatory oversight, they also introduce risks of data breaches and privacy violations. Criminals can analyze peak electricity data from each household to deduce private information such as the number of people in the household, their commuting times, and lifestyle habits, posing a serious threat to public safety and social stability. Furthermore, the collection and use of data are increasingly subject to policy and legal restrictions.
[0004] Given the above background, how to protect users' electricity data while enabling power companies to predict electricity load is one of the urgent problems that the power industry needs to solve.
[0005] Specifically, using user power data to predict power load faces the following problems:
[0006] 1) Users who generate electricity data are unwilling or unable to transmit it directly due to increased awareness of privacy or restrictions imposed by laws and regulations, or their data may be obtained indirectly.
[0007] 2) A large amount of data is generated by smart electrical devices such as smart meters. These devices typically lack data processing and storage capabilities, and the usual practice is to transmit this data to a central server for processing or storage. However, in addition to the privacy considerations mentioned in 1), this type of data is usually generated in real time and is enormous in volume. Direct transmission would put a lot of pressure on network bandwidth and the computing power of the central server, and if this causes delays, the timeliness of the entire system would be affected.
[0008] 3) Servers that process data may be attacked or hijacked by hackers, threatening data security. In addition, individual servers are also prone to single points of failure. Once a server fails, the entire system will come to a standstill, causing serious losses.
[0009] Current technologies include federated learning for predicting electricity load based on user electricity data. Federated learning means that data does not leave the local machine; instead, each client trains its local model using limited local data, then uploads the gradients or model parameters to a central server. The central server then aggregates all uploaded local models or gradients to generate a global model. This method ensures that data remains local, thus protecting individual privacy. In electricity data scenarios, where data sources are relatively dispersed, federated learning is a superior choice. However, federated learning still has the following problems:
[0010] 1) Some researchers have pointed out that during federated learning, malicious attackers can calculate parts of the original data by observing the parameters of the local model. Therefore, strict privacy protection requires that the local gradients generated by each client be invisible during federated learning.
[0011] 2) The central server for federated learning cannot be guaranteed to be trustworthy and may be a single point of failure.
[0012] 3) In the power scenario, the terminal is a smart meter or other device with limited computing and storage capabilities, making it impossible to perform local training tasks. Summary of the Invention
[0013] To address the shortcomings of existing technologies, this invention provides a decentralized collaborative machine learning method and system for protecting the privacy of power data. This invention effectively avoids the problem of malicious participants stealing original information by observing intermediate parameters during model training through multi-key homomorphic encryption and random permutation blinding methods.
[0014] To achieve the above objectives, the present invention adopts the following technical solution:
[0015] The first aspect of this invention provides a decentralized collaborative machine learning method for protecting the privacy of electricity data.
[0016] Decentralized collaborative machine learning methods for protecting the privacy of power data, applied to power data centers, including:
[0017] The consistent hashing algorithm is used to uniformly map all nodes in the blockchain onto a ring. The latest block in the blockchain is selected, and a hash operation is performed to obtain the first hash value, which is used to determine the first aggregation node and the second aggregation node.
[0018] Using general nodes, the model gradient of the local model trained with user electricity consumption data is divided into several blocks. A certain part of the gradient block is selected so that the user can encrypt the gradient block using a public key and upload it to the first aggregation node. The general nodes refer to all nodes other than the first aggregation node and the second aggregation node.
[0019] After receiving the encrypted partial gradient, the first aggregation node shuffles the partial gradient block and the model parameters of the local model corresponding to the partial gradient block in the same order, and sends them to the second aggregation node.
[0020] After the second aggregation node decrypts the global model, it updates the parameters of the global model, encrypts the global model using the client's public key, and then transmits it to the first aggregation node.
[0021] The first aggregation node packages and uploads the updated global model and verification information to the blockchain in the normal order.
[0022] The global model is formed by aggregating multiple local models by the second aggregation node.
[0023] Furthermore, the process of determining the first aggregation node includes: finding two adjacent nodes such that the hash value of the preceding node is less than or equal to the first hash value, and the hash value of the following node is greater than or equal to the first hash value; and selecting the following node as the first aggregation node.
[0024] Furthermore, the process of determining the second aggregation node includes: performing hash calculation on the first hash value again to obtain the second hash value; finding two adjacent nodes again such that the hash value of the former node is less than or equal to the second hash value, and the hash value of the latter node is greater than or equal to the second hash value; and selecting the node closest to the second hash value as the second aggregation node.
[0025] Furthermore, the process of using general nodes to divide the model gradient of the local model trained by user electricity consumption data into several blocks, selecting a certain gradient block, and enabling the user to encrypt the gradient block using a public key is carried out using the DT-PKC encryption scheme.
[0026] Furthermore, when uploading the encrypted portion of the gradient block, the user also uploads the commitment to that gradient.
[0027] Furthermore, when the second aggregation node finishes the aggregation operation of the local model, the first aggregation node packages the aggregation result and the commitments of all gradients participating in the aggregation into a block and adds it to the blockchain.
[0028] Furthermore, the aggregation result satisfies:
[0029]
[0030] in, Gradient The corresponding commitment, Represents the commitments corresponding to all gradients;
[0031] Furthermore, the commitments corresponding to all gradients are calculated using the following formula:
[0032]
[0033] Where, θ t+1 Let θ be the model parameters at time t+1. t Let g be the model parameters at time t, α be the learning rate, and g be the model parameters at time t. i It is the gradient for the descent of the model parameter θ calculated using the electricity consumption data of the i-th user;
[0034] Furthermore, after the second aggregation node completes the aggregation operation, verify whether the second aggregation node has executed the aggregation correctly.
[0035] Furthermore, the first hash value is not fixed and cannot be predicted in advance;
[0036] Furthermore, there are several first aggregation nodes;
[0037] Furthermore, during the training of the local and global models, the latest block contains the global model after the latest iteration and the information required for verification.
[0038] A second aspect of the present invention provides a decentralized collaborative machine learning system for protecting the privacy of electricity data.
[0039] A decentralized collaborative machine learning system for protecting the privacy of power data, applied to power data centers, including:
[0040] The node selection module is configured to: use a consistent hashing algorithm to uniformly map all nodes in the blockchain onto a ring, select the latest block in the blockchain, perform a hash operation to obtain the first hash value, and use this to determine the first aggregation node and the second aggregation node;
[0041] The encryption module is configured to: use general nodes to divide the model gradient of the local model trained on the user's electricity consumption data into several blocks, select a certain gradient block, and have the user encrypt the gradient block using a public key and upload it to the first aggregation node; the general nodes refer to all nodes other than the first aggregation node and the second aggregation node.
[0042] The scrambling module is configured such that, after receiving the encrypted partial gradient, the first aggregation node scrambles the partial gradient block and the model parameters of the local model corresponding to the partial gradient block in the same order, and sends them to the second aggregation node.
[0043] The decryption module is configured as follows: after the second aggregation node decrypts the global model, it updates the parameters of the global model, encrypts the global model using the client's public key, and then transmits it to the first aggregation node.
[0044] The upload module is configured such that the first aggregation node packages and uploads the updated global model and verification information to the blockchain in normal order.
[0045] The global model is formed by aggregating multiple local models by the second aggregation node.
[0046] Furthermore, the process of determining the first aggregation node includes: finding two adjacent nodes such that the hash value of the preceding node is less than or equal to the first hash value, and the hash value of the following node is greater than or equal to the first hash value; and selecting the following node as the first aggregation node.
[0047] Furthermore, the process of determining the second aggregation node includes: performing hash calculation on the first hash value again to obtain the second hash value; finding two adjacent nodes again such that the hash value of the former node is less than or equal to the second hash value, and the hash value of the latter node is greater than or equal to the second hash value; and selecting the node closest to the second hash value as the second aggregation node.
[0048] Furthermore, the process of using general nodes to divide the model gradient of the local model trained from user electricity consumption data into several blocks, selecting a certain gradient block, and enabling the user to encrypt that gradient block using a public key is carried out using the DT-PKC encryption scheme.
[0049] Furthermore, when uploading the encrypted portion of the gradient block, the user also uploads the commitment to that gradient;
[0050] Furthermore, when the second aggregation node finishes the aggregation operation of the local model, the first aggregation node packages the aggregation result and the commitments of all gradients participating in the aggregation into a block and adds it to the blockchain.
[0051] Furthermore, the aggregation result satisfies:
[0052]
[0053] in, Gradient The corresponding commitment, Represents the commitments corresponding to all gradients;
[0054] Furthermore, the commitments corresponding to all gradients are calculated using the following formula:
[0055]
[0056] Where, θ t+1 Let θ be the model parameters at time t+1. t Let g be the model parameters at time t, α be the learning rate, and g be the model parameters at time t.i It is the gradient for the descent of the model parameter θ calculated using the electricity consumption data of the i-th user;
[0057] Furthermore, after the second aggregation node completes the aggregation operation, verify whether the second aggregation node has executed the aggregation correctly.
[0058] Furthermore, the first hash value is not fixed and cannot be predicted in advance;
[0059] Furthermore, there are several first aggregation nodes;
[0060] Furthermore, during the training of the local and global models, the latest block contains the global model after the latest iteration and the information required for verification.
[0061] A third aspect of the present invention provides a computer-readable storage medium.
[0062] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps in the decentralized collaborative machine learning method for protecting the privacy of power data as described in the first aspect above.
[0063] A fourth aspect of the present invention provides a computer device.
[0064] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps in the decentralized collaborative machine learning method for protecting the privacy of power data as described in the first aspect above.
[0065] Compared with the prior art, the beneficial effects of the present invention are:
[0066] This invention addresses the scenario of power load forecasting. To enable power companies to predict power load while protecting user power data, it proposes a decentralized and efficient power load forecasting model training architecture based on multi-key homomorphic encryption. By employing a blinding method using multi-key homomorphic encryption and random permutation, the model parameters are protected between two aggregation nodes, preventing malicious parties from stealing original information by observing intermediate training parameters.
[0067] This invention utilizes a decentralized architecture and employs a consistent hashing algorithm to randomly select aggregation nodes in each round, thus solving the problem of a single point of failure in the central server during traditional centralized training. During model parameter aggregation, this invention uses the Pedersen commitment scheme to ensure that users can verify the correctness of the aggregation results without knowing the model parameters of other users. Attached Figure Description
[0068] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments and descriptions of the invention are used to explain the invention and do not constitute an improper limitation of the invention.
[0069] Figure 1 This is a flowchart illustrating a decentralized collaborative machine learning method for protecting the privacy of electricity data, as shown in this invention.
[0070] Figure 2 This is a training architecture diagram of a decentralized power load prediction model based on multi-key homomorphism as shown in this invention;
[0071] Figure 3 This is a schematic diagram illustrating the selection of aggregation nodes using the consistent hashing algorithm shown in this invention;
[0072] Figure 4 This is a schematic diagram illustrating the interaction process between a user and aggregation server A as shown in this invention;
[0073] Figure 5 This is a flowchart illustrating the interaction between aggregation servers A and B as shown in this invention. Detailed Implementation
[0074] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0075] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0076] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0077] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0078] Example 1
[0079] like Figure 1 As shown, this embodiment provides a decentralized collaborative machine learning method for protecting the privacy of power data, applied to a power data center, including:
[0080] The consistent hashing algorithm is used to uniformly map all nodes in the blockchain onto a ring. The latest block in the blockchain is selected, and a hash operation is performed to obtain the first hash value, which is used to determine the first aggregation node and the second aggregation node.
[0081] Using general nodes, the model gradient of the local model trained with user electricity consumption data is divided into several blocks. A certain part of the gradient block is selected so that the user can encrypt the gradient block using a public key and upload it to the first aggregation node. The general nodes refer to all nodes other than the first aggregation node and the second aggregation node.
[0082] After receiving the encrypted partial gradient, the first aggregation node shuffles the partial gradient block and the model parameters of the local model corresponding to the partial gradient block in the same order, and sends them to the second aggregation node.
[0083] After the second aggregation node decrypts the global model, it updates the parameters of the global model, encrypts the global model using the client's public key, and then transmits it to the first aggregation node.
[0084] The first aggregation node packages and uploads the updated global model and verification information to the blockchain in the normal order.
[0085] The global model is formed by aggregating multiple local models by the second aggregation node.
[0086] The following is a detailed description of this embodiment with reference to the accompanying drawings:
[0087] like Figure 2 Embodiment 1 of this invention provides a decentralized collaborative machine learning method for protecting the privacy of electricity data. Here, ① refers to household appliances, such as refrigerators, televisions, and water heaters; ② refers to smart meters, used to collect electricity data generated by these appliances; ③ refers to edge computing devices connected to the meters; in this solution, a home PC is assumed to act as the edge computing device for local training; and ④ refers to the blockchain, where the edge computing device executes the aggregation process through smart contract protocols and uses the blockchain for synchronization and maintenance through a specific consensus algorithm.
[0088] Table 1 Explanation of Relevant Parameters
[0089]
[0090] The specific solution process of this invention, according to the data flow direction, is described below. Table 1 explains the relevant parameters involved in the technical solution of this invention:
[0091] S1: User i Data on electricity consumption generated using household appliances, where i∈1,2,…,n. i .
[0092] S2: Smart meters collect electricity consumption data. i .
[0093] S3: Edge computing node i Using Data i Training local model M i .
[0094] S4-S5 below occur in parallel across all nodes, using the local model trained in S3. S6-7 occur after the aggregation node receives the local models from all nodes.
[0095] S4: All edge computing nodes use consistent hashing to elect two aggregation nodes, Agg. A and Agg B .
[0096] S5: Node i Select a portion of the gradient encryption and transmit it to Agg. A .
[0097] S6: Agg A and Agg B The global model is updated using a secure aggregation algorithm.
[0098] S7: Agg A The updated global model and necessary verification information are uploaded to the blockchain for all nodes to download and verify.
[0099] Specifically, step S4 includes the following steps:
[0100] A hash algorithm is a method that, given an input, produces a fixed-length string (also called a message digest). The same input will produce the same output, and different inputs will likely produce different outputs. Furthermore, the value of the input cannot be calculated from the output. A consistent hashing algorithm maps all possible hash values to an abstract ring, where each point on the ring represents a hash value.
[0101] This invention maps the nodes in the blockchain evenly onto the ring, such as... Figure 3 As shown. Assume the position of a node in the ring is Hash(Node). i Retrieve the latest block from the blockchain, perform a hash operation to obtain the Hash(Block), and then find the Node. i-1 and Node i This makes Hash(Node) i-1 Hash(Block) ≤ Hash(Node) i Select Node iAs Agg A Similarly, perform another hash calculation on Hash(Block) to obtain Hash(Hash(Block)), and then find Hash(Node). j-1 )≤hash(hash(Block))≤hash(Node j ), where Node j The selection of nodes depends on the value of Hash(Hash(Block)), and the node closest to that value is selected as the second aggregation node. Therefore, Node is selected. j As Agg B In this process, since the hash value of the latest block is not fixed and cannot be predicted in advance, the selection of the two aggregation nodes can be regarded as random, ensuring the safety and reliability of the selection process.
[0102] The latest block contains the global model after the latest iteration and the information required for verification. The global model is an aggregation of multiple local models.
[0103] Specifically, step S5 includes the following steps:
[0104] Traditional homomorphic encryption schemes allow users to directly perform operations on encrypted data, and decrypting the result yields the same result as the plaintext computation. However, this requires all users participating in the computation to share the same public-private key pair. If the key is lost, all users' data is at risk of being leaked.
[0105] This invention uses the Distributed Two Trapdoors Public-Key Cryptosystem (DT-PKC) scheme to encrypt local model gradients. This scheme allows each user to hold a different public-private key pair (pk). i ,sk i Furthermore, ciphertexts encrypted with different public keys can be computed together and decrypted using their corresponding joint private key. and Furthermore, this encryption scheme contains a strong trapdoor. A strong private key constructed using the strong trapdoor can decrypt ciphertext encrypted with any weak key.
[0106] like Figure 4 As shown, based on this encryption scheme, the Node... i Divide all local gradients into N blocks, and select the j-th part. Encrypt using your own public key. Uploaded to Agg AAmong them, Node i It can refer to all nodes except the first aggregation node and the second aggregation node.
[0107] The local model gradient is obtained by using a machine learning gradient descent algorithm.
[0108] Specifically, step S6 includes the following steps:
[0109] Agg A After receiving the encrypted partial gradient from step S5, these parameters are randomly permuted (i.e., completely shuffled). The disordered gradients and the model parameters, which are also shuffled in the same order. Send to Agg B Agg B After decryption using a strong key, the global model parameters are updated, but due to Agg... B Because the order of the original parameters is unknown, it's impossible to recover the portion of the model uploaded by the client, and therefore, information cannot be obtained. Afterwards, Agg... B The updated model parameters are encrypted using the client's public key and then transmitted to Agg. A Agg A After arranging the data in the correct order, package and upload it to the blockchain. A With Agg B The interaction process is as follows Figure 5 As shown.
[0110] Step S7 includes the following steps:
[0111] The updates of each parameter in the model are essentially independent, as expressed by the formula: (g1+g2+…+g n ), where θ is the model parameter, α is the learning rate, and g i It is the gradient for the descent of the model parameter θ calculated by the i-th user using local data.
[0112] This invention employs the Pedersen commitment scheme from cryptography. The committing party selects sensitive data *m*, calculates the corresponding commitment *c*, and then sends commitment *c* to the verifier. Through commitment *c*, the verifier confirms that the committing party has only one way to decrypt the unabridged sensitive data *m*, and therefore cannot breach the agreement. Furthermore, the Pedersen commitment scheme also possesses the additive homomorphic property, i.e., COMM(∑ j m j )=∏ j COMM(m j ).
[0113] Based on the above, this invention designs a verifiable model aggregation method. We require Nodei Upload its encrypted gradient At the same time, upload the commitment for that gradient. When Agg B After the aggregation operation is completed, Agg A The aggregation result θ t+1 All commitments from the gradients participating in the aggregation are packaged into a block and added to the blockchain. The aggregated result should satisfy the homomorphic property, i.e. and It can be done through n×(θ) t+1 -θ t The result is obtained by calculating ) ÷ α. Therefore, the user in Agg... B After performing the aggregation operation, Agg can be verified. B Whether the aggregation was performed correctly.
[0114] In addition, the global model can be used to predict peak electricity consumption data, but it does not include raw electricity consumption data.
[0115] Example 2
[0116] This embodiment provides a decentralized collaborative machine learning system that protects the privacy of power data.
[0117] A decentralized collaborative machine learning system for protecting the privacy of power data, applied to power data centers, including:
[0118] The node selection module is configured to: use a consistent hashing algorithm to uniformly map all nodes in the blockchain onto a ring, select the latest block in the blockchain, perform a hash operation to obtain the first hash value, and use this to determine the first aggregation node and the second aggregation node;
[0119] The encryption module is configured to: use general nodes to divide the model gradient of the local model trained on the user's electricity consumption data into several blocks, select a certain gradient block, and have the user encrypt the gradient block using a public key and upload it to the first aggregation node; the general nodes refer to all nodes other than the first aggregation node and the second aggregation node.
[0120] The scrambling module is configured such that, after receiving the encrypted partial gradient, the first aggregation node scrambles the partial gradient block and the model parameters of the local model corresponding to the partial gradient block in the same order, and sends them to the second aggregation node.
[0121] The decryption module is configured as follows: after the second aggregation node decrypts the global model, it updates the parameters of the global model, encrypts the global model using the client's public key, and then transmits it to the first aggregation node.
[0122] The upload module is configured such that the first aggregation node packages and uploads the updated global model and verification information to the blockchain in normal order.
[0123] The global model is formed by aggregating multiple local models by the second aggregation node.
[0124] It should be noted that the node selection module, encryption module, scrambling module, decryption module, and upload module described above are the same as those implemented in the examples and application scenarios corresponding to Embodiment 1, but are not limited to the content disclosed in Embodiment 1. It should also be noted that these modules, as part of the system, can be executed in a computer system such as a set of computer-executable instructions.
[0125] Example 3
[0126] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the decentralized collaborative machine learning method for protecting power data privacy as described in Embodiment 1 above.
[0127] Example 4
[0128] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the decentralized collaborative machine learning method for protecting power data privacy as described in Embodiment 1 above.
[0129] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0130] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0131] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0132] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0133] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0134] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A decentralized collaborative machine learning method for protecting the privacy of electricity data, characterized in that, Applications in power data centers include: The consistent hashing algorithm is used to uniformly map all nodes in the blockchain onto a ring. The latest block in the blockchain is selected, and a hash operation is performed to obtain the first hash value, which is used to determine the first aggregation node and the second aggregation node. Using general nodes, the model gradient of the local model trained with user electricity consumption data is divided into several blocks. A certain part of the gradient block is selected so that the user can encrypt the gradient block using a public key and upload it to the first aggregation node. The general nodes refer to all nodes other than the first aggregation node and the second aggregation node. After receiving the encrypted partial gradient, the first aggregation node shuffles the partial gradient block and the model parameters of the local model corresponding to the partial gradient block in the same order, and sends them to the second aggregation node. After the second aggregation node decrypts the global model, it updates the parameters of the global model, encrypts the global model using the client's public key, and then transmits it to the first aggregation node. The first aggregation node packages and uploads the updated global model and verification information to the blockchain in the normal order. The global model is formed by aggregating multiple local models by the second aggregation node.
2. The decentralized collaborative machine learning method for protecting the privacy of power data according to claim 1, characterized in that, The process of determining the first aggregation node includes: finding two adjacent nodes such that the hash value of the preceding node is less than or equal to the first hash value, and the hash value of the following node is greater than or equal to the first hash value; and selecting the following node as the first aggregation node.
3. The decentralized collaborative machine learning method for protecting the privacy of power data according to claim 1, characterized in that, The process of determining the second aggregation node includes: performing hash calculation on the first hash value again to obtain the second hash value; finding two adjacent nodes again such that the hash value of the former node is less than or equal to the second hash value, and the hash value of the latter node is greater than or equal to the second hash value; and selecting the node closest to the second hash value as the second aggregation node.
4. The decentralized collaborative machine learning method for protecting the privacy of power data according to claim 1, characterized in that, The process involves using general nodes to divide the model gradient of the local model trained from user electricity consumption data into several blocks, selecting a certain gradient block, and having the user encrypt that gradient block using a public key. The DT-PKC encryption scheme is used.
5. The decentralized collaborative machine learning method for protecting the privacy of power data according to claim 1, characterized in that, When uploading the encrypted portion of the gradient block, the user also uploads the commitment to that gradient.
6. The decentralized collaborative machine learning method for protecting the privacy of power data according to claim 1, characterized in that, When the second aggregation node finishes performing the aggregation operation on the local model, the first aggregation node packages the aggregation result and all commitments of the gradients participating in the aggregation into a block and adds it to the blockchain. Alternatively, the aggregation result satisfies: in, Gradient The corresponding commitment, Represents the commitments corresponding to all gradients; Alternatively, the commitments corresponding to all gradients can be calculated using the following formula: Where, θ t+1 Let θ be the model parameters at time t+1. t Let g be the model parameters at time t, α be the learning rate, and g be the model parameters at time t. i It is the gradient for the descent of the model parameter θ calculated using the electricity consumption data of the i-th user; Alternatively, after the second aggregation node completes the aggregation operation, verify whether the second aggregation node has executed the aggregation correctly. Alternatively, the first hash value is not fixed and cannot be predicted in advance; Alternatively, there may be several first aggregation nodes; Alternatively, during the training of the local and global models, the latest block contains the global model after the latest iteration, as well as the information required for verification.
7. A decentralized collaborative machine learning system for protecting the privacy of electricity data, characterized in that, Applications in power data centers include: The node selection module is configured to: use a consistent hashing algorithm to uniformly map all nodes in the blockchain onto a ring, select the latest block in the blockchain, perform a hash operation to obtain the first hash value, and use this to determine the first aggregation node and the second aggregation node; The encryption module is configured to: use general nodes to divide the model gradient of the local model trained on the user's electricity consumption data into several blocks, select a certain gradient block, and have the user encrypt the gradient block using a public key and upload it to the first aggregation node; the general nodes refer to all nodes other than the first aggregation node and the second aggregation node. The scrambling module is configured such that, after receiving the encrypted partial gradient, the first aggregation node scrambles the partial gradient block and the model parameters of the local model corresponding to the partial gradient block in the same order, and sends them to the second aggregation node. The decryption module is configured as follows: after the second aggregation node decrypts the global model, it updates the parameters of the global model, encrypts the global model using the client's public key, and then transmits it to the first aggregation node. The upload module is configured such that the first aggregation node packages and uploads the updated global model and verification information to the blockchain in normal order. The global model is formed by aggregating multiple local models by the second aggregation node.
8. The decentralized collaborative machine learning system for protecting the privacy of power data according to claim 7, characterized in that, The process of determining the first aggregation node includes: finding two adjacent nodes such that the hash value of the preceding node is less than or equal to the first hash value, and the hash value of the following node is greater than or equal to the first hash value; and selecting the following node as the first aggregation node. Alternatively, the process of determining the second aggregation node includes: performing hash calculation on the first hash value again to obtain the second hash value; finding two adjacent nodes again such that the hash value of the former node is less than or equal to the second hash value, and the hash value of the latter node is greater than or equal to the second hash value; and selecting the node closest to the second hash value as the second aggregation node. Alternatively, the process of using general nodes to divide the model gradient of the local model trained from user electricity consumption data into several blocks, selecting a certain gradient block, and having the user encrypt that gradient block using a public key; is performed using the DT-PKC encryption scheme. Alternatively, when uploading the encrypted portion of the gradient block, the user may also upload the commitment to that gradient. Alternatively, when the second aggregator node finishes performing the aggregation operation on the local model, the first aggregator node packages the aggregation result and all commitments of the gradients participating in the aggregation into a block and adds it to the blockchain. Alternatively, the aggregation result satisfies: in, Gradient The corresponding commitment, Represents the commitments corresponding to all gradients; Alternatively, the commitments corresponding to all gradients can be calculated using the following formula: Where, θ t+1 Let θ be the model parameters at time t+1. t Let g be the model parameters at time t, α be the learning rate, and g be the model parameters at time t. i It is the gradient for the descent of the model parameter θ calculated using the electricity consumption data of the i-th user; Alternatively, after the second aggregation node completes the aggregation operation, verify whether the second aggregation node has executed the aggregation correctly. Alternatively, the first hash value is not fixed and cannot be predicted in advance; Alternatively, there may be several first aggregation nodes; Alternatively, during the training of the local and global models, the latest block contains the global model after the latest iteration, as well as the information required for verification.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps in the decentralized collaborative machine learning method for protecting the privacy of power data as described in any one of claims 1-6.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the decentralized collaborative machine learning method for protecting the privacy of power data as described in any one of claims 1-6.
Citation Information
Patent Citations
Model training verification method and device based on federated learning, equipment and medium
CN113435121A
Multi-party privacy protection machine learning method based on homomorphic encryption and trusted hardware
CN113553610A