Model gradient confirmation method, device, equipment and medium based on federated learning

By obtaining the data volume information and local gradients of participating nodes, and calculating the global gradient and participation degree, the problem of model consistency in federated learning is solved, and a method of providing personalized model gradients for different participating nodes is realized.

CN114819183BActive Publication Date: 2024-09-17ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210399999.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-15
Publication Date
2024-09-17
Estimated Expiration
2042-04-15

AI Technical Summary

Technical Problem

In federated learning, each participant gets the same model, and it is impossible to provide different models for participants based on their own circumstances.

Method used

By obtaining the data volume information of participating nodes and node local gradients, the global gradient and participation degree are determined, and then the actual model gradient is calculated, thereby allocating different models to different participating nodes.

Benefits of technology

It realizes providing different model gradients for different participating nodes in the federated learning process, so that each participating node can obtain a model that matches its own situation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114819183B
    Figure CN114819183B
Patent Text Reader

Abstract

The embodiments of this specification disclose a method, device, equipment and medium for determining a model gradient based on federated learning. The scheme includes: obtaining data volume information of participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; obtaining the node local gradient obtained by the participating nodes when training the basic training model based on local data; determining the global gradient of the federated learning model in which the participating nodes participate based on the data volume information and the node local gradient; determining the participation degree of the participating nodes based on the node local gradient of the participating nodes and the global gradient; determining the actual model gradient of the participating nodes based on the participation degree.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and medium for determining a model gradient based on federated learning. Background Art

[0002] As society becomes more aware of the necessity of data privacy, emerging laws such as the General Data Protection Regulation (GDPR) have imposed strict restrictions on data circulation, leading to an increasingly severe data silo problem. Federated learning, as an emerging distributed machine learning method with privacy protection, provides a new approach to solving the data silo problem. However, in current federated learning training, the training model obtained through the participation of multiple data owners is unified, so that each participant obtains the same model, and it is not possible to provide different models for participants based on their own circumstances.

[0003] Therefore, how to provide different models for different participants in federated learning is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of this specification provide a method, apparatus, device and medium for determining a model gradient based on federated learning to solve the problem that the models obtained by each participant in the existing federated learning are completely consistent.

[0005] To solve the above technical problems, the embodiments of this specification are implemented as follows:

[0006] The model gradient determination method based on federated learning provided in the embodiments of this specification includes:

[0007] Acquire data volume information of participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating nodes;

[0008] Obtaining node local gradients obtained by the participating nodes training the basic training model based on local data;

[0009] Determine the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient;

[0010] Determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model;

[0011] Based on the participation degree, an actual model gradient of the participating node is determined.

[0012] The embodiment of this specification provides a model gradient determination device based on federated learning, including:

[0013] A volume information acquisition module is used to acquire data volume information of participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating nodes;

[0014] A local gradient acquisition module, used to acquire node local gradients obtained by the participating nodes training the basic training model based on local data;

[0015] A global gradient determination module, used to determine the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient;

[0016] A participation degree determination module, used to determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model;

[0017] The actual gradient determination module is used to determine the actual model gradient of the participating node based on the participation degree.

[0018] A model gradient determination device based on federated learning provided in an embodiment of this specification includes:

[0019] at least one processor; and,

[0020] a memory communicatively connected to the at least one processor; wherein,

[0021] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0022] Acquire data volume information of participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating nodes;

[0023] Obtaining node local gradients obtained by the participating nodes training the basic training model based on local data;

[0024] Determine the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient;

[0025] Determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model;

[0026] Based on the participation degree, an actual model gradient of the participating node is determined.

[0027] An embodiment of this specification provides a computer-readable medium having computer-readable instructions stored thereon, and the computer-readable instructions can be executed by a processor to implement a model gradient determination method based on federated learning.

[0028] An embodiment of this specification can achieve the following beneficial effects:

[0029] In the embodiments of this specification, when performing federated learning, the data volume information used by the participating nodes when training the basic training model based on local data, as well as the node local gradients provided by the participating nodes, can be obtained to determine the global gradient of the federated learning model, and the participation degree of the participating nodes can be determined based on the node local gradients and the global gradient, and then the actual model gradient that the participating nodes can obtain can be determined based on the participation degree. Therefore, in the process of federated learning, different model gradients can be assigned to different participating nodes, so that different participating nodes can obtain different federated learning models. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0031] Figure 1 A schematic diagram of an application scenario of a model gradient determination method based on federated learning provided in an embodiment of this specification;

[0032] Figure 2 A flowchart of a method for determining a model gradient based on federated learning provided in an embodiment of this specification;

[0033] Figure 3 A swim lane diagram of a method for determining a model gradient based on federated learning provided in an embodiment of this specification;

[0034] Figure 4 A schematic diagram of the structure of a model gradient determination device based on federated learning provided in an embodiment of this specification;

[0035] Figure 5A schematic diagram of the structure of a model gradient determination device based on federated learning provided in an embodiment of this specification. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this description, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.

[0037] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0038] In the prior art, federated learning usually involves each participant obtaining a model from a server separately; each participant then trains the model using local data, and uploads the obtained model gradient data to the server. The server aggregates the various gradient data to obtain updated model parameters or gradients, and then sends the updated model parameters or gradients to each participant, so that each participant can obtain a unified model obtained through federated learning.

[0039] In order to solve the defects in the prior art, this solution provides the following embodiments:

[0040] Figure 1 The following is a schematic diagram of an application scenario of a method for determining a model gradient based on federated learning provided in an embodiment of this specification. Figure 1 As shown, the scheme may include: a participating node 1 and a server 2 participating in federated learning. Among them, the participating node 1 participating in federated learning may include multiple participating nodes, and the server 2 may obtain the model gradients provided by multiple participating nodes, and then aggregate them to obtain a federated learning model. In the embodiment of this specification, the participating node 2 can train the basic training model according to its own local data, and feed back the model parameters or node local gradients of the trained model to the server, and the server 2 can also obtain the data volume information of the training data collected when the participating node performs model training, and obtain the global gradient of the federated learning model based on the data volume information of the participating node and the model parameters or node local gradients provided by the participating node. In the embodiment of this specification, the server 2 can also determine the participation of the participating node in federated learning based on the node local gradient of the participating node 1 and the global gradient, and then determine the actual model gradient that matches the participating node according to the participation.

[0041] Next, a model gradient determination method based on federated learning provided in the embodiment of the specification will be specifically described with reference to the accompanying drawings:

[0042] Figure 2 A flowchart of a method for determining a model gradient based on federated learning is provided in an embodiment of this specification. From a program perspective, the execution subject of the process can be a program or application client installed on an application server.

[0043] like Figure 2 As shown, the process may include the following steps:

[0044] Step 202: Obtain data volume information of participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating nodes.

[0045] Step 204: Obtain node local gradients obtained by the participating nodes through training the basic training model based on local data.

[0046] In the embodiments of this specification, a participating node may be any of the multiple participating nodes participating in federated learning. A participating node may represent various institutions participating in federated learning, which may include institutions that provide services such as resource processing, payment, leasing, online and offline transactions, etc. User data may include user data retained by the user in the target institution, for example, business data and transaction records of the user handling business in the target institution, registration information provided by the user to the target institution, and browsing records of the user in the target institution, etc.

[0047] Participating nodes can train the basic training model based on the data they obtain, obtain the node local gradient, and send the node local gradient and the data volume information involved in the training to the server. The data volume information may include the amount of training data used in model training. There is no need to send the training data to the server, which can ensure that the data of the participating nodes does not go out of the domain, and improve the security of the data.

[0048] The basic training model can represent the latest training model existing in the participating nodes. In practical applications, the basic training model can be a model to be trained provided by the server to the participating nodes. Among them, federated learning can be a learning method that adopts multiple rounds of iterations. For the first round of training, the server can send the basic training model to each participating node; after the participating node trains the model using local data, it can temporarily store the trained model or model parameters. In subsequent rounds of training, the model obtained in the previous round can be updated and trained. At this time, the basic training model can represent the model obtained in the previous round of training.

[0049] Step 206: Determine the global gradient of the federated learning model in which the participating nodes participate based on the data volume information and the local gradient of the node.

[0050] In practical applications, in federated learning, the global gradient is usually obtained by aggregating the local gradients of the nodes provided by the participating nodes. In the embodiments of this specification, the global gradient of the federated learning model can be obtained by combining the data volume information of the participating nodes, which can improve the accuracy of the global gradient.

[0051] Step 208: Determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model.

[0052] In practical applications, due to the influence of the computing power of the participating nodes or the quality or quantity of the training data, the participation of different participating nodes in the federated learning process may be different. For example, the local gradient of the node provided by the participating node that uses the training data with better quality and larger data volume for model training has a greater impact on the global gradient, and the participation of this participating node can be higher.

[0053] Step 210: Based on the participation degree, determine the actual model gradient of the participating node.

[0054] The server can send the determined actual model gradient of the participating node to the corresponding participating node so that the participating node can obtain the federated learning model that matches the participating node. In practical applications, the server can also determine the federated learning model or model parameters that match the participating node based on the determined actual model gradient of the participating node, and can also send the federated learning model or model parameters to the participating node. The federated learning model can include a model for evaluation, such as a risk assessment model, a reputation assessment model, a profit and loss assessment model, and the like.

[0055] In the embodiments of this specification, when performing federated learning, the data volume information used by the participating nodes when training the basic training model based on local data, as well as the node local gradients provided by the participating nodes, can be obtained to determine the global gradient of the federated learning model, and the participation degree of the participating nodes can be determined based on the node local gradients and the global gradient, and then the actual model gradient that the participating nodes can obtain can be determined based on the participation degree. Therefore, in the process of federated learning, different model gradients can be assigned to different participating nodes, so that different participating nodes can obtain different federated learning models.

[0056] It should be understood that the order of some steps in the methods described in one or more embodiments of this specification can be interchanged according to actual needs, or some steps can be omitted or deleted.

[0057] based on Figure 2 The method, the examples of this specification also provide some specific implementation plans of the method, which are described below.

[0058] In order to improve the accuracy of the global gradient in federated learning, the data quality of the participating nodes can also be integrated into the determination of the global gradient in the embodiment of this specification. Optionally, after obtaining the node local gradient obtained by the participating node training the basic training model based on local data in the embodiment of this specification, it can also include:

[0059] Obtaining the marginal loss of the participating node; the marginal loss is used to indicate the degree of influence of the node local gradient of the participating node on the performance of the federated learning model;

[0060] Determining the node quality of the participating nodes based on the marginal loss;

[0061] Determining the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient may specifically include:

[0062] The global gradient of the federated learning model in which the participating nodes participate is determined based on the data volume information, the node local gradient and the node quality.

[0063] Among them, the marginal loss can represent the loss of the federated learning model that increases accordingly with the increase in participating nodes in federated learning, and can represent the degree of influence of the node local gradient of the participating node on the performance of the federated learning model.

[0064] In the embodiment of this specification, the participating nodes participating in the federated learning model may include multiple participating nodes; wherein, obtaining the marginal loss of the participating nodes may specifically include:

[0065] Determining a first reference global model according to a node local gradient of each participating node among the plurality of participating nodes;

[0066] Determining a second reference global model according to node local gradients of each other participating node among the plurality of participating nodes other than the participating node;

[0067] Determining a first model loss of the first reference global model based on a preset validation set;

[0068] Determining a second model loss of the second reference global model based on the preset validation set;

[0069] Based on the first model loss and the second model loss, a marginal loss of the participating node is determined.

[0070] As an implementation method, assume that in each round t of federated learning, to represent the first global model obtained by aggregating the node local gradients provided by all participating nodes, To represent the second global model obtained by aggregating the node local gradients of all participating nodes except participating node i. (t) and Respectively represent the model and The loss on the validation set, then the marginal loss Can be

[0071] in, represents the federated learning model at the t-1th round of federated learning; N represents the total number of participating nodes participating in federated learning; W represents the set of all participating nodes participating in federated learning, and j represents any participating node participating in federated learning; represents the sum of the node local gradients of all participating nodes in federated learning; w' represents the set of all participating nodes in federated learning except participating node i; represents the sum of the node local gradients of other participating nodes except participating node i.

[0072] In practical applications, a preset validation set can be used to calculate the first reference global model based on the loss function The first model loss l (t) , and the second reference global model The second model loss

[0073] In the embodiment of this specification, the marginal loss of participating node i is The larger the value is, the more important the local gradient of the participating node i is in federated learning. Optionally, the node quality of the participating node is determined based on the marginal loss in the embodiment of this specification, which may specifically include:

[0074] Based on the marginal loss of each participating node among the multiple participating nodes, the node quality of the participating nodes is determined according to a normalization algorithm.

[0075] In the embodiment of this specification, the node quality of the participating node i in the tth round of federated learning training is It can be expressed as: in, is a constant representing the tth round, represents the marginal loss with the minimum marginal loss among all participating nodes in the tth round of training; Represents the sum of the differences between the marginal loss of each participating node and the minimum marginal loss in the tth round of training.

[0076] Node quality It can also represent the weight of participating node i in federated learning. Local gradients with larger marginal loss values ​​can correspond to higher weights. Can be a positive number to ensure node quality Not equal to 0.

[0077] In order to obtain a more effective global gradient, in the embodiments of this specification, the effective participating nodes can also be determined according to the marginal loss, and the global gradient can be determined according to the node local gradients of the effective participating nodes. This can also make the aggregated model converge faster and more accurate.

[0078] Optionally, the method in the embodiments of this specification may further include:

[0079] Determine a participating node whose marginal loss is greater than or equal to a preset loss threshold among the plurality of participating nodes as a valid participating node;

[0080] Determining the global gradient of the federated learning model in which the participating nodes participate according to the data volume information, the node local gradient, and the node quality specifically includes:

[0081] According to the data volume information of each participating node among the valid participating nodes and the node quality of each participating node, an aggregation operation is performed on the node local gradients of each participating node to obtain the global gradient.

[0082] In the embodiment of this specification, the global gradient in the tth round of training can be obtained according to the following formula

[0083] Among them, i represents the valid participating nodes whose marginal loss is greater than or equal to the preset loss threshold among all participating nodes participating in federated learning; D i represents the volume of training data used by participating node i when training based on local data; ∑ i Represents the sum of relevant data for each valid participating node.

[0084] To improve the validity of data, in the embodiments of this specification, the node quality of effective participating nodes can be calculated when calculating the node quality of participating nodes, wherein the node quality of each effective participating node is determined based on the marginal loss of each effective participating node according to a normalization algorithm.

[0085] The above formula The i in can represent any node among the valid participating nodes. It can represent the marginal loss with the minimum marginal loss among all valid participating nodes in the tth round of training; Represents the sum of the differences between the marginal losses of each valid participating node and the minimum marginal loss in the tth round of training.

[0086] In the embodiment of this specification, the participating nodes participating in the federated learning model include multiple participating nodes, and the participation degree of the participating nodes can be expressed as the contribution degree of the participating nodes in the federated learning. The determining the participation degree of the participating nodes based on the node local gradient of the participating nodes and the global gradient may specifically include:

[0087] Determine a node contribution of each participating node based on a node local gradient of each node among the multiple participating nodes and the global gradient;

[0088] The relative contribution of the participating nodes is determined according to the node contribution of the participating nodes and the node contribution of each participating node.

[0089] In the embodiment of this specification, the distance mapping of the node local gradient of the participating node on the global gradient can be used as the benefit function of contribution evaluation, and then the contribution of the participating node is calculated using the Shapley value. Specifically, in the tth round of training, the benefit function V(i) of the participating node i can be: Then, substituting the above benefit function into the calculation of the Shapley value, we can get the node contribution of participating node i in the tth round: in Represents the aggregate weight of participating node i in round t.

[0090] In the embodiments of this specification, the Shapley value is used to calculate the contribution of participating nodes, and the distance mapping of the local gradient of each participating node on the global gradient is used as the benefit function of the Shapley value, which meets the idea of ​​contribution evaluation in cooperative games and overcomes the shortcoming of related work that only uses accuracy as contribution. The calculation cost is smaller than the real Shapley value, which can save resources and improve calculation efficiency.

[0091] In order to better reflect the stability of the participating nodes in the entire federated learning, the embodiments of this specification can also determine the relative contribution of the participating nodes in the entire training process according to the contribution of the participating nodes in each round of training. Among them, the node cumulative contribution of each participating node can be determined according to the node contribution of each participating node; based on the node cumulative contribution of the participating node and the maximum node cumulative contribution among the participating nodes, the relative contribution of the participating node is determined.

[0092] As an implementation method, the relative contribution of participating node i in the tth round of training is It can be expressed as:

[0093]

[0094] in, represents the cumulative contribution of participant i from round 1 to round t,

[0095] In the embodiments of this specification, the actual model gradient of the participating node can be determined according to the relative contribution. The higher the relative contribution of the participating node, the closer the actual model gradient that the participating node can obtain can be to the global gradient.

[0096] In the embodiments of this specification, the reputation of the participating nodes can also be determined based on the historical behavior of the participating nodes, which can also be used to indicate the reliability or trustworthiness of the participating nodes, smooth the fluctuations of the participating nodes in federated learning, and more accurately determine the participation of the participating nodes.

[0097] In the embodiment of this specification, the global gradient includes the gradient obtained through iterative calculation of the target round; wherein determining the participation degree of the participating node may also include:

[0098] Acquire the trusted parameters of the participating nodes; the trusted parameters are used to represent the comprehensive reliability of the participating nodes in the calculation process of the global gradient of the target round;

[0099] Based on the relative contribution and the trust parameter, the reputation of the participating node is determined.

[0100] As an implementation method, in the embodiments of this specification, Calculate the reputation of participating node i in round t in represents the trusted parameter of participating node i in round t, Represents the relative contribution of participating node i in round t.

[0101] The obtaining of the trusted parameters of the participating nodes in the embodiments of this specification may specifically include:

[0102] Determine the first number of times that the participating node is determined as a valid participating node in the target round; the valid participating node represents a participating node whose marginal loss is greater than or equal to a preset loss threshold;

[0103] Determining a second number of times that the participating node is determined as an invalid participating node in the target round; the invalid participating node represents a participating node whose marginal loss is less than the preset loss threshold;

[0104] Based on the first number and the second number, a trustworthy parameter of the participating node is determined.

[0105] As an implementation method, the embodiments of this specification can be adopted To represent the trusted parameters of participating nodes It can represent the trustworthiness of the participating nodes in the tth round, or it can represent the comprehensive reliability of the participating nodes in the entire federated learning of calculating the global gradient from the 1st round to the tth round; β represents a constant coefficient, which can be set according to actual needs; Indicates the number of times participating node i is confirmed as a valid participating node during the training process from round 1 to round t; It indicates the number of times the participating node i is confirmed as an invalid participating node during the training process from the 1st round to the tth round.

[0106] In the embodiments of this specification, the global gradient may include multiple global gradient factors; the participating nodes participating in the federated learning model may include multiple participating nodes; the global gradient may include a gradient obtained by iterative calculation of a target round;

[0107] Determining the actual model gradient of the participating node based on the participation degree may specifically include:

[0108] Determine the number of gradient matches corresponding to the participating node according to the ratio of the reputation of the participating node to the maximum reputation; the maximum reputation is used to represent the maximum reputation among the reputations of the participating nodes in the multiple participating nodes;

[0109] A global gradient factor of the gradient matching quantity is selected from the global gradient to obtain the actual model gradient.

[0110] In the embodiments of this specification, at least part of the global gradient can be sent to the corresponding participating node according to the reputation of the participating node, so that the participating node can obtain the model gradient matching the participating node, and further each participating node can obtain the federated learning model matching its own node.

[0111] In the embodiments of this specification, Obtain the number of gradient matches assigned to participating node i in round t in, It can represent the total number of global gradient factors contained in the global gradient of the tth round. The participating node with the highest reputation can obtain the entire global gradient. In practical applications, if the calculated gradient matches the number Including decimals, the gradient matching quantity can also be obtained by rounding, rounding up, rounding down, etc.

[0112] In practical applications, when participating nodes use local data for model training, the characteristics of the training data used by different participating nodes may be different, and the degree of influence of different participating nodes on various model parameters in the global model may be different. The node local gradient provided by the participating node can also reflect the needs of the participating node. For example, the node local gradient provided by participating node A focuses on the relationship between the user's age and the user's demand for the product, and its influence on the global gradient representing the user's age and the user's demand for the product may be greater; the node local gradient provided by participating node B focuses on the relationship between the user's education and the user's demand for the product, and its influence on the global gradient representing the user's education and the user's demand for the product may be greater; and then the gradient factor reflecting the user's age and the user's demand for the product in the global gradient can be fed back to participating node A, and the gradient factor reflecting the user's education and the user's demand for the product in the global gradient can be fed back to participating node B.

[0113] In order to make the actual gradient allocated to the participating nodes more in line with the needs of the participating nodes, the embodiments of this specification can also determine the degree of influence of each gradient factor in the node local gradient on the global gradient based on the node local gradient provided by the participating nodes, and send the global gradient factor with a greater impact on the global gradient to the participating nodes.

[0114] Optionally, the global gradient in the embodiment of this specification includes multiple global gradient factors; the node local gradient includes multiple local gradient factors; the method in the embodiment of this specification may also include:

[0115] Obtaining the node influence of each global gradient factor relative to the participating node; the node influence is used to indicate the degree to which each global gradient factor is influenced by the participating node;

[0116] According to the node influence, sorting the global gradient factors in the global gradient to obtain sorted global gradient factors;

[0117] The selecting the global gradient factor of the gradient matching quantity from the global gradient to obtain the actual model gradient may specifically include:

[0118] The global gradient factors of the gradient matching quantity are selected from the sorted global gradient factors in a preset order to obtain the actual model gradient.

[0119] In practical applications, the global gradient factors in the global gradient can be sorted according to the size of the node influence. Optionally, in an embodiment of this specification, the sorting of the global gradient factors in the global gradient according to the node influence can specifically include:

[0120] According to the node influence, sorting the global gradient factors in the global gradient in descending order;

[0121] The step of selecting the global gradient factors of the gradient matching quantity from the sorted global gradient factors to obtain the actual model gradient specifically includes:

[0122] From the global gradient factors arranged in descending order, the above-mentioned gradient matching number global gradient factors are selected to obtain the actual model gradient.

[0123] Assume that the global gradient contains four global gradient factors M, N, P, and Q. The node influences of participating node A for these four global gradient factors are A1, A2, A3, and A4, respectively, where A3>A2>A4>A1. The number of gradient matches corresponding to participating node A is 3. It can be determined that the global gradient factors N, P, and Q ranked in the top three in node influence will be sent to the participating node.

[0124] In practical applications, the global gradient factors in the global gradient can also be sorted in ascending order according to the node influence, and the factors at the bottom of the order are determined as the actual model gradients of the participating nodes. The specific sorting method is not limited here, as long as it can meet the actual needs.

[0125] In the embodiments of this specification, obtaining the node influence of each global gradient factor relative to the participating node may specifically include:

[0126] Determine a first distribution parameter corresponding to each local gradient factor in the local gradient of the participating node; the first distribution parameter is used to represent the proportion of each local gradient factor in the local gradient;

[0127] Determine a second distribution parameter corresponding to each global gradient factor in the global gradient; the second parameter is used to represent the proportion of each global gradient factor in the global gradient;

[0128] The node influence of each global gradient factor relative to the participating node is determined according to the first distribution parameter and the second distribution parameter.

[0129] In practical applications, the global gradient factors in the global gradient can be arranged according to a preset attribute order, and the local gradient factors in the node local gradient can also be arranged according to the preset attribute order.

[0130] As an implementation method, in the embodiment of this specification, the node influence corresponding to the jth node local gradient factor in the node local gradient provided by the participating node i in the tth round is It can be expressed as in, represents the first distribution parameter, represents the second distribution parameter.

[0131] Among them, the first distribution parameter of the jth node local gradient factor in the node local gradient of participating node i in the tth round is It can be expressed as in, represents the jth node local gradient factor in the node local gradient of participating node i in the tth round, Represents the node local gradient provided by participating node i in round t The sum of the local gradient factors of each node in .

[0132] The second distribution parameter of the jth global gradient factor in the global gradient in the tth round It can be expressed as in represents the jth global gradient factor in the tth round of global gradient, Represents the global gradient of the tth round The sum of the global gradient factors in .

[0133] In the embodiment of this specification, marginal loss is used as a measure of the data quality of each participating node during the gradient aggregation process, and gradient aggregation is performed in combination with data quality and quantity, so that the aggregated model converges faster and has higher accuracy.

[0134] Furthermore, the embodiments of this specification comprehensively consider the data quality and contribution of the participating nodes, calculate the cumulative reputation of the participating nodes to determine the number of gradients allocated to each participating node, and take into account the local gradient distribution of the participating nodes when selecting the gradients, so that the participating nodes can obtain models that match the participating nodes, and also enable participating nodes with high contributions to obtain models with higher accuracy.

[0135] In order to more clearly illustrate the model gradient determination method based on federated learning provided in the embodiments of this specification, Figure 3 This is a swim lane diagram of a method for determining a model gradient based on federated learning provided in the embodiments of this specification. Figure 3 The method may include a node training phase, a gradient aggregation phase, and a gradient determination phase, and may specifically include:

[0136] Step 302: The server sends the basic training model to each participating node participating in federated learning.

[0137] Step 304: The participating nodes obtain the basic training model.

[0138] Step 306: The participating nodes train the basic training model based on local data to obtain a trained model.

[0139] Step 308: The participating nodes may determine the node local gradients according to the trained model.

[0140] Step 310: The participating node sends the node local gradient and the data volume information of the training data used when training the basic training model based on the local data to the server.

[0141] Step 312: The server obtains node local gradients and data volume information of participating nodes.

[0142] In practical applications, each participating node participating in federated learning can execute steps 304 to 310 respectively, and the server can obtain the node local gradient and data volume information of each participating node.

[0143] Step 314: After obtaining the node local gradient and data volume information sent by each participating node participating in the federated learning, the server can determine the global gradient of the federated learning model in which the participating nodes participate based on the data volume information and the node local gradient.

[0144] In the embodiments of this specification, the edge loss of the participating nodes can also be determined based on the node local gradients of the participating nodes, and based on the edge loss, the effective participating nodes and the node quality of the participating nodes can be determined from each participating node. In the embodiments of this specification, the global gradient of the federated learning model can be determined based on the node local gradients of the effective participating nodes, the data volume information and the node quality, which can effectively improve the convergence of the model and improve the training efficiency.

[0145] Step 316: The server may determine the contribution of the participating nodes based on the local gradient of the nodes and the global gradient, and determine the reputation of the participating nodes based on the contribution.

[0146] Step 318: The server may determine the number of gradient matches corresponding to the participating nodes according to the reputation of the participating nodes.

[0147] Step 320: The server determines the node influence of each global gradient factor in the global gradient relative to the participating nodes, and sorts the global gradient factors in the global gradient according to the node influence to obtain sorted global gradient factors.

[0148] Step 322: The server selects the global gradient factors of the gradient matching quantity from the sorted global gradient factors according to a preset order to obtain the actual model gradient.

[0149] Step 324: The server sends the determined actual model gradients that match the participating nodes to the participating nodes.

[0150] The server can send the actual model gradient corresponding to each participating node to each participating node, and each participating node can generate its own federated learning model based on the actual model gradient received. For the iterative training process in federated learning, the participating node can update its own training model based on the actual model gradient received to obtain the latest version of the training model, which can be regarded as the basic training model. Then, the latest version of the training model is trained based on its own data, and the node local gradient obtained by training is fed back to the server for aggregation.

[0151] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 4 The following is a schematic diagram of a model gradient determination device based on federated learning provided in an embodiment of this specification. Figure 4 As shown, the device may include:

[0152] The volume information acquisition module 402 is used to acquire data volume information of the participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating nodes;

[0153] A local gradient acquisition module 404 is used to acquire the node local gradient obtained by the participating node through training the basic training model based on local data;

[0154] A global gradient determination module 406, configured to determine a global gradient of the federated learning model in which the participating nodes participate, based on the data volume information and the node local gradient;

[0155] A participation degree determination module 408 is used to determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model;

[0156] The actual gradient determination module 410 is used to determine the actual model gradient of the participating node based on the participation degree.

[0157] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method.

[0158] Figure 5 A schematic diagram of the structure of a model gradient determination device based on federated learning provided in an embodiment of this specification.

[0159] like Figure 5 As shown, the device 500 may include:

[0160] at least one processor 510; and,

[0161] A memory 530 in communication with the at least one processor; wherein,

[0162] The memory 530 stores instructions 520 executable by the at least one processor 510. The instructions are executed by the at least one processor 510 to enable the at least one processor 510 to:

[0163] Acquire data volume information of participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating nodes;

[0164] Obtaining node local gradients obtained by the participating nodes training the basic training model based on local data;

[0165] Determine the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient;

[0166] Determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model;

[0167] Based on the participation degree, an actual model gradient of the participating node is determined.

[0168] Based on the same idea, the embodiment of this specification also provides a computer-readable medium corresponding to the above method. The computer-readable medium stores computer-readable instructions, which can be executed by a processor to implement the above-mentioned model gradient determination method based on federated learning.

[0169] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. Figure 5 As for the device shown, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0170] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0171] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0172] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0173] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

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

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

[0176] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0177] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0178] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0179] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0180] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0181] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

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

[0183] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0184] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A method for determining a model gradient based on federated learning, comprising: Get the data volume information of participating nodes; The data volume information is used to indicate the amount of data used by the participating node when training the basic training model based on local data; The local data includes user data of the target organization corresponding to the participating node; Obtaining node local gradients obtained by the participating nodes training the basic training model based on local data; Determine the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient; Determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model; Based on the participation degree, an actual model gradient of the participating node is determined.

2. The method according to claim 1, after obtaining the node local gradient obtained by the participating node training the basic training model based on local data, further comprises: Obtaining the marginal loss of the participating nodes; The marginal loss is used to represent the influence of the node local gradient of the participating node on the performance of the federated learning model; Determining the node quality of the participating nodes based on the marginal loss; Determining the global gradient of the federated learning model in which the participating nodes participate based on the data volume information and the node local gradient specifically includes: The global gradient of the federated learning model in which the participating nodes participate is determined based on the data volume information, the node local gradient and the node quality.

3. According to the method of claim 2, the participating nodes participating in the federated learning model include multiple participating nodes; The obtaining of the marginal loss of the participating node specifically includes: Determining a first reference global model according to a node local gradient of each participating node among the plurality of participating nodes; Determining a second reference global model according to node local gradients of each other participating node among the plurality of participating nodes other than the participating node; Determining a first model loss of the first reference global model based on a preset validation set; Determining a second model loss of the second reference global model based on the preset validation set; Based on the first model loss and the second model loss, a marginal loss of the participating node is determined.

4. According to the method of claim 2, the participating nodes participating in the federated learning model include multiple participating nodes; The determining the node quality of the participating nodes based on the marginal loss specifically includes: Based on the marginal loss of each participating node among the multiple participating nodes, the node quality of the participating nodes is determined according to a normalization algorithm.

5. According to the method of claim 2, the participating nodes participating in the federated learning model include multiple participating nodes; The method further comprises: Determine a participating node whose marginal loss is greater than or equal to a preset loss threshold among the plurality of participating nodes as a valid participating node; Determining the global gradient of the federated learning model in which the participating nodes participate according to the data volume information, the node local gradient, and the node quality specifically includes: According to the data volume information of each participating node among the valid participating nodes and the node quality of each participating node, an aggregation operation is performed on the node local gradients of each participating node to obtain the global gradient.

6. According to the method of claim 1, the participating nodes participating in the federated learning model include multiple participating nodes; The determining the participation degree of the participating node based on the node local gradient of the participating node and the global gradient specifically includes: Determine a node contribution of each participating node based on a node local gradient of each node among the multiple participating nodes and the global gradient; Determining the relative contribution of the participating nodes according to the node contribution of the participating nodes and the node contribution of each participating node; Acquire the trusted parameters of the participating nodes; the trusted parameters are used to represent the comprehensive reliability of the participating nodes in the calculation process of the global gradient of the target round; Determining the reputation of the participating node based on the relative contribution and the trust parameter; Based on the reputation of the participating nodes, the participation degree of the participating nodes is determined.

7. According to the method of claim 6, the obtaining of the trusted parameters of the participating nodes specifically comprises: determining a first number of times the participating node is determined as a valid participating node in the target round; The effective participating node represents a participating node whose marginal loss is greater than or equal to a preset loss threshold; the marginal loss is used to indicate the degree of influence of the node local gradient of the participating node on the performance of the federated learning model; Determining a second number of times that the participating node is determined as an invalid participating node in the target round; the invalid participating node represents a participating node whose marginal loss is less than the preset loss threshold; Based on the first number and the second number, a trustworthy parameter of the participating node is determined.

8. According to the method of claim 6, the global gradient includes multiple global gradient factors; the participating nodes participating in the federated learning model include multiple participating nodes; the global gradient includes the gradient obtained by iterative calculation of the target round; The determining, based on the participation degree, the actual model gradient of the participating node specifically includes: Determine the number of gradient matches corresponding to the participating node according to the ratio of the reputation of the participating node to the maximum reputation; the maximum reputation is used to represent the maximum reputation among the reputations of the participating nodes in the multiple participating nodes; A global gradient factor of the gradient matching quantity is selected from the global gradient to obtain the actual model gradient.

9. The method according to claim 8, wherein the global gradient includes multiple global gradient factors; the node local gradient includes multiple local gradient factors; The method further comprises: Obtaining the node influence of each global gradient factor relative to the participating node; the node influence is used to indicate the degree to which each global gradient factor is influenced by the participating node; According to the node influence, sorting the global gradient factors in the global gradient to obtain sorted global gradient factors; The step of selecting the global gradient factor of the gradient matching quantity from the global gradient to obtain the actual model gradient specifically includes: The global gradient factors of the gradient matching quantity are selected from the sorted global gradient factors in a preset order to obtain the actual model gradient.

10. According to the method of claim 9, the step of obtaining the node influence of each global gradient factor relative to the participating nodes specifically comprises: Determine a first distribution parameter corresponding to each local gradient factor in the local gradient of the participating node; the first distribution parameter is used to represent the proportion of each local gradient factor in the local gradient; Determine a second distribution parameter corresponding to each global gradient factor in the global gradient; the second distribution parameter is used to represent the proportion of each global gradient factor in the global gradient; The node influence of each global gradient factor relative to the participating node is determined according to the first distribution parameter and the second distribution parameter.

11. A model gradient determination device based on federated learning, comprising: A volume information acquisition module is used to obtain data volume information of participating nodes; The data volume information is used to indicate the amount of data used by the participating node when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating node; A local gradient acquisition module, used to acquire node local gradients obtained by the participating nodes training the basic training model based on local data; A global gradient determination module, used to determine the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient; A participation degree determination module, used to determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model; The actual gradient determination module is used to determine the actual model gradient of the participating node based on the participation degree.

12. A model gradient determination device based on federated learning, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Acquire data volume information of participating nodes; the data volume information is used to indicate the amount of data used by the participating nodes when training the basic training model based on local data; the local data includes user data of the target organization corresponding to the participating nodes; Obtaining node local gradients obtained by the participating nodes training the basic training model based on local data; Determine the global gradient of the federated learning model in which the participating nodes participate according to the data volume information and the node local gradient; Determine the participation degree of the participating node based on the node local gradient of the participating node and the global gradient; the participation degree is used to indicate the degree of participation of the participating node in the training of the federated learning model; Based on the participation degree, an actual model gradient of the participating node is determined.

13. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the model gradient determination method based on federated learning as described in any one of claims 1 to 10.