WO2024139312A1 - 一种模型训练方法、装置、存储介质及电子设备 - Google Patents

一种模型训练方法、装置、存储介质及电子设备 Download PDF

Info

Publication number
WO2024139312A1
WO2024139312A1 PCT/CN2023/115130 CN2023115130W WO2024139312A1 WO 2024139312 A1 WO2024139312 A1 WO 2024139312A1 CN 2023115130 W CN2023115130 W CN 2023115130W WO 2024139312 A1 WO2024139312 A1 WO 2024139312A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
model
server
gradient
training
Prior art date
Application number
PCT/CN2023/115130
Other languages
English (en)
French (fr)
Inventor
傅欣艺
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2024139312A1 publication Critical patent/WO2024139312A1/zh

Links

Definitions

  • the present invention relates to the field of computer technology, and in particular to a model training method, device, storage medium and electronic device.
  • models can be obtained from cloud servers and deployed on user terminals so that the models can provide users with services such as image recognition, information recommendation, and privacy protection.
  • the model to be trained can be deployed on each user terminal. Then, for each user terminal, the user terminal uses local training samples to train the deployed model to obtain gradient information, and uploads the gradient information to the cloud server.
  • the cloud server trains the model in the cloud server according to the gradient information uploaded by each user terminal.
  • the embodiments of this specification provide a model training method, device, storage medium and electronic device.
  • a model training method provided in this specification is used for distributed training;
  • the system on which the distributed training is based includes: a first server and several node devices, and the method includes: the node device obtains model parameters from the first server; based on the model parameters, generates a target model; trains the target model to obtain gradient data generated when training the target model; based on a preset gradient threshold, filters out data in the gradient data that does not meet the training conditions required for training the model of the first server to obtain target data; sends the target data to the first server, so that the first server adjusts the model parameters according to the target data sent by the node device and the gradient data sent by other node devices, and generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • filtering out data in the gradient data that does not meet the training conditions required by the first server training model specifically comprising: performing noise processing on the preset gradient threshold to obtain a processed gradient threshold; based on the processed gradient threshold, filtering out data in the gradient data that does not meet the training conditions required by the first server training model; The data required for the training conditions of the model.
  • data in the gradient data that does not meet the training conditions required by the first server training model is filtered out, specifically including: for each data in the gradient data, comparing the data with the processed gradient threshold; if the data is greater than the processed gradient threshold, retaining the data; if the data is not greater than the processed gradient threshold, filtering out the data.
  • data in the gradient data that does not meet the training conditions required for the training model of the first server is filtered out to obtain target data, specifically including: sending the gradient data to a second server so that the second server filters out data in the gradient data that does not meet the training conditions required for the training model of the first server based on the preset gradient threshold to obtain target data; sending the target data to the first server specifically includes: sending the target data to the first server via the second server.
  • the operating environment of the second server is a trusted execution environment TEE.
  • a model training device includes: an acquisition module, which is used for a node device to acquire model parameters from a first server; a generation module, which is used to generate a target model based on the model parameters; a gradient data determination module, which is used to train the target model and obtain gradient data generated when training the target model; a filtering module, which is used to filter out data in the gradient data that does not meet the training conditions required for training the model of the first server based on a preset gradient threshold, and obtain target data; a training module, which is used to send the target data to the first server, so that the first server adjusts the model parameters according to the target data sent by the node device and the gradient data sent by other node devices, and generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • This specification provides a computer-readable storage medium, which stores a computer program.
  • the computer program is executed by a processor, the above-mentioned model training method is implemented.
  • This specification provides an electronic device, including a memory, a processor, and a A computer program running on a processor, wherein the processor implements the above-mentioned model training method when executing the program.
  • At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects: in the embodiments of this specification, after the node device obtains the model parameters from the first server, a target model is generated based on the model parameters, and the target model is trained to obtain the gradient data generated when the target model is trained. Then, based on the preset gradient threshold, the data that does not meet the training conditions required for the training model of the first server is filtered out from the gradient data, the target data is obtained, and sent to the first server.
  • the first server adjusts the model parameters to generate a model based on the target data sent by the node device and the gradient data sent by other node devices, and deploys it in the first server, and trains the generated model.
  • the target data that meets the training conditions is filtered out from the gradient data, and the model parameters are adjusted based on the target data, rather than using all the gradient data to adjust the model parameters, which can improve the training efficiency of the model generated in the first server.
  • FIG1 is a flow chart of a model training method provided in an embodiment of this specification.
  • FIG2 is a schematic diagram of the structure of a model training device provided in an embodiment of this specification.
  • FIG. 3 is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification.
  • Figure 1 is a flow chart of a model training method provided in this specification, the model training method is used for distributed training, and the system based on which the distributed training is based may include a first server and several node devices.
  • the model training method can be applied to any node device, including steps S100 to S108.
  • S102 Generate a target model based on the model parameters.
  • the first server may refer to a cloud server
  • a model may be deployed in the first server
  • the model in the first server may refer to a model for executing a service.
  • the types of services may include: recommendation services, query services, payment services, privacy protection services, image recognition services, voice recognition services, etc.
  • the first server may randomly select at least some of the node devices from the node devices of the system. Then, the first server may send the model parameters of the model in the first server to at least some of the selected node devices.
  • the node device may refer to a client device.
  • the node device receives the model parameters sent by the first server. That is, the node device obtains the model parameters from the first server. Then, based on the obtained model parameters, a target model is generated.
  • the obtained model parameters are the model parameters of the model regenerated after adjusting the model parameters of the model in the first server during the last iterative training.
  • the target model may refer to a model deployed in the node device, and the model structure of the target model is the same as the model structure of the model in the first server.
  • the node device may update the model parameters of the model deployed on the node device during the last iterative training to the acquired model parameters, and use the updated model deployed on the node device as the target model.
  • the node device can directly assign the acquired model parameters to a model with the same model structure as the model in the first server to generate a target model.
  • the local historical business data of the node device can be obtained first, and then the obtained historical business data can be input into the target model to output the result through the target model. According to the difference between the result output by the target model and the label, the gradient data generated during the training of the target model is determined.
  • S106 Based on a preset gradient threshold, filter out data in the gradient data that does not meet the training conditions required by the first server training model to obtain target data.
  • S108 sending the target data to the first server, so that the first server adjusts the model parameters according to the target data sent by the node device and the gradient data sent by other node devices.
  • a model is generated according to the adjusted model parameters, and the generated model is deployed in the first server to train the generated model.
  • the node device can filter out the data in the gradient data that does not meet the training conditions required for the first server training model based on a preset gradient threshold to obtain the target data. Then, the target data is sent to the first server. The first server adjusts the model parameters of the model in the server according to the received target data and the gradient data sent by other node devices. The model is regenerated according to the adjusted model parameters, and the regenerated model is deployed in the first server to continue training the regenerated model.
  • the training conditions required for the first server training model may refer to data important for model training.
  • the data in the gradient data that is not important for model training is filtered out, that is, the data less than the gradient threshold is filtered out.
  • the data that does not meet the training conditions required for the first server training model may also be: in a specified number of consecutive iterative trainings, the gradient data generated by each iterative training remains unchanged or the change difference is within a specified range.
  • each data in the gradient data can be compared with the gradient threshold. If the data is greater than the gradient threshold, the data is retained and used as the target data; if the data is not greater than the gradient threshold, the data is filtered out.
  • the gradient threshold may refer to a gradient threshold matrix
  • the target data may be a target gradient matrix
  • the gradient value can be compared with the gradient threshold at the position corresponding to the gradient value in the gradient threshold matrix. If the gradient value is greater than the gradient threshold, the gradient value is retained; if the gradient value is not greater than the gradient threshold, the gradient value is set to zero. Finally, the filtered gradient matrix is used as the target gradient matrix.
  • the first server may first determine a preset gradient threshold, and then process the gradient threshold to obtain a processed gradient threshold.
  • the processing of the gradient threshold may include: adding noise, encryption, hashing, etc.
  • the processed gradient threshold is sent to the node device.
  • the node device receives the processed threshold matrix sent by the first server, and can filter out the data in the gradient data that does not meet the training conditions required for the training model of the first server based on the processed gradient threshold to obtain the target data.
  • the data can be compared with the processed gradient threshold. If the data is greater than the processed gradient threshold, the data is retained and used as the target data. If the data is not If the value is greater than the post-processing gradient threshold, the data is filtered out.
  • the node device can also process the gradient threshold.
  • the processing of the gradient threshold may include: adding noise, encryption, hash operation, etc.
  • the node device can obtain the gradient threshold from the first server, and then process the gradient threshold to obtain a processed gradient threshold. Then, according to the processed gradient threshold, the data in the gradient data that does not meet the training conditions required by the first server training model is filtered out to obtain the target data.
  • the gradient threshold matrix after processing the gradient threshold may be referred to as a processed gradient threshold matrix
  • the target data may be a target gradient matrix
  • the gradient value is compared with the gradient threshold corresponding to the gradient value in the processed gradient threshold matrix. If the gradient value is greater than the gradient threshold, the gradient value is retained; if the gradient value is not greater than the gradient threshold, the gradient value is set to zero. Finally, the filtered gradient matrix is used as the target gradient matrix.
  • the node device may send the target data to the first server.
  • the first server adjusts the model parameters according to the received target data and the gradient data sent by other node devices, generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • the gradient data sent by other node devices may be all the gradient data generated when other node devices train the target model, or may refer to the target data obtained after other node devices filter out the data that does not meet the training conditions required for the first server to train the model.
  • the first server may perform weighted summation on each target data to obtain the comprehensive gradient data, wherein the sum of the weights corresponding to each target data is 1.
  • the node device can process the target data to obtain processed target data.
  • the method of processing the target data may include: adding noise, encryption, hash operation, etc.
  • the node device can send the processed target data to the first server.
  • the model parameters are adjusted, and a model is generated according to the adjusted model parameters, and the generated model is deployed in the first server to train the generated model.
  • the processing of the gradient data generated during the training of the target model consumes privacy computing resources, and the more gradient data there is, the more privacy computing resources are consumed. Therefore, in this specification, when processing the target data, only part of the gradient data is processed, which reduces the privacy computing resources consumed by one iteration of training. In this way, under the condition of fixed privacy computing resources, the number of iterative training required by the training method for processing the target data is greater than the number of iterative training required by the training method for processing all the gradient data, thereby improving the training effect of the model in the first server.
  • this specification generates a target model based on the model parameters, and trains the target model to obtain the gradient data generated when the target model is trained. Then, based on the preset gradient threshold, the data that does not meet the training conditions required for the training model of the first server is filtered out from the gradient data to obtain the target data, and send it to the first server.
  • the first server adjusts the model parameters to generate a model based on the target data sent by the node device and the gradient data sent by other node devices, and deploys it in the first server, and trains the generated model.
  • the target data that meets the training conditions is filtered out from the gradient data, and the model parameters are adjusted based on the target data, rather than using all the gradient data to adjust the model parameters, which can improve the training efficiency of the model generated in the first server.
  • the node device can also send the gradient data to the second server.
  • the second server can refer to a server that can implement processing and filtering functions such as noise addition and encryption, and the operating environment of the second server is a trusted execution environment (TEE). Since the second server is a trusted execution environment, the gradient data will not be leaked.
  • TEE trusted execution environment
  • the second server After receiving the gradient data sent by the node device, the second server can obtain the gradient data from the first server through the second server. The second server obtains the gradient threshold from the server. Then, based on the gradient threshold, the second server can filter out the data in the gradient data that does not meet the training conditions required for the training model of the first server to obtain the target data.
  • the filtering method of the second server is the same as the filtering method of the node device, which will not be repeated here.
  • the node device can first encrypt the gradient data to obtain ciphertext data for the gradient data. Then, the ciphertext data is sent to the second server. After that, the second server needs to decrypt the ciphertext data to obtain the gradient data. Finally, the second server can filter out the data in the gradient data that does not meet the training conditions required by the first server training model based on the gradient threshold to obtain the target data.
  • the second server can process the gradient threshold to obtain a processed gradient threshold. Then, according to the processed gradient threshold, the data in the gradient data that does not meet the training conditions required by the first server training model is filtered out to obtain the target data.
  • the second server can send the target data to the first server so that the first server adjusts the model parameters based on the target data and the gradient data sent by other node devices, generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • the second server can process the target data to obtain processed target data. Then, the processed target data is sent to the first server, so that the first server adjusts the model parameters according to the received processed target data and the gradient data sent by other node devices, generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • the second server can obtain the target data generated by each node device when training the target model. Then, the target data are weighted and summed to obtain the aggregated gradient data. Finally, the aggregated gradient data is sent to the first server, so that the first server adjusts the model parameters according to the received aggregated gradient data, generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • the aggregated gradient data can be denoised to obtain comprehensive gradient data, and the comprehensive gradient data can be sent to the first server so that the first server adjusts the model parameters according to the comprehensive gradient data, generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • FIG. 2 is a schematic diagram of the structure of a model training device provided in an embodiment of the present specification, wherein the device comprises: an acquisition module 201, for a node device to acquire model parameters from the first server; a generation module 202, for generating a target model based on the model parameters; a gradient data determination module 203, for training the target model to obtain gradient data generated when training the target model; a filtering module 204, for filtering out data in the gradient data that does not meet the training conditions required for training the model of the first server based on a preset gradient threshold, to obtain target data; a training module 205, for sending the target data to the first server, so that the first server adjusts the model parameters according to the target data sent by the node device and the gradient data sent by other node devices, and generates a model according to the adjusted model parameters, and deploys the generated model in the first server to train the generated model.
  • the device comprises: an acquisition module 201, for a node device to acquire model parameters from the first server; a
  • the filtering module 204 is specifically used to perform noise processing on a preset gradient threshold to obtain a processed gradient threshold; based on the processed gradient threshold, filter out data in the gradient data that does not meet the training conditions required by the first server training model.
  • the filtering module 204 is specifically configured to compare, for each data in the gradient data, the data with the processed gradient threshold; if the data is greater than the processed gradient threshold, retain the data; if the data is not greater than the processed gradient threshold, filter out the data.
  • the filtering module 204 is specifically used to send the gradient data to a second server, so that the second server filters out data in the gradient data that does not meet the training conditions required for the training model of the first server based on a preset gradient threshold, and obtains target data.
  • the filtering module 204 is specifically used to encrypt the gradient data to obtain ciphertext data; and send the ciphertext data to the second server.
  • the training module 205 is specifically used to perform noise processing on the target data to obtain processed target data; and send the processed target data to the first server so that the first server adjusts the model parameters according to the processed target data sent by the node device and the gradient data sent by other node devices.
  • the operating environment of the second server is a trusted execution environment TEE.
  • This specification also provides a computer-readable storage medium, wherein the storage medium stores a computer program.
  • the computer program When executed by a processor, it can be used to execute the model training method provided in Figure 1 above.
  • the embodiment of this specification also provides a schematic diagram of the structure of the unmanned device shown in FIG3 .
  • the unmanned device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services.
  • the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the model training method shown in FIG1 above.
  • a programmable logic device such as a field programmable gate array (FPGA)
  • FPGA field programmable gate array
  • HDL Hardware Description Language
  • HDL Very-High-Speed Integrated Circuit Hardware Description Language
  • ABEL Advanced Boolean Expression Language
  • AHDL Altera Hardware Description Language
  • HDCal Joint CHDL
  • JHDL Java Hardware Description Language
  • Lava Lava
  • Lola MyHDL
  • PALASM RHDL
  • VHDL Very-High-Speed Integrated Circuit Hardware Description Language
  • Verilog Verilog
  • a typical implementation device is a computer.
  • the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
  • a computing device includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
  • processors CPU
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory

Abstract

本说明书公开了一种模型训练方法、装置、存储介质及电子设备,本说明书实施例中在节点设备从第一服务器中获取模型参数后,基于模型参数生成目标模型,并对目标模型进行训练,得到目标模型训练时产生的梯度数据。基于预设的梯度阈值,从梯度数据中过滤掉不满足第一服务器训练模型所需训练条件的数据,得到目标数据,并发送给第一服务器。第一服务器根据目标数据和其他节点设备发送的梯度数据,调整模型参数以生成模型,并部署于第一服务器中,并对生成的模型进行训练。在此方法中,从梯度数据中筛选出满足训练条件的目标数据,并基于目标数据调整模型参数,而不是采用所有梯度数据调整模型参数,这样可以提高第一服务器中生成的模型的训练效率。

Description

一种模型训练方法、装置、存储介质及电子设备 技术领域
本说明书涉及计算机技术领域,尤其涉及一种模型训练方法、装置、存储介质及电子设备。
背景技术
随着科技的发展,可以从云服务器中获取模型并部署在用户终端,以使模型为用户提供图像识别、信息推荐、隐私保护等服务。
在对云服务器中的模型进行训练时,可以将待训练的模型部署于各用户终端,然后,针对每个用户终端,该用户终端采用本地的训练样本,对部署的模型进行训练,以得到梯度信息,并将梯度信息上传给云服务器。云服务器根据每个用户终端上传的梯度信息,对云服务器中的模型进行训练。
然而,目前采用的训练方法降低了云服务器中的模型的训练效率。
发明内容
本说明书实施例提供一种模型训练方法、装置、存储介质及电子设备。
本说明书实施例采用下述技术方案:本说明书提供的一种模型训练方法,所述方法用于分布式训练;所述分布式训练所基于的系统包括:第一服务器和若干节点设备,所述方法包括:节点设备从所述第一服务器中获取模型参数;基于所述模型参数,生成目标模型;对所述目标模型进行训练,得到对所述目标模型训练时产生的梯度数据;基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据;将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在所述第一服务器中,以对生成的模型进行训练。
可选地,基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,具体包括:对预设的梯度阈值进行加噪处理,得到处理后梯度阈值;基于所述处理后梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练 模型所需训练条件的数据。
可选地,基于所述处理后梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,具体包括:针对所述梯度数据中的每个数据,将该数据与所述处理后梯度阈值进行比较;若该数据大于所述处理后梯度阈值,则保留该数据;若该数据不大于所述处理后梯度阈值,则过滤掉该数据。
可选地,将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数,具体包括:对所述目标数据进行加噪处理,得到处理后目标数据;将所述处理后目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述处理后目标数据以及其他节点设备发送的梯度数据,调整所述模型参数。
可选地,基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据,具体包括:将所述梯度数据发送给第二服务器,以使所述第二服务器基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据;将所述目标数据发送给所述第一服务器,具体包括:通过所述第二服务器,将所述目标数据发送给所述第一服务器。
可选地,将所述梯度数据发送给第二服务器,具体包括:对所述梯度数据进行加密,得到密文数据;将所述密文数据发送给第二服务器。
可选地,所述第二服务器的运行环境为可信执行环境TEE。
本说明书提供的一种模型训练装置,包括:获取模块,用于节点设备从第一服务器中获取模型参数;生成模块,用于基于所述模型参数,生成目标模型;确定梯度数据模块,用于对所述目标模型进行训练,得到对所述目标模型训练时产生的梯度数据;过滤模块,用于基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据;训练模块,用于将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在所述第一服务器中,以对生成的模型进行训练。
本说明书提供的一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述的模型训练方法。
本说明书提供的一种电子设备,包括存储器、处理器及存储在存储器上并可在处理 器上运行的计算机程序,所述处理器执行所述程序时实现上述的模型训练方法。
本说明书实施例采用的上述至少一个技术方案能够达到以下有益效果:本说明书实施例中在节点设备从第一服务器中获取模型参数之后,基于模型参数生成目标模型,并对目标模型进行训练,得到对目标模型训练时产生的梯度数据。然后,基于预设的梯度阈值,从梯度数据中过滤掉不满足第一服务器训练模型所需训练条件的数据,得到目标数据,并发送给第一服务器。第一服务器根据节点设备发送的目标数据和其他节点设备发送的梯度数据,调整模型参数以生成模型,并部署于第一服务器中,并对生成的模型进行训练。在此方法中,从梯度数据中筛选出满足训练条件的目标数据,并基于目标数据调整模型参数,而不是采用所有梯度数据调整模型参数,这样可以提高第一服务器中生成的模型的训练效率。
附图说明
此处所说明的附图用来提供对本说明书的进一步理解,构成本说明书的一部分,本说明书的示意性实施例及其说明用于解释本说明书,并不构成对本说明书的不当限定。
图1为本说明书实施例提供的一种模型训练方法的流程示意图。
图2为本说明书实施例提供的一种模型训练的装置结构示意图。
图3为本说明书实施例提供的电子设备的结构示意图。
具体实施方式
为使本说明书的目的、技术方案和优点更加清楚,下面将结合本说明书具体实施例及相应的附图对本说明书技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本说明书保护的范围。
以下结合附图,详细说明本说明书各实施例提供的技术方案。
图1为本说明书提供一种模型训练方法的流程示意图,该模型训练方法用于分布式训练,分布式训练所基于的系统可以包括第一服务器和若干节点设备。该模型训练方法可以应用于任意节点设备,包括步骤S100至步骤S108。
S100:节点设备从所述第一服务器中获取模型参数。
S102:基于所述模型参数,生成目标模型。
在本说明书实施例中,第一服务器可以是指云服务器,可以在第一服务器中部署模型,第一服务器中的模型可以是指用于执行业务的模型。业务的类型可以包括:推荐业务、查询业务、支付业务、隐私保护业务、图像识别业务、语音识别业务等。
针对第一服务器中的模型的每次迭代训练,第一服务器可以从系统的各节点设备中随机选择出至少部分节点设备。然后,第一服务器可以将第一服务器中的模型的模型参数发送给选择出的至少部分节点设备。其中,节点设备可以是指客户端设备。
针对任意节点设备,该节点设备接收第一服务器发送的模型参数。也就是,该节点设备从第一服务器中获取模型参数。然后,基于获取到的模型参数,生成目标模型。其中,获取的模型参数是上一次迭代训练时对第一服务器中的模型进行模型参数调整后重新生成的模型的模型参数。目标模型可以是指部署于节点设备的模型,并且目标模型的模型结构与第一服务器中的模型的模型结构相同。
在生成目标模型时,该节点设备可以将上一次迭代训练时部署于该节点设备的模型的模型参数更新为获取到的模型参数,并将部署于该节点设备的更新后的模型作为目标模型。
此外,若在上一次迭代训练时该节点设备未部署模型,则该节点设备可以直接将获取到的模型参数赋予与第一服务器中的模型相同模型结构的模型,以生成目标模型。
S104:对所述目标模型进行训练,得到对所述目标模型训练时产生的梯度数据。
在本说明书实施例中,在节点设备生成目标模型之后,可以根据业务需求,获取节点设备本地的历史业务数据,并基于历史业务数据,对目标模型进行训练,得到对目标模型训练时产生的梯度数据。其中,梯度数据可以是指梯度矩阵。
在对目标模型进行训练时,可以先获取节点设备本地的历史业务数据,然后,将获取到的历史业务数据输入目标模型中,以通过目标模型输出结果。根据目标模型输出的结果与标签之间的差异,确定目标模型训练时产生的梯度数据。
S106:基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据。
S108:将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数, 并根据调整后的模型参数生成模型,并将生成的模型部署在所述第一服务器中,以对生成的模型进行训练。
在本说明书实施例中,节点设备在得到目标模型训练时产生的梯度数据之后,可以基于预设的梯度阈值,滤除掉梯度数据中不满足第一服务器训练模型所需训练条件的数据,得到目标数据。然后,将目标数据发送给第一服务器。第一服务器根据接收到的目标数据以及其他节点设备发送的梯度数据,调整服务器中的模型的模型参数。根据调整后的模型参数重新生成模型,并将重新生成的模型部署在第一服务器中,以继续对重新生成的模型进行训练。其中,第一服务器训练模型所需训练条件可以是指对模型训练重要的数据。即,基于预设的梯度阈值,滤除掉梯度数据中对模型训练不重要的数据,也就是,滤除掉小于梯度阈值的数据。另外,不满足第一服务器训练模型所需训练条件的数据还可以是:在连续指定次数的迭代训练中,每次迭代训练产生的梯度数据不变或变化差异在指定范围内的数据。
在滤除梯度数据中不满足第一服务器训练模型所需的训练条件的数据时,可以针对梯度数据中的每个数据,将该数据与梯度阈值进行比较,若该数据大于梯度阈值,则保留该数据,并将该数据作为目标数据;若该数据不大于梯度阈值,则过滤掉该数据。
当梯度数据为梯度矩阵时,梯度阈值可以是指梯度阈值矩阵,目标数据可以是目标梯度矩阵。
在滤除梯度数据中不满足第一服务器训练模型所需的训练条件的数据时,可以针对梯度矩阵中的每个梯度值,将该梯度值与梯度阈值矩阵中与该梯度值对应位置的梯度阈值进行比较。若该梯度值大于梯度阈值,则保留该梯度值;若该梯度值不大于梯度阈值,则将该梯度值置零。最终,将滤除后的梯度矩阵作为目标梯度矩阵。
另外,为了防止因泄露梯度阈值而泄露目标模型训练时产生的梯度数据,第一服务器可以先确定出预设的梯度阈值,然后,对梯度阈值进行处理,得到处理后梯度阈值。其中,对梯度阈值进行处理可以包括:加噪、加密、哈希运算等。最后,将处理后梯度阈值发送给节点设备。节点设备接收第一服务器发送的处理后阈值矩阵,并可以基于处理后梯度阈值,过滤掉梯度数据中不满足第一服务器训练模型所需的训练条件的数据,得到目标数据。
具体的,可以针对梯度数据中的每个数据,将该数据与处理后梯度阈值进行比较,若该数据大于处理后梯度阈值,则保留该数据,并将该数据作为目标数据;若该数据不 大于处理后梯度阈值,则过滤掉该数据。
此外,除了采用第一服务器对梯度阈值进行处理的方法之外,还可以由节点设备对梯度阈值进行处理。其中,对梯度阈值进行处理可以包括:加噪、加密、哈希运算等。
具体的,节点设备可以从第一服务器中获取梯度阈值,然后,可以对梯度阈值进行处理,得到处理后梯度阈值。然后,根据处理后梯度阈值,过滤掉梯度数据中不满足第一服务器训练模型所需的训练条件的数据,得到目标数据。
当梯度数据为梯度矩阵时,对梯度阈值进行处理后的梯度阈值矩阵可以是指处理后梯度阈值矩阵,目标数据可以是目标梯度矩阵。
具体的,针对梯度矩阵中的每个梯度值,将该梯度值与处理后梯度阈值矩阵中与该梯度值对应位置的梯度阈值进行比较。若该梯度值大于梯度阈值,则保留该梯度值;若该梯度值不大于梯度阈值,则将该梯度值置零。最终,将滤除后的梯度矩阵作为目标梯度矩阵。
在得到目标数据之后,节点设备可以将目标数据发送给第一服务器。第一服务器根据接收到的目标数据以及其他节点设备发送的梯度数据,调整模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在第一服务器中,以对生成的模型进行训练。其中,其他节点设备发送的梯度数据可以是其他节点设备训练目标模型时产生的全部梯度数据,也可以是指其他节点设备滤除不满足第一服务器训练模型所需训练条件的数据之后所得到的目标数据。
当其他节点设备发送的是目标数据时,第一服务器可以接收每个节点设备发送的目标数据,然后,根据每个节点设备发送的目标数据,确定综合梯度数据。最后,根据综合梯度数据,对模型参数进行调整,得到调整后的模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在第一服务器中,以对生成的模型进行训练。即,可以将调整后的模型参数作为下一次迭代训练时目标模型的模型参数。
在确定综合梯度数据时,第一服务器可以将各目标数据进行加权求和,得到综合梯度数据。其中,每个目标数据对应的权重之和为1。
另外,为了进一步保护目标数据不被泄露,节点设备可以对目标数据进行处理,得到处理后目标数据。其中,对目标数据进行处理的方法可以包括:加噪、加密、哈希运算等。
在这种情况下,节点设备可以将处理后目标数据发送给第一服务器。第一服务器根 据接收到的处理后目标数据以及其他节点设备发送的梯度数据,调整模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在第一服务器中,以对生成的模型进行训练。
此外,每次迭代训练,对目标模型训练时产生的梯度数据进行处理时都需要消耗隐私计算资源,并且梯度数据量越多,消耗的隐私计算资源越多,因此,在本说明书中,对目标数据进行处理时,只对部分梯度数据进行处理,减少了一次迭代训练所消耗的隐私计算资源。这样的话,在固定隐私计算资源的情况下,采用对目标数据进行处理的训练方式所要迭代训练的次数比采用对全部梯度数据进行处理的训练方式所要迭代训练的次数更多,从而提高第一服务器中模型的训练效果。
在步骤S106~S108中,只保留梯度数据中大于梯度阈值的数据,可以大幅度减少第一服务器中的模型和目标模型的模型参数量级,从而提高训练第一服务器中的模型和目标模型的训练效率。另外,在不对梯度阈值进行处理的情况下,节点设备只将梯度数据中大于梯度阈值的目标数据发送给第一服务器,即使泄露了目标数据,攻击者也只是获取到了部分梯度数据,很难从部分梯度数据中还原出训练目标模型的业务数据。更何况,本说明书中还可以对梯度阈值进行加噪、加密处理。此外,还可以节点设备对目标数据进行处理后,再发送给第一服务器。
通过上述图1所示的方法可见,本说明书在节点设备从第一服务器中获取模型参数之后,基于模型参数生成目标模型,并对目标模型进行训练,得到对目标模型训练时产生的梯度数据。然后,基于预设的梯度阈值,从梯度数据中过滤掉不满足第一服务器训练模型所需训练条件的数据,得到目标数据,并发送给第一服务器。第一服务器根据节点设备发送的目标数据和其他节点设备发送的梯度数据,调整模型参数以生成模型,并部署于第一服务器中,并对生成的模型进行训练。在此方法中,从梯度数据中筛选出满足训练条件的目标数据,并基于目标数据调整模型参数,而不是采用所有梯度数据调整模型参数,这样可以提高第一服务器中生成的模型的训练效率。
进一步,在S106~S108中,节点设备在得到目标模型训练时产生的梯度数据之后,节点设备除了自身对梯度数据进行过滤之外,节点设备还可以将梯度数据发送到第二服务器中。其中,第二服务器可以是指能够实现加噪、加密等处理、过滤功能的服务器,并且第二服务器的运行环境为可信执行环境(Trusted Execution Environment,TEE)。由于第二服务器为可信执行环境,因此,不会泄露梯度数据。
第二服务器在接收到节点设备发送的梯度数据之后,可以通过第二服务器从第一服 务器中获取梯度阈值。然后,第二服务器可以基于梯度阈值,过滤掉梯度数据中不满足第一服务器训练模型所需训练条件的数据,得到目标数据。第二服务器的过滤方法与节点设备的过滤方法相同,在此不再赘述。
此外,为了防止泄露梯度数据,节点设备可以先对梯度数据进行加密,得到针对梯度数据的密文数据。然后,将密文数据发送给第二服务器。之后,第二服务器需要对密文数据进行解密,得到梯度数据。最后,第二服务器可以基于梯度阈值,过滤掉梯度数据中不满足第一服务器训练模型所需训练条件的数据,得到目标数据。
同样的,为避免因梯度阈值而泄露梯度数据,第二服务器可以对梯度阈值进行处理,得到处理后梯度阈值。然后,根据处理后梯度阈值,过滤掉梯度数据中不满足第一服务器训练模型所需训练条件的数据,得到目标数据。
在第二服务器得到目标数据之后,第二服务器可以将目标数据发送给第一服务器,以使第一服务器基于目标数据以及其他节点设备发送的梯度数据,调整模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在第一服务器中,以对生成的模型进行训练。
此外,为了进一步保护梯度数据,第二服务器可以对目标数据进行处理,得到处理后目标数据。然后,将处理后目标数据发送给第一服务器,以使第一服务器根据接收到的处理后目标数据以及其他节点设备发送的梯度数据,调整模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在第一服务器中,以对生成的模型进行训练。
另外,第二服务器除了直接将目标数据或处理后目标数据发送给第一服务器之外,当节点设备存在多个时,第二服务器可以获取各节点设备训练目标模型时产生的目标数据。然后,将各目标数据进行加权求和,得到聚合梯度数据。最后,将聚合梯度数据发送给第一服务器,以使第一服务器根据接收到的聚合梯度数据,调整模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在第一服务器中,以对生成的模型进行训练。
此外,为了减少隐私计算资源,可以对聚合梯度数据进行加噪处理,得到综合梯度数据,并将综合梯度数据发送给第一服务器,以使第一服务器根据综合梯度数据,调整模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在第一服务器中,以对生成的模型进行训练。
以上为本说明书实施例提供的模型训练方法,基于同样的思路,本说明书还提供了 相应的装置、存储介质和电子设备。
图2为本说明书实施例提供的一种模型训练装置的结构示意图,所述装置包括:获取模块201,用于节点设备从所述第一服务器中获取模型参数;生成模块202,用于基于所述模型参数,生成目标模型;确定梯度数据模块203,用于对所述目标模型进行训练,得到对所述目标模型训练时产生的梯度数据;过滤模块204,用于基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据;训练模块205,用于将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在所述第一服务器中,以对生成的模型进行训练。
可选地,所述过滤模块204具体用于,对预设的梯度阈值进行加噪处理,得到处理后梯度阈值;基于所述处理后梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据。
可选地,所述过滤模块204具体用于,针对所述梯度数据中每个数据,将该数据与所述处理后梯度阈值进行比较;若该数据大于所述处理后梯度阈值,则保留该数据;若该数据不大于所述处理后梯度阈值,则过滤掉该数据。
可选地,所述过滤模块204具体用于,将所述梯度数据发送给第二服务器,以使所述第二服务器基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据。
可选地,所述过滤模块204具体用于,对所述梯度数据进行加密,得到密文数据;将所述密文数据发送给第二服务器。
可选地,所述训练模块205具体用于,对所述目标数据进行加噪处理,得到处理后目标数据;将所述处理后目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述处理后目标数据以及其他节点设备发送的梯度数据,调整所述模型参数。
可选地,所述训练模块205具体用于,通过所述第二服务器,将所述目标数据发送给所述第一服务器。
可选地,所述第二服务器的运行环境为可信执行环境TEE。
本说明书还提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所 述计算机程序被处理器执行时可用于执行上述图1提供的模型训练方法。
基于图1所示的模型训练方法,本说明书实施例还提供了图3所示的无人设备的结构示意图。如图3,在硬件层面,该无人设备包括处理器、内部总线、网络接口、内存以及非易失性存储器,当然还可能包括其他业务所需要的硬件。处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,以实现上述图1所示的模型训练方法。
当然,除了软件实现方式之外,本说明书并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、 可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本说明书时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本说明书的实施例可提供为方法、系统、或计算机程序产品。因此,本说明书可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书是参照根据本说明书实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或 多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
本领域技术人员应明白,本说明书的实施例可提供为方法、系统或计算机程序产品。因此,本说明书可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本说明书的实施例而已,并不用于限制本说明书。对于本领域技术人员来说,本说明书可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本说明书的权利要求范围之内。

Claims (10)

  1. 一种模型训练方法,所述方法用于分布式训练;所述分布式训练所基于的系统包括:第一服务器和若干节点设备,所述方法包括:
    节点设备从所述第一服务器中获取模型参数;
    基于所述模型参数,生成目标模型;
    对所述目标模型进行训练,得到对所述目标模型训练时产生的梯度数据;
    基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据;
    将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在所述第一服务器中,以对生成的模型进行训练。
  2. 如权利要求1所述的方法,基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,包括:
    对预设的梯度阈值进行加噪处理,得到处理后梯度阈值;
    基于所述处理后梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据。
  3. 如权利要求2所述的方法,基于所述处理后梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,包括:
    针对所述梯度数据中每个数据,将该数据与所述处理后梯度阈值进行比较;
    若该数据大于所述处理后梯度阈值,则保留该数据;
    若该数据不大于所述处理后梯度阈值,则过滤掉该数据。
  4. 如权利要求1所述的方法,将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数,包括:
    对所述目标数据进行加噪处理,得到处理后目标数据;
    将所述处理后目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述处理后目标数据以及其他节点设备发送的梯度数据,调整所述模型参数。
  5. 如权利要求1所述的方法,基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据,包括:
    将所述梯度数据发送给第二服务器,以使所述第二服务器基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据;
    将所述目标数据发送给所述第一服务器,包括:
    通过所述第二服务器,将所述目标数据发送给所述第一服务器。
  6. 如权利要求5所述的方法,将所述梯度数据发送给第二服务器,包括:
    对所述梯度数据进行加密,得到密文数据;
    将所述密文数据发送给第二服务器。
  7. 如权利要求5或6所述的方法,所述第二服务器的运行环境为可信执行环境TEE。
  8. 一种模型训练装置,包括:
    获取模块,用于节点设备从第一服务器中获取模型参数;
    生成模块,用于基于所述模型参数,生成目标模型;
    确定梯度数据模块,用于对所述目标模型进行训练,得到对所述目标模型训练时产生的梯度数据;
    过滤模块,用于基于预设的梯度阈值,过滤掉所述梯度数据中不满足所述第一服务器训练模型所需训练条件的数据,得到目标数据;
    训练模块,用于将所述目标数据发送给所述第一服务器,以使所述第一服务器根据接收到所述节点设备发送的所述目标数据以及其他节点设备发送的梯度数据,调整所述模型参数,并根据调整后的模型参数生成模型,并将生成的模型部署在所述第一服务器中,以对生成的模型进行训练。
  9. 一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现上述权利要求1-7任一项所述的方法。
  10. 一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述权利要求1-7任一项所述的方法。
PCT/CN2023/115130 2022-12-30 2023-08-27 一种模型训练方法、装置、存储介质及电子设备 WO2024139312A1 (zh)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211739985.0 2022-12-30

Publications (1)

Publication Number Publication Date
WO2024139312A1 true WO2024139312A1 (zh) 2024-07-04

Family

ID=

Similar Documents

Publication Publication Date Title
EP3910513B1 (en) Blockchain-based data processing method and device
US11605087B2 (en) Method and apparatus for identifying identity information
US10594489B2 (en) Method and device for processing service request
CN108053211B (zh) 基于区块链的交易处理方法及装置
TWI745861B (zh) 資料處理方法、裝置和電子設備
CN116011587A (zh) 一种模型训练方法、装置、存储介质及电子设备
US20210044653A1 (en) Method, apparatus, client terminal, and server for data processing
WO2021017424A1 (zh) 数据预处理方法、密文数据获取方法、装置和电子设备
CN114429222A (zh) 一种模型的训练方法、装置及设备
CN108334340A (zh) 一种跨环境数据通信方法、装置和系统
US10790961B2 (en) Ciphertext preprocessing and acquisition
WO2024113932A1 (zh) 一种模型优化的方法、装置、设备及存储介质
CN114638005A (zh) 基于区块链的数据处理方法、装置及系统、存储介质
WO2024060852A1 (zh) 一种模型的所有权验证方法、装置、存储介质及电子设备
WO2024139312A1 (zh) 一种模型训练方法、装置、存储介质及电子设备
CN115618375A (zh) 一种业务执行方法、装置、存储介质及电子设备
CN116629381A (zh) 一种联邦迁移学习方法、装置、存储介质及电子设备
CN114638998A (zh) 模型更新方法、装置、系统及设备
CN115545572A (zh) 一种业务风控的方法、装置、设备及存储介质
CN108681554A (zh) 一种利用正则表达式的匹配方法、装置及设备
EP3779691B1 (en) Data processing method and apparatus
CN113673844A (zh) 一种信息反馈方法、装置及设备
WO2024139320A1 (zh) 一种数据排序方法、装置、设备及可读存储介质
CN115550071B (zh) 一种数据处理方法、装置、存储介质及设备
CN117194298B (zh) 一种控制方法、装置、设备及存储介质