scieee AI-readable full text Open interactive document viewer

Deep Homeomorphic Data Encryption for Privacy Preserving Machine Learning

Terziyan, Vagan,Bilokon, Bohdan,Gavriushenko, Mariia

Full text

This is a self-archived version of an original article. This version may differ from the original in pagination and typographic details. Author(s): Title: Year: Version: Copyright: Rights: Rights url: Please cite the original version: CC BY-NC-ND 4.0 https://creativecommons.org/licenses/by-nc-nd/4.0/ Deep Homeomorphic Data Encryption for Privacy Preserving Machine Learning © 2024 the Authors Published version Terziyan, Vagan; Bilokon, Bohdan; Gavriushenko, Mariia Terziyan, V., Bilokon, B., & Gavriushenko, M. (2024). Deep Homeomorphic Data Encryption for Privacy Preserving Machine Learning. Procedia Computer Science, 232, 2201-2212. https://doi.org/10.1016/j.procs.2024.02.039 2024 ScienceDirect Available online at www.sciencedirect.com Procedia Computer Science 232 (2024) 2201–2212 1877-0509 © 2024 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0) Peer-review under responsibility of the scientific committee of the 5th International Conference on Industry 4.0 and Smart Manufacturing 10.1016/j.procs.2024.02.039 10.1016/j.procs.2024.02.039 1877-0509 © 2024 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0) Peer-review under responsibility of the scientific committee of the 5th International Conference on Industry 4.0 and Smart Manufacturing Available online at www.sciencedirect.com ScienceDirect Procedia Computer Science 00 (2023) 000–000 www.elsevier.com/locate/procedia 1877-0509 © 2023 The Authors. Published by ELSEVIER B.V. This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0) Peer-review under responsibility of the scientific committee of the 5th International Conference on Industry 4.0 and Smart Manufacturing 5th International Conference on Industry 4.0 and Smart Manufacturing Deep Homeomorphic Data Encryption for Privacy Preserving Machine Learning Vagan Terziyan a,*, Bohdan Bilokon b, Mariia Gavriushenko a a Faculty of Information Technology, University of Jyväskylä, 40014, Jyväskylä, Finland b Department of Artificial Intelligence, Kharkiv National University of Radio Electronics, 61166, Kharkiv, Ukraine Abstract Addressing privacy concerns is critical in smart manufacturing where sensitive data is used for machine learning. Data protection is essential to ensure model accuracy while upholding data privacy. Homeomorphic encryption, an algorithm for privacy-preserving machine learning, achieves this by transforming data using a neural network with secret key weights. This process conceals private data while retaining the potential to learn classification models from the anonymized data. This paper introduces a comprehensive quality metric to assess homeomorphic encryption across conflicting criteria: security (regarding private data), machine learning adaptability (tolerance), and efficiency (regarding needed extra resources). Through experiments on various datasets, the metric proves its effectiveness in guiding optimal encryption parameter selection. Our findings highlight homeomorphic encryption’s strong overall quality, positioning it as a valuable Industry 4.0 solution. By offering a simpler alternative to fully homomorphic encryption, it effectively addresses privacy concerns and enhances data usability in the context of smart manufacturing. © 2023 The Authors. Published by ELSEVIER B.V. This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0) Peer-review under responsibility of the scientific committee of the 5th International Conference on Industry 4.0 and Smart Manufacturing Keywords: Smart manufacturing; data privacy; privacy-preserving machine learning; quality metric; homeomorphic encryption 1. Introduction In his famous book [1], among the 21 challenges of our century, Harari stressed the power of data, which is becoming “the currency of the future”. Should we care about huge and detailed information collected from and about us (physical or biological censors, cameras, texts, videos, user profiles, etc.)? Are the benefits from personalized technologies we are using every day worth of being “naked” in front of potential “digital dictatorships”? What would be the reasonable regulations regarding personal data collection and use so that, while obtaining useful value from * Corresponding author. E-mail address: vagan.terziy[email protected]i Available online at www.sciencedirect.com ScienceDirect Procedia Computer Science 00 (2023) 000–000 www.elsevier.com/locate/procedia 1877-0509 © 2023 The Authors. Published by ELSEVIER B.V. This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0) Peer-review under responsibility of the scientific committee of the 5th International Conference on Industry 4.0 and Smart Manufacturing 5th International Conference on Industry 4.0 and Smart Manufacturing Deep Homeomorphic Data Encryption for Privacy Preserving Machine Learning Vagan Terziyan a,*, Bohdan Bilokon b, Mariia Gavriushenko a a Faculty of Information Technology, University of Jyväskylä, 40014, Jyväskylä, Finland b Department of Artificial Intelligence, Kharkiv National University of Radio Electronics, 61166, Kharkiv, Ukraine Abstract Addressing privacy concerns is critical in smart manufacturing where sensitive data is used for machine learning. Data protection is essential to ensure model accuracy while upholding data privacy. Homeomorphic encryption, an algorithm for privacy-preserving machine learning, achieves this by transforming data using a neural network with secret key weights. This process conceals private data while retaining the potential to learn classification models from the anonymized data. This paper introduces a comprehensive quality metric to assess homeomorphic encryption across conflicting criteria: security (regarding private data), machine learning adaptability (tolerance), and efficiency (regarding needed extra resources). Through experiments on various datasets, the metric proves its effectiveness in guiding optimal encryption parameter selection. Our findings highlight homeomorphic encryption’s strong overall quality, positioning it as a valuable Industry 4.0 solution. By offering a simpler alternative to fully homomorphic encryption, it effectively addresses privacy concerns and enhances data usability in the context of smart manufacturing. © 2023 The Authors. Published by ELSEVIER B.V. This is an open access article under the CC BY-NC-ND license (https://creativecommons.org/licenses/by-nc-nd/4.0) Peer-review under responsibility of the scientific committee of the 5th International Conference on Industry 4.0 and Smart Manufacturing Keywords: Smart manufacturing; data privacy; privacy-preserving machine learning; quality metric; homeomorphic encryption 1. Introduction In his famous book [1], among the 21 challenges of our century, Harari stressed the power of data, which is becoming “the currency of the future”. Should we care about huge and detailed information collected from and about us (physical or biological censors, cameras, texts, videos, user profiles, etc.)? Are the benefits from personalized technologies we are using every day worth of being “naked” in front of potential “digital dictatorships”? What would be the reasonable regulations regarding personal data collection and use so that, while obtaining useful value from * Corresponding author. E-mail address: [email protected] 2202 Vagan Terziyan et al. / Procedia Computer Science 232 (2024) 2201–2212 2 Vagan Terziyan et al. / Procedia Computer Science 00 (2023) 000–000 data, we will not lose our freedom for privacy (aka “Big Brother” scenarios)? Security and privacy issues, as pointed out in [2], are of great importance to Industry 4.0 and smart manufacturing. Due to the full use of large-scale machine-to-machine communication, the internet of things, and machine learning to increase automation, improve communication, self-monitoring, diagnostics, and predictive maintenance (without human intervention but with massive amount of data), security and privacy issues have become emergent. Important decisions are made automatically based on such data [3]. Without strong cryptographic assurance, resource-limited devices could be easily compromised and hacked by adversaries. Therefore, assuring the safety and privacy of industrial data, data-driven products and decisions is a top concern for industry 4.0 nowadays. The General Data Protection Regulation (GDPR), which came into force in the European Union in May 2018, has been an attempt to meet current challenges related to personal data protection [4]. While the basic GDPR principles were welcomed, two of them, namely the right to withdraw consent and the right to be forgotten, caused controversy within the academy, business, and manufacturing. A special challenge for the GDPR is the domain of machine learning (ML). What would be a smart way to formulate and apply the regulations to ML with personal or sensitive industrial data? This challenge emerged as a new field, which is Privacy-Preserving Machine Learning (PPML), aiming to bridge the gap between ML and privacy communities [5]. The “right to be forgotten” assumes the ability to request deletion of personal data, including training records used to train ML models. However, keeping trained models instead of training data does not guarantee complete privacy protection. Even (deep) neural network (aka “black-boxes”) models are vulnerable to various information leaking attacks (model inversion, membership inference, etc.), which may determine the presence and content of private examples in the training data [6]. A special threat of potential privacy violations and model stealing by third parties [7] is the case when ML is provided as a service. Hence, ML concerns encompass safeguarding ML models along with training data to prevent private data leakage, while ensuring these secured models maintain the necessary accuracy for their intelligent tasks like classification, regression, prediction, etc. PPML is all about a trade-off between security of ML processes (training data and models’ privacy and their secure use), efficiency and effectiveness of the secured models. In [8], the need is pointed out to ensure that ML models are trustworthy and, therefore, we must have some way (e.g. a metric) to evaluate these models based on their mutually competing features, such as security, privacy, fairness and accuracy, among others. Measuring the values of security and privacy threats as well as the values of fitness regarding security and privacy requirements for some developed systems are known to be the hard tasks [9]. Evaluating the relevance, performance and efficiency of the ML models is also a multidimensional and non-trivial task [10] Therefore, introducing some trade-off metrics between these concerns will be a far more challenging task [11]. In this paper, we suggest and justify a metric for quality assessment of PPML encryption instruments, which is based on a trade-off between the requirements: (a) to guarantee stronger security/privacy of encrypted data and models (“security” component of the quality metric); (b) to minimize the loss of performance of the models trained on encrypted data (“ML tolerance” component of the quality metric); (c) to minimize the extra time needed to train models on encrypted data (“efficiency” component of the quality metric). This quality metric will be introduced following an example related to homeomorphic encryption [12], [13] with experiments on particular datasets. The rest of the paper is organized as follows: Section 2 describes PPML encryption methods (homomorphic vs. homeomorphic), each with its own specifics; Section 3 introduces the PPML quality metric with detailed analytics; Section 4 summarizes the experiments of applying the metric to the homeomorphic encryption of the popular datasets; and we conclude in Section 5. 2. Homomorphic vs. Homeomorphic Encryption of Private Data PPML could be achieved by either getting rid of private data completely by: (A) generation of new (synthetic) data with a similar distribution to the original one [14]; or (B) by applying various privacy-preserving cryptography protocols [15], transforming the original data by secure multi-party computation [16], or homomorphic encryption [17]. In both cases, the required GDPR protection is supposed to be provided and the new (generated, transformed, anonymized, encrypted) data is supposed to be useful to train various classifiers. In this section, we will focus more on the transformation (anonymization, encryption) of private data for PPML purposes. Vagan Terziyan et al. / Procedia Computer Science 232 (2024) 2201–2212 2203 Vagan Terziyan et al. / Procedia Computer Science 00 (2023) 000–000 3 2.1. Homomorphic encryption as a homomorphic transformation In mathematics, a group (𝐺𝐺,⊛) is a numerical set 𝐺𝐺 and an operation ⊛ that combines any two numeric instances of the set to produce a third numeric instance of the set; assuming that the operation is associative, has an identity element 𝒆𝒆, and inverse 𝑔𝑔𝑖𝑖−1 exists for each 𝑔𝑔𝑖𝑖 instance of the set, i.e.: ∀𝑔𝑔𝑖𝑖,𝑔𝑔𝑗𝑗,𝑔𝑔𝑘𝑘∈𝐺𝐺,(𝑔𝑔𝑖𝑖⊛𝑔𝑔𝑗𝑗)⊛𝑔𝑔𝑘𝑘=𝑔𝑔𝑖𝑖⊛(𝑔𝑔𝑗𝑗⊛𝑔𝑔𝑘𝑘); ∀𝑔𝑔𝑖𝑖∈𝐺𝐺,𝑔𝑔𝑖𝑖⊛𝑒𝑒=𝑒𝑒⊛𝑔𝑔𝑖𝑖=𝑔𝑔𝑖𝑖; ∀𝑔𝑔𝑖𝑖∃𝑔𝑔𝑖𝑖−1,𝑔𝑔𝑖𝑖⊛𝑔𝑔𝑖𝑖−1=𝑔𝑔𝑖𝑖−1⊛𝑔𝑔𝑖𝑖=𝑒𝑒. Given two groups, (𝐺𝐺,⊛) and (𝐻𝐻,⨀); a homomorphism (or homomorphic transformation) from (𝐺𝐺,⊛) to (𝐻𝐻,⨀) is a (transformation) function 𝐹𝐹 :𝐺𝐺→𝐻𝐻 such that: ∀𝑔𝑔𝑖𝑖,𝑔𝑔𝑗𝑗∈𝐺𝐺,𝐹𝐹(𝑔𝑔𝑖𝑖⊛𝑔𝑔𝑗𝑗)=𝐹𝐹(𝑔𝑔𝑖𝑖)⨀𝐹𝐹(𝑔𝑔𝑗𝑗). Here one may say that group 𝐻𝐻 (after the homomorphic transformation) has a similar algebraic structure as group 𝐺𝐺 (before the transformation), i.e., the homomorphic transformation 𝐹𝐹 preserves that similarity. Therefore, homomorphism can be used as an algebraic term for a transformation function preserving some algebraic operations after the transformation, i.e.: ∀𝑔𝑔𝑖𝑖,𝑔𝑔𝑗𝑗,𝑔𝑔𝑘𝑘∈𝐺𝐺,(𝑔𝑔𝑖𝑖⊛𝑔𝑔𝑗𝑗=𝑔𝑔𝑘𝑘)→(𝐹𝐹(𝑔𝑔𝑖𝑖)⨀𝐹𝐹(𝑔𝑔𝑗𝑗)=𝐹𝐹(𝑔𝑔𝑘𝑘)). A prevalent form of homomorphic transformation, where a secret key acts as the transformation function 𝐹𝐹, is termed homomorphic encryption. This method safeguards sensitive data’s privacy. The core concept is that specific algebraic manipulations on encrypted data can occur for third parties without revealing original private data values. Furthermore, these manipulations’ outcomes can be decrypted to yield meaningful results for the original data owner. Partially homomorphic cryptosystems facilitate homomorphic calculations for a single operation, such as addition or multiplication. A more robust cryptosystem that accommodates both addition and multiplication is referred to as fully homomorphic encryption. Homomorphic encryption’s overarching goal is to ensure privacy for outsourced storage and computation within commercial cloud environments [18]. 2.2. Homeomorphic encryption as a homeomorphic transformation Morphism in mathematics is known to be a generic structure preserving (and reversible in the case of isomorphism) transformation of some abstract object. As we have seen above, homomorphism is such an isomorphism that preserves the algebraic structure of the object. However, there could be another (similar to isomorphism) concept called homeomorphism, which preserves the topological structure of the object. Topology is a mathematical field that studies homeomorphism, which is a continuous function (aka structure-preserving map) between multidimensional numeric data spaces (like topological spaces) that has a continuous inverse function. Topological space (which is rather geometrical than algebraic) is such a space where closeness is defined but not necessarily measured or computed. Such space is considered as a set of points (samples, elements) with the structure (neighborhoods, boundaries, etc.). Topological space is known to be an n-dimensional data manifold (according to popular ML terminology), which resembles Euclidean space in the neighborhood of each point. Homeomorphism (or topology preserving transformation) is a function between two manifolds, which sends points that are close to one another in the first manifold to points that are close to one another in the second manifold, and there exists an inverse function, which can send transferred points back to their original places. Therefore, we are talking about such continuous deformations (stretching and bending but not breaking or gluing) of the object into a new shape that leave its topological structure intact. Let us define a Supervised ML (SML) group (𝐷𝐷,𝐿𝐿𝑘𝑘,𝑀𝑀𝐷𝐷) as a numerical multidimensional data space (ndimensional data manifold) 𝐷𝐷, each point (data sample defined by the vector of n numerical values) of which could get a unique label from the set of 𝑘𝑘 labels 𝐿𝐿𝑘𝑘 using the labelling operation (model) 𝑀𝑀𝐷𝐷, i.e., ∀𝑑𝑑𝑖𝑖∈𝐷𝐷,∃!𝑙𝑙𝑗𝑗∈ 𝐿𝐿𝑘𝑘,𝑀𝑀𝐷𝐷(𝑑𝑑𝑖𝑖)=𝑙𝑙𝑗𝑗. Given two SML groups, (𝐷𝐷,𝐿𝐿𝑘𝑘,𝑀𝑀𝐷𝐷) and (𝐷𝐷 ,𝐿𝐿𝑘𝑘,𝑀𝑀𝐷𝐷 ), which share the same labels’ set 𝐿𝐿𝑘𝑘; a homeomorphism (or homeomorphic transformation) from and (𝐷𝐷 ,𝐿𝐿𝑘𝑘,𝑀𝑀𝐷𝐷 ) is a function 𝐹𝐹 :𝐷𝐷→𝐷𝐷  such that: ∀𝑑𝑑𝑖𝑖∈𝐷𝐷,𝐹𝐹(𝑑𝑑𝑖𝑖)=𝑑𝑑󰆻𝑖𝑖;∀𝑑𝑑󰆻𝑖𝑖∈𝐷𝐷 ,𝐹𝐹−1(𝑑𝑑󰆻𝑖𝑖)=𝑑𝑑𝑖𝑖; ∀𝑑𝑑𝑖𝑖∈𝐷𝐷,∃!𝑙𝑙𝑗𝑗∈𝐿𝐿𝑘𝑘,𝑀𝑀𝐷𝐷(𝑑𝑑𝑖𝑖)=𝑙𝑙𝑗𝑗=𝑀𝑀𝐷𝐷 (𝑑𝑑󰆻𝑖𝑖), which means that homeomorphic transformation of data (and, therefore, of the corresponding model) does not change the result of 2204 Vagan Terziyan et al. / Procedia Computer Science 232 (2024) 2201–2212 4 Vagan Terziyan et al. / Procedia Computer Science 00 (2023) 000–000 labelling for any of the data samples. Such a transformation does not directly require preserving the algebraic operations with the data (like in the case of homomorphic transformation), but instead, it requires preserving the labelling topology (geometry of distribution and decision boundaries between 𝑘𝑘 data manifolds) of the data space (as a topological space). Therefore, we will refer to such a transformation as a homeomorphic data space transformation. The connection between the topology domain and a neural network (NN) concept has been noticed in [19] where the relationship between topological transformations and deep neural network learning has been described. The observation is as follows: each layer of a deep neural network with a continuous activation function “stretches” and “squishes” the space (defined in the very beginning by the input vector of the original data values), but it never “cuts”, “breaks”, or “folds” it. This means that topological properties of the original data space are preserved during data propagation through several hidden layers of the neural network. The author proved this observation as a theorem, which states that each neural network layer with the same number of inputs and outputs and continuous activation functions for the neurons is a homeomorphism, if the corresponding square weight matrix is invertible (i.e., nonsingular). In [12], we suggested homeomorphic encryption as a homeomorphic transformation of labelled data with the secret transformation parameters as encryption keys. The intended objective was to explore the possibility to use such encrypted data for PPML and particularly for safe supervised learning at third party servers (clouds). We performed a topology-preserving transformation of the original data as a kind of anonymization technique, which uses deep feedforward neural network (aka perceptron) to hide (by topology-preserving replacement) the coordinates (numeric attribute values) of sensitive or private data samples but still enables potential classification model to be learned on the basis of the anonymized data. Such homeomorphic encryption applied on top of an n-dimensional data manifold performs appropriate secret-key 𝑛𝑛×𝑛𝑛 non-singular matrices (neural network weights) multiplication and applies invertible activation function at each layer. After several layers of such transformation, according to [19], we will still keep the topologically equivalent (to the original one) data manifold, which hides private values of the data but preserves the labelling structure of the data needed to build the correct classification models. Encryption, which involves homomorphic, homeomorphic or other techniques that fit for the data transformation purpose, is supposed to be done within secure private space before the data is send for further processing elsewhere. It is supposed that the original private data is not recoverable from the encrypted one without knowing the encryption keys. Encrypted data can be placed within the (potentially unsafe) public space (cloud), which is supposed to provide ML as a service (MLaaS) analytics. The encryption must be done so that the MLaaS would take it as some businessas-usual task input without even knowing what kind of data it processes and that it is encrypted. MLaaS will train the classification model (e.g., deep neural network) and test it using the encrypted data for both training and testing purposes. Because the data from which the model has been built was encrypted, the model itself can also be queried with encrypted queries only. Therefore, such a model (if stolen) would be useless without knowing the encryption key. The model can be safely kept within the public space (cloud) and queried remotely from the secure private space with the encrypted queries. If the original private data is meant only for the purpose of a particular classification model design task, then such data can be deleted after the model is built to avoid leakage or hacking (of data or the encryption keys) within the private space. This ensures security worries can be avoided and the original data is protected. Therefore, homomorphic encryption is usually a complex procedure, which is applied to potentially different and unknown during the encryption phase purposes use cases. These use cases involve protected private data and include PPML just as one of possible options [20]. In contrast, the homeomorphic encryption (a quite simple and efficient procedure) can be used when we know that the main and sole purpose of the collected private data is a supervised ML (e.g., classification model building). However, in both cases, the concerns for the PPML are similar:  We need a high level of protection (security) provided by encryption.  We want to have the as small as possible (if any) loss of classification accuracy of the model built from the encrypted data comparably to the one built from the original data.  We want to have as small as possible complexity increase (and, therefore, appropriate processing time) of the model built from the encrypted data comparably to the one built from the original data. There is a definite need to create a quality metric capable of using these mutually conflicting criteria to assess the quality of encryption regarding the particular data and intended model. We are going to suggest one for homeomorphic encryption in the following section. Vagan Terziyan et al. / Procedia Computer Science 232 (2024) 2201–2212 2205 Vagan Terziyan et al. / Procedia Computer Science 00 (2023) 000–000 5 3. Quality Metric for Homeomorphic Encryption In this section, we are going to present the metric to assess the quality of anonymization procedures (particularly homeomorphic encryption) by giving the same importance to the safety of private data after anonymization and to the preserved information of the anonymized data for potential ML on top of it. Safety (security) is provided by replacing the data samples as much as possible from their original places within the attributes’ space. The original data should not be recoverable, ensuring that the models (potentially built on anonymized data by ML techniques) will be useless for anyone who steals them. Both of these conditions (“to be well replaced” and “to be well protected”) will be assessed within the security component of the anonymization quality metric. The value for ML will depend, on the one hand, on the loss of accuracy of potential ML models after applying the anonymization to the original data, and, on the other hand, it will depend on additional resources (models’ complexity) needed for ML to deal with the anonymized data. The first (major importance) of these two conditions will be assessed within the ML tolerance component of the anonymization quality metric, while the second (minor importance) of the two conditions will be assessed within the ML efficiency component of the anonymization quality metric. Let us consider the details of constructing the metric. Assume we have a dataset 𝐷𝐷 for supervised ML, particularly classification, containing 𝑘𝑘 samples that have 𝑛𝑛 attributes and labelled into 𝑚𝑚 different class categories. We suppose to introduce and experimentally test the intended quality metric based on real data. The generic schema of our experiments for this purpose is shown in Fig. 1. Firstly, during our experiments, we configured and trained the neural network architecture, which will provide the best classification accuracy on top of the testing subset of the original data after learning. Let us assume that the architecture of the best preforming (on the original data) feedforward NN (perceptron) has the following total number of neurons: 𝑛𝑛+𝑚𝑚+𝐻𝐻before, where: 𝐻𝐻𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 is the number of hidden neurons within the best NN architecture used with the original data (before anonymization). Secondly, during our experiments, we anonymized the original dataset (which had been named 𝐷𝐷 before and became 𝐷𝐷  after the anonymization) using different anonymization depths 𝑑𝑑 (natural numbers from 1 to ∞). Therefore, the anonymizer here is another deep feedforward NN (aka perceptron), whose parameters (weights and biases are chosen as secret keys and frozen). After the frozen anonymization layers, another NN architecture will be configured and trained, which will provide the best classification accuracy on top of the testing subset of the anonymized data after learning. Let us assume that the architecture of the best preforming (on the anonymized data) feedforward NN (perceptron) has the following total number of neurons: 𝑛𝑛+𝑚𝑚+𝐻𝐻after, where: 𝐻𝐻after is the number of hidden neurons within the best NN architecture used with the anonymized data (i.e., after the original data has been anonymized). Fig. 1. Generic schema of the experiments with homeomorphic encryption. Experiments provide two sets of performance values to compare the NN trained on original data with another NN trained on anonymized data. Therefore, the first NN takes the input values for training from the original dataset, and the second NN takes the input from the anonymized values. The anonymization procedure here is propagation of the data through the anonymization layers (deep NN with frozen secret weights). 2206 Vagan Terziyan et al. / Procedia Computer Science 232 (2024) 2201–2212 6 Vagan Terziyan et al. / Procedia Computer Science 00 (2023) 000–000 Our objective is to estimate (measure, compute) the quality of the anonymization algorithm for the particular dataset, taking into account several quality criteria (security, ML tolerance, and efficiency). Assume that the training experiments with both NNs give us the following measurements as the outcomes: 𝐴𝐴𝐷𝐷|𝐷𝐷 – testing accuracy for the case when the classifier is both trained and tested on the original “clean” data (i.e., a certain subset of the original data is used for training and the rest for testing); 𝐴𝐴𝐷𝐷 |𝐷𝐷  – testing accuracy for the case when the classifier is both trained and tested on the modified “anonymized” data (i.e., a certain subset of the anonymized data is used for training and the rest for testing); 𝐴𝐴𝐷𝐷|𝐷𝐷  – testing accuracy for some kind of “cross-validation”, or the case when the classifier is trained on the original “clean” data but tested on the corresponding modified “anonymized” data (i.e., all the original data is used for training and all the anonymized data is used for testing); 𝐴𝐴𝐷𝐷 |𝐷𝐷 – testing accuracy for another kind of “cross-validation”, or the case when the classifier is trained on the modified “anonymized” data and tested on the corresponding original “clean” data (i.e., all the anonymized data is used for training and all the original “clean” data is used for testing). Let us introduce the intermediate (anonymization) quality indicators: 𝑑𝑑 (depth of anonymization), which value is supposed to be the more the better for the anonymization quality; NOTE: The depth of anonymization (aka indicator for the data being “protected”) contributes to the security component of the anonymization quality. Each additional layer of the anonymization network adds at least 𝑛𝑛2 (more precisely 𝑛𝑛∙(𝑛𝑛+1) if secret biases are taken into account) secret keys (weights of the anonymization neural network), making potential hacking of the original data much more complicated; 𝑎𝑎=|𝐴𝐴𝐷𝐷|𝐷𝐷−𝐴𝐴𝐷𝐷|𝐷𝐷 | (the greater value the better for the anonymization quality); (1) NOTE: This parameter is based on cross-validation and assesses how much replacement of the original data has been made by the anonymization procedure. Assume that we have built a model from the original data, test the model on the original data and achieve a certain accuracy 𝐴𝐴𝐷𝐷|𝐷𝐷 during testing. Assume that now we will use the anonymized data 𝐷𝐷  to test this model. If the anonymized data samples from 𝐷𝐷  are placed differently enough from their original locations in 𝐷𝐷, which is good for data security, then the corresponding accuracy 𝐴𝐴𝐷𝐷|𝐷𝐷  during testing must be essentially different (lower) from 𝐴𝐴𝐷𝐷|𝐷𝐷. Therefore, parameter 𝑎𝑎 indicates the quality (its security component) of a particular anonymization; 𝑏𝑏=|𝐴𝐴𝐷𝐷 |𝐷𝐷 −𝐴𝐴𝐷𝐷 |𝐷𝐷| (the greater value the better for the anonymization quality); (2) NOTE: Similarly, to 𝑎𝑎, parameter 𝑏𝑏 is based on cross-validation and also assesses how much replacement of the original data has been made by the anonymization procedure. Assume that we have built a model from the anonymized data, test the model on the anonymized data and achieve certain accuracy 𝐴𝐴𝐷𝐷 |𝐷𝐷  during testing. Assume that now we will use the original data 𝐷𝐷 to test this model. If the original data samples from 𝐷𝐷 are placed differently enough from their new locations in 𝐷𝐷 , which is good for data security, then the corresponding accuracy 𝐴𝐴𝐷𝐷 |𝐷𝐷 during testing must be essentially different (lower) from 𝐴𝐴𝐷𝐷 |𝐷𝐷 . Therefore, parameter 𝑏𝑏 also indicates the quality (its security component) of a particular anonymization; NOTE: Fig. 2 contains a simple example of a weak data replacement and, therefore, it demonstrates the importance of the cross-validation check mentioned above. Fig. 2(a) shows four original data samples of two classes (different colors) and an approximate decision boundary between the two classes, which clearly separates the classes according to some ML model. Assume that we apply three layers of homeomorphic encryption over the data, which means that we three times replace the data samples according to the weights (encryption keys) of the corresponding encryption neural network (Fig. 2(b)). However, we can see that, after such a complex replacement, the encrypted data samples accidentally appear close to their original places. Accordingly, the new learned decision boundary, which separates the encrypted data samples (Fig. 2(c)), will be close to the original decision boundary (Fig. 2(d)). This is bad for encryption security, and, therefore, this will be indicated by small values of the quality indicators 𝑎𝑎 and 𝑏𝑏 as the result of cross-validation. 𝛾𝛾=𝟐𝟐∙𝒂𝒂∙𝒃𝒃 𝒂𝒂+𝒃𝒃 – a harmonic mean (i.e., biased to the worst case scenario average) of 𝑎𝑎 and 𝑏𝑏 indicators; (2*) NOTE: if 𝑎𝑎=𝑏𝑏=0, then 𝛾𝛾=0. Vagan Terziyan et al. / Procedia Computer Science 232 (2024) 2201–2212 2207 Vagan Terziyan et al. / Procedia Computer Science 00 (2023) 000–000 7 Fig. 2. The need for a cross-validation procedure to indicate weak homeomorphic encryption is visualized: (a) the original data samples and corresponding decision boundary between two classes; (b) replaced (with three layers of homeomorphic encryption) data samples occasionally appear close to their original places; (c) new decision boundary, which separates classes of the encrypted samples appears (d) to be close to the decision boundary for the original data, which indicates weak encryption. NOTE: 𝛾𝛾 is a kind of indicator of how the data has been “replaced” (an important parameter of the security component of all the anonymization quality functions), which estimates how well the original data samples are replaced (hidden) from their original places; 𝑐𝑐=1−|𝐴𝐴𝐷𝐷|𝐷𝐷−𝐴𝐴𝐷𝐷 |𝐷𝐷 | (the greater value the better for the anonymization quality). (3) 𝛿𝛿=𝑛𝑛+𝑚𝑚+𝐻𝐻before 𝑛𝑛+𝑚𝑚+𝐻𝐻after (the greater value the better for the anonymization quality). (4) The “SECURITY” (a major importance) component of the anonymization quality (which indicates how strongly the privacy of the original data is protected by the anonymization) benefits from both: the depth of anonymization 𝑑𝑑 and the Harmonic Mean of both “cross-validation”-related quality indicators 𝑎𝑎 and 𝑏𝑏 as follows: 𝑄𝑄Security=1−𝑒𝑒−𝛾𝛾∙𝑑𝑑=1−𝑒𝑒−2∙𝑎𝑎∙𝑏𝑏∙𝑑𝑑 𝑎𝑎+𝑏𝑏 . (5) NOTE: a more advanced option for Equation (5) would be the following one, which takes into account the number of instances 𝑘𝑘 and the number of attributes 𝑛𝑛 in the dataset: 𝑄𝑄Security ∗=1−𝑒𝑒−𝛾𝛾∙𝑑𝑑∙ln𝑛𝑛2 ln𝑘𝑘=1−𝑒𝑒−2∙𝑎𝑎∙𝑏𝑏 𝑎𝑎+𝑏𝑏∙𝑑𝑑∙2∙ln𝑛𝑛 ln𝑘𝑘 . (5*) The “SECURITY”* component of the anonymization quality (Equation (5*)) considers the importance of the anonymization depth 𝑑𝑑 in the context (the second factor in the exponent) of the number of samples 𝑘𝑘 and number of attributes 𝑛𝑛 in the dataset. It gives an estimate of the likelihood of uncovering the remaining original data from 𝐷𝐷 if an essential part of it has been leaked. Such a data hacking procedure would mean using the leaked data samples from 𝐷𝐷 and their anonymized values 𝐷𝐷  and solving the set of equations 𝐷𝐷 =𝐹𝐹(𝐷𝐷,𝑤𝑤 󰇍 󰇍 ), to get the vector of the anonymization neural network’s weights 𝑤𝑤 󰇍 󰇍 as the anonymization keys. One may see that, in addition to Equation (5), Equation (5*) 2208 Vagan Terziyan et al. / Procedia Computer Science 232 (2024) 2201–2212 8 Vagan Terziyan et al. / Procedia Computer Science 00 (2023) 000–000 adds the ln𝑛𝑛2 ln𝑘𝑘 multiplier to the exponent as a kind of “defense vs. attack” opportunity ratio. “Attack opportunity” depends on the total number of samples 𝑘𝑘, which are being hunted for. “Defence opportunity” grows by adding anonymization layers, each of which brings at least 𝑛𝑛2 additional keys to be uncovered. The logarithm function is added here to smooth the ratio and normalize the quality function to better fit the intended quality interval. NOTE: another advanced option for Equation (5), with similar intuition as the one in Equation (5*), also takes into account the number of instances 𝑘𝑘 and the number of attributes 𝑛𝑛 in the dataset. It uses a negative power function instead of a logarithm to smooth the “attack opportunity” (driven by 𝑘𝑘 and restricted by 𝑑𝑑). This advanced quality option is based on the following components: ℎ=𝑑𝑑∙𝑛𝑛∙(𝑛𝑛+1) is the exact number of secret keys provided by 𝑑𝑑 additional anonymization layer (i.e., an estimate for the “defence opportunity”); 𝐾𝐾=𝑘𝑘𝑑𝑑−1 is an estimate for the “attack opportunity”; 𝐻𝐻= ℎ ℎ+𝐾𝐾 is a special way to normalize the “protected” (regarding the data) indicator 𝑑𝑑 to [0,1] interval using 𝑘𝑘 and 𝑛𝑛 values as the characteristics of the dataset; 𝑄𝑄Security ∗∗ =√𝛾𝛾∙𝐻𝐻=√2∙𝑎𝑎∙𝑏𝑏 𝑎𝑎+𝑏𝑏∙𝑑𝑑∙𝑛𝑛∙(𝑛𝑛+1) 𝑑𝑑∙𝑛𝑛∙(𝑛𝑛+1)+𝑘𝑘𝑑𝑑−1 , (5**) which is a geometric mean of the “replaced” (𝛾𝛾) and “protected” (𝐻𝐻) indicators of security. The “SECURITY”** component of the anonymization quality (Equation (5**)) is more sensitive to change of the anonymization depth 𝑑𝑑 and the characteristics of the dataset (𝑘𝑘 and 𝑛𝑛), and, therefore, can be used as an alternative (when appropriate) to Equation (5) and Equation (5*). Since Equation (5), Equation (5*), and Equation (5**) give different estimates for the security component of the anonymization quality, it will be useful to have also their average as follows: 𝑄𝑄Security=𝑄𝑄Security+𝑄𝑄Security ∗+𝑄𝑄Security ∗∗ 3 . (5†) The “ML TOLERANCE” (a moderate importance) component of the anonymization quality (which measures to what extent the accuracy is preserved after anonymization) is simply: 𝑄𝑄ML Tolerance=𝑐𝑐 . (6) The “EFFICIENCY” (a minor importance) component of the anonymization quality (which measures an additional resource (neurons) needed to deal with the anonymized data comparably to the original one) is as follows: 𝑄𝑄Efficiency=min (1,𝛿𝛿). (7) The final anonymization quality measure (which value belongs to [0,1] interval, or [0-100%] interval) for the 𝐷𝐷→ 𝐷𝐷  anonymization can be computed as a “Golden Ratio”-driven compromise between the three quality components as follows: Q(D→D )= 1 φ2+φ+1∙(φ2∙QSecurity+φ∙QML Tolerance+QEfficiency), (8) where φ is a “Golden Ratio” constant (φ=1+√5 2≈1.618). Taking into account the “Golden Ratio” properties, we have: 𝑄𝑄(𝐷𝐷→𝐷𝐷 )= 1 2∙𝜑𝜑2∙(𝜑𝜑2∙𝑄𝑄𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆+𝜑𝜑∙𝑄𝑄𝑀𝑀𝑀𝑀 𝑇𝑇𝑇𝑇𝑇𝑇𝑆𝑆𝑆𝑆𝑎𝑎𝑛𝑛𝑆𝑆𝑆𝑆+𝑄𝑄𝐸𝐸𝐸𝐸𝐸𝐸𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑛𝑛𝑆𝑆𝑆𝑆), 𝑄𝑄(𝐷𝐷→𝐷𝐷 )=0.5∙𝑄𝑄𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆+0.5∙(𝜑𝜑−1)∙𝑄𝑄𝑀𝑀𝑀𝑀 𝑇𝑇𝑇𝑇𝑇𝑇𝑆𝑆𝑆𝑆𝑎𝑎𝑛𝑛𝑆𝑆𝑆𝑆+(1−0.5∙𝜑𝜑)∙𝑄𝑄𝐸𝐸𝐸𝐸𝐸𝐸𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑛𝑛𝑆𝑆𝑆𝑆, and, finally: 𝑄𝑄(𝐷𝐷→𝐷𝐷 )≈0.5∙𝑄𝑄𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆+0.3∙𝑄𝑄𝑀𝑀𝑀𝑀 𝑇𝑇𝑇𝑇𝑇𝑇𝑆𝑆𝑆𝑆𝑎𝑎𝑛𝑛𝑆𝑆𝑆𝑆+0.2∙𝑄𝑄𝐸𝐸𝐸𝐸𝐸𝐸𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑛𝑛𝑆𝑆𝑆𝑆, or in detail: (9) 𝑄𝑄(𝐷𝐷→𝐷𝐷 )≈0.5∙(1−𝑒𝑒−2∙𝑎𝑎∙𝑏𝑏∙𝑑𝑑 𝑎𝑎+𝑏𝑏 )+0.3∙𝑐𝑐+0.2∙𝑚𝑚𝑚𝑚𝑛𝑛 (1,𝛿𝛿), and, therefore, in initial terms: 𝑄𝑄(𝐷𝐷→𝐷𝐷 )≈0.5∙(1−𝑒𝑒−2∙|𝐴𝐴𝐷𝐷|𝐷𝐷−𝐴𝐴𝐷𝐷|𝐷𝐷 |∙|𝐴𝐴𝐷𝐷 |𝐷𝐷 −𝐴𝐴𝐷𝐷 |𝐷𝐷|∙𝑑𝑑 |𝐴𝐴𝐷𝐷|𝐷𝐷−𝐴𝐴𝐷𝐷|𝐷𝐷 |+|𝐴𝐴𝐷𝐷 |𝐷𝐷 −𝐴𝐴𝐷𝐷 |𝐷𝐷|)+0.3∙(1−|𝐴𝐴𝐷𝐷|𝐷𝐷−𝐴𝐴𝐷𝐷 |𝐷𝐷 |)+0.2∙𝑚𝑚𝑚𝑚𝑛𝑛 (1,𝑛𝑛+𝑚𝑚+𝐻𝐻𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑛𝑛+𝑚𝑚+𝐻𝐻𝑎𝑎𝑏𝑏𝑎𝑎𝑏𝑏𝑏𝑏). (10) Three other options for Equation (10) would be the following ones where the security component of quality is computed based on Equation (5*), Equation (5**) or Equation (5†):