arXiv:2610.33525cs.CROct 2026

Manuscript Offprint

arXiv:2610.33525

Pacifo: An Efficient Fully Homomorphic Encryption-based Lightweight ResNet for Trustworthy Machine Learning as a Service

Yang Li, Gang He, Ruichen Zhang, Guangyuan Liu, Yinqiu Liu

Yang Li, Gang He, Ruichen Zhang, Guangyuan Liu, and Yinqiu Liu

Abstract—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×3.7 - 21.7 \times 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.

Index Terms—Privacy-preserving machine learning, fully homomorphic encryption, private inference, ResNet20, fine-tuning

I. Introduction

In recent years, deep learning-based models have shown remarkable capabilities across a wide range of tasks, including image recognition [1], [2], sentiment analysis [3], and content generation [4]. In this case, Machine Learning as a Service (MLaaS) [5], [6] has emerged as a popular business use case to facilitate the development of diverse AI applications. Fig. 1 presents a typical MLaaS workflow: the well-trained model is often deployed on the remote server, and the clients need to upload their data to the server and receive the inference result in return. This setup allows clients to avoid the cost of training computationally intensive models locally, while the server retains ownership of its valuable model.

However, the data handling process in MLaaS could raise significant privacy concerns. Specifically, MLaaS often operates through an online platform or APIs, requiring clients to transmit input data to the server. This reliance could lead to potential misuse of private data, such as unauthorized processing or resale to third parties. Even when the server is considered trustworthy, clients with sensitive data (e.g., medical records or financial information) may be unwilling to grant direct access to their data. These concerns have triggered responses scuh as Italy's temporary ban of ChatGPT [7], [8]. Hence, different private outsourced computation techniques have been applied to MLaaS to mitigate data privacy concerns, e.g., Differential Privacy (DP) [9], secure Multi-Party Computation (MPC) [10], and Homomorphic Encryption (HE) [11]. These approaches belong to the broader field of Privacy-Preserving Machine Learning (PPML) and focus on private inference (PI), which means performing model inference service without exposing client data [12].

FHE for Private Inference. Among existing solutions, FHE-based approaches are considered highly promising. In this setting, clients encrypt their private inputs before transmission, and only decrypt the final inference results returned by the server, ensuring that the server gains no knowledge of the input [13]. The privacy guarantees of FHE are grounded in the hardness of well-established cryptographic assumptions, i.e., the Ring Learning With Errors (RLWE) problem [14]. In addition, FHE-based protocols are usually non-interactive, which means no additional communication is required between the client and server during the inference process. Thereafter, there are several studies on HE-based private inference [15]–[24], with recent works [25]–[29] targeting deep and wide Convolutional Neural Networks (CNNs). Specifically, CNNs excel at capturing two-dimensional spatial features, making them effective for a wide range of image processing tasks and a popular choice for private inference [30].

Challenges in FHE-Based CNN Inference. Most existing HE-based solutions [25]–[29] utilize the Cheon-Kim-Kim-Song (CKKS) scheme [31] (except Benamira et al. [27] with TFHE [32]). CKKS supports approximate arithmetic over real and complex numbers, making it well-suited for PPML. Nonetheless, current implementations on CNNs still face the following challenges:

Y. Li and G. Liu are with the College of Computing and Data Science, the Energy Research Institute @ NTU, Interdisciplinary Graduate Program, Nanyang Technological University, Singapore (e-mail: yang048@e.ntu.edu.sg; liug0022@e.ntu.edu.sg).

G. He is with the School of Communication and Information Engineering, Shanghai University, Shanghai, China (e-mail: hegang@shu.edu.cn).

  1. Advanced CNNs such as ResNet involve many convolutions and non-linear activations, which require

R. Zhang, and Y. Liu are with the College of Computing and Data Science, Nanyang Technological University, Singapore (e-mails: ruichen.zhang@ntu.edu.sg; yinqiu001@e.ntu.edu.sg)

Figure

Fig. 1: MLaaS without privacy protection

a large number of expensive homomorphic computations and customized polynomial approximations in the context of FHE. This results in significant computational overhead and high runtime costs. For instance, Kim et al. [28] reported a runtime of 368 seconds to evaluate a single CIFAR-10 image using ResNet20.

  1. CNNs often have deep architectures—for example, even the lightweight ResNet20 consists of 20 network layers. Designing an FHE circuit to evaluate the entire model typically requires frequent and costly bootstrapping operations to manage noise during computation. In Lee et al. [26] and Kim et al. [28], bootstrapping accounts for 72.6% and 82.3% of the total runtime, respectively.

  2. Existing solutions [25]–[29] typically adopt a fixed security standard in HE (e.g., 128-bit), which is reasonable but lacks flexibility. We believe that the security levels should align with different application scenarios. Highly sensitive data, e.g., government communications, requires stronger security (e.g., 256-bit) to counter potential quantum threats.

To address challenges 1) and 2), prior studies have targeted computationally expensive operations, e.g., using single instruction multiple data (SIMD) to accelerate the linear computations [25], [26], [28] and proposing HE-friendly approximations for non-linear operations [29]. They have also optimized the design and placement of bootstrapping to further reduce overhead [33]. However, despite significant advancements in efficiency, these protocols remain impractical for real-world applications due to high runtime costs. Besides, none of them considers challenge 3) for further optimizing security standards. Given these limitations, we are motivated to re-consider how to design an efficient and practical private inference framework from a higher level, while ensuring the model performance.

Our Solutions. In this paper, we present Pacifo, a client-server private inference framework that minimizes FHE overhead through high-level circuit design. Pacifo leverages open-source pretrained models and strategically modifies the fine-tuning process to shift most of the computations outside the FHE domain without compromising security. As a result, the associated computational cost becomes relatively negligible. Furthermore, it introduces aggressive ReLU approximations and incorporates knowledge distillation (KD) during fine-tuning to preserve accuracy. Additionally, Pacifo supports flexible security levels, allowing clients to balance efficiency and security standards based on their specific requirements.

References (60)