Method and device for updating global model and local model of joint learning architecture
By using the method of adding penalty terms to the parameter change state in joint learning in system heterogeneous scenarios, the problem of large deviation between the local model and the global model is solved, and the accuracy of the training results is improved.
Patent Information
- Application Number
- CN202110039718.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-13
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2041-01-13
AI Technical Summary
In system heterogeneous scenarios, there is a large deviation between the local model and the global model in joint learning, resulting in unsatisfactory training results.
During the local model training process, the parameter change state between the new local model and the target global model is extracted. When the parameter change state exceeds the preset deviation range, it is added to the penalty term of the local model to reduce the parameter change gap.
It improves the accuracy of local training of local models, reduces the deviation between local models and global models, and improves the effectiveness of joint learning.
Smart Images

Figure CN114764621B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a method and device for updating a global model and a local model of a joint learning architecture. Background Art
[0002] Due to the objective existence of system heterogeneity, when the local client participating in the joint learning obtains the local model through training, there is a large deviation between the local model and the global model. Therefore, those skilled in the art are eager to improve the problem of deviation between the local model and the global model in the joint learning. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method and device for updating the global model and local model of a joint learning architecture to solve the problem that the parameter change state deviation in the local model training process in joint learning in system heterogeneous scenarios is too large, resulting in unsatisfactory training results.
[0004] In a first aspect, the present invention provides a local model updating method for a joint learning architecture, comprising: receiving a global model obtained by aggregating local models uploaded by clients participating in the joint learning; training the global model with target data to obtain a target global model; updating the local model according to the target global model to obtain a new local model; extracting a parameter change state between the new local model and the target global model; and when the parameter change state deviates from a preset state parameter interval, adding the parameter change state to a penalty term.
[0005] In some optional schemes, when the parameter change state deviates from the preset state parameter interval, after adding the parameter change state to the penalty term, it also includes: uploading the new local model in which the parameter change state is added to the penalty term to the joint server.
[0006] The second aspect of the present invention provides a global model updating method for a joint learning architecture, which includes: when the parameter change state between the new local model generated by the client in the joint learning architecture and the target global model deviates from the preset state parameter interval, the parameter change state is added to the new local model generated by the penalty term; the new local models uploaded by all clients are aggregated, and the global model is updated according to the aggregation results; the updated global model is distributed to each client participating in the joint learning.
[0007] In some optional schemes, when the parameter change state between the new local model generated by the client in the joint learning architecture and the target global model deviates from the preset state parameter interval, before adding the parameter change state to the new local model generated in the penalty term, it also includes: initializing the global model according to the joint learning architecture; and sending the initialized global model to each client participating in the joint learning.
[0008] In some optional schemes, distributing the updated global model to each client participating in the joint learning also includes: determining whether the updated global model meets the conditions for stopping learning: if not, distributing the updated global model to each client participating in the joint learning; if so, stopping the joint learning and outputting the updated global model.
[0009] According to the third aspect of the present invention, a local model updating device of a joint learning architecture is provided, comprising: a global model receiving module, used to receive a global model obtained by aggregating local models uploaded by clients participating in the joint learning; a global model training module, used to train the global model with target data to obtain a target global model; a local model updating module, used to update the local model according to the target global model to obtain a new local model; a parameter change state module, used to extract the parameter change state between the new local model and the target global model; and a model parameter modification module, used to add the parameter change state to the penalty term when the parameter change state deviates from a preset state parameter interval.
[0010] In some optional schemes, it also includes: a local model uploading module, which is used to upload a new local model with the parameter change state added to the penalty item to the joint server.
[0011] In a fourth aspect of the present invention, a global model updating device for a joint learning architecture is provided, comprising: a local model acquisition module, for acquiring a new local model generated by a client in the joint learning architecture and a target global model, when the parameter change state between the new local model generated by the client deviates from a preset state parameter interval, and adding the parameter change state to the penalty term to generate a new local model; a local model aggregation module, for aggregating the new local models uploaded by all clients, and updating the global model according to the aggregation results; and a global model distribution module, for distributing the updated global model to each client participating in the joint learning.
[0012] In some optional schemes, it also includes: a global initialization module, which is used to initialize the global model according to the joint learning architecture; an initial model distribution module, which is used to distribute the initialized global model to each client participating in the joint learning.
[0013] In some optional schemes, the global model distribution module includes: an iteration condition judgment unit, used to judge whether the updated global model meets the conditions for stopping learning; a global model iteration unit, used to distribute the updated global model to each client participating in the joint learning if not; a global model stopping unit, used to stop the joint learning if so, and output the updated global model.
[0014] The beneficial effect of the embodiments of the present invention compared with the prior art is: the present invention is aimed at the client in the joint learning architecture in the system heterogeneous scenario, by extracting the parameter change state between the new local model and the target global model during the local model training process, and when the parameter change state exceeds the preset deviation range, the parameter change state is added to the penalty term of the local model, so as to improve the accuracy of the locally trained local model. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 A joint learning architecture to which the method and device for updating the global model and the local model of the joint learning architecture of the present invention can be applied;
[0017] Figure 2 is a flow chart of a local model updating method of a joint learning architecture provided in Example 1;
[0018] Figure 3 is a flow chart of a global model updating method of a joint learning architecture provided in Example 2;
[0019] Figure 4 It is a structural diagram of the local model updating device of the joint learning architecture provided in Example 3. DETAILED DESCRIPTION
[0020] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0021] Figure 1The method and device for updating the global model and the local model of the joint learning architecture of the present invention can be applied to the joint learning architecture of the present invention, such as Figure 1 As shown, in the joint learning architecture, it includes: a server 101 and multiple clients 102, 103, 104, and the multiple clients 102, 103, 104 are respectively connected to the server for communication.
[0022] The server 101 is the trust center of the federated learning, also called the central server; the clients 102, 103, and 104 are the clients of the federated learning. Generally, the number of clients can be K, where K ≥ 2 and is a positive integer, for example, Figure 1 client-1, client-2…client-K in the server.
[0023] Specifically, the client may include but is not limited to electronic devices such as computers, servers, and workstations. Exemplarily, the electronic device may include: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any complete method in the following embodiment 1 or embodiment 2 are implemented.
[0024] More specifically, the memory may be a storage medium, such as a read-only memory or a random access memory, etc. Exemplarily, the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any complete method in the following embodiment 1 or embodiment 2 are implemented.
[0025] Federated learning allows multiple users to collaboratively train a shared global model without sharing data in local devices. The central server coordinates multiple rounds of federated learning to obtain the final global model. At the beginning of each round, the central server sends the current global model to the clients participating in the federated learning; each client trains the received global model based on its local data, and returns the updated model to the central server after training; after the central server collects the updates returned by all clients, it updates the global model once, and then ends this round of updates. In traditional federated learning, federated learning is updated synchronously, that is, the central server sends the global model synchronously to multiple clients, and multiple clients train the model based on local data and then synchronously return the updated model to the central server. It has been found in actual applications that due to the objective existence of system heterogeneity, when the local clients participating in the federated learning train the local model, there is a large deviation between the local model and the global model.
[0026] At this point, in the following embodiments of the present invention, a penalty term will be added to the loss function during the training of the local model, so that the local model will not deviate too much from the global model, thereby improving the accuracy of the learning model in the local client.
[0027] Embodiment 1
[0028] Figure 2 1 is a flowchart of a local model updating method of a joint learning architecture provided in Embodiment 1, wherein this embodiment illustrates the present invention from the client side in the joint learning architecture. Specifically, the method comprises the following steps S101-S105.
[0029] S101: Receive a global model obtained by aggregating local models uploaded by clients participating in the joint learning.
[0030] Among them, in the joint learning architecture, the local client receives the global model sent by the server, and also includes the client downloading the global model from the server. It should be understood that the sending of the global model and the uploading of the local model mentioned in this embodiment are both for the intermediate parameters of the model. This article is for the convenience of description and refers to the global model and the local model for short, and the same applies to the description below.
[0031] S102, training the global model using the target data to obtain a target global model.
[0032] The target data includes local data of the client, and may also include data required in other scenarios. For example, the client's own operating data or parameter data may be used, or external data obtained from the client, such as weather conditions, temperature conditions, etc., may also be used. It should be understood that the present application does not limit the specific content of the target data.
[0033] S103: updating the local model according to the target global model to obtain a new local model.
[0034] Among them, following the previous step, by using the target data to train the global model, the target global model can be obtained after the training is completed. Therefore, the target global model after this training can be used to update the local model generated last time, so as to obtain a new local model. Of course, if the client is training the global model for the first time, then the target local model it obtains is the new local model.
[0035] S104: Extracting the parameter change state between the new local model and the target global model.
[0036] Among them, under system heterogeneity, the parameter change state gap between the new local model and the target global model may be very large, thereby affecting the training effect of the model.
[0037] S105: When the parameter change state deviates from a preset state parameter interval, the parameter change state is added to a penalty term.
[0038] The preset state parameter interval can be set according to the specific application situation, and this application does not limit it. Here, adding the parameter change state to the penalty term can reduce the parameter change gap between the new local model and the target global model, thereby facilitating rapid learning and obtaining the target model.
[0039] For the convenience of understanding by those skilled in the art, the above steps are described in detail below with an example. For example, assuming that the penalty term in the local model is F(w), w represents the new local model, and wt represents the target global model, the loss function of the local model is:
[0040] lose=F(w)+[w-wt] 2 .
[0041] It should be understood that there are many specific examples of adding penalty terms in the loss function in practice, and they are not limited to the above examples. For example, coefficients can also be added to the loss function. Therefore, the present application does not limit the specific implementation method of adding the deviation of parameter changes between the local local model and the global model to the penalty term during the local training process.
[0042] In addition, in one example, after the above step S105, the method may further include step S106 of uploading the new local model in which the parameter change state is added to the penalty term to the joint server.
[0043] Embodiment 2
[0044] Figure 3 1 is a flow chart of a global model updating method of a joint learning architecture provided in Embodiment 2, wherein this embodiment illustrates the present invention from the server side in the joint learning architecture. Specifically, the method comprises the following steps S201-S203.
[0045] Step S201: When the parameter change state between the new local model generated by the client in the joint learning framework and the target global model deviates from the preset state parameter interval, the parameter change state is added to the new local model generated in the penalty term.
[0046] Corresponding to the first embodiment above, under the joint learning architecture, the server will receive the local models uploaded by each client, such as the local model after the penalty item is modified as mentioned above.
[0047] In addition, if the global model is initialized by the server, before the above step S201, the following steps may be further included:
[0048] S301, initializing the global model according to the joint learning architecture;
[0049] S302: Send the initialized global model to each client participating in the joint learning.
[0050] When the joint learning task is started, the server initializes the global model according to the connected clients, and then sends the initialized global model to the clients participating in the joint learning. It should be noted that in the joint learning process, the global model sent by the server to the client, or the global model downloaded by the client, specifically includes the parameters of the global model, such as the average gradient of the model; and the local model of the client last time is also the parameters of the local model.
[0051] Considering that in the existing joint learning, the initialization of the global model is performed by the server before starting the task, after measuring the algorithm model, data structure, etc. installed in each client participating in the joint learning. The parameters are uniformly initialized. Since this initialization of the global model is performed when all participants have completed access, the efficiency of initialization is often not high in the case of system heterogeneity. To this end, in an example one, for step S01, it can also specifically include: at the beginning of the task, the server initializes the first model added to the task as a global model. In this way, there is no need to consider the initialization of the global model after all participants have completed access, which can effectively improve the efficiency of global model initialization, and also avoid the situation where the central server cannot initialize the global model normally due to abnormalities in individual clients under system heterogeneity.
[0052] Step S202: Aggregate the new local models uploaded by all clients, and update the global model according to the aggregation results.
[0053] Here, the local models are aggregated, which may be the aggregation of the parameter means of all local models, and then the aggregated parameters are used to update the global model after the previous aggregation to obtain a new global model.
[0054] Step S203: Distribute the updated global model to each client participating in the joint learning.
[0055] Specifically, in an example, step S203 may further include:
[0056] Step S231, determine whether the updated global model meets the conditions for stopping learning:
[0057] Step S232: if not, the updated global model is distributed to each client participating in the joint learning;
[0058] Step S233: If yes, stop the joint learning and output the updated global model.
[0059] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0060] Embodiment 3
[0061] Under the same inventive concept, this embodiment also provides a device corresponding to each step of the method described in the above embodiment 1.
[0062] Figure 4 It is a structural diagram of the local model updating device of the joint learning architecture provided in Example 3.
[0063] like Figure 4 As shown, the local model updating device 400 of the joint learning architecture includes: a global model receiving module 401, which is used to receive a global model obtained by aggregating local models uploaded by clients participating in the joint learning; a global model training module 402, which is used to train the global model with target data to obtain a target global model; a local model updating module 403, which updates the local model according to the target global model to obtain a new local model; a parameter change state module 404, which is used to extract the parameter change state between the new local model and the target global model; a model parameter modification module 405, which is used to add the parameter change state to the penalty term when the parameter change state deviates from the preset state parameter interval.
[0064] In some optional embodiments, the local model updating device 400 of the joint learning architecture further includes: a local model uploading module, configured to upload a new local model in which the parameter change state is added to the penalty term to the joint server.
[0065] Embodiment 4
[0066] Under the same inventive concept, this embodiment also provides a device corresponding to each step of the method described in the above-mentioned embodiment 2.
[0067] Specifically, the present embodiment provides a global model updating device for a joint learning architecture, which includes: a local model acquisition module, used to obtain a new local model generated by a client in the joint learning architecture and a target global model when the parameter change state deviates from a preset state parameter interval, and add the parameter change state to the penalty term to generate a new local model; a local model aggregation module, used to aggregate the new local models uploaded by all clients, and update the global model according to the aggregation results; a global model distribution module, used to distribute the updated global model to each client participating in the joint learning.
[0068] In some optional embodiments, it also includes: a global initialization module, which is used to initialize the global model according to the joint learning architecture; and an initial model distribution module, which is used to distribute the initialized global model to each client participating in the joint learning.
[0069] In some optional embodiments, the global model distribution module includes: an iteration condition judgment unit, used to judge whether the updated global model meets the condition for stopping learning; a global model iteration unit, used to distribute the updated global model to each client participating in the joint learning if not; and a global model stopping unit, used to stop the joint learning if so, and output the updated global model.
[0070] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A global model updating method for a joint learning architecture, characterized in that: include: Receive a global model obtained by aggregating local models uploaded by clients participating in the federated learning; Training the global model using target data to obtain a target global model, wherein the target data includes local data of the client; Updating the local model according to the target global model to obtain a new local model; Extracting a parameter change state between the new local model and the target global model; When the parameter change state deviates from the preset state parameter interval, the parameter change state is added to the penalty term; When the parameter change state deviates from the preset state parameter interval, after adding the parameter change state to the penalty term, the method further includes: Upload the new local model in which the parameter change state is added to the penalty term to the joint server; When the parameter change state between the new local model generated by the client and the target global model in the joint learning architecture deviates from the preset state parameter interval, the parameter change state is added to the new local model generated in the penalty term; Aggregate the new local models uploaded by all clients and update the global model based on the aggregation results; Distribute the updated global model to each client participating in federated learning.
2. The global model updating method of the joint learning architecture according to claim 1, characterized in that: The step of obtaining the parameter change state between the new local model generated by the client in the joint learning framework and the target global model deviates from the preset state parameter interval, before adding the parameter change state to the new local model generated in the penalty term, further includes: Initialize the global model according to the joint learning architecture; The initialized global model is sent to each client participating in the joint learning.
3. The global model updating method of the joint learning architecture according to claim 1 or 2, characterized in that: The method of distributing the updated global model to each client participating in the joint learning further includes: Determine whether the updated global model meets the conditions for stopping learning: If not, the updated global model is distributed to each client participating in the federated learning; If yes, stop the joint learning and output the updated global model.
4. A global model updating device for a joint learning architecture, characterized in that: include: A global model receiving module is used to receive a global model obtained by aggregating local models uploaded by clients participating in the joint learning; A global model training module, used for training the global model with target data to obtain a target global model, wherein the target data includes local data of the client; A local model updating module, which updates the local model according to the target global model to obtain a new local model; A parameter change state module, used for extracting the parameter change state between the new local model and the target global model; A model parameter modification module, used for adding the parameter change state to the penalty term when the parameter change state deviates from the preset state parameter interval; A local model uploading module, used for uploading a new local model in which the parameter change state is added to the penalty term to the joint server; A local model acquisition module is used to acquire a new local model generated by a client in a joint learning framework and add the parameter change state to a penalty term when the parameter change state between the new local model generated by the client and the target global model deviates from a preset state parameter interval; The local model aggregation module is used to aggregate new local models uploaded by all clients and update the global model based on the aggregation results; The global model distribution module is used to distribute the updated global model to each client participating in the federated learning.
5. The global model updating device of the joint learning architecture according to claim 4, characterized in that: Also includes: The global initialization module is used to initialize the global model according to the federated learning architecture; The initial model sending module is used to send the initialized global model to each client participating in the joint learning.
6. The global model updating device of the joint learning architecture according to claim 4 or 5, characterized in that: The global model distribution module includes: Iteration condition judgment unit, used to judge whether the updated global model meets the conditions for stopping learning: A global model iteration unit, used for distributing the updated global model to each client participating in the federated learning if no; The global model stopping unit is used to stop the joint learning if , and output the updated global model.
Citation Information
Patent Citations
Training machine learning models on multiple machine learning tasks
CN109690576A
Federated learning training method based on model dispersion
CN111860581A
Model joint training method and equipment, and storage medium
CN112163675A