Federated learning development method, device, equipment and storage medium

By detecting industrial development needs and generating random numbers for federated learning training, a horizontal federated learning algorithm framework is formed, which solves the problem of low development efficiency in existing technologies and achieves efficient development and automation of federated learning algorithms.

CN111340453BActive Publication Date: 2024-09-24WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010133912.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-28
Publication Date
2024-09-24
Estimated Expiration
2040-02-28

AI Technical Summary

Technical Problem

Developing horizontal federated learning algorithms in the existing technology requires a lot of resources and costs. The development process of each algorithm is cumbersome and complex, lacking scalability and flexibility, resulting in low development efficiency.

Method used

By detecting industrial development needs, determining participants and evaluation models, generating random numbers for fusion evaluation, conducting federated learning training according to preset conditions, forming an algorithm framework for horizontal federated learning, and setting stop conditions to achieve self-iteration of data and improve the development framework of automation.

Benefits of technology

It greatly simplifies the development process of federated learning algorithms, reduces development workload, improves development efficiency, and realizes self-iteration and automation of the fusion evaluation steps of data from all participants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111340453B
    Figure CN111340453B
Patent Text Reader

Abstract

The present invention relates to the field of financial technology, and discloses a federated learning development method, device, equipment and storage medium, wherein the federated learning development method comprises: if an industrial development demand is detected, multiple participants in the industrial development demand are determined, and a first evaluation model and preset evaluation conditions are determined according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions; random numbers of each participant are generated according to the multiple participants, and based on the local data and random numbers of each participant, the first evaluation model is subjected to fusion evaluation processing to obtain a fusion evaluation value; according to the preset evaluation condition and the fusion evaluation value, the first evaluation model is subjected to federated learning training to obtain a second evaluation model. The present invention simplifies the development process of a horizontal federated learning algorithm, reduces the workload of algorithm development, and improves the efficiency of algorithm development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technology, and in particular to a federated learning development method, device, equipment and storage medium. Background Art

[0002] With the development of computer technology, more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are applied in the financial field. The traditional financial industry is gradually transforming to financial technology (Fintech). However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology.

[0003] Developing a horizontal federated learning algorithm that can be applied to an actual production environment requires a lot of development resources. The development of different algorithms also requires a lot of development costs. Each algorithm has its own corresponding development process, which requires developers to customize the development of each algorithm separately. The development process is cumbersome and complicated. Each development process cannot be applied to other development processes. The lack of scalability and flexibility makes the development process too cumbersome and lengthy, which greatly increases the workload of algorithm development and reduces the efficiency of algorithm development. Summary of the invention

[0004] The main purpose of the present invention is to provide a federated learning development method, apparatus, device and storage medium, aiming to simplify the development process of horizontal federated learning algorithms, reduce the workload of algorithm development, and improve the efficiency of algorithm development.

[0005] To achieve the above objective, an embodiment of the present invention provides a federated learning development method, the federated learning development method comprising:

[0006] If an industrial development demand is detected, multiple participants in the industrial development demand are determined, and a first evaluation model and a preset evaluation condition are determined according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions;

[0007] Generating a random number for each participant according to the multiple participants, and performing fusion evaluation processing on the first evaluation model based on local data and the random number of each participant to obtain a fusion evaluation value;

[0008] According to the preset evaluation condition and the fusion evaluation value, the first evaluation model is trained by federated learning to obtain a second evaluation model.

[0009] Optionally, the step of performing federated learning training on the first evaluation model according to the preset evaluation condition and the fusion evaluation value to obtain the second evaluation model includes:

[0010] If the fusion evaluation value does not meet the preset evaluation condition, performing federated learning training on the first evaluation model, and repeating the step of performing fusion evaluation processing on the first evaluation model;

[0011] If the fusion evaluation value reaches the preset evaluation condition, the first evaluation model is determined as the second evaluation model.

[0012] Optionally, the step of generating a random number for each participant according to the multiple participants includes:

[0013] Generate common keys between two of the participants according to the multiple participants, and send each common key to the participant corresponding to the common key;

[0014] Based on each participant and the common key corresponding to each participant, a random number between each two participants corresponding to each common key is generated.

[0015] Optionally, the step of generating a common key between two of the participants according to the multiple participants includes:

[0016] Generate a DH public key according to each participant, and broadcast the DH public key to each participant;

[0017] According to each participant and the DH public key received by each participant, the corresponding private key of each participant is calculated, and the private key of each participant is encrypted to obtain the encrypted ciphertext of each participant, and each encrypted ciphertext is broadcast to each participant;

[0018] Based on each participant and the encrypted ciphertext of each participant, the common key between each two participants is calculated.

[0019] Optionally, if the fusion evaluation value does not meet the preset evaluation condition, the step of performing federated learning training on the first evaluation model includes:

[0020] If the fusion evaluation value does not meet the preset evaluation condition, the first evaluation model is trained according to the local data of each participant to obtain the local training model parameters of each participant and the weight factors of each local training model;

[0021] Encrypting the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant;

[0022] The encrypted model parameters of each participant are aggregated and averaged, and the first evaluation model is updated based on the aggregated and averaged model parameters.

[0023] Optionally, the step of performing aggregating and averaging the encryption model parameters of each participant and updating the first evaluation model based on the aggregated and averaged model parameters includes:

[0024] Aggregate the encrypted model parameters of each participant to generate aggregate model parameters;

[0025] Aggregate the weight factors of each participant to generate an aggregate weight factor;

[0026] Model parameter averaging is performed according to the aggregated model parameters and the aggregated weight factors, and the first evaluation model is updated based on the model parameters after the aggregated averaging process.

[0027] Optionally, the step of encrypting the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant includes:

[0028] Generate initial model parameters for each participant based on each participant, their local training model parameters, and weight factors;

[0029] Generate random model parameters for each participant based on each participant and the random number of each participant;

[0030] Obtaining the identification number of each participant, and determining the encryption method of the initial model parameters of each participant according to the identification number corresponding to each participant;

[0031] If the encryption method is an addition method, the initial model parameters and random model parameters of each participant are added together to obtain the first model parameters of each participant;

[0032] If the encryption method is a subtraction method, the initial model parameters and random model parameters of each participant are subtracted to obtain the second model parameters of each participant;

[0033] The first model parameter or the second model parameter of each participant is confirmed as the encrypted model parameter of each participant.

[0034] The present invention also provides a federated learning development device, the federated learning development device comprising:

[0035] A determination module, for determining multiple participants in the industrial development demand if an industrial development demand is detected, and determining a first evaluation model and a preset evaluation condition according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions;

[0036] A processing module, configured to generate a random number of each participant according to the multiple participants, and perform fusion evaluation processing on the first evaluation model based on the local data and the random number of each participant to obtain a fusion evaluation value;

[0037] A training module is used to perform federated learning training on the first evaluation model according to the preset evaluation conditions and the fusion evaluation value to obtain a second evaluation model.

[0038] Optionally, the training module includes:

[0039] A training submodule, configured to perform federated learning training on the first evaluation model and repeat the step of performing fusion evaluation processing on the first evaluation model if the fusion evaluation value does not meet the preset evaluation condition;

[0040] The determination submodule is used to determine the first evaluation model as the second evaluation model if the fusion evaluation value reaches the preset evaluation condition.

[0041] Optionally, the processing module includes:

[0042] A common key submodule, used for generating common keys between two participants among the participants according to the multiple participants, and sending each common key to the participant corresponding to the common key;

[0043] The random number submodule is used to generate random numbers between two participants corresponding to each common key based on each participant and the common key corresponding to each participant.

[0044] Optionally, the steps of the common key submodule include:

[0045] A generating unit, used to generate a DH public key according to each participant, and broadcast the DH public key to each participant;

[0046] The encryption unit is used to calculate the private key corresponding to each participant according to each participant and the DH public key received by each participant, encrypt the private key of each participant, obtain the encrypted ciphertext of each participant, and broadcast each encrypted ciphertext to each participant;

[0047] The common key unit is used to calculate the common key between each participant according to each participant and the encrypted ciphertext of each participant.

[0048] Optionally, the training submodule includes:

[0049] A training unit, configured to, if the fusion evaluation value does not meet the preset evaluation condition, train the first evaluation model according to the local data of each participant to obtain the local training model parameters of each participant and the weight factors of each local training model;

[0050] An encryption unit, used to encrypt the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant;

[0051] The aggregation and averaging unit is used to perform aggregation and averaging processing on the encryption model parameters of each participant, and update the first evaluation model based on the aggregated and averaged model parameters.

[0052] Optionally, the aggregated averaging unit comprises:

[0053] A first aggregation subunit is used to aggregate the encryption model parameters of each participant to generate an aggregate model parameter;

[0054] The second aggregation subunit is used to aggregate the weight factors of each participant to generate an aggregated weight factor;

[0055] The averaging subunit is used to perform model parameter averaging processing according to the aggregated model parameters and the aggregated weight factor, and to update the first evaluation model based on the model parameters after the aggregated averaging processing.

[0056] Optionally, the encryption unit includes:

[0057] The initial model subunit is used to generate initial model parameters of each participant according to each participant, local training model parameters of each participant and weight factors;

[0058] A random model subunit, for generating random model parameters of each participant according to each participant and the random number of each participant;

[0059] A determination subunit is used to obtain the identification number of each participant, and determine the encryption method of the initial model parameters of each participant according to the identification number corresponding to each participant;

[0060] An adding subunit, for adding the initial model parameters and random model parameters of each participant to obtain the first model parameters of each participant if the encryption mode is an adding mode;

[0061] A subtraction subunit, for subtracting the initial model parameters and random model parameters of each participant from each other to obtain the second model parameters of each participant if the encryption mode is a subtraction mode;

[0062] The confirmation subunit is used to confirm the first model parameter or the second model parameter of each participant as the encryption model parameter of each participant.

[0063] In addition, to achieve the above-mentioned purpose, the present invention further provides a device, comprising: a memory, a processor, and a federated learning development program stored in the memory and executable on the processor, wherein:

[0064] When the federated learning development program is executed by the processor, the steps of the federated learning development method described above are implemented.

[0065] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer storage medium;

[0066] The computer storage medium stores a federated learning development program, and when the federated learning development program is executed by the processor, the steps of the above-mentioned federated learning development method are implemented.

[0067] If the present invention detects an industrial development demand, it determines multiple participants in the industrial development demand, and determines a first evaluation model and preset evaluation conditions according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions; random numbers of each participant are generated according to the multiple participants, and based on the local data and random numbers of each participant, the first evaluation model is subjected to fusion evaluation processing to obtain a fusion evaluation value; according to the preset evaluation conditions and the fusion evaluation value, the first evaluation model is subjected to federated learning training to obtain a second evaluation model. The present invention encapsulates the common application steps in different algorithms to form an algorithm framework for horizontal federated learning, and sets the stop conditions for the fusion evaluation of local data of different participants, thereby realizing the self-iteration of the fusion evaluation steps of the data of each participant, improving the automation of the federated learning development framework, greatly simplifying the development process of the horizontal federated learning algorithm, reducing the workload of algorithm development, and improving the efficiency of algorithm development. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;

[0069] Figure 2 A schematic diagram of a process flow of an embodiment of a federated learning development method of the present invention;

[0070] Figure 3 A schematic diagram of uuid generation in an embodiment of the federated learning development method of the present invention;

[0071] Figure 4 A schematic diagram of DH key exchange in an embodiment of the federated learning development method of the present invention;

[0072] Figure 5 A schematic diagram of a random number generator in an embodiment of the federated learning development method of the present invention;

[0073] Figure 6 A schematic diagram of local model evaluation in an embodiment of the federated learning development method of the present invention;

[0074] Figure 7 A schematic diagram of local model training in an embodiment of the federated learning development method of the present invention.

[0075] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION

[0076] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0077] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.

[0078] The device in the embodiment of the present invention may be a PC or a server device.

[0079] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0080] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0081] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a federated learning development program.

[0082] exist Figure 1In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the federated learning development program stored in the memory 1005 and perform the operations in each embodiment of the following federated learning development method.

[0083] The main idea of ​​the embodiment of the present invention is: if the present invention detects an industrial development demand, it determines multiple participants in the industrial development demand, and determines a first evaluation model and preset evaluation conditions according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions; random numbers of each participant are generated according to the multiple participants, and based on the local data and random numbers of each participant, the first evaluation model is subjected to fusion evaluation processing to obtain a fusion evaluation value; according to the preset evaluation condition and the fusion evaluation value, the first evaluation model is subjected to federated learning training to obtain a second evaluation model. The present invention encapsulates the common application steps in different algorithms to form an algorithm framework for horizontal federated learning, and sets the stop conditions for the fusion evaluation of local data of different participants, thereby realizing the self-iteration of the fusion evaluation steps of the data of each participant, improving the automation of the federated learning development framework, greatly simplifying the development process of the horizontal federated learning algorithm, reducing the workload of algorithm development, and improving the efficiency of algorithm development.

[0084] The embodiments of the present invention take into account that, in the prior art, developing a horizontal federated learning algorithm that can be applied to an actual production environment requires a large amount of development resources, and the development of different algorithms also requires a large amount of development costs. Each algorithm has its own corresponding development process, which requires developers to perform separate customized development for each algorithm. The development process is cumbersome and complicated, and each development process cannot be applied to other development processes. It lacks scalability and flexibility, making the development process too cumbersome and lengthy, greatly increasing the workload of algorithm development and reducing the efficiency of algorithm development.

[0085] The present invention provides a solution that encapsulates the common application steps in different algorithms, forms an algorithm framework for horizontal federated learning, and sets the stop conditions for the fusion evaluation of local data of different participants, thereby realizing the self-iteration of the fusion evaluation steps of the data of each participant, improving the automation of the federated learning development framework, greatly simplifying the development process of the horizontal federated learning algorithm, reducing the workload of algorithm development, and improving the efficiency of algorithm development.

[0086] Based on the above hardware structure, an embodiment of the federated learning development method of the present invention is proposed.

[0087] The present invention belongs to the field of financial technology (Fintech), and provides a federated learning development method.

[0088] In one embodiment of the federated learning development method, refer to Figure 2 , the federated learning development method includes:

[0089] Step S10, if an industrial development demand is detected, multiple participants in the industrial development demand are determined, and a first evaluation model and a preset evaluation condition are determined according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions;

[0090] Step S20, generating a random number for each participant according to the multiple participants, and performing fusion evaluation processing on the first evaluation model based on the local data and random number of each participant to obtain a fusion evaluation value;

[0091] Step S30: performing federated learning training on the first evaluation model according to the preset evaluation condition and the fusion evaluation value to obtain a second evaluation model.

[0092] The federated learning development method can be applied to devices as follows:

[0093] Step S10, if an industrial development demand is detected, multiple participants in the industrial development demand are determined, and a first evaluation model and a preset evaluation condition are determined according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions;

[0094] The industrial development requirements refer to the project requirements for the development of the federated learning algorithm in the present invention. The industrial development requirements of the present invention specify multiple participants, the number of participants is greater than 2, and each participant holds its own labeled data; the data held by each party has the same structure, that is, has the same characteristics; there is an untrusted but protocol-compliant central node, which does not hold data itself and serves as an intermediary for model aggregation and information interaction; now it is necessary to jointly train a model using the data of multiple participants, and at the same time, the private model of any participant in the process is not obtained by other participants and the central node, thereby protecting the security of the participant's data. For ease of understanding, in the examples of the behaviors of the embodiments of the present invention, the participants are replaced by Clients, and the central nodes are replaced by Servers.

[0095] In this embodiment, there is a random encryptor, which is used for uuid generation, key exchange and random number generation of each participant.

[0096] It can be understood that UUID generation refers to the unique UUID_{i} assigned by the system to each participant as an identifier.

[0097] Key exchange refers to the one-to-one key exchange between each participant and other participants. Random number generation refers to the conversion of the keys between the two participants into random numbers to enhance the security and reliability of the keys. The preset evaluation conditions refer to the iterative reference conditions for each participant to train the data during the demand development process, representing the stop conditions for the end of the development process when the development level reaches this condition. The first evaluation model is a preset model saved in the central node (Server), which is used to evaluate the data availability of each participant (Client). It can be understood that the first evaluation model is the training object specified in the industrial development requirements, and the preset evaluation conditions are the training conditions specified in the industrial development requirements.

[0098] Reference Figure 3 , Figure 3 This is a schematic diagram of uuid generation in the first embodiment of the federated learning development method of the present invention. Uuid is the identification data that uniquely identifies the current participant. Therefore, in the process of generating uuid, it is necessary to determine whether the client represented by each participant has a uuid conflict. If there is a conflict, the uuid is regenerated and matched to the corresponding client. Through the generation and matching of uuid, each client has its own uuid identification number, which facilitates the system to identify each client. For example, each client in the system is named Client 1, Client 2, Client 3...Client i, etc.

[0099] Furthermore, the preset evaluation conditions can be adjusted according to the actual industrial development needs. Assuming that the current industrial development needs are to develop a large-scale customer loan prediction model algorithm, it is necessary to determine the customer's age, social security, provident fund, loan history and other data in order to predict and derive various data. Assume that the industrial development needs require that the developed algorithm must have the attribute of high concurrency performance to avoid system crashes or data processing anomalies in the face of huge customer data calculations. Therefore, according to the data calculation amount determined by the industrial development needs, the concurrency performance of the large-scale loan prediction model algorithm needs to reach the range that can be used by the current industrial development needs.

[0100] Specifically, after obtaining the industrial development requirements, this embodiment will analyze the industrial development requirements to determine the algorithm functionality of the industrial development requirements, such as performance concurrency, page rendering degree, algorithm security, data privacy, etc. In this embodiment, the performance compliance conditions can be determined according to the algorithm functionality of the industrial development requirements, and the performance compliance conditions can be confirmed as preset evaluation conditions to be used as important reference values ​​for whether the performance compliance conditions are met during the algorithm development process. For example, assuming the preset evaluation condition "the algorithm evaluation value is greater than 85% of the safety judgment unit", then when the fusion evaluation value reaches the preset evaluation condition, that is, when the fusion evaluation value is greater than 85% of the safety judgment unit, the first evaluation model is output, otherwise the preset evaluation condition is not met, and further iterative processing is required until the fusion evaluation value reaches 85% of the safety judgment unit.

[0101] Step S20, generating a random number for each participant according to the multiple participants, and performing fusion evaluation processing on the first evaluation model based on the local data and random number of each participant to obtain a fusion evaluation value;

[0102] In this embodiment, the local data of all participants are provided to the first estimation model, and the first estimation model performs fusion processing based on the collected multi-party data to obtain a fusion evaluation value.

[0103] For easier understanding, the following example will be used to explain:

[0104] Reference Figure 6 , Figure 6 This is a schematic diagram of local model evaluation in an embodiment of the federated learning development method of the present invention; in this embodiment, a first evaluation model M_{t-1} is stored in the Server, and the system obtains the first evaluation model and local data of each Client, and inputs the local data of each Client into the first evaluation model as an input parameter, so that the first evaluation model can perform fusion evaluation processing. It can be understood that the fusion evaluation processing can be customized according to actual development needs, and is not fixed in this embodiment. It has a certain tendency through the weight bias in the development needs. In this embodiment, the fusion evaluation processing is an execution processing step that changes according to changes in development needs, and will not be elaborated here. The key lies in the fusion evaluation value obtained through the fusion evaluation processing.

[0105] Specifically, the step of generating a random number for each participant according to the multiple participants includes:

[0106] Step A1, generating common keys between two of the participants according to the multiple participants, and sending each common key to the participant corresponding to the common key;

[0107] The key exchange uses DH key exchange technology to achieve a common private key (P_{i,j}=P_{j,i}) between any two participants (ci,cj). In this embodiment, each participant needs to generate a common key between two participants with other participants to ensure that the data between the two participants with a common key cannot be obtained by other participants, which has a certain data security.

[0108] Specifically, the step of generating a common key between two participants among the multiple participants according to the multiple participants includes:

[0109] Step A11, generating a DH public key according to each participant, and broadcasting the DH public key to each participant;

[0110] Step A12: Calculate the private key corresponding to each participant according to each participant and the DH public key received by each participant, encrypt the private key of each participant, obtain the encrypted ciphertext of each participant, and broadcast each encrypted ciphertext to each participant;

[0111] Step A13, based on each participant and the encrypted ciphertext of each participant, calculate the common key between each two participants.

[0112] For ease of understanding, refer to Figure 4 , Figure 4 This is a schematic diagram of DH key exchange in an embodiment of the federated learning development method of the present invention; this embodiment will illustrate the specific steps of DH key exchange based on the above steps combined with the following examples:

[0113] Step 1: The server generates a DH public key (a, n) and broadcasts the DH public key to other clients;

[0114] Step 2: Each client generates a local private key (random number r) based on the DH public key, calculates the private key to encrypt the ciphertext and sends it to the server;

[0115] Step 3: The server collects the private keys of all clients to encrypt the ciphertexts, forms a ciphertext list, and broadcasts the ciphertext list to all clients;

[0116] Step 4: Each client receives the ciphertext list, encrypts the ciphertext with the private key in the list, and calculates the common key between the client and other clients in the corresponding private key encrypted ciphertext.

[0117] According to the above steps, each client can form a common key between any two clients. For example, there is Client 1, which obtains the DH public key from the broadcast, generates the local private key of Client 1 based on the DH public key, encrypts the local private key to generate Client 1 encrypted ciphertext, and sends it to the server. After the server obtains the encrypted ciphertexts of multiple clients such as Client 1, Client 2, ... Client n, it sorts them into a ciphertext list, and the server broadcasts the ciphertext list to all clients. After obtaining the ciphertext list, Client 1 extracts the encrypted ciphertexts of multiple clients such as Client 2, Client 3, ... Client n, and generates the common key 12 between Client 1 and Client 2 based on the encrypted ciphertext of Client 1 and Client 2. Similarly, the common key 13 between Client 1 and Client 3, ... and the common key 1n between Client 1 and Client n can be obtained. By analogy, Client 2 can obtain the common key 12 between Client 2 and Client 1, the common key 23 between Client 2 and Client 3, ... and the common key 2n between Client 2 and Client n.

[0118] Therefore, each Client can obtain the common key between all the Clients. This process is the generation of the common key. Each Client (ci) holds the common key {P_{i,1},...,P{i,i-1},P_{i,i+1},...,P_{i,N}}.

[0119] Step A2, based on each participant and the common key corresponding to each participant, generate a random number between each pair of participants corresponding to each common key.

[0120] Reference Figure 5 , Figure 5Schematic diagram of a random number generator in an embodiment of a federated learning development method of the present invention; after obtaining the common key data of each participant, that is, each Client (ci), according to the common key {P_{i,1}, ..., P{i,i-1}, P_{i,i+1}, ..., P_{i,N}} of each Client (ci), the common key of each Client (ci) is used as a random number seed to initialize the MT19937 seed to generate a random number generator for each Client (ci), thereby obtaining a random number RS_{i} = {R_{i,1}, ..., R{i,i-1}, R_{i,i+1}, ..., R_{i,N}} of each Client (ci). Assume that currently Client 1 has common key 12, common key 13 and common key 14, and Client 2 has common key 12, common key 23 and common key 24, then the common key 12 of Client 1 is converted into random number 12, common key 13 is converted into random number 13, and common key 14 is converted into random number 14 through a random number generator.

[0121] Step S30: performing federated learning training on the first evaluation model according to the preset evaluation condition and the fusion evaluation value to obtain a second evaluation model.

[0122] In this embodiment, the federated learning training adjusts the number of iterative training in real time according to the preset evaluation conditions, and the fusion evaluation value is a reference parameter for judging the preset evaluation conditions. The first evaluation model is federated learning trained according to the preset evaluation conditions and the fusion evaluation value, and the result of the federated learning training can be obtained, thereby obtaining the second evaluation model.

[0123] Specifically, the step of performing federated learning training on the first evaluation model according to the preset evaluation condition and the fusion evaluation value to obtain the second evaluation model includes:

[0124] Step B1, if the fusion evaluation value does not meet the preset evaluation condition, the first evaluation model is subjected to federated learning training, and the step of performing fusion evaluation processing on the first evaluation model is repeated;

[0125] When the fusion evaluation value does not reach the preset evaluation condition, it proves that the current algorithm development has not been completed and a new development process is required. At this time, the system will continue to perform federated learning training processing on the first evaluation model based on the local data and random numbers of the participants, thereby realizing algorithm iterative training. The federated learning training process is specifically embodied in training processing and encryption processing. Since there are multiple participants, the training processing and encryption processing are to use the local data and random numbers corresponding to each participant as training parameters and encryption parameters, respectively, as the training sample data of the first evaluation model to complete training and encryption, and obtain a new first evaluation model. The new first evaluation model obtained will continue to be confirmed as the evaluation model for the next round of algorithm development, and the local data of each participant will be used for another fusion evaluation process. This cycle will be iteratively executed until the fusion evaluation value reaches the preset evaluation condition and forms the second evaluation model, which proves that the final model effect of the algorithm development meets the actual development needs.

[0126] Therefore, in an embodiment of the present invention, the most initial model of the first evaluation model is processed through a first round of fusion evaluation by multiple participants to obtain a first evaluation model 1 corresponding to a fusion evaluation value 1. When the fusion evaluation value 1 does not reach the preset evaluation condition, a second round of fusion evaluation is performed on the first evaluation model 1 according to the local data of each participant to obtain a first evaluation model 2 corresponding to a fusion evaluation value 2, and then the preset evaluation condition is judged until there is a fusion evaluation value n and a corresponding first evaluation model n. When it is determined that the fusion evaluation value n reaches the preset evaluation condition, the iteration ends, and the first evaluation model n is confirmed as the second evaluation model corresponding to the final development and training completion.

[0127] Specifically, if the fusion evaluation value does not meet the preset evaluation condition, the step of performing federated learning training on the first evaluation model includes:

[0128] Step B11: if the fusion evaluation value does not meet the preset evaluation condition, the first evaluation model is trained according to the local data of each participant to obtain the local training model parameters of each participant and the weight factors of each local training model;

[0129] Step B12, encrypting the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant;

[0130] If the fusion evaluation value does not meet the preset evaluation conditions, it proves that the current algorithm development effect does not meet the development requirements. Figure 7 , Figure 7This is a schematic diagram of local model training in an embodiment of the federated learning development method of the present invention. At this time, the first evaluation model will be trained according to the local data of each participant. For example, Client 1 performs data training on the first evaluation model based on its corresponding local data to obtain the local training model parameter M_{t1} of Client 1, and Client 2 performs data training on the first flat model based on its corresponding local data to obtain the local training model parameter M_{t2} of Client 2, that is, Client n has a local training model parameter M_{tn}, and so on, the local training model parameters of all participants can be obtained as: {M_{t1}, M_{t2}, ... M_{tn}}. In addition, there is a weight factor generated according to its own data in the local training model parameter M_{tn}, and the weight factor represents the proportion of the local training model parameter M_{tn} in all local training models of the Client of each participant.

[0131] After obtaining the local training model parameters and weight factors of each participant, the local training model parameters of each participant are encrypted based on the random number and weight factor of each participant to obtain the encrypted model parameters of each participant.

[0132] Specifically, the step of encrypting the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant includes:

[0133] Step B121, generating initial model parameters of each participant according to each participant, local training model parameters of each participant and weight factors;

[0134] Step B122, generating random model parameters of each participant according to each participant and the random number of each participant;

[0135] Step B123, obtaining the identification number of each participant, and determining the encryption method of the initial model parameters of each participant according to the identification number corresponding to each participant;

[0136] Step B124, if the encryption method is an addition method, the initial model parameters and random model parameters of each participant are added together to obtain the first model parameters of each participant;

[0137] Step B125, if the encryption method is a subtraction method, subtract the initial model parameters and random model parameters of each participant to obtain the second model parameters of each participant;

[0138] Step B126: confirm the first model parameter or the second model parameter of each participant as the encrypted model parameter of each participant.

[0139] Specifically, for the convenience of understanding, the following will be explained by way of examples:

[0140] Encrypt through the local training model parameter M_{t}, the weight factor w_{t}, and the random number RS_{i}. The encryption rules are as follows:

[0141] For each local training model parameter, generate the initial model parameter of this party from the local training model parameter and the weight factor. The formula is: TM_{t} = M_{t} * w_{t}. Thus, the initial model parameters of each Client are obtained.

[0142] Obtain the random model parameter GenRands(r) of each Client. GenRands(r) is a random model parameter with the same structure as the local training model parameter M_{t}, generated by using the random number of this Client through the random number generator r.

[0143] For the identification number uuid of the party corresponding to each initial model parameter, set j, i, n. For each 0 < j < n and j not equal to i:

[0144] Successively take any two Clients from all Clients and set them as Client i and Client j respectively. If uuid_i < uuid_j, then determine that the initial model parameter and the random model parameter of Client i are in the addition mode. At this time, perform the addition process through the following formula: TM_{t} = TM_{t} + GenRands(R_{i,j}), and the TM_{t} is the first model parameter; otherwise, determine that the initial model parameter and the random model parameter of Client i are in the subtraction mode. At this time, perform the subtraction process through the following formula: TM_{t} = TM_{t} – GenRands(R_{i,j}), and the TM_{t} is the second model parameter.

[0145] After obtaining the first model parameter or the second model parameter, the first model parameter or the second model parameter is the encrypted model parameter of the current Client i. The formula is: EM_{t} = TM_{t}.

[0146] Step B13: Perform an aggregation and averaging process on the encrypted model parameters of each party, and update the first evaluation model based on the model parameters after aggregation and averaging.

[0147] Specifically, the step of performing an aggregation and averaging process on the encrypted model parameters of each party and updating the first evaluation model based on the model parameters after aggregation and averaging includes:

[0148] After obtaining the encrypted model parameters of each participant, the system will collect the encrypted model parameters of each participant and aggregate and average all the encrypted model parameters, that is, summarize the data of all encrypted model parameters and average them to reach the average level of each participant, thereby obtaining the second evaluation model.

[0149] Step B131, aggregate the encryption model parameters of each participant to generate an aggregate model parameter;

[0150] Step B132, aggregating the weight factors of each participant to generate an aggregate weight factor;

[0151] Step B133, performing model parameter averaging processing according to the aggregated model parameters and the aggregated weight factors, and updating the first evaluation model based on the model parameters after the aggregated averaging processing.

[0152] For ease of understanding, this embodiment will illustrate the implementation process of the aggregate average processing of the participant (ie, Client) based on the above steps and the following examples:

[0153] Each client sends the encryption model parameter EM_{t} to the server, and the server collects the encryption models of all clients to obtain the encryption model parameter set {EM_{t1}, EM_{t2}, ... EM_{tn}}. At the same time, the server collects the weight factors of all clients to obtain the weight factor set {w_{t1}, w_{t2}, ... w_{tn}}.

[0154] Sever aggregates the model data in each encrypted model parameter set, that is, aggregates the encrypted model parameters of each Clinet to obtain an aggregate model parameter SEM_{t}. At the same time, Sever aggregates the weight factors of each encrypted model parameter, that is, aggregates the encrypted model parameters of each Clinet to obtain an aggregate weight factor sw_{t}.

[0155] According to the aggregate model parameter SEM_{t} and the aggregate weight factor sw_{t}, model averaging processing is performed to calculate and obtain the second evaluation model parameter M_{t}, where M_{t}=SEM_{t} / sw_{t}.

[0156] It can be understood that the current second evaluation model M_{t} will serve as the first evaluation model in step S20, so as to iteratively execute to obtain a new fusion evaluation value, and pass through the judgment branch of the preset evaluation condition, thereby realizing the cyclic training of the model until the fusion evaluation value reaches the preset evaluation condition.

[0157] According to the above scheme, in the embodiment of the present invention, most of the processes of the above algorithm are encapsulated, and the communication, encryption, and aggregation processes between all parties in the above process are provided in the form of Procedure class. Users only need to implement the logic of local model training and model evaluation on the participating party side to customize a horizontal federation algorithm. The details of the framework are transparent to users. Users only need to care about the non-federated algorithms they design, and the details of federation are completed by the framework.

[0158] Step B2: If the fusion evaluation value reaches the preset evaluation condition, the first evaluation model is determined as the second evaluation model.

[0159] The fusion evaluation value represents the degree of fusion between the current Client local data and the first evaluation model, that is, the fusion evaluation value can represent the degree of fit between the current algorithm development and the development requirements. The higher the degree of fusion, the higher the degree of fit, indicating that the algorithm development is more in line with the development requirements. The server will determine whether to stop and complete the algorithm development process based on the received evaluation value. In this embodiment, a preset evaluation condition is set, and the preset evaluation condition is used to determine whether the fusion evaluation value meets the standard. If the fusion evaluation value reaches the preset evaluation condition, it proves that the currently developed algorithm meets the development requirements; otherwise, it does not meet the development requirements and further training and fusion development are required.

[0160] Specifically, each client sends the fusion evaluation value to the server, which collects all fusion evaluation values ​​and performs preset evaluation condition judgment. If the fusion evaluation value reaches the preset evaluation condition, it means that the current first evaluation model can meet the application requirements of all clients. At this time, the first evaluation model is retained as the second evaluation model and output. The second evaluation model is the final result of this algorithm development.

[0161] If the present invention detects an industrial development demand, it determines multiple participants in the industrial development demand, and determines a first evaluation model and preset evaluation conditions according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions; random numbers of each participant are generated according to the multiple participants, and based on the local data and random numbers of each participant, the first evaluation model is subjected to fusion evaluation processing to obtain a fusion evaluation value; according to the preset evaluation conditions and the fusion evaluation value, the first evaluation model is subjected to federated learning training to obtain a second evaluation model. The present invention encapsulates the common application steps in different algorithms to form an algorithm framework for horizontal federated learning, and sets the stop conditions for the fusion evaluation of local data of different participants, thereby realizing the self-iteration of the fusion evaluation steps of the data of each participant, improving the automation of the federated learning development framework, greatly simplifying the development process of the horizontal federated learning algorithm, reducing the workload of algorithm development, and improving the efficiency of algorithm development.

[0162] In addition, an embodiment of the present invention further provides a federated learning development device, the federated learning development device comprising:

[0163] A determination module, for determining multiple participants in the industrial development demand if an industrial development demand is detected, and determining a first evaluation model and a preset evaluation condition according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions;

[0164] A processing module, configured to generate a random number of each participant according to the multiple participants, and perform fusion evaluation processing on the first evaluation model based on the local data and the random number of each participant to obtain a fusion evaluation value;

[0165] A training module is used to perform federated learning training on the first evaluation model according to the preset evaluation conditions and the fusion evaluation value to obtain a second evaluation model.

[0166] Optionally, the training module includes:

[0167] A training submodule, configured to perform federated learning training on the first evaluation model and repeat the step of performing fusion evaluation processing on the first evaluation model if the fusion evaluation value does not meet the preset evaluation condition;

[0168] The determination submodule is used to determine the first evaluation model as the second evaluation model if the fusion evaluation value reaches the preset evaluation condition.

[0169] Optionally, the processing module includes:

[0170] A common key submodule, used for generating common keys between two participants among the participants according to the multiple participants, and sending each common key to the participant corresponding to the common key;

[0171] The random number submodule is used to generate random numbers between two participants corresponding to each common key based on each participant and the common key corresponding to each participant.

[0172] Optionally, the steps of the common key submodule include:

[0173] A generating unit, used to generate a DH public key according to each participant, and broadcast the DH public key to each participant;

[0174] The encryption unit is used to calculate the private key corresponding to each participant according to each participant and the DH public key received by each participant, encrypt the private key of each participant, obtain the encrypted ciphertext of each participant, and broadcast each encrypted ciphertext to each participant;

[0175] The common key unit is used to calculate the common key between each participant according to each participant and the encrypted ciphertext of each participant.

[0176] Optionally, the training submodule includes:

[0177] A training unit, configured to, if the fusion evaluation value does not meet the preset evaluation condition, train the first evaluation model according to the local data of each participant to obtain the local training model parameters of each participant and the weight factors of each local training model;

[0178] An encryption unit, used to encrypt the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant;

[0179] The aggregation and averaging unit is used to perform aggregation and averaging processing on the encryption model parameters of each participant, and update the first evaluation model based on the aggregated and averaged model parameters.

[0180] Optionally, the aggregated averaging unit comprises:

[0181] A first aggregation subunit is used to aggregate the encryption model parameters of each participant to generate an aggregate model parameter;

[0182] The second aggregation subunit is used to aggregate the weight factors of each participant to generate an aggregated weight factor;

[0183] The averaging subunit is used to perform model parameter averaging processing according to the aggregated model parameters and the aggregated weight factor, and to update the first evaluation model based on the model parameters after the aggregated averaging processing.

[0184] Optionally, the encryption unit includes:

[0185] The initial model subunit is used to generate initial model parameters of each participant according to each participant, local training model parameters of each participant and weight factors;

[0186] A random model subunit, for generating random model parameters of each participant according to each participant and the random number of each participant;

[0187] A determination subunit is used to obtain the identification number of each participant, and determine the encryption method of the initial model parameters of each participant according to the identification number corresponding to each participant;

[0188] An adding subunit, for adding the initial model parameters and random model parameters of each participant to obtain the first model parameters of each participant if the encryption mode is an adding mode;

[0189] A subtraction subunit, for subtracting the initial model parameters and random model parameters of each participant from each other to obtain the second model parameters of each participant if the encryption mode is a subtraction mode;

[0190] The confirmation subunit is used to confirm the first model parameter or the second model parameter of each participant as the encryption model parameter of each participant.

[0191] In addition, an embodiment of the present invention also proposes a device, which includes: a memory 109, a processor 110, and a federated learning development program stored in the memory 109 and executable on the processor 110, wherein the federated learning development program implements the steps of each embodiment of the above-mentioned federated learning development method when executed by the processor 110.

[0192] In addition, the present invention also provides a computer storage medium, which stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of each embodiment of the above-mentioned federated learning development method.

[0193] The expanded contents of the specific implementation methods of the device and storage medium (i.e., computer storage medium) of the present invention are basically the same as the embodiments of the above-mentioned federated learning development method, and will not be elaborated here.

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

[0195] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0196] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0197] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

Claims

1. A method for developing federated learning, characterized in that: The federated learning development method includes: If an industrial development demand is detected, multiple participants in the industrial development demand are determined, and a first evaluation model and a preset evaluation condition are determined according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions, wherein the industrial development demand is a project demand for the development of a federated learning algorithm, the first evaluation model is a training object specified in the industrial development demand, and the preset evaluation condition is a training condition specified in the industrial development demand; Generating a random number for each participant according to the multiple participants, and performing fusion evaluation processing on the first evaluation model based on local data and the random number of each participant to obtain a fusion evaluation value; According to the preset evaluation condition and the fusion evaluation value, the first evaluation model is trained by federated learning to obtain a second evaluation model; The step of performing federated learning training on the first evaluation model according to the preset evaluation condition and the fusion evaluation value to obtain the second evaluation model comprises: If the fusion evaluation value does not meet the preset evaluation condition, performing federated learning training on the first evaluation model, and repeating the step of performing fusion evaluation processing on the first evaluation model; If the fusion evaluation value reaches the preset evaluation condition, determining the first evaluation model as the second evaluation model; The step of generating a random number for each participant according to the multiple participants comprises: Generate common keys between two of the participants according to the multiple participants, and send each common key to the participant corresponding to the common key; Generate random numbers between two participants corresponding to each common key according to each participant and the common key corresponding to each participant; The step of generating a common key between two participants among the participants according to the multiple participants comprises: Generate a DH public key according to each participant, and broadcast the DH public key to each participant; According to each participant and the DH public key received by each participant, the corresponding private key of each participant is calculated, and the private key of each participant is encrypted to obtain the encrypted ciphertext of each participant, and each encrypted ciphertext is broadcast to each participant; Based on each participant and the encrypted ciphertext of each participant, the common key between each two participants is calculated.

2. The method for developing federated learning according to claim 1, wherein: If the fusion evaluation value does not meet the preset evaluation condition, the step of performing federated learning training on the first evaluation model includes: If the fusion evaluation value does not meet the preset evaluation condition, the first evaluation model is trained according to the local data of each participant to obtain the local training model parameters of each participant and the weight factors of each local training model; Encrypting the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant; The encrypted model parameters of each participant are aggregated and averaged, and the first evaluation model is updated based on the aggregated and averaged model parameters.

3. The method for developing federated learning as claimed in claim 2, wherein: The step of performing aggregating and averaging the encryption model parameters of each participant and updating the first evaluation model based on the aggregating and averaging model parameters includes: Aggregate the encrypted model parameters of each participant to generate aggregate model parameters; Aggregate the weight factors of each participant to generate an aggregate weight factor; Model parameter averaging is performed according to the aggregated model parameters and the aggregated weight factors, and the first evaluation model is updated based on the model parameters after the aggregated averaging process.

4. The method for developing federated learning according to claim 2, wherein: The step of encrypting the local training model parameters of each participant according to the random number and weight factor of each participant to obtain the encrypted model parameters of each participant includes: Generate initial model parameters for each participant based on each participant, their local training model parameters, and weight factors; Generate random model parameters for each participant based on each participant and the random number of each participant; Obtaining the identification number of each participant, and determining the encryption method of the initial model parameters of each participant according to the identification number corresponding to each participant; If the encryption method is an addition method, the initial model parameters and random model parameters of each participant are added together to obtain the first model parameters of each participant; If the encryption method is a subtraction method, the initial model parameters and random model parameters of each participant are subtracted to obtain the second model parameters of each participant; The first model parameter or the second model parameter of each participant is confirmed as the encrypted model parameter of each participant.

5. A federated learning development device, characterized in that: The federated learning development device comprises: A determination module, for determining multiple participants in the industrial development demand if an industrial development demand is detected, and determining a first evaluation model and a preset evaluation condition according to the industrial development demand; wherein different industrial development demands correspond to different first evaluation models and different preset evaluation conditions, wherein the industrial development demand is a project demand for the development of a federated learning algorithm, the first evaluation model is a training object specified in the industrial development demand, and the preset evaluation condition is a training condition specified in the industrial development demand; A processing module, configured to generate a random number of each participant according to the multiple participants, and perform fusion evaluation processing on the first evaluation model based on the local data and the random number of each participant to obtain a fusion evaluation value; A training module, used to perform federated learning training on the first evaluation model according to the preset evaluation condition and the fusion evaluation value to obtain a second evaluation model. Specifically, if the fusion evaluation value does not meet the preset evaluation condition, the training module is used to perform federated learning training on the first evaluation model and repeat the step of performing fusion evaluation processing on the first evaluation model; if the fusion evaluation value meets the preset evaluation condition, the first evaluation model is determined as the second evaluation model; The processing module comprises: A common key submodule, used for generating common keys between two participants among the participants according to the multiple participants, and sending each common key to the participant corresponding to the common key; A random number submodule, used to generate random numbers between two participants corresponding to each common key according to each participant and the common key corresponding to each participant; The common key submodule comprises: A generating unit, used to generate a DH public key according to each participant, and broadcast the DH public key to each participant; The encryption unit is used to calculate the private key corresponding to each participant according to each participant and the DH public key received by each participant, encrypt the private key of each participant, obtain the encrypted ciphertext of each participant, and broadcast each encrypted ciphertext to each participant; The common key unit is used to calculate the common key between each participant according to each participant and the encrypted ciphertext of each participant.

6. A device, characterized in that: The device comprises: a memory, a processor, and a federated learning development program stored in the memory and executable on the processor, wherein the federated learning development program implements the steps of the federated learning development method according to any one of claims 1 to 4 when executed by the processor.

7. A storage medium, characterized in that: The storage medium stores a federated learning development program, which, when executed by a processor, implements the steps of the federated learning development method according to any one of claims 1 to 4.