CN113326949A - Model parameter optimization method and system for federal learning - Google Patents

Model parameter optimization method and system for federal learning Download PDF

Info

Publication number
CN113326949A
CN113326949A CN202110399316.2A CN202110399316A CN113326949A CN 113326949 A CN113326949 A CN 113326949A CN 202110399316 A CN202110399316 A CN 202110399316A CN 113326949 A CN113326949 A CN 113326949A
Authority
CN
China
Prior art keywords
gradient
client
model parameters
values
gradient value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110399316.2A
Other languages
Chinese (zh)
Inventor
范晓亮
王铮
王程
温程璐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen University
Original Assignee
Xiamen University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen University filed Critical Xiamen University
Priority to CN202110399316.2A priority Critical patent/CN113326949A/en
Publication of CN113326949A publication Critical patent/CN113326949A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/20Ensemble learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/161Computing infrastructure, e.g. computer clusters, blade chassis or hardware partitioning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a method and a system for optimizing model parameters of federated learning, wherein the method comprises the following steps: obtaining model parameters uploaded by a plurality of clients and corresponding training losses; calculating the corresponding gradient of each client so as to update the historical gradient list; sequencing the gradients corresponding to each client according to the training loss, and sequentially judging whether contradiction components exist between the gradients corresponding to each client and other gradients except the client; if so, sequentially eliminating components of the gradient corresponding to each client side and contradictory to other gradients in a projection mode to obtain the projected gradient of each client side and aggregating to obtain a primary gradient; judging whether contradiction components exist between the preliminary gradient and the historical gradient of the client which is sampled in the round and is not sampled in the current round according to the number of the rounds from the certain round; if yes, eliminating the sum of all contradictory components of the primary gradient and the wheel in a projection mode; thereby improving the fairness of the federal learning model.

Description

Model parameter optimization method and system for federal learning
Technical Field
The invention relates to the technical field of deep learning, in particular to a method for optimizing model parameters of federated learning, a computer-readable storage medium, computer equipment and a system for optimizing model parameters of federated learning.
Background
Today, with the rapid development of information technology, models trained on massive data through a machine learning algorithm are applied to various industries. However, as the awareness of people's privacy increases and related laws become enforced, it is no longer feasible to directly obtain user data for training a model. Federal learning has emerged as a distributed machine learning paradigm with privacy preserving capabilities. The method does not require a user to upload data any more, and only exchanges encrypted model parameters, so that the data and the calculation power of the user can be utilized to cooperatively train a model, and the privacy of the data of the user can be protected.
In the related technology, in an actual application scenario, data are distributed on each client in a non-independent manner, the data are different in number, network states of different individuals are different, and situations of offline or zombie users may exist, so unfairness is easily introduced into a model, and negative effects are brought to model training due to the unfairness, and poor model performance may possibly inhibit willingness of part of users to participate in training, so that the model is unwilling to contribute own data, finally the model lacks certain data, while the model increasingly biases towards other user groups, generalization capability is lost, and fairness of a federal model is greatly reduced.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the art described above. Therefore, an object of the present invention is to provide a method for optimizing model parameters for federated learning, which can optimize the model parameters by reducing the gradient contradiction between clients, thereby improving the accuracy and fairness of the federated learning model.
A second object of the invention is to propose a computer-readable storage medium.
A third object of the invention is to propose a computer device.
The fourth purpose of the invention is to provide a model parameter optimization system for federated learning.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a method for optimizing model parameters for federated learning, including the following steps:
obtaining model parameters uploaded by a plurality of clients and training loss values corresponding to the model parameters; calculating a gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding wheel number; sorting the gradient values corresponding to each client according to the training loss values uploaded by each client, and sequentially judging whether contradiction components exist between the gradient values corresponding to each client and other gradient values except the client; if so, sequentially eliminating components of the gradient value corresponding to each client side and the other sorted gradient values in a projection mode to obtain the projected gradient value of each client side; aggregating the gradient values projected by each client to obtain updated initial gradient values; judging whether a contradiction component exists between the updated preliminary gradient value and a history gradient value of a client end which is sampled in the designated turns and has no sampled current turns from the designated turns according to the turns; and if so, eliminating the sum of all contradictory components of the preliminary gradient values and the historical gradient values of the clients which are sampled in the specified round number and have not been sampled in the current round number in a projection mode to obtain the final gradient value. .
According to the method for optimizing the model parameters of the federal learning, firstly, the model parameters uploaded by a plurality of clients and the corresponding training loss values are obtained; then, calculating a gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding number of turns; then, sorting the gradient values corresponding to each client according to the training loss values uploaded by each client, and sequentially judging whether contradiction components exist between the gradient values corresponding to each client and other gradient values except the client; then, if yes, components of the gradient value corresponding to each client and the other sorted gradient values are eliminated in sequence in a projection mode, and the gradient value projected by each client is obtained; then, aggregating the gradient values projected by each client to obtain updated initial gradient values; then, judging whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client side which is sampled in the specified number of rounds and has no sampled current number of rounds from the specified number of rounds; finally, if so, eliminating the sum of all contradictory components of the historical gradient values of the client end which is sampled in the initial gradient values and has no current round number sampled in the appointed round number in a projection mode to obtain a final gradient value; therefore, model parameters can be optimized by reducing gradient contradictions among clients, and therefore accuracy and fairness of the federal learning model are improved.
In addition, the method for optimizing the model parameters for federal learning proposed by the above embodiment of the present invention may also have the following additional technical features:
optionally, when the inner product between the two gradient values is less than zero, determining that a contradiction component exists between the two gradient values; and when the inner product between the two gradient values is greater than or equal to zero, judging that no contradiction component exists between the two gradient values.
Optionally, after the final gradient value is obtained, the step length of the final gradient value is further corrected, so that the model parameter is optimized according to the corrected gradient value.
It should be noted that the step size of the gradient values is potentially increased when the projection operation is eliminated, and for this reason, the step size of the final gradient values needs to be corrected.
Optionally, before obtaining the model parameters uploaded by the multiple clients and the training loss values corresponding to the model parameters, the method further includes: initializing model parameters and a historical gradient table, and broadcasting the model parameters to a plurality of randomly sampled clients respectively; and each client trains the model according to the local data set so as to calculate and obtain new model parameters and corresponding training loss values according to the received model parameters.
To achieve the above object, a second aspect of the present invention provides a computer-readable storage medium having stored thereon a federally learned model parameter optimization program which, when executed by a processor, implements a federally learned model parameter optimization method as described above.
According to the computer-readable storage medium of the embodiment of the invention, the federal-learned model parameter optimization program is stored, so that the processor can realize the above-mentioned federal-learned model parameter optimization method when executing the federal-learned model parameter optimization program, and therefore, the model parameters can be optimized by reducing the gradient contradiction between the clients, and the accuracy and fairness of the federal-learned model can be improved.
In order to achieve the above object, a third embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the computer device implements the method for optimizing the model parameters of federal learning as described above.
According to the computer equipment provided by the embodiment of the invention, the storage is used for storing the model parameter optimization program learned by the federation, so that the processor can realize the above-mentioned model parameter optimization method learned by the federation when executing the model parameter optimization program learned by the federation, therefore, the model parameters can be optimized by reducing the gradient contradiction among the clients, and the accuracy and fairness of the model learned by the federation are improved.
In order to achieve the above object, an embodiment of a fourth aspect of the present invention provides a model parameter optimization system for federated learning, including a server and a plurality of clients, where the server includes: the acquisition module is used for acquiring model parameters uploaded by a plurality of clients and corresponding training loss values; the calculation module is used for calculating a gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding wheel number; the judging module is used for sequencing the gradient values corresponding to the clients according to the training loss values uploaded by the clients and sequentially judging whether contradiction components exist between the gradient values corresponding to the clients and other gradient values except the clients; the first component processing module is used for eliminating the components of the gradient value corresponding to each client side and the other sequenced gradient values in a projection mode in sequence when the contradictory components exist so as to obtain the projected gradient value of each client side; the aggregation module is used for aggregating the gradient values projected by each client to obtain updated initial gradient values; the judging module is further used for judging whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client which is sampled in the specified round number and has no current round number sampled according to the round number from the specified round number; and the second component processing module is used for eliminating the sum of all contradictory components of the preliminary gradient value and the historical gradient value of the client side which is sampled in the specified round number and has no current round number sampled in a projection mode when the contradictory components exist so as to obtain the final gradient value.
According to the model parameter optimization system for federal learning, model parameters uploaded by a plurality of clients and corresponding training loss values are obtained through an obtaining module; the calculation module calculates the gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding wheel number; the judgment module sequences the gradient values corresponding to the clients according to the training loss values uploaded by the clients and sequentially judges whether contradiction components exist between the gradient values corresponding to the clients and other gradient values except the clients; the first component processing module sequentially eliminates components, which are inconsistent with the other sequenced gradient values, corresponding to each client in a projection mode when inconsistent components exist so as to obtain the projected gradient value of each client; the aggregation module aggregates the gradient values projected by each client to obtain updated initial gradient values; the judging module judges whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client side which is sampled in the appointed turns and has no sampled current turns from the appointed turns according to the number of turns; and when the contradictory components exist, the second component processing module eliminates the sum of all contradictory components of the preliminary gradient values and the historical gradient values of the client which are sampled in the appointed round number and have no current round number sampled in a projection mode to obtain the final gradient value. Therefore, model parameters can be optimized by reducing gradient contradiction among clients, and therefore accuracy and fairness of the federal learning model are improved.
Optionally, the determining module is further configured to determine that a contradiction component exists between the two gradient values when an inner product between the two gradient values is less than zero; and when the inner product between the two gradient values is greater than or equal to zero, judging that no contradiction component exists between the two gradient values.
Optionally, the server further includes a correction module, configured to correct a step length of the final gradient value after the final gradient value is obtained, so as to optimize the model parameter according to the corrected gradient value.
Optionally, the server further includes a parameter processing module, configured to initialize the model parameters and the historical gradient table, and broadcast the model parameters to the multiple clients that sample randomly; each client comprises a training module used for training the model according to the local data set so as to calculate and obtain new model parameters and corresponding training loss values according to the received model parameters.
Drawings
FIG. 1 is a schematic flow chart diagram of a method for optimizing model parameters for federated learning according to an embodiment of the present invention;
FIG. 2 is a schematic representation of a federated learning process according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a before-after comparison for eliminating contradictory components between two gradients according to an embodiment of the invention;
FIG. 4 is a schematic structural diagram of a federated-learned model parameter optimization system in accordance with an embodiment of the present invention;
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
In order to better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
Fig. 1 is a schematic flow chart of a federal-learned model parameter optimization method according to an embodiment of the present invention, and as shown in fig. 1, the federal-learned model parameter optimization method includes the following steps:
s101, model parameters uploaded by a plurality of clients and corresponding training loss values are obtained.
It should be noted that, before obtaining the model parameters uploaded by the multiple clients and the training loss values corresponding to the model parameters, the method further includes: initializing model parameters and a historical gradient table, and broadcasting the model parameters to a plurality of randomly sampled clients respectively; and each client trains the model according to the local data set so as to calculate and obtain new model parameters and corresponding training loss values according to the received model parameters.
That is, each client uploads the calculated new model parameters and the training loss values corresponding to the new model parameters to the server, so that the server can obtain the model parameters uploaded by the clients and the training loss values corresponding to the model parameters.
S102, calculating a gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding wheel number.
As an example, the gradient value corresponding to each client is calculated by the following formula:
Figure BDA0003019797370000051
wherein t represents the number of communication rounds, k represents the number of clients, k belongs to {1,2, …, N },
Figure BDA0003019797370000052
represents the gradient value, theta, corresponding to each client in the t-th round(t)Representing the server-side model parameters in the t-th round,
Figure BDA0003019797370000053
and representing the model parameters uploaded by each client in the t round.
S103, ranking the gradient values corresponding to the clients according to the training loss values uploaded by the clients, and sequentially judging whether contradiction components exist between the gradient values corresponding to the clients and other gradient values except the clients.
It should be noted that if the inner product between the gradient value corresponding to each client and the other gradient values except the client is smaller than zero, it is determined that a contradiction component exists between the two gradient values; if the gradient value is larger than or equal to zero, the contradiction component does not exist between the two gradient values.
And S104, if so, sequentially eliminating components of the gradient value corresponding to each client and the other sorted gradient values in a projection mode to obtain the projected gradient value of each client.
As an example, the gradient value after each client projection is calculated by the following formula:
Figure BDA0003019797370000061
wherein the content of the first and second substances,
Figure BDA0003019797370000062
representing the gradient value after each client in the t-th round is projected,
Figure BDA0003019797370000063
representing the gradient values of each client except the client in the t-th round.
And S105, aggregating the gradient values projected by each client to obtain an updated initial gradient value.
As an example, the updated preliminary gradient value is obtained by the following formula:
Figure BDA0003019797370000064
wherein, g(t)Representing the updated preliminary gradient values;
Figure BDA0003019797370000065
representing the gradient value after each client projection in the k-th round.
Therefore, the invention designs a method for eliminating the gradient contradiction between the clients through projection according to the training loss order, so that the contradiction between the finally aggregated gradient and the gradient of the client with worse optimization is smaller, and the fairness is realized.
And S106, judging whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client side which is sampled in the specified round number and has no sampled current round number according to the round number from the specified round number.
The designated number of rounds is a certain round among the previous rounds in the current number of rounds, and can be designated by the user according to actual needs.
And S107, if so, eliminating the sum of all contradictory components of the preliminary gradient values and the history gradient values of the client which are sampled in the specified round number and have not been sampled in the current round number in a projection mode to obtain the final gradient value.
That is, if there are contradictory components, the sum of all contradictory components in the preliminary gradient values and the historical gradient values of the clients that are sampled in the specified round number and whose current round number is not sampled is eliminated in a projection manner to obtain the final gradient value.
As an example, assuming that the current round number is 7 rounds, and the designated round number is 3 rounds, it is determined whether there is a contradiction component between the updated preliminary gradient value obtained in the 7 th round and the historical gradient values of all clients sampled in the 3 rd round and not sampled in the 7 th round, if there is a contradiction component, the sum of all contradiction components in the 3 rd round that contradict the updated preliminary gradient value obtained in the 7 th round is calculated, and the sum of all contradiction components in the updated preliminary gradient value obtained in the 7 th round is eliminated in a projection manner, then the contradiction component in the designated round number is 4 rounds is calculated in the manner described above, and so on until the 6 th round.
It should be noted that, because communication resources are limited, only part of clients are selected by the server side in each round of training, so that sampling deviation is easy to occur, and for this reason, the component inconsistent with the gradient value of each client in the previous round of training is eliminated from front to back in a projection manner according to the time sequence, so as to reduce the negative influence of the sampling deviation occurring when the server selects the clients, thereby improving the accuracy and fairness of the federal learning model.
As a specific embodiment, the gradient value g after updating and the gradient value g in the client with the number of rounds i of the history gradient table GH of the client are calculated by the following formula(t)Summation of conflicting client gradients:
Figure BDA0003019797370000071
then, the server side eliminates the data through the following formulaNew gradient value g(t)Neutralization of
Figure BDA0003019797370000072
The contradictory components:
Figure BDA0003019797370000073
wherein, g(t),Representing the final gradient values.
As an example, after the final gradient value is obtained, the step size of the final gradient value is also corrected, so as to optimize the model parameter according to the corrected gradient value.
It should be noted that the step size of the gradient values is potentially increased when the projection operation is eliminated, and for this reason, the step size of the final gradient values needs to be corrected.
As a specific embodiment, the server side corrects the step size of the final gradient value by the following formula:
Figure BDA0003019797370000074
wherein, g(t),,Representing the corrected gradient values.
It should be noted that the server passes through θ(t+1)=θ(t)-g(t),,Updating the model parameters, wherein θ(t+1)The optimized model parameters are obtained; and if the number of training rounds reaches the specified number of rounds or the average training loss meets the requirement, stopping training, otherwise, repeating the steps to perform a new round of model parameter optimization so as to perform model training.
In summary, according to the method for optimizing the model parameters for federal learning in the embodiment of the present invention, first, the model parameters uploaded by a plurality of clients and the training loss values corresponding to the model parameters are obtained; then, calculating a gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding number of turns; then, sorting the gradient values corresponding to each client according to the training loss values uploaded by each client, and sequentially judging whether contradiction components exist between the gradient values corresponding to each client and other gradient values except the client; then, if yes, components of the gradient value corresponding to each client and the other sorted gradient values are eliminated in sequence in a projection mode, and the gradient value projected by each client is obtained; then, aggregating the gradient values projected by each client to obtain updated initial gradient values; then, judging whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client side which is sampled in the specified number of rounds and has no sampled current number of rounds from the specified number of rounds; finally, if so, eliminating the sum of all contradictory components of the historical gradient values of the client end which is sampled in the initial gradient values and has no current round number sampled in the appointed round number in a projection mode to obtain a final gradient value; therefore, model parameters can be optimized by reducing gradient contradiction among clients, and accordingly fairness of the federal learning model is improved.
As shown in fig. 2 and 3, in order to better understand the above technical solution, the technical solution of the present invention is described in more detail by a specific embodiment as follows:
step A, initializing and broadcasting parameters by a server side.
Step A.1, the server side initializes the deep learning model parameter theta(0)User history gradiometer
Figure BDA0003019797370000081
The communication round number t is 0, the privileged user ratio alpha and the historical projection round number tau.
Step A.2, the server side slave user set
Figure BDA0003019797370000082
Randomly sampling a user subset S with the size of K(t)={ckIs equal to {1,2, …, N }, and is equal to the model parameter theta of the current round(t)Broadcast to S(t)To the user in (1).
And step B, the client locally trains the model.
Step B.1, selected user c in the t roundiReceiving model parameter theta from server side(t)
Step B.2, user ckUsing local data sets
Figure BDA0003019797370000083
Repeatedly training the model theta according to the learning rate eta and the batch size B(t)E local rounds are counted, and new model parameters are calculated
Figure BDA0003019797370000084
And loss of training
Figure BDA0003019797370000085
And sending to the server side.
And step C, the server receives the parameters.
Step C.1, the server receives the information from S(t)The data uploaded by the user obtains the updated model parameters of the user
Figure BDA0003019797370000086
And their respective corresponding training losses
Figure BDA0003019797370000087
Step C.2, the server side calculates the gradient of each user
Figure BDA0003019797370000088
Deriving a set of user gradients
Figure BDA0003019797370000089
And updating user history gradient table
Figure BDA00030197973700000810
And D, eliminating the gradient contradiction among the users in the current round by the server.
Step D.1, the server-side sorts the user gradient according to the uploaded user training loss magnitude to obtain a sorted user gradient array
Figure BDA00030197973700000811
Wherein the order of the users corresponding to the gradient should satisfy
Figure BDA00030197973700000812
Step D.2, for POtAnterior gradient of
Figure BDA00030197973700000813
Sequentially judging the gradient and POtIndividual gradients in the array
Figure BDA00030197973700000814
(excluding itself) whether the inner product is less than 0; if the value is larger than 0, the contradiction component does not exist; if less than 0, the gradient and PO are indicatedtGradients in the array
Figure BDA00030197973700000815
Existence of contradictory components, iterative cancellation
Figure BDA00030197973700000816
The contradictory components in (1):
Figure BDA0003019797370000091
finally obtaining the projected gradient of each user
Figure BDA0003019797370000092
Step D.3, polymerizing the gradient after eliminating the contradiction to obtain a primary gradient
Figure BDA0003019797370000093
And E, correcting the sampling deviation by the server side.
E.1, directly jumping to the step A.2 if the current round number t is less than or equal to tau; otherwise, let i be t- τ.
Step E.2, the server calculates the user gradient with the number of rounds i of the user historical gradient GH and the preliminary gradient g(t)Summation of conflicting user gradients
Figure BDA0003019797370000094
Step E.3, the server side eliminates the preliminary gradient g(t)Neutralization of
Figure BDA0003019797370000095
Contradictory components
Figure BDA0003019797370000096
Step E.4, let i equal i +1, if i < t, jump to step e.1, otherwise continue.
And F, updating the model parameters by the server side.
Step F.1, in order to eliminate the effect of the projection operation potentially increasing the step size, the server corrects the step size of the final gradient to
Figure BDA0003019797370000097
F.2, updating the model parameter theta at the server side(t+1)=θ(t)-g(t),,. If the number of training rounds reaches the specified number of rounds or the average training loss meets the requirement, stopping training, otherwise, skipping to the step A.2.
Therefore, the invention provides a method for eliminating gradient contradiction between users through projection according to the training loss order, so that the contradiction between the finally aggregated gradient and the gradient of the user with worse optimization is smaller, and fairness is realized; and the method for eliminating the sampling bias from front to back according to the time sequence by projection is provided, so that the negative influence of the sampling bias when the server selects the user is reduced, and the accuracy and the fairness of the federal learning model are improved.
To implement the above embodiments, embodiments of the present invention provide a computer-readable storage medium having stored thereon a federally learned model parameter optimization program that, when executed by a processor, implements a federally learned model parameter optimization method as described above.
According to the computer-readable storage medium of the embodiment of the invention, the federal-learned model parameter optimization program is stored, so that the processor can realize the above-mentioned federal-learned model parameter optimization method when executing the federal-learned model parameter optimization program, and therefore, the model parameters can be optimized by reducing the gradient contradiction between the clients, and the fairness of the federal-learned model can be improved.
In order to implement the foregoing embodiments, an embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the computer device implements the above federally learned model parameter optimization method.
According to the computer equipment provided by the embodiment of the invention, the storage is used for storing the federally learned model parameter optimization program, so that the processor can realize the above-mentioned federally learned model parameter optimization method when executing the federally learned model parameter optimization program, and therefore, the model parameters can be optimized by reducing the gradient contradiction among the clients, and the fairness of the federally learned model is improved.
In addition, as shown in fig. 4, an embodiment of the present invention further provides a model parameter optimization system for federal learning, including a server 1 and a plurality of clients 2, where the server 1 includes: the acquisition module 11 is configured to acquire model parameters uploaded by a plurality of clients and training loss values corresponding to the model parameters; a calculating module 12, configured to calculate a gradient value corresponding to each client according to the model parameter, so as to update a historical gradient list according to the gradient value, where the historical gradient list includes the gradient value of each client and a corresponding number of rounds; the judging module 13 is configured to sort the gradient values corresponding to each client according to the training loss values uploaded by each client, and sequentially judge whether a contradiction component exists between the gradient value corresponding to each client and other gradient values except the client; the first component processing module 14 is configured to sequentially eliminate components, in which the gradient value corresponding to each client conflicts with the sorted other gradient values, in a projection manner when conflicting components exist, so as to obtain a gradient value after projection of each client; the aggregation module 15 is configured to aggregate the gradient values projected by each client to obtain an updated preliminary gradient value; the judging module 13 is further configured to judge, according to the number of rounds from the specified number of rounds, whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client that is sampled in the specified number of rounds and has not been sampled at the current number of rounds; when there are contradictory components, the second component processing module 16 eliminates the sum of all contradictory components in the preliminary gradient values and the historical gradient values of the clients which are sampled in the designated round number and have not been sampled in the current round number in a projection manner, so as to obtain a final gradient value.
As an example, the determining module 13 is further configured to determine that a contradiction component exists between the two gradient values when an inner product between the two gradient values is less than zero; and when the inner product between the two gradient values is greater than or equal to zero, judging that no contradiction component exists between the two gradient values.
As an example, the server side 1 further includes a modification module 17, configured to modify the step size of the final gradient value after obtaining the final gradient value, so as to optimize the model parameter according to the modified gradient value.
As an example, the server 1 further includes a parameter processing module 18, configured to initialize the model parameters and the historical gradient table, and broadcast the model parameters to the plurality of randomly sampled clients respectively; each client includes a training module 21, configured to train a model according to the local data set, so as to calculate a new model parameter and a training loss value corresponding to the new model parameter according to the received model parameter.
It should be noted that the above description and examples of the method for optimizing the model parameters related to the federal learning are also applicable to the system for optimizing the model parameters related to the federal learning in this embodiment, and are not repeated herein.
In summary, according to the federate learning model parameter optimization system of the embodiment of the present invention, the model parameters uploaded by the plurality of clients and the training loss values corresponding to the model parameters are obtained by the obtaining module; the calculation module calculates the gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding wheel number; the judgment module sequences the gradient values corresponding to the clients according to the training loss values uploaded by the clients and sequentially judges whether contradiction components exist between the gradient values corresponding to the clients and other gradient values except the clients; the first component processing module sequentially eliminates components, which are inconsistent with the other sequenced gradient values, corresponding to each client in a projection mode when inconsistent components exist so as to obtain the projected gradient value of each client; the aggregation module aggregates the gradient values projected by each client to obtain updated initial gradient values; the judging module judges whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client side which is sampled in the appointed turns and has no sampled current turns from the appointed turns according to the number of turns; and when the contradictory components exist, the second component processing module eliminates the sum of all contradictory components of the preliminary gradient values and the historical gradient values of the client which are sampled in the appointed round number and have no current round number sampled in a projection mode to obtain the final gradient value. Therefore, model parameters can be optimized by reducing gradient contradiction among clients, and therefore accuracy and fairness of the federal learning model are improved. .
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above should not be understood to necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. A method for optimizing model parameters of federated learning is characterized by comprising the following steps:
obtaining model parameters uploaded by a plurality of clients and training loss values corresponding to the model parameters;
calculating a gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding wheel number;
sorting the gradient values corresponding to each client according to the training loss values uploaded by each client, and sequentially judging whether contradiction components exist between the gradient values corresponding to each client and other gradient values except the client;
if so, sequentially eliminating components of the gradient value corresponding to each client side and the other sorted gradient values in a projection mode to obtain the projected gradient value of each client side;
aggregating the gradient values projected by each client to obtain updated initial gradient values;
judging whether a contradiction component exists between the updated preliminary gradient value and a history gradient value of a client end which is sampled in the designated turns and has no sampled current turns from the designated turns according to the turns;
and if so, eliminating the sum of all contradictory components of the preliminary gradient values and the historical gradient values of the clients which are sampled in the specified round number and have not been sampled in the current round number in a projection mode to obtain the final gradient value.
2. The method of federally learned model parameter optimization of claim 1, wherein, when an inner product between two gradient values is less than zero, it is determined that there is a contradiction component between the two gradient values; and when the inner product between the two gradient values is greater than or equal to zero, judging that no contradiction component exists between the two gradient values.
3. The method for optimizing federally learned model parameters of any one of claims 1-2, wherein after a final gradient value is obtained, a step size of the final gradient value is also modified so that the model parameters are optimized according to the modified gradient value.
4. The method for optimizing model parameters for federal learning according to any one of claims 1 to 3, wherein before obtaining model parameters uploaded by a plurality of clients and corresponding training loss values, the method further comprises:
initializing model parameters and a historical gradient table, and broadcasting the model parameters to a plurality of randomly sampled clients respectively;
and each client trains the model according to the local data set so as to calculate and obtain new model parameters and corresponding training loss values according to the received model parameters.
5. A computer readable storage medium having stored thereon a federally learned model parameters optimizer that, when executed by a processor, implements a method of federally learned model parameters optimization as claimed in any of claims 1-4.
6. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the program, implements the method for federally learned model parameter optimization as in any of claims 1-4.
7. The model parameter optimization system for federated learning is characterized by comprising a server and a plurality of clients, wherein the server comprises:
the acquisition module is used for acquiring model parameters uploaded by a plurality of clients and corresponding training loss values;
the calculation module is used for calculating a gradient value corresponding to each client according to the model parameters so as to update a historical gradient list according to the gradient values, wherein the historical gradient list comprises the gradient value of each client and the corresponding wheel number;
the judging module is used for sequencing the gradient values corresponding to the clients according to the training loss values uploaded by the clients and sequentially judging whether contradiction components exist between the gradient values corresponding to the clients and other gradient values except the clients;
the first component processing module is used for eliminating the components of the gradient value corresponding to each client side and the other sequenced gradient values in a projection mode in sequence when the contradictory components exist so as to obtain the projected gradient value of each client side;
the aggregation module is used for aggregating the gradient values projected by each client to obtain updated initial gradient values;
the judging module is further used for judging whether a contradiction component exists between the updated preliminary gradient value and the historical gradient value of the client which is sampled in the specified round number and has no current round number sampled according to the round number from the specified round number;
and the second component processing module is used for eliminating the sum of all contradictory components of the preliminary gradient value and the historical gradient value of the client side which is sampled in the specified round number and has no current round number sampled in a projection mode when the contradictory components exist so as to obtain the final gradient value.
8. The federally learned model parameter optimization system of claim 7, wherein the determination module is further configured to determine that a contradicting component exists between two gradient values when an inner product between the two gradient values is less than zero; and when the inner product between the two gradient values is greater than or equal to zero, judging that no contradiction component exists between the two gradient values.
9. The system of claim 8, wherein the server further comprises a modification module configured to modify a step size of the final gradient value after obtaining the final gradient value, so as to optimize the model parameter according to the modified gradient value.
10. The system for optimizing model parameters for federal learning as in any one of claims 7-9, wherein the server further comprises a parameter processing module for initializing model parameters and a historical gradient table and broadcasting the model parameters to the plurality of clients for random sampling respectively; each client comprises a training module used for training the model according to the local data set so as to calculate and obtain new model parameters and corresponding training loss values according to the received model parameters.
CN202110399316.2A 2021-04-14 2021-04-14 Model parameter optimization method and system for federal learning Pending CN113326949A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110399316.2A CN113326949A (en) 2021-04-14 2021-04-14 Model parameter optimization method and system for federal learning

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110399316.2A CN113326949A (en) 2021-04-14 2021-04-14 Model parameter optimization method and system for federal learning

Publications (1)

Publication Number Publication Date
CN113326949A true CN113326949A (en) 2021-08-31

Family

ID=77414943

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110399316.2A Pending CN113326949A (en) 2021-04-14 2021-04-14 Model parameter optimization method and system for federal learning

Country Status (1)

Country Link
CN (1) CN113326949A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113902131A (en) * 2021-12-06 2022-01-07 中国科学院自动化研究所 Updating method of node model for resisting discrimination propagation in federal learning
CN114819192A (en) * 2022-06-28 2022-07-29 医渡云(北京)技术有限公司 Federal learning method and device, computer readable storage medium and electronic equipment
CN114996733A (en) * 2022-06-07 2022-09-02 光大科技有限公司 Aggregation model updating processing method and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113902131A (en) * 2021-12-06 2022-01-07 中国科学院自动化研究所 Updating method of node model for resisting discrimination propagation in federal learning
CN114996733A (en) * 2022-06-07 2022-09-02 光大科技有限公司 Aggregation model updating processing method and device
CN114996733B (en) * 2022-06-07 2023-10-20 光大科技有限公司 Aggregation model updating processing method and device
CN114819192A (en) * 2022-06-28 2022-07-29 医渡云(北京)技术有限公司 Federal learning method and device, computer readable storage medium and electronic equipment
CN114819192B (en) * 2022-06-28 2022-09-13 医渡云(北京)技术有限公司 Federal learning method and device, computer readable storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN113326949A (en) Model parameter optimization method and system for federal learning
CN110610242A (en) Method and device for setting participant weight in federated learning
CN110378488B (en) Client-side change federal training method, device, training terminal and storage medium
CN108596800B (en) Bayes-based open answer decision method
CN111327355B (en) Unmanned aerial vehicle edge perception calculation and joint transmission method, device, medium and equipment
CN111723947A (en) Method and device for training federated learning model
CN110674925B (en) No-reference VR video quality evaluation method based on 3D convolutional neural network
CN112990478B (en) Federal learning data processing system
CN113691594B (en) Method for solving data imbalance problem in federal learning based on second derivative
CN115775026B (en) Federal learning method based on tissue similarity
CN111222553B (en) Training data processing method and device of machine learning model and computer equipment
CN114169543A (en) Federal learning algorithm based on model obsolescence and user participation perception
CN111061624A (en) Policy execution effect determination method and device, electronic equipment and storage medium
CN114912626A (en) Method for processing distributed data of federal learning mobile equipment based on summer pril value
CN114021735A (en) Method and device for processing data in federated learning
CN114116705A (en) Method and device for determining contribution value of participants in joint learning
CN114332550A (en) Model training method, system, storage medium and terminal equipment
CN115496121A (en) Model training method and device based on federal learning
CN117196058A (en) Fair federation learning method based on node contribution clustering
CN111292062A (en) Crowdsourcing garbage worker detection method and system based on network embedding and storage medium
CN114866272B (en) Multi-round data delivery system of true value discovery algorithm in crowd-sourced sensing environment
CN114401192B (en) Multi-SDN controller cooperative training method
CN113411354B (en) Data transmission method based on public cloud
CN110689035B (en) User classification method, storage medium, electronic device and system
CN117172333A (en) Federal learning equipment scheduling method based on model loss tolerance

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination