A federated learning method, device and computer-readable storage medium

By updating the identity and model aggregation when the client node is abnormal when the server node is abnormal at the server node, the problem of the system collapse and low stability have been solved, and the continuity of the federal learning process and the system stability of the system Improvement.

CN110929880BActive Publication Date: 2025-01-24WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911099763.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-12
Publication Date
2025-01-24
Estimated Expiration
2039-11-12

AI Technical Summary

Technical Problem

In the federated learning system, exceptions of the server node will cause the system to crash, interrupt the ongoing federated learning process, and the storage and network transmission pressure are high and the stability is low.

Method used

In a peer-to-peer network, when a client node detects an abnormality in a server node, it updates its identity as a server node and sends update instructions to other client nodes, instructing them to update the client node as a new server node. Receive the training model for federated aggregation until the preset model convergence conditions are met.

Benefits of technology

Through the identity update and model aggregation of client nodes, the continuity of the federated learning process is ensured, the stability and robustness of the system are improved, and system crashes caused by abnormal server nodes are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110929880B_ABST
    Figure CN110929880B_ABST
Patent Text Reader

Abstract

The present application provides a federated learning method, device and computer-readable storage medium, which relate to the field of machine learning technology and are used to improve the stability of a federated learning system. The method is applied to a client node in a peer-to-peer network, and includes: after determining that a server node in the peer-to-peer network is abnormal, updating its own identity to a server node; sending a server node update indication to other client nodes in the peer-to-peer network, instructing the other client nodes to update the client node to a server node; receiving a training model obtained by the other client nodes performing model training on a local model, and performing federated aggregation on the received training model to obtain a federated model. In this method, the federated learning process will not be interrupted due to an abnormality of the server node, thereby improving the stability of the federated learning system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, and in particular to a federated learning method, device, and computer-readable storage medium. Background Art

[0002] In the field of machine learning technology, in some specific application scenarios of machine learning models such as target detection, since the training data sources of the machine learning models are distributed among different clients or different institutions, different clients and different institutions often do not share the training data with different clients or different institutions due to data privacy or security issues, or do not share the training data because the amount of training data is too large.

[0003] Therefore, the models in the above application scenarios are often trained through the method of federated learning. However, the federated learning system includes a server and multiple clients. The training models of all clients need to be uploaded to the server. The storage pressure on the server is large and the network transmission pressure is also very large. Once an abnormality occurs on the server, it will directly lead to the crash of the federated learning system, thereby interrupting the ongoing federated learning process. Summary of the invention

[0004] The embodiments of the present application provide a federated learning method, device, and computer-readable storage medium, which are mainly used to avoid the crash of a federated learning system and improve the stability of the federated learning system.

[0005] In a first aspect of the present application, a federated learning method is provided, which is applied to a client node in a peer-to-peer network, comprising:

[0006] After determining that the server node in the peer-to-peer network is abnormal, updating its own identity to the server node;

[0007] Sending a server node update indication to other client nodes in the peer-to-peer network, instructing the other client nodes to update the client node to a server node;

[0008] Receive the training model obtained by the other client nodes performing model training on the local model, and perform federation aggregation on the received training model to obtain a federated model.

[0009] In a possible implementation, after the received training models are federated and aggregated to obtain a federated model, the method further includes:

[0010] If it is determined that the federated model meets the preset model convergence condition, a training end indication is sent to the other client nodes; otherwise, a retraining indication is sent to the other client nodes so that the other client nodes retrain the local model according to the retraining indication until it is determined that the federated model meets the preset model convergence condition.

[0011] In a possible implementation manner, after determining that the federated model satisfies a preset model convergence condition, the method further includes:

[0012] The model performance of the federated model is verified according to the preset shared verification data, and if it is determined that the model performance meets the preset model performance, the federated model is added to the model database.

[0013] In a possible implementation, the method further includes:

[0014] Periodically sending connection confirmation information to the other client nodes;

[0015] According to the connection response signal sent by other client nodes in response to the connection confirmation message, the client node with abnormal network connection in the peer-to-peer network is determined, and the client node with abnormal network connection is deleted from the peer-to-peer network, and the connection response signal includes the node identification information of the other client nodes.

[0016] In a possible implementation, the method further includes:

[0017] After determining that the server node in the peer-to-peer network is normal, the training model obtained by training the local model is sent to the server node, so that the server node federally aggregates the training model sent by at least one client node to obtain a federal model.

[0018] In a possible implementation, the method further includes:

[0019] If a retraining indication is received from the server node, the most recently sent federated model is used as the local model, the local model is retrained, and the retrained training model is sent to the server node until a training end indication is received from the server node.

[0020] In a possible implementation, before training the local model, the method further includes:

[0021] Sending the received user identity to the server node;

[0022] After the server node passes the authority verification of the user identity, the federated model is obtained from the model database and used as the local model.

[0023] In a possible implementation, the method further includes:

[0024] After receiving a server node update indication sent by other client nodes in the peer-to-peer network, taking the other client nodes that sent the server node update indication as new server nodes;

[0025] The training model obtained by training the local model is sent to the new server node.

[0026] In a second aspect of the present application, a federated learning method is provided, comprising:

[0027] After receiving a server node update indication sent by other client nodes in the peer-to-peer network, taking the other client nodes that sent the server node update indication as new server nodes;

[0028] The training model obtained by training the local model is sent to the new server node.

[0029] In one possible implementation, if a retraining indication is received from the new server node, the federated model most recently sent by the new server node is used as the local model, the local model is retrained, and the retrained training model is sent to the new server node until a training end indication is received from the new server node.

[0030] In a possible implementation, the received user identity is sent to the new server node;

[0031] After the new server node passes the authority verification of the user identity, the federated model is obtained from the model database and used as the local model.

[0032] In one possible implementation, a connection confirmation message periodically sent by the new server node is received, and within a preset time after receiving the connection confirmation message, a connection response signal containing its own node identifier is sent to the new server node, so that the new server node determines the client node with abnormal network connection in the peer-to-peer network and deletes it.

[0033] In a third aspect of the present application, a federated learning device is provided, comprising:

[0034] An identity updating unit, configured to update its own identity to a server node after determining that a server node in the peer-to-peer network is abnormal;

[0035] An identity indication unit, configured to send a server node update indication to other client nodes in the peer-to-peer network, instructing the other client nodes to update the client node to a server node;

[0036] The federation aggregation unit is used to receive the training model obtained by the other client nodes performing model training on the local model, and to perform federation aggregation on the received training model to obtain a federated model.

[0037] In a possible implementation, the federation aggregation unit is further configured to:

[0038] After the received training models are federated and aggregated to obtain a federated model, if it is determined that the federated model meets the preset model convergence conditions, a training end indication is sent to the other client nodes; otherwise, a retraining indication is sent to the other client nodes so that the other client nodes retrain the local models according to the retraining indication until it is determined that the federated model meets the preset model convergence conditions.

[0039] In a possible implementation, the federal aggregation unit is also used to, after determining that the federal model meets the preset model convergence conditions, verify the model performance of the federal model according to preset shared verification data; if it is determined that the model performance meets the preset model performance, the federal model is added to the model database.

[0040] In a possible implementation, the method further includes:

[0041] an abnormal node determination unit, configured to periodically send connection confirmation information to the other client nodes;

[0042] According to the connection response signal sent by other client nodes in response to the connection confirmation message, the client node with abnormal network connection in the peer-to-peer network is determined, and the client node with abnormal network connection is deleted from the peer-to-peer network, and the connection response signal includes the node identification information of the other client nodes.

[0043] In a possible implementation manner, the device further includes:

[0044] The model training unit is used to send the training model obtained by training the local model to the server node after determining that the server node in the peer-to-peer network is normal, so that the server node federates the training model sent by at least one client node to obtain a federal model.

[0045] In a possible implementation, the model training unit is further used to:

[0046] If a retraining indication is received from the server node, the federated model most recently sent by the server node is used as the local model, the local model is retrained, and the retrained training model is sent to the server node until a training end indication is received from the server node.

[0047] In a possible implementation, the model training unit is further used to send the received user identity to the server node before training the local model;

[0048] After the server node passes the authority verification of the user identity, the federated model is obtained from the model database and used as the local model.

[0049] In a possible implementation, the method further includes:

[0050] The connection confirmation unit is used to receive the connection confirmation message periodically sent by the service node, and within a preset time after receiving the connection confirmation message, send a connection response signal containing its own node identifier to the service node, so that the service node determines the client node with abnormal network connection in the peer-to-peer network and deletes it.

[0051] In a possible implementation, the identity update unit is further configured to update the other client nodes that sent the server node update indication to a new server node after receiving the server node update indication sent by other client nodes in the peer-to-peer network;

[0052] The model training unit is also used to send the training model obtained by training the local model to the new server node.

[0053] In a fourth aspect of the present application, a federated learning device is provided, comprising:

[0054] An identity updating unit, configured to update the other client nodes that sent the server node update indication to a new server node after receiving the server node update indication sent by the other client nodes in the peer-to-peer network;

[0055] The model training unit is used to send the training model obtained by training the local model to the new server node.

[0056] In a possible implementation, the model training unit is further used to:

[0057] If a retraining indication is received from the new server node, the federated model most recently sent by the new server node is used as the local model, the local model is retrained, and the retrained training model is sent to the new server node until a training end indication is received from the new server node.

[0058] In a possible implementation, the model training unit is further used to:

[0059] Sending the received user identity to the new server node;

[0060] After the new server node passes the authority verification of the user identity, the federated model is obtained from the model database and used as the local model.

[0061] In a possible implementation manner, the device further includes:

[0062] A connection confirmation unit is used to receive the connection confirmation message periodically sent by the new server node, and within a preset time after receiving the connection confirmation message, send a connection response signal containing its own node identifier to the new server node, so that the new server node determines the client node with abnormal network connection in the peer-to-peer network and deletes it.

[0063] In a fifth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in any one of the first aspect or the second aspect.

[0064] The embodiments of the present application bring at least the following beneficial effects:

[0065] In the present application, the server nodes and client nodes in the federated learning system establish a peer-to-peer network. When an abnormality occurs in the server node, any client node can act as the server node and continue the federated learning process in the federated learning system, so that the federated learning process will not be interrupted due to the abnormality of the server node, thereby improving the stability and robustness of the federated learning system. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 A schematic diagram of a standard federated learning process provided for an embodiment of the present application;

[0067] Figure 2 A schematic diagram of a peer-to-peer network provided in an embodiment of the present application;

[0068] Figure 3A schematic diagram of a federated learning system based on a P2P network provided in an embodiment of the present application;

[0069] Figure 4 A schematic diagram of the execution steps of the client node in various scenarios in the embodiment of the present application;

[0070] Figure 5 A flowchart of a federated learning method based on a P2P network provided in an embodiment of the present application;

[0071] Figure 6 A schematic diagram of another federated learning method based on a P2P network provided in an embodiment of the present application;

[0072] Figure 7 A schematic diagram of a federated learning device provided in an embodiment of the present application;

[0073] Figure 8 A schematic diagram of an electronic device provided in an embodiment of the present application;

[0074] Fig. 9 A structural diagram of another federated learning device provided in an embodiment of the present application;

[0075] Fig.10 A structural diagram of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0076] In order to better understand the technical solution provided by the embodiments of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0077] In order to help those skilled in the art better understand the technical solution of the present application, the technical terms involved in the present application are explained below.

[0078] The client can be terminal devices such as mobile phones, computers, personal digital assistants (PDAs), smart TVs, car-mounted devices, and network-side devices such as servers.

[0079] Peer-to-Peer (P2P): Peer-to-peer computer network is a distributed application architecture that distributes tasks and workloads between peers. It is a networking or network form formed by the peer computing model at the application layer. Multiple computers connected to each other are in a completely equal position. Each computer has the same function and there is no master-slave distinction. A computer can be used as a server to set shared resources for other computers in the network to use, and can also be used as a workstation. The entire network generally does not rely on dedicated centralized servers, nor does it have dedicated workstations. Each computer in the network can act as a requester of network services and respond to requests from other computers to provide resources, services and content. Usually these resources and services include: information sharing and exchange, computing resources (such as CPU computing power sharing), storage sharing (such as cache and disk space usage), network sharing, printer sharing, etc.

[0080] The idea of ​​federated learning is to use a machine learning model built using encrypted technical algorithms. Multiple clients in the federated learning architecture do not need to provide their own data during model training. Instead, they train local models based on the global federated model encrypted by parameters sent by the server and the client's local training data. The local model is then returned to the server for aggregation and update of the global federated model. The updated federated model is then sent back to the client, and the cycle repeats until convergence.

[0081] In some specific application scenarios of machine learning models, such as target detection, since the training data sources of the machine learning models are distributed among different clients or different institutions, different clients and institutions often do not share training data with different clients or institutions due to data privacy or security issues, or do not share training data because the amount of training data is too large.

[0082] For example, during the training of a target detection model, the data sources of target detection are distributed on different clients, such as in different cameras or in different institutions. Different institutions often do not share verification data due to privacy issues, or it is inconvenient to share verification data due to the large amount of data. At this time, when the trained target detection model is applied to different clients or institutions, the performance of the target detection model is poor. Therefore, a method of training the above detection model through a federated learning process has emerged to ensure the data security of each client.

[0083] like Figure 1 As shown, a standard federated learning process is given below, which specifically includes:

[0084] Step S101, each client 11 trains a local model using local training data to obtain a training model;

[0085] Step S102, each client 11 sends the trained model to the server 12;

[0086] Step S103, the server 12 receives training models sent by multiple clients, and aggregates the received multiple training models to obtain a federated model;

[0087] Step S104, the server sends the federated model obtained by federation aggregation to each client;

[0088] Step S105: Each client receives the federated model and updates the local model to the federated model.

[0089] The training models of all the above clients need to be uploaded to the server. The storage pressure and network transmission pressure of the server are very high. Once an abnormality occurs on the server, it will directly lead to the crash of the federated learning system, thereby interrupting the ongoing federated learning process. The stability of the federated learning system is relatively low.

[0090] In view of this, the present application provides a federated learning method, which is applied to a client node in a peer-to-peer network, specifically comprising:

[0091] The client nodes and server nodes in the federated learning system establish a peer-to-peer network. During the federated learning process, after determining that the server node in the above peer-to-peer network is abnormal, the client node updates its own identity to a server node, sends a server node update instruction to other client nodes in the above peer-to-peer network, instructing the above other client nodes to update the above client nodes to server nodes, and receives the training model obtained by the above other client nodes performing model training on the local model, and federates the received training model to obtain a federated model.

[0092] Furthermore, after determining that the server node in the above-mentioned peer-to-peer network is normal, the client node sends the training model obtained by training the local model to the above-mentioned server node, so that the above-mentioned server node federally aggregates the above-mentioned training model sent by at least one client node to obtain a federal model.

[0093] The following is a detailed description of the solution of this application in conjunction with the accompanying drawings:

[0094] like Figure 2 As shown, this embodiment provides a peer-to-peer network, which includes multiple nodes. The identity of each node can be a server node or a client node, and at different times, the identity of a node can be updated from a client node to a server node. Figure 2 The server node 21 and the multiple client nodes 22 are only exemplary, and their identities can be converted.

[0095] like Figure 3 As shown, this embodiment provides a federated learning system based on a P2P network, including: a server node 21, multiple client nodes 22, a shared verification database 31, and a model database 32, wherein:

[0096] The server node 21 is used to receive a training model uploaded by at least one client node 22, and to aggregate the at least one received training model to obtain a federated model. The training model is obtained by each client node 22 training a local model using local training data.

[0097] The client node 22 is used to obtain the federated model from the model database as a local model, train the local model using local training data to obtain a training model, and send the obtained training model to the server node 21.

[0098] The client node 21 may be a device, or may include a main server and a main client to collaboratively train to obtain a training model of the client node.

[0099] The shared verification database 31 is used to store shared verification data for judging the model performance of the federated model.

[0100] The model database 32 is used to store federated models that have good model performance by verifying the model performance through shared verification data. The model database 32 also stores federated models with good model performance obtained by historical federation aggregation.

[0101] Optionally, the shared verification database 31 and the model database 32 may be stored in a cloud network.

[0102] In order to ensure the security of local training data of each client node, the federated learning system may also include an authority server node 33. When a client node requests to obtain a federated model from a model database, the identity of the user using the client node is verified to determine whether the user has the authority to download the federated model.

[0103] Optionally, the authority server node 33 and the service end node 21 may be the same device or different devices, and those skilled in the art may configure them according to actual needs.

[0104] This embodiment provides a federated learning method based on a P2P network, which can be used in the above-mentioned federated learning system based on a P2P network. The following is a schematic description of the interaction between a server node and a client node as an example:

[0105] It should be noted that before performing the following steps, a peer-to-peer network is established between the server node and multiple client nodes belonging to the same federated architecture.

[0106] For any client node in the peer-to-peer network, after determining that the model training trigger condition is met, the server node in the peer-to-peer network is first determined, and the federated learning process is performed in collaboration with the server node. The following situations may exist:

[0107] Scenario 1: The client node determines that the server node in the peer-to-peer network is normal and cooperates with the server node to perform the federated learning process normally.

[0108] Scenario 2: The client node determines that the server node in the peer-to-peer network is abnormal, updates its identity to a server node, and then collaborates with other client nodes to perform a federated learning process.

[0109] Scenario 3: The client node receives a server node update indication sent by other client nodes in the peer-to-peer network, updates the client node notified by the server node update indication to a new server node, and collaborates with the new server node to perform a federated learning process.

[0110] The above model training trigger conditions may include, but are not limited to, one or more of the following:

[0111] The first model training trigger condition: model training is performed using user instructions from the client node.

[0112] The second model training trigger condition: other client nodes in the peer-to-peer network instruct to perform model training.

[0113] The third model training triggering condition: the server node in the peer-to-peer network instructs model training.

[0114] The following is a detailed description of the above three scenarios:

[0115] Scenario 1:

[0116] After determining that the server node B in the peer-to-peer network is abnormal, the client node A updates its identity to a server node and sends a server node update instruction to other clients in the peer-to-peer network to instruct the other client nodes to update the client node to a server node.

[0117] Correspondingly, after receiving the server node update indication, other client nodes update the above client nodes to new server nodes, train the local model, and send the trained model to the above new server node (ie, client node A).

[0118] Correspondingly, the new server node (ie, client node A) receives the training models sent by other client nodes, and performs federation aggregation on the received training models to obtain a federated model.

[0119] Scenario 2:

[0120] After the client node A determines that the server node C in the peer-to-peer network is normal, it trains the local model and sends the trained model to the server node C.

[0121] Correspondingly, the server node C receives the training models sent by the client node A and other clients, and aggregates the obtained training models to obtain a federated model.

[0122] Scenario 3:

[0123] After receiving the server node update indication sent by client node D, client node A updates client node D to a new server node, trains the local model, and sends the trained model to the new server node (ie, client node D).

[0124] Correspondingly, after the new server node (ie, client D) receives the training models of client node A and other client nodes, it performs federation aggregation on the received training models to obtain a federated model.

[0125] In the above scenarios 1 to 3, the operation of the client node can be seen in Figure 4 .

[0126] In the above scenarios 1 to 3, the abnormal situation of the server node may be, but is not limited to, a server node crash, excessive storage pressure or computing pressure on the server node, or a network connection interruption of the server node.

[0127] Optionally, in the above scenarios 1 to 3, the client node that first discovers the abnormality of the server node may update its own identity to the server node.

[0128] After the nodes in the peer-to-peer network determine their own identities, the client nodes and server nodes can collaborate in the federated learning process, such as Figure 5 As shown, the following only takes the interaction between the server node and the client node as an example for schematic description:

[0129] Step S501: The client node obtains a local model.

[0130] Before obtaining the local model, the client node needs to perform the following steps S5011 and S5012:

[0131] Step S5011, the client node verifies with the authority server node whether it has the authority to download the model;

[0132] Step S5012: the authority server node verifies the authority of the client node successfully;

[0133] The client node needs to first verify with the authority server node whether it has the authority to download the model. Only after the authority server node passes the authority verification of the client node can the client node obtain the local model.

[0134] Optionally, the client node can obtain a saved federated model from the model database as a local model.

[0135] Step S502: The client node selects local training data to perform model training on the local model to obtain a training model, and sends the training model to the server node in the peer-to-peer network.

[0136] Optionally, a user using the client node may annotate local training data of the client node, select a portion of the local training data of the client node as a training sample, and perform model training on a local model using the training sample.

[0137] It should be noted that each client node will perform the above steps S501 and S502. Figure 5 Only client node 1 is used as an example for illustration, and client node 2 to client node n can perform the same steps, wherein n is a positive integer greater than 2, representing the number of the client node.

[0138] Step S503: The server node receives a training model sent by at least one client node in the peer-to-peer network.

[0139] Step S504: The server node performs federation aggregation on the training model of the at least one client node to obtain a federated model.

[0140] Optionally, in the above step S501, obtaining the local model may include:

[0141] The client node sends the received user identity to the server node;

[0142] The server node verifies the authority of the user identity to obtain the federated model, and after determining that the authority verification is passed, sends an instruction to the client node;

[0143] After the server node verifies the authority of the user identity, the client node obtains the federated model from the model database and uses the federated module as the local model.

[0144] Optionally, in this embodiment, a user identity set with permissions is pre-established. If the server node determines that the user identity sent by the client node is in the user identity set, the permission verification of the user identity is passed.

[0145] Optionally, a mapping relationship between a user identity and a federated model identifier may be pre-established. When the server node determines that the federated model identifier corresponding to the user identity sent by the client node can be found in the above mapping relationship, the authority verification of the above user identity is passed.

[0146] Optionally, in the above step S501, the above model database also includes the saved data of the above federated model, and the saved data may be the saving time of the federated model in the model database. The client node obtains the local model from the model database including one or more of the following:

[0147] The client node obtains, based on the saved data of each federated model in the model database, a federated model whose saved time indicated by the saved data is closest to the current time as the local model; or

[0148] The client node obtains the federation model corresponding to the received user identity according to the preset mapping relationship between the user identity and the above-mentioned federation model.

[0149] Optionally, in the above step S502, before the client node selects local training data to perform model training on the local model, the method further includes:

[0150] Determine whether the client node meets one or more of the following model training start conditions:

[0151] The first model training start condition: the occupancy rate of the central processing unit (CPU) of the client node does not exceed a first preset value.

[0152] The second model training start condition: the memory occupancy rate of the client node does not exceed a second preset value.

[0153] The third model training start condition: the hard disk occupancy rate of the client node does not exceed a third preset value.

[0154] like Figure 6 As shown, after step S504, the following may also be included:

[0155] Step S601, the server node determines whether the federated model meets the preset model convergence condition. If so, it proceeds to step S602. If not, it sends a retraining instruction to the above-mentioned multiple client nodes and proceeds to step S603.

[0156] In step S602, the server node verifies the model performance of the above-mentioned federated model according to the preset shared verification data. When it is determined that the above-mentioned model performance meets the preset model performance, the above-mentioned server node adds the above-mentioned federated model to the model database. When it is determined that the above-mentioned model performance does not meet the preset model performance, the federated model is discarded and a training end indication is sent to the client node.

[0157] When the prediction accuracy of the federated model reaches a first preset value, it can be considered that the model performance of the federated model meets the preset model performance.

[0158] Step S603, the client node receives the retraining instruction sent by the server node, re-trains the model, and sends the training model obtained by the re-training to the server node in the peer-to-peer network until receiving the training end instruction sent by the above server node.

[0159] Optionally, in step S603, the client node may re-train the model in one or more of the following ways, but is not limited to:

[0160] The first retraining method:

[0161] A new federated model is re-acquired from the model database as the above-mentioned local model, and the re-acquired local model is trained using the local training data to obtain a training model.

[0162] For example, during the last model training, the client node obtained federal model A from the model database as the local model, and used local training data to train the above local model to obtain a training model. After sending the above training model to the server node, if the client node receives a retraining instruction sent by the server node, it can obtain a federal model other than federal model A from the model database as a local model, and use local training data to train the local model.

[0163] The second retraining method:

[0164] Reselect local training data to perform model training on the local model to obtain a training model.

[0165] For example, after the client node obtains the initial federated model, when training the initial federated model for the first time, it can select a part of the data from the local training data as a training sample, and train the above initial model to obtain a training model. After the client node sends the above training model to the server node, if it receives a retraining instruction sent by the server node, it can re-select a part of the data from the local training sample as a new training sample to train the above local model.

[0166] The third retraining method:

[0167] A new federated model is obtained as a local model, and local training data is reselected to perform model training on the new local model to obtain a training model.

[0168] For example, when the client node trained the model last time, it obtained the federal model A from the model database as the local model, and selected a part of the data from the local training data as the training sample, and trained the above local model to obtain the training model A. After the client node sends the above training model A to the server node, if it receives a retraining instruction sent by the server node, it can use the training model A obtained in the last training as the local model, or obtain a federal model other than the federal model A from the model database as the local model, and re-select a part of the data from the local training sample as a new training sample to train the above local model.

[0169] Optionally, after a node in a peer-to-peer network determines its own identity, the following steps are further included:

[0170] The at least one client node sends its own identity information to the server node;

[0171] The server node receives and stores the identity information of the at least one client node to learn the identity of each client node in the current peer-to-peer network;

[0172] The service end node periodically sends a connection confirmation message to the at least one client node to determine the client node with abnormal network connection; and determines the client node that has not received a connection response signal within a preset time period as the client node with abnormal network connection, wherein the connection response signal includes the identity information of the client node;

[0173] Among them, after the server node determines the client node with abnormal network connection, it can mark or delete the client node with abnormal network connection, so as to avoid sending or receiving messages to the client node with abnormal network connection in the future, thereby saving network bandwidth and ensuring the network environment in the federated learning process.

[0174] Optionally, when marking or deleting the client node with abnormal network connection, the server node may mark or delete the identity information of the client node with abnormal network connection.

[0175] Correspondingly, each client node receives the connection confirmation message periodically sent by the server node, and sends a connection response signal containing its own identity information to the server node within a preset time period after receiving the connection confirmation message.

[0176] like Figure 7 As shown, based on the same technical concept, the embodiment of the present application further provides a federated learning device 700, which is the client node in the peer-to-peer network discussed above, and includes:

[0177] The identity updating unit 701 is used to update its own identity to a server node after determining that the server node in the above-mentioned peer-to-peer network is abnormal;

[0178] The identity indication unit 702 is used to send a server node update indication to other client nodes in the above-mentioned peer-to-peer network, instructing the above-mentioned other client nodes to update the above-mentioned client node to a server node;

[0179] The federation aggregation unit 703 is used to receive the training model obtained by the other client nodes performing model training on the local model, and to perform federation aggregation on the received training model to obtain a federated model.

[0180] Optionally, the above-mentioned federation aggregation unit is further used for:

[0181] After the received training models are federated and aggregated to obtain a federated model, if it is determined that the above-mentioned federated model meets the preset model convergence conditions, a training end indication is sent to the above-mentioned other client nodes; otherwise, a retraining indication is sent to the above-mentioned other client nodes, so that the above-mentioned other client nodes re-train the local model according to the above-mentioned retraining indication until it is determined that the above-mentioned federated model meets the above-mentioned preset model convergence conditions.

[0182] Optionally, the federal aggregation unit is also used to verify the model performance of the federal model according to preset shared verification data after determining that the federal model meets the preset model convergence conditions. If it is determined that the model performance meets the preset model performance, the federal model is added to the model database.

[0183] Optionally, the device further comprises an abnormal node determination unit, configured to periodically send connection confirmation information to the other client nodes;

[0184] According to the connection response signal sent by other client nodes in response to the connection confirmation message, determine the client node with abnormal network connection in the above-mentioned peer-to-peer network, and delete the client node with abnormal network connection from the above-mentioned peer-to-peer network, and the above-mentioned connection response signal includes the node identification information of the above-mentioned other client nodes

[0185] Optionally, the device also includes: a model training unit, which is used to send a training model obtained by training a local model to the above-mentioned server node after determining that the server node in the above-mentioned peer network is normal, so that the above-mentioned server node federates the above-mentioned training model sent by at least one client node to obtain a federal model.

[0186] Optionally, the above-mentioned model training unit is also used to, if a retraining indication sent by the above-mentioned server node is received, use the federated model most recently sent by the above-mentioned server node as the local model, retrain the above-mentioned local model, and send the retrained training model to the above-mentioned server node until a training end indication sent by the above-mentioned server node is received.

[0187] Optionally, the model training unit is further used to send the received user identity to the server node before training the local model;

[0188] After the server node passes the authority verification of the user identity, the federated model is obtained from the model database and used as the local model.

[0189] Optionally, the device also includes a connection confirmation unit, which is used to receive the connection confirmation message periodically sent by the above-mentioned server node, and within a preset time after receiving the above-mentioned connection confirmation message, send a connection response signal containing its own node identifier to the above-mentioned server node, so that the above-mentioned server node determines the client node with abnormal network connection in the above-mentioned peer network and deletes it.

[0190] Optionally, the identity update unit is further configured to, after receiving a server node update indication sent by other client nodes in the peer-to-peer network, update the other client nodes that sent the server node update indication to a new server node;

[0191] The above-mentioned model training unit is also used to send the training model obtained by training the local model to the above-mentioned new server node.

[0192] Based on the same technical concept, the present application embodiment also provides an electronic device 800, please refer to Figure 8 , the computer device includes a processor 801 and a memory 802, wherein:

[0193] The memory 802 stores a computer program;

[0194] When the processor 801 executes the computer program, the method for testing blockchain software discussed above is implemented.

[0195] Figure 8 In the figure, one processor 801 is taken as an example, but the number of processors 801 is not limited in practice.

[0196] The memory 802 may be a volatile memory, such as a random-access memory (RAM); the memory 802 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 802 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 802 may be a combination of the above memories.

[0197] As an example, Figure 7 The functions of each module in the federated learning device 700 can be obtained by Figure 8 It is implemented by the processor 801 in.

[0198] like Fig. 9 As shown, based on the same technical concept, the embodiment of the present application further provides a federated learning device 900, which is the client node discussed above, and includes:

[0199] The identity updating unit 901 is used to update the other client nodes that sent the server node update indication to a new server node after receiving the server node update indication sent by other client nodes in the peer-to-peer network;

[0200] The model training unit 902 is used to send the training model obtained by training the local model to the above-mentioned new server node.

[0201] Optionally, the above model training unit is also used for:

[0202] If a retraining indication is received from the new server node, the federated model most recently sent by the new server node is used as the local model, the local model is retrained, and the retrained training model is sent to the new server node until a training end indication is received from the new server node.

[0203] Optionally, the above model training unit is also used for:

[0204] Sending the received user identity to the new server node;

[0205] After the new server node passes the authority verification of the user identity, the federated model is obtained from the model database and used as the local model.

[0206] Optionally, the above device further includes:

[0207] A connection confirmation unit is used to receive the connection confirmation message periodically sent by the above-mentioned new server node, and within a preset time after receiving the above-mentioned connection confirmation message, send a connection response signal containing its own node identifier to the above-mentioned new server node, so that the above-mentioned new server node determines the client node with abnormal network connection in the above-mentioned peer-to-peer network and deletes it.

[0208] Based on the same technical concept, the present application embodiment also provides another electronic device 1000, please refer to Fig.10 , the computer device includes a processor 1001 and a memory 1002, wherein:

[0209] The memory 1002 stores a computer program;

[0210] When processor 1001 executes the computer program, the method for testing blockchain software discussed above is implemented.

[0211] Fig.10 In the figure, one processor 1001 is taken as an example, but the number of processors 1001 is not limited in practice.

[0212] The memory 1002 may be a volatile memory, such as a random-access memory (RAM); the memory 1002 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 1002 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1002 may be a combination of the above memories.

[0213] As an example, Fig. 9 The functions of each module in the federated learning device 900 can be obtained by Fig.10 It is implemented by the processor 1001 in.

[0214] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions. When the above computer instructions are executed on a computer, the computer executes the federated model training method discussed above.

[0215] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0216] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0217] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0218] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A federated learning method, characterized in that: Applicable to client nodes in a peer-to-peer network, including: After determining that the server node in the peer-to-peer network is abnormal, updating its own identity to the server node; Sending a server node update indication to other client nodes in the peer-to-peer network, instructing the other client nodes to update the client node to a server node; Receive the training model obtained by the other client nodes performing model training on the local model, and perform federation aggregation on the received training model to obtain a federated model.

2. The method according to claim 1, characterized in that After the received training model is federated and aggregated to obtain a federated model, the method further includes: If it is determined that the federated model meets the preset model convergence condition, a training end indication is sent to the other client nodes; otherwise, a retraining indication is sent to the other client nodes so that the other client nodes retrain the local model according to the retraining indication until it is determined that the federated model meets the preset model convergence condition.

3. The method according to claim 2, characterized in that After determining that the federated model meets the preset model convergence condition, the method further includes: The model performance of the federated model is verified according to the preset shared verification data, and if it is determined that the model performance meets the preset model performance, the federated model is added to the model database.

4. The method according to claim 1, characterized in that The method further comprises: After determining that the server node in the peer-to-peer network is normal, the training model obtained by training the local model is sent to the server node, so that the server node federally aggregates the training model sent by at least one client node to obtain a federal model.

5. The method according to claim 4, characterized in that Also includes: If a retraining indication is received from the server node, the most recently sent federated model is used as the local model, the local model is retrained, and the retrained training model is sent to the server node until a training end indication is received from the server node.

6. The method according to claim 5, characterized in that Before training the local model, the following steps are also included: Sending the received user identity to the server node; After the server node passes the authority verification of the user identity, the federated model is obtained from the model database and used as the local model.

7. A federated learning method, characterized in that: Applicable to client nodes in a peer-to-peer network, including: After receiving a server node update indication sent by other client nodes in the peer-to-peer network, updating the other client nodes that sent the server node update indication to a new server node; The training model obtained by training the local model is sent to the new server node.

8. A federated learning device, characterized in that: Applicable to peer-to-peer networks, including: An identity updating unit, configured to update its own identity to a server node after determining that a server node in the peer-to-peer network is abnormal; An identity indication unit, configured to send a server node update indication to other client nodes in the peer-to-peer network, instructing the other client nodes to update the client node to a server node; The federation aggregation unit is used to receive the training model obtained by the other client nodes performing model training on the local model, and to perform federation aggregation on the received training model to obtain a federated model.

9. A federated learning device, characterized in that: Applicable to peer-to-peer networks, including: An identity updating unit, configured to update the other client nodes that sent the server node update indication to a new server node after receiving the server node update indication sent by the other client nodes in the peer-to-peer network; The model training unit is used to send the training model obtained by training the local model to the new server node.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 6 or 7.

Citation Information

Patent Citations

  • Host node switching method, device, electronic device, and computer storage medium

    CN109101196A

  • Federation training method and device for client change, training terminal and storage medium

    CN110378488A