{'fraction_non_alphanumeric': 0.029097357510365154, 'fraction_numerical': 0.007268095309456017, 'mean_word_length': 4.738712913859825, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Physics solutions for machine learning privacy leaks

Machine learning systems are becoming more and more ubiquitous in increasingly complex areas, including cutting-edge scientific research. The opposite is also true: the interest in better understanding the inner workings of machine learning systems motivates their analysis under the lens of different scientific disciplines. Physics is particularly successful in this, due to its ability to describe complex dynamical systems. While explanations of phenomena in machine learning based on physics are increasingly present, examples of direct application of notions akin to physics in order to improve machine learning systems are more scarce. Here we provide one such application in the problem of developing algorithms that preserve the privacy of the manipulated data, which is especially important in tasks such as the processing of medical records. We develop well-defined conditions to guarantee robustness to specific types of privacy leaks, and rigorously prove that such conditions are satisfied by tensor-network architectures. These are inspired by the efficient representation of quantum many-body systems, and have shown to compete and even surpass traditional machine learning architectures in certain cases. Given the growing expertise in training tensor-network architectures, these results imply that one may not have to be forced to make a choice between accuracy in prediction and ensuring the privacy of the information processed.

Vast amounts of data are routinely processed in machine learning pipelines, every time covering more aspects of our interactions with the world. When the models processing the data are made public, is the safety of the data used for training it guaranteed? This is a question of utmost importance when processing sensitive data such as medical records, but also for businesses whose competitive advantage lies in data quality.
The gold standard in privacy protection within machine learning [1,2] is provided by differential privacy [3], which consists of inserting carefully crafted noise either in the training dataset [4,5], in the final model parameters [3], in the objective function [6], or in the gradient updates [7], in order to hide the presence or absence of any particular sample in the training dataset. There exist, however, privacy-related issues that do not directly fall in this category. Imagine a machine-learning algorithm designed to diagnose a specific disease, which uses patients' records as training data, and that these records have a strong imbalance in a particular morbidity which turns out to have no association to the disease target of the model. Even if irrelevant for the final task of the algorithm, knowing this imbalance may have consequences even at the individual level, if the participation of a patient in the study (in contrast with the knowledge of their full record) is disclosed by other means. As a first result, we show that this concern is a reality in machine learning architectures based on neural networks, caused by the driving of the corresponding network parameters to erase the information that is irrelevant.
In regards to the protection of privacy, the ideal model would only retain from the training dataset the information that is essential to perform well. In this sense, access to the model's parameters in one such models would not be more informative about the data used for training than having a description of it by means of recording the outputs generated for different inputs. This is a problem similar in spirit to the protection of software against Man-At-The-End attacks [8]. As a second contribution, we show that the characterization of complex physical systems can provide a fruitful alternative viewpoint on the problem of privacy in machine learning. Concretely, we rigorously prove that in specific tensor network architectures [9], inspired by the theory of efficient representation of quantum many-body states, it is possible and easy to find alternative parametrizations of a model that are as informative as a black-box access to it. Moreover, this is achieved with no impact on the model's performance, in contrast with solutions based on differential privacy. This work wants to drag focus to physics as a source of mathematically founded inspiration for machine learning solutions. Cross-fertilizations between machine learning and physics are now commonplace [10]: on the one hand, machine learning algorithms are routinely used in particle colliders [11], in the understanding of quantum matter and its properties [12,13], or in the experimental control of quantum computers [14,15]; on the other hand, tools developed within the umbrella of physics have proven invaluable in the understanding of the training and performance of machine learning algorithms, perhaps the most significant being the theory of the information bottleneck [16]. It is expected that such improved understanding leads to new proposals, inspired by physics, of machine learning architectures or training algorithms. However, with the very notable exception of Boltzmann machines [17][18][19], this type of influence of physics in machine learning has been arguably limited. Our work is one of such form of influences, the main message being that tensor-network architectures provide a favorable framework to develop privacy-preserving machine learning algorithms.

I. THE VULNERABILITY
Training neural networks is routinely performed via optimization based on gradient descent: given a dataset that wants to be learned and a parametrization of a family of models, a notion of error between the evaluation of the function on the dataset and the expected result is minimized by adjusting the parameters of the model in the direction given by the gradient of the error. Also, most model classes have, at some point in their architecture, a concatenation of parametrized affine transformations, of the form is a matrix of weights and b (l) is a vector of biases, and fixed nonlinear functions, z (l) = φ l (y (l) ), applied to the data. These parameters, as we shall see now, contain information about the training dataset that, ideally, a model should not reveal.
For simplicity, let us start considering a hypothetical situation (see Figure 1) where all points in the dataset that we want to learn have one binary feature which takes always the same value, say 1, and the model is a concatenation of these affine transformation and nonlinearities. Since all the datapoints in the dataset have the same value of the binary feature, this information is of no use for the classification, and thus an ideal final model shall not depend on it. During training, the contribution of the biases in the affine transformations are driven to compensate that of the corresponding weights, in the attempt of eliminating the effect of this irrelevant variable on the final prediction. If the initial data has the constant value 1, this will make that the corresponding weights and biases are directed towards taking opposite signs. The situation is the opposite if the binary feature takes the constant value of −1. In order to minimize the contribution of the irrelevant feature, in this case the gradient will drive the parameters towards taking values with same signs. An attacker that has access to the model can thus easily recover the nature of the irrelevant feature just by looking at the parity of a set of weights and biases.
In more realistic scenarios the situation is not as clearcut (after all, if a feature takes the exact same value in the whole dataset, it is not reasonable to feed it to the model). It is more common to have features which have some imbalance between the different values it can take. In such situation, this type of vulnerability is still Before training After training Illustration of the proposed vulnerability. Each point represents a simple neural network model, f θ (x) = φ (W rel x rel + Wirrxirr + b) (where φ is an activation function), that is trained to learn the function y(x) = sign(x rel ). Each model is trained on a different dataset where x rel ∼ N (0, 1), and xirr is +1 for all datapoints used to train the models depicted by the blue stars and −1 for the orange circles. The plots show the values of the neural network weight for the irrelevant variable, Wirr, and the bias of the output neuron, b, (a) before and (b) after training on a different, random dataset for each model. In this architecture, the gradients of any loss function L are ∂W irr L = xirrφ ∂ φ L and ∂ b L = φ ∂ φ L, implying that ∂W irr L = xirr∂ b L. These gradients will naturally drive the parameters to distinguishable regimes, which can be identified after training as demonstrated in (b). The codes for generating these figures are available in the computational appendix [20].
present, as we demonstrate in Figure 2d. There, we show an illustration with deep neural networks trained on real-world data of medical records derived from the global.health database [21] of COVID-19 cases around the world. The task in which the neural networks are trained is the prediction of the outcome of the infection given demographics, symptoms, and the parity of the date when the case was recorded (this is the feature irrelevant to the task). Then, the attacks follow the spirit of shadow training [22,23]: the attacker is provided with trained models and labels denoting the majority value of the irrelevant feature in the corresponding training set, and with them trains a meta-model that constitutes the attack. Notably, for the case of neural networks, simple logistic regression meta-models perform well in the attack task, highlighting the vulnerability to the sort of privacy leaks described.

II. QUANTUM-INSPIRED ARCHITECTURES WITH PRIVACY GUARANTEES
The above example is a (rather extreme) illustration that neural-network architectures store information about the training set in the way that the network parameters process its features. Now we will see that in alternative architectures, inspired by the study of quantum many-body systems, this information can easily be deleted without compromising on model performance.
Continuing with the previous example, it is clear that there exists a straightforward way to erase the information about irrelevant features that does not lead to privacy leaks: simply setting to zero the weights that propagate the influence of those features to the initial layer of the network. In a hypothetical situation where one fixed such parameters and trained the rest, the result would be an alternative collection of weights and biases leading to a model, ideally equally performing, yet not containing any information about the training dataset other than that needed for making the prediction. Thus, the ability to characterize the sets of parameters that lead to the same model opens the door to ways of choosing model parameters which contain no more information about the training dataset than what can be inferred from recording the output for different inputs. The first part of our contribution in this aspect is formally proving this intuition in Section III. The second part is showing, in Section IV, that for the family of matrix product state architectures (this is a family of architectures originally developed in the context of many-body quantum systems that have recently attracted interest in machine learning [24,25]) one can make an assignment of parameters that has specially suitable properties when analyzed under the lens of privacy in machine learning.

A. Matrix product states
The field of quantum many-body physics has been developing manageable ways of simulating the states and evolutions of quantum systems composed of many particles, which have recently gained attention in machine learning as alternative parametrizations of highdimensional, convoluted functions. These are the socalled tensor network architectures and, notably within them, the matrix-product state (MPS) representations [9,24]. In fact, these parametrizations of complex functions were later rediscovered in the field of numeri-cal analysis, under the name of tensor trains [25,26]. An MPS architecture is best defined when viewing functions as hyperplanes on high-dimensional feature maps of the input. This is, when we consider (vector) functions f (x) of the input x as taking the form (1) MPS architectures correspond to the family of functions illustrated in Figure 2b. These are obtained when the vector feature map, Ψ(x) (typically non-trainable), has a tensor-product form with one component per dimension , and the hyperplane is expressed as a product of in general complex matrices (hence the name), namely These architectures have a very well-characterized gauge symmetry group, which characterizes the sets of parameters that describe the same function. If between every two consecutive matrices one inserts a decomposition of produce M as well. Importantly, it is well-known from quantum many-body physics that these are the only symmetries of the MPS architectures [27], and that it is possible to fix a value of the gauge for each MPS. This fixing is known as a "canonical form", and it is generally obtained via singular value decompositions [27,28].

III. PRIVACY FROM REPARAMETRIZATION INVARIANCE
Invariance under reparametrizations is commonly known as gauge symmetry [29]. This is a concept that is commonplace in many-body physics, nuclear and particle physics, or in general relativity. In order to rigorously prove that a complete characterization of gauge symmetries protects against revealing unintended information, we must first define some mathematical objects. For a fixed learning architecture (this is, a functional ansatz depending on n parameters), call W ∈ C n the set of all possible values of its parameters. The architecture, along with a point θ ∈ W, completely determines a model. Thus, we will refer to W as the set of white-box representations for a given architecture. In this picture, training a model amounts to choosing the optimal θ for a specific task. In general, this optimal value will depend on the data used for training the algorithm. Analogously, the set of black-box representations B can be understood as the set of oracular functions (i.e., seen as input-output pairs) corresponding to each θ ∈ W. In general, there exists a function π : W → B that assigns every white-box representation to its corresponding black-box oracle. In certain cases one can define a right inverse, α : B → W, that assigns a set of parameters to a black-box representation. This function satisfies π • α = id B→B , this is, that the oracular function associated to a white-box representation of a black box is the black box itself. Due to redundancies in the description, there can be many θ ∈ W that lead to the same black-box representation, so in general, even if an α can be defined, it is not true that α•π = id W→W . This function, which takes all white boxes describing the same black box to the same element of W, is commonly known as canonical form.
Consider also what an attack is. In the proposed context, an attack is a function applied on a white-box representation whose output provides information about features of the training data. Formally, we can model this as a (smooth) function f : W → C that maps the parameters of a model to a complex number.
With these, we can now state our first result: Consider the set of white-box representations for some architecture, W ∈ C n , and its associated set of black-box representations, B = π(W). If a right inverse α : π • α = id B→B can be defined, then for every function f whereθ = α • π(θ) ∈ W are the parameters denoting a canonical form for the model described by θ andf = f •α is the application of f in black boxes.
Proof. By expanding f (θ): where we have decomposed the identity in the space of black boxes as id B→B = π • α.
The relation above means that the evaluation of an attack, f , in a set of parameters that describe the canonical form of a model, α • π(θ), coincides with the evaluation of the induced attack,f = f • α, in the associated black box, π(θ) = π(θ). Therefore, an attack f cannot extract from a canonical form any information that is not present in the associated black-box.
Note that the only requirement of Theorem 1 is that the function α can be defined. However, in particular, there are no requirements on the degree of regularity, or smoothness, of α, so in general the degree of regularity of the black-box attackf will depend on the regularity of both f and α. In the next section we prove that, for the case of MPS, α can indeed be taken as smooth as possible: namely holomorphic. This implies that the degree of regularity of the white-box and black-box attacks is the same, and therefore, that MPS are strong candidates for privacy-preserving machine learning architectures.

IV. GLOBAL CANONICAL FORM IN MPS
We now know that if a canonical form can be defined, then the information about the training dataset stored in the model's parameters is the same information that is stored in the corresponding black box. However, it could still be possible that accessing this information is easier when knowing the model's parameters. In this section we prove that this is not the case for MPS architectures. The reason for this is that the map α, from the space B to the space W described in Section III, can be taken to be holomorphic, and hence possesses the highest degree of smoothness. Then, since holomorphy implies that the composition of any function with α preserves its regularity, any attack at the white-box level, f : W → C, can be upgraded to an attack at the black-box level, f = f • α : B → C, with the same regularity. Therefore, for every white-box attack to a canonical-form representation not only there exists a black-box attack with the same performance (as we showed in Theorem 1), but also with the same regularity. This is, not only the canonical form stores as much information as the black box, but also it is equally hard to extract such information in both cases.
In this section we give an explicit construction for such holomorphic map α in MPS architectures. Recall that MPS architectures process the input is a (typically non-trainable) feature map with a tensor-product form and M was described in Eq. (2) with each entry of the A tensors in the left-hand side being a trainable parameter. Thus, when considering MPS architectures, the set W is a subset of C n (where typically n = N b 2 d for some number of sites N , bond dimension b, and physical dimension p, see Refs. [30,31] for descriptions of these quantities and their connections with the simulation of quantum many-body systems) given by all the possible values of all the elements of the A tensors in the right-hand side of Eq. (2). The function π that maps a white-box representation of an MPS to its corresponding black box is, precisely, Eq. (2). Then, the set B is defined as π(W), i.e., the subset of C n (with n = d N ) defined by all allowed values of the entries of the M tensor in the left-hand side of Eq. (2).
In order to provide the map α, we will construct a specific holomorphic canonical form for MPS. Formally, this is an holomorphic map W → W, transforming each MPS to its canonical form, so that all MPS related by a gauge transformation are mapped to the exactly same canonical-form MPS. This map then induces uniquely the desired α : B → W, which will also be holomorphic, as shown below.
The construction of the holomorphic canonical form is done in the following Theorem: Proof. The function is well-defined whenever the L matrices are invertible. In such case, the only non-trivial operation is the computation of such inverses, which is an holomorphic operation in the elements of the matrix.
Following the usual graphical notation for tensor networks (for its definition see, for instance, the explanations in Figure 2b or Ref. [31]), this decomposition iŝ with L s j Theorem 2 assumes, a priori, that the dimension of all legs are the same. However, it is easy to obtain decompositions with different dimensions, by using projectors different than the one considered. Importantly, note that this decomposition requires that the L matrices are invertible. These matrices are, at every step in the procedure, just a projection on specific sites of the original MPS. While the projected states are not invertible in all MPS, typicality arguments show that this will be the case in general: the set of parameters that give rise to MPS with at least one non-invertible L is of measure zero in the space of all possible parameter values. Note also that the canonical form obtained in this way will be the same for all MPS that are related by a gauge transformation, as required, which means that this canonical form indeed gives a well-defined map α : B → W.
It remains to show that α is also holomorphic. In order for this statement to be meaningful, or even to define what it means for an attack on black boxes to be smooth, one needs to endow the set B with a smooth structure; more specifically, with a complex manifold structure. Note that W is trivially a complex manifold, since it is an open subset of some C n .
There are a priori two ways to see B as a complex manifold. One is as a submanifold, generated by the π given by Eq. (2) as B = π(W) and embedded in the ambient (exponentially large) complex vector space of all possible input-output relations. The other is as the space of orbits defined by the gauge symmetries. This is, if we call S MPS to the complex Lie group of gauge symmetries, the space of orbits is nothing but the quotient set W/S MPS , where a natural complex manifold structure can be defined whenever the symmetry group action is reasonably good (holomorphic, free and proper). One can see, using well-known results in the theory of complex manifolds, that both ways to describe B are equivalent. Formally, the complex manifolds W/S MPS and B are biholomorphic, and thus we write B = W/S MPS from now onwards. The analysis of these manifolds has been done in full detail for the set of "full-rank" MPS in Ref. [30], where we also refer to for the necessary definitions and background. Due to our extra condition of the matrices L being invertible, our sets W and B are (full measure) subsets of those considered in Ref. [30], but the exact same proof applies.
By the way the complex manifold structure is defined in the space of orbits W/S MPS , for any holomorphic map W → W that is invariant under the action of the gauge group S MPS -as it is the case for the canonical form defined in Theorem 2-the uniquely defined associated map α : B = W/S MPS → W is also holomorphic. All details can also be found in Ref. [30] and the references therein.
Summarizing, we have defined a new, holomorphic, canonical form for MPS architectures. This implies that the MPS parameters obtained after computing the canonical form have no more information than the information already included in a black-box oracular access to the model, and that such information is equally hard to extract in both cases. Importantly, the sets of parameters generated by the gauge freedom all describe the exact same function, and thus the reparametrization to a canonical form does not have an impact on the performance of the model. This is in stark contrast with approaches based on differential privacy to protect the privacy in neural networks, where noise is added to the training dataset or the final parameters in a way that there is a tradeoff between the model's utility and the protection of the dataset.
In particular, for the type of examples discussed in Section I on features that are irrelevant to the target task, and in the ideal scenario in which the model learns perfectly, this means that the MPS parameters obtained after computing the canonical form would have no dependence at all on these irrelevant features. In realistic scenarios such as that illustrated in Figure 2d, one observes that there is still some dependence for high biases, but this is notably lower than that present in the parameters obtained directly from training.
It is important to clarify that our Theorem 2 is just a proof-of-principle illustration of the power of this approach to obtain privacy-preserving machine learning based on tensor networks. We have focused on preserving regularity, but for any other property that one is interested in, in order to obtain a similar reduction from white boxes to black boxes, all that one needs is to find a canonical form that preserves such property. In particular, it is important to note that the canonical form described in Theorem 2 differs from that in the standard literature of MPS algorithms, based on a sequence of singular value decompositions (SVD) [27,28]. The SVD-based canonical form of MPS presents a residual U(1) × · · · × U(1) gauge freedom [30], and it is not clear how to perform a global section of this residual gauge in an holomorphic manner. However, one can a priori expect at least some degree of privacy protection from the SVD-based canonical form. Indeed, relaxing a bit the mechanism, the process of computing the canonical form of an MPS via SVD, and afterwards choosing randomly a representative of the gauge orbit, is equivalent to first computing the canonical form described in Theorem 2, and then computing the SVD-based canonical form of this MPS and randomly choosing a representative of the gauge orbit. The latter process has all the privacy guarantees described in this work because of the application of our canonical form in the first step, and therefore so does the former. Moreover, the analysis on Figure 2 indicates that the direct application of the SVD-based canonical form, without subsequent randomization, also guarantees a significant degree of privacy.

V. EXPERIMENTS
As an illustration of the protective power of the canonical form of MPS, we depict in Figure 2 the training of one of these MPS architectures in the real-world dataset used in the demonstration with neural networks (the prediction of the outcome of COVID-19 infections given demographics, symptoms, and the parity of the date of the record), as well as the probability of success of attacks based on shadow training [22,23], both before and after computing its canonical form. This sort of attacks constitute an upper bound to the efficacy of realistic ones because it allows the attacker to have much more infor-mation than reasonable. Details on the training and attacks can be found in appendices A and B, respectively. Both types of models (neural networks and MPS architectures) perform very similarly in the target task (see Figure 2c), while the vulnerability to attacks is markedly different: as can be seen in Figure 2d, both neural networks and MPS architectures straight out from training are equally vulnerable but MPS in canonical form are not. For instance, at 80% imbalance of the irrelevant feature, attacks on both models have around 78% of accuracy, while in the canonical-form description of the MPS the accuracy drops down to around 56%, close to the limit of random guessing. Notably, as it is described in Appendix B, this happens despite the attacks performed to MPS architectures being more general than those performed to neural networks.

VI. DISCUSSION
As machine learning permeates through more layers in society, it is increasingly important to shift the focus from prediction accuracy to greater goals such as privacy and fairness. This work shows that global information about the training dataset is hidden in the parameters of deep learning models, even if this information is irrelevant for the task at hand. More importantly, it points at physics, and more concretely at the tensor networks used in quantum many-body physics, as a favourable framework where to find architectures that are robust to privacy leaks. In this second aspect, our results are encompassed in Theorems 1 and 2, which can be informally stated in the following way: Theorem 1 (Informal version). If the sets of parameters that leave a model invariant can be characterized, then each white-box attack performed on a representative of the set is equally performing (in terms of accuracy) as an attack in the corresponding black box.
Theorem 2 (Informal version). There is a canonical form for the set of MPS architectures so that every whitebox attack to such canonical-form set of parameters is "as good" (in terms of the attack accuracy and its regularity as a function) as an attack to the black-box representation.
We have shown that the key of the protection comes from the ability to characterize all sets of parameters that produce the same trained model. Once this set is characterized, making the final choice of parameters in a way that is independent of the training dataset (i.e., choosing a canonical form) implies that the final parameters contain no more information about the training dataset than the strictly necessary to produce the output. For neural networks, one could imagine obtaining a canonical form by proceeding in the spirit of model extraction attacks [32,33]. While one would need to study carefully whether the requirements for robustness are satisfied in this scenario, one should bear in mind the increased computation time and amount of necessary data (after all, a second model must be trained from input-output queries to the vulnerable one, ideally using datapoints not used in the training of the first), and the potential loss of accuracy entailed by the process.
The standard in privacy protection within machine learning is provided by differential privacy. While now having become the standard in the industry in regards to privacy-preserving machine learning [1,2], adding noise imposes a tradeoff between the level of privacy and the utility of the model. Moreover, the vulnerability illustrated regards global properties of the dataset rather than individual datapoints. Therefore, whether differential privacy protects against the vulnerability demonstrated remains to be understood.
With this work we want to shift the focus towards a promising class of architectures for machine learning. Our contribution is a foundational step in that direction, where many open questions still lie ahead. We have provided only an exemplary family of architectures, that of matrix product states, which we prove to admit parametrizations that are no more informative than a black-box access to a trained model. Our results nevertheless apply to any architecture where different parametrizations lead to the same model and where a global, smooth, and one-to-one mapping can be defined between the space of black-box representations and a representative of every possible model. If such mapping exists, one can use it to eliminate information that the final model should not have. This part of the proof is not restricted neither to MPS architectures, to general tensornetwork architectures, nor even to neural networks. However, given all the expertise of the community of quantum many-body physics, it is expected that model classes that satisfy the required conditions are easier to find within the tensor-network family [34]. Finding such architecture classes, which are also enough expressive and easy to train, will constitute a very important task.
In contrast with defenses based on differential privacy, the canonical form guarantees that defense in tensornetwork architectures can be achieved without compromising on prediction accuracy. However, tensor network architectures can also be trained using differentially private mechanisms, thus adding privacy of individual datapoints on top of the canonical form. Still, more effort must be put into the optimization of training of tensornetwork architectures, which only recently are finding advantages over state-of-the-art deep neural network architectures [35]. For this, it is fundamental to develop tensor-network models beyond the highly structured ones developed within the physics community (which, nevertheless, already cover large families of interesting architectures [34]). A good source of inspiration is the "tensorization" of popular deep learning models, a field that is rapidly gaining traction [36][37][38]. More broadly, both neural-network and tensor-network architectures can easily be combined [39][40][41], so it is not unreasonable to imagine having hybrid architectures where tensor-network layers take care of some privacy aspects, and neural-network layers do the heavy-lifting on private data. To illustrate the fact that neural networks are vulnerable to irrelevant feature leaks and MPS are not, we have trained both architectures in a real-world dataset. This is part of the global.health database of . This is a very large database that allows us to make small partitions, so that we can train shadow models when illustrating the attacks. We take the dataset available on March 22nd 2021, use the data of two countries, Argentina and Colombia, for generating our database. The database built only contains the columns location.country, events.outcome.value, events.confirmed.date, demographics.ageRange.start, demographics.gender, and symptoms.status from the whole dataset, and all datapoints where at least one of these entries is empty are discarded. As a first balancing between countries, we take all entries for Argentina and, evenly, one out of every seven (which is approximately the ratio between the number of datapoints for each country) points for Colombia's cases where the column events.outcome.value takes the value Death, and the same amount for the cases where events.outcome.value takes any other value. As a second balancing, now between cases with odd and even registration dates, we take all cases where the column events.outcome.value takes the value Death (a total of 21 503), and the first 5 375 cases for each combination of country and parity from the subset of points where the column events.outcome.value takes the value Recovered. We provide the computer codes, written in Python, for generating the database from the global.health dataset in the computational appendix [20].
The classification task in which both, neural networks and MPS, are trained, is in predicting the value for events.outcome.value when provided the rest. While all features are discrete in nature, we treat the age feature as continuous. As irrelevant feature, we choose the parity of the report date, extracted from events.confirmed.date. While this quantity is indeed expected to be irrelevant for the classification, we check that it is sufficiently uncorrelated with the remaining features (see Table I).
The neural network model used is depicted in Figure 2a and consists of a five-layer architecture with structure 16-16-8-4-2, totalling 614 trainable parameters. Each intermediate layer has a rectified linear unit as activation. Training optimizes the cross-entropy between the predictions and the labels in batches of 8 datapoints, using the Adam optimizer with learning rate of 3·10 −4 and 2 regularization of magnitude 6·10 −3 , for at most 1 250 epochs. The final model picked is that along the training history that achieves higher accuracy in a held-out validation set composed of 5 000 samples of the original database.
The matrix product state model is depicted in Figure 2b  have cardinality 2. This is, the leftmost and rightmost purple squares in Figure 2b are 2 × 2 matrices, and the remaining purple squares and the orange square are tensors of dimensions 2 × 2 × 2. All entries in all tensors (a total of 40) are free, trainable parameters. Training optimizes the cross-entropy between the predictions and the labels in batches of 100 datapoints, using the Adam optimizer with learning rate of 10 −1 , for 20 epochs.
The encoding of categorical variables in the input is different for both architectures. For neural networks we perform a traditional one-hot encoding. In contrast, for MPS we perform a noisy encoding, in such a way that for each datapoint the class is encoded in a random value in either 0, 1 2 − or 1 2 + , 1 , with = 5 · 10 −2 . Then, every dimension of the input is encoded in a different twodimensional vector via ψ(x) = (1 − x, x), and these are the objects that are input to the MPS (the yellow squares in Figure 2b). For the demographics.ageRange.start column, a min-max normalization is performed before producing the input vector. The different encoding of the variables for neural networks and MPS does not have severe impacts in the vulnerability of the models: as demonstrated in Figure 2d, the MPS architectures are still vulnerable if no protection is applied.
Notably, the function computing the canonical form that is used in the experiments is the standard one based on singular value decompositions. As we commented in Section IV, it is left for future work to analyse whether the SVD-based canonical form fulfills similar regularity properties as the new one we construct here for the proof of Theorem 2. In any case, the analysis on Figure 2 indicates that, in practice, the canonical form obtained via SVD guarantees a significant degree of privacy.

Appendix B: Attacks
The attacks we consider are in the spirit of shadow modeling attacks [22,23], whereby the attacker is pro-vided with a large collection of models trained on datasets that share the statistics of the dataset where the victim model has been trained on. This is a situation where the attacker has much more power than what is realistic, so the results are upper bounds to realistic attacks.
In order to produce Figure 2d, we generate, for every percentage of the majority class in the irrelevant variable, a total of 200 datasets (100 for each majority class) with that proportion, randomly sampled from the original dataset. On each of these datasets, a total of 100 models are trained according to the prescription described in 'Dataset and training of models'. This produces, for each of the percentages (the horizontal axis of Figure 2d), 20 000 trained models. Out of all of them, those corresponding to 80 of the datasets are provided to the attacker along with their corresponding majority class, while the models for the remaining 20 datasets will be those to be attacked.
The attacker, depending on the type of models, does a different kind of attack: for neural networks the attack consists of a logistic regressor over the full set of models' weights and biases after a proper normalization, with 2 regularization and using the LBFGS solver. This attack is arguably simple, but this only reinforces the argument that neural networks are very vulnerable to leaking the nature of irrelevant features. Removing parameters and keeping those in the initial layer, or doing PCA to reduce dimensionality, did not offer advantages to using the full set of model parameters as input.
For MPS architectures, the attacker trains a deep feedforward neural network that is input the model weights (after a proper normalization) and outputs the corresponding label. This was done to provide the attack with more generality, so it could hopefully extract more information from the parameters of the model. The attack neural network consists of six layers with structure 20-20-10-10-2-2, using rectified linear units as activation functions for the intermediate layers. Training optimizes the cross-entropy between the predictions and the labels in batches of 1 000 datapoints, using the Adam optimizer with learning rate of 10 −3 and 2 regularization of magnitude 10 −4 , for at most 1 000 epochs. The set of 80 datasets is split randomly in an 80-20 proportion as to generate a validation set for early stopping.
In order to provide statistics, we train and evaluate the attacks for several random choices of the 80 datasets given to the attacker. We do a total of 1 000 of these repetitions, which provide the confidence intervals in Figure 2.