A model parameter updating method and device

By obtaining the local model gradient and weight of the client and updating the server model parameters, the problem of inability to distinguish the completeness of model training in the federated averaging algorithm is solved, and the model update efficiency is improved.

CN114037045BActive Publication Date: 2025-03-18EVERBRIGHT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111307114.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-05
Publication Date
2025-03-18
Estimated Expiration
2041-11-05

AI Technical Summary

Technical Problem

The federated averaging algorithm cannot effectively distinguish the degree of completeness of user model training, resulting in reduced model update efficiency.

Method used

By obtaining the gradient and gradient weights of the local model determined by multiple clients based on the number of trainings, and updating the model parameters of the total model on the server side based on these gradients and weights, the updated model parameters are obtained.

Benefits of technology

The number of local models trained by different clients is different, and the gradient weights are also different, so that models with high training degree of completeness have higher weights when uploading, and models with low training degree of completeness have relatively low weights, which improves the efficiency of model parameter update.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114037045B_ABST
    Figure CN114037045B_ABST
Patent Text Reader

Abstract

The present invention provides a model parameter updating method and device, wherein the method comprises: obtaining the gradients and gradient weights of local models determined by multiple clients according to the number of training times; updating the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models to obtain the updated model parameters, which can solve the problem in the related art that the degree of completeness of model training cannot be distinguished, resulting in reduced model updating efficiency. Different clients determine different gradient weights for different numbers of training times of their local models, and the model parameters of the server-side total model are updated according to the gradients and gradient weights of the multiple local models, so that the local models with a high degree of training completeness have a higher weight when uploaded, and the local models with a low degree of training completeness have a relatively low weight, which can improve the efficiency of model parameter updating.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a model parameter updating method and device. Background Art

[0002] At present, the federated average algorithm cannot solve the problem of uneven training times on the user's mobile terminal. In the mobile terminal scenario, it mainly covers mobile devices such as mobile phones, tablets and cars. Before the user uploads or downloads the model, the local training is triggered according to the update strategy of the user's local data, resulting in the user having performed a total of T rounds of training locally. The existing algorithm does not take the number of training times T into consideration, which makes it impossible to distinguish the degree of completeness of user model training, reducing the efficiency of model update.

[0003] There is no solution yet to the problem that related technologies cannot distinguish the degree of completeness of model training, which reduces the efficiency of model updating. Summary of the invention

[0004] The embodiments of the present invention provide a model parameter updating method and device to at least solve the problem in the related art that the degree of completeness of model training cannot be distinguished, thereby reducing the model updating efficiency.

[0005] According to an embodiment of the present invention, a model parameter updating method is provided, which is applied to a server and includes:

[0006] Obtain the gradients and gradient weights of the local models of multiple clients determined according to the number of training times;

[0007] The model parameters of the server-side total model are updated according to the gradients and gradient weights of multiple local models to obtain updated model parameters.

[0008] Optionally, the method further comprises:

[0009] The model parameters of the server-side total model are updated according to the gradients and gradient weights of the multiple local models to obtain updated model parameters:

[0010] Among them, θ * is the updated model parameter, θ is the initial model parameter, is the gradient of local model i, ω i is the gradient weight of the local model i, and ε is the learning rate of the server-side total model.

[0011] Optionally, after updating the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models to obtain updated model parameters, the method further includes:

[0012] Sending a notification message of updated model parameters to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model to zero.

[0013] According to another embodiment of the present invention, a model parameter updating method is also provided, which is applied to a client and includes:

[0014] Determine the gradient and gradient weight of the local model based on the number of training times;

[0015] The gradient and gradient weight of the local model are sent to the server, so that the server updates the model parameters of the server's total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

[0016] Optionally, before determining the gradient and gradient weight of the local model, the method further includes:

[0017] Download the model from the server;

[0018] The model is trained according to local data to obtain the local model, and the number of times the local model is trained is recorded.

[0019] Optionally, determining the gradient and gradient weight of the local model includes:

[0020] Obtain target model parameters of the local model after the current training is completed;

[0021] Determining the gradient of the local model according to the target model parameters and the initial model parameters;

[0022] The gradient weight is determined according to the number of training times of the local model.

[0023] Optionally, the method further comprises:

[0024] The gradient of the local model is determined according to the model parameters and the initial model parameters in the following manner:

[0025] in, is the gradient of local model i, θ0 is the initial model parameter, θ t is the target model parameter, ε i is the learning rate of the local model i;

[0026] The gradient weight is determined according to the number of training times of the local model in the following manner:

[0027] ω i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T iis the number of training times.

[0028] Optionally, after sending the gradient and gradient weight of the local model to the server, the method further includes:

[0029] Sending a notification message of updated model parameters to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model to zero.

[0030] According to another embodiment of the present invention, there is also provided a model parameter updating device, which is applied to a server and includes:

[0031] An acquisition module is used to obtain the gradients and gradient weights of local models determined by multiple clients according to the number of training times;

[0032] The update module is used to update the model parameters of the server-side total model according to the gradients and gradient weights of multiple local models to obtain updated model parameters.

[0033] Optionally, the updating module is further configured to update the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models in the following manner to obtain updated model parameters:

[0034] Among them, θ * is the updated model parameter, θ is the initial model parameter, is the gradient of local model i, ω i is the gradient weight of the local model i, and ε is the learning rate of the server-side total model.

[0035] Optionally, the device further comprises:

[0036] The first notification module is used to send a notification message of updated model parameters to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model.

[0037] According to another embodiment of the present invention, there is also provided a model parameter updating device, which is applied to a client and includes:

[0038] A determination module is used to determine the gradient and gradient weight of the local model according to the number of training times;

[0039] The sending module is used to send the gradient and gradient weight of the local model to the server, so that the server updates the model parameters of the server's total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

[0040] Optionally, the device further comprises:

[0041] A download module, used to download the model from the server;

[0042] The training module is used to train the model according to local data to obtain the local model and record the number of times the local model is trained.

[0043] Optionally, the determining module includes:

[0044] An acquisition submodule, used to obtain target model parameters of the local model after the current training is completed;

[0045] A first determination submodule, configured to determine a gradient of the local model according to the target model parameters and the initial model parameters;

[0046] The second determination submodule is used to determine the gradient weight according to the number of training times of the local model.

[0047] Optionally, the first determining submodule is further configured to determine the gradient of the local model according to the model parameters and the initial model parameters in the following manner:

[0048] in, is the gradient of local model i, θ0 is the initial model parameter, θ t is the target model parameter, ε i is the learning rate of the local model i;

[0049] The second determination submodule is further configured to determine the gradient weight according to the number of training times of the local model in the following manner:

[0050] ω i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T i is the number of training times.

[0051] Optionally, the device further comprises:

[0052] The second notification module is used to send a notification message of updated model parameters to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model.

[0053] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0054] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0055] Through the present invention, the gradients and gradient weights of local models determined by multiple clients according to the number of training times are obtained; the model parameters of the server-side total model are updated according to the gradients and gradient weights of the multiple local models to obtain the updated model parameters, which can solve the problem in the related art that the degree of completeness of model training cannot be distinguished, thereby reducing the efficiency of model updating. Different clients determine different gradient weights for different training times of their local models, and the model parameters of the server-side total model are updated according to the gradients and gradient weights of the multiple local models, so that the local model with a high degree of training completeness has a higher weight when uploaded, and the local model with a low degree of training completeness has a relatively low weight, which can improve the efficiency of model parameter updating. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0057] Figure 1 is a hardware structure block diagram of a mobile terminal of a model parameter updating method according to an embodiment of the present invention;

[0058] Figure 2 The process of the model parameter updating method according to the embodiment of the present invention is Figure 1 ;

[0059] Figure 3 The process of the model parameter updating method according to the embodiment of the present invention is Figure 2 ;

[0060] Figure 4 is a schematic diagram of a federated average supplementation algorithm based on horizontal federated learning according to an embodiment of the present invention;

[0061] Figure 5 is a frame of a model parameter updating device according to an embodiment of the present invention Figure 1 ;

[0062] Figure 6 is a frame of a model parameter updating device according to an embodiment of the present invention Figure 2 . DETAILED DESCRIPTION

[0063] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0064] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0065] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal of a model parameter updating method according to an embodiment of the present invention, such as Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0066] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the model parameter updating method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0067] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0068] In this embodiment, a model parameter updating method running on the above mobile terminal or network architecture is provided. Figure 2 The process of the model parameter updating method according to the embodiment of the present invention is Figure 1 ,like Figure 2 As shown, applied to the server, the process includes the following steps:

[0069] Step S202, obtaining the gradients and gradient weights of the local models determined by the multiple clients according to the number of training times;

[0070] Step S204, updating the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models to obtain updated model parameters.

[0071] Furthermore, in the above step S204, the model parameters of the server-side total model may be updated in the following manner to obtain updated model parameters:

[0072] Among them, θ * is the updated model parameter, θ is the initial model parameter, is the gradient of local model i, ω i is the gradient weight of the local model i, and ε is the learning rate of the server-side total model.

[0073] Through the above steps S202 to S204, the problem in the related art that the degree of completeness of model training cannot be distinguished, resulting in reduced model update efficiency, can be solved. Different clients determine different gradient weights for different training times of their local models, and the model parameters of the server-side total model are updated according to the gradients and gradient weights of multiple local models, so that the local model with a high degree of training completeness has a higher weight when uploaded, and the local model with a low degree of training completeness has a relatively low weight, which can improve the efficiency of model parameter updating.

[0074] In an optional embodiment, after the above step S204, a notification message of updated model parameters is sent to the multiple clients, wherein the notification message is used to instruct the multiple clients to reset the number of training times of the local model to zero.

[0075] According to another embodiment of the present invention, a model parameter updating method is also provided. Figure 3 The process of the model parameter updating method according to the embodiment of the present invention is Figure 2 ,like Figure 3 As shown, applied to the client, the process includes the following steps:

[0076] Step S302, determining the gradient and gradient weight of the local model according to the number of training times;

[0077] Step S304, sending the gradient and gradient weight of the local model to the server, so that the server updates the model parameters of the server total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

[0078] Through the above steps S302 to S304, the problem in the related art that the degree of completeness of model training cannot be distinguished, resulting in reduced model update efficiency, can be solved. Different clients determine different gradient weights for different training times of their local models, and the model parameters of the server-side total model are updated according to the gradients and gradient weights of multiple local models, so that the local model with a high degree of training completeness has a higher weight when uploaded, and the local model with a low degree of training completeness has a relatively low weight, which can improve the efficiency of model parameter updating.

[0079] In an optional embodiment, before the above step S302, a model is downloaded from the server; the model is trained according to local data to obtain the local model, and the number of times the local model is trained is recorded.

[0080] In the embodiment of the present invention, the above step S302 may specifically include:

[0081] Obtain target model parameters of the local model after the current training is completed;

[0082] The gradient of the local model is determined according to the target model parameters and the initial model parameters. Specifically, the gradient of the local model can be determined in the following manner: in, is the gradient of local model i, θ0 is the initial model parameter, θ t is the target model parameter, ε i is the learning rate of the local model i;

[0083] The gradient weight is determined according to the number of training times of the local model. Specifically, the gradient weight is determined in the following manner: i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T i is the number of training times.

[0084] In another optional embodiment, after the above step S304, a notification message of updated model parameters is sent to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model.

[0085] The following content uses the general template of the regression model as an example to explain the principle of the federal average supplement algorithm. Other similar models can be expanded based on the regression model and will not be explained separately.

[0086] Figure 4 is a schematic diagram of a federated average supplementation algorithm based on horizontal federated learning according to an embodiment of the present invention, such as Figure 4 As shown in the figure, the server will generate the initial total model, the user end will download the model from the server, and the user end will perform training based on local data. Each training includes n rounds of cycles, and a total of T training times are performed. The user end determines the model gradient, determines the gradient weight according to the number of training times, and then uploads the model gradient and gradient weight. The server updates the model to obtain a new model; the user end downloads the new model and resets the number of training times to zero.

[0087] Assume that the server model is Y = θ·X, where θ = (θ0, θ1, ..., θ n ), X=(1,x1,...,x n ), the range of the gradient weight ω is set to [α,1), where α is a hyperparameter;

[0088] Let the local model of the i-th user be Y i =θ i ·X i , where θ i is the user local parameter vector, X i is the user's local data, and T i is the number of times user i uploads gradients for local training. is the gradient to be uploaded by user i this time, that is, Where θ0 is the local initial model parameter, θ t is the model parameter after local training, ε i is the local learning rate;

[0089] Then there is a gradient weight ω i =(2+2α)sigmoid(T i-1)+2α-1, and the updated parameters on the server are Where ε is the model learning rate.

[0090] Compared with the original federated average algorithm, the supplementary algorithm increases the number of user training times T i and the gradient weight ω i , after the user completes a training session, T i Increase by 1. One training can include multiple rounds of loop operations. The number of training times is reset to zero when the user downloads a new model from the server.

[0091] The embodiment of the present invention introduces the number of training times, increases the weight value during federation averaging; introduces the weight value range hyperparameter, expands the value range of the original sigmoid function in the non-negative range from [0.5,1) to [α,1); in addition to the regression model exemplified in the principle, logistic regression and multi-layer perceptron (Multi-Layer Percepetron, MLP for short) of deep neural network are also applicable, where MLP can be split according to hidden layers, and each hidden layer is similar to a regression model. The parameter of the number of training times can be replaced by the sample size ratio, or other subjectively assigned weights; for new users, the learning rate of the user's local model is reduced, or momentum is added to cause the learning rate to decay; through hyperparameter search for other hyperparameters or the use of more complex models, the model accuracy can be greatly improved, thereby reducing the model effect gap between the original algorithm and the supplementary algorithm of this patent.

[0092] According to another embodiment of the present invention, a model parameter updating device is provided, which is applied to a server. Figure 5 is a frame of a model parameter updating device according to an embodiment of the present invention Figure 1 ,like Figure 5 As shown, including:

[0093] An acquisition module 52 is used to obtain the gradients and gradient weights of the local models determined by multiple clients according to the number of training times;

[0094] The updating module 54 is used to update the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models to obtain updated model parameters.

[0095] Optionally, the updating module 54 is further configured to update the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models in the following manner to obtain updated model parameters:

[0096] Among them, θ * is the updated model parameter, θ is the initial model parameter, is the gradient of local model i, ω iis the gradient weight of the local model i, and ε is the learning rate of the server-side total model.

[0097] Optionally, the device further comprises:

[0098] The first notification module is used to send a notification message of updated model parameters to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model.

[0099] According to another embodiment of the present invention, a model parameter updating device is provided, which is applied to a client. Figure 6 is a frame of a model parameter updating device according to an embodiment of the present invention Figure 2 ,like Figure 6 As shown, including:

[0100] A determination module 62, used to determine the gradient and gradient weight of the local model according to the number of training times;

[0101] The sending module 64 is used to send the gradient and gradient weight of the local model to the server, so that the server updates the model parameters of the server's total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

[0102] Optionally, the device further comprises:

[0103] A download module, used to download the model from the server;

[0104] The training module is used to train the model according to local data to obtain the local model and record the number of times the local model is trained.

[0105] Optionally, the determining module 62 includes:

[0106] An acquisition submodule, used to obtain target model parameters of the local model after the current training is completed;

[0107] A first determination submodule, configured to determine a gradient of the local model according to the target model parameters and the initial model parameters;

[0108] The second determination submodule is used to determine the gradient weight according to the number of training times of the local model.

[0109] Optionally, the first determining submodule is further configured to determine the gradient of the local model according to the model parameters and the initial model parameters in the following manner:

[0110] in, is the gradient of local model i, θ0 is the initial model parameter, θ tis the target model parameter, ε i is the learning rate of the local model i;

[0111] The second determination submodule is further configured to determine the gradient weight according to the number of training times of the local model in the following manner:

[0112] ω i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T i is the number of training times.

[0113] Optionally, the device further comprises:

[0114] The second notification module is used to send a notification message of updated model parameters to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model.

[0115] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0116] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0117] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0118] S11, obtaining the gradients and gradient weights of local models determined by multiple clients according to the number of training times;

[0119] S12, updating the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models to obtain updated model parameters.

[0120] Optionally, in this embodiment, the above storage medium may also be configured to store a computer program for performing the following steps:

[0121] S21, determining the gradient and gradient weight of the local model according to the number of training times;

[0122] S22, sending the gradient and gradient weight of the local model to the server, so that the server updates the model parameters of the server total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

[0123] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0124] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0125] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0126] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0127] S11, obtaining the gradients and gradient weights of local models determined by multiple clients according to the number of training times;

[0128] S12, updating the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models to obtain updated model parameters.

[0129] Optionally, in this embodiment, the processor may also be configured to perform the following steps through a computer program:

[0130] S21, determining the gradient and gradient weight of the local model according to the number of training times;

[0131] S22, sending the gradient and gradient weight of the local model to the server, so that the server updates the model parameters of the server total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

[0132] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0133] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0134] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A model parameter updating method, applied to a server, characterized in that: include: Obtain the gradient and gradient weight of the local model determined by multiple clients according to the number of training times, wherein the gradient of the local model is determined according to the target model parameters and the initial model parameters of the local model after the current training is completed in the following manner: in, is the gradient of local model i, θ0 is the initial model parameter, θ t is the target model parameter, ε i is the learning rate of the local model i; the gradient weight is determined according to the number of training times of the local model in the following manner: ω i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T i is the number of trainings; The model parameters of the server-side total model are updated according to the gradients and gradient weights of multiple local models to obtain updated model parameters.

2. The method according to claim 1, characterized in that The method further comprises: The model parameters of the server-side total model are updated according to the gradients and gradient weights of the multiple local models to obtain updated model parameters: Among them, θ * is the updated model parameter, θ is the initial model parameter, is the gradient of local model i, ω i is the gradient weight of the local model i, and ε is the learning rate of the server-side total model.

3. The method according to claim 1 or 2, characterized in that: After updating the model parameters of the server-side total model according to the gradients and gradient weights of the multiple local models to obtain updated model parameters, the method further includes: Sending a notification message of updated model parameters to the multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model to zero.

4. A model parameter updating method, applied to a client, characterized in that: include: Determining the gradient and gradient weight of the local model according to the number of training times includes: obtaining the target model parameters of the local model after the current training is completed; determining the gradient of the local model according to the target model parameters and the initial model parameters in the following manner: ▽θ i =(θ0-θ t ) / ε i , where ▽θ i is the gradient of local model i, θ0 is the initial model parameter, θ t is the target model parameter, ε i is the learning rate of the local model i; the gradient weight is determined according to the number of training times of the local model in the following manner: ω i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T i is the number of trainings; The gradient and gradient weight of the local model are sent to the server, so that the server updates the model parameters of the server's total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

5. The method according to claim 4, characterized in that Before determining the gradient and the gradient weight of the local model, the method further includes: Download the model from the server; The model is trained according to local data to obtain the local model, and the number of times the local model is trained is recorded.

6. The method according to any one of claims 4 to 5, characterized in that After sending the gradient and gradient weight of the local model to the server, the method further includes: Sending a notification message of updated model parameters to multiple clients, wherein the notification message is used to instruct the multiple clients to clear the number of training times of the local model to zero.

7. A model parameter updating device, applied to a server, characterized in that: include: An acquisition module is used to obtain the gradient and gradient weight of the local model determined by multiple clients according to the number of training times, wherein the gradient of the local model is determined according to the target model parameters and initial model parameters of the local model after the current training is completed in the following manner: i =(θ0-θ t ) / ε i , where ▽θ i is the gradient of local model i, θ0 is the initial model parameter, θ t is the target model parameter, ε i is the learning rate of the local model i; the gradient weight is determined according to the number of training times of the local model in the following manner: ω i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T i is the number of trainings; The update module is used to update the model parameters of the server-side total model according to the gradients and gradient weights of multiple local models to obtain updated model parameters.

8. A model parameter updating device, applied to a client, characterized in that: include: A determination module is used to determine the gradient and gradient weight of the local model according to the number of training times, including: obtaining the target model parameters of the local model after the current training is completed; determining the gradient of the local model according to the target model parameters and the initial model parameters in the following manner: ▽θ i =(θ0-θ t ) / ε i , where ▽θ i is the gradient of local model i, θ0 is the initial model parameter, θ t is the target model parameter, ε i is the learning rate of the local model i; the gradient weight is determined according to the number of training times of the local model in the following manner: ω i =(2+2α)sigmoid(T i -1)+2α-1, α is a constant, T i is the number of trainings; The sending module is used to send the gradient and gradient weight of the local model to the server, so that the server updates the model parameters of the server's total model according to the gradient and gradient weight of the local model to obtain updated model parameters.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 3 and 4 to 6 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 3 and 4 to 6.

Citation Information

Patent Citations

  • Method, system and device for updating model parameters based on federated learning

    CN112288100A