The present techniques relate to training machine learning models. More specifically, the techniques relate to training homomorphic encryption (HE) friendly neural networks.
According to an embodiment described herein, a system can include processor to receive a machine learning network and a selected homomorphic encryption (HE) processing framework. The processor can also further generate a list of HE packings for the machine learning network based on the selected HE processing framework. The processor can also extend the machine learning network to include additional neurons based on the list of HE packings. The processor can then train the extended machine learning network.
According to another embodiment described herein, a method can include receiving, via a processor, a machine learning network and a selected homomorphic encryption (HE) packing framework. The method can further include generating, via the processor, list of HE packings for the machine learning network based on the selected HE packing framework. The method can also further include extending, via the processor, the machine learning network to include additional neurons based on the list of HE packings. The method can also include training, via the processor, the extended machine learning network.
According to another embodiment described herein, a computer program product for training machine learning networks can include computer-readable storage medium having program code embodied therewith. The program code executable by a processor to cause the processor to receive a machine learning network and a selected homomorphic encryption (HE) packing framework. The program code can also cause the processor to generate a list of HE packings for the machine learning network based on the selected HE packing framework. The program code can also cause the processor to extend the machine learning network to include additional neurons based on the list of HE packings. The program code can also cause the processor to train the extended machine learning network.
Homomorphic encryption (HE) allows performing operations on encrypted data. Such a cryptosystem may be used, for example, in a client-server scenario where the client desires the server to perform a function f(x). A client device may provide x and f can be obtained from a different source. HE enables the server to homomorphically compute f(x) without learning about x. One practical application of HE is for encrypted inference on neural networks running on the cloud. However, training and running neural networks, such as deep neural networks (DNNs), over HE may require HE-friendly architectures that may have lower accuracy compared to non HE-friendly architectures. For example, HE-friendly architectures include architectures in which particular functions such as sine and cosine have been adapted using any suitable methods to HE-friendly functions such as addition, multiplication, or some combination of these functions. Specifically, when training a machine learning model in HE environments, as in the cases above, these requirements may force the model owner to only use polynomial functions during training and inference. Therefore, the NN architecture may include polynomial activations instead of ReLU activations and MAX-Pooling instead of AVG-Pooling. Such conversion and associated approximations may result in lower accuracy models. In addition, HE processing is intensive and generally slow. For example, fully homomorphic encrypted (FHE) operations may be from three to five orders of magnitude more expensive with respect to processing compared to their plaintext counterparts.
According to embodiments of the present disclosure, a system includes a processor to receive a machine learning network and a selected homomorphic encryption (HE) packing framework. The processor can generate list of HE packings for the machine learning network based on the selected HE packing framework. The processor can extend the machine learning network to include additional neurons based on the list of HE packings. The processor can also train the extended machine learning network. Thus, embodiments of the present disclosure enable improved accuracy of HE-friendly DNNs without degrading their latency over the original HE inference. Thus, the performance of HE-friendly architectures may be improved without further reducing their processing speed. In this manner, the performance of such HE-friendly architectures may be increased to the accuracy of similar models trained on non-HE friendly architectures, for example using plain text. Moreover, the techniques described herein describe a fully automated process.
With reference now to
In various examples, the HE packing optimizer 104 optimizes lists of HE packings based on the received selected model architecture 110 and optimization parameters 112. For example, each HE packing may be a ciphertext representing an encrypted group of underlying integers. As one example, the Tile Tensor packing method may be used to generate HE packings. In particular, the Tile Tensor packing method works with multi-dimensional arrays in a system that imposes tiles, which may be fixed-size vectors. In various examples, HE operations may be performed using a single instruction multiple data (SIMD) paradigm. For example, in SIMD, a message may be split into an array of values called slots. A single HE operation may then be applied to all these slots at once. However, packing a neural network in HE ciphertexts using a method such as SIMD packing may leave some of the ciphertexts slots empty. Occupying these slots with extra neuron weights may not affect the latency of the training or inference procedures. For example, given a model layer with 120 neurons, and a packing of 128 slots, the model layer may be extended to have 128 neurons with 8 extra dummy neurons having weights of zero. The addition of extra or dummy neurons to a NN may thus not harm the model accuracy because the weights and biases can be all set as zeros. Since the packing may also have had 128 original slots, the size of the packing and thus the latency of training or inference procedures may not be affected.
As one example, the selected model architecture 110 may have been programmed using the Pytorch deep learning framework, version 0.1.12 first released 2017, with a Keras neural network API, first released in March 2015, to specify a DNN architecture. In some examples, the selected model architecture 110 may have been programed using any other suitable libraries for programming neural networks, such as the TensorFlow machine learning system, first released November 2016. The computing device 102 may receive the selected model architecture 110 from a Pytorch/Keras API and send the selected architecture 110 to an HE packing optimizer 104. In some examples, the HE packing optimizer 104 may include a software development kit (SDK) that supports or automates the packing process, such as HELayers, version 1 released in November 2020. Alternatively, any suitable packing framework may be used, such as CHET, first released in October 2018. For example, the HELayers packing framework uses a special packing technique called tile tensors. A tile sensor is a data structure that packs tensors in fixed size chunks, as may be required for FHE, and allows these chunks to be manipulated similar to tensors. Tensors, as used herein, refer to multi-dimensional arrays. The HE packing optimizer 104 may output a set of HE packings. In various examples, every one of the elements in each of the HE packings may uniquely define how to pack plaintext data into possibly more than one array before encrypting the one or more arrays into ciphertexts. For example, in the case of HELayers, the HE packings may be more specifically tile tensor shapes. In various examples, a set of HE packings may be output for each layer of the DNN model. The network extender 106 of the computing device 102 may then identify incomplete tiles in the set of tile tensor shapes and extend the Pytorch/Keras DNN model accordingly. For example, each of the layers in the Pytorch/Keras DNN model may be extended based on the number of incomplete tiles in the set of tile tensor shapes. The Pytorch/Keras DNN model may then be retrained with the extended layers. Finally, the retrained model may be run in the HELayers SDK. For example, the retrained model may be repacked according to the chosen packing and encrypted and provided to a customer for use at inference. In various examples, the repacked model may be uploaded to an untrusted environment. For example, the untrusted environment can be a cloud, a different location, or just another untrusted process in a shared processing unit. An encrypted inference evaluation may then be executed using the encrypted model.
It is to be understood that the block diagram of
The example LeNet network 200 is a convolutional neural network (CNN) that includes a first convolutional layer 202, a first average pooling layer 204, a second convolutional layer 206, and a second average pooling layer 208. The LeNet network 200 includes a flattening layer 210, a fully connected (FC) layer 211 including weights 212 and bias 214, and output layer 216. In addition, an initial tile-tensor based HE packing 218 with 32 slots including eight slots with values of zero is shown being converted into a full tile-tensor based HE packing 220 with the eight zeros of the initial tile-tensor based HE packing 218 converted into usable values. The layer size of the neural network may thus be adapted to 128 based on the HE architecture of multiples of 32. Additional layers 222 of the LeNet network left out for simplicity are represented using a block including an ellipsis. For example, the additional layers 222 may include fully connected layers, output layers, and activation layers, such as ReLU or polynomial activation layers.
At the flattening layer 210, a flatten shape operation is executed on the layers 202-208 to generate an array of elements. In particular, the array shown in flattening layer 210 is one embodiment of a notation that describes how elements are packed in a ciphertext. The array includes five elements representing the dimensions of the tile tensor that packs the data in the flatten layer 210. The denominator of each element represents the number of slots available for a particular dimension in each tile. The numerators represent the occupied slots for this dimension accommodated over several tiles (ciphertexts). The notation also includes symbols such as “*” indicating broadcasting elements over a given dimension, and “?” that indicates that a given dimension includes unknown or less important values that may be safely ignored.
The fully connected layer 211 includes a set of weights 212 and bias 214. In various examples, the set of weights 212 to be applied to the neural network may be modified. In particular, the array of weights 212 similarly includes five elements representing the dimensions of the neural network, with the denominators of the elements representing the slots available in each of the tile elements in that dimension, and the number of elements is represented in the numerators. In the example of
In various examples, the bias array 214 may also be similarly modified. For example, the number of total occupied slots may be similarly updated from 120 to 128.
It is to be understood that the block diagram of
At block 502, a processor receives a machine learning network and a selected homomorphic encryption (HE) packing framework. For example, the machine learning network may be an HE-friendly model architecture. In various examples, the machine learning network may or may not have been trained by a model owner with or without use of HE in the training process. In some examples, the processor may also receive any number of optimization parameters.
At block 504, the processor generates a list of HE packings for the machine learning network based on the selected HE packing framework. For example, the processor may feed the machine learning network into an HE processing program and receive a list of different HE packings. For example, the list of different HE packings may be received in any suitable format. In various examples, a list of different HE packings may be generated for each of any number of optimization parameters received. For example, the process may generate a number of lists of HE packings corresponding to a number of received optimization parameters. In some examples, a list of HE packings may be generated for each of the layers in the machine learning network.
At block 506, the processor extends the machine learning network to include additional neurons based on the list of HE packings. For example, the processor can analyze each of the lists of HE packings and detect model layers that can be extended with additional neurons. For example, the HE packing for a particular model layer may have empty slots available for the given packing size. In various example, the processor can add neurons to any number of layers of the machine learning network.
At block 508, the processor trains the extended machine learning network. For example, the extended machine learning network may be retrained in order to improve the accuracy of the extended machine learning network. In various examples, the extended machine learning network may be trained using HE encrypted training data or unencrypted plaintext training data.
At block 510, the processor packs the trained extended machine learning network into HE ciphertexts. For example, the processor may pack the extended machine learning network using the HE packing generated at block 504 that corresponds to the received optimization parameter.
At block 512, the processor runs the packed machine learning network via an HE framework. For example, the packed machine learning network may be used to process received data at inference. In various examples, the received data may be HE data.
The process flow diagram of
It is to be understood that although this disclosure includes a detailed description on cloud computing, implementation of the teachings recited herein are not limited to a cloud computing environment. Rather, embodiments of the present invention are capable of being implemented in conjunction with any other type of computing environment now known or later developed.
Cloud computing is a model of service delivery for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, network bandwidth, servers, processing, memory, storage, applications, virtual machines, and services) that can be rapidly provisioned and released with minimal management effort or interaction with a provider of the service. This cloud model may include at least five characteristics, at least three service models, and at least four deployment models.
Characteristics are as follows:
Service Models are as follows:
Deployment Models are as follows:
A cloud computing environment is service oriented with a focus on statelessness, low coupling, modularity, and semantic interoperability. At the heart of cloud computing is an infrastructure that includes a network of interconnected nodes.
The computing device 600 may include a processor 602 that is to execute stored instructions, a memory device 604 to provide temporary memory space for operations of said instructions during operation. The processor can be a single-core processor, multi-core processor, computing cluster, or any number of other configurations. The memory 604 can include random access memory (RAM), read only memory, flash memory, or any other suitable memory systems.
The processor 602 may be connected through a system interconnect 606 (e.g., PCI®, PCI-Express®, etc.) to an input/output (I/O) device interface 608 adapted to connect the computing device 600 to one or more I/O devices 610. The I/O devices 610 may include, for example, a keyboard and a pointing device, wherein the pointing device may include a touchpad or a touchscreen, among others. The I/O devices 610 may be built-in components of the computing device 600, or may be devices that are externally connected to the computing device 600.
The processor 602 may also be linked through the system interconnect 606 to a display interface 612 adapted to connect the computing device 600 to a display device 614. The display device 614 may include a display screen that is a built-in component of the computing device 600. The display device 614 may also include a computer monitor, television, or projector, among others, that is externally connected to the computing device 600. In addition, a network interface controller (NIC) 616 may be adapted to connect the computing device 600 through the system interconnect 606 to the network 618. In some embodiments, the NIC 616 can transmit data using any suitable interface or protocol, such as the internet small computer system interface, among others. The network 618 may be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, among others. An external computing device 620 may connect to the computing device 600 through the network 618. In some examples, external computing device 620 may be an external webserver 620. In some examples, external computing device 620 may be a cloud computing node.
The processor 602 may also be linked through the system interconnect 606 to a storage device 622 that can include a hard drive, an optical drive, a USB flash drive, an array of drives, or any combinations thereof. In some examples, the storage device may include a receiver module 624, a homomorphically encryption (HE) packing optimizer module 626, a network extender module 628, and a network trainer module 630. The receiver module 624 can receive a machine learning network and a selected homomorphic encryption (HE) processing framework. For example, the received machine learning network may be pretrained. For example, the machine learning network may have been pretrained using HE training data. In some example, the received machine learning network may be an HE-friendly deep neural network (DNN). In various examples, the receiver module 624 can also receive an optimization parameter. The HE packing optimizer module 626 can generate a list of HE packings for the machine learning network based on the selected HE processing framework. For example, the HE packing optimizer module 626 can generate the list of HE packings based on the optimization parameter. In various examples, the list of HE packings may be in one of various different formats. In some examples, the HE packing optimizer module 626 can generate a number of lists of HE packings corresponding to a number of received optimization parameters. The network extender module 628 can extend the machine learning network to include additional neurons based on the list of HE packings. In some examples, the network extender module 628 can extend the machine learning network by adding neurons to a layer of the machine learning network. For example, the added neurons may be initially set to have weights of zero. The module 624 may then. The network trainer module 630 can train the extended machine learning network. The module 628 can. In various examples, the HE packing optimizer module 626 can then pack the trained extended machine learning network into HE ciphertexts. In some examples, the packed machine learning network may then be run via the HE processing framework.
It is to be understood that the block diagram of
Referring now to
Referring now to
Hardware and software layer 800 includes hardware and software components. Examples of hardware components include: mainframes 801; RISC (Reduced Instruction Set Computer) architecture based servers 802; servers 803; blade servers 804; storage devices 805; and networks and networking components 806. In some embodiments, software components include network application server software 807 and database software 808.
Virtualization layer 810 provides an abstraction layer from which the following examples of virtual entities may be provided: virtual servers 811; virtual storage 812; virtual networks 813, including virtual private networks; virtual applications and operating systems 814; and virtual clients 815.
In one example, management layer 820 may provide the functions described below. Resource provisioning 821 provides dynamic procurement of computing resources and other resources that are utilized to perform tasks within the cloud computing environment. Metering and Pricing 822 provide cost tracking as resources are utilized within the cloud computing environment, and billing or invoicing for consumption of these resources. In one example, these resources may include application software licenses. Security provides identity verification for cloud consumers and tasks, as well as protection for data and other resources. User portal 823 provides access to the cloud computing environment for consumers and system administrators. Service level management 824 provides cloud computing resource allocation and management such that required service levels are met. Service Level Agreement (SLA) planning and fulfillment 825 provide pre-arrangement for, and procurement of, cloud computing resources for which a future requirement is anticipated in accordance with an SLA.
Workloads layer 830 provides examples of functionality for which the cloud computing environment may be utilized. Examples of workloads and functions which may be provided from this layer include: mapping and navigation 831; software development and lifecycle management 832; virtual classroom education delivery 833; data analytics processing 834; transaction processing 835; and HE-friendly machine learning model training 836.
The present invention may be a system, a method and/or a computer program product at any possible technical detail level of integration. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the techniques. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
Referring now to
The various software components discussed herein may be stored on the tangible, non-transitory, computer-readable medium 900, as indicated in
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions. It is to be understood that any number of additional software components not shown in
The descriptions of the various embodiments of the present techniques have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.