Federated learning method and device

Through the adaptive update method, the weights of each participant are calculated from the model dimension and data dimension, which solves the problem of weight setting affecting the model performance in the existing technology, achieves more efficient model convergence and performance improvement, and evaluates the various participants .

CN118551865BActive Publication Date: 2025-01-07ANT GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411017513.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2025-01-07
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

The existing horizontal federated learning methods have shortcomings in model convergence and prediction accuracy. The aggregation weights are usually pre-set in person, affecting the performance of the model, and it is difficult to effectively evaluate the contribution of each participant.

Method used

Adaptive update method is adopted to calculate the weights of each participant from the model dimension and data dimension, and adjust the weights through the difference between distance and evaluation indicators, and realize the weights of weights of the weights and the calculation of the complementary parameters of the model parameters, thereby updating the weights.

Benefits of technology

On the premise of protecting data privacy, accelerate model convergence, improve model performance, and accurately evaluate the contribution of each participant, promoting the full mining of data value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118551865B_ABST
    Figure CN118551865B_ABST
Patent Text Reader

Abstract

The embodiments of this specification disclose a federated learning method and device. The method is applied to the target party, and any round of iterative training involved in the method includes: first, obtaining N model parameters from N participants, wherein any i-th model parameter is obtained by the i-th participant using local samples for model training; then, weighted aggregation of the N model parameters is performed using N current weights to obtain the global parameters updated in this round; thereafter, for the i-th participant, weighted aggregation of the other N-1 model parameters is performed using the N-1 current weights corresponding to the other N-1 participants to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global parameter; and providing the global parameter to the i-th participant for the next round of iterative training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of machine learning technology, and more particularly, to a federated learning method and apparatus. Background Art

[0002] Federated Learning is a machine learning framework that helps multiple parties (such as institutions or devices) jointly build machine learning models while protecting their respective data privacy.

[0003] According to the distribution characteristics of training data among multiple participants, federated learning can be divided into horizontal federated learning and vertical federated learning. In horizontal federated learning, the feature spaces of different participants are aligned, but the sample spaces are not aligned. For example, the transaction data of different banks are feature-aligned, but the user groups they serve are different, so the number of training samples is increased.

[0004] Horizontal federated learning has been widely used in recommendation, finance, medical and other fields. Therefore, the embodiments of this specification disclose an improved solution for horizontal federated learning, which can meet higher requirements in practical applications, such as improving the accuracy of the federated learning model, effectively evaluating the contribution of each participant in the federated learning, and so on. Summary of the invention

[0005] The embodiments of this specification describe a federated learning method and device that can meet higher requirements in practical applications.

[0006] According to the first aspect, a federated learning method is provided, which is applied to a target party, and any round of iterative training involved in the method includes: obtaining N model parameters from N participants, wherein any i-th model parameter is obtained by the i-th participant using local samples to perform model training; using N current weights to perform weighted aggregation on the N model parameters to obtain the global parameters updated in this round; for the i-th participant, using the N-1 current weights corresponding to the other N-1 participants, weighted aggregation on the other N-1 model parameters to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global parameter; and providing the global parameter to the i-th participant for the next round of iterative training.

[0007] In one embodiment, the target party is an intermediary party other than the N participating parties, or is one of the N participating parties.

[0008] In one embodiment, updating the i-th current weight includes: normalizing N distances corresponding to N participants to obtain the normalized value of the i-th distance as the first value of the i-th participant; and updating the i-th current weight based on the first value.

[0009] In one embodiment, updating the i-th current weight includes: constructing multiple sets including the i-th participant based on the N participants; determining the difference between the first model and the second model on the validation set for each set with respect to an evaluation index; the first model is obtained by performing target aggregation using the model parameters of the participants in the set, and the second model is obtained by performing the target aggregation using the model parameters of the participants in the set except for the i-th participant; determining the second value of the i-th participant based on multiple differences corresponding to the multiple sets; and updating the i-th current weight based on the second value and the i-th distance.

[0010] Furthermore, in a specific embodiment, the target aggregation includes: normalizing current weights corresponding to model parameters participating in the target aggregation to obtain corresponding weighting coefficients; and performing weighted summation on the model parameters participating in the target aggregation using the weighting coefficients.

[0011] In a specific embodiment, based on multiple differences corresponding to the multiple sets, the second value of the i-th participant is determined, including: weighted summing the multiple differences to obtain the i-th weighted difference; normalizing the N weighted differences corresponding to the N participants to obtain the normalized value of the i-th weighted difference as the second value.

[0012] In a specific embodiment, updating the i-th current weight based on the second value and the i-th distance includes: determining a first value based on the i-th distance;

[0013] The sum or product of the first value and the second value is calculated as the updated i-th current weight.

[0014] In one embodiment, the i-th model parameters are parameters of a low-order adaptive LoRA layer in a large model.

[0015] According to the second aspect, a federated learning method is provided, which is applied to a target party, and any round of iterative training involved in the method includes: obtaining N local update data from N participants, wherein any i-th local update data is obtained by the i-th participant using local samples to perform model training; using N current weights to perform weighted aggregation on the N local update data to obtain global update data after this round of update; for the i-th participant, using the N-1 current weights corresponding to the other N-1 participants, weighted aggregation on the other N-1 local update data to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global update data; providing the global update data to the i-th participant for the next round of iterative training.

[0016] In one embodiment, the N local update data are N local gradients, and the global update data are global gradients.

[0017] According to a third aspect, a federated learning device is provided, which is integrated in a target party, and the device performs any round of iterative training in federated learning through the following modules: a parameter acquisition module, configured to obtain N model parameters from N participants, wherein any i-th model parameter is obtained by the i-th participant performing model training using local samples; a parameter aggregation module, configured to perform weighted aggregation on the N model parameters using N current weights to obtain global parameters after this round of update; a weight update module, configured to perform weighted aggregation on the other N-1 model parameters for the i-th participant using the N-1 current weights corresponding to the other N-1 participants to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global parameter; a parameter provision module, configured to provide the global parameter to the i-th participant for the next round of iterative training.

[0018] According to a fourth aspect, a federated learning device is provided, which is integrated in a target party, and the device performs any round of iterative training in federated learning through the following modules: a data acquisition module, configured to acquire N local update data from N participants, wherein any i-th local update data is obtained by the i-th participant using local samples for model training; a data aggregation module, configured to perform weighted aggregation on the N local update data using N current weights to obtain global update data after this round of update; a weight update module, configured to perform weighted aggregation on the other N-1 local update data for the i-th participant using the N-1 current weights corresponding to the other N-1 participants to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global update data; a data provision module, configured to provide the global update data to the i-th participant for the next round of iterative training.

[0019] According to a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method provided in the first aspect or the second aspect.

[0020] According to a sixth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect or the second aspect is implemented.

[0021] In summary, the federated learning method and device disclosed in the embodiments of this specification can accurately and efficiently realize the adaptive adjustment of the weights used to aggregate the model parameters of each participant from the model dimension and / or data dimension, thereby accelerating convergence and improving the performance of the trained model while protecting data privacy. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 A schematic diagram showing data distribution in a horizontal federated learning scenario;

[0024] Figure 2 A schematic diagram showing the traditional process architecture of horizontal federated learning;

[0025] Figure 3 A schematic diagram of an implementation architecture of an improved solution for horizontal federated learning disclosed in the embodiments of this specification;

[0026] Figure 4 A schematic diagram of the multi-party interaction steps of federated learning disclosed in the embodiments of this specification;

[0027] Figure 5 A schematic diagram of the steps of the method flow of federated learning disclosed in the embodiments of this specification;

[0028] Figure 6 This is one of the schematic diagrams of the structure of the federated learning device disclosed in the embodiments of this specification;

[0029] Figure 7 This is the second schematic diagram of the device structure of federated learning disclosed in the embodiments of this specification. DETAILED DESCRIPTION

[0030] The solution provided in this specification is described below in conjunction with the accompanying drawings.

[0031] As mentioned above, the embodiments of this specification disclose an improved solution for horizontal federated learning. To help understanding, the following first briefly introduces the data distribution and traditional process under horizontal federated learning, and then introduces the inventive concept of proposing the improved solution.

[0032] 1. Data Distribution in Horizontal Federated Learning

[0033] like Figure 1 As shown, in horizontal federated learning, N (>1) data parties (also called participants or clients in this article) each have complete and different training samples.

[0034] In the recommendation scenario, multiple data parties can be different e-commerce platforms, and the samples held by each data party include user and product characteristics, as well as behavioral labels indicating whether the user has made a predetermined behavior on the product. For example, user characteristics include static attribute characteristics of the user, such as occupation, permanent residence, hobbies, etc., and dynamic behavioral characteristics (or network behavioral characteristics), such as browsing web pages or operating application history, etc.; product characteristics include product type, origin, price, shelf life, etc.; the predetermined behavior corresponding to the behavior label can be adding to the shopping cart or purchasing, etc.

[0035] In the risk assessment scenario, multiple data parties can be different payment platforms, and the samples held by each payment platform include the user's payment records and corresponding risk labels. For example, the payment record includes the payment amount, payment content, payment time, payment address, etc.; the risk labels include high risk, medium risk and low risk, etc.

[0036] The above combines the recommendation scenario and risk assessment scenario to provide an exemplary introduction to the data distribution corresponding to multiple participants in horizontal federated learning.

[0037] 2. Traditional Process of Horizontal Federated Learning

[0038] In horizontal federated learning, a central server independent of the N participants is generally introduced. The central server can be a server maintained by an authoritative organization. Figure 2 As shown, in any round of iterative training, N participants each train a local model using local data and provide the trained model parameters to the central server. Then, the central server can update the global model by weighted aggregation of the model parameters provided by the N participants, where weighted aggregation can be seen in the following formula (1).

[0039] (1)

[0040] In formula (1), the superscript Indicates the current iteration number is , Indicates The parameters of the local model in each participant, Indicates for The assigned aggregate weight, and ; Represents the global model parameters after aggregation. For brevity, it may be omitted in the following text. , and The superscript of .

[0041] Afterwards, the central server uses the model parameters obtained by weighted aggregation as the global model parameters after this round of update, and sends a complete copy of it to the N participants. Then, the N participants each update their local model to the copy to participate in the next round of iterative training.

[0042] It should be understood that expressions such as training models, updating models, updating model parameters, adjusting model parameters, and adjusting parameters have essentially the same meaning and can be used interchangeably in the article.

[0043] III. Inventive Concept of Improved Scheme

[0044] In the above traditional process, the aggregation weight used in formula (1) is Generally, it is obtained by artificial presetting, which will affect the convergence and prediction accuracy of the model. In this regard, the applicant proposes an improved solution, in each round of iterative training, the aggregate weights of N participants are adaptively updated from the model dimension and / or data dimension, so that the updated aggregate weights are used for the next round of iterative training.

[0045] 1) Model Dimension

[0046] For any i-th client among N clients, or client i, define To represent the weighted average of the model parameters in the other N-1 clients, formula (1) can be transformed into:

[0047] (2)

[0048] Figure 3 The vector triangle is used to visualize formula (2) and A simple illustration is .observe Figure 3 It can be seen that: and The higher the similarity, or the closer the distance, the better the model parameters in client i. The higher the substitutability, the lower the contribution. Therefore, the applicant proposes to calculate and The distance (or similarity) between them is used to measure the contribution of client i in the model dimension.

[0049] On the other hand, although it is possible to directly calculate and ,or and However, the distance between the single model parameters The calculation of is easily affected by outliers, especially in the scenario where low-rank adaptation (LoRA) technology is used to fine-tune large models.

[0050] The essence of LoRA technology is to embed a low-rank matrix in the large model, and only update this low-rank matrix during fine-tuning. Compared with the parameters of other layers in the large model, the parameter values ​​of the low-rank matrix are relatively low and more susceptible to some outliers. and (or ), by calculating the weighted average of the parameters of the other N-1 clients and The distance between them is used to measure the contribution of participant i, which can effectively resist the interference of outliers in the low-rank matrix and smooth out the noise.

[0051] The above introduction starts from the model dimension and updates the aggregate weights allocated to each participant.

[0052] 2) Data Dimension

[0053] In the data dimension, the contribution of different participants can be measured by using the model's evaluation indicators on the validation data (or validation set), such as error rate or loss function value.

[0054] Specifically, the applicant proposed to calculate the evaluation index based on the validation set. The marginal benefit corresponding to all subsets of clients ( Figure 3 Indicated in ), thereby measuring the The contribution of each client in the data dimension ( Figure 3 Indicated in ). In this way, if If the data overlap between a client and a certain client is high, the marginal benefit of the subset formed by the i-th client and the certain client is low, thereby resisting the behavior of a participant maliciously copying its own data to increase its contribution.

[0055] The above introduces the improvements proposed by the applicant for weighted aggregation in horizontal federated learning. The improvements to the model dimension and the data dimension can be used independently or in combination. For example, Figure 3 The contribution of client i is calculated from the model dimension and data dimension respectively. and , and then multiply or add to get the final contribution , as the aggregation weight in the next round (t+1th round) of iterative training.

[0056] The above introduces the data distribution and traditional process of horizontal federated learning, and then introduces the invention concept of the improved solution proposed by the applicant. Figure 4 And more embodiments describe the specific implementation steps of the improved solution.

[0057] Figure 4 This is a schematic diagram of the multi-party interaction steps of federated learning disclosed in the embodiments of this specification. The multi-party involved in the interaction includes N participants and a central server. Considering that the steps performed by the N participants are similar, Figure 4 P is only shown as a representative example. i The interaction steps involved by the party (referring to any i-th participant); in addition, all parties involved in the interaction can be implemented as any device, platform or device cluster with computing and processing capabilities. Figure 4 As shown in Figure 1, any round of iterative training in federated learning involves the following interactive steps:

[0058] Step S41, P i The local samples are used to train the model and obtain the updated model parameters. .

[0059] Specifically, P iThe party trains the locally deployed model using a batch of local samples sampled for the current training round. In one implementation, the parameters of some network layers in the model may be adjusted, for example, the LoRA layer in the large model. In another implementation, the parameters of all network layers in the model may also be adjusted.

[0060] From above, P i The parties can conduct local training for this round.

[0061] Step S42, P i The updated model parameters Provided to the central server.

[0062] It is understandable that if P i When training locally, the model parameters are partially and completely adjusted. i The party can only provide the updated model parameters to the central server, thereby reducing the communication volume and subsequent calculation volume.

[0063] Step S43: The central server uses N current weights For N model parameters Perform weighted aggregation to obtain the global parameters after this round of update .

[0064] For the above N current weights In one implementation, the current training round is the first round, at which time, N current weights It can be randomly initialized, or N current weights are initialized to 1 / N. In another implementation, the current training is not the first round. In this case, the N current weights It can be obtained by updating in the previous round of iterative training.

[0065] For the execution of weighted aggregation in this step, please refer to the above formula (1).

[0066] Above, the central server can get global parameters .

[0067] Step S44: the central server sends i party, using the N-1 current weights corresponding to the other N-1 parties , for the other N-1 model parameters Perform weighted aggregation to obtain the i-th complement parameter The calculation of this step can be written as:

[0068] (3)

[0069] Step S45: the central server calculates the value of the i-th complement parameter. and global parameters The i-th distance between , update the i-th current weight . Need to understand, It can be cosine distance, Euclidean distance, or Manhattan distance, etc. In addition, the updated current weight The distance to the i-th Positive correlation, that is, The larger the updated The bigger.

[0070] Specifically, according to the i-th distance Determine the first value of the i-th participant , and then based on the first value Update the i-th current weight It should be noted that the “first” in the first value, as well as the first, second and other similar terms in other places in the text, are all used to distinguish things of the same kind and do not have other limiting functions such as ranking.

[0071] In one embodiment, the N distances corresponding to the N participants are normalized to obtain the normalized value of the i-th distance as the first value of the i-th participant. For example, the normalization process can be performed using the following formula:

[0072] (4)

[0073] Furthermore, in one embodiment, the i-th current weight Update to first value , that is, setting .

[0074] In another embodiment, in addition to calculating the first value from the model dimension In addition, the second value is calculated from the data dimension , thereby utilizing and Update the i-th current weight .

[0075] Second value The calculation can be done using the following formula:

[0076] α i s = ∑ s∈ S i ρ s [ v s - v(s\i) ] (5)

[0077] In formula (5):

[0078] 1) The set elements in are: all sets formed based on N participants and including the i-th participant; yes A collection of Representing a collection The number of participants in Representing a collection Remove the participants After the collection.

[0079] 2) Representing a collection The evaluation index of the first model jointly trained by all participants on the validation set, Representing a collection Evaluation index of the second model jointly trained by the participants on the validation set.

[0080] In one embodiment, when calculating or When the federated model is in the collection or For example, in computing When Members of Perform local training, and the parameters after training are recorded as , and then aggregate: .

[0081] Retraining will greatly increase the cost of model training. In order to solve this problem, the applicant proposes to design a model replacement mechanism. In this mechanism, there is no need to retrain, but to use the N copies of model parameters already obtained in this round. and N weights , alternatively determined in the set The first model obtained by retraining , and in the collection The second model obtained by retraining The specific calculation formula is as follows:

[0082] , (6)

[0083] , (7)

[0084] Get the first model above And the second model After that, the two models can be used to process the validation set respectively, so as to calculate the index value of the evaluation index according to the prediction results and corresponding labels of the validation samples, including and For example, the evaluation index may be accuracy, error rate or loss function value.

[0085] 3) Return to formula (5), where express The corresponding weighting coefficient.

[0086] In one embodiment, It can be set manually, for example, directly setting .

[0087] In another embodiment, the Shapley value can be used to calculate The calculation formula is as follows:

[0088] (8)

[0089] in, Represents the total number of participants in federated learning, Represents the factorial symbol.

[0090] The above introduction uses formula (5) to calculate the second value of the i-th participant from the data dimension .

[0091] Furthermore, based on P i The first value calculated by the square and the second value , update the i-th current weight It should be understood that the updated i-th current weight is and For example, the sum or product between the two can be calculated as the updated i-th current weight .for example:

[0092] (9)

[0093] Above, the central server can complete the current weight corresponding to any participant Updates.

[0094] Step S46: The central server sends the global parameters Provide to P i square.

[0095] Step S47, P i Using global parameters Update the local model for the next round of iterative training.

[0096] Understandable, P. i You can replace all or part of the parameters in the local model with global parameters. , thereby using the updated local model to participate in the next round of iterative training.

[0097] From the above, the central server and N participants jointly conduct multiple rounds of iterative training until the global parameters converge, and finally obtain the trained global parameters, which are put into the actual reasoning stage. In addition, it should be noted that the central server can be independent of the N participants or integrated into one of the N participants. In this article, the maintenance party of the central server may be referred to as the target party.

[0098] In summary, by adopting the federated learning method disclosed in the embodiments of this specification, the weights used to aggregate the model parameters of each participant can be accurately and efficiently updated adaptively from the model dimension and / or data dimension, thereby accelerating convergence and improving the performance of the trained model while protecting data privacy.

[0099] In addition, the updated weights can also be used to evaluate the contribution of each participant in federated learning, so that each participant can be incentivized according to the assessed contribution, thereby attracting potential high-quality data holders to participate in federated learning, fully exploring and utilizing the value of big data, and better serving users.

[0100] According to another embodiment, considering that in horizontal federated learning, what is transmitted between the participant and the target is not necessarily the model parameters themselves, but also the gradient of the model parameters. It is proposed that the above improvement scheme can be extended to the scenario of transmitting parameter gradients. Specifically, Figure 5 The following is a schematic diagram of the steps of the method for federated learning disclosed in the embodiments of this specification. The method is applied to the target party, and any round of iterative training involved includes:

[0101] Step S510, obtaining N local update data from N participants, wherein any i-th local update data is obtained by the i-th participant using local samples for model training; Step S520, weighted aggregation is performed on the N local update data using N current weights to obtain the global update data after this round of update; Step S530, for the i-th participant, weighted aggregation is performed on the other N-1 local update data using the N-1 current weights corresponding to the other N-1 participants to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global update data; Step S540, the global update data is provided to the i-th participant for the next round of iterative training.

[0102] Regarding the above steps, it should be noted that, in one implementation, the N local update data may be N model parameters, and the global update data may be global parameters. In this case, Figure 5 The method shown in Figure 4 The methods shown in are essentially the same except that the expressions are slightly different.

[0103] In another implementation, the N local update data may be N local gradients, and the global update data may be a global gradient. Figure 4 In short, Figure 4 The model parameters in steps S41-S45 can be replaced by gradients.

[0104] In this implementation, in step S540, the target party can directly provide the global gradient to the i-th participant, so that the i-th participant can update the local model using the local model and the global gradient. Alternatively, the target party can also use the global gradient to update the global model parameters, and then provide the updated global model parameters to the i-th participant.

[0105] In summary, by adopting the federated learning method disclosed in the embodiments of this specification, the weights used to aggregate the local updated data of each participant can be accurately and efficiently adjusted adaptively from the model dimension and / or data dimension, thereby accelerating convergence and improving the performance of the trained model while protecting data privacy.

[0106] Corresponding to the above-mentioned federated learning method, the embodiments of this specification also disclose a federated learning device. Figure 6 This is one of the schematic diagrams of the structure of the federated learning device disclosed in the embodiments of this specification. The device is integrated in the target party and performs any round of iterative training in the federated learning through the following modules:

[0107] The parameter acquisition module 610 is configured to obtain N model parameters from N participants, wherein any i-th model parameter is obtained by the i-th participant through model training using local samples. The parameter aggregation module 620 is configured to perform weighted aggregation on the N model parameters using N current weights to obtain the global parameters after this round of update. The weight update module 630 is configured to perform weighted aggregation on the other N-1 model parameters for the i-th participant using the N-1 current weights corresponding to the other N-1 participants to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global parameter. The parameter provision module 640 is configured to provide the global parameter to the i-th participant for the next round of iterative training.

[0108] In one embodiment, the target party is an intermediary party other than the N participating parties, or is one of the N participating parties.

[0109] In one embodiment, the weight update module 630 is specifically configured as follows: normalizing the N distances corresponding to the N participants to obtain the normalized value of the i-th distance as the first value of the i-th participant; and updating the i-th current weight based on the first value.

[0110] In one embodiment, the weight update module 630 is specifically configured as follows: based on the N participants, multiple sets including the i-th participant are constructed. For each set, the difference between the first model and the second model on the validation set for the evaluation index is determined; the first model is obtained by performing target aggregation using the model parameters of the participants in the set, and the second model is obtained by performing the target aggregation using the model parameters of the set other than the i-th participant. Based on the multiple differences corresponding to the multiple sets, the second value of the i-th participant is determined. Based on the second value and the i-th distance, the i-th current weight is updated.

[0111] Furthermore, in a specific embodiment, the target aggregation includes: normalizing current weights corresponding to model parameters participating in the target aggregation to obtain corresponding weighting coefficients; and performing weighted summation on the model parameters participating in the target aggregation using the weighting coefficients.

[0112] In a specific embodiment, the weight update module 630 is configured to determine the second value of the i-th participant, specifically including: performing weighted summation on the multiple differences to obtain the i-th weighted difference; normalizing the N weighted differences corresponding to the N participants to obtain the normalized value of the i-th weighted difference as the second value.

[0113] In a specific embodiment, the weight updating module 630 is further configured to: determine a first value based on the ith distance; and calculate a sum or product between the first value and the second value as the updated ith current weight.

[0114] In one embodiment, the i-th model parameters are parameters of a low-order adaptive LoRA layer in a large model.

[0115] Figure 7 This is the second schematic diagram of the structure of the device for federated learning disclosed in the embodiment of this specification, which is integrated in the target side. The device performs any round of iterative training in federated learning through the following modules:

[0116] The data acquisition module 710 is configured to acquire N local update data from N participants, wherein any i-th local update data is obtained by the i-th participant using local samples for model training. The data aggregation module 720 is configured to perform weighted aggregation on the N local update data using N current weights to obtain the global update data after this round of update. The weight update module 730 is configured to perform weighted aggregation on the other N-1 local update data for the i-th participant using the N-1 current weights corresponding to the other N-1 participants to obtain the i-th complement parameter, thereby updating the i-th current weight according to the i-th distance between the i-th complement parameter and the global update data. The data provision module 740 is configured to provide the global update data to the i-th participant for the next round of iterative training.

[0117] In one embodiment, the N local update data are N local gradients, and the global update data are global gradients.

[0118] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute Figure 4 or Figure 5 The method described.

[0119] According to another embodiment, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, Figure 4 or Figure 5 The method described.

[0120] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0121] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A federated learning method, applied to a target party, wherein any round of iterative training involved in the method includes: Obtain N sets of model parameters from N participants, where any i-th set of model parameters is obtained by the i-th participant using local samples to perform model training; The local sample is a recommendation sample, which includes the characteristics of the user and the product, or the local sample is a risk assessment sample, which includes the user's payment record and the corresponding risk label; Use N current weights to perform weighted aggregation on N model parameters to obtain the global parameters after this round of update; For the ith participant, using the N-1 current weights corresponding to the other N-1 participants, weighted aggregation is performed on the other N-1 model parameters to obtain the ith complement parameter, thereby updating the ith current weight according to the ith distance between the ith complement parameter and the global parameter; The global parameters are provided to the i-th participant for the next round of iterative training.

2. The method according to claim 1, wherein: The target party is an intermediary party other than the N participating parties, or is one of the N participating parties.

3. The method according to claim 1, wherein: Update the i-th current weight, including: Normalizing the N distances corresponding to the N participants to obtain the normalized value of the i-th distance as the first value of the i-th participant; Based on the first value, the i-th current weight is updated.

4. The method according to claim 1, wherein: Update the i-th current weight, including: Based on the N participants, construct multiple sets including the i-th participant; For each set, determine the difference between the first model and the second model on the validation set for the evaluation index; the first model is obtained by performing target aggregation using the model parameters of the participants in the set, and the second model is obtained by performing the target aggregation using the model parameters of the participants in the set except the i-th participant; Determining a second value of the i-th participant based on a plurality of difference values ​​corresponding to the plurality of sets; Based on the second value and the i-th distance, the i-th current weight is updated.

5. The method according to claim 4, wherein: The target aggregation includes: Normalize the current weights corresponding to the model parameters participating in the target aggregation to obtain the corresponding weight coefficients; The weighted coefficients are used to perform weighted summation on the model parameters involved in target aggregation.

6. The method according to claim 4, wherein: Determining the second value of the i-th participant based on the multiple difference values ​​corresponding to the multiple sets includes: Performing weighted summation on the multiple differences to obtain an i-th weighted difference; The N weighted differences corresponding to the N participants are normalized to obtain the normalized value of the i-th weighted difference as the second value.

7. The method according to claim 4, wherein: Based on the second value and the i-th distance, updating the i-th current weight includes: Determining a first value based on the i-th distance; The sum or product of the first value and the second value is calculated as the updated i-th current weight.

8. The method according to any one of claims 1 to 7, wherein: The i-th model parameters are parameters of the low-order adaptive LoRA layer in the large model.

9. A federated learning method, applied to a target party, wherein any round of iterative training involved in the method includes: Obtain N local update data from N participants, wherein any i-th local update data is obtained by the i-th participant using local samples for model training; the local samples are recommendation samples, which include features of users and commodities, or the local samples are risk assessment samples, which include payment records of users and corresponding risk labels; Use N current weights to perform weighted aggregation on N local update data to obtain the global update data after this round of update; For the ith participant, using the N-1 current weights corresponding to the other N-1 participants, weighted aggregation is performed on the other N-1 local update data to obtain the ith complement parameter, thereby updating the ith current weight according to the ith distance between the ith complement parameter and the global update data; The global update data is provided to the i-th participant for the next round of iterative training.

10. The method according to claim 9, wherein: The N local update data are N local gradients, and the global update data are global gradients.

11. A federated learning device, integrated in a target party, wherein the device performs any round of iterative training in federated learning through the following modules: A parameter acquisition module is configured to acquire N sets of model parameters from N participants, wherein any i-th set of model parameters is obtained by the i-th participant performing model training using local samples; the local samples are recommendation samples, which include features of users and commodities, or the local samples are risk assessment samples, which include payment records of users and corresponding risk labels; A parameter aggregation module is configured to perform weighted aggregation on N model parameters using N current weights to obtain the global parameters after this round of update; A weight updating module is configured to perform weighted aggregation on other N-1 model parameters for the ith participant using N-1 current weights corresponding to other N-1 participants to obtain an ith complement parameter, thereby updating the ith current weight according to an ith distance between the ith complement parameter and the global parameter; The parameter providing module is configured to provide the global parameters to the i-th participant for the next round of iterative training.

12. A federated learning device, integrated in a target party, wherein the device performs any round of iterative training in federated learning through the following modules: A data acquisition module is configured to acquire N local update data from N participants, wherein any i-th local update data is obtained by the i-th participant using local samples for model training; the local samples are recommendation samples, which include features of users and commodities, or the local samples are risk assessment samples, which include payment records of users and corresponding risk labels; A data aggregation module is configured to perform weighted aggregation on N local update data using N current weights to obtain global update data after this round of update; A weight updating module is configured to perform weighted aggregation on other N-1 local update data for the ith participant using N-1 current weights corresponding to other N-1 participants to obtain an ith complement parameter, thereby updating the ith current weight according to an ith distance between the ith complement parameter and the global update data; A data providing module is configured to provide the global update data to the i-th participant for the next round of iterative training.

13. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 10.

14. A computing device comprising a memory and a processor, wherein: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Federal learning participant weight calculation method based on information entropy

    CN114398634A

  • Federal learning poisoning attack-oriented defense method and system

    CN115907029A