In this work, we present a novel matrix-encoding method that is particularly convenient for neural networks to make predictions in a privacy-preserving manner using homomorphic encryption. Based on this encoding method, we implement a convolutional neural network for handwritten image classification over encryption. For two matrices $A$ and $B$ to perform homomorphic multiplication, the main idea behind it, in a simple version, is to encrypt matrix $A$ and the transpose of matrix $B$ into two ciphertexts respectively. With additional operations, the homomorphic matrix multiplication can be calculated over encrypted matrices efficiently. For the convolution operation, we in advance span each convolution kernel to a matrix space of the same size as the input image so as to generate several ciphertexts, each of which is later used together with the ciphertext encrypting input images for calculating some of the final convolution results. We accumulate all these intermediate results and thus complete the convolution operation. In a public cloud with 40 vCPUs, our convolutional neural network implementation on the MNIST testing dataset takes $\sim$ 287 seconds to compute ten likelihoods of 32 encrypted images of size $28 \times 28$ simultaneously. The data owner only needs to upload one ciphertext ($\sim 19.8$ MB) encrypting these 32 images to the public cloud.
翻译:本文提出了一种新颖的矩阵编码方法,特别适用于神经网络基于同态加密进行隐私保护的预测任务。基于该编码方法,我们实现了针对加密手写图像分类的卷积神经网络。为实现两个矩阵$A$和$B$的同态乘法,其核心思想(简化版本)是将矩阵$A$与矩阵$B$的转置分别加密为两个密文。通过附加运算,即可在加密矩阵上高效计算同态矩阵乘法。对于卷积运算,我们预先将每个卷积核展开至与输入图像尺寸相同的矩阵空间,从而生成若干密文;每个密文后续将与加密输入图像的密文结合,用于计算部分最终卷积结果。通过累加所有这些中间结果,即可完成卷积运算。在配备40个虚拟CPU的公共云环境中,我们的卷积神经网络在MNIST测试集上对32张尺寸为$28 \times 28$的加密图像同时计算十类似然值耗时约287秒。数据所有者仅需向公共云上传一个加密这32张图像的密文(约19.8 MB)。