Horizontal federation modeling optimization method, device, equipment and readable storage medium

By setting up private and public partial models in participating devices and performing parameter updates locally, the problem of local models in the existing technology is solved, and flexible adjustment and independent update of models are realized, and modeling efficiency and prediction are improved. Accuracy.

CN111967612BActive Publication Date: 2025-02-11WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010850612.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-21
Publication Date
2025-02-11
Estimated Expiration
2040-08-21

AI Technical Summary

Technical Problem

In the existing horizontal federated learning method, the local models of each participant are difficult to adjust flexibly and cannot be modified independently.

Method used

By setting up a local basic model including the private part model and the public part model in the participating device, and performing parameter update operations locally, obtaining parameter update information for public and private part models, and sending parameter update information for public part models for federal fusion. Update parameters for both public and private partial models.

Benefits of technology

It realizes flexible adjustment and independent update of models of each participating device, improves modeling efficiency, saves computing resources, and ensures data privacy and model prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111967612B_ABST
    Figure CN111967612B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and readable storage medium for optimizing horizontal federated modeling, the method comprising: using a preset local data set to perform parameter update operation on a local basic model, obtaining parameter update information corresponding to a private part model and a public part model in the local basic model, wherein the public part model structure of each participating device is the same; sending the parameter update information corresponding to the public part model to a coordination device participating in horizontal federated modeling, so that the coordination device can perform federated fusion on the parameter update information sent by each participating device to obtain global update information; using the global update information received from the coordination device to update the model parameters in the public part model, and using the parameter update information of the private part model to update the model parameters in the private part model, so as to update the local basic model. After the present invention realizes horizontal federated modeling, each participating device can flexibly adjust its own local model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a horizontal federated modeling optimization method, device, equipment and readable storage medium. Background Art

[0002] At present, federated learning has attracted much attention from all parties as a new privacy and security protection method. "Federated learning" is a concept proposed by people to solve the problem of data islands. It allows both parties in the federation to train models and obtain model parameters without providing their own data, and can avoid the problem of data privacy leakage. Horizontal federated learning, also known as feature-aligned federated learning, is to take out the part of the data with the same client data features but different users for joint machine learning when the data features of each client overlap a lot (that is, the data features are aligned) and the user overlap is small. However, after the horizontal federated learning is federated modeling, it is difficult to modify the local model of the participants. If you want to modify it, you must work with other participants to modify it together. That is, in the current horizontal federated learning method, the local models of each participant cannot be flexibly adjusted. Summary of the invention

[0003] The main purpose of the present invention is to provide a horizontal federated modeling optimization method, device, equipment and readable storage medium, aiming to solve the problem that the local models of each participant in the current horizontal federated learning method cannot be flexibly adjusted.

[0004] To achieve the above object, the present invention provides a horizontal federation modeling optimization method, which is applied to participating devices participating in horizontal federation modeling, and the method comprises the following steps:

[0005] Using a preset local data set to perform a parameter update operation on a local basic model, obtaining parameter update information corresponding to a private part model and a public part model in the local basic model, wherein the public part model structure of each participating device is the same;

[0006] Sending parameter update information corresponding to the public part model to the coordination device participating in horizontal federation modeling, so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain global update information;

[0007] The model parameters in the public part model are updated by using the global update information received from the coordination device, and the model parameters in the private part model are updated by using the parameter update information of the private part model, so as to update the local basic model.

[0008] Optionally, after the step of updating the model parameters in the public part model by using the global update information received from the coordination device and updating the model parameters in the private part model by using the parameter update information of the private part model to update the local basic model, the method further includes:

[0009] When a local private task is detected, a private replacement model corresponding to the local private task is obtained;

[0010] The private replacement model is used to replace the private part model in the updated local basic model to obtain a local private task model;

[0011] A parameter updating operation is performed on the local private task model using a local data set corresponding to the local private task, so as to update model parameters in the local private task model.

[0012] Optionally, after the step of updating the model parameters in the public part model by using the global update information received from the coordination device and updating the model parameters in the private part model by using the parameter update information of the private part model to update the local basic model, the method further includes:

[0013] When a public task is detected, a public replacement model corresponding to the public task is obtained;

[0014] The public replacement model is used to replace the public part model in the updated local basic model to obtain a local public task model;

[0015] The local data set corresponding to the public task is used as the preset local data set, and the local public task model is used as the local basic model, and then the steps are executed: the preset local data set is used to perform parameter update operation on the local basic model to obtain parameter update information corresponding to the private part model and the public part model in the local basic model respectively.

[0016] Optionally, the step of sending the parameter update information corresponding to the public part model to the coordination device participating in the horizontal federation modeling so that the coordination device performs federation fusion on the parameter update information sent by each participating device to obtain the global update information includes:

[0017] Performing an approximate quantization operation on the parameter update information corresponding to the public part model to obtain quantized update information;

[0018] The quantized update information is sent to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the quantized update information sent by each participating device to obtain the global update information.

[0019] Optionally, the step of performing a quantization operation on the parameter update information corresponding to the public part model to obtain the quantized update information includes:

[0020] Substituting the parameter update information corresponding to the preset integer vector and the common part model into the cosine similarity formula, wherein the value of each element of the preset integer vector is to be determined;

[0021] The cosine similarity formula is solved to obtain the value of each element of the preset integer vector, and the preset integer vector with the determined value of each element is used as the quantization update information, wherein the preset integer vector with the determined value of each element maximizes the cosine value of the cosine similarity formula.

[0022] Optionally, when the preset local data set is an image data set, the step of performing a parameter update operation on the local basic model using the preset local data set to obtain parameter update information corresponding to the private part model and the public part model in the local basic model includes:

[0023] Inputting the image data set into a local basic model to obtain a classification prediction result corresponding to each image in the image data set;

[0024] Calculating the classification loss of the local basic model based on the classification prediction results and the true classification labels corresponding to each image;

[0025] Based on the classification loss, gradient information corresponding to the private part model and the public part model in the local basic model is calculated, and the gradient information is used as parameter update information.

[0026] Optionally, when the preset local data set is an image data set, after the step of using the global update information received from the coordination device to update the model parameters in the public part model and using the parameter update information of the private part model to update the model parameters in the private part model to update the local basic model, the method further includes:

[0027] When it is detected that the updated local basic model meets the preset model condition, the updated local basic model is used as the target model;

[0028] Input the image data to be classified into the private part model of the target model for processing to obtain an intermediate result; input the intermediate result into the public part model of the target model for processing to obtain a classification result of the image data to be classified; or,

[0029] The image data to be classified is divided into a first part of image data and a second part of image data; the first part of image data and the second part of image data are processed by a private part model and a public part model of the target model respectively to obtain a private result and a public result; the private result and the public result are combined to obtain a classification result of the image data to be classified.

[0030] To achieve the above object, the present invention provides a horizontal federation modeling optimization device, which is deployed on a participating device participating in horizontal federation modeling, and includes:

[0031] A first updating module is used to perform a parameter updating operation on a local basic model using a preset local data set to obtain parameter updating information corresponding to a private part model and a public part model in the local basic model, wherein the public part model structures of all participating devices are the same;

[0032] A sending module, used to send parameter update information corresponding to the public part model to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain global update information;

[0033] The second updating module is used to update the model parameters in the public part model using the global update information received from the coordination device, and to update the model parameters in the private part model using the parameter update information of the private part model, so as to update the local basic model.

[0034] To achieve the above-mentioned objectives, the present invention also provides a horizontal federated modeling optimization device, which includes: a memory, a processor, and a horizontal federated modeling optimization program stored in the memory and executable on the processor, wherein the horizontal federated modeling optimization program implements the steps of the horizontal federated modeling optimization method described above when executed by the processor.

[0035] In addition, to achieve the above-mentioned purpose, the present invention also proposes a computer-readable storage medium, on which a horizontal federated modeling optimization program is stored. When the horizontal federated modeling optimization program is executed by a processor, the steps of the horizontal federated modeling optimization method as described above are implemented.

[0036] In the present invention, by setting a local basic model including a private part model and a public part model in the participating devices, and setting the public part model structure in each participating device to be the same, each participating device uses its local data set to perform parameter update operations on the local basic model, obtains parameter update information corresponding to the private part model and the public part model in the local basic model, and then sends the parameter update information corresponding to the public part model to the coordination device for federal fusion to obtain global update information, updates the model parameters of the public part model based on the global update information, and updates the model parameters of each private part model based on the parameter update information of the private part model, so as to update the local basic model and complete the public-private mixed federal modeling. Since the public part model structure in the local basic model of each participating device is the same, each participating device can jointly complete the federal modeling. While the data privacy in each participating device is guaranteed based on the federal modeling, the amount of training data of the model is also expanded, so that the model prediction accuracy of the local basic model is optimized. At the same time, compared with the existing horizontal federation modeling in which each participating device cannot modify its own local model independently, in the present invention, since the local basic model of each participating device also includes a private part model, the model parameter update optimization of the private part model is performed locally by each participating device separately, so each participating device can set a private part model of different structure according to the difference of its own modeling task, and can flexibly adjust its own private part model without cooperating with other participating devices to modify the private part model, thereby improving the modeling efficiency of the participating devices and saving the computing resources inside the participating devices. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0038] Figure 2 It is a flowchart of the first embodiment of the horizontal federation modeling optimization method of the present invention;

[0039] Figure 3 is a formula (1) involved in the embodiment of the present invention;

[0040] Figure 4 is a formula (2) involved in the embodiment of the present invention;

[0041] Figure 5 It is a functional schematic module diagram of a preferred embodiment of the horizontal federation modeling optimization device of the present invention.

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

[0043] 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.

[0044] 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.

[0045] It should be noted that the horizontal federated modeling optimization device in the embodiment of the present invention can be a smart phone, a personal computer, a server and other devices, and no specific limitation is made here.

[0046] like Figure 1 As shown, the horizontal federation modeling optimization 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 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.

[0047] Those skilled in the art will understand that Figure 1 The device structure shown in does not constitute a limitation on the horizontal federated modeling optimization device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0048] 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 horizontal federated modeling optimization program. The operating system is a program that manages and controls the hardware and software resources of the device, and supports the operation of the horizontal federated modeling optimization program and other software or programs. Figure 1 In the device shown, the user interface 1003 is mainly used for data communication with the client; the network interface 1004 is mainly used for establishing a communication connection with the server; the processor 1001 can be used to call the horizontal federation modeling optimization program stored in the memory 1005 and perform the following operations:

[0049] Using a preset local data set to perform a parameter update operation on a local basic model, obtaining parameter update information corresponding to a private part model and a public part model in the local basic model, wherein the public part model structure of each participating device is the same;

[0050] Sending parameter update information corresponding to the public part model to the coordination device participating in horizontal federation modeling, so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain global update information;

[0051] The model parameters in the public part model are updated by using the global update information received from the coordination device, and the model parameters in the private part model are updated by using the parameter update information of the private part model, so as to update the local basic model.

[0052] Further, after the step of updating the model parameters in the public part model by using the global update information received from the coordination device and updating the model parameters in the private part model by using the parameter update information of the private part model to update the local basic model, the processor 1001 may also be used to call the horizontal federated modeling optimization program stored in the memory 1005 and perform the following operations:

[0053] When a local private task is detected, a private replacement model corresponding to the local private task is obtained;

[0054] The private replacement model is used to replace the private part model in the updated local basic model to obtain a local private task model;

[0055] A parameter updating operation is performed on the local private task model using a local data set corresponding to the local private task, so as to update model parameters in the local private task model.

[0056] Further, after the step of updating the model parameters in the public part model by using the global update information received from the coordination device and updating the model parameters in the private part model by using the parameter update information of the private part model to update the local basic model, the processor 1001 may also be used to call the horizontal federated modeling optimization program stored in the memory 1005 and perform the following operations:

[0057] When a public task is detected, a public replacement model corresponding to the public task is obtained;

[0058] The public replacement model is used to replace the public part model in the updated local basic model to obtain a local public task model;

[0059] The local data set corresponding to the public task is used as the preset local data set, and the local public task model is used as the local basic model, and then the steps are executed: the preset local data set is used to perform parameter update operation on the local basic model to obtain parameter update information corresponding to the private part model and the public part model in the local basic model respectively.

[0060] Furthermore, the step of sending the parameter update information corresponding to the public part model to the coordination device participating in the horizontal federation modeling so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain the global update information includes:

[0061] Performing an approximate quantization operation on the parameter update information corresponding to the public part model to obtain quantized update information;

[0062] The quantized update information is sent to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the quantized update information sent by each participating device to obtain the global update information.

[0063] Furthermore, the step of performing a quantization operation on the parameter update information corresponding to the public part model to obtain the quantized update information includes:

[0064] Substituting the parameter update information corresponding to the preset integer vector and the common part model into the cosine similarity formula, wherein the value of each element of the preset integer vector is to be determined;

[0065] The cosine similarity formula is solved to obtain the value of each element of the preset integer vector, and the preset integer vector with the determined value of each element is used as the quantization update information, wherein the preset integer vector with the determined value of each element maximizes the cosine value of the cosine similarity formula.

[0066] Furthermore, when the preset local data set is an image data set, the step of performing a parameter update operation on the local basic model using the preset local data set to obtain parameter update information corresponding to the private part model and the public part model in the local basic model includes:

[0067] Inputting the image data set into a local basic model to obtain a classification prediction result corresponding to each image in the image data set;

[0068] Calculating the classification loss of the local basic model based on the classification prediction results and the true classification labels corresponding to each image;

[0069] Based on the classification loss, gradient information corresponding to the private part model and the public part model in the local basic model is calculated, and the gradient information is used as parameter update information.

[0070] Further, when the preset local data set is an image data set, after the step of using the global update information received from the coordination device to update the model parameters in the public part model, and using the parameter update information of the private part model to update the model parameters in the private part model to update the local basic model, the processor 1001 can also be used to call the horizontal federated modeling optimization program stored in the memory 1005, and perform the following operations:

[0071] When it is detected that the updated local basic model meets the preset model condition, the updated local basic model is used as the target model;

[0072] Input the image data to be classified into the private part model of the target model for processing to obtain an intermediate result; input the intermediate result into the public part model of the target model for processing to obtain a classification result of the image data to be classified; or,

[0073] The image data to be classified is divided into a first part of image data and a second part of image data; the first part of image data and the second part of image data are processed by a private part model and a public part model of the target model respectively to obtain a private result and a public result; the private result and the public result are combined to obtain a classification result of the image data to be classified.

[0074] Based on the above structure, various embodiments of the horizontal federation modeling optimization method are proposed.

[0075] Reference Figure 2 , Figure 2 The flowchart of the first embodiment of the horizontal federated modeling optimization method of the present invention is shown. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than here. The horizontal federated modeling optimization method of the present invention is applied to participating devices in federated learning, and multiple participating devices are communicatively connected with the coordinating device participating in horizontal federated learning. The participating devices and the coordinating device can be devices such as smart phones, personal computers and servers. In this embodiment, the horizontal federated modeling optimization method includes:

[0076] Step S10, performing a parameter update operation on the local basic model using a preset local data set, and obtaining parameter update information corresponding to the private part model and the public part model in the local basic model, wherein the public part model structure of each participating device is the same;

[0077] In this embodiment, the coordinating device and each participating device can pre-establish a communication connection through handshake, identity authentication and other operations, and determine the model structure in each participating device of this federation modeling. The local model of each participating device (hereinafter referred to as the local basic model) may include two parts: a private part model and a public part model. The public part model structure of each participating device is the same in preparation for federal fusion. The structure of the private part model can be set differently, and can be specifically set according to the local modeling tasks of each participating device. The local basic model can be any machine learning model, wherein the connection method between the private part model and the public part model is not limited in this embodiment, and can be specifically set by the participating device according to the modeling task. For example, when the modeling task is to build an image classification model, the local basic model can adopt an image convolutional neural network structure, in which the front input layer and convolution layer and other network layers can be set as public part networks, and the subsequent fully connected layer and output layer and other network layers can be set as private part networks. Then, each participating device can set the specific structure of the fully connected layer and the output layer according to its own image classification requirements, so that the local basic model of each participating device outputs different image classification results. For example, participating device A sets the output layer to output 20 categories of classification labels, and participating device B sets the output layer to output 30 categories of classification labels.

[0078] Before federated modeling, the model parameters of the local basic model in each participating device are initialized randomly or in other ways. During the federated modeling process, each participating device performs multiple rounds of joint parameter updates to optimize and update the model parameters in their respective local basic models, and finally obtains a local basic model that meets the modeling requirements.

[0079] Specifically, during a round of joint parameter update, the participating devices first obtain the preset local data set to be used in this round of joint parameter update. The preset local data set may be a pre-collected data set for modeling, and the data set of each participating device may contain privacy data, so the participating devices will not directly transfer the data set to each other. The participating devices use the preset local data set to perform parameter update operations on the local basic model. If it is the first round of joint parameter update, the model parameters in the local basic model are initialized before the parameter update operation. If it is a joint parameter update after the first round, the model parameters in the local basic model before the parameter update operation are the model parameters after the previous round of update.

[0080] After the participating device performs the parameter update operation, the parameter update information corresponding to the private part model and the public part model in the local basic model is obtained. The parameter update information can be the gradient corresponding to the model parameter, or it can be the updated model parameter. Since the private part model and the public part model have corresponding model parameters, the parameter update information corresponding to the two parts is also obtained after the parameter update operation. Specifically, when the parameter update information is the gradient corresponding to the model parameter, the specific process of the participating device performing the parameter update operation can be: inputting the preset local data set into the local basic model for processing to obtain the prediction result; calculating the loss function of the local basic model based on the prediction result and the real label corresponding to the preset local data set; and calculating the gradient corresponding to each model parameter in the private part model and the gradient corresponding to each model parameter in the public part model based on the loss function. When the parameter update information is the updated model parameter, the specific process of the participating device performing the parameter update operation can be based on the above process, updating the model parameters in the private part model based on the gradient of the model parameter in the private part model, and updating the model parameters in the public part model based on the gradient of the model parameter in the public part model. Among them, the loss function can adopt the commonly used machine learning model loss function, and the method of calculating the gradient according to the loss function and updating the parameters according to the gradient can adopt the existing machine learning model parameter updating method, which will not be described in detail here.

[0081] Step S20, sending parameter update information corresponding to the public part model to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain global update information;

[0082] The participating devices send the parameter update information corresponding to the public part model to the coordination device. The coordination device performs federation fusion on the parameter update information sent by each participating device to obtain global update information. The federation fusion can be an average or weighted average of each parameter update information. The commonly used federation fusion method can be used, which is not limited here. The coordination device sends the global update information to each participating device.

[0083] Step S30: Use the global update information received from the coordination device to update the model parameters in the public part model, and use the parameter update information of the private part model to update the model parameters in the private part model, so as to update the local basic model.

[0084] The participating devices receive the global update information sent by the coordinating device, and use the global update information to update the model parameters in the public part model. Specifically, when the parameter update information is a gradient, the global update information is also a gradient, and the participating devices update the model parameters in the public part model according to the global update information, that is, update the model parameters according to the gradient; when the parameter update information is a model parameter, the global update information is also a model parameter, and the participating devices directly use the global update information as the updated model parameters of the public part model.

[0085] The participating devices use the parameter update information of the private part model to update the model parameters in the private part model. Specifically, when the parameter update information is a gradient, the participating devices update the model parameters in the private part model according to the parameter update information, that is, update the model parameters according to the gradient; when the parameter update information is a model parameter, the participating devices directly use the parameter update information as the updated model parameters of the private part model. After updating the model parameters in the private part model and the public part model, the local basic model is updated, and a round of joint parameter update is completed.

[0086] After multiple rounds of joint parameter updates, if the local basic model is detected to have converged, or the number of iteration rounds is detected to have reached a predetermined maximum number of rounds, or the time for joint modeling is detected to have reached a predetermined maximum number of time, or other predetermined stop conditions are detected, the participating devices can end the joint parameter update, use the latest updated local basic model as the target model for modeling completion, and complete the prediction task based on the target model.

[0087] In this embodiment, by setting a local basic model including a private part model and a public part model in the participating devices, and setting the public part model structure in each participating device to be the same, each participating device uses its local data set to perform parameter update operations on the local basic model, and obtains parameter update information corresponding to the private part model and the public part model in the local basic model, and then sends the parameter update information corresponding to the public part model to the coordination device for federal fusion to obtain global update information, and updates the model parameters of the public part model based on the global update information, and updates the model parameters of each private part model based on the parameter update information of the private part model, so as to update the local basic model and complete the public-private mixed federal modeling. Since the public part model structure in the local basic model of each participating device is the same, each participating device can jointly complete the federal modeling. While the data privacy in each participating device is guaranteed based on the federal modeling, the amount of training data of the model is also expanded, so that the model prediction accuracy of the local basic model is optimized. At the same time, compared with the existing horizontal federation modeling in which each participating device cannot modify its own local model independently, in the present embodiment, since the local basic model of each participating device also includes a private part model, the model parameter update optimization of the private part model is performed locally by each participating device separately, so each participating device can set a private part model of different structure according to the difference of their respective modeling tasks, and can flexibly adjust their own private part model without cooperating with other participating devices to modify the private part model, thereby improving the modeling efficiency of the participating devices and saving the computing resources inside the participating devices.

[0088] Further, based on the above first embodiment, a second embodiment of the horizontal federation modeling optimization method of the present invention is proposed. In this embodiment, the method further includes:

[0089] Step S40, when a local private task is detected, obtaining a private replacement model corresponding to the local private task;

[0090] After a round of joint parameter update to obtain an updated local basic model, or after the joint parameter update is completed, if the participating device detects a local private task, it can obtain a private replacement model corresponding to the local private task. Among them, the local private task is a task triggered by the participating device to replace the model structure of the private part model to adapt to the new modeling task. The new modeling task may be different from the federal modeling task and has nothing to do with other participating devices. The local private task may correspond to a private replacement model, which may be a model structure pre-set based on the new modeling task, and the model parameters in the private replacement model may be initialized by random or other means.

[0091] Step S50, using the private replacement model to replace the private part model in the updated local basic model to obtain a local private task model;

[0092] The participating devices use the private replacement model to replace the private part model in the updated local basic model, while the public part model remains unchanged. After the replacement, a local private task model consisting of the original public part model and the private replacement model is obtained.

[0093] Step S60: performing a parameter update operation on the local private task model using the local data set corresponding to the local private task, so as to update the model parameters in the local private task model.

[0094] A local data set corresponding to a local private task may be pre-set in the participating device, and the participating device uses the local data set to perform a parameter update operation on the local private task model to update the model parameters in the local private task model. It should be noted that the parameter update operation in this step is not necessarily the same as the parameter update operation in the first embodiment described above. In this step, the parameter update operation may be one or more rounds of parameter updates, and the process of a round of parameter updates may be: inputting the local data set into the local private task model for processing to obtain a prediction result; calculating the loss function of the local private task model based on the prediction result and the true label corresponding to the local data set; calculating the gradient corresponding to each model parameter in the local private task model based on the loss function, wherein the model parameters include the model parameters in the private replacement model and the model parameters in the public part model; updating each model parameter according to the gradient to complete a round of parameter updates. After multiple rounds of parameter updates, if the participating device detects that the local private task model converges, or detects that the number of iteration rounds reaches a predetermined maximum round, or detects that the time for local parameter update reaches a predetermined maximum time, or detects other predetermined stop conditions, the participating device can end the local parameter update, use the latest updated local private task model as the target model for local modeling, and can complete the corresponding prediction task based on the target model.

[0095] For example, a federated modeling task is to build an image classification model with 20 categories of classification labels. Based on the federated modeling task, the model structure of the public part model in the local basic model set by the participating devices is an image feature extraction layer, and the model structure of the private part model is a multi-classifier suitable for 20 categories of classification labels, which is connected to the image feature extraction layer. After the participating devices jointly model the optimized and updated local basic model, a local private task is detected. The new modeling task corresponding to the local private task is to build an image classification model with 30 categories of classification labels. Then, the private replacement model corresponding to the local private task is a multi-classifier suitable for 30 categories of classification labels, and the model parameters of the multi-classifier are initialized. The multi-classifier corresponding to the local private task is used to replace the original multi-classifier in the updated local basic model, while the original image feature extraction layer remains unchanged, so as to obtain a local private task model. The participating devices use the local data set corresponding to the local private task, that is, the image data set corresponding to the 30 categories of classification labels, to perform parameter update operations on the local private task model, and optimize and update the model parameters of the image feature extraction layer and the multi-classifier in the local private task model. Since the image feature extraction layer is obtained through federated modeling, it has learned a large number of image features. Therefore, compared with the image feature extraction layer that has not undergone federated modeling, it has a better feature extraction effect. In addition, after the parameter update operation of the participating devices, the feature extraction effect of the image feature extraction layer is further optimized under the new data set. Although the multi-classifier in the local private task model is initialized, the effective features extracted by the image feature extraction layer provide a convergence direction for the multi-classifier, so that the multi-classifier can converge quickly, thereby improving the completion speed of the participating devices' new modeling tasks and reducing the consumption of computing resources of the participating devices. On this basis, the participating devices also obtained an image classification model capable of performing 30 categories of classification.

[0096] In this embodiment, after federal modeling, the participating devices can replace the private part of the network in the updated local basic model in the federal modeling based on the local private tasks to adapt to the new modeling tasks, thereby enabling the participating devices to flexibly adjust the local model.

[0097] Further, based on the above-mentioned first and / or second embodiments, a third embodiment of the horizontal federation modeling optimization method of the present invention is proposed. In this embodiment, the method further includes:

[0098] Step S70, when a public task is detected, obtaining a public replacement model corresponding to the public task;

[0099] After a round of joint parameter update to obtain the updated local basic model, or after the joint parameter update is completed, if the participating device detects a public task, it can obtain the public replacement model corresponding to the public task. Among them, the public task is a task triggered by the participating device to replace the model structure of the public part model to adapt to the new federal modeling task. The new federal modeling task may be different from the previous federal modeling task. The new federal modeling task is determined together with other participating devices, and the other participating devices here may be the same as or different from the other participating devices in the previous federal modeling. The public task may correspond to a public replacement model, which may be pre-negotiated and determined with other participating devices, or broadcast by a coordinating device. The model parameters in the public replacement model may be initialized by random or other means.

[0100] Step S90, using the public replacement model to replace the public part model in the updated local basic model to obtain a local public task model;

[0101] The participating devices use the public replacement model to replace the public part model in the updated local basic model, while the private part model remains unchanged. After the replacement, a local public task model consisting of the public replacement model and the original private replacement model is obtained.

[0102] Step S80, taking the local data set corresponding to the public task as the preset local data set, adopting the local public task model as the local basic model, and then executing the step: using the preset local data set to perform parameter update operation on the local basic model, and obtaining parameter update information corresponding to the private part model and the public part model in the local basic model respectively.

[0103] A local data set corresponding to a public task may be pre-set in the participating device. The participating device uses the local data set as a preset data set, that is, as a data set for a new federated modeling, and uses the local public task model as a local basic model, that is, as a local model for a new federated modeling, and then executes step S10 and subsequent steps. That is, the participating device uses the local data set to perform parameter update operations on the local public task model in the same manner, obtains parameter update information corresponding to the functional public replacement model and the private part model in the local public task model, respectively, sends the parameter update information corresponding to the public replacement network to the coordination device for federated fusion, obtains a global parameter update, updates the model parameters in the public replacement model according to the global parameter update, and updates the model parameters in the private part model according to the parameter update information corresponding to the private part model, so as to update the local public task model. After multiple rounds of joint parameter updates, if the local public task model is detected to have converged, or the number of iteration rounds is detected to have reached a predetermined maximum number of rounds, or the time for joint modeling is detected to have reached a predetermined maximum number of time, or other predetermined stop conditions are detected, the participating devices can end the joint parameter update, use the latest updated local public task model as the target model for modeling completion, and complete the prediction task based on the target model.

[0104] For example, the federated modeling task is to build an image semantic segmentation model to separate the building part and the non-building part in the image. Based on the federated modeling task, the model structure of the public part model in the local basic model set by the participating devices is the image feature extraction layer, and the model structure of the private part model is a binary classifier connected to the image feature extraction layer, which is used to classify each pixel in the feature pair of the input image extracted by the image feature extraction layer, that is, whether each pixel belongs to a building; after the participating devices jointly modeled the optimized and updated local basic model, a public task was detected. The new modeling task corresponding to the public task is to build a map for separating the vegetation area and the non-vegetation area in the image. Like the semantic segmentation model, the public replacement model corresponding to the public task is a new image feature extraction layer, and the model parameters in the new image feature extraction layer are initialized; the image feature extraction layer corresponding to the public task is used to replace the original image feature extraction layer in the updated local basic model, and the original binary classifier remains unchanged, so as to obtain a local public task model; the participating devices use the local data set corresponding to the public task, that is, a data set composed of a large number of images containing vegetation, to perform parameter update operations on the local public task model, optimize and update the model parameters of the image feature extraction layer and the binary classifier in the local public task model, and finally obtain an image semantic segmentation model for separating vegetation areas from non-vegetation areas. Since the binary classifier in the local public task model is obtained through the previous federated modeling, it has learned a lot of classification experience, and thus has better classification accuracy than the binary classifier that has not undergone federated modeling. Moreover, after the participating devices perform local federated modeling, the classification accuracy of the binary classifier is further optimized under the new data set. Although the image feature extraction layer in the local public task model is initialized, the accurate classification results of the binary classifier in turn provide a convergence direction for the image feature extraction layer, so that the image feature extraction layer can converge quickly, thereby improving the speed of the participating devices in performing a new federated modeling and reducing the consumption of computing resources of the participating devices.

[0105] In this embodiment, after federal modeling, the participating devices can replace the public part of the network in the updated local basic model in the federal modeling based on the public task to adapt to the new federal modeling task, thereby enabling the participating devices to flexibly adjust the local model.

[0106] Further, based on the above-mentioned first, second and / or third embodiments, a fourth embodiment of the horizontal federation modeling optimization method of the present invention is proposed. In this embodiment, the step S20 includes:

[0107] Step S201, performing an approximate quantization operation on the parameter update information corresponding to the public part model to obtain quantized update information;

[0108] After obtaining the parameter update information corresponding to the public part model, the participating device may perform an approximate quantization operation on the parameter update information corresponding to the public part model, and the result of the quantization operation is used as the quantization update information. Among them, the approximate quantization operation may be to retain the key information of the parameter update information when quantizing the parameter update information, so that the obtained quantization update information and the parameter update information are similar in key information. Specifically, the participating device may calculate the quantization information similar to the parameter update information based on a certain similarity algorithm to obtain the quantization update information of the parameter update information, and the similarity between the quantization update information and the parameter update information satisfies the preset similarity condition. Among them, the similarity algorithm may adopt some existing similarity algorithms, such as the cosine similarity formula. The preset similarity condition may be a pre-set condition, for example, the preset similarity condition may be that the similarity between the quantization update information and the parameter update information is greater than a certain threshold, and when it is greater than the threshold, it means that the quantization update information is very similar to the parameter update information. It should be noted that each information in the quantized update information can be information in a quantized form. For example, if each information in the original parameter update information is a continuous floating point number, then each information in the quantized update information is an integer value, which greatly reduces the storage space occupied compared to the original floating point number, thereby reducing communication overhead and improving communication efficiency.

[0109] Step S202: Send the quantized update information to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the quantized update information sent by each participating device to obtain global update information.

[0110] The participating devices send the quantized update information to the coordinating device. The coordinating device performs federation fusion on the quantized update information received from each participating device to obtain the global update information. The federation fusion may be an average or weighted average of each quantized update information. Specifically, a commonly used federation fusion method may be used, which is not limited here. The coordinating device sends the global update information to each participating device.

[0111] In this embodiment, the parameter update information is quantized to obtain quantized update information, and the quantized update information is sent to the coordination device. Since the quantized update information is a quantized information of the parameter update information, the storage space occupied is much smaller than the original parameter update information, so that the communication overhead required for information transmission is reduced, and the communication efficiency in the federated modeling process is improved. In addition, since the parameter update information is approximately quantized in the embodiment of the present invention, the quantized information similar to the parameter update information is obtained, so that after the quantized update information is sent to the coordination device, the coordination device can directly use the quantized update information for subsequent federated learning, and there is no need to restore the quantized update information, thereby reducing the amount of calculation of the coordination device, and reducing the storage space occupied by the coordination device, and improving the efficiency of federated learning modeling. In addition, in this embodiment, by sending the quantized update information of the parameter update information to the coordination device instead of sending the parameter update information itself to the coordination device, during the information transmission process, even if it is intercepted by a third-party attacker, it is not the original parameter update information that is obtained, so that the input data of the federated learning model cannot be derived, and the privacy information cannot be obtained, thereby improving the privacy protection strength in the process of federated learning information transmission.

[0112] Furthermore, the step S201 includes:

[0113] Step S2011, substituting the parameter update information corresponding to the preset integer vector and the common part model into the cosine similarity formula, wherein the value of each element of the preset integer vector is to be determined;

[0114] Step S2012, solving the cosine similarity formula to obtain the element values ​​of the preset integer vector, and using the preset integer vector of each element value determined as quantization update information, wherein the preset integer vector of each element value determined maximizes the cosine value of the cosine similarity formula.

[0115] The parameter update information corresponding to the public part model may be gradient information or model parameter information, and both the gradient information and the model parameter information may be in vector form.

[0116] The participating device may substitute the parameter update information corresponding to the preset integer vector and the public part model (hereinafter referred to as the vector to be transferred) into the cosine similarity formula, that is, calculate the cosine value of the preset integer vector and the vector to be transferred, wherein the value of each element of the preset integer vector is to be determined, specifically, each element value may be randomly initialized; solve the value of each element of the preset integer vector based on the cosine similarity formula, and each element value obtained by solving maximizes the cosine value of the cosine similarity formula, that is, maximizes the cosine value of the preset integer vector and the vector to be transferred; and use the preset integer vector with each element value determined as the quantized update information of the vector to be transferred. The solution process may be: select multiple possible element values ​​of the preset integer vector, calculate the corresponding cosine values ​​according to the multiple possible element values, select the largest cosine value from the multiple cosine values, and use each element value corresponding to the cosine value as the element value finally determined by the preset integer vector. It can be understood that when the cosine value of two vectors is the largest, the two vectors are closest in direction.

[0117] In one embodiment, a method for calculating the quantized update information based on the cosine similarity formula is also provided, which makes the calculation efficiency faster, thereby saving calculation resources and improving the overall communication efficiency.

[0118] Specifically, the descending vector corresponding to the vector to be transferred can be obtained first. Specifically, the absolute values ​​of the elements of the vector to be transferred are calculated and then arranged in descending order to obtain the descending vector corresponding to the vector to be transferred. The values ​​of the elements of the obtained descending vector are all greater than zero and are arranged from large to small according to the values.

[0119] Furthermore, obtaining the descending vector corresponding to the vector to be transferred may also be: normalizing the vector to be transferred to obtain the normalized vector; taking the absolute value of each element in the normalized vector and arranging them in descending order to obtain the descending vector. The normalization process is to keep the direction of the vector to be transferred unchanged and to set the length of the vector to be transferred to 1. The specific process can refer to the existing process of normalizing the vector, and will not be described in detail here.

[0120] Substitute the descending vector and the candidate quantity value into the maximization formula for maximizing the target value for calculation, and select the candidate quantity value that maximizes the target value as the target quantity value, wherein the maximization formula is constructed based on the cosine similarity formula, in which the target value is equal to the result obtained by summing the target elements in the descending vector and dividing it by the target quantity under the square root, and the target element is the element in the descending vector whose sequence number is less than or equal to the candidate quantity value. In other words, a maximization formula can be constructed based on the cosine similarity formula, which is a formula for maximizing the target value, in which the target value is equal to the result obtained by summing the target elements in the descending vector and dividing it by the target quantity under the square root, wherein the target element is the element in the descending vector whose sequence number is less than or equal to the candidate quantity value. The process of solving the maximization formula is to substitute each candidate quantity value and the target element in the descending vector into the maximization formula to obtain the candidate quantity value that maximizes the target value.

[0121] After the target quantity value is calculated, the operation of assigning the quantization value can be performed based on the target quantity value, that is, the value of each element of the quantization update information is determined, and then the quantization update information corresponding to the vector to be transmitted is obtained. Specifically, the number of elements of the quantization update information is the same as the number of elements of the normalized vector, and the sequence number of the element in the quantization update information corresponds to the sequence number of the element in the normalized vector. Then, a quantization value can be assigned to each element of the normalized vector, and the quantization value is used as the element value of the corresponding position of the quantization update information, so as to obtain the quantization update information.

[0122] Furthermore, the elements in the descending vector whose serial numbers are less than or equal to the target quantity value can be determined as descending elements, that is, the first several largest elements are regarded as descending elements. The descending vector is a vector sorted in descending order after the absolute value of the normalized vector is calculated. Then, each element in the normalized vector corresponds to each element in the descending vector. The elements corresponding to each descending element in the normalized vector can be regarded as reserved elements, that is, the several elements with the largest absolute values ​​in the normalized vector are regarded as reserved elements. Further, 0 is assigned to the elements other than the reserved elements in the normalized vector, positive 1 is assigned to the elements greater than zero in the reserved elements, negative 1 is assigned to the elements less than zero in the reserved elements, and if the reserved element is 0, 0 is assigned accordingly. Then, the quantization value is assigned to each element of the normalized vector, and the quantization update information is obtained. The value of each element value in the quantization update information is 0, -1 or +1.

[0123] The principle is: using W = (w 1 , w 2 ,…,w n ) to represent the vector to be transferred, W 0 =(a 1 , a 2 , …, a n) is the vector obtained by normalizing W, and the quantization update information T = (t 1 , t 2 ,…,t i ,…t n ), where t i ∈{0, ±1} or t i ∈{±1}, according to the cosine similarity formula, establish Figure 3 W, W shown 0 and T. According to the relationship (1), to maximize the cosine value, the denominator of the rightmost term in the relationship needs to be larger and the numerator smaller. The numerator is the square root of the sum of the squares of the values ​​of each element in T, which can be converted to the square root of the number of elements in T whose absolute value is 1. The denominator is W 0 The elements of T are multiplied and summed. In order to make the denominator larger, the absolute value of the elements in T is 1, and it is consistent with W. 0 When the corresponding elements in T have the same sign, the denominator will be larger, and when there are more elements with an absolute value of 1 in T, the numerator will also become larger. Then, we need to find the appropriate number of elements with an absolute value of 1 in T to maximize the result, and when there are more elements with an absolute value of 1 in T, the corresponding W 0 The larger the element in is, the larger the denominator is, so W 0 The elements in T corresponding to the largest elements in are assigned quantized values ​​with an absolute value of 1.

[0124] According to the above reasoning process, equation (1) is transformed into Figure 4 The formula (2) shown in the figure is the maximization formula. 0 Take the absolute value of each element to get {|a 1 ∣,∣a 2 ∣, …, ∣a n ∣}, for {∣a 1 ∣,∣a 2 ∣, …, ∣a n |} Arrange in descending order to obtain vector B = {b 1 , b 2 , …, b n}, the quantized vector T' corresponding to vector B = (t 1 ',t 2 ', ..., t i ',…t n '), where t i ' indicates the original i The number of non-zeros in T' is M (M = 1, ..., N), then when j∈(M+1, ..., N), t i' are all zero. By solving equation (2), we can get an M that maximizes the result of (2), that is, the target value. After obtaining M, we get the number of elements in T with an absolute value of 1, and according to the corresponding relationship between the descending vector and the normalized vector elements, we determine which elements in T have an absolute value of 1, and then according to the positive and negative of the elements in the normalized vector, we determine the positive and negative of the elements in T with an absolute value of 1, that is, if the element in the normalized vector is positive, the corresponding element in T is +1, and if the element in the normalized vector is negative, the corresponding element in T is -1.

[0125] In this embodiment, in the process of calculating the quantization update information of the vector to be transmitted based on the cosine similarity formula, the nonlinear integer problem is transformed into a linear optimization problem, that is, it is transformed into a problem of solving the maximization formula, and the amount of calculation of the optimization solution is reduced to O(n*log n), which is smaller than the amount of calculation O(N*log n) using the function transformation method. 2 ), this embodiment greatly reduces the amount of computation in the process of federated learning information transmission, thereby improving the communication efficiency while also improving the overall efficiency of the federated learning modeling process.

[0126] Furthermore, based on the first, second, third and / or fourth embodiments above, a fifth embodiment of the horizontal federated modeling optimization method of the present invention is proposed. In this embodiment, when the preset local data set is an image data set, step S10 includes:

[0127] Step S101, inputting the image data set into a local basic model to obtain a classification prediction result corresponding to each image in the image data set;

[0128] In this embodiment, the federated modeling task may be to build an image classification model, and the preset local data set may be a data set consisting of a large amount of image data corresponding to the target classification label, and the real classification label corresponding to each image data is preset, that is, which category each image data belongs to. The participating device inputs the image data set into the local basic model to obtain the classification prediction result corresponding to each image in the image data set.

[0129] Step S102, calculating the classification loss of the local basic model based on the classification prediction result and the true classification label corresponding to each image;

[0130] The participating devices calculate the classification loss of the local basic model based on the classification prediction results and the true classification labels corresponding to each image. The classification loss can use the loss function of the commonly used image classification model, and the classification loss can also be calculated using the commonly used loss function calculation method, which will not be described in detail here.

[0131] Step S103, based on the classification loss, obtain the gradient information corresponding to the private part model and the public part model in the local basic model, and use the gradient information as parameter update information.

[0132] The participating device calculates the gradient information corresponding to the private part model and the public part model in the local basic model according to the classification loss. Specifically, the method of calculating the gradient information according to the classification loss can adopt the commonly used method of calculating the gradient information according to the loss function, which will not be described in detail here. The participating device uses the gradient information as parameter update information.

[0133] Furthermore, in another embodiment, after calculating the gradient information, the participating device may update the model parameters of the private part model and the public part model in the local basic model according to the gradient information, and use the updated model parameters of the private part model as the parameter update information corresponding to the private part model, and use the updated model parameters of the public part model as the parameter update information corresponding to the public part model.

[0134] Furthermore, when the preset local data set is an image data set, the method further includes:

[0135] A10, when it is detected that the updated local basic model meets the preset model condition, the updated local basic model is used as the target model;

[0136] When the preset local data set is an image data set, and the federated modeling task is to build an image classification model, the model structure of the local basic model can adopt the model structure commonly used in image classification models, and divide the image classification model into two parts: a private part model and a public part model. For example, the image feature extraction layer at the front end of the image classification model is used as the public part model, and the multi-classifier at the back end is used as the private part model, or the image feature extraction layer at the front end is used as the private part model, and the multi-classifier at the back end is used as the public part model. After a round of joint parameter update to obtain the updated local basic model, it can be detected whether the updated local basic model meets the preset model conditions, wherein the preset model conditions can be set according to specific needs, for example, the local basic model needs to converge, or the iteration rounds need to reach a predetermined maximum round, or the iteration time needs to reach a predetermined maximum time, or other conditions. When it is detected that the updated local basic model meets the preset model conditions, the updated local basic model is used as the target model, that is, as the image classification model that has been modeled.

[0137] A20, inputting the image data to be classified into the private part model of the target model for processing to obtain an intermediate result;

[0138] A30, inputting the intermediate result into the public part model of the target model for processing to obtain the classification result of the image data to be classified.

[0139] In this embodiment, when the private part model of the target model is at the front end and the public part model is at the back end, that is, when the model is divided vertically, the image data to be classified can be input into the private part model of the target model for processing to obtain an intermediate result, and then the intermediate result can be input into the public part model of the model to be classified for processing to obtain a classification result of the image data to be classified.

[0140] In another embodiment, the step A10 includes:

[0141] Step A40, dividing the image data to be classified into a first portion of image data and a second portion of image data;

[0142] Step A50, processing the first portion of image data and the second portion of image data through the private portion model and the public portion model of the target model respectively to obtain a private result and a public result;

[0143] Step A60: combining the private result and the public result to obtain a classification result of the image data to be classified.

[0144] When the model is divided horizontally, that is, the public part model and the private part model process a part of the input data respectively, the image data to be classified can be divided into a first part of image data and a second part of image data, corresponding to the private part model and the public part model respectively. Among them, the way to divide the image data can be to directly cut the image into two areas, that is, cut it from the middle, and the image data of one part of the area is used as the first part of the image data, and the image data of the other part of the area is directly used as the second part of the image data. The first part of the image data is processed by the private part model in the target model to obtain a private result, and the second part of the image data is processed by the public part model in the target model to obtain a public result. Then the private result and the public result are combined to obtain the classification result of the image data to be classified. Specifically, the private result and the public result can be combined in a weighted average or summation manner, which is not limited here.

[0145] In this embodiment, an image classification model including a private part model and a public part model is set in the participating devices, and the public part model structure in each participating device is set to be the same. Each participating device uses its local image data set to perform parameter update operations on the image classification model, and obtains parameter update information corresponding to the private part model and the public part model in the image classification model. The parameter update information corresponding to the public part model is then sent to the coordination device for federal fusion to obtain global update information, and the model parameters of the public part model are updated based on the global update information. The model parameters of each private part model are updated based on the parameter update information of the private part model to update the image classification model and complete the public-private mixed federal modeling. Since the public part model structure in the image classification model of each participating device is the same, each participating device can jointly complete the federal modeling. While the data privacy in each participating device is guaranteed based on the federal modeling, the amount of training data of the model is also expanded, so that the classification accuracy of the image classification model is optimized. At the same time, compared with the existing horizontal federated modeling in which each participating device cannot modify its own local model independently, in the present embodiment, since the image classification model of each participating device also includes a private part model, the model parameter update optimization of the private part model is performed locally by each participating device separately. Therefore, each participating device can set a private part model with a different structure according to the difference of their respective modeling tasks, and can flexibly adjust their respective private part models to achieve different image classification tasks.

[0146] In addition, the embodiment of the present invention also provides a horizontal federation modeling optimization device, which is deployed on a participating device participating in the horizontal federation modeling. Figure 5 , the device comprises:

[0147] A first updating module 10 is used to perform a parameter updating operation on a local basic model using a preset local data set to obtain parameter updating information corresponding to a private part model and a public part model in the local basic model, wherein the public part model structures of all participating devices are the same;

[0148] The sending module 20 is used to send the parameter update information corresponding to the public part model to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain global update information;

[0149] The second updating module 30 is used to update the model parameters in the public part model using the global update information received from the coordination device, and to update the model parameters in the private part model using the parameter update information of the private part model, so as to update the local basic model.

[0150] Furthermore, the device also includes:

[0151] A first acquisition module, configured to acquire a private replacement model corresponding to the local private task after a local private task is detected;

[0152] A first replacement module, configured to use the private replacement model to replace the private part model in the updated local basic model to obtain a local private task model;

[0153] The third updating module is used to perform a parameter updating operation on the local private task model by using a local data set corresponding to the local private task, so as to update the model parameters in the local private task model.

[0154] Furthermore, the device also includes:

[0155] A second acquisition module is used to acquire a public replacement model corresponding to the public task after a public task is detected;

[0156] A second replacement module, used to replace the public part model in the updated local basic model with the public replacement model to obtain a local public task model;

[0157] An execution module is used to use the local data set corresponding to the public task as a preset local data set, adopt the local public task model as a local basic model, and then execute the steps: use the preset local data set to perform parameter update operations on the local basic model to obtain parameter update information corresponding to the private part model and the public part model in the local basic model.

[0158] Furthermore, the sending module 20 includes:

[0159] A quantization unit, used to perform an approximate quantization operation on the parameter update information corresponding to the public part model to obtain quantized update information;

[0160] The sending unit is used to send the quantized update information to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the quantized update information sent by each participating device to obtain the global update information.

[0161] Furthermore, the quantization unit includes:

[0162] A substitution subunit, used for substituting parameter update information corresponding to a preset integer vector and the common part model into a cosine similarity formula, wherein the value of each element of the preset integer vector is to be determined;

[0163] A solving subunit is used to solve the cosine similarity formula to obtain the value of each element of the preset integer vector, and use the preset integer vector with the determined value of each element as the quantization update information, wherein the preset integer vector with the determined value of each element maximizes the cosine value of the cosine similarity formula.

[0164] Further, when the preset local data set is an image data set, the first updating module 10 includes:

[0165] An input unit, used to input the image data set into a local basic model to obtain a classification prediction result corresponding to each image in the image data set;

[0166] A first calculation unit, used to calculate the classification loss of the local basic model based on the classification prediction result and the true classification label corresponding to each image;

[0167] The second calculation unit is used to calculate the gradient information corresponding to the private part model and the public part model in the local basic model based on the classification loss, and use the gradient information as parameter update information.

[0168] Furthermore, when the preset local data set is an image data set, the device further includes:

[0169] A determination module, configured to use the updated local basic model as a target model when it is detected that the updated local basic model meets a preset model condition;

[0170] A classification module, used for inputting the image data to be classified into the private part model of the target model for processing to obtain an intermediate result; inputting the intermediate result into the public part model of the target model for processing to obtain a classification result of the image data to be classified; or,

[0171] The classification module is used to divide the image data to be classified into a first part of image data and a second part of image data; process the first part of image data and the second part of image data through the private part model and the public part model of the target model respectively to obtain a private result and a public result; and combine the private result and the public result to obtain a classification result of the image data to be classified.

[0172] The expanded content of the specific implementation method of the horizontal federated modeling optimization device of the present invention is basically the same as the various embodiments of the above-mentioned horizontal federated modeling optimization method, and will not be repeated here.

[0173] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, on which a horizontal federated modeling optimization program is stored. When the horizontal federated modeling optimization program is executed by a processor, the steps of the horizontal federated modeling optimization method described below are implemented.

[0174] The various embodiments of the horizontal federated modeling optimization device and computer-readable storage medium of the present invention can all refer to the various embodiments of the horizontal federated modeling optimization method of the present invention, and will not be repeated here.

[0175] 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.

[0176] 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.

[0177] 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, 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), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the embodiments of the present invention.

[0178] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A horizontal federation modeling optimization method, characterized in that: The method is applied to participating devices participating in horizontal federation modeling, and the method comprises the following steps: Using a preset local data set to perform a parameter update operation on a local basic model, obtaining parameter update information corresponding to a private part model and a public part model in the local basic model, wherein the public part model structure of each participating device is the same; Sending parameter update information corresponding to the public part model to the coordination device participating in horizontal federation modeling, so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain global update information; Using the global update information received from the coordination device to update the model parameters in the public part model, and using the parameter update information of the private part model to update the model parameters in the private part model, so as to update the local basic model; After the step of updating the model parameters in the public part model by using the global update information received from the coordination device and updating the model parameters in the private part model by using the parameter update information of the private part model to update the local basic model, the method further includes: When a local private task is detected, a private replacement model corresponding to the local private task is obtained; The private replacement model is used to replace the private part model in the updated local basic model to obtain a local private task model; Performing a parameter update operation on the local private task model using a local data set corresponding to the local private task, so as to update model parameters in the local private task model; And / or after the step of updating the model parameters in the public part model by using the global update information received from the coordination device and updating the model parameters in the private part model by using the parameter update information of the private part model to update the local basic model, the method further includes: When a public task is detected, a public replacement model corresponding to the public task is obtained; The public replacement model is used to replace the public part model in the updated local basic model to obtain a local public task model; The local data set corresponding to the public task is used as the preset local data set, and the local public task model is used as the local basic model, and then the steps are executed: the preset local data set is used to perform parameter update operation on the local basic model to obtain parameter update information corresponding to the private part model and the public part model in the local basic model respectively.

2. The horizontal federation modeling optimization method according to claim 1, characterized in that: The step of sending the parameter update information corresponding to the public part model to the coordination device participating in the horizontal federation modeling so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain the global update information includes: Performing an approximate quantization operation on the parameter update information corresponding to the public part model to obtain quantized update information; The quantized update information is sent to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the quantized update information sent by each participating device to obtain the global update information.

3. The horizontal federation modeling optimization method according to claim 2, characterized in that: The step of performing a quantization operation on the parameter update information corresponding to the public part model to obtain the quantized update information comprises: Substituting the parameter update information corresponding to the preset integer vector and the common part model into the cosine similarity formula, wherein the value of each element of the preset integer vector is to be determined; The cosine similarity formula is solved to obtain the value of each element of the preset integer vector, and the preset integer vector with the determined value of each element is used as the quantization update information, wherein the preset integer vector with the determined value of each element maximizes the cosine value of the cosine similarity formula.

4. The horizontal federation modeling optimization method according to claim 1, characterized in that: When the preset local data set is an image data set, the step of performing a parameter update operation on the local basic model using the preset local data set to obtain parameter update information corresponding to the private part model and the public part model in the local basic model includes: Inputting the image data set into a local basic model to obtain a classification prediction result corresponding to each image in the image data set; Calculating the classification loss of the local basic model based on the classification prediction results and the true classification labels corresponding to each image; Based on the classification loss, gradient information corresponding to the private part model and the public part model in the local basic model is calculated, and the gradient information is used as parameter update information.

5. The horizontal federation modeling optimization method according to any one of claims 1 to 4, characterized in that: When the preset local data set is an image data set, after the step of updating the model parameters in the public part model by using the global update information received from the coordination device and updating the model parameters in the private part model by using the parameter update information of the private part model to update the local basic model, the method further includes: When it is detected that the updated local basic model meets the preset model condition, the updated local basic model is used as the target model; Input the image data to be classified into the private part model of the target model for processing to obtain an intermediate result, and input the intermediate result into the public part model of the target model for processing to obtain a classification result of the image data to be classified; or, The image data to be classified is divided into a first part of image data and a second part of image data; the first part of image data and the second part of image data are processed by a private part model and a public part model of the target model respectively to obtain a private result and a public result; the private result and the public result are combined to obtain a classification result of the image data to be classified.

6. A horizontal federation modeling optimization device, characterized in that: The device is deployed on a participating device participating in horizontal federation modeling, and the device includes: A first updating module is used to perform a parameter updating operation on a local basic model using a preset local data set to obtain parameter updating information corresponding to a private part model and a public part model in the local basic model, wherein the public part model structures of all participating devices are the same; A sending module, used to send parameter update information corresponding to the public part model to the coordination device participating in the horizontal federation modeling, so that the coordination device can perform federation fusion on the parameter update information sent by each participating device to obtain global update information; A second updating module, configured to update the model parameters in the public part model using the global update information received from the coordination device, and to update the model parameters in the private part model using the parameter update information of the private part model, so as to update the local basic model; The horizontal federation modeling optimization device also includes: A first acquisition module, configured to acquire a private replacement model corresponding to the local private task after a local private task is detected; A first replacement module, configured to use the private replacement model to replace the private part model in the updated local basic model to obtain a local private task model; A third updating module, configured to perform a parameter updating operation on the local private task model using a local data set corresponding to the local private task, so as to update model parameters in the local private task model; And / or the horizontal federation modeling optimization device further includes: A second acquisition module is used to acquire a public replacement model corresponding to the public task after a public task is detected; A second replacement module, used to replace the public part model in the updated local basic model with the public replacement model to obtain a local public task model; An execution module is used to use the local data set corresponding to the public task as a preset local data set, adopt the local public task model as a local basic model, and then execute the steps of: using the preset local data set to perform parameter update operations on the local basic model to obtain parameter update information corresponding to the private part model and the public part model in the local basic model.

7. A horizontal federation modeling optimization device, characterized in that: The horizontal federated modeling optimization device includes: a memory, a processor, and a horizontal federated modeling optimization program stored in the memory and executable on the processor. When the horizontal federated modeling optimization program is executed by the processor, the steps of the horizontal federated modeling optimization method as described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a horizontal federated modeling optimization program, which, when executed by a processor, implements the steps of the horizontal federated modeling optimization method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Model parameter verification method and apparatus in transverse federation learning, and medium

    CN110378487A

  • Transverse federation learning system optimization method and device, equipment and readable storage medium

    CN111310932A