Privacy-preserving neural networks with Homomorphic encryption: Challenges and opportunities

Classical machine learning modeling demands considerable computing power for internal calculations and training with big data in a reasonable amount of time. In recent years, clouds provide services to facilitate this process, but it introduces new security threats of data breaches. Modern encryption techniques ensure security and are considered as the best option to protect stored data and data in transit from an unauthorized third-party. However, a decryption process is necessary when the data must be processed or analyzed, falling into the initial problem of data vulnerability. Fully Homomorphic Encryption (FHE) is considered the holy grail of cryptography. It allows a non-trustworthy third-party resource to process encrypted information without disclosing confidential data. In this paper, we analyze the fundamental concepts of FHE, practical implementations, state-of-the-art approaches, limitations, advantages, disadvantages, potential applications, and development tools focusing on neural networks. In recent years, FHE development demonstrates remarkable progress. However, current literature in the homomorphic neural networks is almost exclusively addressed by practitioners looking for suitable implementations. It still lacks comprehensive and more thorough reviews. We focus on the privacy-preserving homomorphic encryption cryptosystems targeted at neural networks identifying current solutions, open issues, challenges, opportunities, and potential research directions.

unauthorized third-party. Data outsourcing implies that the user delegates direct data control and its processing. The user requires greater trust in Cloud Service Providers (CSP) because dishonest behavior can compromise the data. In general, new threats appear since more data is outsourced.
Security and privacy are critical issues for preserving integrity, reliability, and availability in a cloud computing environment. Privacy and efficient data processing are important research areas in the field of outsourcing computing. Traditionally, encryption of confidential information was the standard solution before the use of the cloud model. It may protect user data privacy from a non-trustworthy third-party, but it cannot support effective ciphertext computing.
In this respect, data in use is a phase of the data life cycle in modern data security practices that goes overlooked. Conventional cryptosystems successfully protect stored data and data in transit but do not protect the data while decrypted to be processed. The data value extraction requires decryption, creating critical exposure points. As a result, privacypreserving techniques are emerging as a key consideration in data analytics and cloud computing domains. The general idea is to delegate data processing without giving transparent access to it.
Fully Homomorphic Encryption (FHE) has been dubbed the holy grail of cryptography, an elusive goal that could solve cybersecurity problems [2][3][4]. FHE allows a non-trustworthy third-party to process encrypted information without disclosing confidential data. Since the remote server only sees encryptions and never has access to the secret key, users can be assured that it does not learn anything about their data or the computation output. This is an extremely valuable opportunity in the world of distributed computing and heterogeneous networks.
FHE enables applying basic mathematical operations directly to the ciphertext so that the decrypting of the ciphertext results in the same answer as applying the operations to the original unencrypted data. In other words, FHE enables compatibility between two critical factors: computing and privacy.
Today, the promising post-quantum tool based on HE is technically feasible for real-world domains, after years of being considered a purely theoretical problem [5]. However, its implementation exhibits several limitations in performance. A long-pursue application is a privacy-preserving machine learning model for predicting or classifying confidential information. These systems promise to work with encrypted data and have the same performance as their unencrypted versions, providing security and accuracy at the same time.
A critical limitation of the extensive adoption of machine learning is the low protection of sensitive information. In most cases, access to the datasets is forbidden due to privacy concerns, e.g., accessing medical datasets is a privacy violation of the patients. In such a domain, the privacy-preserving Neural Network (NN) models via Homomorphic Encryption (NN-HE) come to place.
In this paper, we consider the current state-of-art NN-HE systems focusing on the followings aspects: & Latest issues related to the intersection of HE cryptosystems and NN models, and ways to overcome privacy and security threats arisen in present-day computing environments; & Fundamental concepts of NN-HE, main theoretical results, capabilities, potential applications, and limitations, discussing their state-of-the-art and the state-of-thepractice; & Important compromises between theoretical models and their feasibility, showing tendencies of combining their potentialities; & High-level and low-level tools, frameworks, interfaces, languages, libraries, etc.; & Privacy-preserving NN-HE development by retrieving academic publications in the last fifteen years to detect emerging trends in research and relevant application domains; & NN-HE implementations using high-level and low-level tools to demonstrate the advantages and disadvantages of each approach.
This survey aims to give a knowledge basis to researchers and practitioners interested in knowing, applying, and extending NN-HE models.
The paper is structured as follows. Section 2 reviews the evolution of homomorphic encryption schemes. Section 3 provides the formal definition of fully homomorphic encryption and describes fundamental concepts, such as bootstrapping and key-switching. Section 4 discusses the state-of-the-art of homomorphic cryptosystems and machine learning. Section 5 addresses privacy-preserving NN-HE, focusing on challenges and opportunities towards a blind noninteractive classification. Section 6 presents NN-HE applications in real-world problems and current development tools. Section 7 presents NN-HE implementation examples using both high-level and low-level tools. Section 8 summarizes open research problems and challenges. Finally, we conclude and discuss future works in Section 9.

Homomorphic encryption
In this section, we discuss basic concepts of HE and their evolution based on representative works in the area.
In the cryptography field, the term HE defines a kind of encryption system able to perform certain computable functions over ciphertexts. The output maintains the features of the function and input format. The system has no access to information on the ciphertexts and secret keys. It only uses publicly available information without risks of the data breach. The HE concept refers to a mapping between functions on the space of messages and ciphertexts. A homomorphic function applied to ciphertexts provides the same (after decryption) result as applying the function to the original unencrypted data.
Let m 1 and m 2 be messages, c 1 and c 2 be their corresponding ciphertexts. The operation :: þ in an additively HE produces the ciphertext c þ ←c 1 :: þ c 2 that can be decrypted to m 1 + m 2 .
Similarly for :: Â in a multiplicatively HE, it generates the ciphertext c Â ←c 1 :: Âc 2 that is decrypted to m 1 · m 2 . Both HEs obtain ciphertexts c + and c × , without knowing m 1 and m 2 . Conventional encryption cannot compute m 1 + m 2 and m 1 · m 2 without the decryption of c 1 and c 2 first, when users sacrifice their privacy.
The HE is categorized according to the list of specific basic mathematical operations executed over encrypted data. The efficiency and flexibility of HE are strongly related to the number of operations in the list. A HE scheme with a higher number is more flexible but less efficient. In the opposite direction, a scheme with a lower number is less flexible but more efficient.
In the following sections, we describe three types of HE cryptosystems: Partially Homomorphic (PHE), S o m e w h a t H o m o m o r p h i c ( S H E ) , a n d F u l l y Homomorphic (FHE) encryptions, and discuss their limitations and scopes.

Partially homomorphic encryption
PHE supports an unlimited number of one type of operation. For example, additive HE allows an unbounded number of additions but no multiplications. Ronald Rivest, Adi Shamir, and Leonard Adleman (RSA) cryptosystem is the first multiplicative PHE [6]. In general, given two messages m 1 and m 2 and their respective ciphertexts c 1 ¼ m e 1 À Á mod n, and c 2 ¼ m e 2 À Á mod n, where e is chosen such that gcd(e, ϕ) = 1 for ϕ = (q 1 − 1) · (q 2 − 1) with large primes q 1 and q 2 , and n = q 1 · q 2 . The ciphertext with the product of the original plaintexts is computed as RSA is not semantically secure as a result of its deterministic encryption algorithm. Taher El-Gamal is another relevant multiplicative PHE [7]. Shafi Goldwasser and Silvio Micali (GM) cryptosystem is the first additively PHE [8]. According to GM cryptosystem, there are two message m 1 and m 2 and their respective ciphertexts c 1 ¼ b 2 1 Á e m 1 À Á mod n and c 2 ¼ b 2 2 Á e m 2 À Á mod n, where b 2 1 and b 2 2 are quadratic nonresidue values such that gcd b 2 1 ; n , and e is one of the quadratic nonresidue modulo n values with (x/n) = 1.
The GM scheme has a homomorphic property, where the encryption of m 1 + m 2 , is However, GM is not an efficient scheme, as ciphertexts may be several hundred times larger than the initial plaintexts.
The encryption process in PHE does not guarantee a given level of security. The worst-case hardness of "noisy" problems is one direction in the security solution. The noise term denotes a moderate quantity of error injected in the encrypted message and generates a not exact relation [16].

Somewhat homomorphic encryption
SHE supports a predetermined amount of different homomorphic operations, limiting the number of allowed operations. Each operation increases the underlying noise, so its correct evaluation depends on performing only a bounded number of actions. Message decryption fails when noise overpasses a certain threshold.
Dan Boneh, Eu-Jin Goh, and Kobbi Nissim (BGN) scheme [17] was the first approach that allowed both additions and multiplications with constant-size ciphertexts. BGN hardness is based on the subgroup decision problem [18], which decides whether an element is a member of a subgroup G p of group G of order n = q 1 · q 2 . In BGN, ciphertexts c 1 ¼ g m 1 Áh e 1 and c 2 ¼ g m 2 Á h e 2 encrypts m 1 and m 2 messages, where g and u are two random generators from G, h ¼ u q 2 is a random generator of the subgroup of G of order q 1 and random numbers e 1 and e 2 from the set {0, 1, …, n − 1}.
The encryption of m 1 + m 2 is computed as :: Nonetheless, BGN is impractical due to it computes c × only once using the bilinear map property, which maps s : G × G = G 1 , where G 1 is a group of order n = q 1 · q 2 .
Let g 1 = s(g, g) and h 1 = s(g, h), where g 1 is of order n and h 1 is of order q 1 . Thus, there is α such that h ¼ g αq 2 .
The encryption of m 1 · m 2 is computed as :: where m 1 e 2 + e 2 m 1 + αq 2 e 1 e 2 + e is uniformly distributed in ℤ N , and c × is uniformly distributed encryption of (m 1 · m 2 ) mod n, but now in G 1 rather than G. However, BGN is still additively homomorphic in G 1 . Figure 1 presents a timeline of the most relevant inventions in the history of HE up before the first Gentry's FHE scheme in 2009 [3]. SHE approaches are proposed by Andrew Yao [19] in 1982, Tomas Sander, Adam Young, and Moti Yung (SYY) [20] in 1999, and Yuval Ishai and Anat Paskin (IP) [21] in 2007. They have several advantages and disadvantages concerning the number of operations, ciphertexts redundancy, processing efficiency, and vulnerability to attacks. In general, they are either insecure or impractical, but they are the basis for FHE.

Fully homomorphic encryption concept
Gentry [3] presents the first FHE scheme after 30 years of countless advances in the field when researches began with the invention of the public key cryptography in 1976 [22].
He builds a bootstrappable SHE with hardness based on the I d e a l C o s e t P r o b l e m ( I C P ) . T h e s c h e m e c a n homomorphically evaluate its decryption function. The construction of the SHE uses the notion of the ideal in the lattice algebra. The ideal I in the ring Z[x]/(f(x)) with f(x) of degree n satisfies a + b ∈ I and r × a ∈ I for all a, b ∈ I and ∈Z[x]/(f(x)).
The scheme encrypts plaintexts m 1 and m 2 in ciphertexts c 1 ¼ ψ 1 ð Þ mod B pk J a n d c 2 ¼ ψ 2 ð Þ mod B pk J , where ψ 1 ← samp(B I , m 1 ) and ψ 2 ← samp(B I , m 2 ) samples from the coset I + m 1 and I + m 2 , respectively, and B pk J defines a secrete base for some ideal J in a ring R with a basis B I of I, for relative primes I and J.
Encryption of m 1 + m 2 is computed as It becomes an object of optimization study and the basis of new approaches to solve performance and implementation problems [23][24][25][26][27].
After ten years, the advance in FHE is grouped into four main families: Ideal Lattice-based, over integers, Learning with Error based, and Nth-Degree Truncated Polynomial Ring Unit (NTRU)-based.
The continuous improvements and new approaches increase the efficiency and performance of FHE schemes. However, the contributions involve complicated designs, large keys, low computing efficiency, and high computing complexity.
The high overhead of performing additions and multiplication makes FHE impractical in real-world applications. To have a better understanding of the scopes and limitations of FHE schemes, we describe their most significant aspects in the next section.

Fully homomorphic encryption
The arrival of the first FHE scheme had a significant impact on the design of more secure systems, but not in their implementations. The high level of security in an FHE solution can enhance many technologies, e.g., outsourcing computing in cloud environments. But, the efficient implementation of the FHE is far away due to several limitations. This section introduces the formal definition of FHE and fundamental concepts, such as bootstrapping and key-switching.
The privacy homomorphism term was introduced by Rivest [35] to describe FHE formally; the main idea focuses on the arbitrarily computing of encrypted data without using the decryption key [3]. The concept of FHE does not involve the obfuscation characteristic, where a scheme is capable of hiding a sequence of l instructions called program P, P = {I 1 , I 2 , …, I l }. In such a way, given a plaintext input m and program P, O P ð Þ ¼ b P is an obfuscation transformation of P if only if b P and P have the same observable behavior. More precisely, if P fails or terminates with an error condition, then b P may or may not terminate; otherwise, P m ð Þ ¼ b P m ð Þ. For more detailed information and additional considerations on obfuscating transformations, refer to [36].
A third-party can process b P m ð Þ without learning about b P. The major disadvantage of the approach is the possibility to learn about the relation between m and b P m ð Þ. In contrast to FHE, where the third-party can process an encrypted version of P(m) but cannot decrypt m and b P m ð Þ: The general idea behind FHE is that the function f can be efficiently expressed as a circuit that processes homomorphically encrypted data, e.g., programs, mathematical operations, etc. [3].
FHE is considered a promising post-quantum tool [5]. Current public-key cryptography is based on the hardness of solving problems such as factoring or discrete logarithms. These widely studied problems are believed to be hard to settle on a classical computer. However, an adversary equipped with a sufficiently large quantum computer can solve them easily. While the quantum computer does not exist today, its potential is considered a threat.
The essence of FHE is to produce the output of a ciphertext f(c) for any desired function f and encrypted message c of plaintext m, as long as no information about c, f(c), and m can be leaked. The function f can be efficiently computed. The expected operation of an FHE scheme ε as the classic black box model in computer systems is clarified by Fig. 3.
The challenging task is to find the appropriate mechanism Evaluate ε that satisfactorily leads to the output in a suitable time.
The following sections clarify concepts as Encrypt ε and Evaluate ε and describes additional fundamental elements, such as bootstrapping and key-switching.

Notation
Formally, an FHE scheme ε defines a conventional public-key scheme with four operations: KeyGen ε , Encrypt ε , Decrypt ε , and Evaluate ε [3]. The computational complexity of all ε operations must be polynomial with respect to a security parameter λ, where: & KeyGen ε takes λ as input and produces a public key pk and secret key sk as outputs, where pk maps from a plaintext space ℙ to a ciphertext space ℂ and sk in the opposite direction. & Encrypt ε uses pk and a plaintext m ∈ ℙ as inputs and produces a ciphertext c ∈ ℂ as output. & Decrypt ε defines the opposite process of Encrypt ε , it receives sk and c ∈ ℂ as inputs and outputs the plaintext m ∈ ℙ. & Evaluate ε takes as input pk, a circuit δ ∈ δ ε , and a tuple of ciphertexts C = 〈c 1 , …, c t 〉 that encrypt M = 〈m 1 , …, m t 〉 for the input wires of δ; it outputs a ciphertext C ′ ∈ ℂ, such that Decrypt ε (sk, C′) = δ(M).
Hence, given C that encrypt M, the desired functionality of Evaluate ε operation is to obtain the ciphertext C ′ ← Evaluate ε (pk, δ, C) that encrypts δ(M) under pk, where δ(M) defines the output of δ on unencrypted messages of M. Additionally, the correctness and compactness properties are fundamentals in the formal definition of an FHE scheme.
They can be expressed using the four basic operations defined above. Definition 1. Correctness A HE scheme ε is correct for circuits in δ ε if, for any key-pair (sk, pk) ← KeyGen ε (λ), any circuit δ ∈ δ ε , and any ciphertexts C = 〈c 1 , …, c t 〉 where c i ← Encrypt ε (pk, m i ) for plaintexts M = 〈m 1 , …, m t 〉, it is the case that: Definition 2. Compactness A HE scheme ε is compact if there is a polynomial f such that, for every value of the security parameter λ, Decrypt ε can be expressed as a circuit D ε of size at most f(λ). Now, let ε be compact and also correct for all circuits in δ ε , it is said that ε "compactly evaluates" δ ε .
Definition 3. Fully Homomorphic Encryption A HE scheme ε is fully homomorphic if it compactly evaluates all circuits, i.e.: Decrypt ε sk; Evaluate ε pk; δ; Since the first FHE scheme, the term of bootstrapping or "recrypt" function is fundamental. The next section highlights its importance and sketches the process.

Bootstrapping
The security of an FHE scheme resides in hiding the original message with a certain level of noise. Before the FHE introduction, the noise can be removed only by decryption; it limits the number of operations on the ciphertexts. The error grows with each homomorphic operation, and the decryption process is hopeless when the error reaches a threshold.
The notion of bootstrapping is introduced to maintain the error under the threshold. It allows creating the first FHE scheme based on a bootstrappable SHE scheme, i.e., a scheme able to homomorphically evaluate its own decryption function. The recrypt function is the core part of the bootstrapping procedure to reduce the noise in the ciphertexts. It can be applied an unlimited number of times to obtain fresh ciphertexts. So, recryption actions guarantee the correct decryption of the ciphertext after an unbounded number of operations.
In general, the recrypt function encrypts again the ciphertext (the plaintext now is double encrypted), removing the inner encryption by homomorphically evaluating the doubly encrypted plaintext using the encrypted secret key [37].
In other words, recryption refers to the process of executing Evaluate ε function on Decrypt ε , i.e., Evaluate ε ðpk 2 ; D ε ; sk 1 ; c 1 h i ), where pk 2 defines the new public key, D ε is the Decrypt ε function, sk 1 is sk 1 encrypted under pk 2 , and c 1 h i the noisy ciphertext encrypted under pk 1 and pk 2 . Algorithm 1 defines a sufficient process to build an FHE scheme out of SHE; see [3] for more details.
The bootstrapping is a homomorphic encryption scheme able to decrypt itself. The next section provides additional information about this characteristic.

Key-switching
A second secret key is fundamental in the bootstrapping process to encrypt/decrypt a ciphertext homomorphically. In algorithmic terms, bootstrapping can be defined as: where the fresh ciphertext C ′ contains less noise than the original C. sk 1 and C are encrypted under a public key pk 1 and C′ under pk 2 . The encryption of sk 1 is usually referred to as bootstrapping key bk. Key selection is a fundamental piece for the correct operation of the process; the quality in the selection and development of keys is directly proportional to the performance carried out by bootstrapping. There are two alternatives to define bk: encrypt the secret key sk 1 und e r i t s e l f E n c r y p t ε ( p k 1 , s k 1 ) , o r a n o t h e r k e y Encrypt ε (pk 2 , sk 1 ).
In the self-encryption key sk 1 , ciphertexts C and C′ are encrypted under the same key, so the circular security [26] avoids the use of several keys.
In contrast, the key-switching alternative has the advantage of not requiring circular security, but it has to deal with multiple keys. A critical limitation of the key-switching approach is the number of available keys, i.e., n keys allow to achieve only a leveled homomorphism because they allow performing n bootstrapping operations.
Circular security with key-switching is a combination of both approaches. It repeatedly uses a collection of n iterative keys: sk 1 , sk 2 , …, sk n , sk 1 …. , sk n … The major disadvantage of the bootstrapping method is the computational cost. The overhead becomes the main drawback of the practicality of all FHEs. Most of the bootstrapping routines are complex and slow. Even with these limitations, researchers try to affront these disadvantages with techniques of high-performance, distributed, and parallel computing. All the circumstances make cloud computing ideal to receive the benefits of the FHE schemes. The next section delves into a promising long-pursue application for privacy-preserving using homomorphic ciphers in cloud environments.

State-of-the-art
In this section, we review the latest advances in HE and Machine Learning-as-a-Service (MLaaS) fields. First, we highlight the main topics discussed in the published HE reviews. Later, we identify potential areas of opportunity, general limitations of MLaaS, introduce the latest approaches, and discuss open research directions in the area.

HE surveys
HE surveys consolidate significant contributions focusing on performance improvement, new approaches, applications, among others. They provide knowledge foundation and general panorama to researchers interested in applying and extending HE approaches.
Armknecht et al. [37] present the latest advances in the field and discuss relevant terminology and notions. They investigate fundamental concepts related to the implementation and development of HE, particularly in FHE. Naehrig et al. [38] exhibit the advantages of SHE in the medical, financial, and advertising domain; the authors implement a proof-of-concept based on RLWE to evaluate the efficiency and size of ciphertexts. Moreover, Archer et al. [39] list the benefits of FHE or SHE in real-world applications. The authors analyze its use in genomics, health, security, and education domains and present the significant importance of FHE.
Acar et al. [40] provide an exhaustive literature review and open research directions to essential contributions in the field. The survey gives the fundaments and future trends in the domain of HE systems. Martins et al. [41] present the topic from an engineering perspective. The last approaches in the field are analyzed and compared concerning performance and security. Vaikuntanathan [2] covers the development of HE for readers with knowledge in the mathematic field rather than for practitioners, similarly to Parmar et al. [42], Soitha and Shunmuganathan [43], and Gentry [44].
Aguilar-Melchor et al. [45] discuss the implementation of algorithms for signal processing in SHE. Hrestak and Picek [46] describes practical scenarios in the domain of cloud computing for HE. Moore et al. [47] propose an optimization hardware implementation solution of FHE. Table 1 lists the main topics discussed in the HE reviews. It indicates a lack of specialized reviews focused on MLaaS-HE and NN-HE. This is one of the motivations of our work.
The next section presents recent advances in MLaaS-HE. We analyze contributions related to the design of ML modules for processing confidential information.

MLaaS-HE
MLaaS refers to services in cloud computing for deploying machine learning tools [48]. It has emerged as a flexible and scalable solution for the training and prediction remotely. However, its most serious limitation is security and privacy concerns [49]. For example, prediction and classification models can involve extremely sensitive data: medical, advertising, financial, and behavioral, among others.
HE offers an elegant solution to the apparent paradox of security in the cloud. It allows a blind process of encrypted data in a remote server, i.e., the third-party does not learn anything about the input data and output. According to the notation in previous sections: given an HE scheme ε, a model α, and an input pattern p with its correspondent ciphertext e ← Encrypt ε (p), the scheme ε returns a ciphertext s with the evaluation of the model α on the input pattern p, where Decrypt ε (s) = α (p).
Under this assumption, many machine learning models have tried to implementing cryptographic systems for the prediction and classification of confidential information using homomorphic ciphers [50]. For instance, in health, to process encrypted patient data and obtain an encrypted diagnosis.
Naehrig et al. [38] consider the training of a Logistic Regression (LR) model with data protection during the regression coefficients generation. The model enables an efficient message encoding of an approximate polynomial of degree N-1.
Khedr et al. [51] implement Bayesian filters and Decision Trees (DT) for encrypted data using an FHE scheme. The classification model supports ciphertexts multiplication without require key-switching.
Several researchers focus their contributions on HE frameworks capable of enriching the MLaaS paradigm and designing an efficient environment for the arbitrary evaluation of complex NNs over encrypted data.
Dowlin et al. [52] propose CryptoNets to address the challenge of achieving a blind non-interactive classification. The NN uses a SHE scheme for inputs and propagates signals across the network homomorphically. Its performance is limited due to the replacement of the sigmoidal activation function and the computational overhead. Several subsequent works in the literature focus on improving its constraints.
Chabanne et al. [53] solve the limitations of CryptoNets by adding a normalized layer before each activation layer. The implementation is the first to enable a homomorphic evaluation of Deep Neural Networks (DNN). The NN achieved an accuracy similar to the best non-secure versions through an FHE scheme.
Hesamifard et al. [54] develop CryptoDL to prove the possibility to find a lowest degree polynomial approximation of an activation function within a specific error range. Rectified Linear Unit (ReLU), Sigmoid, and hyperbolic Tangent (Tanh) functions are approximated by polynomials.
Badawi et al. [55] present a Convolutional Neural Network (CNN) for image classification with FHE properties on Graphics Processing Units (GPU). The AlexNet accelerates the classification process and maintains security and accuracy; it classifies the MNIST dataset in 1% of the time CryptoNets takes.
Zhang et al. [56] propose a privacy-preserving deep learning model for big data learning in a cloud computing environment. The model is trained with a back-propagation algorithm and uses the BGV homomorphic scheme [26].
Brutzkus et al. [57] develop Low-Latency CryptoNets (LoLa) to improve latency and memory usage over its predecessors. While CryptoNets encodes each image's feature as a separate message, Lo-La encrypts the input vector as a single message. This modification allowed evaluating the same network in a pair of seconds. Takabi et al. [58] consider decentralized scenarios with distributed datasets across multiple parties. The NN uses a polynomial approximation as an activation function. Nonetheless, the recryption process is carried out directly by the client because the implementation has an interactive approach.
Phong et al. [59] introduce an asynchronous Stochastic Gradient Descent (SGD) on a DNN with an additively HE. The approach holds the accuracy with an acceptable increase of the overhead considering the conventional deep learning systems.
Wagh et al. [60] develop the building blocks for a novel protocol of NN with a secure three-party. The model enables the training and inference of several NNs architectures without learning about the data.
There is a key limitation of current HE schemes. They cannot support division operations and comparisons, such as the test of equality/inequality. Number comparison and sign determination are essential operations for implementing cryptographic algorithms in MLaaS [61]. As a consequence, without their substantial development, practical adoption is bounded [62].
One strong direction focuses on designing approximate methods to address these limitations. Babenko et al. [61] introduce a numerical comparison technique in the Residue Number System (RNS) without requiring resourceconsuming non-modular operations. Table 2 presents a comparison of MLaaS-HE related works.
It emphasizes objectives, operational characteristics, approaches, and implemented schemes. Many studies analyze efficiency, additionally to security. A higher level of security increases the use of computational resources, and therefore, implies less efficiency.
The literature review exposes three main challenges of NN-HE research and development: a. Low efficiency. Significant optimization is required in the practical implementation of NN-HEs. High complexity operations, such as bootstrapping and large encrypted messages, are the main sources of low efficiency. b. Reduced number of primitives. Technical characteristics limit the applicability of NN-HE schemes in real-world applications. A major number of operations, increased multiplicative depth, efficient number comparison (sign detection) can expand the adoption of privacypreserving systems. c. Real-world applications. The HE schemes are being used even with problems of performance and the limited number of primitives. ML models can train, predict, and classify confidential information using HE schemes.
In the next section, we focus on relevant aspects of privacypreserving neural networks.

Privacy-preserving neural networks
NNs are achieving remarkable results and are extensively used in multiple domains. However, their implementation can be difficult for inexperienced users. The training process with relatively big datasets can consume many resources and time.
Сloud services can make it easier. The models can be implemented, trained, and deployed on third-party infrastructures with a relative facility [69,70].
The use of a third-party infrastructure reduces the problems of resources and complexity but introduces privacy issues of sensitive information [49,71].
The access of the NN to the raw data can create potential privacy risks. This section presents solutions for solving the apparent paradox by allowing encrypted data to be blindly processed by a remote server.
This section addresses the importance and shortcomings of the homomorphic processing of NNs. The idea is to explain the difficulties of achieving an efficient blind non-interactive classification. First, we provide basic notions in the field of NNs. Later, we present relevant aspects of the implementation of privacy-preserving NN via HE (NN-HE), focusing on the techniques for constructing NN-HE models.

Preliminaries
In the last decades, ML emerged as an essential topic in Artificial Intelligence (AI). Moreover, ML algorithms based on NNs are the primary research potential line. They provide suitable solutions in a wide field of human knowledge. Its massive adoption and generalized use reveal several possible data privacy problems in the construction of a model. An underlying notion of NN is required to understand its issue of privacy.
NN is a computing model system that mimics the behavior of a biological brain. It attempts to identify (to learn) underlying relationships in the information provided by a dataset. The architecture of NN groups a population of neurons in layers and defines the connection between them. The neurons are basic units to process information coming from the external world.
Each neuron consists of n I inputs The value of y defines a weighted sum of the inputs considering the weights w ¼ Þand a bias β. The non-linear activation function f generates the final output of the neuron. The definition of w and f are fundamental problems of NN.  Â. c 0 contains the encrypted output of the neuron computation, it guarantees the privacy of the result even if c 0 is disclosed.
The interaction between neurons is essential for NN performance, the network structure defines the interaction between layers, subsets of grouped neurons. In the network sequence, the layer position establishes a specific role in the processing of data. Typically, NN is composed of three types of layers. The first layer is the input layer. It receives information from outside the network. Internal layers, also called hidden, are not directly accessible from the exterior. The last segment in the NN is the output layer. It transfers information outside of the network.
Neurons can be connected to the neurons of the same layer (self-recurrent), a successive layer (feed-forward), or a previous layer (feedback/recurrent). Hence, a NN could be a recurrent system, as opposed to the purely feed-forward ones, where each neuron is evaluated only once. Throughout this manuscript, we consider feed-forward networks because they are widely used, easier to understand, and simpler to evaluate homomorphically.
The associate weight of a path between two neurons defines the importance of the input in the neuron. Moreover, the degree of connection establishes the number of inputs in the neuron. The most widely used architectures are fully connected, convolutional, max pooling, and mean pooling. The NN-HE does not apply any modification in the structure of the NN.
The selection of an activation function is an essential element in the construction of an effective NN model. It determines the reaction of a neuron to the inputs and information forwarded to the following layers. The most common activation functions are step, sign, sigmoid, ReLU, and Tanh [72]. They contribute to the underlying relationships in a set of data by the learning process.
The definition of an adequate :: f is an open problem. Standard activation functions use operations not supported by HE, so to find cryptographically compatible replacement functions is necessary to operate over encrypted data. Related works provide several examples of approximate activation functions for multiple domains.

Homomorphic training of neural networks
The training process consists of developing a mapping from the input to the output space based on the modification of the weights w of each neuron. The network is able to learn and generalize information based on several examples. The presence of an external entity that controls the learning process is defined as Supervised Learning (SL). Meanwhile. The absence of the entity is denoted as Unsupervised Learning (UL).
In SL, the supervisor adjusts w when the expected output b ϑ and actual output ϑ are different. The loss function L b ϑ; ϑ measures the error between both outputs. In general, the training process is the following: 1) the network receives an input pattern x, 2) it calculates the output ϑ = Net(x) by feeding x forward and performing all the computations until the output layer; 3) the network computes L b ϑ; ϑ , and 4) it modifies the weights to reduce the error. Finally, 5) the network repeats the process several times for all the samples in the dataset. The aim is to find a collection of weights that minimize that error. The NN should provide correct answers after the training process, even in the presence of patterns that are not used to train the model. In the testing phase, the NN is evaluated under a set of examples distinct to the training phase samples. The idea is to avoid the overfitting of the model and measure its efficiency with new information. The general process is an analogy of the human brain evolution during a person's life.
The training consists of computationally intensive tasks, even for non-HE models. Training a NN itself involves a large number of operations toward finding the collection of weights that minimize L b ϑ; ϑ . With HE, it becomes more challenging even with advanced technologies. In the HE domain, the training process implies large encrypted messages and several bootstrapping executions. Its computational complexity is in orders of magnitude of the unencrypted training. For instance, the computational cost of seven-layer CNN training is around one hour with a conventional CPU, while to train the same CNN with HE requires around a year [73]. Hence, training DNNs that can contain tens, hundreds, or sometimes thousands of layers is impractical.
Two options are common to deal with the bootstrapping execution during NN-HE training: its acceleration and exclusion.
High-performance, distributed, and parallel computing provide tools for training over large encrypted datasets. The main tendencies are to use hardware accelerators such as high throughput computing units (GPU, FPGA, etc.) and customized chips (ASIC).
These technologies significantly reduce runtime and can make them comparable to similar unencrypted versions. The use of cloud computing is a cornerstone in this direction.
The first approach of avoiding bootstrapping operations focuses on their substitution by decrypting the ciphertext inside a secure entity (client-server, secured HPC computers, etc.).
F o r i n s t a n c e , T a k a b i [ 5 8 ] p r e s e n t s t h e f i r s t homomorphically trained NN-HE using an interactive approach, where the decryption and encryption process must be carried out directly by the client. It is a hybrid model between Secure Multi-party Computing (SMC) and HE.
The second approach focuses on pre-trained NN-HEs, where the weights of an already trained NN are public. To avoid the overhead of the training phase, it is performed over unencrypted data keeping the evaluation on the encrypted data. It is widely used in current practice.

Homomorphic evaluation of neural networks
The training and testing processes of NNs do not limit access to the raw data. Consequently, legal and ethical requirements may prevent cloud-based solutions for many applications [74,75]. For example, the processing of DNA sequencing remains a complex task, but now it is faster and less expensive due to the methods developed over the last two decades [76].
Two opposing considerations should be evaluated. On the one hand, sharing and processing the genetic sequence with complex NN models could offer much value, such as disease diagnosis. On the other hand, from a privacy perspective, when a person shares his DNA sequence, his siblings or children's DNA is partially shared; it falls into severe problems if such information reaches than unreliable third-parties. We can find analogies of this example with medical, financial, or behavioral data.
The above problem detonated the interest of evaluating arbitrarily complex NNs over encrypted data. One strong direction focuses on the benefit of HE schemes for the processing of information in NN. NN-HE is a natural extension of NN models. The methodology consists of applying HE to the network inputs and propagating the signals across the network homomorphically. The training and inference phases are fundamental in the process of NN with privacy-preserving.
In the inference phase, the model's dimensions are known beforehand, so the number of operations can be estimated apriori.
From a HE perspective, the network represents a leveled circuit where levels are called layers. The cryptosystem allows implementing an encryption scheme with a predefined noise budget, avoiding bootstrapping or any recrypt function. In other words, a leveled HE scheme is enough for the inference phase since the amount of noise supported by the ciphertext is known, and the polynomial functions have a fixed maximal degree on the encrypted data.
Nonetheless, deep learning needs an FHE scale-invariant scheme because it implies many hidden layers in the network. Therefore, a large amount of noise has to be controlled by bootstrapping or any recrypt function. Moreover, only polynomial functions can be computed due to the HE schemes supports only additions and multiplications.
The construction of NN-HE involves two challenges: a computational design of the homomorphic processing of inner network functions and low-degree polynomials manipulation. The following sections delve into both challenges and solutions proposed in the literature.

Homomorphic neurons
NN-NE design involves several aspects of efficient implementations. For example, each neuron performs a weighted-sum y and non-linear activation function f(y). With the HE scheme, multiplication operation is slower and adds large amounts of noise. A bootstrapping operation should be performed when a ciphertext contains too much noise.
The computing of weighted-sum consists of a set of additions and multiplications between known constant weights and ciphertexts. The processing of y can be improved since one of the operands is plaintext and the size of the resultant ciphertext remains the same as the input ciphertext.
Bos et al. [77] encryption scheme can help to clarify this point. It maps plaintext messages from the ring scheme chooses random polynomials f, g∈ R N q , f = (tf ′ + 1) mod q. The public key h is defined as (tgf −1 ) mod q, while f is the secret key. Since not every element in R N q is invertible, these steps are iterated until the corresponding f has an inverse and h can be computed. Encryption of a message m∈R N t , can be defined as c ¼ q t Ä Å m ð Þmod t þ e þ hs Â Ã mod q, where e and s are random noise polynomials in R N q with coefficients of small absolute value. Decrypting is done by computing Here the product f · c is first computed in R N q ; the coefficients are interpreted as integers, scaled by t/q, and rounded to the nearest integers. Finally, they are interpreted as modulo t.
To compute an operation of addition or multiplication between plaintext and ciphertext there are two alternatives: 1) The naive process is computationally intensive and increments the noise. It encrypts the constant and then executes the operation, and 2) an optimized process encrypts the constant without noise and performes the standard homomorphic operation. Let c ¼ q t Ä Å Á m ð Þmod t þ e þ hs Â Ã mod q be the encrypted message and w the plaintext. Addition can be achieved by multiplying w by q/t, and the result is adding to c, which produces Homomorphic multiplication is done similarly. The processing of activation functions in HE is more complicated because most of the functions are not polynomials, such as sigmoid and ReLU functions. Some approaches replace standard functions with the non-linear low-degree square function [52,57]. Nonetheless, the square function's unbounded derivate induces a strange behavior during the training phase with more than two non-linear layers [53].
Multiple approaches address the limitation of activation function represented by polynomial approximation through Taylor series, Chebyshev polynomials, among others [53-55, 58, 78-81]. Since all NN inner functions are continuous, the network can be viewed as a continuous function. If the domain (the input space) is a compact set, then the Stone-Weierstrass theorem [82] establishes that it can be approximated uniformly by polynomials. The challenge is to approximate NN with polynomials of the lowest possible degree.
Let Net() be a network with l layers. If a polynomial of degree d approximates the activation function in each layer, then the polynomial approximation of Net() will be a polynomial of degree d l . Hence, to achieve a low degree polynomial, d and l must be small. Minimizing d is a standard exercise in approximation theory. Even so, optimizing l implies reducing the layers in Net(); this goes against the deep learning current trend.

Data manipulation
Data representation and manipulation in the network is another challenge of the construction and implementation of NN-HE. Each ciphertext c has some noise that hides the message. Hence, c = m + e, where m represents the original message and e defines the noise. Regardless of the data nature to be submitted in these computational models, their encryptions are entries in a polynomial ring.
Mapping integers, floats, binaries, or another number system to polynomials is a standard and widely studied exercise. For example, a conventional mapping technique for integers uses their binary representation; the binary expansion of an integer generates the polynomials' coefficients. However, it is still necessary to achieve a low-degree polynomial representation.
Multiple approaches provide low-degree polynomial representation by applying the Chinese Remainder Theorem (CRT) [52,54,55,57,83], where k primes q 1 , …, q k and a polynomial ∑a i x i define k polynomials in such a way that the jth polynomial is ∑[(a i ) mod t j ]x i .
CryptoNets [52] and AlexNet [55] follow the CRT approach with polynomials of a high degree. They implement a Single Instruction Multiple Data (SIMD) technique where a single polynomial encodes a feature of multiple instances. For example, if the input data are images with a dimension of 28 × 28 pixels, it generates 784 ciphertexts (one per pixel) where the number of images determines the ciphertexts' size. The constructions use the CRT to break the ciphertexts into multiples chunks and process them in parallel. The main contribution of CRT is decreasing the processing time of high degree polynomials.
The SMID approach has several limitations of latency and memory. A single prediction implies many operations since each feature represents a message, and the high number of messages generates memory bottlenecks. It makes unfeasible its implementation in DNN models. The biggest disadvantage is inefficiency. The consumption of computational resources is the same in processing one or a thousand images.
Lo-La [57] employs an alternative representation to reduce the latency and memory usage of its predecessors. It encodes an input vector v of d dimensions as a single message m where m i = v i , for i = 1, …, d. The private prediction of a linear classifier on v requires only a single message and O(logd) operations, in contrast to the d messages and O(d) operations of previous systems for the same classifier. However, the scheme is still dependent on the dimension of the message, and therefore, impractical for real-world applications with highdimension data.
In a nutshell, CryptoNets and Lo-La contributions are the foundations of many types of solutions. Consequent works combine different techniques for the reduction and manipulation of polynomials such as CRT and SIMD, among other methods. Besides, the evolution towards an NN-HE friendly model suggests incorporating GPUs, Field-Programmable Gate Arrays (FPGA), and Application-Specific Integrated Circuits (ASIC). We are dealing with a nascent research area with innumerable potentials and commensurable benefits.

Noise and errors
As shown in previous sections, sometimes HE uses the concepts of noise and error as interchangeable notions. In this section, we differentiate them from each other for better understanding. Broadly, the noise is information injected into data for the generic construction of a public-key cryptosystem. In contrast, the error occurs as part of a rounding error occurring during approximate computations. This section presents the noise and error notions in the context of ML, specifically in NN models.

Noise
The design of NN-HE has to take into account the number of arithmetic operations (addition and multiplication) necessary for its implementation. In BFV [29] and CKKS [34] schemes, the quantity of additions is unlimited, but the amount of multiplications is limited.
The multiplicative depth is the maximal number of homomorphic multiplications, which can be performed on ciphertexts to retrieve the result of these multiplications correctly. The computational complexity of each multiplication and size of the public key depends on the multiplicative depth. Both parameters are increased with increasing depth.
As practice shows, the volume of noise depends on two factors: level keys and implementation.
-Level keys. The upper limit of the multiplicative depth relies on the selected level keys. For example, the PALISADE library offers an algorithm for selecting level keys to change the amount of noise that cannot be removed without decryption or bootstrapping. -Implementation. The maximum number of the multiplicative depth also depends on the algorithm implementation [84]. For instance, the theoretical boundary for multiplicative depth in Halevi et al., [85] and Bajard et al., [86] schemes is the same, but the multiplicative depth of [85] is larger than [86] in practice. Also, the approximate calculations of implementation [85] increase the noise in comparison with exact calculations.
Gentry [3] proposes a mechanism to remove excessed noise through the bootstrapping procedure (See Section 3.2), which can be roughly construed as re-encryption or decryption in encrypted form. Some noise can only be removed with decryption. The amount of noise after the bootstrapping process is greater than in the original ciphertext for FHE over integers [87].
Considering the great computational complexity of bootstrapping, Badawi et al. [55] use a scheme that does not require bootstrapping to implement CNN. A general NN model consists of mathematical convolutions and activation functions. In the best case, the multiplicative depth of the mathematical convolution is equal to one. For the realization of activation, the function is approximated by a polynomial, as HE supports only addition and multiplication.
In the worst case, the multiplicative depth is equal to the binary logarithm of the polynomial plus one. To reduce the multiplicative depth in the polynomial calculating, various techniques are used based on function compositions [88].
The correctness of the result in NN-HE depends on two factors described in the next section.

Errors
Errors in data processing can compromise the correctness of the results. The implementation of NN-HE distinguishes two error classes: algorithmic errors and running errors.
Algorithmic errors. The representation of real numbers with integer polynomials can lead to an incorrect result. An error can occur in numbers in the vicinity of zero, even without adding noise. Converting a value vector to polynomial m(X) can lead to a severe error in calculations. For example, let us consider the CKKS [34]  The example shows that the encoding number − 0.01 turned into 0.00268 when it is decoded. The number obtained during decoding differs in the value and sign, i.e., it does not carry any information about the initial number. Additionally, in this case, increasing Δ allows reducing the absolute value.
As a consequence, an incorrect result using HE with NN is highly probable when the input data are normalized, i.e., the values are compressed up to the interval [0, 1]. Moreover, this kind of error leads to incorrect results when using unstable algorithms [89].
Running errors. The errors of calculations can arise as a result of the polynomial approximation of activation functions of NNs. For instance, let us consider the function ReLU(x) = max(x, 0) = (sgn(x) + 1) · x.
The function max(a, b) returns the maximum value of a and b, where sgn(x) is a sign function. When we calculate ReLU(x), for x < 0, implemented by HE, with the sgn(x) algorithm presented in [88], the function will be greater than zero. Thus, the implementation of NN-HE should be considered rounding errors that may occur.

Applications and tools
In this section, we outline NN-HE implementations in realworld applications and show current tools for its development. First, we illustrate the advances and limitations of HE libraries and highlight NN frameworks. Later, we present a literature analysis to describe the growing interest in the field, the breadth of domains that can benefit from it, and emerging trends.

NN-HE tools
High-quality implementations should complement theoretical research. Industrial and academic groups released several HE libraries in recent years: SEAL, HElib, TFHE, PALISADE, cuHE, HEAAN, HE-transformer, etc. Many implementations are based on RLWE and contain common choices for the underlying rings, error distributions, and other parameters.
Simple Encrypted Arithmetic Library (SEAL) [90] is the most used open-source HE tool supporting BFV and CKKS schemes. It is implemented in C++ with active developments for other languages C#, F#, Python, and JavaScript. SEAL can compress data to achieve significant memory footprint savings.
Homomorphic-Encryption Library (HElib) [91] is an opensource library based on the BGV scheme and developed in C++. It focuses on the effective use of ciphertext packing and data-movement optimizations. One disadvantage of HElib is limited bootstrapping performance.
Faster Fully Homomorphic Encryption (TFHE) [24] is an open-source library sustained in a Ring-variant of the GSW and an alternative representation over the torus. The library in C/C++ implements a very fast gate-by-gate bootstrapping procedure; this mode has no restriction on the number of gates or their composition. PALISADE [92] is an open-source project for the implementation of a HE library with support to BGV, BFV, CKKS, FHEW, and THEW schemes. It was developed with C++ and provided an extension for multi-party. PALISADE takes advantage of RNS algorithms to achieve high performance.
CUDA Homomorphic Encryption (cuHE) [93] is a GPUaccelerated library implemented in C++ for the parallel platform CUDA. Arithmetic functions adopt the CRT, Number-Theoretic Transform (NTT), and Barrett reduction to handle with large polynomial operands.
Homomorphic Encryption for Arithmetic of Approximate Numbers (HEAAN) [34] is a library with supports for the CKKS scheme. It is implemented in C++ with support to fixed-point arithmetic. The approximate operations of rational numbers generate an error that depends on configurable parameters.
Homomorphic Encryption transformer for nGraph (HEtransformer) [94] is a HE project for Intel nGraph Compiler based on SEAL; the implementation in C++ provides a graph compiler for NN. The project is a proof-of-concept to measure the performance of HE schemes for deep learning.
The selection of a specific HE library is a step that requires knowledge of its advantages and disadvantages. Table 3 compares the most common general-purpose HE libraries with their pros and cons. It describes crucial key features for rapid adoption and further development. The selection of an adequate approach of the privacy-preserving tool should consider these essential features.
On the other hand, an important decision in the NN-HE implementation is choosing a framework to deal with the NN model. Table 4 presents the characteristics of popular ML frameworks. Our goal is to emphasize those high-level tools used to compute homomorphic operations. Core language is the primary library language, but most of them use more than one to build the framework. Bindings define official interfaces to support other languages and libraries for different activities: feature extraction, training, etc. GPU indicates the availability of CUDA for GPU computation, a crucial feature for training and testing modern CNNs.
According to Table 4, several works employ toolboxes such as Caffe, Dlib, Pytorch, TensorFlow, and Theano on researches related to CNN over encrypted data. Moreover, it underlines the GPU's use as an essential capability for HE computation. Also, it highlights C++ and Python as key languages in model building.
These efforts towards NN-HE are either insecure or impractical. They suffer from the limitations mentioned in previous sections. They are based on PHE cryptosystems [108,110], compute plaintext and simulate ciphertext performance [99], introduce NN models without multi-party computation support [112], propose interactive NNs [110], or use the mathematical properties of "homomorphism" to NN training, not HE itself [96]. Moreover, all of them use high-level toolboxes solely for pre-process and pre-train NN models.

Literature analysis
The pros and cons of HE libraries do not describe their current study or research. So, an important topic is the analysis of their trends in the field. Moreover, the study of the applications mostly addressed by the research community. A proper and instrumented overview for NN-HE development is of utmost importance. In this section, we start with a method for retrieving relevant works, then we analyze the most prominent terms and, finally, touch upon several emerging trends in the HE domain.
Initial evidence of the interest in HE topics is academic publications' growth in the last fifteen years. Among the vast number of publications, we distinguish the following two types of papers, a. research publications suggesting new HE approaches, or extending and applying an existing one, b. dissertations and thesis addressing HE cryptosystems.
For databases querying, we consider three popular databases as publication sources: ProQuest Dissertations and Theses (PQDT) database, Web of Science (WoS) database, and Google Scholar. Like in many fields, in HE literature, the same notion can be named by multiple terms. To avoid misinterpretations, we consider most of these terms in the database querying, which generally holds in papers.
For PQDT, we performed searches of thesis from the corresponding query: query "(homomorphic) (encryption OR encrypt OR cipher OR encode)". We select "since 2005" and "since 2013" and take all works for each result.
For WoS, we merged the results from the following queries (options "Search by topic" and "All collections" were enabled):  query "(homomorphic) (encryption OR encrypt OR cipher OR encode)". We select "since 2005" and "since 2013" and take all papers for each result, including their citation statistics per year; query "(homomorphic) (encryption OR encrypt OR cipher OR encode) (cryptosystem OR cryptography OR cybersecurity)". We select "since 2005" and "since 2013" and take all papers for each result, including their citation statistics per year.
The last part of the literature analysis consists of highlighting popular applications and tools in the HE area under the premise that a popular theme has more results in a search engine like Google Scholar than a poorly addressed.
We count the papers indexed. Figure 4 presents the number of published articles and thesis (Fig. 4a), and citations (Fig. 4b) related to HE.
The analysis is conducted based on the PQDT as well as the WoS database. PQDT is a comprehensive collection of dissertations and thesis, which offers millions of works from worldwide universities.
Both graphs show a significant increase in publications and citations since 2013 due to the practicability demonstration of the first FHE scheme in 2009 [3] and its implementation in 2011 [4].
The following analysis considers only works written within the last five years due to two main reasons: the publications and dissertations of the last five years include 74% of the total elements. This number provides a reasonable definition of recent works.
A keyword analysis of the thesis and dissertations can guide to identify trending topics in the HE area. We collected the set of keywords from HE-related literature published in the last five years. Figure 5 presents the prevalent terms and the number of times they are included in the research. Two significant elements are identified. First, words closely related to HE concepts such as data, security, privacy, cryptography, privacypreserving, cybersecurity, and lattices are prevalent (see Fig. 5a). The second popular field is associated with: cloud computing, multi-party computing, and secure computing. The characteristics of these environments make them suitable to receive the benefits of HE.
Similarly, but with a different direction, a keyword analysis highlights terms related to HE specific areas of applications. It allows an overview of the emerging research area of applicability. Figure 5b presents the keywords related to particular applications in the HE domain. It can measure popularity by the number of times a term is included in the research. The domains are not mutually exclusive. One study can address a topic in two or more fields. According to Fig. 5b, machine learning and big data are the two most significant fields in the HE domain, mainly due to datasets' sensibility. It also shows health, robotics, biometrics, and genomics as potential areas to adopt these approaches. Smart grid and blockchain propose decentralized security systems of data exchange and processing.
Quantum computing evidences the concern in the cryptographic community to generate post-quantum cryptosystems. Searchable encryption illustrates the need for a system with search capability over encrypted information, i.e., searching without disclosure. The engine does not know what it is looking for, but it does [114]. Also, applications such as image processing, autonomous vehicles, and election guard are prevalent.
Finally, in Fig. 6, we present relevant applications and tools based on the number of related documents provided by the Google Scholar search engine. Our goal is to highlight popular topics under the premise that a popular theme has more results in a search engine than a poorly addressed. Several literature approaches have applied HE schemes to tangible real-world applications in health, genomics, smart government, cyberphysical industrial systems, and education (see more details in [37][38][39]).
Our search includes applications highlighted by the keyword analysis conducted above. It considers keywords such as robotics, biometrics, and financial.  Figure 6b presents the popularity of the HE libraries. The query is performed considering both the library's original name, its abbreviation.
The systematic analysis confirms the research community's emerging interest in the construction of HE machine learning models for handling highly sensitive data and processing encrypted data.
The use of well-known general-purpose tools, such as HElib and SEAL, characterized by the effective execution of homomorphic operations, is widespread. It also underlined tools such as PALISADE or application areas such as biometrics, finance, and robotics.
Previous surveys, to the best of our knowledge, did not distinguish topics of the HE development.
Modern data security practices successfully protect stored data and data in transit from non-trustworthy third-parties but do not protect the data while decrypted to be processed. This vulnerability enables a wide range of potential application lines to develop HE schemes in almost any domain. In a nutshell, we are dealing with a nascent research area in constant

NN-HE implementations
This section presents a comparison of three NN-HE implementations. We use high-level and low-level tools and compare their performance. We show compromise between technologies and highlight combining their potentialities. On one side, several tools are well known and highly validated. But they do not provide the facility to incorporate new data representation and their processing. On the other side, basic development offers more flexibility, but its implementation, validation, and testing are more time-consuming.
Most HE tools are developed in low-level languages, such as C or C++, with the idea of increasing application speed. The main tools for developing NNs are implemented in highlevel languages, such as Python, for quick understanding. NN frameworks have greatly simplified novel methods of development, but their structures are not designed to support alternative information representations.
The objective of NN-HE systems is threefold: accuracy, data security, and computational complexity. Extremely secure models are not useful if they do not offer acceptable accuracy and computational complexity. So, the three objectives should always be presented in the system design. Here, the trade-off between technologies comes into place.
For studying purposes, we use PyTorch [107] as a representative ML tool. It is a deep learning framework used in many papers of top research conferences in the past couple of years. PyTorch has an important prevalent among the research community and industry as well. A friendly and flexible environment is its primary goal. Users can quickly and easily perform experiments on the platform.
An efficient implementation of NN-HE requires flexibility on both NN and HE technologies, combining HE tool potentialities with the PyTorch facilities.
PySyft [115], CrypTen [116], and TenSEAL libraries offer a bridge between the PyTorch platform and many privacypreserving techniques described in a long history of academic research.
We compare the performance of three NNs implemented in PyTorch, SEAL, and a combination of both (SEAL + PyTorch). SEAL is a low-level tool, and PyTorch is a high-level tool, both with high adoption in their respective domains. A combination of both approaches provides a middle point between efficiency and facility of implementation.
The evaluation considers three types of instances: native, small, and large. Native (N) instance corresponds to the original implementations using specifications, parameters, and characteristics proposed in the corresponding papers [52,57]. Small (S) instance has only one convolutional layer. Large instance (L) uses a convolutional network with sixlayer architecture: one convolutional input layer with 28 × 28 input nodes, four hidden layers, and one output fully connected layer with ten neurons (one per digit or class). The difference between a small and large instance lies in the number of convolutional layers. The four hidden layers include one activation layer with pooling, one convolutional, one pooling, and a fully connected activation layer. All neurons use a square activation function.
We use the two datasets that consist of the well-known handwritten digits MNIST (Modified National Institute of Standards and Technology) database and Fashion MNIST (F-MNIST) -MNIST-like dataset of labeled fashion images. They are commonly used for training various image processing systems.
The test set includes 10,000 examples. The analysis is performed on a computer with Windows 10 of 64-bit OS and an Intel(R) Core (TM) i7-8565U CPU 1.8 GHz with 16 GB of memory and 256 GB of SSD. Table 5 presents the accuracy, latency, and memory usage of three CNNs with MNIST and F-MNIST. Latency corresponds to the time required to process a single prediction request. CryptoNets takes the same processing time for one or 4096 predictions. Results show the trade-off between the implemented approaches in memory and latency. The computational resources of the framework implemented in Phyton is compromised concerning other approaches in a language such as C++.
We are at the beginning of a long road ahead exploring the NN-HE field. Several approaches are restricted due to higher computational requirements and complex space of functions. However, the analysis elucidates a competitive accuracy performance of PyTorch + SEAL implementation.
NN-HE is a nascent area with a small number of primitives. However, these primitives can achieve an accuracy similar to the non-secure versions for some cases and under certain circumstances. While MNIST and F-MNIST are datasets smaller than medical or financial ones, like many other complex tasks in modern computing, where NN-HE can take advantage of hardware support such as GPU, FPGA, or ASIC.

Challenges
Although the HE standards, platforms, and implementations presented in this work help advancing NN-HE, there are still some open challenges to be solved: overhead, performance, interoperability, bootstrapping bottlenecks, sign determination, common frameworks, etc.
Overhead. NN-HE has a significant overhead compared with its unencrypted analogous, making it impractical for many applications. The training phase of NN consists of a computationally intensive task for non-HE models. With HE, it becomes more challenging even with advanced technologies. A new tendency is to avoid the training phase by using pre-trained models to achieve a balance between complexity and accuracy.
Parallelization. One way to deal with the computational overhead is to incorporate well-known and new parallelizing techniques. NN-HE models can be adapted to use highperformance computing, distributed systems, and specialized resources. Multi-core processing units (GPU, FPGA, etc.) or customized chips (ASIC) technologies give the possibility of friendlier and efficient NN-HE environments. Another way to improve the overall efficiency is related to the possibility of batching and parallelizing several bootstrapping operations together.
Polynomial Approximation. A crucial challenge in developing NN-HE consists of the computational design for the homomorphic processing of the neuron's inner functions. NN-HE requires operations not supported by HE, so it is necessary to find cryptographically compatible replacement functions to operate over encrypted data.
The activation function is an essential element in the construction of an effective NN-HE. It determines NN-HE accuracy and computational efficiency. Moreover, activation functions have a significant effect on the converging speed of the network. Also, its derivative, also known as gradient, is fundamental in the training phase.
Multiple approaches address the limitation by polynomially approximating non-compatible functions with a cryptographically consistent polynomial form. These functions should exhibit a trade-off between complexity and accuracy, limiting the efficiency of conventional approximation techniques [117].
In practice, an inadequate approximation function can result in poor performance and long processing time of NN-HE. Moreover, it produces larger encrypted messages that increase memory use.
The challenge of designing a cryptographically computable approximation of the activation function is in identifying low-degree polynomial with a minimal error and good accuracy.
Leveled HE schemes. Another vital direction focuses on designing schemes without bootstrapping that supports the NN evaluation of bounded (pre-determined) depth. Such leveled HE schemes dramatically improves performance by removing the bottleneck and complexity generated by the bootstrapping recrypt function. However, this approach limits the deep learning implementation. While it is efficient for bounded NN-HE, the complexity may become undesirably high for deep learning models.
Binary Neural Networks (BNN) are emerged as an area of opportunity to achieve blind non-interactive NN-HE models. Since the space of functions is restricted, the solution should be limited by the number of possible inputs and outputs. In BNN, every layer maps a binary input to a binary output, using a set of binary weights and a binary activation function. For the bias, it applies a batch normalization before each activation function. The input data is binarized using a predefined threshold.
In general, data and weights in non-standard binary representations {−1, 1} can be mapped to binary space {0, 1} by replacing −1 with 0. The weighted-sum can be performed by an element-wise product. It uses the logical operator XNOR and subsequently sums the result of the previous step by counting the number of ones. The binary activation function f(y) returns 1 if y > 0 and −1 otherwise.
Interoperability of existing ML tools is another challenging problem to achieve friendly NN-HE models. Popular NN frameworks have simplified the development of novel NN methods, but they do not provide HE support. The development of NN-HE depends on the current tools and their flexibility to supply or incorporate new approaches. The low flexibility of several HE libraries restricts their interaction with other frameworks. It makes more complicated the design, testing, and implementing new models, hence, increases the development time.
Automatization. The development of HE applications implies manual configuration and high expertise in different domains: scheme-specific optimizations, complicated security parameter setting, low-level programming, among others. Improper setup can generate low performance, encryption insecurity, and corrupted or unrecoverable information. The automatization and simplification of the development lifecycle are required. The implementation should be easily employed by beginners and highly configurable for expert users.
Common framework. Most of the related works focus on specific environments with different characteristics. It limits the possibility of comparing new approaches to state-of-art algorithms. A standard framework can simplify the comparative analysis and show the advantages of new models. It should simplify the adoption of libraries, algorithms, measures, and statistical analysis.

Conclusion
Easy deploying of machine learning in clouds makes homomorphic encryption an important mechanism to solve security and privacy concerns. Many solutions have been proposed in the continuum between theoretical and applied aspects. Theoretical research increases understanding of the problem by developing new theories and algorithms, while applied research is to solve real-world problems in business, medicine, industry, etc.
Although different aspects have been discussed in the literature, a systematic comparison of the state-of-the-art NN-HE solutions has not been conducted.
In this paper, we: & review the latest advances of HE cryptosystems, focusing mainly on the intersection of cryptography and neural networks, discussing the state-of-the-art and the state-of-thepractice; & describe fundamental concepts, such as bootstrapping, key-switching, noise, running errors, algorithmic errors, etc., that are easy to follow for readers who are not familiar with NN-HE. We cover the main theoretical results, capabilities, opportunities, potential applications, and trends of design and application; & Highlight the compromises between NN technologies and HE feasibility, combining their potentialities and important limitations & discuss current development tools, frameworks, emerging trends in the research, and relevant application domains; & compare three NN-HE implementations with CryptoNets and LoLa, both using high-level and low-level tools to demonstrate the advantages and disadvantages of each approach.
& Finally, we sketch open problems, challenges, and solutions associated with homomorphic cryptosystems and machine learning.
The key goal is to show how to process encrypted information by non-trustworthy third-parties without disclosing confidential data. Specifically, we concentrate on the p r i v a c y -p r e s e r v i n g n e u r a l n e t w o r k s a n d t h e i r implementations.

Terminology
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as   Public key λ Security parameter Bootstrapping key Encryption of the secret key. When the bootstrapping process encrypts the ciphertext again, the bootstrapping key removes the inner encryption by homomorphically evaluating the doubly encrypted plaintext.

Ciphertext
Encrypted message.
Algorithmic error Error in data processing that compromises the correctness of the results generated by representing real numbers with integer polynomial. An error of this nature can occur in numbers in the vicinity of zero, even without adding noise.
Functional error Rounding error that results from the polynomial approximation of activation functions of neural networks.
long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Padding
Practice of adding data to the beginning, middle, or end of a message prior to encryption.