Asynchronous clustering federated learning method and device
By adopting DAG distributed ledger technology and asynchronous clustered federated learning method in federated learning, the problems of network heterogeneity and computing power differences are solved, efficient and secure federated learning is achieved, and data privacy protection and tamper-proof are enhanced. .
Patent Information
- Application Number
- CN202311072605.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-24
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2043-08-24
AI Technical Summary
Existing federated learning methods are difficult to deal with the heterogeneity of network environments and differences in client computing capabilities, and are susceptible to single point of failure, resulting in interruptions in training processes, leakage of model parameters, and privacy and security issues.
Using asynchronous clustering federated learning method based on DAG distributed ledger technology, the model parameters are stored and history is recorded through a two-layer architecture and P2P communication mechanism, so as to achieve tamper-proof and auditable, and the model parameter similarity selection is performed. Tip nodes perform asynchronous federated learning.
It improves the efficiency and privacy security of federated learning, adapts to collaboration in different fields and environments, enhances data privacy protection, and realizes the efficiency and tamper-proof of asynchronous federated learning.
Smart Images

Figure CN117094415B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an asynchronous clustering federated learning method based on DAG distributed ledger technology, belonging to the technical field of federated learning. Background Art
[0002] The increasing popularity of the Internet of Things (IoT) and smartphones has greatly changed people's lifestyles and working environments, providing greater connectivity and convenience. Current research shows that there are more than 14.3 billion active IoT endpoints and approximately 6.84 billion smartphones worldwide. These devices are equipped with advanced sensors, computing power, and communication capabilities, enabling them to perform various tasks and collect large amounts of data to train machine learning models. However, the data collected by these devices are usually distributed in different locations and owned by different users. Limited communication resources pose a challenge to collecting this data to a central server. In addition, the data collected by these devices often contains sensitive personal information, resulting in users being reluctant to share the data with others due to privacy concerns. Therefore, there are significant challenges and limitations in using such distributed privacy-sensitive datasets to centrally train machine learning models.
[0003] Although Federated Learning can achieve machine learning while protecting data privacy, the server of Federated Learning cannot access the actual distribution of user data, which makes it vulnerable to the challenges brought by the statistical heterogeneity of data. This non-independent and identically distributed (non-iid) data distribution may lead to a decrease in model accuracy. Researchers divide independent and identically distributed data into client-wise non-IID and cluster-wise non-IID. When the labels vary significantly between different clients, it is called client-wise non-IID; when the distribution of labels between different clusters is very different, it is called cluster-wise non-IID. At the same time, Federated Learning is a centralized synchronous learning mechanism that has difficulty in handling the heterogeneity of the network environment and the differences in client computing power. It is also susceptible to single point failures, which can lead to interruptions in the training process, leakage of model parameters, and privacy and security issues. Summary of the invention
[0004] In view of the fact that existing federated learning methods are difficult to handle the heterogeneity of network environments and differences in client computing capabilities, and are easily affected by single point failures, resulting in interruption of the training process, leakage of model parameters and privacy security issues, the present invention provides an asynchronous clustering federated learning method based on DAG (Directed Acyclic Graphs) distributed ledger technology.
[0005] An asynchronous clustering federated learning method of the present invention is implemented based on a two-layer architecture, which includes a server layer and a client layer. Multiple servers and corresponding DAG ledgers are deployed in the server layer. Multiple servers in the server layer communicate with each other in a P2P manner to synchronize the DAG ledger. Each client in the client layer is configured with a local data set, and the client is a device currently participating in training.
[0006] The method comprises:
[0007] S1. The client selects a server and establishes a connection. The client transmits the hash value of the latest transaction to the selected server.
[0008] S2. The server verifies the validity of the hash value and uses the hash value to query the DAG ledger to obtain the model parameters of the corresponding client from the DAG ledger. Based on the model parameters of the client, the server uses a predefined Tip selection algorithm to select the Tip node in the DAG ledger, aggregates the model stored in the selected Tip node to obtain a new model, and sends the new model to the client.
[0009] S3: The client uses the local data set to perform multiple rounds of training on the new model received from the server to obtain the trained model, and returns the trained model parameters to the server;
[0010] S4. The server packages the model parameters received from the client into a new transaction. The server links the new transaction to each previously selected Tip node to become a new Tip node, calculates the hash value of the new transaction, sends the hash value to the client for the next training, and broadcasts the new transaction to other servers.
[0011] As a preference, for new clients joining federated learning:
[0012] In S1, when the client joins federated learning for the first time, it applies to the server for the initial model, performs multiple rounds of training on the initial model using the local training data set, and after the training is completed, transmits the trained model parameters to the server as the client's model parameters.
[0013] Preferably, the method of selecting a Tip node using a predefined Tip selection algorithm includes:
[0014] Calculate the similarity between the model parameters on the Tip node and the customer's model parameters, and select the Tip node with high similarity.
[0015] Preferably, the similarity is:
[0016]
[0017] Among them, ωi represents the model parameters on the i-th Tip node, ω client Represents the model parameters of the customer.
[0018] Preferably, the BEAST algorithm is used to detect the mutation points of the similarity sequence after descending sorting, and the confidence sequence Confidence of the mutation points is obtained;
[0019] Select a point in Confidence whose confidence is greater than the threshold α, and use all the Tip nodes before this point as the selected Tip nodes.
[0020] Preferably, the server is deployed in a real edge device environment on multiple mobile edge computing cloud servers or communication base stations.
[0021] Preferably, the client can establish connections with different servers at any time.
[0022] The present invention also provides an asynchronous clustering federated learning device, including a server layer and a client layer, wherein a plurality of servers and corresponding DAG ledgers are deployed in the server layer, and the plurality of servers in the server layer communicate with each other in a P2P manner to synchronize the DAG ledgers, and each client in the client layer is configured with a local data set, and the client is a device currently participating in training;
[0023] The client is used to select a server and establish a connection, and the client transmits the hash value of the latest transaction to the selected server;
[0024] The server is used to verify the validity of the hash value, and use the hash value to query the DAG ledger to obtain the model parameters of the corresponding client from the DAG ledger; and according to the model parameters of the client, a predefined Tip selection algorithm is used to select the Tip node in the DAG ledger, aggregate the model stored in the selected Tip node to obtain a new model, and send the new model to the client;
[0025] The client is further used to perform multiple rounds of training on the new model received from the server using the local data set to obtain a trained model, and return the trained model parameters to the server;
[0026] The server is used to package the model parameters received from the client into a new transaction, link the new transaction to the back of each Tip node selected previously to become a new Tip node, calculate the hash value of the new transaction, send the hash value to the client for the next training, and broadcast the new transaction to other servers.
[0027] Preferably, the client is also used to apply to the server for an initial model when joining federated learning for the first time, perform multiple rounds of training on the initial model using a local training data set, and after the training is completed, transmit the trained model parameters to the server as the client's model parameters.
[0028] Preferably, the server calculates the cosine similarity between the model parameters on the Tip node and the model parameters of the client, selects the Tip node with high similarity, applies the BEAST algorithm to detect the mutation points of the similarity sequence after descending sorting, and obtains the confidence sequence Confidence of the mutation points; selects a point in Confidence whose confidence is greater than a threshold α, and uses all the Tip nodes before the point as the selected Tip nodes.
[0029] The beneficial effects of the present invention are as follows: the present invention provides a two-layer asynchronous clustering federated learning framework based on directed acyclic graph distributed ledger technology, which can promote efficient federated learning between different fields, enhance collaboration and data privacy by utilizing the decentralization and asynchrony of DAG distributed ledger technology, and achieve tamper-proof and auditability by using DAG-DLT to store model parameters and record the history of federated learning. In addition, the present invention also provides an adaptive tip selection algorithm based on model parameter similarity to realize asynchronous federated learning for cluster-wise non-iid data distribution. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a schematic diagram of the principle of the double-layer architecture of the present invention;
[0031] Figure 2 This is a schematic diagram of the network structure of the DAG ledger;
[0032] Figure 3 It is a timing diagram of the training process of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0035] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0036] The asynchronous clustering federated learning method of this embodiment is implemented based on a two-layer architecture, which includes a server layer and a client layer. Multiple servers and corresponding DAG ledgers are deployed in the server layer. Multiple servers in the server layer use P2P communication to synchronize the DAG ledger and complete the update of the DAG ledger, thereby ensuring the synchronization of new transactions and information in the entire distributed ledger maintained by the server. The network structure of the DAG ledger is as follows: Figure 2 As shown in the figure. The server can be deployed in a real edge device environment on multiple mobile edge computing cloud servers or communication base stations. This deployment strategy can be closer to edge devices and facilitate efficient communication and model exchange between clients and DAG distributed ledger servers.
[0037] The client layer consists of multiple clients. Each client in the client layer is configured with a local dataset. The client is the device currently participating in the training, including smartphones, sensor devices, and IoT devices.
[0038] Due to the network conditions and the mobility of mobile edge devices, the connection between clients and servers is flexible. Clients can establish connections with different servers at any time. They can choose the nearest and most suitable server according to the network conditions and their own location. This flexibility enables our proposed framework to adapt to various mobile edge computing environments.
[0039] By considering the dynamic network state and client mobility, the framework of this embodiment ensures efficient and adaptable communication between the client and the server. This adaptability helps to improve the overall efficiency and performance of the federated learning process in different mobile edge computing scenarios.
[0040] Figure 1 The description is just a simplified description, and the actual deployment may need to be adjusted according to specific circumstances.
[0041] The two-layer framework of this embodiment can be flexibly deployed in different environments, including the Internet of Vehicles and smart city scenarios. In the context of the Internet of Vehicles, the server can be deployed on a base station, such as a roadside unit (RSU). The clients in this scenario are various devices in the vehicle that participate in the federated learning process. These devices can include on-board computers, infotainment systems, or other connected vehicle components. As for the smart city environment, the DAG distributed ledger server can be deployed on distributed nodes throughout the city. These nodes can be located on infrastructure elements such as lamp posts, utility poles, or other central points in the city. In this case, the clients will include various devices and nodes in the smart city ecosystem, such as cameras, sensors, smart street lights, environmental monitoring systems, etc. The versatility of the two-layer framework enables it to be deployed and adapted in different environments to meet the specific requirements and characteristics of each scenario. By leveraging the decentralization and asynchrony of the DAG distributed ledger technology, this embodiment can promote efficient federated learning between different fields, enhance collaboration and data privacy, and adapt to the unique combination of infrastructure and devices in the Internet of Things and smart city environments.
[0042] by Figure 2 For example, in Figure 2 There are two clients (1 and 2) and two DAG ledger servers (A and B). Each client trains a model using its local dataset. Client 1 connects to server A and client 2 connects to server B. Client i selects a server within its communication range and establishes a connection with the selected server. The training process of the client is as follows: Figure 2 As shown, including:
[0043] Step 1. The client selects a server and establishes a connection. The client transmits the hash value of the latest transaction to the selected server. It should be noted that for the client that has newly joined the federated learning, it applies to the server to obtain the initial model. The initial model is stored on the Genesis node. The initial model is trained multiple times using the local training data set. After the training is completed, the trained model parameters are transmitted to the server as the client's model parameters.
[0044] Step 2: The server verifies the validity of the hash value and uses the hash value to query the DAG ledger to obtain the model parameters of the corresponding client from the DAG ledger. If it is a new client that joins the federated learning, after receiving the client's training request and sending the initial model to the client, the client's model parameters will be directly received without the need to use the hash value query. The server then uses the predefined Tip selection algorithm to select the Tip node in the DAG ledger based on the client's model parameters, aggregates the model stored in the selected Tip node to obtain a new model, and sends the new model to the client. Each node on the DAG ledger corresponds to a model published by the client, which can be stored in a distributed database such as IPFS. The corresponding model can be found through the hash value of the transaction.
[0045] Step 3: The client uses the local data set to perform multiple rounds of training on the new model received from the server to obtain the trained model, and returns the trained model parameters to the server;
[0046] Step 4: The server packages the model parameters received from the client into a new transaction. The server links the new transaction to each previously selected Tip node to become a new Tip node, calculates the hash value of the new transaction, sends the hash value to the client for the next training, and broadcasts the new transaction to other servers.
[0047] The federated learning method of this embodiment uses DAG-DLT to store model parameters and record the history of federated learning, achieving tamper-proof and auditability. This embodiment also provides a Tip selection algorithm, the core idea of which is to calculate the cosine similarity between the model parameters on the tip node and the model parameters provided by the customer to select tips with high similarity, and use the BEAST algorithm to achieve self-adaptation of tip selection.
[0048] The method for selecting a Tip node using a predefined Tip selection algorithm in this embodiment includes:
[0049] When receiving a training request from a client, the server first obtains all tip nodes in the DAG distributed ledger;
[0050] Then, the similarity of model parameters between the model stored on each Tip node and the latest model of the client is calculated to obtain the similarity sequence similarity. The similarity calculation formula is:
[0051]
[0052] Sort the similarity sequence similarity in descending order;
[0053] The BEAST algorithm is used to detect the mutation points of the similarity sequence similarity and obtain the confidence sequence Confidence of the mutation points;
[0054] Select a point whose confidence is greater than the threshold α, and use all the Tip nodes before this point as the selected Tip nodes;
[0055] Aggregate the models on the selected Tip nodes to get a new model.
[0056] This algorithm implements asynchronous federated learning for cluster-wise non-iid data distribution.
[0057] The asynchronous clustering federated learning device of this embodiment includes a server layer and a client layer. Multiple servers and corresponding DAG ledgers are deployed in the server layer. Multiple servers in the server layer communicate with each other in a P2P manner to synchronize the DAG ledger. Each client in the client layer is configured with a local data set, and the client is a device currently participating in training.
[0058] The client is used to select a server and establish a connection, and the client transmits the hash value of the latest transaction to the selected server;
[0059] The server is used to verify the validity of the hash value, and use the hash value to query the DAG ledger to obtain the model parameters of the corresponding client from the DAG ledger; and according to the model parameters of the client, a predefined Tip selection algorithm is used to select the Tip node in the DAG ledger, aggregate the model stored in the selected Tip node to obtain a new model, and send the new model to the client;
[0060] The client is further used to perform multiple rounds of training on the new model received from the server using the local data set to obtain a trained model, and return the trained model parameters to the server;
[0061] The server is used to package the model parameters received from the client into a new transaction, link the new transaction to the back of each Tip node selected previously to become a new Tip node, calculate the hash value of the new transaction, send the hash value to the client for the next training, and broadcast the new transaction to other servers.
[0062] The learning process of the asynchronous clustering federated learning device and the functions of the client and server of this embodiment are the same as the above-mentioned asynchronous clustering federated learning method.
[0063] Although the present invention is described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the present invention. It should therefore be understood that many modifications may be made to the exemplary embodiments and that other arrangements may be devised without departing from the spirit and scope of the present invention as defined by the appended claims. It should be understood that the various dependent claims and features described herein may be combined in a manner different from that described in the original claims. It should also be understood that features described in conjunction with individual embodiments may be used in other described embodiments.
Claims
1. Asynchronous clustering federated learning method, characterized in that: The method is implemented based on a two-layer architecture, which includes a server layer and a client layer. Multiple servers and corresponding DAG ledgers are deployed in the server layer. Multiple servers in the server layer communicate with each other in a P2P manner to synchronize the DAG ledger. Each client in the client layer is configured with a local data set, and the client is a device currently participating in training. The method comprises: S1. The client selects a server and establishes a connection. The client transmits the hash value of the latest transaction to the selected server. S2. The server verifies the validity of the hash value and uses the hash value to query the DAG ledger to obtain the model parameters of the corresponding client from the DAG ledger. Based on the model parameters of the client, the server uses a predefined Tip selection algorithm to select the Tip node in the DAG ledger, aggregates the model stored in the selected Tip node to obtain a new model, and sends the new model to the client. S3. The client uses the local data set to perform multiple rounds of training on the new model received from the server to obtain the trained model, and returns the trained model parameters to the server; S4. The server packages the model parameters received from the client into a new transaction. The server links the new transaction to each previously selected Tip node to become a new Tip node. The server calculates the hash value of the new transaction, sends the hash value to the client for the next training, and broadcasts the new transaction to other servers. Methods for selecting tip nodes using a predefined tip selection algorithm include: Calculate the similarity between the model parameters on the Tip node and the customer's model parameters, and select the Tip node with high similarity; The similarity is: Among them, ω i represents the model parameters on the i-th Tip node, ω client Model parameters representing customers; The BEAST algorithm is used to detect the mutation points of the similarity sequence after descending sorting, and the confidence sequence Confidence of the mutation points is obtained; Select a point in Confidence whose confidence is greater than the threshold α, and use all the Tip nodes before this point as the selected Tip nodes.
2. The asynchronous clustering federated learning method according to claim 1, characterized in that: For new clients joining federated learning: In S1, when the client joins federated learning for the first time, it applies to the server for the initial model, performs multiple rounds of training on the initial model using the local training data set, and after the training is completed, transmits the trained model parameters to the server as the client's model parameters.
3. The asynchronous clustering federated learning method according to claim 1 or 2, characterized in that: The server is deployed in a real edge device environment on multiple mobile edge computing cloud servers or communication base stations.
4. The asynchronous clustering federated learning method according to claim 1 or 2, characterized in that: The client establishes connections with different servers at any time.
5. An asynchronous clustering federated learning device, characterized in that: It includes a server layer and a client layer. Multiple servers and corresponding DAG ledgers are deployed in the server layer. Multiple servers in the server layer communicate with each other in a P2P manner to synchronize the DAG ledger. Each client in the client layer is configured with a local data set. The client is the device currently participating in the training. The client is used to select a server and establish a connection, and the client transmits the hash value of the latest transaction to the selected server; The server is used to verify the validity of the hash value, and use the hash value to query the DAG ledger to obtain the model parameters of the corresponding client from the DAG ledger; and according to the model parameters of the client, a predefined Tip selection algorithm is used to select the Tip node in the DAG ledger, aggregate the model stored in the selected Tip node to obtain a new model, and send the new model to the client; The client is further used to perform multiple rounds of training on the new model received from the server using the local data set to obtain a trained model, and return the trained model parameters to the server; The server is used to package the model parameters received from the client into a new transaction, link the new transaction to each previously selected Tip node to become a new Tip node, calculate the hash value of the new transaction, send the hash value to the client for the next training, and broadcast the new transaction to other servers; The server calculates the cosine similarity between the model parameters on the Tip node and the model parameters of the client, selects the Tip node with high similarity, applies the BEAST algorithm to detect the mutation point of the similarity sequence after descending sorting, and obtains the confidence sequence Confidence of the mutation point; A point in Confidence whose confidence is greater than a threshold α is selected, and all Tip nodes before the point are used as the selected Tip nodes.
6. The asynchronous clustering federated learning device according to claim 5, characterized in that: The client is also used to apply to the server for an initial model when joining federated learning for the first time, perform multiple rounds of training on the initial model using a local training data set, and after the training is completed, transmit the trained model parameters as the client's model parameters to the server.
