Pacifo: An Efficient Fully Homomorphic Encryption-based Lightweight ResNet for Trustworthy Machine Learning as a Service
Authors: Yang Li, Gang He, Ruichen Zhang, Guangyuan Liu, Yinqiu Liu
Organizations: School of Communication and Information Engineering, Shanghai University, Shanghai, China · College of Computing and Data Science, Nanyang Technological University, Singapore
Machine Learning as a Service (MLaaS) has become a popular paradigm for deploying AI applications. However, it raises significant privacy concerns that the raw client data needs to be uploaded to the server for inference services. Private inference using Fully Homomorphic Encryption (FHE) offers a solution by allowing computations directly on encrypted data, with only the final results decrypted on a client side. However, current practical implementations still suffer from large computational overhead and high latency due to the cost of FHE operations. In this paper, we propose Pacifo, a framework that adapts customized fine-tuning strategies to efficiently evaluate the ResNet20 model in the context of FHE. Specifically, Pacifo introduces a public-private layer partitioning scheme and an efficient ReLU approximation, significantly reducing the number of private layers and costly FHE operations during inference. It also offers flexible security configurations to accommodate varying client privacy requirements. Compared to state-of-the-art FHE implementations of ResNet20, Pacifo achieves a speedup of 3.7−21.7× in runtime while effectively preserving 95%−99% of the original plaintext model accuracy across downstream tasks. Pacifo is open-sourced at https://github.com/BryceYangLi/Pacifo.
Figures & tables
Fig. 1 : MLaaS without privacy protection
TABLE I : Comparison of privacy-preserving schemes for private neural network inference.
Fig. 2 : Performance comparison between existing HE-based methods and ours on ResNet20 using the CIFAR-10 dataset.
Fig. 3 : The architecture of a ResNet20 model.
Fig. 4 : A toy example of our utilized vector encoding method for 2D convolutional computation with an input feature map I of size 3×3 and a kernel K of size k=2 . Specifically, the input I needs to be packed and encrypted before computation.
Fig. 5 : Placement of bootstrappings in a block of ResNet20.
Fig. 6 : Leverage layer freezing techniques on an open-source pretrained ResNet20 model.
Security
Personal computer
Supercomputer
Quantum computer
80-bit
1000years
14days
1seconds
96-bit
1\times106years
2500years
10seconds
128-bit
1\times1020years
1\times1013years
16hours
192-bit
1\times1036years
1\times1025years
10years
256-bit
1\times1053years
1\times1040years
1\times106years
TABLE II : Cracking costs for different bit-security levels using various computing systems.
Scheme
Ring ( N )
Moduli chain log2(PQ)
Noise distribution ( χe )
Security level ( λ )
1
216
1228 bits
NZ(0,3.192)
128 -bit
2
216
1188 bits
NZ(0,3.192)
192 -bit
3
217
1289 bits
NZ(0,3.192)
256 -bit
TABLE III : Key parameters for our RNS-CKKS schemes to achieve different HE security levels.
System
Method
Interval
Degree
Depth
Lee et al. [ 25 ]
Remez. [ 33 ]
[-1,1]
50
12
Lee et al. [ 26 ]
Remez. [ 33 ]
[-1,1]
50
12
Kim et al. [ 28 ]
Lee. [ 59 ]
[-1,1]
28
10
Rovida et al. [ 29 ]
Chebyshev. [ 60 ]
[-1,1]
59
5
Ours
Remez. [ 48 ]
[-1,1]
2
2
TABLE IV : Comparison of the computational efficiency for different ReLU approximations in FHE.
Dataset
Model
Acc. (ReLU)
Acc. (Approx)
Loss ↓
MNIST
ResNet20frozen-6
99.59%
99.60%
-0.01%
ResNet20frozen-8
99.40%
99.39%
0.01%
CIFAR-10
ResNet20frozen-6
92.31%
92.58%
-0.27%
ResNet20frozen-8
88.11%
88.14%
-0.03%
TABLE V : Comparison of model accuracy with ReLU and approximated ReLU activations on different datasets.