Paper 2018/1041

Secure Outsourced Matrix Computation and Application to Neural Networks

Xiaoqian Jiang, Miran Kim, Kristin Lauter, and Yongsoo Song


Homomorphic Encryption (HE) is a powerful cryptographic primitive to address privacy and security issues in outsourcing computation on sensitive data to an untrusted computation environment. Comparing to secure Multi-Party Computation (MPC), HE has advantages in supporting non-interactive operations and saving on communication costs. However, it has not come up with an optimal solution for modern learning frameworks, partially due to a lack of efficient matrix computation mechanisms. In this work, we present a practical solution to encrypt a matrix homomorphically and perform arithmetic operations on encrypted matrices. Our solution includes a novel matrix encoding method and an efficient evaluation strategy for basic matrix operations such as addition, multiplication, and transposition. We also explain how to encrypt more than one matrix in a single ciphertext, yielding better amortized performance. Our solution is generic in the sense that it can be applied to most of the existing HE schemes. It also achieves reasonable performance for practical use; for example, our implementation takes 0.6 seconds to multiply two encrypted square matrices of order 64 and 0.09 seconds to transpose a square matrix of order 64. Our secure matrix computation mechanism has a wide applicability to our new framework E2DM, which stands for encrypted data and encrypted model. To the best of our knowledge, this is the first work that supports secure evaluation of the prediction phase based on both encrypted data and encrypted model, whereas previous work only supported applying a plain model to encrypted data. As a benchmark, we report an experimental result to classify handwritten images using convolutional neural networks (CNN). Our implementation on the MNIST dataset takes 1.69 seconds to compute ten likelihoods of 64 input images simultaneously, yielding an amortized rate of 26 milliseconds per image.

Note: An early version of this work was published in CCS 2018. In this version, we present better experimental results in Sections 5 and 6 based on our more recent implementation.

Available format(s)
Publication info
Published elsewhere. MINOR revision.ACM SIGSAC Conference on Computer and Communications Security
Homomorphic encryptionmatrix computationmachine learningneural networks
Contact author(s)
miran kim @ uth tmc edu
2019-09-04: revised
2018-11-02: received
See all versions
Short URL
Creative Commons Attribution


      author = {Xiaoqian Jiang and Miran Kim and Kristin Lauter and Yongsoo Song},
      title = {Secure Outsourced Matrix Computation and Application to Neural Networks},
      howpublished = {Cryptology ePrint Archive, Paper 2018/1041},
      year = {2018},
      doi = {10.1145/3243734.3243837},
      note = {\url{}},
      url = {}
Note: In order to protect the privacy of readers, does not use cookies or embedded third party content.