Combining Bayesian Deep Learning and Homomorphic
Total Page:16
File Type:pdf, Size:1020Kb
Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence (IJCAI-19) BAYHENN: Combining Bayesian Deep Learning and Homomorphic Encryption for Secure DNN Inference Peichen Xie1;2∗ , Bingzhe Wu1;3∗ and Guangyu Sun1;2 1Center for Energy-efficient Computing and Applications, Peking University 2Advanced Institute of Information Technology, Peking University 3Ant Financial Services Group fxpc, wubingzhe, [email protected] Abstract are not protected, using DLaaS will cause potential privacy issues. A curious server may collect sensitive information Recently, deep learning as a service (DLaaS) has contained in the private data (i.e. client’s privacy). emerged as a promising way to facilitate the em- To address this privacy issue, researchers have employed ployment of deep neural networks (DNNs) for var- the homomorphic encryption to perform various DNN oper- ious purposes. However, using DLaaS also causes ators on encrypted client data [Phong et al., 2018; Ma et al., potential privacy leakage from both clients and 2019]. As a result, the cloud server only serves as a compu- cloud servers. This privacy issue has fueled the re- tation platform but cannot access the raw data from clients. search interests on the privacy-preserving inference However, there exist two major obstacles in applying these of DNN models in the cloud service. In this paper, approaches. First, some common non-linear activation func- we present a practical solution named BAYHENN tions, such as ReLU and Sigmoid, are not cryptographically for secure DNN inference. It can protect both the computable. Second, the inference processing efficiency is client’s privacy and server’s privacy at the same seriously degraded by thousands of times. time. The key strategy of our solution is to combine To tackle these problems, a recent work [Zhang et al., homomorphic encryption and Bayesian neural net- 2018] proposes using an interactive paradigm. A DNN in- works. Specifically, we use homomorphic encryp- ference is partitioned into linear and non-linear computa- tion to protect a client’s raw data and use Bayesian tion parts. Then, only the linear computations are per- neural networks to protect the DNN weights in a formed on the cloud server with encrypted data. The non- cloud server. To verify the effectiveness of our so- linear computations are performed by the client with raw lution, we conduct experiments on MNIST and a data. However, in such an interactive paradigm, the inter- real-life clinical dataset. Our solution achieves con- mediate features extracted by the linear computations are di- sistent latency decreases on both tasks. In partic- rectly exposed (sent back) to the client. Thus, a curious ular, our method can outperform the best existing client can leverage these features to reconstruct the weights method (GAZELLE) by about 5×, in terms of end- of the DNN model held by the cloud [Tramer` et al., 2016; to-end latency. Zhang et al., 2018]. This issue is called the leakage of server’s privacy. 1 Introduction In fact, a practical solution for secure DNN inference should protect both client’s privacy and server’s privacy. In In the past years, deep neural networks (DNNs) have achieved addition, it should support DNNs with all types of non-linear remarkable progress in various fields, such as computer vi- activation functions. Unfortunately, there still lacks an effec- sion [He et al., 2016; Ren et al., 2017], natural language pro- tive approach in literature. The limitations of recent works cessing [Vaswani et al., 2017; Devlin et al., 2018], and med- are discussed in Section 2.3. Thus, we propose a new method ical image analysis [Litjens et al., 2017; Havaei et al., 2017]. for secure DNN inference, called BAYHENN. Our key strat- Recently, deep learning as a service (DLaaS) has emerged as egy is to combine Bayesian deep learning and homomorphic a promising to further enable the widespread use of DNNs encryption. To the best of our knowledge, it is the first ap- in industry/daily-life. Google1, Amazon2, and IBM [Bhat- proach that can protect both client’s privacy and server’s pri- tacharjee et al., 2017] have all launched DLaaS platforms in vacy and support all types of non-linear activation functions their cloud services. Using DLaaS, a client sends its private at the same time. data to the cloud server. Then, the server is responsible for performing the DNN inference and sends the prediction re- BAYHENN follows an interactive paradigm so that all sults back to the client. Obviously, if the private client data types of activation functions are supported. On the one hand, it uses the homomorphic encryption to provide protection for ∗Equal contribution. the client’s privacy. On the other hand, it adds proper ran- 1https://cloud.google.com/inference/ domness into DNN weights to prevent the leakage of the 2https://docs.aws.amazon.com/machine-learning/index.html server’s privacy. This idea is motivated by the learning with 4831 Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence (IJCAI-19) error (LWE) problem, in which solving the noisy linear equa- Client’s Server’s Support all tions system has been proven to be NP-hard [Regev, 2009]. Privacy Privacy activation func. However, “adding proper randomness” is a new challenge. Directly injecting well-designed Gaussian Noise into weights CryptoNets Yes Yes — will cause a drastic performance degradation [Chaudhuri and GELU-Net Yes — Yes Monteleoni, 2008; Zhang et al., 2017]. Therefore, we pro- GAZELLE Yes Yes — pose to use a more intrinsic method, the Bayesian neural net- Ours Yes Yes Yes work, to model the weight uncertainty of DNNs. Armed with the weight uncertainty, we can protect the weight information Table 1: Feature comparison among different solutions. by sending obscured features to the client. In summary, the contributions of our paper are as follows: where '(i) denotes the activation function (e.g. ReLU). • We provide a novel insight that using the Bayesian neu- In summary, the classification model M can be reformu- ral network can prevent leakage of a server’s privacy un- lated into: der an interactive paradigm. M : t = f(x; f(W(i); b(i))gn ) (3) • Based on this insight, we build a practical solution for i=1 secure DNN inference. Our solution is more (about 5×) 2.2 Privacy Leakage in DLaaS efficient than the best existing method, and is capable of supporting all types of activation functions. In a common setting, there are two parties involved in a pro- cess of DLaaS. Specifically, at the beginning, a client sends • We validate the proposed solution on a real-life clinical its private data x into a cloud server, which holds the DNN dataset, which is less explored in previous studies. model M for inference. Then, the server can perform the DNN inference and send the prediction results back to the 2 Preliminary client. Considering that both the client and the server are In this part, we first introduce some basic notations in DNN semi-honest, privacy leakages may occur on both sides: inference. Then, the potential privacy leakages in DLaaS and • Client’s Privacy Leakage: From the perspective of a the goal of this paper are presented. At last, we summarize client, its input data x is directly exposed to the cloud the limitations of previous works on secure DNN inference. server in a non-private setting. Thus, the server may col- lect the sensitive information contained in x. 2.1 DNN Inference • Server’s Privacy Leakage: A cloud server also holds We start from the process of a DNN inference. For simplicity, the private data, i.e. the weight parameters and the DNN the following discussion is based on a fully connected neural structure of M. A curious client may attempt to obtain network. It can be easily switched to the context of a convo- these valuable model information. lutional neural network, as shown in our experiments. We take the image classification as an example in this part. In this paper, we focus on a secure DNN inference. Our goal It can be extended to other types of tasks as well (e.g. re- is to prevent the privacy leakage of the input data (client-side) gression). The image classification aims to assign a label and the model parameters (server-side). The protection of a t to the input image x. To this end, a classification model model structure is out of the scope of this paper, yet part of M : t = f (x; θ) is trained on some pre-collected data. In a the DNN model structure (such as the filter and stride size context of deep learning, the f is a highly non-linear function, in the convolution layers and the type of each layer) is also which is formed by alternately stacking several linear (e.g. protected in our solution4. fully connected layer) and non-linear (e.g. activation func- tion) operations3. 2.3 Limitation of Previous Work Formally, for a neural network, we denote W(i) and b(i) In this subsection, we discuss the limitations of previous as weights and biases corresponding to the i-th linear layer. works, which are most related to ours (listed in Table 1). We To calculate outputs (i.e. activations) of the i-th non-linear do not consider [Bourse et al., 2018; Sanyal et al., 2018], layer (denoted as a(i)), a linear transformation is firstly per- since they only work on binary neural networks and do not formed on the inputs from previous layers following: outperform the state-of-the-art. CryptoNets [Gilad-Bachrach et al., 2016] is the first sys- (i) (i) (i−1) (i) z = W a + b (1) tem for homomorphic encryption based neural network in- ference.