WO2021184345A1 - 隐私机器学习实现方法、装置、设备及存储介质 - Google Patents

隐私机器学习实现方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2021184345A1
WO2021184345A1 PCT/CN2020/080390 CN2020080390W WO2021184345A1 WO 2021184345 A1 WO2021184345 A1 WO 2021184345A1 CN 2020080390 W CN2020080390 W CN 2020080390W WO 2021184345 A1 WO2021184345 A1 WO 2021184345A1
Authority
WO
WIPO (PCT)
Prior art keywords
machine learning
native
node
cryptographic
plaintext
Prior art date
Application number
PCT/CN2020/080390
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 云图技术有限公司
Priority to PCT/CN2020/080390 priority Critical patent/WO2021184345A1/zh
Publication of WO2021184345A1 publication Critical patent/WO2021184345A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Definitions

  • This specification relates to the field of machine learning technology, and in particular to a method, device, equipment and storage medium for implementing privacy machine learning.
  • Machine Learning has been applied in many fields.
  • machine learning requires the use of a large amount of sample data
  • two or more data holders will collaborate in machine learning modeling.
  • any data holder there is a risk that its private data will be leaked or used improperly. Therefore, how to protect private data well is very important for machine learning.
  • privacy machine learning frameworks In order to solve this problem, various encryption machine learning-based frameworks (hereinafter referred to as privacy machine learning frameworks) have emerged, such as: TF-Encrypted, PySyft, etc.
  • these privacy machine learning frameworks make use of the ease of use of the application programming interface (API, Application Programming Interface) of plaintext machine learning frameworks (such as Tensorflow, PyTorch, etc.), and at the same time train encrypted data through a variety of cryptographic algorithms And predictions, so that users can use them without expertise in cryptography, distributed systems, or high-performance computing.
  • API Application Programming Interface
  • plaintext machine learning frameworks such as Tensorflow, PyTorch, etc.
  • the purpose of the implementation of this specification is to provide a way to reduce the implementation cost of privacy machine learning.
  • the implementation of this specification provides a method for implementing privacy machine learning, including:
  • the plaintext machine learning model is generated based on a plaintext machine learning framework
  • the dynamic optimizer is derived from the optimizer base class of the plaintext machine learning framework, and the cryptographic operator and all are registered in the plaintext machine learning framework. The dynamic optimizer.
  • the implementation of this specification also provides a device for implementing privacy machine learning, including:
  • the judgment module is used to confirm whether the execution time of the dynamic optimizer in the plaintext machine learning model comes when the calculation logic of the plaintext machine learning model is executed;
  • the execution module is configured to execute the dynamic optimizer when the execution time of the dynamic optimizer arrives, so as to replace the native operator in the calculation logic with a cryptographic operator, and execute the cryptographic operator;
  • the plaintext machine learning model is generated based on a plaintext machine learning framework
  • the dynamic optimizer is derived from the optimizer base class of the plaintext machine learning framework, and the cryptographic operator and all are registered in the plaintext machine learning framework. The dynamic optimizer.
  • the implementation of this specification also provides an electronic device, including a memory, a processor, and a computer program stored on the memory, and the computer program executes the aforementioned privacy machine learning when the computer program is run by the processor. Implementation.
  • the implementation of this specification also provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a processor, the aforementioned privacy machine learning implementation method is implemented.
  • the native operator of the cipher is replaced with a cryptographic operator, and then by executing the cryptographic operator, private machine learning can be realized by reusing the existing plaintext machine learning model, thus avoiding the use of the APIs and privacy specific to the private machine learning framework due to the prior art
  • Figure 1 is a flowchart of a privacy machine learning implementation method of some embodiments of this specification
  • FIG. 2 is a schematic diagram of a structure in which multiple data holders jointly perform machine learning in an exemplary embodiment of this specification
  • Fig. 3 is a flowchart of a method for implementing privacy machine learning according to an embodiment of this specification
  • Figure 4 is a native static diagram of the plaintext machine learning model before executing the dynamic optimizer in an exemplary embodiment of this specification;
  • Figure 5 is a static cryptographic diagram of the plaintext machine learning model after executing the dynamic optimizer in an exemplary embodiment of this specification
  • Fig. 6 is a structural block diagram of a privacy machine learning implementation device according to some embodiments of this specification.
  • FIG. 7 is a structural block diagram of an electronic device in some embodiments of this specification.
  • the privacy machine learning implementation method may include the following steps:
  • the plaintext machine learning model is generated based on a plaintext machine learning framework
  • the dynamic optimizer is derived from the optimizer base class of the plaintext machine learning framework, and the cryptographic operator and all are registered in the plaintext machine learning framework. The dynamic optimizer.
  • the implementation of this specification can also implement a dynamic optimizer in the plaintext machine learning model; since the dynamic optimizer is derived from the native optimizer class of the plaintext machine learning framework, the plaintext machine learning A cryptographic operator and a dynamic optimizer are registered in the framework, and the plaintext machine learning model is generated based on the plaintext machine learning framework.
  • this dynamic replacement method since the implementation of this specification replaces the native operators with cryptographic operators when the calculation logic of the plaintext machine learning model is to be executed, this dynamic replacement method also has high flexibility. . Not only that, this dynamic replacement method also enables subsequent function expansion (for example, adding some business judgment conditions) without complicating the static graph, which is beneficial for users to find problems and is user-friendly.
  • the plaintext machine learning framework can be any existing plaintext machine learning framework, such as TensorFlow, PyTorch, or Caffe. Therefore, this specification does not limit the specific plaintext machine learning framework used to generate the plaintext machine learning model, and it can be selected according to actual needs.
  • the cryptographic operator can be implemented by a developer through a static language (such as C, C++, etc.) in advance to improve efficiency, and registered in the plaintext machine learning framework after implementation.
  • the password operator generally also includes a password gradient operator.
  • these cryptographic operators should correspond one-to-one with the native operators in the plaintext machine learning model generated based on the plaintext machine learning framework, so as to facilitate subsequent corresponding replacements.
  • a cryptographic operator is any cryptographic operator that can provide privacy protection for the input data of all parties in a scenario where two or more data holders jointly (or collaboratively) perform machine learning modeling. son.
  • the cryptographic operator may be a Secure Multi-Party Computation (MPC) operator, a homomorphic encryption (Homomorphic Encryption, HE) operator, or a zero-knowledge proof (Zero-knowledge) operator. Proof, ZKP) operator, etc.
  • MPC Secure Multi-Party Computation
  • HE homomorphic Encryption
  • ZKP zero-knowledge proof
  • this specification does not limit the specific codon operators used, which can be selected according to actual needs.
  • the dynamic optimizer can also be derived and implemented by the developer based on the optimizer base class of the plaintext machine learning framework in advance, so that the optimizer base class of the plaintext machine learning framework can be reused.
  • the optimizer base class of the plaintext machine learning framework can be reused.
  • a developer can derive and implement a dynamic optimizer based on the TensorFlow optimizer base class GraphOptimizationPass, thereby reusing the TensorFlow optimizer base class.
  • the dynamic optimizer can be registered in the plaintext machine learning framework to facilitate the use of the plaintext machine learning model generated based on the plaintext machine learning framework.
  • the execution timing of the dynamic optimizer includes any one of the following:
  • placement refers to assigning nodes in the native static graph to designated devices (such as CPU, GPU, etc.) for processing.
  • Splitting refers to splitting the native static graph into multiple static graphs to facilitate concurrent execution.
  • executing the computational logic of the plaintext machine learning model refers to processing training samples based on the computational logic of the plaintext machine learning model to perform machine learning modeling.
  • the training samples are generally private data from at least two data holders.
  • three data holders (data holder 1, data holder 2, and data holder 3) cooperate to perform machine learning modeling.
  • the terminal of each data holder is equipped with a plaintext machine learning model, and a dynamic optimizer is imported into the plaintext machine learning model.
  • the native operator of the plaintext machine learning model can be replaced with the MPC operator (here, the cryptographic operator is used Take the MPC operator as an example), and execute the MPC operator.
  • MPC operator the cryptographic operator is used Take the MPC operator as an example
  • the data of any one of the three data holders will not be known by the other two parties, thus achieving the improvement of the value of data utilization while taking into account the security of their own private data.
  • each data holder can be trained to obtain a data prediction model, and subsequent data predictions can be made based on the data prediction model.
  • the general principle of replacing the native operators in the plaintext machine learning model with cryptographic operators is: all native operators that affect data privacy protection need to be replaced with corresponding cryptographic operators. Ensure the privacy and security of input data; for native operators that do not affect data privacy protection, try not to replace them, so as to improve the reuse rate of plaintext machine learning models, thereby helping to reduce the implementation cost of private machine learning.
  • a plaintext machine learning model that uses a computational graph (or called a directed acyclic graph) to represent processing logic (for example, a plaintext machine learning model generated based on Tensorflow)
  • processing logic for example, a plaintext machine learning model generated based on Tensorflow
  • each native operator in the plaintext machine learning model if (Necessary)
  • the original static graph in the plaintext machine learning model is replaced with a cryptographic static graph.
  • the native operators in the plaintext machine learning models are replaced It is a codon operator, and naturally it may not be a replacement for the calculation graph.
  • the cryptographic operators and cryptographic static graphs mentioned in the embodiments of this specification refer to operators and static graphs under privacy protection, respectively.
  • replacing the native static image of the plaintext machine learning model with the password static image may include the following steps:
  • the native node is the native operator.
  • the native static graph here can be a native static subgraph.
  • the native node needs to be replaced with a corresponding cryptographic node by confirming whether the data stream corresponding to the native node contains model private data.
  • the data stream corresponding to the native node contains model private data, it needs to be replaced to protect the privacy of the private data. Otherwise, it may not be replaced to improve the reuse rate of the plaintext machine learning model.
  • variable 1 and variable 2 are private data held by each party, and constant 1 and constant 2 are public constant data.
  • the MatMul 1 function is the native node that the data flow starting from variable 1 and variable 2 must pass through. Therefore, the MatMul 1 function needs to be replaced. For the same reason, the MatMul 3 function also needs to be replaced.
  • the MatMul 2 function is the native node that the data flow starting from the constant 1 and constant 2 must pass. However, because the constant 1 and constant 2 are not private data and need not be protected, the MatMul 2 function does not need to be replaced.
  • replacing the native node with a corresponding cryptographic node may include:
  • the native node and its input edge and output edge are correspondingly replaced with the cryptographic node, the new input edge and the new output edge, thereby completing the replacement of the native operator.
  • the replacement operation of the native static graph at runtime can be completed through continuous iteration, thereby generating a cryptographic static graph, and then the cryptographic static graph can be executed to realize private machine learning.
  • the original static image shown in FIG. 4 can be changed to the password static image shown in FIG. 5 (it can be seen that in FIG. 5, MpcMatMul 1 and MpcMatMul 3 are MPC nodes).
  • the privacy machine learning implementation device may include:
  • the judging module 61 may be used to confirm whether the execution time of the dynamic optimizer in the plaintext machine learning model comes when the calculation logic of the plaintext machine learning model is executed;
  • the execution module 62 may be configured to execute the dynamic optimizer when the execution time of the dynamic optimizer arrives, so as to replace the native operator in the calculation logic with a cryptographic operator, and execute the cryptographic operator ;
  • the plaintext machine learning model is generated based on a plaintext machine learning framework
  • the dynamic optimizer is derived from the optimizer base class of the plaintext machine learning framework, and the cryptographic operator and all are registered in the plaintext machine learning framework. The dynamic optimizer.
  • the replacement of the native operator in the calculation logic with a cryptographic operator includes:
  • the native static image of the plaintext machine learning model is replaced with a cryptographic static image.
  • replacing the native static image of the plaintext machine learning model with a password static image includes:
  • the confirmation whether it is necessary to replace the native node with a corresponding cryptographic node includes:
  • the replacement of the native node with a corresponding cryptographic node includes:
  • edge information Acquiring attribute information, edge information, and corresponding cryptographic node name of the native node;
  • the edge information includes an input edge and an output edge;
  • the execution timing of the dynamic optimizer includes any one of the following:
  • an electronic device includes a memory, a processor, and a computer program stored on the memory, and the computer program can execute the above-mentioned when the computer program is run by the processor.
  • Privacy machine learning implementation method includes a memory, a processor, and a computer program stored on the memory, and the computer program can execute the above-mentioned when the computer program is run by the processor.
  • These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • the computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-permanent memory in a computer readable medium, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash memory
  • Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
  • the information can be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • the implementation of this specification can be provided as a method, a system or a computer program product. Therefore, the implementation of this specification may adopt the form of a complete hardware implementation, a complete software implementation, or an implementation combining software and hardware. Moreover, the implementation of this specification may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
  • the embodiments of this specification can also be practiced in distributed computing environments. In these distributed computing environments, tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本说明书实施方案提供了一种隐私机器学习实现方法、装置、设备及存储介质,该方法包括:在执行明文机器学习模型的计算逻辑时,确认所述明文机器学习模型中的动态优化器的执行时机是否到来;当所述动态优化器的执行时机到来时,执行所述动态优化器,以将所述计算逻辑中的原生算子替换为密码算子,并执行所述密码算子;其中,所述明文机器学习模型基于明文机器学习框架生成,所述动态优化器派生于所述明文机器学习框架的优化器基类,所述明文机器学习框架中注册有所述密码算子和所述动态优化器。本说明书实施方案可以降低隐私机器学习的实现成本。

Description

隐私机器学习实现方法、装置、设备及存储介质 技术领域
本说明书涉及机器学习技术领域,尤其是涉及一种隐私机器学习实现方法、装置、设备及存储介质。
背景技术
目前机器学习(Machine Learning)已在很多领域有所应用。在一些情况下,鉴于机器学习需要使用大量的样本数据,为了可以从数据中挖掘出更大的价值,两个或更多个数据持有方会协作进行机器学习建模。但是,对于任何一个数据持有方而言,己方的私有数据有被泄露或者是被不正当使用的风险。因此,如何将私有数据很好地保护起来对机器学习至关重要。
为了解决该问题,各种基于加密机器学习的框架(以下简称隐私机器学习框架)应运而生,如:TF-Encrypted、PySyft等。一般地,这些隐私机器学习框架是利用了明文机器学习框架(如Tensorflow、PyTorch等)的应用程序接口(API,Application Programming Interface)的易用性,同时通过多种密码学算法对加密数据进行训练和预测,以使用户可以在并不精通密码学、分布式系统或高性能计算专业知识的情况下,也可以使用。
然而,在实现本申请的过程中,本申请的发明人发现:这些隐私机器学习框架的实现均未使用已有的明文机器学习模型,若想要使用已有的明文机器学习模型的处理逻辑,就需要使用隐私机器学习框架特有的APIs和私有数据类型重新编码实现,实现成本较高。
发明内容
本说明书实施方案的目的在于提供一种以降低隐私机器学习的实现成本。
为达到上述目的,一方面,本说明书实施方案提供了一种隐私机器学习实现方法,包括:
在执行明文机器学习模型的计算逻辑时,确认所述明文机器学习模型中的动态优化器的执行时机是否到来;
当所述动态优化器的执行时机到来时,执行所述动态优化器,以将所述计算逻辑中 的原生算子替换为密码算子,并执行所述密码算子;
其中,所述明文机器学习模型基于明文机器学习框架生成,所述动态优化器派生于所述明文机器学习框架的优化器基类,所述明文机器学习框架中注册有所述密码算子和所述动态优化器。
另一方面,本说明书实施方案还提供了一种隐私机器学习实现装置,包括:
判断模块,用于在执行明文机器学习模型的计算逻辑时,确认所述明文机器学习模型中的动态优化器的执行时机是否到来;
执行模块,用于当所述动态优化器的执行时机到来时,执行所述动态优化器,以将所述计算逻辑中的原生算子替换为密码算子,并执行所述密码算子;
其中,所述明文机器学习模型基于明文机器学习框架生成,所述动态优化器派生于所述明文机器学习框架的优化器基类,所述明文机器学习框架中注册有所述密码算子和所述动态优化器。
另一方面,本说明书实施方案还提供了一种电子设备,包括存储器、处理器、以及存储在所述存储器上的计算机程序,所述计算机程序被所述处理器运行时执行上述的隐私机器学习实现方法。
另一方面,本说明书实施方案还提供了一种计算机存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的隐私机器学习实现方法。
由以上本说明书实施方案提供的技术方案可见,在本说明书实施方案中,由于动态优化器派生于明文机器学习框架的原生优化器类,明文机器学习框架中注册有密码算子和动态优化器,且明文机器学习模型是基于明文机器学习框架生成的,如此,在执行明文机器学习模型的计算逻辑时,当动态优化器的执行时机到来时,通过执行动态优化器,就可以将明文机器学习模型的原生算子替换为密码算子,再通过执行密码算子就可以通过复用已有的明文机器学习模型实现隐私机器学习,从而避免了现有技术因使用隐私机器学习框架特有的APIs和隐私数据类型重新编码所带来的巨大开发成本,因而本说明书的实施方案降低了隐私机器学习的实现成本。
附图说明
为了更清楚地说明本说明书实施方案或现有技术中的技术方案,下面将对实施方案或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施方案,对于本领域普通技术人员来讲,在不付出创造性 劳动性的前提下,还可以根据这些附图获得其他的附图。在附图中:
图1为本说明书的一些实施方案的隐私机器学习实现方法的流程图;
图2为本说明书的一个示例性实施方案中多个数据持有方联合进行机器学习的结构示意图;
图3为本说明书的一个实施方案的隐私机器学习实现方法的流程图;
图4为本说明书的一个示例性实施方案中,执行动态优化器前明文机器学习模型的原生静态图;
图5为本说明书的一个示例性实施方案中,执行动态优化器后明文机器学习模型的密码静态图;
图6为本说明书的一些实施方案的隐私机器学习实现装置的结构框图;
图7为本说明书的一些实施方案中电子设备的结构框图。
具体实施方式
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施方案中的附图,对本说明书实施方案中的技术方案进行清楚、完整地描述,显然,所描述的实施方案仅仅是本说明书一部分实施方案,而不是全部的实施方案。基于本说明书中的实施方案,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施方案,都应当属于本说明书保护的范围。
参考图1所示,在本说明书的一些实施方案中,隐私机器学习实现方法可以包括以下步骤:
S101、在执行明文机器学习模型的计算逻辑时,确认所述明文机器学习模型中的动态优化器的执行时机是否到来。
S102、当所述动态优化器的执行时机到来时,执行所述动态优化器,以将所述计算逻辑中的原生算子替换为密码算子,并执行所述密码算子。
其中,所述明文机器学习模型基于明文机器学习框架生成,所述动态优化器派生于所述明文机器学习框架的优化器基类,所述明文机器学习框架中注册有所述密码算子和所述动态优化器。
由此可见,本说明书的实施方案除了实现密码算子外,还可以实现在明文机器学习模型中导入一个动态优化器;由于动态优化器派生于明文机器学习框架的原生优化器类,明文机器学习框架中注册有密码算子和动态优化器,且明文机器学习模型是基于明文机 器学习框架生成的,如此,在执行明文机器学习模型的计算逻辑时,当动态优化器的执行时机到来时,通过执行动态优化器,就可以将明文机器学习模型的原生算子替换为密码算子,再通过执行密码算子就可以通过复用已有的明文机器学习模型实现隐私机器学习,从而避免了现有技术因使用隐私机器学习框架特有的APIs和隐私数据类型重新编码所带来的巨大开发成本,因而本说明书的实施方案降低了隐私机器学习的实现成本。
此外,由于本说明书的实施方案是在要执行明文机器学习模型的计算逻辑时才将其将其中的原生算子替换为密码算子,因此,这种动态替换方式,还具有较高的灵活性。不仅如此,这种动态替换方式还使得后续在进行功能扩展(例如增加一些业务判断条件)时,不会使静态图复杂化,从而有利于用户查找问题,用户友好性好。
在本说明书的一些实施方案中,明文机器学习框架可以为任何已有的明文机器学习框架,例如TensorFlow、PyTorch、或Caffe等。因此,本说明书对于明文机器学习模型具体采用何种明文机器学习框架生成不作限定,具体可根据需要选择。
在本说明书的一些实施方案中,密码算子可以由开发人员预先通过静态语言(例如C、C++等)编程实现,以提高效率,并在实现后注册到明文机器学习框架中。其中,密码算子中一般还包含有密码梯度算子。当然,这些密码算子(包括密码梯度算子),应与基于该明文机器学习框架生成的明文机器学习模型中的原生算子一一对应,以便于后续对应替换。
在本说明书的一些实施方案中,密码算子为任何可在两个或多个数据持有方联合(或协同)进行机器学习建模的场景中,为各方输入数据提供隐私保护的密码算子。例如,在一些示例性实施方案中,密码算子可以为安全多方计算(Secure Multi-Party Computation,MPC)算子、同态加密(Homomorphic Encryption,HE)算子、或零知识证明(Zero-knowledge Proof,ZKP)算子等。同样,本说明书对具体采用何种密码算子不作限定,具体可根据需要选择。
在本说明书的一些实施方案中,动态优化器也可以由开发人员预先基于明文机器学习框架的优化器基类派生并实现,如此就可以复用明文机器学习框架的优化器基类。例如,在一示例性实施方案中,以TensorFlow为例,开发人员可以基于TensorFlow的优化器基类GraphOptimizationPass派生并实现动态优化器,从而复用TensorFlow的优化器基类。
在实现动态优化器后,可以将动态优化器注册到明文机器学习框架中,以便于基于明文机器学习框架生成的明文机器学习模型使用。此外,注册动态优化器到明文机器学 习框架时,还可以指定动态优化器的执行时机。例如,在一示例性实施方案中,以TensorFlow为例,动态优化器的执行时机包括以下中的任意一种:
(1)、安置所述明文机器学习模型中的原生静态图之前。例如,REGISTER_OPTIMIZATION(PRE_PLACEMENT,DynamicPass);其中,DynamicPass表示注册的动态优化器,PRE_PLACEMENT表示执行时机是在原生静态图安置之前;
(2)、安置所述明文机器学习模型中的原生静态图之后。例如,REGISTER_OPTIMIZATION(POST_PLACEMENT,DynamicPass);其中,DynamicPass表示注册的动态优化器,POST_PLACEMENT表示执行时机是在原生静态图安置之后;
(3)、优化所述明文机器学习模型中的原生静态图之后。例如,REGISTER_OPTIMIZATION(POST_REWRITE_FOR_EXEC,DynamicPass),其中,DynamicPass表示注册的动态优化器,POST_REWRITE_FOR_EXEC表示执行时机是在原生静态图优化之后。
(4)、分裂所述明文机器学习模型中的原生静态图之后。例如,REGISTER_OPTIMIZATION(POST_PARTITIONING,DynamicPass),其中,DynamicPass表示注册的动态优化器,POST_PARTITIONING表示执行时机是在原生静态图分裂之后。
在本说明书中,安置是指将原生静态图中的节点分配给指定的设备(例如CPU、GPU等)去处理。分裂是指将原生静态图拆分为多个静态图,以便于并发执行。
在密码算子和动态优化器注册到明文机器学习框架之后,用户可以获取动态优化器并将其导入明文机器学习模型中。
在本说明书的一些实施方案中,执行明文机器学习模型的计算逻辑是指:基于明文机器学习模型的计算逻辑处理训练样本,以进行机器学习建模。其中,训练样本一般为来至少两个数据持有方的私有数据。例如,在如图2所示的示例性实施方案中,三个数据持有方(数据持有方1、数据持有方2和数据持有方3)协同进行机器学习建模。每个数据持有方的终端均配置有明文机器学习模型,且在明文机器学习模型中导入有动态优化器。在执行明文机器学习模型的计算逻辑时,当动态优化器的执行时机到来时,通过执行动态优化器,就可以将明文机器学习模型的原生算子替换为MPC算子(这里以密码算子采用MPC算子为例),并执行MPC算子。这样,在MPC隐私保护加持下,三个数据持有方中,任何一方的数据都不会被其他两方所获知,从而实现了在提高数据利用价值的同时,兼顾了自身隐私数据的安全。在完成机器学习建模后,每个数据持有方都可以训练得到一个数据预测模型,后续就可以基于该数据预测模型进行数据预测。
在本说明书的一些实施方案中,将明文机器学习模型中的原生算子替换为密码算子的一般原则是:对于影响数据隐私保护的原生算子,均需要替换为对应的密码算子,以确保输入数据的隐私安全;对于不影响数据隐私保护的原生算子,尽量不进行替换,以提高对明文机器学习模型的复用率,从而有利于降低隐私机器学习的实现成本。
对于使用计算图(或称为有向无环图)表示处理逻辑的明文机器学习模型(例如基于Tensorflow生成的明文机器学习模型)而言,当将明文机器学习模型中的各个原生算子(如果有必要)替换为对应的密码算子后,即实现了将所述明文机器学习模型中的原生静态图替换为密码静态图。但是,本领技术人员应当理解,这里仅是举例说明,在本说明书的其他实施方案中,当一些明文机器学习模型并不使用计算图表示处理逻辑时,将明文机器学习模型中的原生算子替换为密码算子,自然也可以不是针对计算图的替换。本说明书的实施方案中提及的密码算子和密码静态图,分别是指在隐私保护下的算子和静态图。
参考图3所示,在本说明书的一些实施方案中,将明文机器学习模型的原生静态图替换为密码静态图可以包括如下步骤:
从明文机器学习模型的原生静态图中获取原生节点;这里的原生节点即为原生算子。其中,在并发场景下,这里的原生静态图可以是原生静态子图。
判断获取到原生节点是否为空;如果为空,说明已经处理完整幅原生静态图,则结束流程。
如果不为空,即表示获取到原生节点,此时则可以确认是否需要将该原生节点替换为对应的密码节点。
在本说明书的一实施方案中,可以通过确认该原生节点对应的数据流中是否包含模型私有数据,来确认是否需要将该原生节点替换为对应的密码节点。当该原生节点对应的数据流中包含模型私有数据时,则需要进行替换,以实现对私有数据的隐私保护,否则,可以不进行替换,以提高对明文机器学习模型的复用率。
例如,在图4所示的示例性实施方案中,变量1和变量2是各方持有的私有数据,常量1和常量2是公共的常量数据。从图4中可以看出,MatMul 1函数是从变量1和变量2出发的数据流所必须经过的原生节点,因此,MatMul 1函数需要进行替换。基于同样的原因,MatMul 3函数也需要进行替换。MatMul 2函数是从常量1和常量2出发的数据流所必须经过的原生节点,但由于常量1和常量2不是私有数据,无需保护,因此,MatMul 2函数不需要替换。
如果需要将该原生节点替换为对应的密码节点,则将该原生节点替换为对应的密码节点;否则,则返回第一步,以从明文机器学习模型的原生静态图中获取下一个原生算子并处理。其中,将该原生节点替换为对应的密码节点可以包括:
获取该原生节点的属性信息、边信息(包括输入边和输出边)及对应的密码算子名称;
根据该原生节点的属性信息、边信息及对应的密码节点名称,创建密码算子、新输入边和新输出边,即可以以该原生节点的属性信息、边信息及对应的密码节点名称作为参数,调用密码算子创建函数创建对应的密码节点,并返回。
将该原生节点及其输入边和输出边对应替换为该密码节点、该新输入边和该新输出边,从而完成对该原生算子的替换。
依此递推,通过不断迭代就可以完成运行时原生静态图的替换操作,从而生成密码静态图,此后就可以执行该密码静态图,以实现隐私机器学习。例如,以图4中所示的示例性实施方案为例,经过替换,图4中所示的原生静态图可以变成如图5中所示的密码静态图(可以看出在图5中,MpcMatMul 1和MpcMatMul 3均为MPC节点)。
与上述的隐私机器学习实现方法对应,本说明书还提供有隐私机器学习实现装置。参考图6所示,在本说明书的一些实施方案中,隐私机器学习实现装置可以包括:
判断模块61,可以用于在执行明文机器学习模型的计算逻辑时,确认所述明文机器学习模型中的动态优化器的执行时机是否到来;
执行模块62,可以用于当所述动态优化器的执行时机到来时,执行所述动态优化器,以将所述计算逻辑中的原生算子替换为密码算子,并执行所述密码算子;
其中,所述明文机器学习模型基于明文机器学习框架生成,所述动态优化器派生于所述明文机器学习框架的优化器基类,所述明文机器学习框架中注册有所述密码算子和所述动态优化器。
在本说明书的一些实施方案的隐私机器学习实现装置中,所述将所述计算逻辑中的原生算子替换为密码算子,包括:
将所述明文机器学习模型的原生静态图替换为密码静态图。
在本说明书的一些实施方案的隐私机器学习实现装置中,所述将所述明文机器学习模型的原生静态图替换为密码静态图,包括:
从所述明文机器学习模型的原生静态图中获取原生节点;
确认是否需要将该原生节点替换为对应的密码节点;
如果需要,则将该原生节点替换为对应的密码节点。
在本说明书的一些实施方案的隐私机器学习实现装置中,所述确认是否需要将该原生节点替换为对应的密码节点,包括:
确认该原生节点对应的数据流中是否包含模型私有数据。
在本说明书的一些实施方案的隐私机器学习实现装置中,所述将该原生节点替换为对应的密码节点,包括:
获取该原生节点的属性信息、边信息及对应的密码节点名称;所述边信息包括输入边和输出边;
根据该原生节点的属性信息、边信息及对应的密码节点名称,创建密码算子、新输入边和新输出边;
将该原生算子、所述输入边和所述输出边对应替换为该密码算子、该新输入边和该新输出边。
在本说明书的一些实施方案的隐私机器学习实现装置中,所述动态优化器的执行时机包括以下中的任意一种:
安置所述明文机器学习模型中的原生静态图之前;
安置所述明文机器学习模型中的原生静态图之后;
优化所述明文机器学习模型中的原生静态图之后;
分裂所述明文机器学习模型中的原生静态图之后。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本说明书时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
与上述的隐私机器学习实现方法对应,本说明书还提供有电子设备。参考图7所示,在本说明书的一些实施方案中,电子设备,包括存储器、处理器、以及存储在所述存储器上的计算机程序,所述计算机程序被所述处理器运行时可以执行上述的隐私机器学习实现方法。
虽然上文描述的过程流程包括以特定顺序出现的多个操作,但是,应当清楚了解,这些过程可以包括更多或更少的操作,这些操作可以顺序执行或并行执行(例如使用并行处理器或多线程环境)。
本申请是参照根据本说明书实施方案的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供 这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
本领域技术人员应明白,本说明书的实施方案可提供为方法、系统或计算机程序产品。因此,本说明书实施方案可采用完全硬件实施方案、完全软件实施方案或结合软件和硬件方面的实施方案的形式。而且,本说明书实施方案可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、 光学存储器等)上实施的计算机程序产品的形式。
本说明书实施方案可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书实施方案,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施方案均采用递进的方式描述,各个实施方案之间相同相似的部分互相参见即可,每个实施方案重点说明的都是与其他实施方案的不同之处。尤其,对于系统实施方案而言,由于其基本相似于方法实施方案,所以描述的比较简单,相关之处参见方法实施方案的部分说明即可。在本说明书的描述中,参考术语“一个实施方案”、“一些实施方案”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施方案或示例描述的具体特征、结构、材料或者特点包含于本说明书实施方案的至少一个实施方案或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施方案或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施方案或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施方案或示例以及不同实施方案或示例的特征进行结合和组合。
以上所述仅为本申请的实施方案而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。

Claims (14)

  1. 一种隐私机器学习实现方法,其特征在于,包括:
    在执行明文机器学习模型的计算逻辑时,确认所述明文机器学习模型中的动态优化器的执行时机是否到来;
    当所述动态优化器的执行时机到来时,执行所述动态优化器,以将所述计算逻辑中的原生算子替换为密码算子,并执行所述密码算子;
    其中,所述明文机器学习模型基于明文机器学习框架生成,所述动态优化器派生于所述明文机器学习框架的优化器基类,所述明文机器学习框架中注册有所述密码算子和所述动态优化器。
  2. 如权利要求1所述的隐私机器学习实现方法,其特征在于,所述将所述计算逻辑中的原生算子替换为密码算子,包括:
    将所述明文机器学习模型的原生静态图替换为密码静态图。
  3. 如权利要求2所述的隐私机器学习实现方法,其特征在于,所述将所述明文机器学习模型的原生静态图替换为密码静态图,包括:
    从所述明文机器学习模型的原生静态图中获取原生节点;
    确认是否需要将该原生节点替换为对应的密码节点;
    如果需要,则将该原生节点替换为对应的密码节点。
  4. 如权利要求3所述的隐私机器学习实现方法,其特征在于,所述确认是否需要将该原生节点替换为对应的密码节点,包括:
    确认该原生节点对应的数据流中是否包含模型私有数据。
  5. 如权利要求3所述的隐私机器学习实现方法,其特征在于,所述将该原生节点替换为对应的密码节点,包括:
    获取该原生节点的属性信息、边信息及对应的密码节点名称;
    根据该原生节点的属性信息、边信息及对应的密码节点名称,创建密码算子、新输入边和新输出边;
    将该原生节点及其输入边和输出边对应替换为该密码节点、该新输入边和该新输出边。
  6. 如权利要求2所述的隐私机器学习实现方法,其特征在于,所述动态优化器的执行时机包括以下中的任意一种:
    安置所述明文机器学习模型中的原生静态图之前;
    安置所述明文机器学习模型中的原生静态图之后;
    优化所述明文机器学习模型中的原生静态图之后;
    分裂所述明文机器学习模型中的原生静态图之后。
  7. 一种隐私机器学习实现装置,其特征在于,包括:
    判断模块,用于在执行明文机器学习模型的计算逻辑时,确认所述明文机器学习模型中的动态优化器的执行时机是否到来;
    执行模块,用于当所述动态优化器的执行时机到来时,执行所述动态优化器,以将所述计算逻辑中的原生算子替换为密码算子,并执行所述密码算子;
    其中,所述明文机器学习模型基于明文机器学习框架生成,所述动态优化器派生于所述明文机器学习框架的优化器基类,所述明文机器学习框架中注册有所述密码算子和所述动态优化器。
  8. 如权利要求7所述的隐私机器学习实现装置,其特征在于,所述将所述计算逻辑中的原生算子替换为密码算子,包括:
    将所述明文机器学习模型的原生静态图替换为密码静态图。
  9. 如权利要求8所述的隐私机器学习实现装置,其特征在于,所述将所述明文机器学习模型的原生静态图替换为密码静态图,包括:
    从所述明文机器学习模型的原生静态图中获取原生节点;
    确认是否需要将该原生节点替换为对应的密码节点;
    如果需要,则将该原生节点替换为对应的密码节点。
  10. 如权利要求9所述的隐私机器学习实现装置,其特征在于,所述确认是否需要将该原生节点替换为对应的密码节点,包括:
    确认该原生节点对应的数据流中是否包含模型私有数据。
  11. 如权利要求9所述的隐私机器学习实现装置,其特征在于,所述将该原生节点替换为对应的密码节点,包括:
    获取该原生节点的属性信息、边信息及对应的密码节点名称;所述边信息包括输入边和输出边;
    根据该原生节点的属性信息、边信息及对应的密码节点名称,创建密码算子、新输入边和新输出边;
    将该原生算子、所述输入边和所述输出边对应替换为该密码算子、该新输入边和该新输出边。
  12. 如权利要求8所述的隐私机器学习实现装置,其特征在于,所述动态优化器的执行时机包括以下中的任意一种:
    安置所述明文机器学习模型中的原生静态图之前;
    安置所述明文机器学习模型中的原生静态图之后;
    优化所述明文机器学习模型中的原生静态图之后;
    分裂所述明文机器学习模型中的原生静态图之后。
  13. 一种电子设备,包括存储器、处理器、以及存储在所述存储器上的计算机程序,其特征在于,所述计算机程序被所述处理器运行时执行权利要求1-6任意一项所述的方法。
  14. 一种计算机存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-6任意一项所述的方法。
PCT/CN2020/080390 2020-03-20 2020-03-20 隐私机器学习实现方法、装置、设备及存储介质 WO2021184345A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/080390 WO2021184345A1 (zh) 2020-03-20 2020-03-20 隐私机器学习实现方法、装置、设备及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/080390 WO2021184345A1 (zh) 2020-03-20 2020-03-20 隐私机器学习实现方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2021184345A1 true WO2021184345A1 (zh) 2021-09-23

Family

ID=77769966

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/080390 WO2021184345A1 (zh) 2020-03-20 2020-03-20 隐私机器学习实现方法、装置、设备及存储介质

Country Status (1)

Country Link
WO (1) WO2021184345A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109255234A (zh) * 2018-08-15 2019-01-22 腾讯科技(深圳)有限公司 机器学习模型的处理方法、装置、介质及电子设备
CN110414187A (zh) * 2019-07-03 2019-11-05 北京百度网讯科技有限公司 模型安全交付自动化的系统及其方法
CN110619220A (zh) * 2019-08-09 2019-12-27 北京小米移动软件有限公司 对神经网络模型加密的方法及装置、存储介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109255234A (zh) * 2018-08-15 2019-01-22 腾讯科技(深圳)有限公司 机器学习模型的处理方法、装置、介质及电子设备
CN110414187A (zh) * 2019-07-03 2019-11-05 北京百度网讯科技有限公司 模型安全交付自动化的系统及其方法
CN110619220A (zh) * 2019-08-09 2019-12-27 北京小米移动软件有限公司 对神经网络模型加密的方法及装置、存储介质

Similar Documents

Publication Publication Date Title
CN111428880A (zh) 隐私机器学习实现方法、装置、设备及存储介质
CN111415013B (zh) 隐私机器学习模型生成、训练方法、装置及电子设备
US9569288B2 (en) Application pattern discovery
US11176469B2 (en) Model training methods, apparatuses, and systems
US9563697B1 (en) Calculating differences between datasets having differing numbers of partitions
US10313430B2 (en) Distributed method and apparatus for processing streaming data
WO2021203260A1 (zh) 一种节点匹配方法、装置、设备及系统
US20230222356A1 (en) Federated learning
CN112200713A (zh) 一种联邦学习中的业务数据处理方法、装置以及设备
WO2021184346A1 (zh) 隐私机器学习模型生成、训练方法、装置及电子设备
CN110633959A (zh) 基于图结构的审批任务创建方法、装置、设备及介质
CN108924185A (zh) 接口生成方法及装置
WO2021184345A1 (zh) 隐私机器学习实现方法、装置、设备及存储介质
WO2020211075A1 (zh) 去中心化多方安全数据处理方法、装置及存储介质
Guo et al. A deadlock prevention approach for a class of timed Petri nets using elementary siphons
CN115118411B (zh) 链下多方可信计算方法、装置、设备及存储介质
CN106874341A (zh) 一种数据库同步方法
Kissmann et al. What’s in it for my BDD? On causal graphs and variable orders in planning
CN110401925A (zh) 一种通讯消息的生成方法及装置
US9727311B2 (en) Generating a service definition including a common service action
CN115567596A (zh) 云服务资源部署方法、装置、设备及存储介质
WO2016110204A1 (zh) 处理对象的处理、插件生成方法及装置
CN113204502A (zh) 异构加速计算优化方法、装置、设备及可读存储介质
CN111694870A (zh) 一种大数据模型执行引擎系统及实现方法
CN117056994B (zh) 一种大数据建模的数据处理系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20925130

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20925130

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 290323)

122 Ep: pct application non-entry in european phase

Ref document number: 20925130

Country of ref document: EP

Kind code of ref document: A1