Cross-department federated learning method, system and storage medium based on gradient orthogonalization

By adopting the gradient orthogonalization method in federated learning, we deal with the problem of system heterogeneity, ensure the rapid convergence and accuracy of the global model in cross-department federated learning, and solve the training cost and efficiency problems caused by the low update frequency of backward clients. .

CN118504717BActive Publication Date: 2024-10-22ZHEJIANG LINYAN PRECISION TECH CO LTD

Patent Information

Application Number
CN202410973336.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-10-22
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

The difference in response speed of federated learning due to system heterogeneity in cross-regional and cross-department scenarios affects the convergence speed and effect of the global model, especially the increase in training costs and decrease in efficiency caused by low-frequency updates of lagging clients.

Method used

A cross-department federated learning method based on gradient orthogonalization is used to divide clients into active and lagging clients through asynchronous communication, calculate active orthogonal bases and lagging orthogonal bases, and perform gradient orthogonalization training to ensure that the global model is updated Contains the latest gradients for lagging clients, reducing update direction differences.

Benefits of technology

It effectively reduces the impact of system heterogeneity on the convergence of the global model, improves training efficiency and accuracy, ensures that the update direction of the global model is more accurate, and reduces training costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118504717B_ABST
    Figure CN118504717B_ABST
Patent Text Reader

Abstract

The present invention discloses a cross-departmental federated learning method, system and storage medium based on gradient orthogonalization, which belongs to the technical field of information security. The present invention divides all clients into active clients and lagging clients, and the calculated global gradient includes the gradients of active clients and lagging clients at the same time, ensuring that the latest gradient of the lagging client participates in each update of the global model. Secondly, the present invention sends the active orthogonal basis and the lagging orthogonal basis to the lagging client and the active client respectively, and reduces the difference in the update direction between the active client and the lagging client by orthogonalizing the gradient of the client during the local training process, thereby reducing the impact of system heterogeneity on the convergence of the global model. The present invention not only solves the problem of data islands existing in various industries, but also effectively solves the problem of system heterogeneity in federated learning, and has good practicality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of information security, and specifically relates to a cross-departmental federated learning method, system and storage medium based on gradient orthogonalization. Background Art

[0002] With the rise of the digital economy, all walks of life have gradually entered the digital age. However, people still face many challenges in data collection and processing. Due to data privacy, security, and information isolation between enterprises and departments, data from different departments are often scattered in different systems, forming so-called "data islands". These islands restrict the circulation and sharing of data, hindering the progress of various industries in data analysis, data sharing, and data integration. In order to cope with the many challenges of data processing and integration in various industries, federated learning technology provides an innovative solution. Federated learning effectively protects data privacy and security by conducting collaborative training between multiple decentralized data sources without centralizing data to a central server. This technology allows model parameters to be shared between different departments while ensuring that the data of each department is only processed locally, effectively avoiding the transmission of data between different regions and systems. This enables the model to learn knowledge from data from different departments during training while protecting the data privacy and security of each department.

[0003] However, federated learning also faces some challenges in cross-regional and cross-departmental scenarios, such as system heterogeneity. System heterogeneity refers to the differences in computing power and network environment between different nodes, which may cause some nodes to be unable to participate in global model aggregation in a timely manner due to slow response speed, ultimately affecting the convergence effect of the global model. These slow-responding clients are also called lagging clients. In synchronous communication, the server waits for the lagging client to complete local training and upload local model parameters or gradients, ensuring that active clients and lagging clients participate in aggregation at the same frequency, so that the global model converges as if there were no lagging clients. However, waiting for a lagging client for a long time will cause an increase in training costs and a decrease in training efficiency. Even if some researchers have adopted strategies such as client selection or stratification methods, it is difficult to effectively reduce the training costs caused by waiting.

[0004] In asynchronous communication, the server does not wait for the lagging client, but uses the parameters or gradients from the current active client to perform global model aggregation. Compared with synchronous communication, asynchronous communication is faster, but due to the different data between clients across departments, the update direction of the lagging client is quite different from that of the active client, and the upload frequency of the lagging client is lower than that of the active client, which may cause the global model to eventually deviate from the global optimal state and converge to the optimal state of the active client.

[0005] In summary, federated learning technology can effectively address the challenges of data collection, data processing, and data privacy faced by various industries by training locally on the client and aggregating global models on the server. However, the problem of system heterogeneity affects the convergence speed and effect of federated learning on the global model. Therefore, how to properly handle active clients and lagging clients is a major challenge for asynchronous federated learning. Summary of the invention

[0006] The purpose of the present invention is to provide a cross-departmental federated learning method, system and storage medium based on gradient orthogonalization, aiming to solve the above problems. The present invention can reduce the training cost caused by system heterogeneity while learning across departments, and avoid the influence of system heterogeneity on the convergence of the global model, which is of great significance to the digital transformation of various industries and the cross-departmental application of federated learning.

[0007] The present invention is mainly achieved through the following technical solutions:

[0008] The cross-department federated learning method based on gradient orthogonalization includes the following steps:

[0009] Step S1: Based on asynchronous communication, the server divides all clients into active clients and lagging clients according to the timeliness of uploading the latest gradient; then, the server sends the updated global model to all clients;

[0010] Step S2: The lagging client and the active client perform local training respectively and calculate the gradient used to update the local model :

[0011]

[0012] For lagging clients, b is equal to the active orthogonal basis b1, where the active orthogonal basis b1 is the average of the latest gradients of all active clients; for active clients, b is equal to the lagging orthogonal basis b2, where the lagging orthogonal basis b2 is the average of the latest gradients of all lagging clients;

[0013] Where: g is the current gradient;

[0014] is the cosine of the angle between the active orthogonal basis b1 and the lagging orthogonal basis b2;

[0015] is the cosine value of the angle between the current gradient g and the orthogonal basis b;

[0016] It is the projection component obtained by projecting the current gradient g onto the orthogonal basis b;

[0017] Step S3: After completing local training, the lagging client and the active client upload the latest gradient to the server respectively;

[0018] Step S4: Repeat steps S1 to S3 until the loss function converges.

[0019] In order to better implement the present invention, further, in the step S1, during the initial communication process, the server broadcasts the initial global model parameters to all clients for local training, and then the clients upload the latest gradients to the server; the clients that can upload the latest gradients to the server in time are marked as active clients, and the remaining clients that fail to upload the latest gradients in time are marked as lagging clients.

[0020] In order to better implement the present invention, further, in step S1, the server updates the global model parameters as the current global model parameters minus the quotient of the global gradient and the learning rate, and the global gradient is the average of the latest gradients of all clients.

[0021] In order to better implement the present invention, further, in step S2, The calculation formula is as follows:

[0022] ,

[0023] in: is the norm of the orthogonal basis b;

[0024] is the norm of the current gradient g.

[0025] In order to better implement the present invention, further, in step S2, The calculation formula is as follows:

[0026] .

[0027] In order to better implement the present invention, further, in step S3, the latest gradient is the difference between the local model parameters after training and the local model parameters before training of the lagging client or the active client divided by the learning rate.

[0028] The present invention is mainly achieved through the following technical solutions:

[0029] A cross-departmental federated learning system based on gradient orthogonalization is performed based on the above-mentioned cross-departmental federated learning method based on gradient orthogonalization, including a latest gradient caching module, a client partitioning module, an orthogonal basis calculation module and a gradient orthogonalization training module which are arranged in sequence from front to back;

[0030] The latest gradient cache module is used to store the latest gradients uploaded by all clients;

[0031] The client division module is used to divide the clients into active clients and lagging clients based on the response timeliness of uploading the latest gradient;

[0032] The orthogonal basis calculation module is used to calculate the active orthogonal basis and the backward orthogonal basis and the cosine value of the angle between the active orthogonal basis and the backward orthogonal basis. , in order to send the active orthogonal basis and the backward orthogonal basis to the backward client and the active client respectively, and send the cosine value Sent to all clients;

[0033] The gradient orthogonalization training module is used to perform local training on the lagging client and the active client, and calculates the gradient based on the active orthogonal basis, the lagging orthogonal basis and the current gradient. to update the local model.

[0034] In order to better implement the present invention, further, it also includes a model evaluation module, which is used to test the global model after the federated learning training with a test data set to evaluate the model performance of the global model.

[0035] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned cross-departmental federated learning method based on gradient orthogonalization.

[0036] The beneficial effects of the present invention are as follows:

[0037] (1) The present invention stores the latest gradients of all clients on the client side, so that the server side can use the cached latest gradients of the lagging clients to replace the lagging clients that failed to upload in time to participate in the global model aggregation in each round of communication. Secondly, the global gradient calculated by the present invention includes the gradients of both active clients and lagging clients, ensuring that the latest gradients of the lagging clients participate in each global model update, which to some extent alleviates the convergence problem caused by the lagging clients participating in the global model aggregation less frequently than the active clients, and has good practicality;

[0038] (2) The present invention stores the latest gradients of all clients on the server side to calculate the orthogonal basis and update the global model. The present invention orthogonalizes the gradients of the clients during the local training process, thereby reducing the difference in update direction between active clients and lagging clients, thereby reducing the impact of system heterogeneity on the convergence of the global model. The present invention not only solves the "data island" problem existing in various industries, but also effectively solves the system heterogeneity problem in federated learning, and has good practicality. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1A flowchart of the cross-departmental federated learning method based on gradient orthogonalization of the present invention;

[0040] Figure 2 It is a principle block diagram of the latest gradient caching module and the orthogonal basis calculation module in the cross-department federated learning system based on gradient orthogonalization of the present invention;

[0041] Figure 3 This is a schematic diagram of the gradient orthogonalization in Example 3. DETAILED DESCRIPTION

[0042] Embodiment 1:

[0043] The cross-departmental federated learning system based on gradient orthogonalization adopts asynchronous communication, including the latest gradient caching module, client partitioning module, orthogonal basis calculation module, gradient orthogonalization training module and model evaluation module, which are set up in sequence from front to back.

[0044] The latest gradient module is used to store the latest gradients uploaded by each client on the server, which are used for subsequent calculation of the orthogonal basis and the gradient of the global model.

[0045] The client classification module is used to classify all clients into two types: active clients (capable of uploading in time) and lagging clients (incapable of uploading in time) according to whether the clients can upload local updates in time in each round of communication. Preferably, the client classification module, when the hardware performance and network environment of the client devices are different, uses whether the clients can upload their gradients to the server in time within the response time of each round of communication as a judgment basis to classify all clients into active clients and lagging clients. Among them, active clients are able to upload the gradients of the current communication round in time, while lagging clients cannot.

[0046] The orthogonal basis calculation module is used to calculate the active orthogonal basis and the backward orthogonal basis and the cosine value of the angle between the two orthogonal basis based on the latest gradient of the active client and the latest gradient of the backward client stored in the server, so as to send the active orthogonal basis to all the backward clients, send the backward orthogonal basis to all the active clients, and send the cosine value of the angle between the two orthogonal basis to all the clients in the next round of communication.

[0047] The gradient orthogonalization training module is used to orthogonalize the gradients generated by the client based on the received orthogonal basis during the local training process of the client, so as to reduce the difference between the update directions of the active client and the lagging client, thereby preventing the global model from forgetting the knowledge on the lagging client when frequently receiving updates from the active client.

[0048] The model evaluation module uses a test data set for testing after completing the training of federated learning, and evaluates the model performance of the global model based on the test results.

[0049] like Figure 2 As shown, the latest gradient cache module caches the gradients of all clients on the server side. The latest gradient uploaded by a client will replace the gradient of the client's last upload, ensuring that the gradients cached by the server side are the latest gradients of each client. The orthogonal basis calculation module calculates the average value of the latest gradients of all active clients cached on the server side as the active orthogonal basis, which represents the update direction of all active clients; calculates the average value of the latest gradients of all lagging clients cached on the server side as the lagging orthogonal basis, which represents the update direction of all lagging clients; the cosine value of the angle between the two orthogonal bases represents the difference between the update directions of the lagging client and the active client. Afterwards, the server sends the lagging orthogonal basis to the active client, sends the active orthogonal basis to the lagging client, and sends the cosine value between the two orthogonal bases to all clients. In addition, the global gradient is updated by adding the quotient of the average value of the latest gradients of all clients and the learning rate, and the cached latest gradient of the lagging client replaces the latest gradient of the lagging client that has not been uploaded in time to participate in the global model update.

[0050] Embodiment 2:

[0051] The cross-department federated learning method based on gradient orthogonalization has the following specific steps:

[0052] 1) Assume that there is a server and a set S of K clients. During the initial communication process, the server broadcasts the initial global model parameters to all clients for local training. Then, the client uploads the latest gradient to the server. The server divides the client set according to the relationship between the response time of the client uploading the latest gradient and the time required for a round of communication. Specifically, if the response time of the client sending the latest gradient is less than the time required for a round of communication, the client is classified into the active client set S1; if the response time of the client sending the latest gradient is greater than the time required for a round of communication, the client is classified into the active client set S2; where , that is, the intersection of two sets is empty.

[0053] 2) Based on the number of clients in S1 and S2, the server will allocate two memory spaces M1 and M2 to store the latest gradients uploaded by active clients and lagging clients respectively. When the server receives the latest gradient, it will store it in the memory space. The latest gradient of the active client is stored in M1, and the latest gradient of the lagging client is stored in M2. The formula for the latest gradient is:

[0054] ,

[0055] Where I is the number of iterations of local training,

[0056] In the tth round of communication, the local model parameters obtained by the kth client after I rounds of iterations,

[0057] represents the global model broadcast by the server in the tth round of communication,

[0058] is the learning rate used when training the local model,

[0059] It is represented as the latest gradient obtained after the kth client completes training in the tth round of communication.

[0060] The present invention uploads the latest gradient instead of uploading the model parameters after local training because the latest gradient can represent the local model from Update to Update direction.

[0061] 3) After a round of communication is completed, the global model will calculate the orthogonal basis and cosine value and update the global model according to the latest gradient stored in M1 and M2.

[0062] First, the active orthogonal basis b1 is obtained by calculating the average value of all the latest gradients in M1, and the backward orthogonal basis b2 is obtained by calculating the average value of all the latest gradients in M2. Since the latest gradient represents the update direction of the client's local training, the orthogonal basis b1 and b2 obtained by averaging the latest gradient can represent the update direction of all active clients and the update direction of all backward clients' local training, respectively.

[0063] Second, calculate the cosine of the angle between the two orthogonal bases:

[0064] ,

[0065] in, represents the inner product of the active orthogonal basis and the backward orthogonal basis,

[0066] represents the product of the norms of the active orthogonal basis b1 and the backward orthogonal basis b2.

[0067] Since the cosine of the angle between two vectors can represent the similarity of the directions between the vectors, the cosine value of the angle between two orthogonal bases can represent the similarity between the update directions of all active clients and the update directions of all lagging clients.

[0068] Finally, the global gradient is obtained by calculating the average of the latest gradients of all clients to update the global model parameters. Since b1 and b2 are the average of the latest gradients of all active clients and all lagging clients respectively, the global gradient is:

[0069] ,

[0070] The global model is then updated to obtain the global model parameters for the next round of communication:

[0071] ,

[0072] in, is the learning rate used for global model updates,

[0073] represents the global model broadcast by the server in the tth round of communication,

[0074] is the global model parameter of the t+1th round of communication.

[0075] The global model is updated using the average of all the latest gradients, ensuring that the update information of the lagging clients is involved in each global model update, and preventing the global model from updating along the average update direction of the active clients instead of the average update direction of all clients when the latest gradient uploaded by the lagging clients is not received. , updated global model parameters Send to all clients, send the active orthogonal basis b1 to all lagging clients, and send the lagging orthogonal basis b2 to all active clients.

[0076] 4) After receiving the above parameters, the client starts local training. Taking the active client as an example, assume that the active client k receives the backward orthogonal basis b2 and the global model parameters , cosine value During local training, the client must first calculate the cosine of the angle between the gradient and the backward orthogonal basis b2 before using the gradient obtained in the current iteration to update the local model parameters. :

[0077] ,

[0078] Where g is the gradient obtained in the current iteration.

[0079] Then by comparing and The size of is used to determine whether orthogonalization is performed:

[0080] if Less than , indicating that the similarity between the update direction of the gradient g and the backward orthogonal basis b2 is less than the similarity between the update direction of the active orthogonal basis b1 and the backward orthogonal basis b2. At this time, if g is used directly to update the local model, the difference between the local model parameters of the active client k and the local model parameters of other backward clients will increase, which will make it difficult for the global model to obtain an accurate update direction by averaging the latest gradient. Therefore, the gradient g needs to be corrected by orthogonalization. Therefore, first calculate the projection component of g onto b2:

[0081] ,

[0082] The corrected gradient is then obtained by the following formula :

[0083] ,

[0084] Among them, the projection component Represents the gradient component in the current iteration that is opposite to the update direction of b2;

[0085] The gradient g obtained by the current iteration is orthogonalized after the projection component is subtracted, so that the difference in the update direction between the gradient g obtained by the current iteration and the backward orthogonal basis b2 is reduced. However, after subtracting the projection component, the norm of g is Will be reduced, which will reduce the update step size of the local model and reduce the convergence speed, so we will subtract the projection component multiplied by ,because Less than ,so Less than 1, which ensures that the update step size of the local model will not decrease, and finally the corrected gradient is used Update the local model.

[0086] if Greater than or equal to , indicating that the similarity between the update direction of the gradient g and the backward orthogonal basis b2 is greater than or equal to the similarity between the update directions of the active orthogonal basis b1 and the backward orthogonal basis b2. At this time, using g to update the local model will reduce the difference between the local model parameters of the active client k and the local model parameters of other backward clients, which is conducive to the convergence of the global model and there is no need to orthogonalize and correct the gradient.

[0087] The local training method for lagging clients is based on the same principle as that for active clients. Except that the orthogonal basis needs to be changed to b1, other operations are the same as above.

[0088] 5) After the active client and the lagging client upload the latest gradient to the server, a round of communication is completed. Federated learning can obtain a trained global model by performing multiple rounds of communication until the loss function converges.

[0089] The present invention updates the global model with the average value of the latest gradients cached by all clients on the server side, ensuring that the update direction of the global model will not be biased towards the update direction of the active client, thereby improving the accuracy of the global model. During local model training, the present invention avoids the increase in the difference in model parameters after the active client and the lagging client are updated through orthogonalization, making the update direction of the global model more accurate when the average latest gradient is used for updating. The present invention multiplies the projection component by or , which avoids the decrease in convergence speed caused by the significant reduction of the gradient norm due to orthogonalization.

[0090] Embodiment 3:

[0091] Cross-sector federated learning methods based on gradient orthogonalization, such as Figure 1 As shown, the following steps are included:

[0092] Step 1: The server creates a memory space in the device to store the latest gradients of all clients. Asynchronous communication is used. In each round of communication, after the server sends the global model to all clients, the client sends the latest gradient to the server, and the server caches the latest gradients of all clients.

[0093] Step 2: The server divides all clients into active clients and lagging clients according to the timeliness of uploading the latest gradient. Specifically, the server broadcasts the initial global model parameters to all clients for local training, and marks the clients that can upload gradients to the server in time in the first round of communication as active clients, and the remaining clients that fail to upload gradients in time are marked as lagging clients.

[0094] Step 3: The server calculates the active orthogonal basis based on the latest gradient from the active client, calculates the backward orthogonal basis based on the latest gradient from the backward client, and calculates the cosine of the angle between the two orthogonal bases. At the beginning of the next round of communication, the active orthogonal basis is sent to all lagging clients, the lagging orthogonal basis is sent to all active clients, and the cosine value of the angle between the two orthogonal bases is sent to all clients. At the same time, the server will calculate the average of the latest gradients of all clients as the global gradient, update the global model parameters by adding the current global model parameters to the quotient of the global gradient and the learning rate, and send the updated global model to all clients.

[0095] The calculation formula is as follows:

[0096] ,

[0097] Among them: b1 is the active orthogonal basis, b2 is the lagging orthogonal basis.

[0098] Step 4: The lagging client and active client perform local training based on the active orthogonal basis and the active orthogonal basis respectively, and update the local model. The specific steps are as follows:

[0099] (1) After receiving the orthogonal basis, the client will update the local model by orthogonalizing the gradient. In each iteration of local training, the client calculates the cosine value between the gradient obtained in the current iteration and the orthogonal basis , and determine whether to perform orthogonalization based on the relationship between the cosine value and the orthogonal basis. The calculation formula is as follows:

[0100] ,

[0101] Among them, g is the gradient currently being projected;

[0102] b is an orthogonal basis. For lagging clients, b is equal to b1; for active clients, b is equal to b2;

[0103] is the norm of the orthogonal basis;

[0104] is the norm of the current gradient;

[0105] g·b represents the inner product of the gradient and an orthogonal basis.

[0106] (2) The present invention uses the cosine value of the angle between the gradient and the orthogonal basis to measure the difference in direction between the gradient and the orthogonal basis. The lagging client and the active client calculate the gradient used to update the local model respectively. :

[0107] ,

[0108] in: It is the projection component obtained by projecting the current gradient g onto the orthogonal basis b;

[0109] is the norm of the orthogonal basis;

[0110] is the norm of the current gradient;

[0111] If g is the gradient on the active client, then b is the backward orthogonal basis, that is, b=b2; if g is the gradient on the backward client, b is the active orthogonal basis, that is, b=b1.

[0112] like Figure 3 As shown, Figure 3 (a) is a schematic diagram showing that the projection component is in the opposite direction to the orthogonal basis. In this case, the projection component is subtracted from the gradient to obtain an orthogonal gradient that is orthogonal to the orthogonal basis. Figure 3 (b) is a schematic diagram showing that the projection component and the orthogonal basis have the same direction, and no gradient orthogonalization is performed at this time. After this operation, The difference in direction from the orthogonal basis b is less than the difference in direction between g and the orthogonal basis b.

[0113] Specifically, if the cosine value of the angle between the current gradient and the orthogonal basis is less than the cosine value of the angle between the two orthogonal bases, the current gradient is projected onto the orthogonal basis to obtain the projection component:

[0114] .

[0115] When the cosine of the angle between the gradient and the orthogonal basis Less than the cosine of the angle between two orthogonal bases , indicating that the difference between the current gradient and the orthogonal basis in the update direction has become larger than that of the previous round of gradients. At this time, the projection component is opposite to the orthogonal basis in direction. If the projection is subtracted from the current gradient, the difference in direction between the gradient and the orthogonal basis can be reduced. If the projection component is divided by the cosine value of the angle between the gradient and the orthogonal basis and multiplied by the cosine value of the angle between the two orthogonal bases before subtracting the projection component, the gradient length can be avoided from being shortened due to the subtraction of the component, thereby ensuring that the update step size of the gradient descent is not affected.

[0116] When the cosine of the angle between the gradient and the orthogonal basis Greater than or equal to the cosine of the angle between two orthogonal bases , indicating that the difference between the current gradient and the orthogonal basis in the update direction has become smaller than that of the previous round of gradients. If the projection component is subtracted from the current gradient, the difference in direction between the gradient and the orthogonal basis will increase. Therefore, there is no need to orthogonalize the current gradient.

[0117] Step 5: After completing local training, the client subtracts the trained local model parameters from the pre-trained local model parameters, and obtains the latest gradient of the client by dividing the difference by the learning rate. After the client uploads the latest gradient, the server caches the latest gradient and uses it to calculate the orthogonal basis and update the global model.

[0118] Step 6: Repeat steps 2 to 5 until the loss function converges to obtain the trained global model.

[0119] To verify the effectiveness of the present invention, the test dataset used is the public dataset CIFAR-10, which includes 10 classification categories (image size 3×28×28); the model used is Resnet-18 to verify the test performance of the present invention on the visual task of image classification.

[0120] In the federated learning setting, we simulated a distributed environment of 50 clients and divided the CIFAR-10 dataset into 50 subsets, each of which was independently deployed on a client. In order to be closer to the cross-departmental federated learning environment in the real world, the present invention specially designed a non-independent and identically distributed (Non-IID) data partitioning strategy. On the CIFAR-10 dataset, it is ensured that 95% of the images owned by each client belong to a specific category, which is defined as the main category. This design successfully constructs a non-independent and identically distributed data scenario.

[0121] The present invention sets up three different system heterogeneity scenarios L1, L2, and L3, wherein in L1 there are 30 active clients that upload gradients in each round of communication, 10 lagging clients that upload once every three rounds of communication, and 10 lagging clients that upload once every five rounds of communication; in L2 there are 20 active clients that upload gradients in each round of communication, 15 lagging clients that upload once every three rounds of communication, and 15 lagging clients that upload once every five rounds of communication; in L3 there are 10 active clients that upload gradients in each round of communication, 20 lagging clients that upload once every three rounds of communication, and 20 lagging clients that upload once every five rounds of communication.

[0122] The present invention prepares 5 benchmark methods for comparison with the present invention in the above three system heterogeneity scenarios. The 5 benchmark methods are FedAvg (PMLR, 2017), MIFA (NIPS, 2021), SAFA (TC, 2020), FLANP (JSAIT, 2022), and GradMA (CVPR, 2023). After 300 rounds of training, the classification accuracy of the final global model is shown in Table 1. Obviously, in the scenarios of different system heterogeneity settings, the final trained model of Example 3 is better than other methods in classification performance, and only Example 3 has an accuracy rate of more than 50%, while the accuracy rates of other benchmark methods are less than 50%.

[0123] Table 1 Experimental results of various methods for image classification on CIFAR10

[0124]

[0125] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A cross-sector federated learning method based on gradient orthogonalization, characterized in that: The following steps are involved: Step S1: Based on asynchronous communication, the server divides all clients into active clients and lagging clients according to the timeliness of the response to uploading the latest gradient; The server then sends the updated global model to all clients; Step S2: The lagging client and the active client perform local training respectively and calculate the gradient used to update the local model : For lagging clients, b is equal to the active orthogonal basis b1, where the active orthogonal basis b1 is the average of the latest gradients of all active clients; for active clients, b is equal to the lagging orthogonal basis b2, where the lagging orthogonal basis b2 is the average of the latest gradients of all lagging clients; Where: g is the current gradient; is the cosine of the angle between the active orthogonal basis b1 and the lagging orthogonal basis b2; is the cosine value of the angle between the current gradient g and the orthogonal basis b; It is the projection component obtained by projecting the current gradient g onto the orthogonal basis b; Step S3: After completing local training, the lagging client and the active client upload the latest gradient to the server respectively; Step S4: Repeat steps S1 to S3 until the loss function converges; In step S1, the server updates the global model parameters as the current global model parameters minus the quotient of the global gradient and the learning rate, and the global gradient is the average of the latest gradients of all clients; In the step S2, The calculation formula is as follows: , in: is the norm of the orthogonal basis b; is the norm of the current gradient g; In step S3, the latest gradient is the difference between the local model parameters after training and the local model parameters before training of the lagging client or the active client divided by the learning rate; In step S1, the server creates a memory space in the device for storing the latest gradients of all clients; asynchronous communication is adopted, and in each round of communication, after the server sends the global model to all clients, the client sends the latest gradient to the server, and the server caches the latest gradients of all clients.

2. The cross-departmental federated learning method based on gradient orthogonalization according to claim 1, characterized in that: In step S1, during the initial communication process, the server broadcasts the initial global model parameters to all clients for local training, and then the clients upload the latest gradients to the server; the clients that can upload the latest gradients to the server in time are marked as active clients, and the remaining clients that fail to upload the latest gradients in time are marked as lagging clients.

3. The cross-departmental federated learning method based on gradient orthogonalization according to claim 1, characterized in that: In the step S2, The calculation formula is as follows: 。 4. A cross-departmental federated learning system based on gradient orthogonalization, based on the cross-departmental federated learning method based on gradient orthogonalization according to any one of claims 1 to 3, characterized in that: It includes a latest gradient cache module, a client partition module, an orthogonal basis calculation module and a gradient orthogonalization training module which are arranged in sequence from front to back; The latest gradient cache module is used to store the latest gradients uploaded by all clients; The client division module is used to divide the clients into active clients and lagging clients based on the response timeliness of uploading the latest gradient; The orthogonal basis calculation module is used to calculate the active orthogonal basis and the backward orthogonal basis and the cosine value of the angle between the active orthogonal basis and the backward orthogonal basis. , in order to send the active orthogonal basis and the backward orthogonal basis to the backward client and the active client respectively, and send the cosine value Sent to all clients; The gradient orthogonalization training module is used to perform local training on the lagging client and the active client, and calculates the gradient based on the active orthogonal basis, the lagging orthogonal basis and the current gradient. to update the local model.

5. The cross-departmental federated learning system based on gradient orthogonalization according to claim 4, characterized in that: It also includes a model evaluation module, which is used to test the global model after the federated learning training using a test data set to evaluate the model performance of the global model.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the cross-departmental federated learning method based on gradient orthogonalization described in any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Optimization method for heterogeneous model fusion in federated learning

    CN114912705A

  • Aggregation server selection method for decentralized federated learning

    CN115081002A

  • Data isomerism-oriented personalized federal learning method and storage medium

    CN116579443A

  • Federal learning security aggregation method based on cosine similarity and homomorphic encryption

    CN117216779A

  • Federal learning method, system and device and storage medium

    CN117436515A

Cited By

  • Collaborative modeling method, device and system based on hierarchical gradient regulation and dynamic privacy federated learning

    CN122965620A

  • Asynchronous federated learning system and method based on ineffective weight vector decomposition

    EP4760609A1