Federal learning method and device for trusted computing environment, equipment and storage medium
By introducing a trusted computing environment into federated learning and using local and plaintext gradient data for joint training, the problem of difficult to balance communication efficiency and data security in the prior art is solved, and an efficient and secure federated learning process is achieved.
Patent Information
- Application Number
- CN202510010320.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art is difficult to improve data security on the basis of improving communication transmission efficiency, especially in federated learning scenarios, where data leakage risks are high.
In a trusted computing environment, joint federal training is performed through preset federated learning models, and calculations are performed using local gradient data and plaintext gradient data of other participants, avoiding security protocols with high computational complexity and without the need to send data to third-party neutral cubes.
The communication transmission efficiency and data security are improved, and the purpose of enhancing data protection on the basis of improving communication efficiency is achieved.
Smart Images

Figure CN119808997A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of machine learning technology, and in particular to a federated learning method, apparatus, device and storage medium in a trusted computing environment. Background Art
[0002] At present, with the development of artificial intelligence technology, machine learning has become a hot topic in computer research, and its theories and methods have been widely used in engineering applications and scientific fields. Among them, in the field of machine learning applications, in many scenarios, the training data is distributed among different data owners. In order to further improve the machine learning model, this field proposes a method of federated learning to achieve effective model training and model reasoning using data from multiple parties while protecting data privacy.
[0003] Specifically, each participant calculates the intermediate gradient of their own training data through a preset security protocol joint computing algorithm package, and then sends it to another participant to realize the model training of federated learning. Among them, the security protocol joint computing algorithm includes homomorphic encryption, differential privacy and secure multi-party computing algorithms. The computational complexity of the algorithms involved above is high, and the amount of data exchanged between multiple parties in the federated learning scenario is large, which will lead to low communication transmission efficiency between multiple parties.
[0004] In order to solve the above communication transmission efficiency problem, the relevant technology proposes that each participant encrypts their own data set and uploads it to a trusted computing environment of a third-party neutral party for model training. However, this method involves uploading the training data set to a third-party neutral party, which is prone to data leakage and thus leads to low security of model training. That is, it is impossible to improve data security while improving communication transmission efficiency. Summary of the invention
[0005] The main purpose of this application is to provide a federated learning method, apparatus, device and storage medium in a trusted computing environment, aiming to solve the technical problem that the prior art cannot improve data security while improving communication transmission efficiency.
[0006] To achieve the above objectives, the present application provides a federated learning method in a trusted computing environment, and the federated learning method in a trusted computing environment includes:
[0007] Get the data to be processed;
[0008] Based on the data to be processed, in a trusted computing environment, a preset federated learning processing flow is executed through a preset federated learning model to obtain a target prediction result of the data to be processed;
[0009] The federated learning model is obtained by performing joint federated training on a preset model to be trained based on local gradient data and plaintext gradient data of other second participants in a trusted computing environment;
[0010] The plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted environment after the other second participant obtains the encrypted gradient data in the trusted computing environment and sends it to the first participant.
[0011] Optionally, before the step of obtaining the data to be processed, the method includes:
[0012] Acquire training data, and based on the training data, execute a preset federated learning training process through a preset model to be trained, perform model training on the model to be trained, and obtain local gradient data and model parameters;
[0013] Receiving encrypted gradient data sent by other second participants, and performing a decryption operation on the encrypted gradient data to obtain plaintext gradient data of the other second participants, wherein the encrypted gradient data is obtained by the other second participants in a trusted computing environment and sent to the first participant;
[0014] In a trusted computing environment, based on the local gradient data, the plaintext gradient data and the model parameters, a preset model to be trained is jointly federated trained to obtain a federated learning model.
[0015] Optionally, the step of performing joint federation training on a preset model to be trained based on the local gradient data, the plaintext gradient data and the model parameters in a trusted computing environment to obtain a federated learning model includes:
[0016] In a trusted computing environment, determining a model update parameter based on the local gradient data and the plaintext gradient data, and updating the model parameter based on the model update parameter to obtain an updated model parameter;
[0017] Determine whether the updated model parameters meet the error standard indicated by the preset parameter threshold range. If the updated model parameters do not meet the error standard indicated by the preset parameter threshold range, return to the step of performing a preset federated learning training process based on the training data through a preset model to be trained, perform model training on the model to be trained, and obtain local gradient data and model parameters, until the updated model parameters meet the error standard indicated by the preset parameter threshold range, and obtain a federated learning model.
[0018] Optionally, the step of determining the model update parameter in the trusted computing environment based on the local gradient data and the plaintext gradient data includes:
[0019] In a trusted computing environment, based on a preset plaintext joint computing algorithm, the local gradient data and the plaintext gradient data are jointly calculated to obtain the target gradient data after the joint calculation, and based on the gradient data after the joint calculation, the model parameters are updated to obtain the model update parameters, wherein the plaintext joint computing algorithm is a joint algorithm of a non-secure protocol type.
[0020] Optionally, after the step of acquiring training data, executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters, the method includes:
[0021] In a trusted computing environment, the local gradient data is encrypted to obtain encrypted local gradient data, and the encrypted local gradient data is sent to other second participants so that the other second participants can perform parameter updates of the corresponding federated model based on the encrypted local gradient data in the trusted computing environment.
[0022] Optionally, before the step of acquiring training data, executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters, the method includes:
[0023] Get federated learning tasks;
[0024] In a trusted computing environment, the federated learning task is split into a plurality of subtasks to implement joint federated training of the corresponding subtasks, and the subtasks are encrypted and sent to other second participants.
[0025] Optionally, the step of executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters includes:
[0026] In a trusted computing environment, based on the training data, the federated learning training process corresponding to the subtask is executed through a preset model to be trained, and model training is performed on the model to be trained to obtain local gradient data and model parameters.
[0027] The present application also provides a federated learning device in a trusted computing environment, the federated learning device in the trusted computing environment comprising:
[0028] An acquisition module is used to acquire data to be processed;
[0029] A processing module, configured to execute a preset federated learning processing flow through a preset federated learning model based on the data to be processed in a trusted computing environment to obtain a target prediction result of the data to be processed;
[0030] The federated learning model is obtained by performing joint federated training on a preset model to be trained based on local gradient data and plaintext gradient data of other second participants in a trusted computing environment;
[0031] The plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted environment after the other second participant obtains the encrypted gradient data in the trusted computing environment and sends it to the first participant.
[0032] The present application also provides a federated learning device in a trusted computing environment, the federated learning device in the trusted computing environment comprising: a memory, a processor, and a program stored in the memory for implementing the federated learning method in the trusted computing environment,
[0033] The memory is used to store a program for implementing a federated learning method in a trusted computing environment;
[0034] The processor is used to execute a program for implementing the federated learning method in the trusted computing environment to implement the steps of the federated learning method in the trusted computing environment.
[0035] The present application also provides a storage medium, on which is stored a program for implementing a federated learning method in a trusted computing environment, and the program for implementing a federated learning method in a trusted computing environment is executed by a processor to implement the steps of the federated learning method in a trusted computing environment.
[0036] This application introduces a trusted computing environment into the federated learning model of each participant. On the one hand, each participant can use plaintext local gradient data and plaintext gradient data of other second participants for joint federated training without using algorithms with high computational complexity, thereby improving communication transmission efficiency. On the other hand, the trusted computing environment ensures the trustworthiness and security of the computing environment of each participant, without the need to send data to other neutral parties, thereby improving data security, thereby achieving the purpose of improving data security on the basis of improving communication transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art description will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0038] Figure 1 A flowchart of the first embodiment of the federated learning method in the trusted computing environment of the present application;
[0039] Figure 2 A schematic diagram of a machine learning architecture for a first embodiment of a federated learning method in a trusted computing environment of the present application;
[0040] Figure 3 A schematic diagram of the machine learning architecture in the related technology;
[0041] Figure 4 A schematic diagram of a machine learning architecture of a second embodiment of a federated learning method in a trusted computing environment of the present application;
[0042] Figure 5 A flowchart of a second embodiment of the federated learning method in a trusted computing environment of the present application;
[0043] Figure 6 A schematic diagram of the modules of the federated learning device of the trusted computing environment of this application;
[0044] Figure 7 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0045] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0046] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] Reference Figure 1 , Figure 1 This is a flowchart of the first embodiment of the federated learning method in a trusted computing environment of the present application.
[0048] In a first embodiment, the federated learning method of the trusted computing environment includes the following steps:
[0049] Step S100, obtaining data to be processed;
[0050] It should be noted that the executor of the federated learning method in the trusted computing environment is applied to the first participant, wherein the first participant refers to any participant under multiple participants in the distributed federated training system, and the other participants are all second participants.
[0051] In a specific implementation, the application scenario of the federated learning method of the trusted computing environment can be that a financial institution combines user feature data of multiple financial institutions, and the jointly trained federated learning model is used to predict the user's financial transaction risks to achieve precise risk control of the financial institution.
[0052] It is understandable that, based on the above application scenarios, the data to be processed refers to the transaction data generated by the interaction between the financial institution and the user within a preset time period, and the first participant obtains the data to be processed by extracting the data to be processed from the terminal program transaction database.
[0053] It should be noted that the data to be processed may be data of different categories according to application scenarios in different fields. For example, in the field of financial risk control, the data to be processed may be user financial transaction data.
[0054] Step S200, based on the data to be processed, in a trusted computing environment, a preset federated learning processing flow is executed through a preset federated learning model to obtain a target prediction result of the data to be processed;
[0055] The federated learning model is obtained by performing joint federated training on a preset model to be trained based on local gradient data and plaintext gradient data of other second participants in a trusted computing environment;
[0056] The plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted environment after the other second participant obtains the encrypted gradient data in the trusted computing environment and sends it to the first participant.
[0057] It should be noted that the trusted computing environment refers to hardware used to protect the security of key data and applications. The trusted computing environment can isolate key data and applications in a secure execution environment, effectively preventing malware attacks and data leaks. Trusted computing is an important technology to ensure the security of computer systems. By using trusted computing technology, the security of computer systems and the confidentiality of data can be effectively protected, and the credibility and reliability of the system can be improved. Trusted computing includes a variety of content, including hardware protection, secure boot, encryption technology, secure storage, secure communication and other aspects.
[0058] In a specific implementation, after obtaining the data to be processed, the first participant inputs the data to be processed into a pre-trained federated learning model, so that the federated learning model executes a preset federated learning processing flow on the data to be processed in a trusted computing environment to obtain the target prediction result of the data to be processed. In the precise risk control scenario of a financial institution, the target prediction result refers to the risk prediction result of transactions for some users.
[0059] In a specific implementation, the federated learning model is obtained by performing joint federation training on a preset model to be trained in a trusted computing environment based on local gradient data and plaintext gradient data of other second participants, wherein the plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted computing environment after the other second participants obtain the encrypted gradient data in the trusted computing environment and send it to the first participant. Specifically, refer to Figure 2 , the joint computing algorithm package, encryption module and storage engine in the machine learning architecture of Participant A and Participant B are all in a trusted computing environment, thereby ensuring the trusted security of the computing environment of each participant, realizing that the samples of each participant are not out of the warehouse, and also realizing the joint federal training of the plaintext local gradient data and the plaintext gradient data of other second participants through the trusted computing environment. Among them, the joint calculation of plaintext gradient data does not require algorithms such as secure computing protocols with high computational complexity, that is, when updating the model, this application uses the plaintext gradients of multiple parties for joint calculation, rather than using the encrypted gradients of multiple parties for encrypted joint calculation.
[0060] Understandably, referring to Figure 3 In the related art, in order to reduce the algorithm complexity of the joint computing algorithm package and thus improve the communication transmission efficiency, it is proposed that each participant encrypts their own data set and then uploads it to the trusted computing environment of a third-party neutral party for model training. However, this method involves the operation of uploading the training data set to a third-party neutral party, which is prone to data leakage, and thus leads to low security of model training, that is, it is impossible to improve data security on the basis of improving communication transmission efficiency. Based on this, the present application introduces a trusted computing environment into the federated learning model of each participant. On the one hand, each participant can use plaintext local gradient data and plaintext gradient data of other second participants for joint federated training without using algorithms with high computational complexity, thereby improving communication transmission efficiency. On the other hand, the trusted computing environment ensures the trusted security of each participant's computing environment, without sending data to other neutral parties, thereby improving data security, thereby achieving the purpose of improving data security on the basis of improving communication transmission efficiency.
[0061] Based on the above first embodiment, the present application also provides another embodiment, referring to Figure 5 , the federated learning method of the trusted computing environment includes:
[0062] In a specific implementation, before the step of obtaining the data to be processed, the method includes:
[0063] Step A100, obtaining training data, and executing a preset federated learning training process through a preset model to be trained based on the training data, performing model training on the model to be trained, and obtaining local gradient data and model parameters;
[0064] It should be noted that the training data refers to the sample data owned by the first participant for training the federated learning model; the model to be trained is the initial model of the federated learning model, which differs from the federated learning model in prediction accuracy; the model parameters and local gradient data refer to the parameters and corresponding gradient data output by the model after local training is completed.
[0065] In a specific implementation, after obtaining the training data, the first participant executes a preset federated learning training process based on the training data through the preset model to be trained, performs local model training on the model to be trained, and obtains local gradient data and model parameters under the iteration cycle, wherein the training cycle of the local model training can be set by itself, and it can be one cycle of model training performed locally, and then joint training can be performed; it can also be three cycles of model training performed locally, and then joint training can be performed, and no specific limitation is made here.
[0066] Step A200, receiving encrypted gradient data sent by other second participants, and performing a decryption operation on the encrypted gradient data to obtain plaintext gradient data of the other second participants, wherein the encrypted gradient data is obtained by the other second participants in a trusted computing environment and sent to the first participant;
[0067] It should be noted that after the first participant completes the local training cycle and obtains the model parameters and local gradient data, it further performs a joint gradient fusion calculation. Specifically, the first participant receives the encrypted gradient data sent by the other second participants, and decrypts the encrypted gradient data to obtain the plaintext gradient data of the other second participants, wherein the encrypted gradient data is obtained by the other second participants in a trusted computing environment and sent to the first participant. It should be noted that in the distributed federated learning training process, each participant will send the output gradient data to other participants after local training, and in order to prevent data leakage during the gradient data sending process, the participants need to encrypt the gradient data before sending it to other participants.
[0068] In a specific implementation, after receiving the encrypted gradient data sent by the other second participants, the first participant decrypts the encrypted gradient data to convert it into plaintext gradient data.
[0069] Step A300, in a trusted computing environment, based on the local gradient data, the plaintext gradient data and the model parameters, a preset model to be trained is jointly federated trained to obtain a federated learning model.
[0070] In the specific implementation, after the first participant obtains the plaintext gradient data of the other second participants, Figure 2 In a trusted computing environment, based on the local gradient data, the plaintext gradient data and the model parameters, a joint federal training is performed on the preset model to be trained through a joint computing algorithm package based on confidentiality protection to obtain a federated learning model. The present application proposes to implement a joint computing algorithm package based on confidentiality protection on the basis of a trusted computing environment, because the trusted environment ensures that the plaintext intermediate gradients sent by other participants will not be obtained by the local participant. This is different from the joint computing algorithm package based on the security protocol in the existing scheme, and no longer uses homomorphic encryption, differential privacy, secure multi-party computing technology and other security protocols to encrypt the intermediate gradients and encrypt the joint calculation, which greatly reduces the computational complexity and the amount of data exchanged between multiple parties, thereby greatly improving the computational efficiency.
[0071] In a specific implementation, the device performs joint federation training on a preset model to be trained based on the local gradient data, the plaintext gradient data and the model parameters in a trusted computing environment to obtain a federated learning model, including:
[0072] In a trusted computing environment, based on the local gradient data and the plaintext gradient data, a model update parameter is determined, and the model parameter is updated based on the model update parameter to obtain an updated model parameter; whether the updated model parameter satisfies an error standard indicated by a preset parameter threshold range is judged; if the updated model parameter does not satisfy the error standard indicated by the preset parameter threshold range, the method returns to the step of executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters, until the updated model parameter satisfies the error standard indicated by the preset parameter threshold range, and a federated learning model is obtained.
[0073] In a specific implementation, the first participant determines the model update parameters based on the local gradient data and the plaintext gradient data in a trusted computing environment, and updates the model parameters based on the model update parameters to obtain updated model parameters. After the joint training of this iteration cycle is completed, the first participant needs to determine whether the updated model parameters meet the error standard indicated by the preset parameter threshold range, that is, whether the loss function converges. If the updated model parameters do not meet the error standard indicated by the preset parameter threshold range, then return to the step of performing the preset federated learning training process based on the training data through the preset model to be trained, training the model to be trained, and obtaining local gradient data and model parameters, until the updated model parameters meet the error standard indicated by the preset parameter threshold range, and obtain the federated learning model.
[0074] In a specific implementation, the step of determining the model update parameter based on the local gradient data and the plaintext gradient data includes:
[0075] In a trusted computing environment, based on a preset plaintext joint computing algorithm, the local gradient data and the plaintext gradient data are jointly calculated to obtain the target gradient data after the joint calculation, and based on the gradient data after the joint calculation, the model parameters are updated to obtain the model update parameters, wherein the plaintext joint computing algorithm is a joint algorithm of a non-secure protocol type.
[0076] In a specific implementation, the first participant performs a joint calculation on the gradient data of the party and the plaintext gradient data based on a preset plaintext joint calculation algorithm to obtain the target gradient data after the joint calculation, and updates the model parameters based on the gradient data after the joint calculation to obtain the model update parameters, wherein the plaintext joint calculation algorithm is a joint algorithm of a non-secure protocol type. Specifically, the present application proposes to implement a plaintext joint calculation algorithm package based on a trusted computing environment, because the trusted environment ensures that the plaintext intermediate gradients sent by other participants will not be obtained by the present participant, which is different from the joint calculation algorithm package based on the security protocol in the existing scheme, and no longer uses homomorphic encryption, differential privacy, secure multi-party computing technology and other security protocols to encrypt the intermediate gradients and encrypt the joint calculation, which greatly reduces the computational complexity and the amount of data exchanged by multiple parties, thereby greatly improving the computational efficiency.
[0077] In a specific implementation, the device obtains training data, and based on the training data, executes a preset federated learning training process through a preset model to be trained, performs model training on the model to be trained, and obtains local gradient data and model parameters. After that, the method includes:
[0078] In a trusted computing environment, the local gradient data is encrypted to obtain encrypted local gradient data, and the encrypted local gradient data is sent to other second participants so that the other second participants can perform parameter updates of the corresponding federated model based on the encrypted local gradient data in the trusted computing environment.
[0079] In a specific implementation, while the first participant receives the encrypted gradient data from other second participants, it also needs to encrypt the local gradient data and send the encrypted local gradient data to other second participants so that the other second participants can perform parameter updates of the corresponding federated model based on the encrypted local gradient data in a trusted computing environment.
[0080] In a specific implementation, the device executes a preset federated learning training process based on the training data through a preset model to be trained, performs model training on the model to be trained, and before the step of obtaining local gradient data and model parameters, the method includes:
[0081] Obtain a federated learning task; in a trusted computing environment, split the federated learning task into multiple subtasks to implement joint federated training of the corresponding subtasks, and encrypt the subtasks and send them to other second participants.
[0082] In a specific implementation, the federated learning task refers to a modeling task related to the federated learning modeling required by the administrator / user for the first participant. The first participant splits the federated learning task into multiple subtasks in a trusted computing environment to achieve joint federated training of the corresponding subtasks, and encrypts the subtasks and sends them to other second participants. Specifically, after the user submits the federated learning task instruction, the global scheduling engine of the first participant generates the corresponding federated learning task based on the user configuration. While creating a local federated learning task, the first participant also encrypts the subtask and sends it to other second participants. Finally, in the trusted computing environment, the joint federated training of the corresponding subtasks is performed by executing the container.
[0083] It should be noted that, refer to Figure 4 , the machine learning architecture is similar to Figure 2 The difference is that this architecture relies on the ability of hardware to provide a trusted computing environment to further protect task decomposition information, so that the data of the subtasks split in the task scheduling engine and the data of the subtasks sent are protected, thereby further improving data security.
[0084] In a specific implementation, the device executes a preset federated learning training process based on the training data through a preset model to be trained, performs model training on the model to be trained, and obtains the steps of local gradient data and model parameters, including:
[0085] In a trusted computing environment, based on the training data, the federated learning training process corresponding to the subtask is executed through a preset model to be trained, and model training is performed on the model to be trained to obtain local gradient data and model parameters.
[0086] In the specific implementation, this application proposes to use the plaintext gradients of multiple parties for joint calculation when updating the model, rather than using the encrypted gradients of multiple parties for encrypted joint calculation, so as to reduce the implementation complexity of the algorithm package and reduce the R&D cost. And by introducing a trusted computing environment to ensure the trustworthy security of the computing environment of each participant, the samples of each participant will not be stored, and the overall performance will be greatly improved under the premise of meeting privacy protection.
[0087] The present application also provides a federated learning device in a trusted computing environment, referring to Figure 6 , the federated learning device of the trusted computing environment includes:
[0088] An acquisition module is used to acquire data to be processed;
[0089] A processing module, configured to execute a preset federated learning processing flow through a preset federated learning model based on the data to be processed in a trusted computing environment to obtain a target prediction result of the data to be processed;
[0090] The federated learning model is obtained by performing joint federated training on a preset model to be trained based on local gradient data and plaintext gradient data of other second participants in a trusted computing environment;
[0091] The plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted environment after the other second participant obtains the encrypted gradient data in the trusted computing environment and sends it to the first participant.
[0092] Optionally, the federated learning device of the trusted computing environment further includes:
[0093] A data acquisition module is used to acquire training data, and based on the training data, execute a preset federated learning training process through a preset model to be trained, perform model training on the model to be trained, and obtain local gradient data and model parameters;
[0094] a decryption module, used to receive encrypted gradient data sent by other second participants, and perform a decryption operation on the encrypted gradient data to obtain plaintext gradient data of the other second participants, wherein the encrypted gradient data is obtained by the other second participants in a trusted computing environment and sent to the first participant;
[0095] The training module is used to perform joint federation training on the preset model to be trained in a trusted computing environment based on the local gradient data, the plaintext gradient data and the model parameters to obtain a federated learning model.
[0096] Optionally, the training module includes:
[0097] An updating module, used to determine, in a trusted computing environment, model update parameters based on the local gradient data and the plaintext gradient data, and update the model parameters based on the model update parameters to obtain updated model parameters;
[0098] The iterative training module is used to determine whether the updated model parameters meet the error standard indicated by the preset parameter threshold range. If the updated model parameters do not meet the error standard indicated by the preset parameter threshold range, the module returns to the step of performing a preset federated learning training process based on the training data through a preset model to be trained, training the model to be trained, and obtaining local gradient data and model parameters, until the updated model parameters meet the error standard indicated by the preset parameter threshold range to obtain a federated learning model.
[0099] Optionally, the update module includes:
[0100] A joint computing module is used to jointly compute the local gradient data and the plaintext gradient data in a trusted computing environment based on a preset plaintext joint computing algorithm to obtain the target gradient data after the joint computing, and to update the model parameters based on the gradient data after the joint computing to obtain the model update parameters, wherein the plaintext joint computing algorithm is a joint algorithm of a non-secure protocol type.
[0101] Optionally, the federated learning device of the trusted computing environment further includes:
[0102] An encryption module is used to encrypt the local gradient data in a trusted computing environment to obtain encrypted local gradient data, and send the encrypted local gradient data to other second participants, so that the other second participants can perform parameter updates of the corresponding federated model based on the encrypted local gradient data in the trusted computing environment.
[0103] Optionally, the federated learning device of the trusted computing environment further includes:
[0104] Learning task acquisition module, used to obtain federated learning tasks;
[0105] The splitting module is used to split the federated learning task into multiple subtasks in a trusted computing environment to achieve joint federated training of the corresponding subtasks, and encrypt the subtasks and send them to other second participants.
[0106] Optionally, the training module further includes:
[0107] The federated learning training module is used to execute the federated learning training process corresponding to the subtask through a preset model to be trained in a trusted computing environment based on the training data, perform model training on the model to be trained, and obtain local gradient data and model parameters.
[0108] The specific implementation of the federated learning device in the trusted computing environment of the present application is basically the same as the embodiments of the federated learning method in the trusted computing environment described above, and will not be repeated here.
[0109] Reference Figure 7 , Figure 7 It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present application.
[0110] like Figure 7 As shown, the terminal 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.
[0111] Optionally, the federated learning device of the trusted computing environment may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0112] Those skilled in the art will understand that Figure 6The federated learning device structure of the trusted computing environment shown in the figure does not constitute a limitation on the federated learning device of the trusted computing environment, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0113] like Figure 7 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, and a federated learning program of a trusted computing environment. The operating system is a program that manages and controls the hardware and software resources of the federated learning device of the trusted computing environment, and supports the operation of the federated learning program of the trusted computing environment and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the federated learning system of the trusted computing environment.
[0114] exist Figure 7 In the federated learning device of the trusted computing environment shown, the processor 1001 is used to execute the federated learning program of the trusted computing environment stored in the memory 1005 to implement the steps of the federated learning method of the trusted computing environment described in any one of the above items.
[0115] The specific implementation methods of the federated learning device in the trusted computing environment of the present application are basically the same as the embodiments of the federated learning method in the trusted computing environment described above, and will not be repeated here.
[0116] The present application also provides a storage medium, on which is stored a program for implementing a federated learning method in a trusted computing environment, and the program for implementing a federated learning method in a trusted computing environment is executed by a processor to implement the federated learning method in a trusted computing environment as described below:
[0117] Get the data to be processed;
[0118] Based on the data to be processed, in a trusted computing environment, a preset federated learning processing flow is executed through a preset federated learning model to obtain a target prediction result of the data to be processed;
[0119] The federated learning model is obtained by performing joint federated training on a preset model to be trained based on local gradient data and plaintext gradient data of other second participants in a trusted computing environment;
[0120] The plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted environment after the other second participant obtains the encrypted gradient data in the trusted computing environment and sends it to the first participant.
[0121] Optionally, before the step of obtaining the data to be processed, the method includes:
[0122] Acquire training data, and based on the training data, execute a preset federated learning training process through a preset model to be trained, perform model training on the model to be trained, and obtain local gradient data and model parameters;
[0123] Receiving encrypted gradient data sent by other second participants, and performing a decryption operation on the encrypted gradient data to obtain plaintext gradient data of the other second participants, wherein the encrypted gradient data is obtained by the other second participants in a trusted computing environment and sent to the first participant;
[0124] In a trusted computing environment, based on the local gradient data, the plaintext gradient data and the model parameters, a preset model to be trained is jointly federated trained to obtain a federated learning model.
[0125] Optionally, the step of performing joint federation training on a preset model to be trained based on the local gradient data, the plaintext gradient data and the model parameters in a trusted computing environment to obtain a federated learning model includes:
[0126] In a trusted computing environment, determining a model update parameter based on the local gradient data and the plaintext gradient data, and updating the model parameter based on the model update parameter to obtain an updated model parameter;
[0127] Determine whether the updated model parameters meet the error standard indicated by the preset parameter threshold range. If the updated model parameters do not meet the error standard indicated by the preset parameter threshold range, return to the step of performing a preset federated learning training process based on the training data through a preset model to be trained, perform model training on the model to be trained, and obtain local gradient data and model parameters, until the updated model parameters meet the error standard indicated by the preset parameter threshold range, and obtain a federated learning model.
[0128] Optionally, the step of determining the model update parameter in the trusted computing environment based on the local gradient data and the plaintext gradient data includes:
[0129] In a trusted computing environment, based on a preset plaintext joint computing algorithm, the local gradient data and the plaintext gradient data are jointly calculated to obtain the target gradient data after the joint calculation, and based on the gradient data after the joint calculation, the model parameters are updated to obtain the model update parameters, wherein the plaintext joint computing algorithm is a joint algorithm of a non-secure protocol type.
[0130] Optionally, after the step of acquiring training data, executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters, the method includes:
[0131] In a trusted computing environment, the local gradient data is encrypted to obtain encrypted local gradient data, and the encrypted local gradient data is sent to other second participants so that the other second participants can perform parameter updates of the corresponding federated model based on the encrypted local gradient data in the trusted computing environment.
[0132] Optionally, before the step of acquiring training data, executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters, the method includes:
[0133] Get federated learning tasks;
[0134] In a trusted computing environment, the federated learning task is split into a plurality of subtasks to implement joint federated training of the corresponding subtasks, and the subtasks are encrypted and sent to other second participants.
[0135] Optionally, the step of executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters includes:
[0136] In a trusted computing environment, based on the training data, the federated learning training process corresponding to the subtask is executed through a preset model to be trained, and model training is performed on the model to be trained to obtain local gradient data and model parameters.
[0137] The specific implementation methods of the storage medium of the present application are basically the same as the embodiments of the federated learning method in the above-mentioned trusted computing environment, and will not be repeated here.
[0138] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned federated learning method in a trusted computing environment when executed by a processor.
[0139] The specific implementation methods of the computer program product of the present application are basically the same as the embodiments of the federated learning method in the above-mentioned trusted computing environment, and will not be repeated here.
[0140] 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.
[0141] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0142] 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 application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0143] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A federated learning method in a trusted computing environment, characterized in that: Applied to a first participant, the first participant is in communication connection with a second participant, and the federated learning method of the trusted computing environment includes: Get the data to be processed; Based on the data to be processed, in a trusted computing environment, a preset federated learning processing flow is executed through a preset federated learning model to obtain a target prediction result of the data to be processed; The federated learning model is obtained by performing joint federated training on a preset model to be trained based on local gradient data and plaintext gradient data of other second participants in a trusted computing environment; The plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted environment after the other second participant obtains the encrypted gradient data in the trusted computing environment and sends it to the first participant.
2. The method for federated learning in a trusted computing environment as claimed in claim 1, characterized in that: Before the step of obtaining the data to be processed, the method includes: Acquire training data, and based on the training data, execute a preset federated learning training process through a preset model to be trained, perform model training on the model to be trained, and obtain local gradient data and model parameters; Receiving encrypted gradient data sent by other second participants, and performing a decryption operation on the encrypted gradient data to obtain plaintext gradient data of the other second participants, wherein the encrypted gradient data is obtained by the other second participants in a trusted computing environment and sent to the first participant; In a trusted computing environment, based on the local gradient data, the plaintext gradient data and the model parameters, a preset model to be trained is jointly federated trained to obtain a federated learning model.
3. The federated learning method in a trusted computing environment as claimed in claim 2, characterized in that: The step of performing joint federation training on a preset model to be trained based on the local gradient data, the plaintext gradient data and the model parameters in a trusted computing environment to obtain a federated learning model includes: In a trusted computing environment, determining a model update parameter based on the local gradient data and the plaintext gradient data, and updating the model parameter based on the model update parameter to obtain an updated model parameter; Determine whether the updated model parameters meet the error standard indicated by the preset parameter threshold range. If the updated model parameters do not meet the error standard indicated by the preset parameter threshold range, return to the step of performing a preset federated learning training process based on the training data through a preset model to be trained, perform model training on the model to be trained, and obtain local gradient data and model parameters, until the updated model parameters meet the error standard indicated by the preset parameter threshold range, and obtain a federated learning model.
4. The method for federated learning in a trusted computing environment as claimed in claim 3, characterized in that: The step of determining the model update parameter in the trusted computing environment based on the local gradient data and the plaintext gradient data includes: In a trusted computing environment, based on a preset plaintext joint computing algorithm, the local gradient data and the plaintext gradient data are jointly calculated to obtain the target gradient data after the joint calculation, and based on the gradient data after the joint calculation, the model parameters are updated to obtain the model update parameters, wherein the plaintext joint computing algorithm is a joint algorithm of a non-secure protocol type.
5. The method for federated learning in a trusted computing environment as claimed in claim 2, characterized in that: After the steps of acquiring training data, executing a preset federated learning training process through a preset model to be trained based on the training data, performing model training on the model to be trained, and obtaining local gradient data and model parameters, the method includes: In a trusted computing environment, the local gradient data is encrypted to obtain encrypted local gradient data, and the encrypted local gradient data is sent to other second participants so that the other second participants can perform parameter updates of the corresponding federated model based on the encrypted local gradient data in the trusted computing environment.
6. The method for federated learning in a trusted computing environment as claimed in claim 2, characterized in that: Before the step of acquiring training data, executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters, the method includes: Get federated learning tasks; In a trusted computing environment, the federated learning task is split into a plurality of subtasks to implement joint federated training of the corresponding subtasks, and the subtasks are encrypted and sent to other second participants.
7. The method for federated learning in a trusted computing environment as claimed in claim 6, characterized in that: The step of executing a preset federated learning training process based on the training data through a preset model to be trained, performing model training on the model to be trained, and obtaining local gradient data and model parameters includes: In a trusted computing environment, based on the training data, the federated learning training process corresponding to the subtask is executed through a preset model to be trained, and model training is performed on the model to be trained to obtain local gradient data and model parameters.
8. A federated learning device in a trusted computing environment, characterized in that: The federated learning device of the trusted computing environment includes: An acquisition module is used to acquire data to be processed; A processing module, configured to execute a preset federated learning processing flow through a preset federated learning model based on the data to be processed in a trusted computing environment to obtain a target prediction result of the data to be processed; The federated learning model is obtained by performing joint federated training on a preset model to be trained based on local gradient data and plaintext gradient data of other second participants in a trusted computing environment; The plaintext gradient data is obtained by the first participant decrypting the encrypted gradient data in the trusted environment after the other second participant obtains the encrypted gradient data in the trusted computing environment and sends it to the first participant.
9. A federated learning device in a trusted computing environment, characterized in that: The federated learning device of the trusted computing environment includes: a memory, a processor, and a program stored in the memory for implementing the federated learning method of the trusted computing environment. The memory is used to store a program for implementing a federated learning method in a trusted computing environment; The processor is used to execute a program for implementing the federated learning method in the trusted computing environment, so as to implement the steps of the federated learning method in the trusted computing environment as claimed in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a program for implementing a federated learning method in a trusted computing environment, and the program for implementing a federated learning method in a trusted computing environment is executed by a processor to implement the steps of the federated learning method in a trusted computing environment as described in any one of claims 1 to 7.