Federated learning method and device, storage medium, and computer program product
By introducing proximal term and Lagrangian multiplier update methods in federated learning, the deviation problem between the local optimal solution and the global optimal solution caused by heterogeneous data is solved, and the training efficiency and performance of the model are improved.
Patent Information
- Application Number
- CN202411864590.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-17
AI Technical Summary
The prior art is difficult to effectively process heterogeneous data, resulting in a deviation between the local optimal solution and the global optimal solution in federated learning, affecting the training efficiency and performance of the model.
In the federated learning method, the local loss function of the proximal term is introduced, and the local model parameters of the target model are updated using the gradient descent method. At the same time, through the Lagrangian multiplier update method, the coefficients of the nearest term in the local loss function are adjusted to ensure that the difference between the sum of the local loss functions of all clients and the global loss function is less than the preset threshold.
By introducing proximal term and Lagrangian multiplier update method, the importance of differential information can be more accurately controlled during the model update process, the deviation caused by heterogeneous data can be reduced, and the training efficiency and performance of the model can be improved.
Smart Images

Figure CN119337971B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of machine learning, and more specifically, to a federated learning method and apparatus, a storage medium, and a computer program product. Background Art
[0002] With the acceleration of digital transformation, data has become the core element driving the development of all walks of life, but the security risks behind it are also becoming increasingly prominent, especially in key areas such as medical care, finance and intelligent manufacturing. Data in these areas are not only highly sensitive, but once leaked, they will trigger a chain reaction, not only damaging personal privacy, but also disrupting market order, threatening social stability and even national security. In this context, the importance of federated learning technology as a tool for data security and privacy protection is self-evident. This technology fundamentally cuts off the risk source of data leakage by allowing data to be encrypted locally and only sharing the updated parameters or gradient information of the model instead of directly transmitting the original data, providing a safe and reliable bridge for cross-institutional cooperation. This distributed learning method not only protects the privacy of data, but also promotes the sharing and integration of knowledge, allowing all parties to jointly improve the accuracy and generalization ability of the model without exposing sensitive information. However, in the face of an increasingly complex heterogeneous data environment, federated learning technology is also facing unprecedented challenges. Heterogeneous data not only increases the difficulty of data processing, but also may introduce deviations between the local optimal solution and the global optimal solution, affecting the training efficiency and performance of the model. Therefore, how to effectively process heterogeneous data while ensuring data security and privacy has become the key to the further development of federated learning technology. Summary of the invention
[0003] The embodiments of the present disclosure provide a federated learning method and apparatus, a storage medium, and a computer program product, which can effectively solve the problem in the prior art that the federated learning technology cannot effectively process heterogeneous data.
[0004] In a general aspect, a federated learning method is provided, which is applied to a target client, and the method includes: cyclically performing the following update operations: based on a local loss function that introduces a proximal term and a gradient descent method, updating local model parameters of a target model at a target client, wherein the proximal term includes first difference information between the local model parameters and the global model parameters of the target model; in response to a difference between the sum of the local loss functions of all clients and the global loss function being less than a preset threshold, updating the coefficient of the proximal term in the local loss function of the target client using a Lagrange multiplier update method; in response to the target model satisfying a first preset termination condition, sending the updated local model parameters to a server.
[0005] Optionally, it is determined that the target model satisfies the first preset termination condition in the following manner: the local iteration number of the target model reaches a local iteration number threshold, wherein the local iteration number threshold is obtained by minimizing a global loss function, and the global loss function is determined based on second difference information between global model parameters and predetermined model parameters, and predetermined variables, the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method, and the predetermined variables indicate the local iteration number threshold of the target model.
[0006] Optionally, the global loss function is determined in the following manner: determining the upper limit of the first difference information and the resource information consumed by the target model; determining the global loss function based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, the updated predetermined constant and resource information corresponding to the target model.
[0007] In another general aspect, a federated learning method is provided, which is applied to a server and includes: receiving updated local model parameters of a target model from at least one client, wherein the updated local model parameters corresponding to each client are model parameters after the target model is updated based on a local loss function that introduces proximal terms and a gradient descent method, the proximal terms contain first difference information between the local model parameters of the corresponding client and the global model parameters of the target model, and the coefficients of the proximal terms in the local loss function of each client are updated using a Lagrange multiplier update method; globally aggregating the updated local model parameters corresponding to each client to obtain global model parameters of the target model; in response to the target model satisfying a second preset termination condition, sending the global model parameters to each client and notifying each client to stop the update operation; in response to the target model not satisfying the second preset termination condition, sending the global model parameters to each client and notifying each client to continue the update operation based on the global model parameters.
[0008] Optionally, after aggregating the updated local model parameters corresponding to each client to obtain the global model parameters of the target model, it also includes: determining second difference information between the global model parameters and predetermined model parameters, wherein the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method; determining a global loss function based on the second difference information and predetermined variables, wherein the predetermined variables indicate a local iteration number threshold of the target model; minimizing the global loss function to obtain a local iteration number threshold for the next update operation of each client; in response to the target model not satisfying a second preset termination condition, sending the local iteration number threshold for the next update operation to each client respectively.
[0009] Optionally, based on the second difference information, a global loss function is determined, including: determining the upper limit of the first difference information and resource information consumed by the target model; the global loss function is determined based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, the updated predetermined constant and resource information corresponding to the target model.
[0010] Optionally, the predetermined constant is updated in the following manner: obtaining the predetermined constant of the target model on each client; taking the average value of the predetermined constant of each client as the updated predetermined constant.
[0011] Optionally, before sending the global model parameters to each client, it also includes: in response to the global loss corresponding to the current global aggregation being less than the global loss corresponding to the previous global aggregation, sending the global model parameters after the current aggregation to each client; in response to the global loss corresponding to the current global aggregation being not less than the global loss corresponding to the previous global aggregation, sending the global model parameters after the previous global aggregation to each client; wherein the global loss is determined based on the local loss function of each client.
[0012] In another general aspect, a federated learning device is provided, which is applied to a target client and includes: a loop unit, configured to cyclically perform the following update operations: based on a local loss function that introduces proximal terms and a gradient descent method, updating local model parameters of a target model at a target client, wherein first difference information between the local model parameters and the global model parameters of the target model; in response to a difference between the sum of the local loss functions of all clients and the global loss function being less than a preset threshold, updating the coefficient of the proximal term in the local loss function of the target client using a Lagrange multiplier update method; and a first sending unit, configured to send the updated local model parameters to a server in response to the target model satisfying a first preset termination condition.
[0013] Optionally, it is determined that the target model satisfies the first preset termination condition in the following manner: the local iteration number of the target model reaches a local iteration number threshold, wherein the local iteration number threshold is obtained by minimizing a global loss function, and the global loss function is determined based on second difference information between global model parameters and predetermined model parameters, and predetermined variables, the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method, and the predetermined variables indicate the local iteration number threshold of the target model.
[0014] Optionally, the global loss function is determined in the following manner: determining the upper limit of the first difference information and the resource information consumed by the target model; determining the global loss function based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, the updated predetermined constant and resource information corresponding to the target model.
[0015] In another general aspect, a federated learning device is provided, which is applied to a server, comprising: a receiving unit, configured to receive updated local model parameters of a target model from at least one client, wherein the updated local model parameters corresponding to each client are model parameters after the target function is updated based on a local loss function introducing a proximal term and a gradient descent method, the proximal term contains first difference information between the local model parameters of the corresponding client and the global model parameters of the target function, and the coefficients of the proximal term in the local loss function of each client are updated using a Lagrange multiplier update method; an aggregation unit, configured to globally aggregate the updated local model parameters corresponding to each client to obtain the global model parameters of the target model; a second sending unit, configured to send the global model parameters to each client in response to the target model satisfying a second preset termination condition, and notify each client to stop the update operation; in response to the target model not satisfying the second preset termination condition, send the global model parameters to each client, and notify each client to continue the update operation based on the global model parameters.
[0016] Optionally, the aggregation unit is further configured to, after aggregating the updated local model parameters corresponding to each client to obtain the global model parameters of the target model, determine second difference information between the global model parameters and the predetermined model parameters, wherein the predetermined model parameters are the model parameters after the target model is updated based on the centralized learning method; determine a global loss function based on the second difference information and predetermined variables, wherein the predetermined variables indicate a local iteration number threshold of the target model; minimize the global loss function to obtain a local iteration number threshold for the next update operation of each client; and in response to the target model not satisfying the second preset termination condition, send the local iteration number threshold for the next update operation to each client respectively.
[0017] Optionally, the aggregation unit is also configured to determine the upper limit of the first difference information and the resource information consumed by the target model; and determine the global loss function based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, the updated predetermined constant and resource information corresponding to the target model.
[0018] Optionally, the predetermined constant is updated in the following manner: obtaining the predetermined constant of the target model on each client; taking the average value of the predetermined constant of each client as the updated predetermined constant.
[0019] Optionally, the second sending unit is configured to, before sending the global model parameters to each client, in response to the global loss corresponding to the current global aggregation being less than the global loss corresponding to the previous global aggregation, send the global model parameters after the current aggregation to each client; in response to the global loss corresponding to the current global aggregation being not less than the global loss corresponding to the previous global aggregation, send the global model parameters after the previous global aggregation to each client; wherein the global loss is determined based on the local loss function of each client.
[0020] In another general aspect, a computer-readable storage medium storing instructions is provided, wherein when the instructions are executed by at least one computing device, the at least one computing device is caused to perform the federated learning method as described above.
[0021] In another general aspect, a system is provided that includes at least one computing device and at least one storage device storing instructions, wherein the instructions, when executed by the at least one computing device, cause the at least one computing device to perform the federated learning method as described above.
[0022] In another general aspect, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the federated learning method as described above.
[0023] According to the federated learning method and device, storage medium, and computer program product of the embodiments of the present disclosure, the difference information of the local model parameters and the global model parameters of the target model is introduced into the local loss function of the target client, so that the difference information is taken into account when updating the target model, and the deviation between the local optimal solution and the global optimal solution caused by heterogeneous data can be avoided; at the same time, when the difference between the sum of the local loss functions of all clients and the global loss function is less than a preset threshold, the Lagrange multiplier update method is used to update the correlation coefficient of the difference information in the local loss function of the target client, so that the proportion of the difference information in the local loss function can be adjusted according to the change of the above-mentioned difference information, so that the importance of the difference information in the local loss function of the target client can be more accurately controlled during the model update process. Therefore, through the present disclosure, the problem that the federated learning technology in the prior art cannot effectively process heterogeneous data can be effectively solved.
[0024] Additional aspects and / or advantages of the present general inventive concept will be set forth in part in the following description and in part will be apparent from the description or may be learned through practice of the present general inventive concept. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The above and other objects and features of the embodiments of the present disclosure will become more apparent through the following description in conjunction with the accompanying drawings showing the embodiments, in which:
[0026] Figure 1 The process of the federated learning method of the embodiment of the present disclosure is shown as follows Figure 1 ;
[0027] Figure 2 The process of the federated learning method of the embodiment of the present disclosure is shown as follows Figure 2 ;
[0028] Figure 3 is a schematic diagram showing a federated learning framework of an embodiment of the present disclosure;
[0029] Figure 4 is a schematic diagram showing the overall flow of the federated learning method of an embodiment of the present disclosure;
[0030] Figure 5 is a block diagram showing a federated learning apparatus of the present disclosure Figure 1 ;
[0031] Figure 6 is a block diagram showing a federated learning apparatus of the present disclosure Figure 2 . DETAILED DESCRIPTION
[0032] The following specific embodiments are provided to help the reader obtain a comprehensive understanding of the methods, devices and / or systems described herein. However, after understanding the disclosure of the present application, various changes, modifications and equivalents of the methods, devices and / or systems described herein will be clear. For example, the order of operations described herein is only an example and is not limited to those orders set forth herein, but can be changed as will be clear after understanding the disclosure of the present application, except for operations that must occur in a specific order. In addition, for greater clarity and simplicity, the description of features known in the art may be omitted.
[0033] The features described herein can be implemented in different forms and should not be construed as being limited to the examples described herein. Rather, the examples described herein have been provided to illustrate only some of the many possible ways to implement the methods, devices, and / or systems described herein, which will be clear after understanding the disclosure of the present application.
[0034] As used herein, the term "and / or" includes any one of the associated listed items and any combination of any two or more.
[0035] Although terms such as "first", "second", and "third" may be used herein to describe various members, components, regions, layers, or portions, these members, components, regions, layers, or portions should not be limited by these terms. Instead, these terms are only used to distinguish one member, component, region, layer, or portion from another member, component, region, layer, or portion. Therefore, without departing from the teachings of the examples described herein, the first member, first component, first region, first layer, or first portion referred to in the examples may also be referred to as the second member, second component, second region, second layer, or second portion.
[0036] In the specification, when an element (such as a layer, a region, or a substrate) is described as being “on”, “connected to”, or “coupled to” another element, the element may be directly “on”, “connected to”, or “coupled to” another element, or one or more other elements may be present therebetween. Conversely, when an element is described as being “directly on”, “directly connected to”, or “directly coupled to” another element, there may be no other elements present therebetween.
[0037] The terms used herein are only used to describe various examples and are not intended to limit the disclosure. Unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. The terms "comprise", "include" and "have" indicate the presence of the described features, quantities, operations, components, elements and / or combinations thereof, but do not exclude the presence or addition of one or more other features, quantities, operations, components, elements and / or combinations thereof.
[0038] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which the present disclosure belongs after understanding the present disclosure. Unless explicitly defined as such herein, terms (such as those defined in general dictionaries) should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and should not be interpreted in an idealized or overly formal manner.
[0039] Furthermore, in the description of examples, when it is considered that a detailed description of a well-known related structure or function would cause vague interpretation of the present disclosure, such a detailed description will be omitted.
[0040] The present disclosure relates to resource-constrained federated learning techniques, which require a server (also referred to as a parameter server) and n Each client has its own network parameters, that is, the model parameters of the target model, and updates the target model separately during the training process (hereinafter referred to as local update). τAfter each update (also called iteration), each client uploads the local model parameters obtained by training the model locally to the server. After receiving the local model parameters of each client, the server performs global aggregation on all local model parameters to obtain the global model parameters of the target model and redistributes the global model parameters to each client. Assume t represents the total number of iterations for each client, where ; k Represents the number of global aggregations, where Each local update and global aggregation in the federated learning process usually results in resource consumption, including various types of resources such as transmission bandwidth, storage resources, and computing resources. Assuming that m Different types of resources, among which ; Representative Resource consumption of a partial update of class resources on all clients, Representative m The resource consumption of the class resources in a global aggregation, Represents the total available resource budget, that is, the total resources that can be utilized on the client and the central controller.
[0041] In the federated learning process, due to data privacy and security requirements, each client (such as mobile devices, edge devices, or data islands) can only train the target model on its local dataset and cannot directly share data. Although this setting protects data privacy, it also brings the challenge of inconsistent data distribution, namely the non-independent and identically distributed problem. Non-independent and identically distributed data means that the data of different clients differ in feature space, label distribution, or data scale, which may lead to deviations between the local optimal solution and the global optimal solution.
[0042] In order to overcome the above problems, the present disclosure proposes a federated learning method and apparatus, a storage medium, and a computer program product. The federated learning method and apparatus, storage medium, and computer program product of the present disclosure are described in detail below in conjunction with the accompanying drawings.
[0043] This paper proposes a federated learning method. Figure 1 The process of the federated learning method of the embodiment of the present disclosure is shown as follows Figure 1 . Reference Figure 1 , the federated learning method is applied to the target client and includes the following steps:
[0044] In step S101, the following update operations are performed in a loop: based on the local loss function that introduces the proximal term and the gradient descent method, the local model parameters of the target model at the target client are updated, wherein the proximal term includes the first difference information between the local model parameters and the global model parameters of the target model; in response to the difference between the sum of the local loss functions of all clients and the global loss function being less than a preset threshold, the coefficient of the proximal term in the local loss function of the target client is updated using the Lagrange multiplier update method.
[0045] As an example, the first difference information mentioned above refers to the difference information between the global model parameters and the local model parameters. In order to make better use of the difference information, this embodiment introduces a proximal term containing the difference information in the local loss function, which plays the role of a regularizer, encouraging the local model parameters to maintain a certain degree of proximity with the global model parameters during the update process, such as maintaining a predetermined ratio of consistent parameters between the local model parameters and the global model parameters, so that the target model can optimize its own performance in the client while also taking into account the consistency with the global model parameters.
[0046] As an example, the upper limit of the first difference information will not exceed a predefined parameter deviation tolerance. ξ , for example, i Client No. Local model parameters before sub-global aggregation With Global model parameters after sub-global aggregation There is an upper limit to the parameter difference between and The distance between the two will never exceed a predefined parameter deviation tolerance ξ .
[0047] As an example, the coefficient in the above proximal term (or regularization strength) is a key parameter that needs to be adjusted according to the specific situation to find the best balance point. If the coefficient of the proximal term is set too small, the effect of the proximal term may be negligible and cannot effectively constrain the deviation of the local model parameters from the global model parameters; if the coefficient of the proximal term is set too large, it may overly restrict the flexibility of the local model parameters, resulting in the target model being unable to fully adapt to the local data characteristics of the client. In addition, since the distribution of data between each client is significantly different, it is necessary to set different control parameters for the proximal term, that is, the proximal term coefficient, so that the importance of the proximal term can be more accurately controlled during the entire update process.
[0048] In this embodiment, the local loss function after the introduction of the proximal term can be regarded as a Lagrangian function. At this time, different Lagrangian multipliers, that is, the proximal term coefficients, can be defined for different clients. In order to effectively manage the data heterogeneity between different clients, it is extremely important to conduct an in-depth analysis of the relationship between the local loss function and the global loss function, that is, the heterogeneity between the target models on different clients can be captured, and the relationship between the local loss and the global loss of each client can be compared to model the relationship. Therefore, when the difference between the sum of the local loss functions of all clients and the global loss function is less than a preset threshold, the Lagrangian multiplier update method can be used to update the coefficient of the proximal term in the local loss function of each client.
[0049] It should be noted that given the global model parameters After that, the sum of the local loss functions of all clients must be less than or equal to the scaling factor multiplied by the global loss function. When the scaling factor is close to 1, it indicates that the gradient corresponding to the local model parameters of each client is closely aligned with the gradient corresponding to the global model parameters, and the target model converges at this time. Therefore, this embodiment is limited to using the Lagrange multiplier update method to update the coefficient of the proximal term in the local loss function of each client when the sum of the local loss functions of all clients approaches the global loss function (that is, the difference between the two is less than a preset threshold).
[0050] As an example, after the local loss function is determined, the target model on each client may be updated using a gradient descent method, which is not limited in the present disclosure.
[0051] As an example, the local loss function introducing the proximal term may be as follows, which is not limited in the present disclosure:
[0052] (1)
[0053] Among them, the Indicates i The original loss function of the client, Indicates i On the client k The local model parameters before sub-global aggregation, the expression after the plus sign is the proximal term, Indicates k The global model parameters after sub-global aggregation, represents the coefficient of the proximal term.
[0054] As an example, the above target model can be used in the fields of image recognition, speech recognition, text recognition, etc., which are not limited by the present disclosure. Among them, the field of image recognition can include but is not limited to: predicting image categories and predicting characters in images; the field of speech recognition can include but is not limited to: predicting speech emotion categories and predicting speech tendencies; text recognition can include but is not limited to: predicting text emotion tendencies, predicting text emotion categories, and predicting fraudulent transactions. The input of the above target model can be structured data, such as customer order information of a certain enterprise, which is represented by a fixed table structure, including fields such as order number, customer name, and order time; the input of the above target model can also be unstructured data, such as customer complaint content stored in a document file, which is represented in text format and has no fixed pattern; the input of the above target model can also be images or speech, which are not limited by the present disclosure.
[0055] In step S102, in response to the target model satisfying a first preset termination condition, the updated local model parameters are sent to the server.
[0056] As an example, the server may be a central controller or other types of servers as long as they can achieve similar functions.
[0057] According to an embodiment of the present disclosure, it can be determined that the target model satisfies the first preset termination condition in the following manner: the number of local iterations of the target model reaches a local iteration threshold, wherein the local iteration threshold is obtained by minimizing the global loss function, the global loss function is determined based on the second difference information between the global model parameters and the predetermined model parameters, and the predetermined variables, the predetermined model parameters are the model parameters after the target model is updated based on the centralized learning method, and the predetermined variables indicate the local iteration threshold of the target model. Through this embodiment, the value of the predetermined variable after minimizing the global loss function is used as the local iteration threshold, and the global loss function also covers the difference information between the global model parameters and the predetermined model parameters, that is, the determination of the local iteration threshold also considers the difference information, so that a relatively moderate local iteration threshold can be determined.
[0058] As an example, in order to effectively reduce resource consumption, the number of local updates and global aggregations can be optimized to minimize the server's global loss function under resource constraints. The formula of the global loss function is as follows:
[0059] (2)
[0060] The global loss function reflects the real-time fluctuations in local model parameter updates and resource consumption, which greatly increases the difficulty of the original optimization problem. Therefore, the federated learning technology based on difference measurement can use the difference information between the predetermined model parameters (the predetermined model parameters are the model parameters after the target model is updated based on the centralized learning method) and the global model parameters to construct a substitute function (i.e., the global loss function) for the original optimization problem to optimize the number of local updates (i.e., the number of local iterations) and the number of global aggregations. In fact, it is quite difficult to make an extremely accurate analysis of the specific expression of the local iteration number threshold and the global aggregation number threshold in the substitute function. The main reason is that the substitute function depends greatly on the convergence characteristics of the gradient and the dynamic changes in resource consumption. In the process of theoretical analysis, the convergence process of the model parameters is first analyzed in depth, and an approximate treatment of the solution of the global loss function is attempted through the upper bound of convergence. Taking the difference information between local model parameters and global model parameters as the important foundation and basis, an adaptive control algorithm is proposed. The core purpose of proposing this algorithm is to effectively optimize the local iteration number threshold and the global aggregation number threshold, and finally obtain the asymptotic optimal solution, that is, to obtain the most suitable local iteration number threshold and global aggregation number threshold.
[0061] The convergence analysis process is as follows: determine the upper bound of the difference between the global model parameters of the target model and the optimal parameters (i.e., the above-mentioned predetermined model parameters) in the loss function, and then obtain the expression of the substitute function based on the upper bound of the difference. Specifically, it can be divided into two main steps: S1, in the At the iteration, obtain the parameter difference between the global model parameters of the target model and the predetermined model parameters; S2, use the parameter difference in S1 and the upper bound of the difference to determine the expression of the substitute function. Since the centralized learning framework is considered in the process of convergence analysis, the present disclosure can update the model more effectively. Then, the minimization of the global loss function can be achieved by minimizing the substitute function approximation, and then, according to the minimization of the global loss function, the approximate optimal local iteration number threshold can be obtained, thereby solving the optimal global aggregation number threshold and the total number of iterations. T .
[0062] According to an embodiment of the present disclosure, the global loss function can be determined in the following manner: determining the upper limit of the first difference information and the resource information consumed by the target model; determining the global loss function based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, the updated predetermined constant and resource information corresponding to the target model. Through this embodiment, the global loss function determined by the above information contains rich information, so that based on the global loss function, a better model parameter can be updated.
[0063] As an example, the upper limit of the first difference information can be set as needed, and the resource information consumed by the target model can be determined in the following manner, which is not limited in the present disclosure:
[0064] (3)
[0065] As an example, the above substitution function (also known as the global loss function) ) can be expressed as follows, which is not limited by the present disclosure:
[0066] (4)
[0067] in, Representative m Resource consumption of a partial update of class resources on all clients, Representative m The resource consumption of the class resources in a global aggregation, Represents the total available resource budget, that is, the total resources that can be utilized on the client and the central controller. represents the parameter difference between the global model parameters of the target model and the predetermined model parameters, express The average of the proximal term coefficients for each client in the sub-global aggregation, is a predetermined variable, indicating the threshold of the number of local iterations of the target model on each client. T is the total number of updates for each client (that is, the total number of iterations, which is the product of the local iteration threshold and the global aggregation number), , β represents the smoothing constant, ρ represents the Lipschitz constant, ξ Indicates the upper limit of the first difference information, and the other variables are as follows:
[0068] (5)
[0069] (6)
[0070] in, represents the predetermined model parameters, Represents the global model parameters after training.
[0071] This paper proposes a federated learning method. Figure 2 The process of the federated learning method of the embodiment of the present disclosure is shown as follows Figure 2 . Reference Figure 2 , the federated learning method is applied to the server and includes the following steps:
[0072] In step S201, updated local model parameters of the target model are received from at least one client, wherein the updated local model parameters corresponding to each client are model parameters after the target model is updated based on a local loss function that introduces proximal terms and a gradient descent method, the proximal terms include first difference information between the local model parameters of the corresponding client and the global model parameters of the target model, and the coefficients of the proximal terms in the local loss function of each client are updated using a Lagrange multiplier update method.
[0073] As an example, the first difference information mentioned above refers to the difference between the global model parameters and the local model parameters. In order to make better use of the difference information, this embodiment introduces a proximal term containing the difference information in the local loss function, which plays the role of a regularizer, encouraging the local model parameters to maintain a certain degree of proximity with the global model parameters during the update process, such as maintaining a predetermined ratio of consistent parameters between the local model parameters and the global model parameters, so that the target model can optimize its own performance in the client while also taking into account the consistency with the global model parameters.
[0074] As an example, the upper limit of the first difference information will not exceed a predefined parameter deviation tolerance. ξ , for example, i Client No. Local model parameters before sub-global aggregation With Global model parameters after sub-global aggregation There is an upper limit to the parameter difference between and The distance between the two will never exceed a predefined parameter deviation tolerance ξ .
[0075] As an example, the coefficient in the above proximal term (or regularization strength) is a key parameter that needs to be adjusted according to the specific situation to find the best balance point. If the coefficient of the proximal term is set too small, the effect of the proximal term may be negligible and cannot effectively constrain the deviation of the local model parameters from the global model parameters; if the coefficient of the proximal term is set too large, it may overly restrict the flexibility of the local model parameters, resulting in the target model being unable to fully adapt to the local data characteristics of the client. In addition, since the distribution of data between each client is significantly different, it is necessary to set different control parameters for the proximal term, that is, the proximal term coefficient, so that the importance of the proximal term can be more accurately controlled during the entire update process.
[0076] In this embodiment, the local loss function after the introduction of the proximal term can be regarded as a Lagrangian function. At this time, different Lagrangian multipliers, that is, the proximal term coefficients, can be defined for different clients. In order to effectively manage the data heterogeneity between different clients, it is extremely important to conduct an in-depth analysis of the relationship between the local loss function and the global loss function, that is, the heterogeneity between the target models on different clients can be captured, and the relationship between the local loss and the global loss of each client can be compared to model the relationship. Therefore, when the difference between the sum of the local loss functions of all clients and the global loss function is less than a preset threshold, the Lagrangian multiplier update method can be used to update the coefficient of the proximal term in the local loss function of each client.
[0077] It should be noted that given the global model parameters After that, the sum of the local loss functions of all clients must be less than or equal to the scaling factor multiplied by the global loss function. When the scaling factor is close to 1, it indicates that the gradient corresponding to the local model parameters of each client is closely aligned with the gradient corresponding to the global model parameters, and the target model converges at this time. Therefore, this embodiment is limited to using the Lagrange multiplier update method to update the coefficient of the proximal term in the local loss function of each client when the sum of the local loss functions of all clients approaches the global loss function (that is, the difference between the two is less than a preset threshold).
[0078] As an example, after the local loss function is determined, the target model on each client may be updated using a gradient descent method, which is not limited in the present disclosure.
[0079] As an example, the local loss function introducing the proximal term may be as shown in formula (1), which is not limited in the present disclosure.
[0080] In step S202, the updated local model parameters corresponding to each client are globally aggregated to obtain the global model parameters of the target model.
[0081] According to an embodiment of the present disclosure, after aggregating the updated local model parameters corresponding to each client to obtain the global model parameters of the target model, second difference information between the global model parameters and the predetermined model parameters can also be determined, wherein the predetermined model parameters are the model parameters after the target model is updated based on the centralized learning method; based on the second difference information and predetermined variables, a global loss function is determined, wherein the predetermined variables indicate a local iteration number threshold of the target model; the global loss function is minimized to obtain a local iteration number threshold for the next update operation of each client; in response to the target model not satisfying the second preset termination condition, the local iteration number threshold for the next update operation is sent to each client respectively.
[0082] Through this embodiment, the value of the predetermined variable after minimizing the global loss function is used as the local iteration number threshold, and the global loss function also covers the difference information between the global model parameters and the predetermined model parameters, that is, the determination of the local iteration number threshold also takes this difference information into consideration, so that a relatively moderate local iteration number threshold can be determined.
[0083] As an example, in order to effectively reduce resource consumption, the number of local updates and global aggregations can be optimized to minimize the global loss function of the server under resource constraints. The global loss function can be shown as formula (2).
[0084] The global loss function reflects the real-time fluctuations in local model parameter updates and resource consumption, which greatly increases the difficulty of the original optimization problem. Therefore, the federated learning technology based on difference measurement can use the difference information between the predetermined model parameters (the predetermined model parameters are the model parameters after the target model is updated based on the centralized learning method) and the global model parameters to construct a substitute function (i.e., the global loss function) for the original optimization problem to optimize the number of local updates (i.e., the number of local iterations) and the number of global aggregations. In fact, it is quite difficult to make an extremely accurate analysis of the specific expression of the local iteration number threshold and the global aggregation number threshold in the substitute function. The main reason is that the substitute function depends greatly on the convergence characteristics of the gradient and the dynamic changes in resource consumption. In the process of theoretical analysis, the convergence process of the model parameters is first analyzed in depth, and an approximate treatment of the solution of the global loss function is attempted through the upper bound of convergence. Taking the difference information between the predetermined model parameters and the global model parameters as the important foundation and basis, an adaptive control algorithm is proposed. The core purpose of proposing this algorithm is to effectively optimize the local iteration number threshold and the global aggregation number threshold, and finally obtain the asymptotic optimal solution, that is, to obtain the most suitable local iteration number threshold and the global aggregation number threshold.
[0085] The convergence analysis process is as follows: determine the upper bound of the difference between the global model parameters of the target model and the optimal parameters (i.e., the predetermined model parameters) in the global loss function, and then obtain the expression of the substitute function based on the upper bound of the difference. Specifically, it can be divided into two main steps: S1, in the At the iteration, obtain the parameter difference between the global model parameters of the target model and the predetermined model parameters; S2, use the parameter difference in S1 and the upper bound of the difference to determine the expression of the substitute function. Since the centralized learning framework is considered in the process of convergence analysis, the present disclosure can update the model more effectively. Then, the minimization of the global loss function can be achieved by minimizing the substitute function approximation, and then, according to the minimization of the global loss function, the approximate optimal local iteration number threshold can be obtained, thereby solving the optimal global aggregation number threshold and the total number of iterations. T .
[0086] According to an embodiment of the present disclosure, determining a global loss function based on the second difference information may include: determining an upper limit of the first difference information and resource information consumed by the target model; determining a global loss function based on at least the following information: the second difference information, an upper limit of the first difference information, a coefficient of the proximal term, and an updated predetermined constant and resource information number corresponding to the target model. Through this embodiment, the global loss function determined by the above information contains rich information, so that better model parameters can be updated based on the global loss function.
[0087] The upper limit of the first difference information can be set as needed. The resource information consumed by the target model can be determined by formula (3), which is not limited in the present disclosure.
[0088] As an example, the above substitution function (also known as the global loss function) ) can be expressed as in formula (4), which is not limited in the present disclosure.
[0089] According to an embodiment of the present disclosure, the predetermined constant can be updated in the following manner: obtaining the predetermined constant of the target model on each client; taking the average value of the predetermined constant of each client as the updated predetermined constant. Through this embodiment, the predetermined constant can also be updated in real time according to iteration, so that the old predetermined constant is adopted to affect the learning effect.
[0090] As an example, the average value of the predetermined constant of each client is taken, or the weighted average of the predetermined constant of each client can be performed, which is not limited in the present disclosure.
[0091] In step S203, in response to the target model satisfying the second preset termination condition, the global model parameters are sent to each client, and each client is notified to stop the update operation.
[0092] As an example, after each client receives the notification of stopping the update operation, the global model parameters are used to update the parameters of the local objective function, and then the subsequent practical application is performed.
[0093] In step S204, in response to the target model not satisfying the second preset termination condition, the global model parameters are sent to each client, and each client is notified to continue the update operation based on the global model parameters.
[0094] As an example, after each client receives the notification of continuing the update operation based on the global model parameters, the global model parameters are used as the basic parameters of the target model and the next update operation is performed, that is, the above-mentioned Figure 1 The operation shown.
[0095] According to an embodiment of the present disclosure, before sending the global model parameters to each client, in response to the global loss corresponding to the current global aggregation being less than the global loss corresponding to the previous global aggregation, the global model parameters after the current aggregation can be sent to each client; in response to the global loss corresponding to the current global aggregation being not less than the global loss corresponding to the previous global aggregation, the global model parameters after the previous global aggregation can be sent to each client; wherein the global loss is determined based on the local loss function of each client. Through this embodiment, the optimal global model parameters can be retained and sent to each client.
[0096] In order to facilitate the understanding of the above embodiments, Figure 3 and Figure 4 Provide a systematic explanation.
[0097] Figure 3 The federated learning framework is presented, such as Figure 3 As shown, taking the server as the central controller and the client as the learner as an example, this embodiment embeds the proximal term and the proximal term coefficient in the local loss function, and also introduces a substitute function, and also introduces the proximal term coefficient related information in the substitute function.
[0098] Figure 4 The overall process of the federated learning method disclosed in the present invention is shown, and the overall process mainly includes the following stages:
[0099] (1) Initialization phase
[0100] In the initialization phase of federated learning based on difference measurement, the core task is to set all necessary initial conditions and parameters. First, initialize the global model parameters of the target model on the central controller and the local model parameters of the target model on the local learner, initialize the local iteration number threshold, the global aggregation number threshold, the resource types and their consumption required for local update and global aggregation.
[0101] (2) Local update phase
[0102] In between global aggregations, each learner independently updates the target model locally. These updates are based on the latest global model parameters and are implemented by minimizing a local loss function that includes a proximal term. The proximal term is designed to capture the impact of the parameter difference between the local model parameters and the global model parameters, and to control the contribution of this difference to the local loss function by adjusting the proximal term coefficient. During the local update process, the learner calculates the local gradient and updates the local model parameters according to the gradient descent method or other optimization algorithms. At the same time, the learner also updates the proximal term coefficient, Lipschitz constant, and smoothing constant, which help to more accurately evaluate and optimize the performance of the local target model. After completing the local update, that is, reaching the local iteration threshold, the learner will send the updated local model parameters and related information (such as gradients, loss values, etc.) to the central controller for subsequent global aggregation.
[0103] It should be noted that the update of constants such as the Lipschitz constant and the smoothing constant is performed in the central controller, and each learner only needs to receive the updated constant.
[0104] (3) Global aggregation stage
[0105] After receiving the updated local model parameters of all learners, the central controller will use these local model parameters to obtain the global model parameters. This step is usually achieved by weighted averaging the local model parameters of all learners. The weights corresponding to the weighted average can be adjusted according to the amount of data, data quality or other relevant factors of each learner, which is not limited by the present disclosure. Global aggregation aims to integrate the knowledge of different learners to improve the performance of the target model. At the same time, the central controller will calculate the loss corresponding to the updated global model parameters and compare it with the loss after the last global aggregation. If the new loss is less than the old loss, it means that this global aggregation has brought improvements. The central controller will update the global model parameters obtained by this global aggregation to the current results. If the new loss is not less than the old loss, the central controller can continue to use the global model parameters obtained by the last global aggregation.
[0106] (4) Parameter estimation stage
[0107] After each global aggregation, the central controller estimates some key parameters based on the contributions of all learners. These parameters include but are not limited to the Lipschitz constant and the smoothing constant, which are crucial for evaluating the stability and optimization performance of the target model. These estimates are obtained by calculating the weighted average of the corresponding parameters of all learners or simply taking the average. The weight corresponding to the weighted average is usually adjusted based on the amount of data, data quality or other relevant factors of each learner. In addition, the central controller can also estimate other parameters related to the loss function and target model performance, such as gradient variance, learning rate decay factor, etc., which are not limited in this disclosure.
[0108] (5) Calculation of local iteration threshold and global aggregation threshold
[0109] In order to optimize the performance and resource consumption of the present invention, the optimal local iteration number threshold and global aggregation number threshold are calculated based on the current second difference information (difference information between the predetermined model parameters and the global model parameters) and resource conditions. This step usually involves constructing a substitute function (i.e., a global loss function) to approximate the original optimization problem, and the substitute function can reflect the performance and resource consumption of the method of the present invention under different combinations of local iteration number thresholds and global aggregation number thresholds. In order to simplify the calculation process, the present invention may simplify the optimization variables from the local iteration number threshold and the global aggregation number threshold to only optimize the local iteration number threshold (or only the global aggregation number threshold), and assume that there is a certain fixed relationship between the global aggregation number threshold and the local iteration number threshold or that the global aggregation number threshold can be determined according to other conditions. Then, the present invention uses the minimization substitute function to find the optimal local iteration number value threshold (or global aggregation number threshold), and calculates the global aggregation number threshold and the total number of iterations accordingly.
[0110] It should be noted that the above fixed relationship can be as follows: Assume that each learner updates τ times, where each learner can calculate the global aggregation number based on the total number of iterations K ,Right now K Multiply τ Equal to the total number of iterations.
[0111] (6) Termination condition stage
[0112] The present disclosure will continuously iterate and execute the above-mentioned stages until a certain termination condition (i.e., the second preset termination condition of the above-mentioned embodiment) is met. The termination condition may include but is not limited to the sum of the local iteration times reaching the preset maximum iteration times, the resource consumption exceeding the limit, or the difference between the global loss function and the centralized loss function tends to zero, etc. It should be noted that the setting of the termination condition depends on the specific needs and application scenarios, which are not further limited by the present disclosure. Once the above-mentioned termination condition is met, the present disclosure will stop executing and output the final global model parameters for further use or deployment. The global model parameters represent the optimal solution or approximate optimal solution of the present disclosure under a given data set and constraints.
[0113] It should be noted that this embodiment has a very significant low computational complexity feature. Specifically, for each actual situation of global aggregation, the central controller will n To collect relevant model parameters from the participating learners, it is assumed that the collection and global aggregation process requires M For resources of this type, the number of updates (i.e., the number of iterations) required for local updates obtained through linear search will not exceed the preset value. , the global aggregation times are K , then the computational complexity in the global aggregation stage is ; and for the local update phase, these will execute T In addition, the learner will perform M The actual effect of local computation is further enhanced by processing various resource types. The computational complexity of local updates across all learners is Therefore, the overall computational complexity of the entire algorithm is calculated as , which shows that the computational complexity is reduced.
[0114] In summary, there are two key challenges in federated learning technology: 1) the data on distributed clients is heterogeneous; 2) the communication resources within the network are limited. The federated learning framework based on difference measurement proposed in this disclosure can be regarded as an adaptive enhanced version of the federated proximal algorithm. This adaptability is mainly reflected in two aspects: 1) how to adaptively adjust the proximity between the target model on different clients and the global model on the server; 2) how to adaptively aggregate the local model parameters on different clients.
[0115] like Figure 3As shown, the content covered by this framework includes two extremely critical and important steps: 1) embedding the proximal term and the proximal term coefficient in the local loss function, that is, comprehensively and deeply utilizing the parameter difference between the local model parameters and the global model parameters, and then introducing a proximal term with a specific meaning in the local loss function. This method can rely on the coefficient of the proximal term to carry out adaptive control; and in order to update the coefficient of the proximal term, the present disclosure introduces the concept of Lagrange multiplier, which is used to control the coefficient of the proximal term of different clients, and solve the problem of data heterogeneity through "parameter difference". 2) From the perspective of the substitute function, the framework uses the difference information between the predetermined model parameters (the predetermined model parameters are the model parameters after updating the target model based on the centralized learning method) and the global model parameters to construct a substitute that can optimize the global loss function, that is, using the "second difference information" to adaptively adjust the aggregation frequency of the central controller, thereby reducing communication overhead. The method disclosed in this disclosure can not only effectively improve the security of target model training, but also overcome the problem of data heterogeneity and reduce communication overhead.
[0116] Figure 5 is a block diagram showing a federated learning apparatus of the present disclosure Figure 1 ,The federated learning device is applied to the target client, such as Figure 5 As shown, the device includes a circulation unit 50 and a first sending unit 52 .
[0117] The loop unit 50 is configured to cyclically perform the following update operations: based on the local loss function that introduces the proximal term and the gradient descent method, the local model parameters of the target model at the target client are updated, wherein the first difference information between the local model parameters and the global model parameters of the target model; in response to the difference between the sum of the local loss functions of all clients and the global loss function being less than a preset threshold, the coefficient of the proximal term in the local loss function of the target client is updated using the Lagrange multiplier update method; the first sending unit 52 is configured to send the updated local model parameters to the server in response to the target model satisfying the first preset termination condition.
[0118] According to an embodiment of the present disclosure, it is determined that the target model satisfies the first preset termination condition in the following manner: the number of local iterations of the target model reaches a local iteration number threshold, wherein the local iteration number threshold is obtained by minimizing a global loss function, and the global loss function is determined based on second difference information between global model parameters and predetermined model parameters, and predetermined variables, the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method, and the predetermined variables indicate the local iteration number threshold of the target model.
[0119] According to an embodiment of the present disclosure, the global loss function is determined based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, and the updated predetermined constant corresponding to the target model.
[0120] Figure 6 is a block diagram showing a federated learning apparatus of the present disclosure Figure 2 , the federated learning device is applied to the server, such as Figure 6 As shown, the device includes a receiving unit 60 , an aggregation unit 62 and a second sending unit 64 .
[0121] The receiving unit 60 is configured to receive updated local model parameters of the target model from at least one client, wherein the updated local model parameters corresponding to each client are model parameters after the target function is updated based on a local loss function introducing proximal terms and a gradient descent method, the proximal terms contain first difference information between the local model parameters of the corresponding client and the global model parameters of the target function, and the coefficients of the proximal terms in the local loss function of each client are updated using a Lagrange multiplier update method; the aggregation unit 62 is configured to globally aggregate the updated local model parameters corresponding to each client to obtain the global model parameters of the target model; the second sending unit 64 is configured to send the global model parameters to each client in response to the target model satisfying a second preset termination condition, and notify each client to stop the update operation; in response to the target model not satisfying the second preset termination condition, send the global model parameters to each client, and notify each client to continue the update operation based on the global model parameters.
[0122] According to an embodiment of the present disclosure, the aggregation unit 62 is further configured to, after aggregating the updated local model parameters corresponding to each client to obtain the global model parameters of the target model, determine the second difference information between the global model parameters and the predetermined model parameters, wherein the predetermined model parameters are the model parameters after the target model is updated based on the centralized learning method; determine the global loss function based on the second difference information and the predetermined variables, wherein the predetermined variables indicate the local iteration number threshold of the target model; minimize the global loss function to obtain the local iteration number threshold of the next update operation of each client; in response to the target model not satisfying the second preset termination condition, send the local iteration number threshold of the next update operation to each client respectively.
[0123] According to an embodiment of the present disclosure, the aggregation unit 62 is also configured to determine an upper limit of the first difference information; and determine a global loss function based at least on the following information: the second difference information, the upper limit, the coefficient of the proximal term, and the updated predetermined constant corresponding to the target model.
[0124] According to an embodiment of the present disclosure, the predetermined constant is updated in the following manner: obtaining the predetermined constant of the target model at each client; taking the average value of the predetermined constant of each client as the updated predetermined constant.
[0125] According to an embodiment of the present disclosure, the second sending unit 64 is configured to, before sending the global model parameters to each client, in response to the global loss corresponding to the current global aggregation being less than the global loss corresponding to the previous global aggregation, send the global model parameters after the current aggregation to each client; in response to the global loss corresponding to the current global aggregation being not less than the global loss corresponding to the previous global aggregation, send the global model parameters after the previous global aggregation to each client; wherein the global loss is determined based on the local loss function of each client.
[0126] According to an embodiment of the present disclosure, a computer-readable storage medium storing instructions is provided, wherein when the instructions are executed by at least one computing device, the at least one computing device is prompted to execute the federated learning method as any of the above embodiments.
[0127] According to an embodiment of the present disclosure, a system is provided that includes at least one computing device and at least one storage device storing instructions, wherein the instructions, when executed by the at least one computing device, prompt the at least one computing device to execute a federated learning method as described in any of the above embodiments.
[0128] According to an embodiment of the present disclosure, a computer program product is provided, including computer instructions, which, when executed by a processor, implement the federated learning method as described in any of the above embodiments.
[0129] Although some embodiments of the present disclosure have been shown and described, it will be appreciated by those skilled in the art that modifications may be made to the embodiments without departing from the principles and spirit of the present disclosure, the scope of which is defined by the claims and their equivalents.
Claims
1. A federated learning method, characterized in that: The federated learning method is applied to a target client, and the method includes: The following update operations are performed in a loop: Based on a local loss function that introduces a proximal term and a gradient descent method, updating local model parameters of the target model on the target client, wherein the proximal term includes first difference information between the local model parameters of the target model and the global model parameters; In response to the difference between the sum of the local loss functions of all clients and the global loss function being less than a preset threshold, updating the coefficient of the proximal term in the local loss function of the target client using a Lagrange multiplier update method; In response to the target model satisfying a first preset termination condition, sending updated local model parameters to a server; Wherein, the target model is used for image recognition, speech recognition or text recognition; Among them, it is determined in the following way that the target model satisfies the first preset termination condition: the local iteration number of the target model reaches a local iteration number threshold, wherein the local iteration number threshold is obtained by minimizing a global loss function, and the global loss function is determined based on second difference information between global model parameters and predetermined model parameters and predetermined variables, the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method, and the predetermined variables indicate the local iteration number threshold of the target model.
2. The federated learning method according to claim 1, characterized in that: The global loss function is determined as follows: Determining an upper limit of the first difference information and resource information consumed by the target model; The global loss function is determined based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, the updated predetermined constant corresponding to the target model, and the resource information.
3. A federated learning method, characterized in that: The federated learning method is applied to a server and includes: Receive updated local model parameters of the target model from at least one client, wherein the updated local model parameters corresponding to each client are model parameters after the target model is updated based on a local loss function introducing a proximal term and a gradient descent method, the proximal term includes first difference information between the local model parameters of the corresponding client and the global model parameters of the target model, and the coefficient of the proximal term in the local loss function of each client is updated using a Lagrange multiplier update method; Performing global aggregation on the updated local model parameters corresponding to each of the clients to obtain global model parameters of the target model; In response to the target model satisfying a second preset termination condition, sending the global model parameters to each of the clients, and notifying each of the clients to stop the update operation; In response to the target model not satisfying the second preset termination condition, sending the global model parameters to each of the clients, and notifying each of the clients to continue the update operation based on the global model parameters; Wherein, the target model is used for image recognition, speech recognition or text recognition; After aggregating the updated local model parameters corresponding to each of the clients to obtain the global model parameters of the target model, the method further includes: Determining second difference information between the global model parameters and predetermined model parameters, wherein the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method; Determine a global loss function based on the second difference information and a predetermined variable, wherein the predetermined variable indicates a local iteration number threshold of the target model; Minimize the global loss function to obtain a local iteration number threshold for the next update operation of each client; In response to the target model not satisfying the second preset termination condition, a local iteration number threshold for the next update operation is sent to each of the clients respectively.
4. The federated learning method according to claim 3, characterized in that: The determining of a global loss function based on the second difference information includes: Determining an upper limit of the first difference information and resource information consumed by the target model; The global loss function is determined based on at least the following information: the second difference information, the upper limit of the first difference information, the coefficient of the proximal term, the updated predetermined constant corresponding to the target model, and the resource information.
5. The federated learning method according to claim 4, characterized in that: The predetermined constant is updated in the following manner: Obtaining a predetermined constant of the target model on each of the clients; An average value of the predetermined constants of each of the clients is taken as the updated predetermined constant.
6. The federated learning method according to claim 3, characterized in that: Before sending the global model parameters to each of the clients, the method further includes: In response to the global loss corresponding to the current global aggregation being less than the global loss corresponding to the previous global aggregation, sending the global model parameters after the current aggregation to each of the clients; In response to the global loss corresponding to the current global aggregation being not less than the global loss corresponding to the previous global aggregation, sending the global model parameters after the previous global aggregation to each of the clients; The global loss is determined based on the local loss function of each client.
7. A federated learning device, characterized in that: Applied to target clients, including: The loop unit is configured to cyclically perform the following update operations: based on the local loss function introducing the proximal term and the gradient descent method, update the local model parameters of the target model at the target client, wherein the first difference information between the local model parameters and the global model parameters of the target model; in response to the difference between the sum of the local loss functions of all clients and the global loss function being less than a preset threshold, adopt the Lagrange multiplier update method to update the coefficient of the proximal term in the local loss function of the target client; A first sending unit, configured to send updated local model parameters to a server in response to the target model satisfying a first preset termination condition; Wherein, the target model is used for image recognition, speech recognition or text recognition; Among them, it is determined in the following way that the target model satisfies the first preset termination condition: the local iteration number of the target model reaches a local iteration number threshold, wherein the local iteration number threshold is obtained by minimizing a global loss function, and the global loss function is determined based on second difference information between global model parameters and predetermined model parameters and predetermined variables, the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method, and the predetermined variables indicate the local iteration number threshold of the target model.
8. A federated learning device, characterized in that: Applicable to servers, including: A receiving unit is configured to receive updated local model parameters of a target model from at least one client, wherein the updated local model parameters corresponding to each client are model parameters after the target model is updated based on a local loss function introducing a proximal term and a gradient descent method, the proximal term includes first difference information between the local model parameters of the corresponding client and the global model parameters of the target model, and the coefficient of the proximal term in the local loss function of each client is updated using a Lagrange multiplier update method; an aggregation unit configured to globally aggregate the updated local model parameters corresponding to each of the clients to obtain global model parameters of the target model; a second sending unit, configured to send the global model parameters to each of the clients in response to the target model satisfying a second preset termination condition, and to notify each of the clients to stop the update operation; and to send the global model parameters to each of the clients in response to the target model not satisfying the second preset termination condition, and to notify each of the clients to continue the update operation based on the global model parameters; Wherein, the target model is used for image recognition, speech recognition or text recognition; The aggregation unit is further configured to, after aggregating the updated local model parameters corresponding to each of the clients to obtain the global model parameters of the target model, determine second difference information between the global model parameters and predetermined model parameters, wherein the predetermined model parameters are model parameters after the target model is updated based on a centralized learning method; determine a global loss function based on the second difference information and predetermined variables, wherein the predetermined variables indicate a local iteration number threshold of the target model; minimize the global loss function to obtain a local iteration number threshold for the next update operation of each of the clients; and in response to the target model not satisfying the second preset termination condition, send the local iteration number threshold for the next update operation to each of the clients respectively.
9. A computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the federated learning method according to any one of claims 1 to 6.
10. A system comprising at least one computing device and at least one storage device storing instructions, characterized in that: When the instructions are executed by the at least one computing device, the at least one computing device is prompted to perform the federated learning method according to any one of claims 1 to 6.
11. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the federated learning method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Federal learning method based on block chain and related device
CN116523034A