A model training system and method based on federated learning

By adjusting the learning rate and using a secret-sharing algorithm in federated learning, the model training conflict caused by the non-independent and identically distributed nature of power data is resolved, achieving efficient and secure model optimization and privacy protection.

CN115758127BActive Publication Date: 2026-01-13GLOBAL ENERGY INTERCONNECTION RES INST CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111020735.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-01
Publication Date
2026-01-13
Estimated Expiration
2041-09-01

AI Technical Summary

Technical Problem

In federated learning, due to the non-independent and identically distributed nature of power data, there are significant conflicts among clients in training the initial model. In particular, complex power machine learning models or high-dimensional non-convex neural network models are difficult to guarantee the effectiveness of model co-construction.

Method used

A federated learning-based model training system is adopted. The training process is divided into early and late stages, the learning rate is adjusted, and the model update value is split into multiple secret share values ​​using a secret sharing algorithm. The server cannot obtain the complete update value. At the same time, the addition or multiplication homomorphism algorithm is used for encrypted sharing. The training process is optimized by combining additional constraints and regularization coefficients.

Benefits of technology

It resolves path conflicts during training on different clients, improves model training efficiency and security, ensures model performance and privacy protection, and avoids the limitations of local optima.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115758127B_ABST
    Figure CN115758127B_ABST
Patent Text Reader

Abstract

The application provides a model training system and method based on federated learning. The system comprises a plurality of clients and a plurality of servers. The client comprises: a model training module for training an initial model to obtain a model update value according to a local training set; the training process comprises an early training stage and a late training stage. The learning rate of the early training stage is obtained by expanding the early basic learning rate by several times. The learning rate of the late training stage is obtained by reducing the late basic learning rate by several times. A parameter sharing module is used to calculate a plurality of secret sharing values from the model update value and send the secret sharing values to each server. The server is used to calculate an aggregated update value from the secret sharing values. A model generation module is used to calculate the true value of the model update from the aggregated update value and update the initial model to obtain an optimized model. By executing the application, path conflicts generated when each client jointly trains the same initial model can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer learning technology, and specifically to a model training system and method based on federated learning. Background Technology

[0002] Electricity data can provide effective support for decision-making in the energy industry, including production, sales, and services. However, electricity data is both public and involves user privacy and enterprise operational information, requiring careful attention to privacy protection during sharing and open access. Electricity data is characterized by its large volume, broad business scope, wide geographical reach, rapid growth, and high real-time requirements, placing unique demands on security technologies for open sharing.

[0003] Federated learning provides a privacy-preserving distributed machine learning framework. In this framework, multiple clients train an initial model together, ensuring data privacy and security. However, due to differences in geography, climate, industrial structure, and user proportion across different regions, the training data used by each client for model training suffers from a serious "non-independent and identically distributed" problem. This leads to conflicts between the models trained by each client, especially for complex power machine learning models or high-dimensional non-convex neural network models, making it difficult to guarantee the effectiveness of model co-construction.

[0004] While some strategies exist to aggregate conflicting information uploaded from multiple sources, only improvements to the training algorithm can fundamentally prevent conflicts and reduce the impact of data distribution differences. Summary of the Invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the defect in the prior art that the differences in data distribution lead to significant conflicts in the training of the initial model by different clients, thereby providing a model training system and method based on federated learning.

[0006] The first aspect of this invention provides a model training system based on federated learning, including multiple clients and multiple servers. Each client includes a model training module, a parameter sharing module, and a model generation module. The model training module trains an initial model using a local training set to obtain model update values. The learning rate in the early training phase is obtained by multiplying the initial base learning rate by a certain factor, while the learning rate in the later training phase is obtained by reducing the later base learning rate by a certain factor. The parameter sharing module calculates multiple secret sharing values ​​using a secret sharing algorithm and sends these secret sharing values ​​to each server. The number of secret sharing values ​​is the same as the number of servers. Since each client has a different local training set, the obtained model update values ​​and secret sharing values ​​are also different. The servers calculate an aggregate update value based on the secret sharing values ​​sent by each client and send the aggregate update value to each client. The model generation module calculates the true update value of the model based on the aggregate update value sent by each server and updates the initial model based on the true value to obtain an optimized model.

[0007] Optionally, in the federated learning-based model training system provided by the present invention, the secret sharing algorithm for calculating the model update value is determined by the homomorphism corresponding to the initial model.

[0008] Optionally, in the federated learning-based model training system provided by the present invention, the parameter sharing module includes: a first shared value generation submodule, which generates random numbers, determines the random numbers as the first shared value, and sends the first shared value to the first server if the homomorphism corresponding to the initial model is additive homomorphism; and a second shared value generation submodule, which performs a modulo operation on the difference between the model update value and the first shared value to obtain a second shared value, and sends the second shared value to the second server if the homomorphism corresponding to the initial model is additive homomorphism.

[0009] Optionally, in the federated learning-based model training system provided by the present invention, the server determines the average of the secret sharing values ​​sent by each client as the aggregated update value.

[0010] Optionally, in the federated learning-based model training system provided by the present invention, the model generation module includes: a secret recovery submodule, used to perform a modulo operation on the sum of the aggregated update value sent by the first server and the aggregated update value sent by the second server to obtain the true value of the model update; and a model generation submodule, used to update the initial model according to the true value of the model update to obtain an optimized model.

[0011] Optionally, in the federated learning-based model training system provided by the present invention, if the homomorphism corresponding to the initial model is multiplicative homomorphism, the server includes: a triple generation module for generating triples; an intermediate value generation module for calculating intermediate values ​​based on the triples and the secret sharing value; an intermediate value merging module for merging the intermediate values ​​with the intermediate values ​​generated by other servers in the system to form a merged intermediate value; other servers calculate their respective intermediate values ​​based on their respective triples and their respective received secret sharing values; and an aggregation update value calculation module for calculating the aggregation update value based on the triples, the merged intermediate value, and the secret sharing value.

[0012] Optionally, in the federated learning-based model training system provided by the present invention, the model generation module includes: a secret recovery submodule, used to perform a modulo operation on the sum of the aggregated update values ​​sent by each server to obtain the true value of the model update; and a model generation submodule, used to update the initial model according to the true value of the model update to obtain an optimized model.

[0013] Optionally, in the federated learning-based model training system provided by this invention, the loss function used during the initial model training process consists of a conventional loss function and additional constraint terms: Where, θ * Let N represent the target parameters, N represent the number of samples in the local training set, L represent the conventional loss function, and x represent the target parameters. (n) and y (n) Let λ||θ-θ represent the feature vector and label of the nth sample, respectively, where f is the learner, and λ||θ-θ 0 || 2 For additional constraints, λ represents the strength of the additional constraints, and θ 0 θ refers to the initial parameter, and θ represents the current parameter.

[0014] Optionally, in the federated learning-based model training system provided by the present invention, the regularization coefficient used when training the initial model is several times the value of the regularization coefficient.

[0015] The second aspect of this invention provides a model training method based on federated learning, applied to a client, comprising: training an initial model based on a local training set to obtain model update values; the training process of the initial model includes an early training phase and a later training phase, wherein the learning rate in the early training phase is obtained by multiplying the early base learning rate by a certain factor, and the learning rate in the later training phase is obtained by reducing the later base learning rate by a certain factor; calculating multiple secret share values ​​for the model update values ​​using a secret sharing algorithm, and sending the secret share values ​​to each server respectively, wherein the number of secret share values ​​is the same as the number of servers; each client has a different local training set, and the obtained model update values ​​and secret share values ​​are also different; calculating the true value of the model update based on the aggregated update values ​​sent by each server, and updating the initial model based on the true value to obtain an optimized model; the aggregated update value is calculated by the server based on the secret share values ​​sent by each client.

[0016] A third aspect of this invention provides a model training method based on federated learning, applied to a server, comprising: receiving secret-shared values ​​sent by each client; calculating an aggregated update value based on the secret-shared values ​​sent by each client; and sending the aggregated update value to each client, enabling the client to calculate the true value of the model update based on the aggregated update value, and update the initial model based on the true value to obtain an optimized model; the secret-shared value is obtained by the server training the initial model on a local training set to obtain the model update value, and then calculating the model update value using a secret-shared algorithm. The initial model training process includes an early training phase and a later training phase. The learning rate in the early training phase is obtained by multiplying the early base learning rate by a certain factor, and the learning rate in the later training phase is obtained by reducing the later base learning rate by a certain factor. The number of secret-shared values ​​calculated by each client is the same as the number calculated by the server. Different clients have different local training sets, resulting in different model update values ​​and secret-shared values.

[0017] A fourth aspect of the present invention provides a computer device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to perform a federated learning-based model training method as provided in the second or third aspect of the present invention.

[0018] The fifth aspect of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions for causing a computer to execute a model training method based on federated learning as provided in the second or third aspect of the present invention.

[0019] The technical solution of this invention has the following advantages:

[0020] 1. The federated learning-based model training system provided by this invention divides the training process into an early training stage and a late training stage when each client trains the initial model based on its local training set. The learning rate in the early training stage is obtained by multiplying the base learning rate by several times, while the learning rate in the late training stage is obtained by reducing the base learning rate by several times. When executing this invention, the learning rate decreases rapidly during the transition from the early training stage to the late training stage as the client trains the initial model. This solves the problem of path conflicts when aggregating the gradients of the parameters trained by each client, caused by the large gap between the randomly initialized network and the optimal solution, and the different optimal solutions targeted by each client when training the initial model. Thus, each client is not limited to the local optimal solution when training the initial model, and at the same time avoids the path conflicts caused when each client uses different local training sets to train the same initial model.

[0021] Furthermore, in the federated learning-based model training system provided by this invention, after the client trains the initial model and obtains the model update value, it also uses a secret sharing algorithm to split the model update value into multiple different secret sharing values, and sends each secret sharing value to a different server. None of the servers in the system can obtain the complete model update value, thus ensuring the security of the model training process.

[0022] 2. The federated learning-based model training system provided by this invention, when the homomorphism corresponding to the initial model is additive homomorphism, determines the generated random number as the first sharing value. After performing a modulo operation on the first sharing value, the difference between the model update value and the value obtained after performing a modulo operation on the first sharing value is determined as the second sharing value. The secret sharing algorithm provided by this invention can quickly complete the encrypted sharing of the model update value, thereby improving the efficiency of model training.

[0023] 3. The federated learning-based model training system provided by this invention uses a loss function formed by adding additional constraints to the conventional loss function when the client trains the initial model. The additional constraints can limit the Euclidean distance between the target model and the initial model, further limiting the space of the target solution to the vicinity of the initial solution. This prevents model shift caused by different clients using different local training sets to train the initial model, thereby improving model performance and efficiency.

[0024] 4. The federated learning-based model training system provided by this invention uses a regularization coefficient that is several times higher than the regularization coefficient when the client trains the initial model. By increasing the regularization coefficient to a certain extent, the search space of each client participating in the training can be significantly compressed, the model complexity can be limited, the number of candidate solutions can be reduced, and the probability of path conflicts in the search for the optimal value can be reduced.

[0025] 5. The federated learning-based model training method provided by this invention divides the training process into an early training stage and a late training stage when the client trains the initial model based on the local training set. The learning rate in the early training stage is obtained by multiplying the basic learning rate in the early stage by a certain factor, and the learning rate in the late training stage is obtained by reducing the basic learning rate in the late stage by a certain factor. When executing this invention, the learning rate decreases rapidly during the transition from the early training stage to the late training stage as the client trains the initial model. This solves the problem of path conflict when aggregating the gradients of the parameters trained by each client, caused by the large gap between the randomly initialized network and the optimal solution, and the different optimal solutions that each client points to when training the initial model. This ensures that each client is not limited to the local optimal solution when training the initial model, and avoids path conflicts caused by each client training the same initial model using different local training sets.

[0026] Furthermore, in the federated learning-based model training method provided by this invention, after the client trains the initial model and obtains the model update value, it also uses a secret sharing algorithm to split the model update value into multiple different secret sharing values, and sends each secret sharing value to a different server. None of the servers in the system can obtain the complete model update value, thus ensuring the security of the model training process.

[0027] 6. The federated learning-based model training method provided by this invention involves the server calculating an aggregated update value based on the secret sharing value sent by each client. This allows the client to calculate the true update value of the model based on the aggregated update value and update the initial model using the true value to obtain an optimized model. The secret sharing value is obtained by the server training the initial model on its local training set and then calculating the model update value using a secret sharing algorithm. The initial model training process includes an early training phase and a later training phase. The learning rate in the early training phase is obtained by multiplying the initial base learning rate by a certain factor, while the learning rate in the later training phase is obtained by reducing the later base learning rate by a certain factor. During the client's training of the initial model, the transition from the early training phase to the later training phase... The rapid decrease in learning rate resolves the path conflict issues caused by the large gap between randomly initialized networks and the optimal solution, as well as the different optimal solutions targeted by each client when training the initial model. This prevents clients from being limited to local optima when training the initial model and avoids path conflicts arising when clients train the same initial model using different local training sets. Furthermore, in the federated learning-based model training method provided by this invention, after the client obtains the model update value through training the initial model, a secret sharing algorithm is used to split the model update value into multiple different secret sharing values, which are then sent to different servers. None of the servers in the system can obtain the complete model update value, ensuring the security of the model training process. Attached Figure Description

[0028] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0029] Figure 1 This is a principle block diagram of a specific example of a federated learning-based model training system in an embodiment of the present invention.

[0030] Figure 2 This is a flowchart illustrating a specific example of a model training method based on federated learning in an embodiment of the present invention.

[0031] Figure 3 This is a schematic diagram illustrating a specific example of a computer device in an embodiment of the present invention. Detailed Implementation

[0032] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] In the description of this invention, it should be noted that the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0034] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0035] This invention provides a model training system based on federated learning, such as... Figure 1 As shown, it includes multiple clients and multiple servers. Each client includes a model training module 11, a parameter sharing module 12, and a model generation module 13.

[0036] Model training module 11 is used to train the initial model based on the local training set to obtain the model update value: θ j =F(Θ,D) j ), where Θ represents the initial model, D j Let θ represent the local training set of the j-th client. j This represents the model update value for the j-th client.

[0037] In one alternative embodiment, each client trains the same initial model. Since the different clients are in different environments, the local training sets collected by the different clients are also different, resulting in different model update values.

[0038] The initial model training process includes a pre-training phase and a post-training phase. The learning rate in the pre-training phase is obtained by multiplying the pre-training base learning rate by a certain factor, while the learning rate in the post-training phase is obtained by reducing the pre-training base learning rate by a certain factor.

[0039] In one optional embodiment, the federated learning algorithm is typically based on a centralized training algorithm. The initial base learning rate and the later base learning rate are determined based on the learning rate of each round in the centralized training. The learning rate in the initial training phase can be obtained by increasing the initial base learning rate by 2-10 times, and the learning rate in the later training phase can be 1 / 10 to 1 / 100 of the later base learning rate.

[0040] In one alternative embodiment, the training process can be divided into an early training phase and a late training phase according to the number of training epochs of the initial model. For example, the first quarter of the training epochs can be determined as the early training phase, and the last three-quarters of the training epochs can be determined as the late training phase.

[0041] For example, in the embodiment shown in the table below, the initial model is trained for 100 rounds. Rounds 0-25 are defined as the early training phase, rounds 25-75 as the later training phase, and rounds 75-100 as the final training phase. The learning rate in the early training phase is twice the initial base learning rate, the learning rate in the later training phase is 1 / 10 of the later base learning rate, and the learning rate in the final training phase is 1 / 100 of the final base learning rate.

[0042] Table 1

[0043]

[0044] By setting a higher learning rate in the early training phase and a lower learning rate in the later training phase, the learning rate decreases rapidly during the transition from the early to the later training phase. This solves the problem of path conflicts when aggregating gradients of parameters trained by different clients, which is caused by the large gap between randomly initialized networks and the optimal solution, and the different optimal solutions that different clients are pointing to when training the initial model. This ensures that each client is not limited to local optima when training the initial model, and avoids path conflicts that occur when different clients train the same initial model using different local training sets.

[0045] The parameter sharing module 12 is used to calculate multiple secret sharing values ​​for the model update value using a secret sharing algorithm, and send the secret sharing values ​​to each server respectively. The number of secret sharing values ​​is the same as the number of servers. Since each client has a different local training set, the model update value and secret sharing value obtained are also different.

[0046] In an alternative embodiment, such as Figure 1 In the illustrated embodiment, when there are three clients (b1, b2, b3) and two servers (a1, a2), each client calculates two secret sharing values ​​based on its own model update value, and then sends the two secret sharing values ​​to the two servers respectively. Each server receives three different secret sharing values.

[0047] In one optional embodiment, the secret sharing value is obtained by splitting the model update value. Generally, the multiple secret sharing values ​​obtained by splitting the model update value are different from each other.

[0048] In one optional embodiment, the Shamir algorithm based on the Lagrange interpolation formula, the secret sharing algorithm based on one-way functions, the secret sharing algorithm based on polynomials, etc., can all be used to calculate the model update value to obtain the secret sharing value.

[0049] After the client trains the initial model and obtains the model update value, it uses a secret sharing algorithm to split the model update value into multiple different secret sharing values ​​and sends each secret sharing value to a different server. None of the servers in the system can obtain the complete model update value, thus ensuring the security of the model training process.

[0050] The server calculates an aggregated update value based on the secret shared value sent by each client and sends the aggregated update value to each client. For example, in... Figure 1 In the embodiment shown, each server merges the three secret sharing values ​​it receives to obtain an aggregated update value.

[0051] Model generation module 13 is used to calculate the true value of the model update based on the aggregated update values ​​sent by each server, and update the initial model based on the true value to obtain the optimized model:

[0052] Θ←Θ-α·θ s ,

[0053] Where, θ s α represents the true value of the model update, and α represents the learning rate. In this embodiment of the invention, the learning rate used to update the initial model is the learning rate corresponding to the current number of rounds in which the initial model is trained. For example, if the current round is the 12th round of training the initial model, then the learning rate used to train the initial model is the learning rate corresponding to the 12th round.

[0054] The federated learning-based model training system provided in this invention divides the training process into an early training phase and a late training phase when each client trains the initial model based on its local training set. The learning rate in the early training phase is obtained by multiplying the base learning rate in the early phase by a certain factor, while the learning rate in the late training phase is obtained by reducing the base learning rate in the late phase by a certain factor. When executing this invention, the learning rate rapidly decreases during the transition from the early to the late training phase as the client trains the initial model. This solves the problems of large discrepancies between randomly initialized networks and the optimal solution, as well as the different optimal solutions targeted by each client when training the initial model. This addresses the path conflict issue that arises when aggregating gradients of parameters trained by various clients. It ensures that each client is not limited to local optima when training the initial model, and avoids path conflicts that occur when clients train the same initial model using different local training sets. Furthermore, in the federated learning-based model training system provided in this embodiment, after obtaining model update values ​​through initial model training, the client uses a secret sharing algorithm to split the model update values ​​into multiple different secret sharing values, sending each secret sharing value to a different server. None of the servers in the system can obtain the complete model update values, thus ensuring the security of the model training process.

[0055] In one optional embodiment, the secret sharing algorithm used to split the model update value is determined by the homomorphism of the initial model. When the initial model corresponds to additive homomorphism, a secret sharing algorithm that satisfies additive homomorphism is selected to split the model update value. When the initial model corresponds to multiplicative homomorphism, a secret sharing algorithm that satisfies multiplicative homomorphism is selected to split the model update value.

[0056] In an optional embodiment, in the federated learning-based model training system provided in this embodiment of the invention, the parameter sharing module 12 includes:

[0057] The first shared value generation submodule, if the homomorphism corresponding to the initial model is additive homomorphism, is used to generate random numbers. The random number is determined as the first sharing value [x]0 = r, and the first sharing value is sent to the first server.

[0058] The second shared value generation submodule, if the homomorphism corresponding to the initial model is additive homomorphism, is used to perform a modulo operation on the difference between the model update value and the first shared value to obtain the second shared value [x]1=(xr)(mod2). l The second shared value is sent to the second server.

[0059] In an alternative embodiment, the server determines the average of the secret sharing values ​​sent by each client as the aggregated update value:

[0060]

[0061] Among them, [θ s ] i Let θ represent the aggregated update value calculated by the i-th server, m represent the number of secret-shared values ​​received by the server, and θ represent the total number of secret-shared values. j This represents the secret sharing value sent by the j-th client.

[0062] In this embodiment of the invention, since the secret sharing algorithm used to split the model update value has additive homomorphism, the average value is used when the server generates the aggregate update value.

[0063] In an optional embodiment, in the federated learning-based model training system provided in this embodiment of the invention, the model generation module 13 includes:

[0064] The secret recovery submodule is used to perform a modulo operation on the sum of the aggregated update values ​​sent by the first server and the aggregated update values ​​sent by the second server to obtain the true value of the model update: x = ([x]0 + [x]1)(mod2) l ), where [x]0 represents the aggregated update value sent by the first server and [x]1 represents the aggregated update value sent by the second server.

[0065] With this homomorphism in addition, for multi-party addition x+y, the results can be aggregated through secret sharing and secret recovery. The derivation is as follows: ([x]0+[y]0)(mod2) l )+([x]1+[y]1)(mod2 l )=([x]0+[x]1)(mod2 l )+([y]0+[y]1)(mod2 l ) = x + y.

[0066] The model generation submodule is used to update the initial model based on the real value of the model update to obtain the optimized model. For details, please refer to the description of the model generation module 13 in the above embodiment, which will not be repeated here.

[0067] In an optional embodiment, when the homomorphism corresponding to the initial model is multiplicative homomorphism, and the client uses an algorithm that satisfies multiplicative homomorphism to calculate the model update value to generate the secret sharing value, the server includes:

[0068] The triple generation module is used to generate triples. In an optional embodiment, the triples of the server are obtained by negotiation among the servers in the system. First, each server negotiates to randomly generate a triple combination value (a, b, c), where c = ab. Then, each server negotiates to generate its own triple. Taking a system with two servers as an example, the triple of the first server is (a[]0, [b]0, [c]0), and the triple of the second server is ([a]1, [b]1, [c]1), where a = [a]0 + [a]1, b = [b]0 + [b]1.

[0069] In this embodiment of the invention, based on the additive homomorphism, a multiplicative homomorphism can be further constructed to support the multiplicative operation x*y. In order to make [x]*[y]=x*y, a triplet needs to be introduced.

[0070] An intermediate value generation module is used to calculate intermediate values ​​based on triples and the secret share value: [e] i =[x] i -[a] i [f] i =[y] i -[b] i , where [x] i and [y] i This is the secret share value that the client sends to the i-th server.

[0071] Each server in the system calculates its own intermediate value based on its own triple and the secret sharing value it receives.

[0072] The intermediate value merging module is used to merge intermediate values ​​with those generated by other servers in the system to form a merged intermediate value. In an optional embodiment, if each server generates an intermediate value, the intermediate values ​​obtained by each server are added together to obtain the merged intermediate value; if each server generates multiple types of intermediate values, the intermediate values ​​belonging to the same type are added together to obtain multiple merged intermediate values.

[0073] For example, if the system includes two servers, and the two servers calculate intermediate values ​​([e]0,[f]0) and ([e]1,[f]1) respectively, then the merged intermediate value obtained by merging the intermediate values ​​generated by the two servers is e = ([e]0 + [e]1)(mod2) l ) and f = ([f]0 + [f]1)(mod2) l ), that is, e = xa, f = yb.

[0074] The aggregated update value calculation module is used to calculate the aggregated update value based on triples, merged intermediate values, and secret share values: [z] i=-ief+e[y] i +[x] i f+[c] i , where [z] i This represents the aggregated update value calculated by the i-th server.

[0075] In an optional embodiment, when the homomorphism corresponding to the initial model is multiplicative homomorphism, and the secret sharing value is calculated using a secret sharing algorithm that satisfies multiplicative homomorphism, the model generation module 13 includes:

[0076] The secret recovery submodule is used to sum the aggregated update values ​​sent by each server to obtain the true value of the model update: z = ([z]0 + [z]1)(mod2) l ).

[0077] The model generation submodule is used to update the initial model based on the real value of the model update to obtain the optimized model. For details, please refer to the description of the model generation module 13 in the above embodiment, which will not be repeated here.

[0078] In an optional embodiment, in the federated learning-based model training system provided by this invention, the loss function used during the initial model training process consists of a conventional loss function and additional constraint terms:

[0079]

[0080] Where, θ * Let N represent the target parameters, N represent the number of samples in the local training set, L represent the conventional loss function, and x represent the target parameters. (n) and y (n) Let λ represent the feature vector and label of the nth sample, respectively, and f be the learner, where λ‖θ-θ 0 || 2 For additional constraints, λ represents the strength of the additional constraints, and θ 0 θ refers to the initial parameter, and θ represents the current parameter.

[0081] The federated learning-based model training system provided in this invention uses a loss function formed by adding additional constraints to the conventional loss function when the client trains the initial model. The additional constraints can limit the Euclidean distance between the target model and the initial model, further limiting the space of the target solution to the vicinity of the initial solution. This prevents model shift caused by each client using different local training sets to train the initial model, thereby improving model performance and efficiency.

[0082] In one optional embodiment, in the federated learning-based model training system provided in this embodiment of the invention, the regularization coefficient used when training the initial model is several times the value of the conventional regularization coefficient.

[0083] In one optional embodiment, the regularization coefficient can be expanded to more than 50 times the conventional regularization coefficient, and the specific value can be adjusted according to the actual training results. For example, the regularization coefficient can be increased from 0.0005 to 0.05.

[0084] The federated learning-based model training system provided in this invention uses a regularization coefficient that is several times higher than the regularization coefficient when the client trains the initial model. By increasing the regularization coefficient to a certain extent, the search space of each client participating in the training can be significantly compressed, the model complexity can be limited, the number of candidate solutions can be reduced, and the probability of path conflicts in the search for the optimal value can be reduced.

[0085] This invention provides a model training method based on federated learning, applied to a client-side application, such as... Figure 2 As shown, it includes:

[0086] Step S11: Train the initial model based on the local training set to obtain the model update value; the training process of the initial model includes an early training stage and a late training stage. The learning rate in the early training stage is obtained by multiplying the early basic learning rate by several times, and the learning rate in the late training stage is obtained by reducing the late basic learning rate by several times. For details, please refer to the description of the model training module 11 in the above embodiment, which will not be repeated here.

[0087] Step S12: The secret sharing algorithm is used to calculate multiple secret sharing values ​​for the model update value. The secret sharing values ​​are then sent to each server. The number of secret sharing values ​​is the same as the number of servers. Since each client has a different local training set, the model update value and secret sharing value obtained are also different. For details, please refer to the description of parameter sharing module 12 in the above embodiment. It will not be repeated here.

[0088] Step S13: Calculate the true value of the model update based on the aggregated update value sent by each server, and update the initial model based on the true value to obtain the optimized model. The aggregated update value is calculated by the server based on the secret sharing value sent by each client. For details, please refer to the description of the model generation module 13 in the above embodiment, which will not be repeated here.

[0089] The federated learning-based model training method provided in this invention divides the training process into an early training phase and a late training phase when the client trains the initial model based on its local training set. The learning rate in the early training phase is obtained by multiplying the base learning rate in the early phase by a certain factor, while the learning rate in the late training phase is obtained by reducing the base learning rate in the late phase by a certain factor. When executing this invention, the learning rate decreases rapidly during the transition from the early training phase to the late training phase as the client trains the initial model. This solves the problem of path conflicts when aggregating gradients of parameters trained by each client, caused by the large gap between the randomly initialized network and the optimal solution, and the different optimal solutions targeted by each client when training the initial model. This ensures that each client is not limited to local optima when training the initial model, and avoids path conflicts caused by each client training the same initial model using different local training sets.

[0090] Furthermore, in the federated learning-based model training method provided in this embodiment of the invention, after the client trains the initial model to obtain the model update value, it also uses a secret sharing algorithm to split the model update value into multiple different secret sharing values ​​and sends each secret sharing value to a different server. The servers in the system cannot obtain the complete model update value, thus ensuring the security of the model training process.

[0091] This invention provides a model training method based on federated learning, applied to a server, comprising:

[0092] The system receives secret-shared values ​​from each client, calculates an aggregated update value based on these values, and sends the aggregated update value back to each client. This allows clients to calculate the true update value of the model based on the aggregated update value and update the initial model accordingly to obtain an optimized model. The secret-shared value is calculated by the server using a secret-shared algorithm after training the initial model on its local training set. The initial model training process includes a pre-training phase and a post-training phase. The learning rate in the pre-training phase is a multiplied version of the pre-training base learning rate, while the learning rate in the post-training phase is a multiplied version of the post-training base learning rate. The number of secret-shared values ​​calculated by each client is the same as the number calculated by the server. Different clients have different local training sets, resulting in different model update values ​​and secret-shared values.

[0093] The federated learning-based model training method provided in this invention involves a server calculating an aggregated update value based on the secret-shared value sent by each client. This allows clients to calculate the true update value of the model based on the aggregated update value and update the initial model using the true value to obtain an optimized model. The secret-shared value is obtained by the server training the initial model on its local training set and then calculating the model update value using a secret-shared algorithm. The initial model training process includes a pre-training phase and a post-training phase. The learning rate in the pre-training phase is obtained by multiplying the pre-training base learning rate by a certain factor, while the learning rate in the post-training phase is obtained by reducing the post-training base learning rate by a certain factor. During the client's training of the initial model, the transition from the pre-training phase to the post-training phase involves... The learning rate decreases rapidly, resolving the path conflict issues caused by the large gap between randomly initialized networks and the optimal solution, as well as the different optimal solutions targeted by each client when training the initial model. This allows each client to train the initial model without being limited to local optima, while also avoiding path conflicts arising when clients train the same initial model using different local training sets. Furthermore, in the federated learning-based model training method provided in this embodiment, after the client obtains the model update value through training the initial model, it uses a secret sharing algorithm to split the model update value into multiple different secret sharing values, which are then sent to different servers. None of the servers in the system can obtain the complete model update value, ensuring the security of the model training process.

[0094] This invention provides a computer device, such as... Figure 3 As shown, the computer device mainly includes one or more processors 31 and a memory 32. Figure 3 Take a processor 31 as an example.

[0095] The computer device may also include an input device 33 and an output device 34.

[0096] The processor 31, memory 32, input device 33, and output device 34 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.

[0097] Processor 31 may be a Central Processing Unit (CPU). Processor 31 may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof. The general-purpose processor may be a microprocessor or any conventional processor. Memory 32 may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on the use of the federated learning-based model training system. Furthermore, memory 32 may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 32 may optionally include memory remotely located relative to processor 31, and this remote memory may be connected to the federated learning-based model training system via a network. Input device 33 can receive computation requests (or other numerical or character information) input by the user, and generate key signal inputs related to the federated learning-based model training system. Output device 34 may include a display device such as a screen for outputting computation results.

[0098] This invention provides a computer-readable storage medium that stores computer instructions. The computer-readable storage medium stores computer-executable instructions that can execute the federated learning-based model training system described in any of the above method embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.

[0099] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A model training system based on federated learning, characterized in that, The system comprises a plurality of clients and a plurality of servers, the clients comprising a model training module, a parameter sharing module, a model generation module, The model training module is configured to train an initial model according to a local training set to obtain a model update value; the training process of the initial model comprises a preliminary training stage and a later training stage, the learning rate of the preliminary training stage is obtained by expanding a preliminary basis learning rate by several times, and the learning rate of the later training stage is obtained by reducing a later basis learning rate by several times; The parameter sharing module is configured to calculate a plurality of secret sharing values by using a secret sharing algorithm on the model update value, and send the secret sharing values to the servers respectively, the number of the secret sharing values being the same as the number of the servers; the local training sets corresponding to the clients are different, and the model update values and the secret sharing values obtained by the clients are also different; The server is configured to calculate an aggregated update value according to the secret sharing values sent by the clients, and send the aggregated update value to the clients; The model generation module is configured to calculate a real value of the model update according to the aggregated update values sent by the servers, update the initial model according to the real value, and obtain an optimized model; The secret sharing algorithm used for calculating the model update value is determined by homomorphism corresponding to the initial model; The parameter sharing module comprises: A first sharing value generation submodule, if the homomorphism corresponding to the initial model is additive homomorphism, the first sharing value generation submodule is configured to generate a random number, determine the random number as a first sharing value, and send the first sharing value to a first server; A second sharing value generation submodule, if the homomorphism corresponding to the initial model is additive homomorphism, the second sharing value generation submodule is configured to perform a modulo operation on the difference between the model update value and the first sharing value to obtain a second sharing value, and send the second sharing value to a second server; If the homomorphism corresponding to the initial model is multiplicative homomorphism, the server comprises: A triple generation module configured to generate a triple; An intermediate value generation module configured to calculate an intermediate value according to the triple and a secret sharing value; An intermediate value merging module configured to merge the intermediate value with intermediate values generated by other servers in the system to form a merged intermediate value; the other servers calculate their own intermediate values according to their own triples and their own received secret sharing values; An aggregated update value calculation module configured to calculate the aggregated update value according to the triple, the merged intermediate value, and the secret sharing value.

2. The model training system based on federated learning according to claim 1, wherein The server determines the mean of the secret sharing values sent by the clients as the aggregated update value. 3.The federated learning based model training system according to claim 1 or 2, wherein, The model generation module comprises: A secret recovery submodule configured to perform a modulo operation on the sum of the aggregated update value sent by the first server and the aggregated update value sent by the second server to obtain the real value of the model update; A model generation submodule configured to update the initial model according to the real value of the model update to obtain an optimized model. 4.The federated learning based model training system of claim 1, wherein, The model generation module comprises: The secret recovery submodule is configured to perform a modulo operation on the sum of the aggregated update values sent by the servers to obtain a real value of the model update; The model generation submodule is configured to update the initial model according to the real value of the model update to obtain an optimized model.

5. The federated learning-based model training system according to claim 1, wherein The loss function used in the initial model training process is composed of a conventional loss function and an additional constraint term. , wherein, denotes a target parameter, N denotes a number of samples in a local training set, L is a regular loss function, and denote a feature vector and a label of an nth sample, respectively, f is a learner, is an additional restriction term, and λ denotes a strength of the additional restriction term, denotes an initial parameter, denotes a current parameter.

6. The federated learning-based model training system according to claim 1 or 5, wherein The value of the regularization coefficient used when training the initial model is several times the value of the conventional regularization coefficient.

7. A model training method based on federated learning, characterized in that, A client applied to the system of any one of claims 1-6, comprising: According to the local training set, the initial model is trained to obtain a model update value; the training process of the initial model comprises a preliminary training stage and a later training stage, the learning rate of the preliminary training stage is obtained by expanding the preliminary basis learning rate by several times, and the learning rate of the later training stage is obtained by reducing the later basis learning rate by several times; the learning rate of the preliminary training stage is obtained by expanding the preliminary basis learning rate by 2 10 times, and the learning rate of the later training stage is 1 / 10 1 / 100 of the later basis learning rate. The model update value is calculated using a secret sharing algorithm to obtain a plurality of secret sharing values, which are sent to each server. The number of secret sharing values is the same as the number of servers. Different clients correspond to different local training sets, and the model update values and secret sharing values obtained are also different. The real value of the model update is calculated according to the aggregated update values sent by the servers, and the initial model is updated according to the real value to obtain an optimized model. The aggregated update value is calculated by the server according to the secret sharing values sent by each client.

8. A model training method based on federated learning, characterized in that, A server applied to the system of any one of claims 1-6, comprising: The server receives the secret sharing values sent by each client, calculates the aggregated update value according to the secret sharing values sent by each client, and sends the aggregated update value to each client, so that the client can calculate the real value of the model update according to the aggregated update value, and update the initial model according to the real value to obtain an optimized model. The secret sharing value is calculated by the server using a secret sharing algorithm on the model update value obtained by training the initial model on the local training set. The training process of the initial model includes a pre-training phase and a post-training phase. The learning rate of the pre-training phase is obtained by expanding the pre-training base learning rate by several times. The learning rate of the post-training phase is obtained by reducing the post-training base learning rate by several times. The number of secret sharing values calculated by each client is the same as the number of servers. Different clients correspond to different local training sets, and the model update values and secret sharing values obtained are also different.

9. A computer device, comprising: Comprising: At least one processor; And a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to perform the federated learning-based model training method of claim 7 or 8.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing the computer to perform the federated learning-based model training method of claim 7 or 8.

Citation Information

Patent Citations

  • Method and device for jointly processing data by two parties

    CN111162896A

  • Federated learning method, device and system

    CN111553484A