STRUCTURAL OBFUSCATION FOR PROTECTING DEEP LEARNING MODELS ON EDGE DEVICES
20230214658 · 2023-07-06
Inventors
Cpc classification
G06N3/082
PHYSICS
International classification
Abstract
A method for obfuscating deep learning (DL) models includes the step of training a DL model to obtain weights of operation (OP) layers in the trained DL model. The DL model includes an interface to a public application programming interface (API) that provides access to a compiler of an artificial intelligence (AI) processor. The method further includes the steps of obfuscating the DL model by changing a structure of the OP layers to produce an obfuscated DL model, and publishing the obfuscated DL model for access by devices. The obfuscated DL model is executable by the AI processor after compilation by the compiler on an edge device.
Claims
1. A method for obfuscating deep learning (DL) models, comprising: training a DL model to obtain weights of operation (OP) layers in the trained DL model, the DL model including an interface to a public application programming interface (API) that provides access to a compiler of an artificial intelligence (AI) processor; obfuscating the DL model by changing a structure of the OP layers to produce an obfuscated DL model; and publishing the obfuscated DL model for access by devices, wherein the obfuscated DL model is executable by the AI processor after compilation by the compiler on an edge device.
2. The method of claim 1, wherein obfuscating the DL model further comprises: re-ordering an execution sequence of the OP layers.
3. The method of claim 1, wherein obfuscating the DL model further comprises: adding redundant OP layers to the DL model.
4. The method of claim 1, wherein obfuscating the DL model further comprises: adding redundant weights to the OP layers in the DL model.
5. The method of claim 1, wherein obfuscating the DL model further comprises: changing connections among the OP layers in the DL model.
6. The method of claim 1, wherein obfuscating the DL model further comprises: changing one or more operations in the OP layers in the DL model.
7. The method of claim 1, wherein obfuscating the DL model further comprises: reshaping dimensions of the OP layers in the DL model.
8. The method of claim 1, wherein obfuscating the DL model further comprises: changing the structure of the DL model without re-training the DL model.
9. The method of claim 1, wherein the DL model and the obfuscated DL model are in a same model language.
10. The method of claim 1, wherein the DL model and the obfuscated DL model produce inference results with substantially the same accuracy.
11. A system operative to obfuscate deep learning (DL) models, comprising: processing hardware; and memory to store an obfuscator and a DL model that includes a plurality of operation (OP) layers, wherein the processing hardware is operative to: train the DL model to obtain weights of the OP layers, the DL model including an interface to a public application programming interface (API) that provides access to a compiler of an artificial intelligence (AI) processor; obfuscate the DL model using the obfuscator by changing a structure of the OP layers to produce an obfuscated DL model; and publish the obfuscated DL model for access by devices, wherein the obfuscated DL model is executable by the AI processor after compilation by the compiler on an edge device.
12. The system of claim 11, wherein the processing hardware is further operative to: obfuscate the DL model by re-ordering an execution sequence of the OP layers.
13. The system of claim 11, wherein the processing hardware is further operative to: obfuscate the DL model by adding redundant OP layers to the DL model.
14. The system of claim 11, wherein the processing hardware is further operative to: obfuscate the DL model by adding redundant weights to the OP layers in the DL model.
15. The system of claim 11, wherein the processing hardware is further operative to: obfuscate the DL model by changing connections among the OP layers in the DL model.
16. The system of claim 11, wherein the processing hardware is further operative to: obfuscate the DL model by changing one or more operations in the OP layers in the DL model.
17. The system of claim 11, wherein the processing hardware is further operative to: obfuscate the DL model by reshaping dimensions of the OP layers in the DL model.
18. The system of claim 11, wherein the processing hardware is further operative to: change the structure of the DL model without re-training the DL model.
19. The system of claim 11, wherein the DL model and the obfuscated DL model are in a same model language.
20. The system of claim 11, wherein the DL model and the obfuscated DL model produce inference results with substantially the same accuracy.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that different references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one. Further, when a particular feature, structure, or characteristic is described in connection with an embodiment, it is submitted that it is within the knowledge of one skilled in the art to effect such feature, structure, or characteristic in connection with other embodiments whether or not explicitly described.
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
DETAILED DESCRIPTION
[0018] In the following description, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In other instances, well-known circuits, structures, and techniques have not been shown in detail in order not to obscure the understanding of this description. It will be appreciated, however, by one skilled in the art, that the invention may be practiced without such specific details. Those of ordinary skill in the art, with the included descriptions, will be able to implement appropriate functionality without undue experimentation.
[0019] Embodiments of the invention protect deep learning (DL) models executed on edge devices by obfuscation. A manufacturer of an AI accelerator may provide an obfuscator to developers of DL models that run on the AI accelerator of an edge device. The obfuscator can obfuscate a DL model to hide and protect proprietary information in the DL model. The obfuscation makes it more difficult to understand, modify, and reverse-engineer the DL model. The obfuscated DL model includes an interface to a public application programming interface (API), also known as an open API, which is based on an open standard and available for use by the public. An edge device may provide a compiler for the AI accelerator, which can be accessed by the obfuscated DL model through the public API. The compiler compiles the obfuscated DL model into a compiled DL model to run on the AI accelerator. In one embodiment, the compiler can optimize the obfuscated DL model, as the compiler and the obfuscator may both be provided by the manufacturer of the AI accelerator.
[0020] The term “DL model” as used herein refers to a neural network (NN) model of multiple operation (OP) layers. The terms “DL model” and “NN model” may be used interchangeably. Furthermore, the terms “AI accelerator” and “AI processor” may be used interchangeably. Non-limiting of a public API include TensorFlow™ Lite, Android™ Neural Network API, Web Neural Network API, etc.
[0021] The obfuscated DL model and the original DL model (i.e., the DL model before obfuscation) may produce the same or substantially the same inference results. In some embodiments, the inference results from these two DL models can be not exactly the same, as long as the accuracy of the obfuscated DL model is within a predetermined tolerance (i.e., both models have substantially the same accuracy). Thus, aggressive obfuscations may be performed on a DL model, such as execution sequence reordering for floating point operations. A number of obfuscation examples will be described below.
[0022]
[0023] The obfuscator 120 may be implemented in hardware, in software executed on the hardware, or a combination of hardware and software. The obfuscated DL model 115 may be downloaded to a device 170; e.g., an edge device, to be compiled and executed.
[0024] In one embodiment, system 100 may publish the obfuscated DL model 115 to make it accessible over a network 180 such as the Internet. For example, system 100 may publish a software application (e.g., an app) containing the code of the obfuscated DL model 115. A user of device 170 may download the app from an online marketplace of apps. On device 170, the obfuscated DL model 115 runs on top of a public API 130, which provides an interface to a compiler 140. The compiler 140 compiles the obfuscated DL model 115 into a compiled DL model 145 executable by an AI accelerator 150. At runtime, the AI accelerator 150 executes the compiled DL model 145 to generate an inference output 155. In one embodiment, the compiler 140 may optimize the obfuscated DL model 115 during compile time. In another embodiment, the optimization of the obfuscated DL model may take place at a different time, such as runtime.
[0025] In one embodiment, the compiler 140 may generate the compiled DL model 145 every time the DL model is executed. In an alternative embodiment, the compiler 140 may compile the obfuscated DL model 115 once and store the compiled DL model 145 in a compilation cache 160 (as shown by the dotted block). Thus, the compiler 140 does not need to re-compile the same obfuscated DL model 115 every time it is executed. The compiled DL model 145 in the compilation cache 160 may be in a proprietary format or machine instructions executable by the AI accelerator 150.
[0026] In one embodiment, both the obfuscator 120 and the compiler 140 may be provided by the manufacturer of the AI accelerator 150. Thus, proprietary information regarding the obfuscation may be made available to programmers of the compiler 140, such that the compiler 140 can more effectively optimize the obfuscated DL model 115 during the compilation process.
[0027] The optimization may restore at least a portion of the obfuscated structure and/or weights of the DL model 110.
[0028] In one embodiment, the obfuscated DL model 115 may be compiled and executed without optimization. Even without the optimization, the obfuscated DL model 115 and the DL model 110 after compilation when executed by the AI accelerator 150 may generate the same or substantially the same inference results with substantially the same accuracy.
[0029]
[0030] The obfuscated DL model 201 includes three reshape layers (241, 242, and 243) after Conv2D 210. As shown in
[0031]
[0032]
[0033] In this example, the DL model 400 receives four input operands A1, A2, A3, and A4; e.g., four floating-point numbers or another data format. Each input operand may be multi-dimensional; e.g., a 384×384 matrix. A pack layer 410 packs the four input operands into a four-element array (A1, A2, A3, A4), which is fed into an OP layers sequence 420 to produce an output N.
[0034] In the obfuscated DL model 401, each input operand is individually operated by an OP layers sequence 430 and the results from all four OP layers sequences 430 are concatenated together to produce the output N. Thus, the pack operation in the DL model 400 is changed to the concatenate operation at a different location in the DL model 401. As a result, the connection among the OP layers is changed by the obfuscation. With respect to the OP layers sequences 420 and 430, they may have the same operations but different dimensions. An example of the DL model 400 is shown in
[0035]
[0036] The four OP layers sequences 430 may be interconnected with each other; e.g., they may share one or more operands of a multiply operation, an add operation, etc. In one embodiment, some or all of the OP layers sequences 430 may be further obfuscated in the same or different ways. As a result, the resulting four OP layers sequences may be different from one another.
[0037] As shown in the above examples, the obfuscator 120 (
[0038]
[0039] Method 600 begins at step 610 when a system trains a DL model to obtain weights of the OP layers in the DL model. The DL model includes an interface to a public API that provides access to a compiler of an AI processor. The system at step 620 obfuscates the DL model by changing the structure of the OP layers in the trained DL model to produce an obfuscated DL model. The system at step 630 publishes (e.g., makes it available for online access) the obfuscated DL model for access by devices. The obfuscated DL model is executable by the AI processor after compilation by the compiler on an edge device.
[0040] In one embodiment, the system may obfuscate the DL model by one or more of the following: re-ordering an execution sequence of the OP layers, adding redundant OP layers to the DL model, adding redundant weights to the OP layers in the DL model, changing connections among the OP layers in the DL model, changing one or more operations in the OP layers in the DL model, and/or reshaping dimensions of the OP layers in the DL model. The system may change the structure of the DL model without re-training the DL model. In one embodiment, the DL model and the obfuscated DL model are in the same model language. In one embodiment, the DL model and the obfuscated DL model produce inference results with substantially the same accuracy.
[0041]
[0042] Method 700 begins at step 710 when a device receives an obfuscated DL model that uses a public API to access a compiler of an AI processor. The device at step 720 compiles the obfuscated DL model to output a compiled DL model. The device at step 730 executes the compiled DL model on the AI processor. In one embodiment, the compiler optimizes the obfuscated DL model by restoring at least a portion of a structure and/or weights of the original DL model. In another embodiment, the optimization of the compiled DL model may be performed at runtime.
[0043]
[0044] System 800 includes processing hardware 810, a memory 820, and a network interface 830. Device 870 includes processing hardware 840, a memory 850, and a network interface 860. In one embodiment, processing hardware 810 and/or 840 may include one or more processors such as: a central processing unit (CPU), a GPU, a digital processing unit (DSP), an AI processor, a multimedia processor, other general-purpose and/or special-purpose processing circuitry. In one embodiment, processing hardware 840 may include an AI processor 842, which is an example of the AI accelerator 150 in
[0045] In one embodiment, memory 820 and/or 850 may include memory devices such as dynamic random access memory (DRAM), SRAM, flash memory, other non-transitory machine-readable storage media; e.g., volatile or non-volatile memory devices. Memory 820 and/or 850 may further include storage devices, for example, any type of solid-state or magnetic storage device. In some embodiments, memory 820 and/or 850 may store instructions which, when executed by the respective processing hardware, cause the respective processing hardware to perform the aforementioned method 600 (
[0046] In some embodiments, system 800 and device 870 may also include network interfaces 830 and 860, respectively to connect to a wired and/or wireless network (e.g., the Internet) for transmitting and/or receiving an obfuscated DL model. It is understood the embodiment of
[0047] The operations of the flow diagrams of
[0048] Various functional components or blocks have been described herein. As will be appreciated by persons skilled in the art, the functional blocks will preferably be implemented through circuits (either dedicated circuits or general-purpose circuits, which operate under the control of one or more processors and coded instructions), which will typically comprise transistors that are configured in such a way as to control the operation of the circuity in accordance with the functions and operations described herein.
[0049] While the invention has been described in terms of several embodiments, those skilled in the art will recognize that the invention is not limited to the embodiments described, and can be practiced with modification and alteration within the spirit and scope of the appended claims. The description is thus to be regarded as illustrative instead of limiting.