Manuscript Offprint
arXiv:2610.25286PRICE: Privacy-Preserving Image Classification in Mobile Edge-Cloud Computing with Homomorphic Encryption
Duc-Huy Nguyen, Bui Duc Manh, Chi-Hieu Nguyen, Dinh Thai Hoang
Diep N. Nguyen, Van-Dinh Nguyen, and Quoc-Viet Pham
Abstract—Cloud-assisted image classification enables many mobile AI applications, but transmitting raw images to the cloud raises significant privacy concerns. Homomorphic encryption (HE) allows computation over encrypted data; however, existing end-to-end HE-based inference pipelines incur prohibitive latency and computational overhead, limiting their feasibility for latency-sensitive mobile systems. This paper addresses how to enable efficient encrypted image classification in mobile edge-cloud environments without sacrificing accuracy. We propose PRICE, a three-tier edge-cloud architecture that partitions deep neural network inference between a trusted edge and an untrusted cloud. The edge performs lightweight feature extraction in plaintext, while only compact embeddings are encrypted using the Cheon-Kim-Kim-Song (CKKS) scheme and offloaded to the cloud for encrypted final-layer inference. This design avoids homomorphic evaluation of deep backbone layers, significantly reducing computation depth, ciphertext size, and end-to-end latency. To further improve efficiency, we develop RowHyDiag, a row-packed hybrid diagonal encoding with hoisted-rotation-aware encrypted matrix-vector computation, which minimizes rotation operations and improves slot utilization. Extensive experiments on real devices across five datasets demonstrate that, under the evaluated 128-bit-security configurations, RowHyDiag achieves up to faster cloud inference, fewer rotations, and lower setup payload than the conventional Halevi-Shoup diagonal method. RowHyDiag also outperforms the PEGASUS linear-transformation baseline, providing faster cloud inference and lower setup payload. The results show that PRICE enables deployment-ready, low-latency encrypted inference for mobile edge-cloud systems under a trusted-edge threat model.
Index Terms—Encrypted inference, homomorphic encryption, mobile edge-cloud computing, privacy-preserving image classification, low-latency edge-cloud deployment.
I. INTRODUCTION
Despite these advantages, cloud-based inference introduces a fundamental privacy challenge: users must transmit visual data to external servers that are often modeled as honest-but-curious [11], creating the risk of exposing sensitive content, such as personal identity, location, and behavioral patterns [12]–[14]. To address this issue, secure multi-party computation (SMPC) has emerged as a representative approach for privacy-preserving DL inference [15]. In this setting, a private input is split into random shares and distributed to multiple parties, ensuring that each party sees only an unintelligible share while jointly evaluating inference through interactive protocols [16], [17]. Foundational studies in this domain include Gazelle, a two-party secure inference framework that combines homomorphic encryption with garbled circuits to achieve faster inference than earlier approaches [16], and SecureNN, a three-party protocol that enables efficient convolutional neural network (CNN) training and inference with security guarantees against both semi-honest and malicious adversaries [17]. These studies demonstrate the feasibility of CNN inference under representative SMPC settings with different participant roles and adversary models [16], [17].
However, a key limitation of SMPC is the massive communication overhead required for encrypted computation, which affects both non-linear operations (e.g., ReLU approximation via comparison protocols) and linear operations (e.g., matrix-vector multiplication via share-wise computation and reconstruction) [15]. Specifically, each layer evaluation requires multiple rounds of interaction between parties to exchange intermediate shares, verify correctness, and reconstruct partial results [15]–[17]. As model depth and width increase, the cumulative communication volume grows substantially, creating
Duc-Huy Nguyen, Bui Duc Manh, Chi-Hieu Nguyen, Dinh Thai Hoang, and Diep N. Nguyen are with the School of Electrical and Data Engineering, University of Technology Sydney, Sydney, NSW 2007, Australia (e-mail: duc.h.nguyen-3@student.uts.edu.au; duc.m.bui-1@student.uts.edu.au; hieu.c.nguyen@student.uts.edu.au; hoang.dinh@uts.edu.au; diep.nguyen@uts.edu.au).
Van-Dinh Nguyen and Quoc-Viet Pham are with the School of Computer Science and Statistics, Trinity College Dublin, Dublin 2, D02PN40, Ireland (e-mail: dinh.nguyen@tcd.ie; viet.pham@tcd.ie).
Some results of this work were presented at the ACM MobiCom Conference (Demo Paper), 2025 [1].
significant deployment challenges in bandwidth-constrained mobile-cloud settings. Furthermore, SMPC approaches typically assume different system models depending on party roles: two-party protocols may assume computation between client and server [16], while three-party protocols often assume computation across multiple non-colluding servers [17]. These requirements introduce additional challenges, including trust distribution, network coordination, and synchronization overhead, which are difficult to satisfy in real-world deployments with heterogeneous devices and dynamic network conditions.
To address the above challenges, fully homomorphic encryption (FHE) has emerged as a strong alternative that eliminates multi-party coordination by enabling the server to compute directly on ciphertexts without accessing plaintext inputs [18], [19]. Recent studies in FHE-based secure DL inference have focused on making encrypted image classification more efficient by optimizing FHE-encrypted linear and encrypted non-linear functions in neural networks (i.e., reducing the costly homomorphic operations such as ciphertext rotation and key switching) [15], especially for CNN-based image classification models. However, despite these improvements, existing end-to-end FHE-based inference pipelines remain computationally intensive and memory-demanding, especially for deep models [15]. The need to evaluate all layers of a neural network in the encrypted domain results in high latency, large ciphertext sizes, and significant computational overhead. These limitations make current FHE-based approaches difficult to deploy in low-latency mobile-cloud environments.
B. Related Works
Representative HE/FHE systems for image classification have primarily focused on improving efficiency through packing strategies and operator-level scheduling. CryptoNets [20] was among the first to demonstrate that neural network inference can be performed entirely on encrypted inputs. Using a leveled HE scheme with batched slot packing, CryptoNets evaluated a simple CNN on MNIST and achieved 99% accuracy with a throughput of approximately 59,000 predictions per hour. Although the model was shallow and the per-image latency was high (around 250 s on a single CPU core), it established the foundational paradigm of encoding neural network weights as plaintexts and evaluating layers through ciphertext-plaintext operations (e.g., multiplications and additions).
To reduce the computational overhead of deep encrypted CNNs, the authors in [21] proposed multiplexed parallel convolutions under the CKKS scheme. The proposed approach packed multiple channel outputs compactly into a single ciphertext to minimize the number of costly homomorphic operations (i.e., ciphertext rotation and bootstrapping). In addition, the authors integrated an imaginary-removing bootstrapping variant to prevent error divergence in approximated ReLU evaluation. On CIFAR-10 with ResNet-20, the study reported 2,271 s latency for one encrypted image using a single CPU thread and 79 s amortized runtime per image when classifying 50 images with 50 threads, corresponding to lower inference latency and less amortized runtime than the prior CKKS-based ResNet-20 implementation. Despite these improvements, the reported latency remains far above low-latency mobile-cloud requirements, and the framework still requires evaluating the full CNN depth under encryption.
At a larger model scale, NeuJeans [22] targeted the high cost of encrypted CNN inference by introducing Coefficients-in-Slot (CinS) encoding, which enables multiple convolutions within a single HE multiplication and reduces expensive slot permutations. The authors further showed that CinS aligns with the initial stages of the discrete Fourier transform (DFT), which is also used in CKKS bootstrapping [23], thereby avoiding redundant CinS/slot conversion overhead in Conv2D execution flows. With these co-designed optimizations, NeuJeans reported up to speedup for Conv2D-activation sequences and demonstrated ImageNet-scale encrypted CNN inference in a few seconds [22]. It also reported top-1/top-5 encrypted accuracies on 3,000 validation images (e.g., 74.1%/90.5% for ResNet-50). However, the reported end-to-end server inference delays are in the second-level range, i.e., 14.11 s (ResNet-18 poly approximation), 56.08 s (ResNet-50), and 40.76 s (MobileNetV2), which remains too high for low-latency mobile-cloud applications. [22].
Another recent direction focuses on channel-wise ciphertext organization for encrypted CNN inference. In this line, [24] proposed channel-by-channel packing and channel-by-channel convolution for CIFAR-10 classification with ResNet-20 and ResNet-110, and reported approximately and speedups with negligible accuracy deviation from plaintext. These gains are meaningful, but the deployment overhead remains high because the approach still executes a full deep CNN pipeline in the encrypted domain. In end-to-end HE-based inference, each convolutional layer requires numerous ciphertext rotations and key-switching operations to align packed slots and aggregate intermediate results across channels and spatial dimensions. As model depth increases, the number of required rotation indices also grows, forcing the server to preload a large set of evaluation keys, particularly rotation keys, which substantially increases memory and storage overhead. Despite the packing optimizations, the study still reported an amortized runtime of 15.76 s per image (batch size 512), around 370 GB RAM usage, and 6.91 GB of rotation-key storage.
While effective in principle, existing end-to-end HE-based DL approaches suffer from high latency and heavy computational and memory overhead. Compared with these approaches, split neural networks offer a promising way to reduce inference latency by executing different parts of a model at different entities. Specifically, Vepakomma et al. [25] introduced SplitNN, in which a neural network is partitioned between participating entities so that raw data need not be directly shared. However, conventional SplitNN relies on data and model partitioning rather than cryptographic protection, i.e., intermediate representations are transmitted in plaintext, may retain sensitive input information, and can be exploited to reconstruct the original input [26], [27]. Alternative privacy-enhanced split-computing approaches protect these representations through different mechanisms. Pham et al. [28] integrated differential privacy into split learning by perturbing intermediate representations at the cut layer and investigated the resulting privacy-accuracy and communication trade-offs on image-classification tasks. This approach provides a statistical privacy guarantee without cryptographic computation. However, stronger perturbation can reduce predictive utility. Moreover, its primary focus is collaborative training rather than low-latency online inference. Khan et al. [29] combined U-shaped split learning with function secret sharing, additive secret sharing, and Beaver triples to protect intermediate computations and labels. This design provides cryptographic confidentiality without perturbing the data. However, it primarily targets secure training and requires interactive computation between two non-colluding servers. These requirements complicate deployment in a latency-sensitive setting with a single cloud provider.
HE-enhanced split inference avoids plaintext-representation leakage and noise-induced utility loss, but introduces different system costs. For example, Pereteanu et al. [30] partitioned a network into encrypted server-side front and back segments surrounding a larger plaintext middle segment executed by the client. This design substantially reduces encrypted computation compared with pure HE inference and protects the server-held model segments. However, each request must traverse the client-server boundary multiple times for decryption, plaintext middle-model evaluation, re-encryption, and further encrypted evaluation. Consequently, the design retains multi-second inference latency and increases the number of online communication rounds. Another example is the AI-as-a-Service architecture proposed by Lam et al. [31]. In this architecture, the user runs a public pretrained feature extractor locally, encrypts the resulting feature vector, and sends it to a cloud-hosted private network. The private network typically contains one or two fully connected layers evaluated under fully homomorphic encryption. The design encrypts each input feature separately and uses a look-up-table mechanism for nonlinear operations. To support these operations, the client must generate additional ciphertexts, evaluation keys, and key-switching material. These requirements increase client-side encryption, setup, and communication overhead. The cloud-side computation also increases as the feature dimension or private network grows. Collectively, these costs limit the deployability of existing privacy-preserving inference approaches in low-latency mobile-cloud environments and motivate the need for a more efficient system design.
C. Proposed Approach and Main Contributions
To overcome the above limitations in latency-sensitive mobile-cloud deployment, we propose PRICE, a PRivacy-preserving Image Classification framework for mobile Edge-cloud computing. The design partitions inference across client, trusted edge, and untrusted cloud to minimize encrypted computation while preserving confidentiality. In online operation, the trusted edge performs deep feature extraction in plaintext, encrypts the resulting embedding with CKKS, and sends only ciphertext features to the cloud. The cloud executes ciphertext-only final-layer classification and returns encrypted classification results for decryption at the edge. By avoiding end-to-end encrypted deep-network execution at the cloud, this design reduces computational complexity, evaluation-key burden, and end-to-end latency. Unlike conventional SplitNN [25], our framework does not transmit plaintext intermediate representations between the edge and cloud. It also avoids the intermediate decryption, plaintext evaluation, and re-encryption steps required by Split HE [30]. Therefore, our approach uses only one online edge-cloud request-response exchange. Our proposed framework has an architecture similar to that of Lam et al. [31]: both designs extract features before sending encrypted features to the cloud. However, their cloud-side computations are different. Our framework restricts cloud computation to encrypted final linear-layer evaluation. This restricted design enables RowHyDiag to optimize the encrypted matrix-vector computation. In contrast, Lam et al. support a more general private network that may include nonlinear layers evaluated using encrypted look-up tables.
Under our intended managed multi-client deployment, the edge node operates within an organizational boundary, such as an enterprise or hospital gateway or a carrier-operated multi-access edge computing site. The edge is under local administrative control, whereas the third-party cloud remains outside the data owner's trust domain. Although modern mobile devices may have sufficient computational capability for local feature extraction, the edge in PRICE serves a broader role as a shared trust and service boundary rather than merely as a computational accelerator. It handles CKKS encryption and decryption, keeps the feature extractor and HE context persistently available, and amortizes model loading and cryptographic setup across multiple clients. This design avoids distributing secret keys and model copies to individual client devices. It also provides stable resources as the model size and number of concurrent requests grow. Accordingly, the cloud is untrusted and cannot access raw data, plaintext embeddings, or the secret key. Compared with fully encrypted neural-network inference, PRICE performs the computationally intensive feature extraction at the trusted edge and leaves only encrypted final linear-layer evaluation to the cloud. To further improve cloud efficiency, we introduce RowHyDiag, a row-packed hybrid diagonal encoding with hoisted-rotation-aware encrypted linear-layer evaluation, which increases slot utilization and reduces redundant homomorphic operations. Unlike NeuJeans [22], which improves end-to-end encrypted neural-network inference by co-optimizing convolution and FHE bootstrapping through the CinS encoding, our proposed approach RowHyDiag targets efficient encrypted evaluation of the final linear classifier executed by the cloud after the trusted edge has completed plaintext feature extraction. Its algorithmic novelty lies in jointly designing the row-packed ciphertext layout, diagonal encoding, hoisted rotation schedule, and structured reduction so that multiple output rows are evaluated concurrently within the same CKKS slot space. This joint design reduces the number of ciphertext rotations by up to across the evaluated 128-bit-security configurations. Together, the trusted-edge partitioning and RowHyDiag reduce the encrypted workload to a shallow final-layer computation, lowering ciphertext rotations, evaluation-key usage, cloud setup overhead, and end-to-end inference latency while maintaining predictive accuracy across multiple image-classification workloads.
Specifically, the main contributions of this work include:
- We propose a three-tier edge-cloud architecture that separates plaintext feature extraction and encrypted classification. By executing deep feature extraction at a trusted edge and restricting homomorphic computation to the final classifier at the untrusted cloud, our design avoids evaluating multiple neural-network layers under encryption and substantially reduces encrypted computational complexity and end-to-end inference delay under an explicitly stated trusted-edge threat model.
• We develop RowHyDiag for efficient encrypted linear-layer computation in image classification. Across the evaluated 128-bit-security configurations, RowHyDiag achieves 12.2-31.8× faster cloud inference, 32.0-85.3× fewer rotations, and 31.6-83.0× lower one-time cryptographic setup payload than the conventional Halevi-Shoup diagonal method. It also outperforms the PEGASUS linear-transformation baseline, providing 1.1-4.5× faster cloud inference and 1.2-3.4× lower setup payload. These improvements are validated through theoretical analysis and empirical evaluation.
• We conduct extensive simulations and real-device experiments on benchmark datasets (MNIST, CIFAR-10, CIFAR-100, ImageNet-1K, and Australian Landmarks). Results show strong predictive fidelity and deployment-ready performance: encrypted accuracy consistently matches plaintext accuracy across all five datasets under different HE parameter configurations, while the maximum relative logit error remains between and across all evaluated settings.
• We additionally build a new application-oriented Australian Landmarks dataset to better evaluate the performance of the proposed approach on real image classification tasks. To the best of our knowledge, this is the first curated Australian-focused landmark dataset used in prior privacy-preserving inference studies, providing an essential real-image benchmark for evaluating system performance under realistic deployment conditions.
The remainder of this paper is organized as follows. Section II describes the proposed three-tier framework with main components. Section III details the privacy-preserving image classification technique and Section IV presents the datasets, evaluation metrics, experimental configuration, and baseline methods for evaluation. Section V reports simulation and low-latency edge-cloud results and Section VI concludes the paper.
II. THE PROPOSED FRAMEWORK
Fig. 1 presents the proposed three-tier architecture for privacy-preserving image classification. The system comprises: (i) resource-constrained client devices (e.g., smartphones and tablets), (ii) trusted edge servers deployed within an organizational boundary, and (iii) third-party cloud servers treated as untrusted. The core design principle is to ensure that raw user images never leave the trusted environment, while delegating only encrypted computation to the cloud. In this workflow, client devices transmit images to the trusted edge, which performs preprocessing and deep feature extraction in plaintext, then encrypts the resulting embeddings using the CKKS scheme [32]. The untrusted cloud only executes encrypted inference over ciphertexts, and encrypted outputs are returned to the edge, where the returned ciphertext is decrypted, and the final classification result is then sent back to the user. This three-tier architecture preserves data confidentiality while enabling scalable cloud-assisted computation.
Before online inference, the system executes a one-time key setup phase. The trusted edge server generates CKKS keys, including a public key pk for encryption, a secret key sk for decryption, and evaluation keys (e.g., rotation keys rotk) for homomorphic operations. The public and evaluation keys (pk, rotk) are provisioned to the cloud server, while the secret key sk remains exclusively at the edge.
A. Client Device
In the intended managed multi-client deployment, the client is responsible for data acquisition and transmits the selected image to a nearby trusted edge through a secure HTTPS channel [33].
B. Trusted Edge Node
The trusted edge node handles two main processes: (i) feature extraction and encryption before cloud offloading, and (ii) decryption and final prediction after cloud inference. During deployment, the full model is first fine-tuned offline, then partitioned such that the feature extractor is retained at the edge while the final linear classifier is deployed to the cloud.
-
Extract and Encrypt Features: Upon receiving an image from the client, the edge performs preprocessing and runs the deployed feature extractor to obtain a fixed-dimensional embedding. The edge device then applies normalization to stabilize encrypted computation [34] and encrypts the normalized feature vector using CKKS. Only ciphertext embeddings are transmitted to the cloud, ensuring that raw images and plaintext features never leave the trusted environment. The process is explained in detail in Section III-B.
-
Decrypt and Return Results: After receiving encrypted classification results from the cloud, the edge device decrypts them with the secret key, decodes the recovered plaintext class scores, applies argmax, and returns the final prediction to the client. All decryption and post-processing operations are confined to the trusted edge, preserving data confidentiality. The process is explained in detail in Section III-D.
C. Untrusted Cloud Server
The untrusted cloud server stores and executes only the encrypted final-layer classifier, together with CKKS public/evaluation keys. It performs encrypted linear-layer inference (matrix-vector multiplication with bias addition) over received encrypted embeddings, then returns encrypted class-score ciphertexts to the edge. Since the cloud never has access to the secret key or plaintext data, it can scale inference while preserving data confidentiality. The process is further detailed in Section III-C.

4 Edge - Client: Decrypt & Return Result
Fig. 1: System architecture showing three-tier workflow: (1) client sends image to edge server, (2) edge server extracts and encrypts features, (3) cloud server performs encrypted inference, (4) edge server decrypts and returns result to client.
D. Threat Model Scope and Limitations
Our framework considers scenarios in which the edge node is trusted, i.e., it can access raw data, plaintext feature embeddings, model-backbone parameters, and the CKKS secret key. Following the ETSI security architecture standard, the edge operates inside an organizational security boundary, such as an enterprise or hospital gateway, an on-premise industrial appliance, or a carrier-operated MEC site governed by local administrative control and platform-attestation policies [35], [36].
In scenarios where the edge node cannot be fully trusted, plaintext feature extraction and cryptographic key management should be performed within a trusted execution environment (TEE), such as Intel SGX [37] or ARM TrustZone [38]. The client could first verify the TEE through remote attestation and establish a secure channel terminating inside the TEE. This channel thus can protect the data using conventional encryption method at the transport layer. Furthermore, the edge OS will only forward encrypted traffic, while the data will be decrypted and processed inside hardware-protected memory (i.e., TEE). Feature extraction and cryptographic key management would also be performed inside the TEE. Therefore, software outside the TEE, including a compromised host OS or hypervisor, would not have access to raw data, plaintext embeddings, or cryptographic keys. Incorporating a TEE would inevitably introduce additional overhead associated with enclave memory constraints, context switching, model loading, and remote attestation. Nevertheless, TEE-based protection complements rather than alters the cryptographic design of RowHyDiag. A comprehensive integration and evaluation of TEEs is therefore left for future deployment-oriented work.
III. PROPOSED PRIVACY-PRESERVING IMAGE CLASSIFICATION TECHNIQUE
In this section, we first provide fundamental background on HE and its core operations. We then describe in detail the proposed methods and algorithms introduced in Section II.
A. Homomorphic Encryption Background
Homomorphic encryption is a cryptographic approach that allows mathematical operations to be performed directly on encrypted data without decryption. To work with real numbers in neural network layers, we use the CKKS scheme [32], which supports approximate arithmetic on floating-point values. Additionally, CKKS enables Single Instruction, Multiple Data (SIMD)-style processing, which allows multiple data elements to be encoded within a single ciphertext [39], thereby enabling efficient parallel computation for linear layers in neural networks. Additionally, the CKKS scheme is based on the Ring Learning With Errors (RLWE) problem [40], providing strong privacy against decryption attempts. The scheme requires ciphertexts to be represented as one-dimensional vectors over a ring of dimension N, with the number of available slots equal to N/2. The ring dimension N determines both the security level and the supported multiplicative depth. Importantly, raw data must be encoded into plaintexts before encryption so that homomorphic operations can be applied. The main homomorphic operations used in our encrypted inference pipeline are:
• Key Generation: Generates sk, pk, and rotation keys rotk for computation.
• Encryption: Given a plaintext vector and pk, encrypt into a ciphertext where .
• Decryption: Given a ciphertext and secret key sk, decrypt into its plaintext form c where .
• Addition: Given two ciphertexts and , perform element-wise encrypted addition , where .
• Ciphertext-Plaintext Addition: Given a ciphertext and a plaintext , perform element-wise encrypted addition , where .
• Multiplication: Given two ciphertexts and , perform element-wise encrypted multiplication
EvalMult( , ) = , where Decrypt(sk, ) .
• Ciphertext-Plaintext Multiplication: Given a ciphertext and a plaintext , perform element-wise encrypted multiplication , where .
• Rotation: Given a ciphertext encrypting a vector , perform rotation by positions: , where [41].
• Hoisted Rotation: For efficient multiple rotations of the same ciphertext, hoisted key switching [42] precomputes hoisted = EvalFastRotationPrecompute( ) once, then performs for each rotation index .
• Sum Across Slots: Given a ciphertext with batch size , perform using a binary-tree reduction pattern: in each round , the ciphertext is rotated by positions and added to itself, progressively halving the number of unaccumulated elements. After rounds, the sum of all slot values is replicated across all positions in the resulting ciphertext.
Building on these CKKS primitives, the following subsections describe the end-to-end encrypted inference workflow, including feature extraction and encryption at the edge, encrypted inference in the cloud, and decryption with result recovery at the edge (Fig. 1 steps 2-4).
B. Feature Extraction and Encryption at the Trusted Edge
The trusted edge receives an image from the client, performs preprocessing and feature extraction in plaintext, and encrypts only the resulting feature embedding before offloading it to the cloud. This subsection formalizes the query encoding process and encryption procedure.
Given an input image where , , and denote height, width, and number of channels, the trusted edge first applies standard preprocessing operations (e.g., resizing, normalization) to obtain , where represents the preprocessing transformation. The preprocessed image is then fed into a pretrained feature extractor to extract a compact feature embedding:
where m is the feature dimension (e.g., m = 512 for ResNet-34, m = 768 for ViT-B/16). This embedding serves as the plaintext input for subsequent encrypted classification.
For efficient encrypted computation using CKKS with ring dimension N, each ciphertext provides available slots. To improve slot utilization and support efficient encrypted computation (especially tree-style reduction during encrypted inference), we design a slot-replication encoding strategy. First, we pad the feature dimension to the nearest power of two:
which ensures compatibility with binary-tree reduction patterns. The padded feature vector is defined as:
Given that (a condition satisfied by typical configurations where ), we compute the number of feature replicas that fit into a single ciphertext. Since each replica occupies consecutive slots, the total number of replicas is obtained by dividing the available slot count by the replica size and taking the floor to discard any incomplete trailing block:
We then replicate across consecutive slot blocks to form the replicated feature vector:
This replication strategy enables efficient homomorphic matrix-vector multiplication within our proposed encrypted inference algorithm, which is detailed in Section III-C. Finally, the edge encrypts the replicated feature vector using the CKKS public key:
resulting in an encrypted query ciphertext that is transmitted to the untrusted cloud for encrypted inference. For illustration, Fig. 6 in Appendix A describes this query encoding workflow, including power-of-two padding and slot replication.
C. Encrypted Inference in the Untrusted Cloud
In standard plaintext inference, the linear classification layer computes class logits via a straightforward matrix-vector multiplication followed by bias addition. Given a feature vector , weight matrix , and bias vector , where denotes the number of classes and is the feature dimension, the linear layer computes:
where represents the output logits. The predicted class is then determined by . In conventional plaintext computation, this matrix-vector product is readily computed via standard linear algebra operations.
However, performing the linear forward pass in (7) homomorphically over CKKS ciphertexts introduces fundamental structural constraints. As described in Section III-A, CKKS ciphertexts require data to be encoded in one-dimensional vectors packed into polynomial slots, and the supported homomorphic operations (ciphertext-plaintext multiplication, ciphertext addition, and slot rotation) are inherently elementwise (Hadamard product) or permutation-based rather than standard matrix operations. Consequently, directly applying W to an encrypted vector is not feasible under the CKKS evaluation model. To enable efficient encrypted computation
Algorithm 1 RowHyDiag Encoding: Pack rows and encode diagonals
1: Input: Weight matrix , batch size 2: Output: Packed matrix , diagonal plaintexts 3: Compute 4: Compute 5: Compute 6: Compute 7: for to do 8: for to do 9: 10: 11: if and then 12: 13: else 14: 15: end if 16: end for 17: end for 18: for to do 19: for to do 20: 21: 22: 23: 24: 25: end for 26: end for 27: return
in (7), the weight matrix W and bias vector b must be transformed into plaintext representations that align with the one-dimensional ciphertext slot structure and leverage the element-wise multiplication and rotation primitives provided by CKKS.
To address this challenge, we propose RowHyDiag (row-packed hybrid diagonal encoding), which transforms W and b into structured diagonal plaintexts compatible with rotation-and-multiply-based encrypted matrix-vector multiplication. The untrusted cloud receives only the encrypted feature representation from the trusted edge and fully evaluates the linear mapping in (7) in the encrypted domain using ciphertext-plaintext operations. This subsection details the RowHyDiag encoding for the weight matrix and bias vector, followed by the encrypted evaluation procedure that realizes the same mapping in (7) under encryption.
- RowHyDiag Matrix Encoding: Given classifier weights and slot count , we compute
Starting from the original matrix of size , we first align columns with , then pack original rows into each packed row to obtain a matrix of size .
Algorithm 2 BiasEncode: Encode aligned bias plaintext
1: Input: Bias , , , , 2: Output: Bias plaintext bias 3: for to do 4: blk 5: 6: if then 7: 8: if then 9: 10: else 11: 12: end if 13: else 14: 15: end if 16: end for 17: return bias
We next zero-pad rows until reaching (which equals when is already a power of two), making the packed matrix compatible with power-of-two scheduling in subsequent encrypted operations. This construction improves slot utilization while preserving the original linear mapping. For illustration, Fig. 7 in Appendix A summarizes the square workflow, whereas Fig. 9 in Appendix B provides a detailed non-square example.
Rows of W are packed blockwise into , and diagonal plaintexts are extracted for rotation-and-multiply evaluation according to the slot-index mapping, as formalized in (10)-(13).
For and slot , each diagonal element is defined by
where r denotes the row index, blk denotes the block identifier, p denotes the in-block position, and c denotes the column index. This block-local wrap-around preserves index alignment between packed features and packed weights.
This encoding ensures that when we rotate by positions and multiply with , we obtain the correct element-wise products for encrypted linear-layer evaluation. The proposed RowHyDiag encoding is detailed in Algorithm 1.
- Bias Encoding: To align post-multiplication accumulation with classifier biases, we encode into a plaintext vector using the same block layout. For slot index , let and . The mapped class index is
and if ; otherwise zero. Equivalently, biases are distributed across blocks of size , where block stores biases for rows , , ,
Plaintext Computation
Encrypted Matrix-Vector Computation

Fig. 2: Encrypted linear-layer evaluation workflow for Algorithm 3. Left (plaintext): the linear classifier computes . Right (Encrypted): step 1 forms diagonal products from rotated packed features and diagonal plaintexts; step 2 accumulates partial results; step 3 performs in-block binary-tree reduction via rotations and additions; step 4 adds the aligned bias plaintext to obtain encrypted results . The final class results are decoded from packed slots using the slot-to-class index mapping.
at the block prefix. This layout matches the organization of intermediate encrypted accumulation, enabling correct homomorphic bias addition without extra reshaping. Fig. 8 in Appendix A illustrates the square-case layout, while Fig. 10 in Appendix B shows a non-square example. The full procedure is provided in Algorithm 2.
- Encrypted Linear Layer Evaluation: Given the encoded weight diagonals , aligned bias plaintext bias, and encrypted query from the trusted edge, the untrusted cloud evaluates the linear layer in (7) homomorphically using rotations, ciphertext-plaintext multiplications, and additions.
We first perform hoisted key-switching precomputation for to amortize the cost of multiple ciphertext rotations. For , we multiply the unrotated ciphertext by to initialize the accumulator; for each , we rotate the encrypted query by , multiply by , and accumulate via homomorphic addition. This produces partial results distributed across blocks. Because the packed-row coordinate has period , we then apply in-block binary-tree reduction with strides , and finally add the aligned bias plaintext to obtain encrypted results .
Formally, let denote left rotation by slots, and denote slot-wise multiplication. The diagonal accumulation computes:
At the slot level:
Here, denotes the -th slot of Decrypt(sk, ). Under this notation, the summation is exactly the blockwise wrapped diagonal accumulation induced by (10)-(13).
We then apply in-block binary-tree reduction:
Finally,
For detailed illustration, Fig. 2 visualizes the end-to-end encrypted evaluation flow corresponding to (15)-(20). Algorithm 3 summarizes the full cloud-side encrypted evaluation procedure.
Algorithm 3 EncryptedInference: Encrypted Linear Classifier Evaluation
1: Input: Encrypted replicated query , diagonal plaintexts , bias plaintext bias
2: Output: Encrypted results
3: hoisted EvalFastRotationPrecompute( )
4: EvalMult( , )
5: for to do
6: EvalFastRotation( , , hoisted)
7: EvalMult( , )
8: EvalAdd( , )
9: end for
10: elements_per_block
11: num_shifts
12: stride
13: for to num_shifts - 1 do
14: EvalAdd( , EvalRotate( , stride))
15: stride 2 stride
16: end for
17: EvalAdd( , bias )
18: return
D. Decryption and Result Recovery at the Trusted Edge
After cloud evaluation, encrypted results are returned to the trusted edge for decryption and class-score extraction. The trusted edge first decrypts the returned ciphertext using the secret key:
where is the decrypted plaintext vector containing the packed logit values across S slots.
To extract individual class scores from the decrypted packed vector, the edge applies the inverse of the RowHyDiag layout. Using the same block structure as bias encoding, for class index define
and slot location
The recovered class score is then extracted from the corresponding slot:
Equivalently, if a slot is written as , then it stores class index whenever .
From (22)-(24), applying the slot mapping across valid classes yields
which shows that the three-stage trusted edge/untrusted cloud/trusted edge workflow preserves the plaintext linear-layer mapping, up to CKKS approximation error. Raw images, plaintext embeddings, and decryption keys remain inside the trusted edge boundary.
IV. EXPERIMENT SETUP
This section describes datasets, evaluation metrics, implementation settings, and baseline methods used to validate both prediction accuracy and deployment-oriented encrypted-inference performance.
A. Datasets
We evaluate the proposed framework on five datasets spanning increasing levels of classification complexity and deployment realism: MNIST [43] (10 classes), CIFAR-10 [44] (10 classes), CIFAR-100 [44] (100 classes), ImageNet-1K [45] (1,000 classes), and a custom Australian Landmarks dataset (9 classes).
MNIST is included as a standard low-complexity benchmark with grayscale handwritten digits and limited appearance variation, allowing us to verify numerical correctness and encrypted-plaintext consistency under controlled conditions. CIFAR-10 introduces natural-image diversity (background clutter, viewpoint changes, and intra-class diversity), which is useful for validating robustness beyond digit classification. CIFAR-100 further increases task difficulty through fine-grained 100-class recognition, providing a challenging evaluation of scalability for both model accuracy and encrypted inference overhead. ImageNet-1K extends the evaluation to 50,000 validation images and 1,000 output classes, allowing us to assess encrypted-plaintext consistency and encrypted-inference scalability at a substantially larger classification scale.
In addition to standard benchmarks, we evaluate on a newly curated Australian landmarks dataset to reflect a realistic mobile visual-recognition scenario. This dataset contains 9 landmark classes and 1,981 test images used for final evaluation. We include this dataset because it captures deployment-oriented challenges (scene diversity, landmark-specific visual overlap, and edge-cloud deployment context) that are not fully represented by standard academic benchmarks. The dataset is constructed through web crawling followed by dual-stage filtering (semantic verification and visual consistency verification) to ensure data quality. For simplicity, only summary information is presented in the main text. The full data collection and verification pipeline is described in Appendix C, and Tables VI and VII in Appendix D report the detailed per-class filtering statistics and final train/test split.
B. Evaluation Metrics
We evaluate three aspects of performance: classification quality, plaintext-encrypted numerical consistency, and system efficiency. For classification quality, top-1 accuracy is defined as
where N is the number of test samples, is the predicted class for sample , is the true class label, and is the indicator function. We also report confusion matrices for class-level analysis, where element denotes the number of samples with true class predicted as class . For system delay, we measure end-to-end latency as
where includes both feature extraction time and encryption time, is network transmission time, and is homomorphic inference time. Throughput is reported in images per second and computed as when is measured in seconds (equivalently, when latency is measured in milliseconds). In addition to runtime, we report ciphertext communication size and rotation-key storage to characterize deployment overhead. To quantify plaintext-encrypted numerical consistency, we compute the maximum relative error between plaintext logits and encrypted logits across all test samples:
where prevents division by zero, and denotes the logit for class of sample .
C. Experimental Configuration
-
Hardware and Network: Our implementation follows the proposed three-tier edge-cloud system shown in Fig. 3, comprising an Android client, a trusted edge node, and an untrusted cloud server. The edge-to-cloud link uses 10 Gigabit Ethernet (10GbE). The trusted edge node is an NVIDIA Jetson Orin 64GB device, and the cloud server is equipped with an Intel Core i9-13900K processor (up to 5.8 GHz, 24 cores / 32 threads) and 32 GB of RAM running Linux. All latency components are measured empirically on this physical testbed using wall-clock timing. Specifically, is measured end-to-end on the Jetson Orin, covering image preprocessing, feature extraction, and CKKS encryption; is obtained by timestamping ciphertext payloads at the sender and receiver endpoints, capturing the actual transfer delay over the 10GbE link; and is measured on the cloud server, covering the full homomorphic inference procedure (rotation, multiplication, accumulation, and bias addition). All measurements are taken under real operating conditions, and reported values are averaged over the full test set for each dataset.
-
Model Backbones and Fine-Tuning Settings: Model training and fine-tuning are conducted on the edge node to reflect deployment-oriented resource constraints, while encrypted classification is executed on the cloud. For MNIST, CIFAR-10, and Australian landmarks, we use a ResNet-34 backbone [4] with 512-dimensional embeddings. For CIFAR-100, we use ViT-B/16 [46] with 768-dimensional embeddings to support fine-grained 100-class recognition. For ImageNet-1K, we use a publicly available ViT-B/16 model pretrained on ImageNet-21K and fine-tuned on ImageNet-1K, also producing 768-dimensional embeddings for the 1,000-class classifier.
For ResNet-34 settings, we use Adam optimizer [47] with differential learning rates between the backbone and classifier, weight decay , and validation-based checkpoint selection following standard transfer learning practices [48]. Specifically, MNIST uses 12 epochs with learning rates (backbone) and (classifier), CIFAR-10 uses 20 epochs with and , and Australian landmarks uses 35 epochs with and . The batch size is 64 in all three cases. For Australian landmarks, we additionally use a ReduceLROnPlateau scheduler [49] (factor 0.5, patience 3; minimum learning rate ).

Fig. 3: Real-device experimental setup used in the three-tier edge-cloud deployment.
TABLE I: HE parameter sets used for encrypted inference.
| Set | N | Modulus chain | Multiplicative Depth | Security Level |
|---|---|---|---|---|
| HE-2048 | 2,048 | (60, 50) | 1 | Prototype |
| HE-4096 | 4,096 | (60, 50) | 1 | Prototype |
| HE-8192 | 8,192 | (60, 50) | 1 | 128-bit |
| HE-16384 | 16,384 | (60, 50) | 1 | 128-bit |
| HE-32768 | 32,768 | (60, 50) | 1 | 128-bit |
For CIFAR-100 with ViT-B/16, we fine-tune for 100 epochs using Adam (learning rate , weight decay 0.05, batch size 128) following established ViT fine-tuning protocols [46], [50]. We apply One-Cycle learning-rate scheduling [51], Mixup () [52], CutMix () [53], RandomErasing [54], and label-smoothing cross-entropy (smoothing 0.1) [55], and select the best checkpoint by validation accuracy.
- HE Parameter Configuration: The encrypted pipeline is implemented in OpenFHE [56] using CKKS. Table I defines five parameter sets, denoted by HE-2048 through HE-32768 according to their ring dimensions ; each set provides CKKS slots. All parameter sets use multiplicative depth one, a 60-bit first modulus, and a 50-bit scaling modulus. HE-8192, HE-16384, and HE-32768 are configured for 128-bit security, whereas HE-2048 and HE-4096 are included only as prototype parameter sets for evaluating computational scaling, without claiming a standard security level. The remaining implementation settings are FIXEDAUTO scaling, HYBRID key switching, and a uniform ternary secret distribution. These parameter choices follow the HomomorphicEncryption.org guidelines and OpenFHE's standard parameter interface [57], [58].
D. Baselines
To comprehensively validate our proposed framework, we perform evaluations against baselines following standard practices in HE/FHE-based DL literature.
Plaintext (Non-Encrypted) Baseline. Similar to prior works [16], [18], [24], we compare our approach against plaintext inference to quantify the impact of CKKS approximation noise. The plaintext baseline uses identical model weights and biases but evaluates the linear layer directly in floating-point arithmetic without encryption. This baseline is used to assess classification accuracy (top-1 accuracy, confusion matrices) and numerical consistency (maximum relative logit error between plaintext and encrypted outputs), verifying that encrypted inference preserves plaintext predictive behavior with negligible accuracy degradation.
Halevi-Shoup Diagonal Encoding Baseline. The Halevi-Shoup diagonal method [41] is a foundational technique for encrypted matrix-vector multiplication that decomposes a square matrix into diagonals, encodes them as plaintexts, and multiplies them with rotated encrypted vectors. Prior HE-based neural network inference approaches have widely adopted this method for encrypted linear operation [59], [60], making it a natural baseline for evaluating the algorithmic contribution of RowHyDiag. The method embeds an weight matrix into an square matrix (where rounded to the next power of two), then extracts diagonal plaintexts for encrypted matrix-vector computation through rotation-and-multiply operations. The rotation count for Halevi-Shoup encoding is given in (29). This baseline enables direct comparison of cloud inference efficiency metrics (latency and memory) to demonstrate that RowHyDiag significantly reduces computational overhead, memory footprint, and inference latency compared to conventional diagonal encoding.
PEGASUS Linear-Transformation Baseline. PEGASUS [61] uses a tiled baby-step/giant-step (BSGS) method for encrypted linear transformations. We adapt this method to evaluate the encrypted classifier . The method pads the matrix dimensions to powers of two and constructs tiled diagonals. It then applies a balanced BSGS schedule with baby-step size . Because our framework performs only encrypted linear-layer evaluation at the cloud, the comparison does not include PEGASUS's conversion, lookup-table evaluation, or scheme-switching operations. Therefore, this baseline represents only the linear-transformation method in PEGASUS, rather than the complete PEGASUS system.
RowHyDiag Evaluation Variants. RowHyDiag is designed primarily for short-wide classifier matrices, where the number of output classes is much smaller than the feature dimension. However, as the number of output classes increases, the number of diagonal products also grows. To reduce the resulting rotation overhead, we apply BSGS scheduling, which changes only the order in which the diagonal products are accumulated. Accordingly, we use RowHyDiag for the three small-output datasets and RowHyDiag with BSGS scheduling for CIFAR-100 and ImageNet-1K.
TABLE II: Encrypted classification accuracy and maximum relative logit error across HE parameter sets.
| Dataset | Set | Plain (%) | Encrypted (%) | Max-Rel. Error |
|---|---|---|---|---|
| MNIST | HE-2048 | 99.56 | 99.56 | |
| HE-4096 | ||||
| HE-8192 | ||||
| CIFAR-10 | HE-2048 | 96.64 | 96.64 | |
| HE-4096 | ||||
| HE-8192 | ||||
| Landmarks | HE-2048 | 95.91 | 95.91 | |
| HE-4096 | ||||
| HE-8192 | ||||
| CIFAR-100 | HE-4096 | 92.69 | 92.69 | |
| HE-8192 | ||||
| HE-16384 | ||||
| HE-32768 | ||||
| ImageNet-1K | HE-4096 | 85.99 | 85.99 | |
| HE-8192 | ||||
| HE-16384 | ||||
| HE-32768 |
V. SIMULATION AND EXPERIMENTAL RESULTS
Before evaluating encrypted inference, we verify that all fine-tuned models converge to stable operating points with small train-validation gaps. Convergence curves and detailed analysis for MNIST, CIFAR-10, CIFAR-100, and Australian landmarks are provided in Fig. 11 in Appendix E. The selected checkpoints achieve 99.47% (MNIST), 97.05% (CIFAR-10), 92.69% (CIFAR-100), and 93.92% (Australian landmarks) validation accuracy, confirming reliable feature representations for downstream encrypted classification. For ImageNet-1K, we instead use the public ViT-B/16 AugReg checkpoint distributed through the timm model collection on Hugging Face.
A. Encrypted Classification Accuracy
Table II summarizes plaintext-versus-encrypted accuracy and the maximum relative logit error for every evaluated HE parameter set. Encrypted and plaintext top-1 accuracies are identical for all five datasets and all tested configurations. The largest observed relative error is on ImageNet-1K under HE-32768, which remains too small to alter any top-1 decision. The errors across the remaining parameter sets are of the same negligible order and likewise preserve all top-1 decisions.
To provide class-level transparency for the three 9/10-class datasets, Fig. 4 combines the encrypted confusion matrices for MNIST, CIFAR-10, and Australian landmarks. The matrices show that prediction errors are concentrated in visually similar classes rather than randomly distributed. Together with the identical plaintext and encrypted accuracies for CIFAR-100 and ImageNet-1K in Table II, these results show that the packing and reduction procedure preserves model utility from 9 to 1,000 output classes.
https://huggingface.co/timm/vit_base_patch16_384.augreg_in21k_ft_in1k
Confusion Matrix: ResNet-34 on MNIST

(a) MNIST (10 classes).
Confusion Matrix: ResNet-34 on CIFAR-10
(b) CIFAR-10 (10 classes).
Confusion Matrix: ResNet-34 on Australian Landmarks (9 classes)
(c) Australian landmarks (9 classes).
Fig. 4: Encrypted confusion matrices for the three 9/10-class datasets. The CIFAR-100 and ImageNet-1K matrices are not shown because their 100 and 1,000 classes make them too dense for clear visualization in the main text.

Fig. 5: Per-stage latency breakdown across datasets under the HE-8192 parameter set. Stacked bars show edge processing (blue), network transmission (red), and cloud encrypted inference (green). Total latency is annotated above each bar.
B. Low-Latency Encrypted Inference Analysis
- Latency and Throughput Analysis: Fig. 5 presents the end-to-end latency breakdown across all five datasets under the common HE-8192 parameter set.
For MNIST, CIFAR-10, and Australian Landmarks, the end-to-end latencies are 57.46, 56.93, and 56.88 ms, corresponding to throughputs of 17.40, 17.57, and 17.58 images/s, respectively. The three latency components are nearly balanced in these settings: edge processing requires approximately 19.54-19.64 ms, network transmission requires 19.00-19.21 ms, and cloud encrypted inference requires 18.21-18.71 ms. These results show that the proposed pipeline supports interactive encrypted classification for the 9/10-class workloads, with no individual stage becoming a dominant bottleneck.
The two larger ViT-B/16 workloads exhibit the expected increase in latency. CIFAR-100 requires 92.13 ms for edge processing, 19.67 ms for network transmission, and 37.86 ms for cloud encrypted inference, resulting in 149.66 ms end-to-end latency and 6.68 images/s throughput. ImageNet-1K requires 92.11, 19.20, and 73.53 ms for the corresponding stages, yielding 184.84 ms total latency and 5.41 images/s. The similar edge-processing times follow from the common ViT-B/16 backbone and 768-dimensional feature representation. Their network times are also similar because both datasets use the HE-8192 parameter set. In contrast, the cloud component increases from 37.86 ms for CIFAR-100 to 73.53 ms for ImageNet-1K because the encrypted classifier scales from 100 to 1,000 output classes. Overall, cloud inference latency increases with the number of output classes, while end-to-end latency remains below 200 ms for all evaluated workloads.
- Complexity Analysis of Rotation Count: To understand the algorithmic efficiency of the proposed encoding, we analyze the theoretical rotation complexity of the conventional Halevi-Shoup diagonal method [41], the PEGASUS linear-transformation baseline, and RowHyDiag. Rotation operations (via key-switching) are a major computational cost in encrypted linear-layer evaluation, making rotation count an important complexity metric for encrypted inference systems [59].
Halevi-Shoup Diagonal Encoding. Consider an encrypted matrix-vector computation where is a plaintext matrix ( : number of output rows, : number of input columns) and is encrypted. The Halevi-Shoup diagonal method [41] embeds into a square matrix of size where is the smallest power of two greater than or equal to . The method then extracts diagonal plaintexts and performs encrypted matrix-vector multiplication through rotation-and-multiply operations. For each diagonal , the encrypted vector is rotated by positions, multiplied with the corresponding diagonal plaintext, and the resulting ciphertexts are summed via homomorphic addition. Since no further reduction is needed (each output element is already in its final position after summation), the total rotation count is [41]:
For typical classification tasks where , the rotation count is dominated by the input dimension and scales as .
PEGASUS Linear-Transformation. For output dimension n and input dimension m, the baseline pads the two dimensions to and , respectively. The resulting tiled representation contains
The baseline evaluates these diagonals using a balanced BSGS schedule with baby-step size and giant groups. Preparing the reusable baby steps requires rotations, while accumulating the giant groups requires rotations. When , each output is distributed across column groups. Combining these partial values requires an additional rotations. Substituting the padded dimensions and BSGS parameters gives the following rotation count in terms of and :
RowHyDiag Encoding. In contrast, RowHyDiag uses the available CKKS slots to pack multiple classifier rows before extracting the diagonals. For slot count and input dimension m, the feature length is first padded to
The number of classifier rows combined in each packed row is
The resulting number of packed rows is then padded to a power of two:
The direct schedule evaluates the diagonal products using hoisted rotations. It then combines the partial feature contributions through an in-block binary-tree reduction, which requires additional rotations. Substituting Eqs. (32)-(34) gives the following rotation count in terms of , , and :
\begin{align*}R_{\mathrm{RowHyDiag}}(n,m,S)=&2^{\left\lceil\log_{2}\left\lceil\frac{n}{\left\lfloor S/2^{\lceil\log_{2}m\right\rceil}\right\rfloor}\right\rceil}-1}\\&+\left\lceil\log_{2}\left(\frac{2^{\lceil\log_{2}m\rceil}}{2^{\lceil\log_{2}\left\lceil n/\left\lfloor S/2^{\lceil\log_{2}m\right\rceil}\right\rfloor}\right\rceil}\right)\right\rceil.\end{align*}(35)
For MNIST, CIFAR-10, and Australian Landmarks, row packing produces a small number of diagonals, so we use the direct schedule. For the larger-output CIFAR-100 and ImageNet-1K classifiers, we instead apply BSGS to the same diagonal products. We use baby-step size and giant groups. This reduces the rotations in the diagonal stage from to , while the row-packed encoding and in-block reduction remain unchanged. Substituting the padded dimensions gives the following rotation count in terms of , , and :
Table III reports the rotation counts obtained from Eqs. (29), (31), (35), and (36).
Comparison. For the 9/10-class tasks, RowHyDiag decreases from 13 to 9 rotations as S increases from 1,024 to 4,096, while Halevi-Shoup and the PEGASUS linear-transformation baseline remain at 511 and 11 rotations, respectively. For CIFAR-100, RowHyDiag with BSGS decreases from 18 to 11 rotations over S = 2,048-16,384, compared with 24 for the PEGASUS baseline and 1,023 for Halevi-Shoup. For ImageNet-1K, the RowHyDiag count decreases from 45 to 18, compared with 62 and 1,023 rotations for the two baselines. These reductions result from slot-aware row packing, which packs more output rows together as S increases and therefore reduces the number of RowHyDiag diagonals.
These results are consistent with the asymptotic rotation complexity. Power-of-two padding changes each dimension by at most a constant factor. Therefore, Halevi-Shoup uses diagonals and has rotation complexity . The PEGASUS linear-transformation baseline uses tiled diagonals. Its balanced BSGS schedule therefore has rotation complexity
For RowHyDiag, and hence the number of packed diagonals is
assuming a valid packing configuration with . The direct RowHyDiag schedule thus has rotation complexity
whereas applying BSGS to its diagonal stage reduces the rotation component to
In the intended short-wide regime, where n is small and , remains small and the RowHyDiag rotation complexity approaches . BSGS changes the rotation schedule but does not reduce the number of ciphertext-explaintext products. RowHyDiag evaluates diagonal products, whereas the PEGASUS linear-transformation baseline
TABLE III: Rotation counts across the evaluated slot counts. The smallest count in each setting is shown in bold.
| Dataset | n × m | S | Halevi-Shoup | PEGASUS LT | RowHyDiag |
|---|---|---|---|---|---|
| MNIST, CIFAR-10, Australian Landmarks | (9-10) × 512 | 1,024 | 511 | 11 | 13 |
| 2,048 | 511 | 11 | 10 | ||
| 4,096 | 511 | 11 | 9 | ||
| CIFAR-100 | 100 × 768 | 2,048 | 1,023 | 24 | 18 |
| 4,096 | 1,023 | 24 | 15 | ||
| 8,192 | 1,023 | 24 | 12 | ||
| 16,384 | 1,023 | 24 | 11 | ||
| ImageNet-1K | 1,000 × 768 | 2,048 | 1,023 | 62 | 45 |
| 4,096 | 1,023 | 62 | 32 | ||
| 8,192 | 1,023 | 62 | 24 | ||
| 16,384 | 1,023 | 62 | 18 |
TABLE IV: Memory and resource summary for RowHyDiag using the HE-8192 parameter set (decimal MB/KB).
| Metric | 9/10 classes | CIFAR-100 | ImageNet-1K |
|---|---|---|---|
| Setup (MB) | 7.35 | 12.07 | 25.45 |
| Context+PK (KB) | 263.54 | 263.54 | 263.54 |
| Rotation keys (MB) | 7.08 | 11.81 | 25.18 |
| Rotation indices (#) | 9 | 15 | 32 |
| Upload/query (KB) | 263.01 | 263.01 | 263.01 |
| Return/query (KB) | 263.21 | 263.21 | 263.21 |
evaluates products. Their diagonal-product counts are therefore and , respectively. Thus, rotation count captures the main key-switching cost but does not alone determine the complete homomorphic runtime.
- Memory and Resource Analysis: Beyond computational complexity, deployable systems require careful consideration of storage and communication overhead. We therefore report two deployment-oriented metrics: the one-time setup payload and per-query communication volume. The setup payload includes the cryptographic context, public key, and rotation keys provided to and stored by the cloud. Per-query communication includes the uploaded feature ciphertext and returned result ciphertext. Table IV summarizes these costs under the common HE-8192 parameter set.
For the 9/10-class settings (MNIST, CIFAR-10, and Australian Landmarks), the setup payload is 7.35 MB, including 263.54 KB for the context and public key and 7.08 MB for nine rotation keys. Rotation keys account for approximately 96.3% of the setup payload, indicating that evaluation-key material, rather than the query ciphertext, is the dominant static overhead. At inference time, the encrypted upload and returned result are 263.01 KB and 263.21 KB per image, respectively. The near-equal upload and return sizes follow from the slot-position-matching decode strategy: the cloud returns one logits ciphertext in the same packed layout without ciphertext expansion. These values are shared by the three datasets because they use the same HE-8192 configuration and comparable packing layouts.
For CIFAR-100, the larger output dimension increases the number of required rotation indices from 9 to 15. Consequently, rotation-key storage grows to 11.81 MB and the total setup payload reaches 12.07 MB. ImageNet-1K further increases the output dimension to 1,000 classes, requiring 32 ro- tation indices, 25.18 MB of rotation keys, and a 25.45 MB total setup payload. Rotation keys therefore remain the dominant setup component, accounting for approximately 97.8% and 98.9% of the CIFAR-100 and ImageNet-1K setup payloads, respectively.
TABLE V: Empirical performance comparison of RowHyDiag and baselines. Entries report cloud latency (ms/image) / setup payload (MB).
| Dataset | Set | Halevi-Shoup | PEGASUS LT | RowHyDiag |
|---|---|---|---|---|
| MNIST | HE-2048 | 167.79 / 100.82 | 6.79 / 2.24 | 6.29 / 2.63 |
| HE-4096 | 253.50 / 201.35 | 12.07 / 4.46 | 10.71 / 4.07 | |
| HE-8192 | 418.57 / 402.41 | 19.79 / 8.92 | 18.64 / 7.35 | |
| CIFAR-10 | HE-2048 | 168.00 / 100.82 | 7.14 / 2.24 | 6.86 / 2.63 |
| HE-4096 | 253.07 / 201.35 | 11.07 / 4.46 | 8.21 / 4.07 | |
| HE-8192 | 418.57 / 402.41 | 19.71 / 8.92 | 18.07 / 7.35 | |
| CIFAR-100 | HE-4096 | 554.57 / 402.96 | 36.64 / 9.58 | 31.29 / 7.22 |
| HE-8192 | 899.93 / 805.35 | 55.00 / 19.15 | 37.86 / 12.07 | |
| HE-16384 | 1629.00 / 1610.13 | 85.86 / 38.29 | 51.21 / 19.41 | |
| HE-32768 | - | 153.21 / 76.56 | 83.07 / 35.66 | |
| ImageNet-1K | HE-4096 | 557.21 / 402.96 | 117.74 / 24.55 | 68.11 / 17.85 |
| HE-8192 | 895.53 / 805.35 | 180.21 / 49.06 | 73.53 / 25.45 | |
| HE-16384 | 1610.89 / 1610.13 | 306.11 / 98.08 | 89.89 / 38.29 | |
| HE-32768 | - | 536.79 / 196.12 | 119.42 / 57.68 | |
| Australian Landmarks | HE-2048 | 166.93 / 100.82 | 7.36 / 2.24 | 7.21 / 2.63 |
| HE-4096 | 251.50 / 201.35 | 11.64 / 4.46 | 10.50 / 4.07 | |
| HE-8192 | 418.00 / 402.41 | 19.00 / 8.92 | 18.07 / 7.35 |
Because all three settings use the same ring dimension, their per-query upload and return sizes remain unchanged; the larger class counts primarily affect the number of required rotation keys. Relative to the 9/10-class settings, setup payload increases by approximately for CIFAR-100 and for ImageNet-1K. At the 1,000-class scale, the RowHyDiag setup payload is 25.45 MB.
- Empirical Comparison with Baselines: Having established the theoretical rotation advantage, we compare our proposed approach RowHyDiag with the conventional Halevi-Shoup diagonal method and the PEGASUS linear-transformation baseline. All methods use the same model, cryptographic parameters, hardware, and evaluation settings. Table V reports cloud inference latency and one-time setup payload. The setup payload includes the cryptographic context, public key, and rotation keys.
Comparison with Halevi-Shoup. Under the prototype HE-2048 and HE-4096 settings, our proposed approach RowHy-
Diag is 8.2-30.8× faster and reduces the setup payload by 22.6-55.8×. Under the configurations providing 128-bit security, RowHyDiag is 12.2-31.8× faster and reduces the setup payload by 31.6-83.0×. Halevi-Shoup is unavailable at HE-32768 because its setup payload is too large to transmit over the network. Halevi-Shoup requires substantially more rotations and rotation keys, whereas the packed schedule of RowHyDiag reduces both costs.
Comparison with the PEGASUS linear-transformation baseline. Under the prototype settings, the two methods have comparable latency at HE-2048, although the PEGASUS baseline has a slightly smaller setup payload. At HE-4096, RowHyDiag is 1.1-1.7× faster and reduces the setup payload by 1.1-1.4×. Under the configurations providing 128-bit security, RowHyDiag is 1.1-4.5× faster and reduces the setup payload by 1.2-3.4×. These improvements arise from the RowHyDiag packing layout, which reduces both the number of diagonal products and the required rotation keys. For the larger CIFAR-100 and ImageNet-1K classifiers, BSGS scheduling preserves these advantages as the number of output classes increases.
VI. Conclusion
This paper presents PRICE, a deployment-ready three-tier edge-cloud framework for privacy-preserving image classification with CKKS homomorphic encryption. The design keeps secret-key operations and deep feature extraction at the trusted edge while restricting the untrusted cloud to encrypted final-layer inference. To improve cloud-stage efficiency, we develop RowHyDiag, a row-packed hybrid diagonal encoding method with hoisted-rotation-aware computation, improving slot utilization and reducing costly homomorphic operations. Theoretical complexity analysis and empirical evaluation across five datasets demonstrate that, under the evaluated 128-bit-security configurations, RowHyDiag achieves faster cloud inference, requires fewer rotations, and reduces the setup payload by compared with the Halevi-Shoup diagonal method. RowHyDiag is also faster than the PEGASUS linear-transformation baseline and reduces its setup payload by . Encrypted accuracy matches plaintext accuracy across all five datasets, confirming that encrypted evaluation preserves the predictive results. These results show that our proposed framework supports low-latency encrypted inference for mobile edge-cloud systems under a trusted-edge threat model.
REFERENCES
[1] C.-H. Nguyen, B. D. Manh, D. T. Hoang, D. N. Nguyen, and L. Wang, "Demo: PP-AICloud for edge-assisted privacy-preserving AI inference with homomorphic encryption in cloud-based mobile services," in Proceedings of the 31st Annual International Conference on Mobile Computing and Networking, 2025, p. 1166–1168.
[2] Y. Huang, X. Qiao, P. Ren, L. Liu, C. Pu, S. Dustdar, and J. Chen, "A lightweight collaborative deep neural network for the mobile web in edge cloud," IEEE Transactions on Mobile Computing, vol. 21, no. 7, pp. 2289–2305, Jul. 2022.
[3] M. Gao, R. Shen, L. Shi, W. Qi, J. Li, and Y. Li, “Task partitioning and offloading in DNN-task enabled mobile edge computing networks,” IEEE Transactions on Mobile Computing, vol. 22, no. 4, pp. 2435–2445, Apr. 2023.
[4] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016, pp. 770–778.
[5] M. Tan and Q. Le, “EfficientNetV2: Smaller models and faster training,” in Proceedings of the 38th International Conference on Machine Learning (ICML), 2021, pp. 10096–10106.
[6] T. Liu, L. Fang, Y. Zhu, W. Tong, and Y. Yang, “A near-optimal approach for online task offloading and resource allocation in edge-cloud orchestrated computing,” IEEE Transactions on Mobile Computing, vol. 21, no. 8, pp. 2687–2700, Aug. 2022.
[7] J. Li, W. Liang, Y. Li, Z. Xu, X. Jia, and S. Guo, “Throughput maximization of delay-aware DNN inference in edge computing by exploring DNN model partitioning and inference parallelism,” IEEE Transactions on Mobile Computing, vol. 22, no. 5, pp. 3017–3030, May 2023.
[8] Y. Kang, J. Hauswald, C. Gao, A. Rovinski, T. Mudge, J. Mars, and L. Tang, “Neurosurgeon: Collaborative intelligence between the cloud and mobile edge,” in Proceedings of the 22nd International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2017, pp. 615–629.
[9] Z. Xu, D. Yang, C. Yin, J. Tang, Y. Wang, and G. Xue, “A co-scheduling framework for DNN models on mobile and edge devices with heterogeneous hardware,” IEEE Transactions on Mobile Computing, vol. 22, no. 3, pp. 1275–1288, 2023.
[10] H. Li, X. Li, Q. Fan, Q. He, X. Wang, and V. C. M. Leung, “Distributed dnn inference with fine-grained model partitioning in mobile edge computing networks,” IEEE Transactions on Mobile Computing, vol. 23, no. 10, pp. 9060–9074, Oct. 2024.
[11] O. Goldreich, Foundations of Cryptography: Volume 2, Basic Applications. Cambridge University Press, 2004, published May 2004.
[12] M. Rigaki and S. García, “A survey of privacy attacks in machine learning,” ACM Computing Surveys, vol. 56, no. 4, pp. 1–34, 2023.
[13] R. Zhao, Y. Zhang, T. Wang, W. Wen, Y. Xiang, and X. Cao, “Visual content privacy protection: A survey,” ACM Computing Surveys, vol. 57, no. 5, pp. 122:1–122:36, 2025.
[14] Z. Wang, Y. Sun, D. Liu, J. Hu, X. Pang, Y. Hu, and K. Ren, "Location privacy-aware task offloading in mobile edge computing," IEEE Transactions on Mobile Computing, vol. 23, no. 3, pp. 2269–2283, Mar. 2024.
[15] W. Zeng, T. Xu, Y. Chen, Y. Zhou, M. Zhang, J. Tan, C. Hong, and M. Li, "Towards efficient privacy-preserving machine learning: A systematic review from protocol, model, and system perspectives," arXiv preprint arXiv:2507.14519, 2025.
[16] C. Juvekar, V. Vaikuntanathan, and A. Chandrakasan, “GAZELLE: A low latency framework for secure neural network inference,” in 27th USENIX Security Symposium, 2018, pp. 1651–1669, ePrint 2018/073.
[17] S. Wagh, D. Gupta, and N. Chandran, “SecureNN: Efficient and private neural network training,” in Proceedings on Privacy Enhancing Technologies (PETS), vol. 2019, no. 2, 2019, pp. 26–49, ePrint 2018/442.
[18] B. D. Manh, C.-H. Nguyen, D. T. Hoang, D. N. Nguyen, M. Zeng, and Q.-V. Pham, “Privacy-preserving cyberattack detection in blockchain-based IoT systems using AI and homomorphic encryption,” IEEE Internet of Things Journal, vol. 12, no. 11, pp. 16478–16492, 2025.
[19] A. Acar, H. Aksu, A. S. Uluagac, and M. Conti, “A survey on homomorphic encryption schemes,” ACM Computing Surveys, vol. 51, no. 4, pp. 79:1–79:35, 2018.
[20] R. Gilad-Bachrach, N. Dowlin, K. Laine, K. Lauter, M. Naehrig, and J. Wernsing, “Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy,” in Proceedings of the 33rd International Conference on Machine Learning (ICML), 2016, pp. 201–210.
[21] E. Lee, J.-W. Lee, J. Lee, Y.-S. Kim, Y. Kim, J.-S. No, and W. Choi, "Low-complexity deep convolutional neural networks on fully homomorphic encryption using multiplexed parallel convolutions," in Proceedings of the 39th International Conference on Machine Learning (ICML), 2022, pp. 12403–12422.
[22] J. H. Ju, J. Park, J. Kim, M. Kang, D. Kim, J. H. Cheon, and J. H. Ahn, "NeuJeans: Private neural network inference with joint optimization of convolution and FHE bootstrapping," in Proceedings of the 2024 ACM SIGSAC Conference on Computer and Communications Security, 2024, pp. 4361–4375.
[23] J. H. Cheon, K. Han, A. Kim, M. Kim, and Y. Song, “Bootstrapping for approximate homomorphic encryption,” in Advances in Cryptology – EUROCRYPT 2018, 2018, pp. 360–384.
[24] J. H. Cheon, M. Kang, T. Kim, J. Jung, and Y. Yeo, “Batch inference on deep convolutional neural networks with fully homomorphic encryption using channel-by-channel convolutions," IEEE Transactions on Dependable and Secure Computing, vol. 22, no. 2, pp. 1674–1685, 2025.
[25] P. Vepakomma, O. Gupta, T. Swedish, and R. Raskar, “Split learning for health: Distributed deep learning without sharing raw patient data,” arXiv preprint arXiv:1812.00564, 2018.
[26] D. Pasquini, G. Ateniese, and M. Bernaschi, “Unleashing the tiger: Inference attacks on split learning,” in Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, 2021, pp. 2113–2129.
[27] X. Niu et al., “PrivaScissors: Enhance the privacy of collaborative inference through the lens of mutual information,” arXiv preprint arXiv:2306.07973, 2023.
[28] N. D. Pham, K. T. Phan, and N. Chilamkurti, “Enhancing accuracy–privacy trade-off in differentially private split learning,” IEEE Transactions on Emerging Topics in Computational Intelligence, vol. 9, no. 1, pp. 988–1000, 2025.
[29] T. Khan, M. Budzys, and A. Michalas, “Split happens: Combating advanced threats with split learning and function secret sharing,” in IEEE Conference on Communications and Network Security (CNS), 2025, pp. 1–9.
[30] G.-L. Pereteanu, A. Alansary, and J. Passerat-Palmbach, “Split HE: Fast secure inference combining split learning and homomorphic encryption,” arXiv preprint arXiv:2202.13351, 2022.
[31] K.-Y. Lam, X. Lu, L. Zhang, X. Wang, H. Wang, and S. Q. Goh, “Efficient FHE-based privacy-enhanced neural network for trustworthy AI-as-a-service,” IEEE Transactions on Dependable and Secure Computing, vol. 21, no. 5, pp. 4451–4468, 2024.
[32] J. H. Cheon, A. Kim, M. Kim, and Y. Song, “Homomorphic encryption for arithmetic of approximate numbers,” in Advances in Cryptology – ASIACRYPT 2017, 2017, pp. 409–437.
[33] E. Rescorla, “The transport layer security (tls) protocol version 1.3,” RFC 8446, 2018. [Online]. Available: https://www.rfc-editor.org/rfc/rfc8446
[34] F. Schroff, D. Kalenichenko, and J. Philbin, “FaceNet: A unified embedding for face recognition and clustering,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015, pp. 815–823.
[35] ETSI, “Multi-access edge computing (MEC); study on MEC security,” European Telecommunications Standards Institute, Tech. Rep. GR MEC 041 V3.1.1, 2024. [Online]. Available: https://www.etsi.org/deliver/etsi_gr/mec/001_099/041/03.01.01_60/gr_mec041v030101p.pdf
[36] —, “Multi-access edge computing (MEC); framework and reference architecture,” European Telecommunications Standards Institute, Tech. Rep. GS MEC 003 V4.1.1, 2024. [Online]. Available: https://www.etsi.org/deliver/etsi_gs/mec/001_099/003/04.01.01_60/gs_mec003v040101p.pdf
[37] F. McKeen, I. Alexandrovich, I. Anati, D. Caspi, S. Johnson, R. Leslie-Hurd, and C. Rozas, “Intel software guard extensions (Intel SGX) support for dynamic memory management inside an enclave,” in Proceedings of the Hardware and Architectural Support for Security and Privacy 2016, 2016.
[38] M. Sabt, M. Abi Aad, and J. Pellegrino, “Trusted execution environment: What it is, and what it is not,” 2015 IEEE Trustcom/BigDataSE/ISPA, pp. 57–64, 2015.
[39] H. Chen, K. Laine, R. Player, and Y. Xia, “Efficient homomorphic conversion between (ring) LWE ciphertexts,” in Applied Cryptography and Network Security, ser. Lecture Notes in Computer Science, vol. 11464, 2019, pp. 1–18.
[40] V. Lyubashevsky, C. Peikert, and O. Regev, “On ideal lattices and learning with errors over rings,” in Advances in Cryptology – EUROCRYPT 2010, 2010, pp. 1–23.
[41] S. Halevi and V. Shoup, “Algorithms in helib,” in Advances in Cryptology – CRYPTO 2014, 2014, pp. 554–571.
[42] H. Chen, K. Laine, and R. Player, “Simple encrypted arithmetic library – seal v2.1,” IACR Cryptology ePrint Archive, Report 2017/224, 2017. [Online]. Available: https://eprint.iacr.org/2017/224
[43] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-based learning applied to document recognition,” Proceedings of the IEEE, vol. 86, no. 11, pp. 2278–2324, 1998.
[44] A. Krizhevsky and G. Hinton, “Learning multiple layers of features from tiny images,” University of Toronto, Tech. Rep., 2009.
[45] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei, “Imagenet: A large-scale hierarchical image database,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2009, pp. 248–255.
[46] A. Dosovitskiy and et al., “An image is worth words: Transformers for image recognition at scale,” in International Conference on Learning Representations (ICLR), 2021.
[47] D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” arXiv preprint arXiv:1412.6980, 2014, published as a conference paper at ICLR 2015. [Online]. Available: https://arxiv.org/abs/1412.6980
[48] S. Kornblith, J. Shlens, and Q. V. Le, “Do better ImageNet models transfer better?” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 2661–2671.
[49] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga et al., “PyTorch: An imperative style, high-performance deep learning library,” in Proceedings of the Advances in Neural Information Processing Systems (NeurIPS), vol. 32, 2019, pp. 8024–8035.
[50] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou, “Training data-efficient image transformers & distillation through attention,” in Proceedings of the International Conference on Machine Learning (ICML), 2021, pp. 10347–10357.
[51] L. N. Smith and N. Topin, “Super-convergence: Very fast training of neural networks using large learning rates,” in Artificial Intelligence and Machine Learning for Multi-Domain Operations Applications, vol. 11006, 2019.
[52] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz, “mixup: Beyond empirical risk minimization,” in International Conference on Learning Representations (ICLR), 2018.
[53] S. Yun, D. Han, S. J. Oh, S. Chun, J. Choe, and Y. Yoo, “Cutmix: Regularization strategy to train strong classifiers with localizable features,” in Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2019.
[54] Z. Zhong, L. Zheng, G. Kang, S. Li, and Y. Yang, “Random erasing data augmentation,” Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, no. 07, pp. 13001–13008, 2020.
[55] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna, “Rethinking the inception architecture for computer vision,” Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818–2826, 2016.
[56] D. Technologies, “Openfhe: Open-source fully homomorphic encryption library,” https://github.com/openfheorg/openfhe-development, 2022, version 1.0.
[57] HomomorphicEncryption.org, “Homomorphic encryption security standard,” HomomorphicEncryption.org, Tech. Rep., 2018. [Online]. Available: https://homomorphicencryption.org/standard/
[58] J.-P. Bossuat, R. Cammarota, J. H. Cheon, I. Chillotti, B. R. Curtis, W. Dai, H. Gong, E. Hales, D. Kim, B. Kumara, C. Lee, X. Lu, C. Maple, A. Pedrouzo-Ulloa, R. Player, L. A. Ruiz Lopez, Y. Song, D. Yhee, and B. Yildiz, “Security guidelines for implementing homomorphic encryption,” Cryptology ePrint Archive, Paper 2024/463, 2024. [Online]. Available: https://eprint.iacr.org/2024/463
[59] X. Jiang, M. Kim, K. Lauter, and Y. Song, “Secure outsourced matrix computation and application to neural networks,” in Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security (CCS), 2018, pp. 1209–1222.
[60] M. Kim, X. Jiang, K. Lauter, E. Ismayilzada, and S. Shams, “Secure human action recognition by encrypted neural network inference,” Nature Communications, vol. 13, no. 1, p. 4799, 2022.
[61] W.-j. Lu, Z. Huang, C. Hong, Y. Ma, and H. Qu, “PEGASUS: Bridging polynomial and non-polynomial evaluations in homomorphic encryption,” in 2021 IEEE Symposium on Security and Privacy (SP), 2021, pp. 1057–1073.
[62] T. Weyand, A. Araujo, B. Cao, and J. Sim, “Google landmarks dataset v2 – a large-scale benchmark for instance-level recognition and retrieval,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020, pp. 2575–2584.
[63] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, G. Krueger, and I. Sutskever, "Learning transferable visual models from natural language supervision," in Proceedings of the 38th International Conference on Machine Learning (ICML), 2021, pp. 8748–8763.

Fig. 6: Illustration of query encoding with power-of-two padding and slot replication. The feature vector f is padded to with , then replicated across S slots to form with .
APPENDIX A ENCODING WORKFLOW ILLUSTRATIONS
This appendix collects the main encoding workflow illustrations used to support the query encoding, RowHyDiag matrix encoding, and bias encoding procedures described in Section III of the main manuscript, specifically Fig. 6, Fig. 7, and Fig. 8. These figures first show the square-case layouts, which provide the basic intuition for padding, slot replication, row packing, and bias placement.
APPENDIX B NON-SQUARE ENCODING EXAMPLES
Building on the square-case illustrations in Appendix A, this appendix provides non-square examples that clarify how the same RowHyDiag and bias-encoding rules apply when the number of rows and columns are not equal.
For a representative non-square case, we consider an original weight matrix of size under CKKS slot size . Column alignment gives , and row packing with produces a packed matrix of size . To enable power-of-two scheduling in subsequent encrypted computation, the packed matrix is then padded to rows, yielding . Fig. 9 visualizes this full pipeline (row packing, row padding, and blockwise diagonal extraction) and clarifies how non-square dimensions map to the packed CKKS layout.
For the same non-square setting (, , ), bias encoding follows the same block structure used by packed matrix-vector accumulation. The bias vector is mapped by , so valid class biases are placed at the leading positions of each block and all remaining slots are zero-filled. Fig. 10 illustrates this block-aligned placement, which ensures that ciphertext-plaintext bias addition remains index-consistent with the reduced accumulator slots.
APPENDIX C AUTOMATED DATASET CONSTRUCTION WITH DUAL VERIFICATION
This appendix presents the general data-construction methodology used in this work, i.e., web crawling, semantic filtering, and visual verification. The goal is to describe a reusable pipeline design independent of any specific dataset.
To build a high-quality image dataset, we design a collection pipeline consisting of web crawling and dual-stage filtering. The pipeline ensures that collected images are diverse, visually relevant, and suitable for deep learning training. We first define target classes with distinguishable visual characteristics, then crawl publicly available images licensed for academic use, and finally apply two filtering stages to remove irrelevant or low-quality samples.
Data Crawling: Some prior works have crawled images from Flickr, Wikimedia Commons, and Google Images. A commonly used source is Flickr (e.g., Oxford Buildings and Paris datasets), where data are collected through the Flickr REST API using text queries, tags, and license filters. Wikimedia Commons is also widely used; for example, Google Landmarks Dataset v2 [62] is built from web-scale landmark sources. Because Flickr API access became restricted to Pro subscribers from August 2024, our framework uses Wikimedia Commons API category crawling. For each target class, we collect candidate images via category traversal and retain only Public Domain or research-permitted licensed content.
Semantic Verification: Crawled images may still include irrelevant content due to ambiguous names, incorrect tags, or noisy categories. We therefore use CLIP ViT-B/32 [63] for semantic filtering. For each class, we define multiple text prompts based on class names and characteristics, embed both text and images into CLIP space, compute similarities, and keep an image only if its maximum prompt similarity exceeds a predefined threshold.
KNN-Based Visual Verification: Even after semantic filtering, some images may remain visually mismatched (e.g., cartoons, misleading metadata, or unrelated scenes). We therefore apply a second stage based on visual similarity to high-quality reference galleries. For each candidate image, we compute similarity scores against gallery embeddings, retrieve the top-k neighbors above threshold, and keep the image only if at least of the k nearest neighbors belong to the target class.
APPENDIX D AUSTRALIAN LANDMARKS DATASET CONSTRUCTION STATISTICS
Building on the general pipeline in Appendix C, this appendix instantiates the same process for the 9-class Australian landmarks dataset and reports the final quantitative statistics used in the main experiments.
A. Dataset Collection and Construction
To evaluate our privacy-preserving landmark recognition framework, we construct a dataset of 9 Australian landmarks using the two-stage verification pipeline. The primary crawler source is the Wikimedia Commons API, which provides
Row packing

Blockwise Diagonal Extraction
Fig. 7: Illustration of RowHyDiag matrix encoding. Row packing (square example): rows of are packed to form with and . Pad to rows: is aligned as the padded packed matrix. Blockwise diagonal extraction: diagonal plaintexts and are generated for encrypted linear-layer evaluation.

Fig. 8: Square-case bias encoding illustration ( example).
public-domain and Creative Commons licensed images suitable for academic research.
We first identify Wikimedia category pages for each target landmark (e.g., Category: Sydney_Opera_House, Category: Uluru), then recursively traverse categories and subcategories to collect candidate images and metadata. For each image, we retain only samples with licenses permitting research use, enforce a minimum resolution of , and remove duplicates using MD5 hash matching.
The remaining candidates are filtered in two stages. Stage 1 (CLIP semantic verification): with 9 landmarks and 4 prompts per landmark, we build 36 prompts and compute image-text similarity using CLIP [63]. A sample is accepted only if its maximum similarity exceeds and the highest-scoring prompt belongs to the correct landmark class. Stage 2 (reference-gallery visual verification): we run kNN retrieval against landmark-specific reference galleries selected for viewpoint and illumination diversity. A sample is accepted only if
TABLE VI: Dual-stage filtering pipeline statistics
| Landmark | Crawled | Stage 1 Passed | Stage 2 Passed | Final Accepted |
|---|---|---|---|---|
| Sydney Opera House | 2,660 | 2,023 | 1,943 | 1,943 |
| Sydney Harbour Bridge | 2,522 | 1,959 | 1,836 | 1,836 |
| Uluru | 804 | 772 | 760 | 760 |
| Great Ocean Road | 1,601 | 1,345 | 1,277 | 1,277 |
| Great Barrier Reef | 2,112 | 1,762 | 1,700 | 1,700 |
| Blue Mountains | 780 | 570 | 521 | 521 |
| Flinders Street Station | 669 | 579 | 563 | 563 |
| Parliament House | 597 | 462 | 442 | 442 |
| Surfers Paradise | 1,156 | 973 | 842 | 842 |
| Total | 12,901 | 10,445 | 9,884 | 9,884 |
Filtering Effectiveness:
Stage 1 pass rate: 80.96% (CLIP semantic filter)
Stage 2 pass rate: 94.63% (Reference visual filter)
Overall pass rate: 76.62% (Dual-stage combined)
at least of its nearest neighbors belong to the target class and exceed cosine similarity threshold . Table VI summarizes filtering statistics, and Table VII reports the final train/test split. In Table VI, the Stage 2 and Final columns are identical because no additional filtering is applied after Stage 2. The Australian Landmarks dataset is published on Hugging Face at https://huggingface.co/datasets/huyn1602/Australian_Landmarks_Dataset.
APPENDIX E
CONVERGENCE ANALYSIS OF MODEL FINE-TUNING
This appendix reports convergence behavior for all fine-tuned models to confirm that each reaches a stable operating
Row packing

Blockwise Diagonal Extraction
Fig. 9: Non-square-case workflow of RowHyDiag encoding ( example). Row packing: rows of W are packed to form a matrix with and (). Pad to rows: the packed matrix is zero-padded to with . Blockwise diagonal extraction: diagonal plaintexts are generated from for encrypted matrix-vector computation.

Fig. 10: Non-square bias encoding example. The original bias vector is distributed across blocks of size . Block 0 contains biases at positions 0, 1, 2, while block 1 contains biases at positions 16, 17, 18. Remaining positions are zero-padded.
point before encrypted inference. Fig. 11 consolidates training and validation convergence across all four datasets and shows stable behavior without erratic validation fluctuations.
For MNIST (Fig. 11(a)), convergence is rapid: by epoch 12, training and validation accuracies reach and , respectively, with a very small gap. For CIFAR-10 (Fig. 11(b)), the model reaches training and validation accuracy at epoch 20; the larger but still controlled gap is consistent with higher natural-image variability and task difficulty compared with MNIST. For CIFAR-100 (Fig. 11(c)), ViT-B/16 converges more gradually under stronger augmentation and One-Cycle scheduling, with training accuracy increasing from to and validation accuracy from to over 100 epochs; the best validation point is
TABLE VII: Final dataset statistics (train/test split)
| Landmark | Train (80%) | Test (20%) |
|---|---|---|
| Sydney Opera House | 1,554 | 389 |
| Sydney Harbour Bridge | 1,468 | 368 |
| Uluru | 608 | 152 |
| Great Ocean Road | 1,021 | 256 |
| Great Barrier Reef | 1,360 | 340 |
| Blue Mountains | 416 | 105 |
| Flinders Street Station | 450 | 113 |
| Parliament House | 353 | 89 |
| Surfers Paradise | 673 | 169 |
| Total | 7,903 | 1,981 |
at epoch 87.
For the Australian landmarks dataset (Fig. 11(d)), ResNet-34 improves from to training accuracy and from to validation accuracy across 35 epochs, with the best checkpoint at epoch 33 (93.92% validation accuracy). Overall, these results confirm that all selected checkpoints (99.47% MNIST, 97.05% CIFAR-10, 92.69% CIFAR-100, and 93.92% landmarks) provide stable and reliable feature representations for encrypted final-layer inference. This is important because the encrypted stage evaluates only the final classifier on extracted embeddings; therefore, post-training convergence directly determines the performance upper bound of encrypted inference.
Training and Validation Accuracy on MNIST

(a)
Training and Validation Accuracy on CIFAR-10

(b)
Training and Validation Accuracy on CIFAR-100

(c)
Training and Validation Accuracy on Australian Landmarks

(d)
Fig. 11: Fine-tuning convergence across all evaluated datasets: (a) MNIST, (b) CIFAR-10, (c) CIFAR-100, and (d) Australian landmarks. ResNet-34 on MNIST, CIFAR-10, and Australian landmarks converges quickly with small train–validation gaps, while ViT-B/16 on CIFAR-100 converges more gradually but remains stable at a high-accuracy operating point.