Model parameter updating method and device, computer readable medium and electronic equipment

文档序号:8749 发布日期:2021-09-17 浏览:57次 中文

1. A method for updating model parameters, comprising:

receiving to-be-federal training data sent by each participant; the data to be subjected to federal training are determined and obtained by corresponding participants based on a training result of a model, and the model is composed of a plurality of soft decision trees;

performing joint calculation on the data to be subjected to federal training sent by each participant to obtain a joint calculation result;

and sending the joint calculation result to each participant so that each participant updates the corresponding model parameter according to the joint calculation result.

2. The method of claim 1, wherein prior to receiving the data to be federated that is sent by each participant, the method further comprises:

the participators carry out model training based on the sample data corresponding to the participators;

each participant determines model parameters corresponding to the trained model; the model parameters corresponding to the trained model comprise weight values and/or bias items;

and the participants determine the corresponding model parameters as the data to be subjected to federal training and send the data to a third party, so that the third party receives the data to be subjected to federal training sent by the participants.

3. The method of claim 1, wherein prior to receiving the data to be federated that is sent by each participant, the method further comprises:

the participators carry out model training based on the sample data corresponding to the participators;

determining gradient values corresponding to the trained models by the participants;

and the participants encrypt the gradient values corresponding to the participants according to the pre-generated encryption keys, and the encrypted gradient values are determined as the data to be subjected to federal training and are sent to a third party, so that the third party receives the data to be subjected to federal training sent by the participants.

4. The method according to claim 2, wherein performing joint calculation on the data to be federated and transmitted by each participant to obtain a joint calculation result comprises:

and carrying out mean value calculation on the model parameters sent by each participant, and determining the obtained mean value as the combined calculation result.

5. The method according to claim 3, wherein performing joint calculation on the data to be federated and transmitted by each participant to obtain a joint calculation result comprises:

and carrying out mean value calculation on the gradient values corresponding to the participants, and determining the obtained mean value as the combined calculation result.

6. The method according to claim 1, wherein performing joint calculation on the data to be federated and transmitted by each participant to obtain a joint calculation result comprises:

detecting whether the data to be subjected to federal training sent by each participant correspond to the same data type;

and if so, performing joint calculation on the data to be subjected to federal training sent by each participant to obtain a joint calculation result.

7. The method according to any one of claims 1-6, wherein after the participants update their respective model parameters according to the joint result, the method further comprises:

and training the updated model by each participant based on the new sample data until no new sample exists in the sample set.

8. A model parameter update apparatus, comprising:

the data receiving unit is used for receiving the data to be subjected to federal training, which are sent by all the participants; the data to be subjected to federal training are determined and obtained by corresponding participants based on a training result of a model, and the model is composed of a plurality of soft decision trees;

the joint calculation unit is used for carrying out joint calculation on the data to be subjected to federal training sent by each participant to obtain a joint calculation result;

and the data sending unit is used for sending the joint calculation result to each participant so that each participant updates the corresponding model parameter according to the joint calculation result.

9. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out a model parameter updating method according to any one of claims 1 to 7.

10. An electronic device, comprising:

one or more processors;

storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the model parameter updating method as claimed in any one of claims 1 to 7.

Background

In the field of machine learning, a machine learning model is generally trained by marked sample data, so that the model is suitable for recognizing images, characters, a certain object and the like. Generally speaking, models based on decision trees belong to more common models, and the decision trees form the models in a serial connection mode, but the problem of low training efficiency is easily caused.

Disclosure of Invention

An object of the embodiments of the present disclosure is to provide a model parameter updating method, a model parameter updating apparatus, a computer-readable medium, and an electronic device, which can improve the model training efficiency of each participant, the model training efficiency being composed of soft decision trees, based on cross-sample training.

A first aspect of the embodiments of the present disclosure provides a model parameter updating method, including:

receiving to-be-federal training data sent by each participant; the method comprises the following steps that federal training data to be obtained by determining a training result of a corresponding participant based on a model, wherein the model is composed of a plurality of soft decision trees;

performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result;

and sending the joint calculation result to each participant so that each participant updates the corresponding model parameter according to the joint calculation result.

In an exemplary embodiment of the present disclosure, before receiving the to-be-federated training data sent by each participant, the method further includes:

each participant carries out model training based on the sample data corresponding to each participant;

each participant determines model parameters corresponding to the trained model; the model parameters corresponding to the trained model comprise weight values and/or bias items;

and determining the model parameters corresponding to each participant as the data to be subjected to federal training and sending the data to a third party so that the third party receives the data to be subjected to federal training sent by each participant.

In an exemplary embodiment of the present disclosure, before receiving the to-be-federated training data sent by each participant, the method further includes:

each participant carries out model training based on the sample data corresponding to each participant;

each participant determines a gradient value corresponding to the trained model;

and each participant encrypts the corresponding gradient value according to the pre-generated encryption key, determines the encrypted gradient value as the data to be subjected to federal training and sends the data to a third party, so that the third party receives the data to be subjected to federal training sent by each participant.

In an exemplary embodiment of the present disclosure, performing joint calculation on to-be-federated training data sent by each participant to obtain a joint calculation result, includes:

and carrying out mean value calculation on the model parameters sent by each participant, and determining the obtained mean value as a joint calculation result.

In an exemplary embodiment of the present disclosure, performing joint calculation on to-be-federated training data sent by each participant to obtain a joint calculation result, includes:

and carrying out mean value calculation on the gradient values corresponding to all the participants, and determining the obtained mean value as a combined calculation result.

In an exemplary embodiment of the present disclosure, performing joint calculation on to-be-federated training data sent by each participant to obtain a joint calculation result, includes:

detecting whether the data to be subjected to federal training sent by each participant correspond to the same data type;

if so, performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result.

In an exemplary embodiment of the disclosure, after each participant updates the corresponding model parameter according to the joint result, the method further includes:

and training the model after the parameters are updated based on the new sample data by each participant until no new sample exists in the sample set.

According to a second aspect of the embodiments of the present disclosure, there is provided a model parameter updating apparatus, including:

the data receiving unit is used for receiving the data to be subjected to federal training, which are sent by all the participants; the method comprises the following steps that federal training data to be obtained by determining a training result of a corresponding participant based on a model, wherein the model is composed of a plurality of soft decision trees;

the joint calculation unit is used for carrying out joint calculation on the data to be subjected to federal training sent by each participant to obtain a joint calculation result;

and the data sending unit is used for sending the joint calculation result to each participant so that each participant updates the corresponding model parameter according to the joint calculation result.

In an exemplary embodiment of the present disclosure, before the data receiving unit receives the data to be federated, which is sent by each participant, the apparatus further includes:

each participant carries out model training based on the sample data corresponding to each participant;

each participant determines model parameters corresponding to the trained model; the model parameters corresponding to the trained model comprise weight values and/or bias items;

and determining the model parameters corresponding to each participant as the data to be subjected to federal training and sending the data to a third party so that the third party receives the data to be subjected to federal training sent by each participant.

In an exemplary embodiment of the present disclosure, before the data receiving unit receives the data to be federated, which is sent by each participant, the apparatus further includes:

each participant carries out model training based on the sample data corresponding to each participant;

each participant determines a gradient value corresponding to the trained model;

and each participant encrypts the corresponding gradient value according to the pre-generated encryption key, determines the encrypted gradient value as the data to be subjected to federal training and sends the data to a third party, so that the third party receives the data to be subjected to federal training sent by each participant.

In an exemplary embodiment of the present disclosure, the joint calculation unit performs joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including:

and carrying out mean value calculation on the model parameters sent by each participant, and determining the obtained mean value as a joint calculation result.

In an exemplary embodiment of the present disclosure, the joint calculation unit performs joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including:

and carrying out mean value calculation on the gradient values corresponding to all the participants, and determining the obtained mean value as a combined calculation result.

In an exemplary embodiment of the present disclosure, the joint calculation unit performs joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including:

detecting whether the data to be subjected to federal training sent by each participant correspond to the same data type;

if so, performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result.

In an exemplary embodiment of the disclosure, after each participant updates the corresponding model parameter according to the joint result, the apparatus further includes:

and training the model after the parameters are updated based on the new sample data by each participant until no new sample exists in the sample set.

According to a third aspect of embodiments of the present disclosure, there is provided a computer-readable medium, on which a computer program is stored, which when executed by a processor, implements the model parameter updating method as described in the first aspect of the embodiments above.

According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement the model parameter updating method as described in the first aspect of the embodiments above.

According to a fifth aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations described above.

The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:

in the technical solutions provided by some embodiments of the present disclosure, to-be-federated training data sent by each participant may be received; the method comprises the following steps that federal training data to be obtained by determining a training result of a corresponding participant based on a model, wherein the model is composed of a plurality of soft decision trees; performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result; and sending the joint calculation result to each participant so that each participant updates the corresponding model parameter according to the joint calculation result. By implementing the embodiments of the present disclosure, on the one hand, the model training efficiency of each participant composed of soft decision trees can be improved based on cross-sample training. On the other hand, the method can perform federated calculation on the to-be-federated training data sent by a plurality of participants, so that a joint calculation result which integrates the to-be-federated training data sent by each participant is obtained and fed back to each participant, each participant performs model training based on the joint calculation result, and the generalization of the model can be improved. On the other hand, a plurality of participants can realize federal training on the premise of not revealing own data, so that the data security of the participants is guaranteed.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.

FIG. 1 is a schematic diagram illustrating an exemplary system architecture to which a model parameter update method and apparatus of embodiments of the present disclosure may be applied;

FIG. 2 schematically illustrates a structural schematic diagram of a computer system suitable for use with an electronic device that implements an embodiment of the disclosure;

FIG. 3 schematically shows a flow diagram of a model parameter update method according to one embodiment of the present disclosure;

FIG. 4 schematically illustrates a model parameter based federated training flow diagram in accordance with one embodiment of the present disclosure;

FIG. 5 schematically illustrates a gradient value-based federated training flow diagram in accordance with one embodiment of the present disclosure;

FIG. 6 schematically illustrates a flow diagram of a model parameter update method of one embodiment in FIG. 3;

fig. 7 schematically shows a block diagram of a model parameter updating apparatus in an embodiment according to the present disclosure.

Detailed Description

Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.

Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.

Fig. 1 schematically shows a schematic diagram of an exemplary system architecture to which a model parameter updating method and apparatus according to an embodiment of the present disclosure may be applied.

As shown in fig. 1, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few. The terminal devices 101, 102, 103 may be various electronic devices having a display screen, including but not limited to desktop computers, portable computers, smart phones, tablet computers, and the like. It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, server 105 may be a server cluster comprised of multiple servers, or the like. For example, the server 105 may perform: receiving to-be-federal training data sent by each participant; the method comprises the following steps that federal training data to be obtained by determining a training result of a corresponding participant based on a model, wherein the model is composed of a plurality of soft decision trees; performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result; and sending the joint calculation result to each participant so that each participant updates the corresponding model parameter according to the joint calculation result.

FIG. 2 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present disclosure.

It should be noted that the computer system 200 of the electronic device shown in fig. 2 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments of the present disclosure.

As shown in fig. 2, the computer system 200 includes a Central Processing Unit (CPU)201 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)202 or a program loaded from a storage section 208 into a Random Access Memory (RAM) 203. In the (RAM)203, various programs and data necessary for system operation are also stored. The (CPU)201, (ROM)202, and (RAM)203 are connected to each other by a bus 204. An input/output (I/O) interface 205 is also connected to bus 204.

The following components are connected to the (I/O) interface 205: an input portion 206 including a keyboard, a mouse, and the like; an output section 207 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 208 including a hard disk and the like; and a communication section 209 including a network interface card such as a LAN card, a modem, or the like. The communication section 209 performs communication processing via a network such as the internet. The driver 210 is also connected to the (I/O) interface 205 as necessary. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 210 as necessary, so that a computer program read out therefrom is installed into the storage section 208 as necessary.

In particular, the processes described below with reference to the flowcharts may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 209 and/or installed from the removable medium 211. The computer program, when executed by a Central Processing Unit (CPU)201, performs various functions defined in the methods and apparatus of the present application.

It should be noted that the computer readable media shown in the present disclosure may be computer readable signal media or computer readable storage media or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

The units described in the embodiments of the present disclosure may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.

As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method as described in the embodiments below. For example, the electronic device may implement the various steps shown in fig. 3, and so on.

The present example embodiment provides a model parameter updating method. Referring to fig. 3, the model parameter updating method may include the following steps S310 to S330, specifically:

step S310: receiving to-be-federal training data sent by each participant; the federal training data are obtained by determining the training result of the corresponding participant based on the model, and the model is composed of a plurality of soft decision trees.

Step S320: and performing joint calculation on the data to be subjected to federal training sent by each participant to obtain a joint calculation result.

Step S330: and sending the joint calculation result to each participant so that each participant updates the corresponding model parameter according to the joint calculation result.

It should be noted that steps S310 to S330 may be executed by a third party, where the third party may be a server or a terminal device, and the embodiment of the present application is not limited. In addition, the method and the system can be applied to various scenes such as wind control, finance, medical treatment, images, marketing and the like, each participant can correspond to each data company, and a third party can correspond to a bank or any credible company. Each data company has different application scenes and different samples, model training is performed in a combined modeling mode, the generalization capability of the models of each participant can be improved, and the samples of each participant can be scenes (such as grasslands, basketball courts, banks and the like) and objects (such as people, cats, dogs and the like).

For example, when each participant corresponds to each medical institution and the third party corresponds to a trusted company, the sample data of each medical institution may be patient data (e.g., a nuclear magnetic resonance image), and based on the federal training mode, each medical institution may implement federal model training without revealing its own data, thereby improving the model learning efficiency and the model generalization ability.

By implementing the model parameter updating method shown in fig. 3, the model training efficiency of each participant and composed of soft decision trees can be improved based on cross-sample training, federal calculation can also be performed on the data to be subjected to federal training sent by a plurality of participants, so that a combined calculation result which integrates the data to be subjected to federal training sent by each participant is obtained and fed back to each participant, each participant performs model training based on the combined calculation result, and the generalization of the model can be improved. In addition, a plurality of participants can realize federal training on the premise of not revealing own data, thereby being beneficial to ensuring the data security of the participants.

The above steps of the present exemplary embodiment will be described in more detail below.

In step S310, receiving to-be-federal training data sent by each participant; the federal training data are obtained by determining the training result of the corresponding participant based on the model, and the model is composed of a plurality of soft decision trees.

Specifically, at least one of the model parameter and the gradient value may be included in the to-be-federal training data. The corresponding data to be subjected to federal training of each participant are different. The number of the participants in the present application may be two or more, and the embodiments of the present application are not limited.

Specifically, each participant may be a server or a terminal device, the model run by each participant may be a Soft GBDT model, the Soft GBDT may be composed of a plurality of basic learners (e.g., Soft decision trees), the plurality of basic learners may be connected in series to obtain the Soft GBDT, and each basic learner in the plurality of basic learners may perform calculation in parallel or in series. The soft decision tree comprises a plurality of layers of nodes, wherein each layer determines the left-right branch probability based on logistic regression, the last layer of nodes outputs fixed distribution, and the final result can be the classification distribution corresponding to the path with the maximum probability/the weighted average of all paths. In a soft decision tree, each sample no longer falls exactly on one branch node, but rather with a certain probability on each branch node. Based on the application of the soft decision tree, the training parallelization of a plurality of basic learners can be realized (namely, the forward propagation and the backward propagation of the model can be parallelized), so that the training efficiency of the model can be improved.

As an optional embodiment, before receiving the to-be-federated training data sent by each participant, the method further includes: each participant carries out model training based on the sample data corresponding to each participant; each participant determines model parameters corresponding to the trained model; the model parameters corresponding to the trained model comprise weight values and/or bias items; and determining the model parameters corresponding to each participant as the data to be subjected to federal training and sending the data to a third party so that the third party receives the data to be subjected to federal training sent by each participant.

Specifically, the sample data may be picture data, text data, audio data, video data, and the like, and the embodiment of the present application is not limited. If the sample data is picture data, the feature of the picture data of each participant is a row vector expanded by the size of the picture.

Before each participant performs model training based on respective corresponding sample data, the method may further include: each participant detects whether the sample data in the sample set conforms to a sample rule, wherein the sample rule is used for limiting the dimension, size, quantity, channel and the like of the sample data; and if the sample data which does not accord with the sample rule exists in the sample set, carrying out normalization processing on the sample data which does not accord with the sample rule according to the sample rule.

Before each participant performs model training based on respective corresponding sample data, the method may further include: each participant initializes the corresponding model to preset model parameters.

Wherein, each participant carries out model training based on respective corresponding sample data, including: each participant iterates the model for N times based on the sample data corresponding to each participant to realize model training; wherein N is a positive integer.

In addition, each participant performs model training based on respective corresponding sample data, including: each participant inputs the sample data corresponding to each participant into each model, and calculates the loss function according to the result output by the modelWherein lmIs the local loss function of each base learner in the model. This can be done by minimizing the global penalty functionTraining the entire model, although the results of each base learner fit the residual of the last base learnerHowever, due to the independence between the nodes and trees of the soft decision tree, only the minimum computation result needed to finally synthesize all the trees is minimizedTraining is performed, and the speed of model training is improved by fully utilizing parallel computing.

Therefore, by implementing the optional embodiment, each participant can train the respective model to obtain the model parameters needing to be subjected to the federal training, and then a third party can be requested to fuse the model parameters of each participant under the condition of data confidentiality among the participants, so that the model parameters after the federal training are obtained, and the respective corresponding models can be optimized according to the model parameters after the federal training, so that the model optimization efficiency is improved, and the generalization of the models is improved.

As an optional embodiment, before receiving the to-be-federated training data sent by each participant, the method further includes: each participant carries out model training based on the sample data corresponding to each participant; each participant determines a gradient value corresponding to the trained model; and each participant encrypts the corresponding gradient value according to the pre-generated encryption key, determines the encrypted gradient value as the data to be subjected to federal training and sends the data to a third party, so that the third party receives the data to be subjected to federal training sent by each participant.

In particular, the gradient values are used to describe the rate of change of the model parameters. Each participant corresponds to a unique set of decryption and encryption keys, both of which may be random numbers, represented by a string of characters. The encryption key is used for encrypting the gradient value sent to the third party, and the decryption key is used for decrypting the joint calculation result returned by the third party. Before each participant encrypts the gradient value corresponding to each participant according to the pre-generated encryption key, the method may further include: and each participant pre-generates a group of decryption keys and encryption keys corresponding to each participant according to a threshold homomorphic encryption algorithm.

Therefore, by implementing the optional embodiment, each participant can train the respective model to obtain the gradient value needing to be subjected to federal training, and then a third party can be requested to fuse the gradient values of each participant under the condition that data among the participants is kept secret, so that the gradient value after the federal training is obtained, and the parameter optimization is conveniently carried out on the respective corresponding model according to the gradient value after the federal training, thereby improving the optimization efficiency of the model and the generalization of the model.

In step S320, joint calculation is performed on the to-be-federated training data sent by each participant, so as to obtain a joint calculation result.

Specifically, after performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, the method may further include: and discarding the data to be subjected to federal training sent by each participant, and not storing the data to avoid data theft, thereby ensuring the confidentiality of the data to be subjected to federal training of each participant.

As an optional embodiment, performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including: and carrying out mean value calculation on the model parameters sent by each participant, and determining the obtained mean value as a joint calculation result.

Specifically, the mean value calculation is performed on the model parameters sent by each participant, and the obtained mean value is determined as a joint calculation result, including: performing mean value calculation (w1+ w2+ … … + wn)/n on model parameters w1, w2, … … and wn sent by all participants C1, C2, … … and Cn, and determining the obtained mean value w as a combined calculation result; wherein n is a positive integer. Further, performing a mean value calculation (w1+ w2+ … … + wn)/n on the model parameters w1, w2, … …, wn transmitted by each participant C1, C2, … …, Cn includes: performing weighted average calculation on model parameters w1, w2, … … and wn sent by participants C1, C2, … … and Cn (a1 w1+ a2 w2+ … … + an wn)/n; wherein a1, a2, … …, an may be constants.

Therefore, by implementing the optional embodiment, the third party can be used for performing the joint training of the model parameters, and the parameters are optimized by using more sample data, so that the generalization degree of the model is improved, and the classification precision of the model is improved.

Referring to fig. 4, fig. 4 schematically illustrates a federal training flow diagram based on model parameters according to an embodiment of the present disclosure. As shown in fig. 4, the federal training procedure based on model parameters includes: step S400 to step S418.

Step S400: party a receives the information and stores the information. The information may be triggering information of federal training or sample information used as sample data.

Step S402: the third party receives the information and stores the information. The information may be triggering information of federal training or sample information used as sample data.

Step S404: party B receives the information and stores the information. The information may be triggering information of federal training or sample information used as sample data.

Step S406: and the participator A carries out model training through the sample data. And then the model parameter A corresponding to the trained model can be obtained and sent to a third party.

Step S408: and the participant B performs model training through the sample data. And then the model parameter B corresponding to the trained model can be obtained and sent to a third party.

Step S410: and the third party calculates the joint calculation result to be 0.5 (model parameter A + model parameter B). In turn, the third party may send the joint computation results to party a and party B.

Step S412: and the participant A receives the joint calculation result.

Step S414: and the participant B receives the joint calculation result.

Step S416: and the participant A detects whether new sample data exists in the sample set. If yes, step S406 is executed, and if no, the flow ends.

Step S418: and the participant B detects whether new sample data exists in the sample set. If yes, step S408 is executed, and if no, the flow ends.

As an optional embodiment, performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including: and carrying out mean value calculation on the gradient values corresponding to all the participants, and determining the obtained mean value as a combined calculation result.

In addition, the mean value calculation is performed on the gradient values corresponding to the participants, and the obtained mean value is determined as a joint calculation result, including: carrying out mean value calculation (g1+ g2+ … … + gn)/n on gradient values g1, g2, … … and gn sent by the decrypted participants C1, C2, … … and Cn, and determining the obtained mean value g as a joint calculation result; wherein n is a positive integer. Further, performing a mean calculation on the decrypted gradient values g1, g2, … … and gn sent by the participants C1, C2, … … and Cn (g1+ g2+ … … + gn)/n includes: performing weighted average calculation on gradient values g1, g2, … … and gn sent by each decrypted participant C1, C2, … … and Cn (a1 × g1+ a2 × g2+ … … + an × gn)/n; wherein a1, a2, … …, an may be constants.

In addition, joint calculation is carried out on the data to be subjected to federal training sent by each participant to obtain a joint calculation result, and the joint calculation result comprises the following steps: and carrying out mean value calculation on the gradient values corresponding to all the participants, determining the obtained mean value as a joint calculation result, further decrypting the joint calculation result through a decryption key, and taking the decryption result as a new joint calculation result.

Therefore, by implementing the optional embodiment, the third party can be used for performing the joint training of the gradient values, and more sample data are used for optimizing parameters, so that the generalization degree of the model is improved, and the classification precision of the model is improved.

Referring to fig. 5, fig. 5 schematically illustrates a federal training flow diagram based on gradient values according to an embodiment of the present disclosure. As shown in fig. 5, the gradient value based federal training procedure includes: step S500 to step S518.

Step S500: party a receives the encryption key.

Step S502: the third party receives the information and stores the information. The information may be triggering information of federal training or sample information used as sample data.

Step S504: party B receives the encryption key.

Step S506: and the participator A carries out model training through the sample data, calculates the gradient value A of the model parameter corresponding to the trained model, and encrypts the gradient value A through the pre-generated encryption key a. Further, the encrypted gradient value a may be transmitted to a third party.

Step S508: and the participator B performs model training through the sample data, calculates the gradient value B of the model parameter corresponding to the trained model, and encrypts the gradient value B through a pre-generated encryption key B. Further, the encrypted gradient value B may be transmitted to a third party.

Step S510: the third party calculates the joint calculation result to be 0.5 (gradient value a + gradient value B). In turn, the third party may send the joint computation results to party a and party B.

Step S512: and the participant A receives the joint calculation result, decrypts the joint calculation result through the decryption key a, and updates the model parameters according to the decrypted joint calculation result.

Step S514: and the participant B receives the joint calculation result, decrypts the joint calculation result through the decryption key B, and updates the model parameters according to the decrypted joint calculation result.

Step S516: and the participant A detects whether new sample data exists in the sample set. If yes, step S506 is executed, and if no, the flow ends.

Step S518: and the participant B detects whether new sample data exists in the sample set. If yes, step S508 is executed, and if no, the flow ends.

As an optional embodiment, performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including: detecting whether the data to be subjected to federal training sent by each participant correspond to the same data type; if so, performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result.

Specifically, if the data to be federated sent by each participant are model parameters, the data to be federated sent by each participant belong to the same data type, and if the data to be federated sent by some participants are model parameters and the data to be federated sent by other participants are gradient values, the data to be federated sent by each participant do not belong to the same data type.

Therefore, by implementing the optional embodiment, joint calculation can be performed under the condition that the data to be subjected to federal training, which are sent by each participant, correspond to the same data type, so that the validity of the joint calculation result is ensured, and the model training efficiency is improved.

In step S330, the joint calculation result is sent to each participant, so that each participant updates the corresponding model parameter according to the joint result.

As an optional embodiment, after each participant updates the respective corresponding model parameter according to the joint result, the method further includes: and training the model after the parameters are updated based on the new sample data by each participant until no new sample exists in the sample set.

Specifically, if the federal training data is a gradient value, each participant trains the updated model based on the new sample data training parameters until no new sample exists in the sample set, so as to realize further training of the model, including: and each participant updates the corresponding model parameter according to the joint calculation result, and trains the model after the parameter updating based on the new sample data. Wherein, each participant updates the corresponding model parameter according to the joint calculation result, including: each participant calculates the product of the preset learning rate and the joint calculation result, and takes the sum of the product and the corresponding model parameter as a new model parameter. The preset learning rate may be a preset constant.

In addition, the sample set is used for storing one or more sample data, wherein the sample data used for model training is old sample data, and the sample data not used for model training is new sample data.

Therefore, by implementing the optional embodiment, the federal training can be realized based on a third party, and the model optimization is performed based on the result of the federal training, so that the generalization of the model can be improved.

Referring to fig. 6, fig. 6 schematically shows a flowchart of a model parameter updating method of fig. 3 according to an embodiment. As shown in fig. 6, the model parameter updating method includes: step S610 to step S650.

Step S610: and each participant carries out model training based on the sample data corresponding to each participant, determines the model parameters corresponding to the trained model, determines the model parameters corresponding to each participant as the data to be subjected to federal training and sends the data to a third party.

Step S620: and the third party performs mean calculation on the model parameters sent by each participant, determines the obtained mean as a joint calculation result, and sends the joint calculation result to each participant so that each participant updates the corresponding model parameters according to the joint calculation result. Further, step S650 is performed.

Step S630: each participant carries out model training based on the sample data corresponding to each participant, determines the gradient value corresponding to the trained model, encrypts the gradient value corresponding to each participant according to the pre-generated encryption key, determines the encrypted gradient value as the data to be subjected to federal training and sends the data to a third party.

Step S640: and the third party performs mean value calculation on the gradient values corresponding to the participants, determines the obtained mean value as a joint calculation result, and sends the joint calculation result to the participants so that the participants decrypt the joint calculation result through the decryption keys corresponding to the participants and update the model parameters corresponding to the participants according to the joint result. Further, step S650 is performed.

Step S650: and training the model after the parameters are updated based on the new sample data by each participant until no new sample exists in the sample set.

It should be noted that steps S610 to S650 correspond to the steps and the embodiment shown in fig. 3, and for the specific implementation of steps S610 to S650, please refer to the steps and the embodiment shown in fig. 3, which is not described herein again.

It can be seen that, by implementing the method shown in fig. 6, the model training efficiency of each participant and composed of soft decision trees can be improved based on cross-sample training, federate calculation can also be performed on the data to be federated and transmitted by a plurality of participants, so that a joint calculation result fusing the data to be federated and transmitted by each participant is obtained and fed back to each participant, and each participant performs model training based on the joint calculation result, so that the generalization of the model can be improved. In addition, a plurality of participants can realize federal training on the premise of not revealing own data, thereby being beneficial to ensuring the data security of the participants.

Further, in the present exemplary embodiment, a model parameter updating apparatus is also provided. Referring to fig. 7, the model parameter updating apparatus 700 may include:

a data receiving unit 701, configured to receive to-be-federal training data sent by each participant; the method comprises the following steps that federal training data to be obtained by determining a training result of a corresponding participant based on a model, wherein the model is composed of a plurality of soft decision trees;

a joint calculation unit 702, configured to perform joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result;

a data sending unit 703, configured to send the joint calculation result to each participant, so that each participant updates the corresponding model parameter according to the joint calculation result.

It can be seen that by implementing the device shown in fig. 7, the model training efficiency of each participant and composed of soft decision trees can be improved based on cross-sample training, federal calculation can also be performed on the data to be subjected to federal training sent by a plurality of participants, so that a combined calculation result which integrates the data to be subjected to federal training sent by each participant is obtained and fed back to each participant, and each participant performs model training based on the combined calculation result, so that the generalization of the model can be improved. In addition, a plurality of participants can realize federal training on the premise of not revealing own data, thereby being beneficial to ensuring the data security of the participants.

In an exemplary embodiment of the present disclosure, before the data receiving unit 701 receives the to-be-federated training data sent by each participant, the apparatus further includes:

each participant carries out model training based on the sample data corresponding to each participant;

each participant determines model parameters corresponding to the trained model; the model parameters corresponding to the trained model comprise weight values and/or bias items;

and determining the model parameters corresponding to each participant as the data to be subjected to federal training and sending the data to a third party so that the third party receives the data to be subjected to federal training sent by each participant.

Therefore, by implementing the optional embodiment, each participant can train the respective model to obtain the model parameters needing to be subjected to the federal training, and then a third party can be requested to fuse the model parameters of each participant under the condition of data confidentiality among the participants, so that the model parameters after the federal training are obtained, and the respective corresponding models can be optimized according to the model parameters after the federal training, so that the model optimization efficiency is improved, and the generalization of the models is improved.

In an exemplary embodiment of the present disclosure, before the data receiving unit 701 receives the to-be-federated training data sent by each participant, the apparatus further includes:

each participant carries out model training based on the sample data corresponding to each participant;

each participant determines a gradient value corresponding to the trained model;

and each participant encrypts the corresponding gradient value according to the pre-generated encryption key, determines the encrypted gradient value as the data to be subjected to federal training and sends the data to a third party, so that the third party receives the data to be subjected to federal training sent by each participant.

Therefore, by implementing the optional embodiment, each participant can train the respective model to obtain the gradient value needing to be subjected to federal training, and then a third party can be requested to fuse the gradient values of each participant under the condition that data among the participants is kept secret, so that the gradient value after the federal training is obtained, and the parameter optimization is conveniently carried out on the respective corresponding model according to the gradient value after the federal training, thereby improving the optimization efficiency of the model and the generalization of the model.

In an exemplary embodiment of the present disclosure, the joint calculation unit 702 performs joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including:

and carrying out mean value calculation on the model parameters sent by each participant, and determining the obtained mean value as a joint calculation result.

Therefore, by implementing the optional embodiment, the third party can be used for performing the joint training of the model parameters, and the parameters are optimized by using more sample data, so that the generalization degree of the model is improved, and the classification precision of the model is improved.

In an exemplary embodiment of the present disclosure, the joint calculation unit 702 performs joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including:

and carrying out mean value calculation on the gradient values corresponding to all the participants, and determining the obtained mean value as a combined calculation result.

Therefore, by implementing the optional embodiment, the third party can be used for performing the joint training of the gradient values, and more sample data are used for optimizing parameters, so that the generalization degree of the model is improved, and the classification precision of the model is improved.

In an exemplary embodiment of the present disclosure, the joint calculation unit 702 performs joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result, including:

detecting whether the data to be subjected to federal training sent by each participant correspond to the same data type;

if so, performing joint calculation on the to-be-federated training data sent by each participant to obtain a joint calculation result.

Therefore, by implementing the optional embodiment, joint calculation can be performed under the condition that the data to be subjected to federal training, which are sent by each participant, correspond to the same data type, so that the validity of the joint calculation result is ensured, and the model training efficiency is improved.

In an exemplary embodiment of the disclosure, after each participant updates the corresponding model parameter according to the joint result, the apparatus further includes:

and training the model after the parameters are updated based on the new sample data by each participant until no new sample exists in the sample set.

Therefore, by implementing the optional embodiment, the federal training can be realized based on a third party, and the model optimization is performed based on the result of the federal training, so that the generalization of the model can be improved.

It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.

For details that are not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the model parameter updating method of the present disclosure for the details that are not disclosed in the embodiments of the apparatus of the present disclosure.

Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:管理装置以及管理系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!