{'fraction_non_alphanumeric': 0.027536511612944733, 'fraction_numerical': 0.00784919256256836, 'mean_word_length': 4.791356184798808, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Finding semi-optimal measurements for entanglement detection using Autoencoder Neural Networks

Entanglement is one of the key resources of quantum information science which makes identification of entangled states essential to a wide range of quantum technologies and phenomena. This problem is however both computationally and experimentally challenging. Here we use autoencoder neural networks to find semi-optimal measurements for detection of entangled states. We show that it is possible to find high-performance entanglement detectors with as few as three measurements. Also, with the complete information of the state, we develop a neural network that can identify all two-qubits entangled states almost perfectly. This result paves the way for automatic development of efficient entanglement witnesses and entanglement detection using machine learning techniques.

Mathematical structure of quantum mechanics allows for a peculiar kind of correlation, known as "Entanglement" that in some aspects, is more powerful than classical correlations [1]. Entanglement is known to be one of the key resources in quantum information theory [2] that empowers many quantum technologies such as quantum metrology [3]. This makes entanglement detection uniquely essential for to a variety of quantum applications [4]. In contrast to separable states, Entangled states cannot be written in terms of a convex combination of the product of density matrices. This reduces the entanglement detection to determining if a state is in the convex hull of product states [7]. This problem is also known as the "separability problem" and is NP-Hard [5,6].
Although exact entanglement identification for the full Hilbert space is challenging, it is possible to construct tools that can identify some but not all entangled states. These are known as "entanglement witnesses". Mathematically, a witness provides a sufficient but not necessary condition for entanglement. If the state satisfies this condition, it is entangled, but if it does not, the witness reveals no information with regards to the separability of the state [8,9]. Figure (1-a) gives a schematic picture of how a witness identifies entangled states. It divides the Hilbert space into two partitions, one that only contains entangled states, and an other one that may include of both separable and entangled states.
A variety of approaches have been proposed to provide some entanglement witnesses [10][11][12][13][14]. Also recently, different machine learning techniques have been developed for detection of entanglement. These include forest algorithms [15], Neural Networks [16][17][18][19][20][21], reinforcement learning [22] and Restricted Boltzmann Machines [23][24][25]. Some of these methods require the full description of the state, which in general, might require too many measurements and be infeasible experimentally. Ideally, it is favourable to witness entanglement with as few measurements as possible. This requires finding optimal measurements that are most informative with respect to entan- * sraeisi@sharif.edu glement of the states. Note that although for the detection a general entangled states, the full density matrix (full tomography) is required, it is still possible to detect subsets of entangled states from incomplete data of a few measurements [9]. In this article, we propose to use autoencoder neural networks to find semi-optimal measurements for entanglement detection and construct new entanglement witnesses that can detect entangled states with incomplete data, e.g. with as few as three measurements. More specifically, our methods takes as input the constraint on the number of measurements and returns both the optimized measurements and the witness which uses the result of those optimized measurements to detect entanglement.
Autoencoders are a type of neural network that are designed to find compressed encodings of the inputs that contain the information relevant to a specific target task. In our case, this task is the detection of entanglement and the autoecoder would find a set of few measurements that are optimized for this task. Naively, for a given number of measurements m, we train a neural network with a bottleneck layer of m nodes and in the training process, the m nodes are optimized such that the full network can, to the best of its ability, detect entangled states. This way, the autoencoder neural network finds the optimal m measurements that can be used for detection of entanglement.
Here we apply our method to the two-qubit system, but arXiv:2003.07031v1 [quant-ph] 16 Mar 2020 this method could be generalized for systems with higher Hilbert space dimensions. For the two qubit system, 15 measurements would provide the full information of the state. With the full information, our method can identify entangled and separable states almost perfectly. As we reduce the number of measurements, the performance of the witness decreases and it can only identify smaller portion of the entangled states. We also consider the situation where the state is cylindrically symmetric and find that symmetry can significantly enhance the performance of the resulting entanglement witness and even with a few measurements, it is possible to find highly accurate entanglement detectors. The neural network witness takes states as input and indicates whether or not the state is entangled at the output. For the input, we need to find a representation for the state of a two-qubit system. In quantum information theory, the state of a physical system is represented by a density matrix ρ which is a Hermitian, non-negative operator with trace one [26]. We use the basis of Pauli matrices to express the density matrix and feed this representation for the input of the neural network. Mathematically that is where σ i s are Pauli matrices and σ 0 denotes the identity operator I. Γ ij s could be found as: The reason we choose this basis is because Γ ij are the expectation values of (σ i ⊗ σ j ) measurements on the system. So for two-qubit systems, these 15 measurements (neglecting the trivial Γ 00 = 1 resulted from the identity operators) provide a representation of the density matrix [26].
The final goal is to use the autoencoder to find fewer measurements that can be used to detect entanglement, at least for a subset of the states.
Since we use supervised learning techniques, the label of the states, i.e. whether or not they are entangled, needs to be determined. We use the Peres-Horodecki criterion (also known as Positive Partial Transpose or PPT criterion). This witness states that if the partial transpose of the density matrix is negative, the state has to be entangled [9]. This is because if ρ AB is separable then its partial transpose with respect to one party (ρ T B AB ) should be non-negative [9]. So, if ρ T B AB < 0 then the state has to be entangled. For the special case of when the dimensions of the subsystems satisfy d A × d B ≤ 6 (where d A and d B are the dimensions of the Hilbert spaces of the first and second subsystems respectively) PPT gives a necessary and sufficient condition for separability [9]. see Fig. 1-b) for a schematic picture of PPT witness. For two-qubit systems, Augusiak et al. proposed a simplified form of the PPT criterion [27] det(ρ T AB ) ≥ 0 ⇐⇒ separable.  This is used to determine the labels of the density matrices.
Note that in general, PPT only gives a necessary condition for separability which makes it challenging to extend this approach to higher dimensions.
We use autoencoder neural network [28] to detect entangled states. The autoencoder architecture is shown in Fig. 2, the number of nodes starts to decrease first and then it starts to increase before it gets to the final node. It is common to refer to the first part of the network as the "encoder" and the last part as the "decoder". Also the layer with the fewest nodes is referred to as the "code". This layer, acts as a bottleneck for the flow of information. It means that if the full network can effectively detect entangled states (or a subset of them), then the information relevant to the entanglement of the states has to be coded in the code layer.
In our case, the network is starting with the full density matrix and the encoding can be seen as finding the optimal measurement that contains the information relevant to the entanglement.
The idea is that we train this neural network and the full network gives an entanglement witness that works with complete information. But the network does more. It also finds an encoding of the state that would keep only the information relevant to the entanglement. In other words, we can use the encoder to find the few measurements that are most informative with regards to the entanglement and directly measure them.
We trained a model with the architecture shown in Fig (2)  system.With some tuning, one may even recover the PPT criterion. But it is not really helpful because non-linear measurements are usually challenging to implement experimentally. So we redesign the model and look for linear measurements. That is, we want the nodes in the code layer to be linear functions of the input layer which gives the model in Fig. 3. In this architecture, the first layer consists of only m (desired number of measurements) nodes without any activation function. So the network is forced to choose m linear combination of these 15 features. Each linear combination corresponds to a linear measurement.To minimize the loss, the network changes the weights of the first layer and therefore it finds m semi-optimal linear measurements which can be used to detect entanglement. The model has been trained for different values of m and the results are shown in Fig. (4-a). Also by mod-  ifying the threshold for the classification of the data to reach the precision of 100%, an entanglement witness has been created, and the percentage of the entangled quantum states that these witness can detect from all of the entangled states (recall) are shown in Fig. (4-b) For example, this model achieves an accuracy of about 80% using only three linear measurements. These three semi-optimal measurements can be expressed in terms of the input layer, i.e. Pauli measurements. These weights are depicted in Fig. 5.
Often the quantum states prepared in the lab have some symmetries. These symmetries generally pose some constraints on the density matrix and as a result, could simplify entanglement detection.
One of the common symmetries in state preparation is the cylindrical symmetry, i.e. rotations around the zaxis does not change state. Here, we repeat our idea with the cylindrical symmetry for the two-qubit systems. The results for symmetric states are shown in Fig. 4. The model can achieve high accuracy with a few number of linear measurements in the case of cylindrical symmetry. For example, with even three measurements, it reaches 94% of accuracy.
In conclusion, We proposed to use autoencoder neural networks to find optimal measurements for entanglement detection and constructed entanglement detectors that, with as few as three measurements, could achieve accuracies as high as 80% over all density matrices.
We also showed that for symmetric states, this performance would significantly improve.
As a side result, we found an entanglement detector that with the full information of the state, can identify all entangled and separable states almost perfectly.
Our models present a proof of concept for the idea of using autoencoders for finding optimized measurement for entanglement detection. Our work was limited by our computational resources and our models can potentially be further improved by further training of the model and by better tuning the hyper-parameters like the depth of the networks. It remains open to see how far the performance of this idea can be pushed and what its limitations are.
Also, the idea of using autoencoders for optimization of measurements can be extended beyond two-qubit entanglement detection and can provide a powerful tool in quantum information for a variety of applications.

A. Data synthesis and preparation
For the non-symmetrical data, five million two-qubit density matrices have been generated using a random density matrix generator function in "qutip" [29,30] module in python. Then all the features have been calculated using Eq. (2). The label assignment for all the generated density matrices and their features have been done by the PPT criterion.
For cylindrical symmetry data, one million cylindrical symmetric density matrices have been generated by the satisfaction of the conditions developed in Eq. (S1-S6). In order to satisfy these conditions a function has been developed. This function can transform any arbitrary density matrix for a two-qubit system to a cylindrical symmetric density matrix. The following is the characterization of states with cylindrical symmetry. Consider a cylindrical symmetry about z-axis: For a cylindrical symmetric density matrix the Eq. (S1) is valid, therefore the following condition on every rotation angle θ is satisfied.
by simplifying the Eq. (S3) we obtain : using [σ i , σ j ] = 2i ijk σ k we derive a condition for cylindrical symmetry: The scatter plot of each set of two features have the same general trend ( Figure S1. Moreover, other analysis conducted on the data shows that there are not any clear first-order correlations between the features see Fig. S2).

C. Characterization of Neural Networks
Two types of neural network have been used to determine the entanglement of a two-qubit states (see Fig. 2 and Fig. 3). In order to create these networks "Tensorflow" library has been used. The optimizer of these networks is "Adam" and the learning rate is 0.001. The loss function for all networks is "cross entropy" and for all of the layers the activation function is "relu", except for the networks which their first layer should be a linear combination of the features the activation function of the first layer is "linear".

D. Classification with other Methods
Two methods are used to determine the separability; making a classifier from a trained regressor on the value of determinant of the partial transposed matrix, and per-  forming a direct classification on the data only by knowing whether the system is entangled or not. Different kinds of regressors and classifiers are used in this section and the information and results of each technique are represented in table I. The required number of samples were determined by the learning curve of each method and the optimal hyper-parameters were obtained using "Grid Search Cross Validation" and "Randomized Search Cross Validation". The most accurate methods in these techniques are "Neural Networks" and "Linear Regression with a polynomial feature transform of degree 4" with an accuracy of 97%.

E. Noise robustness
Results of experimental measurements are always coupled with some noise due to the accuracy of the measurement tools and environmental effects. Therefore, the behavior of the proposed estimators as an entanglement witness should be robust to noise to be feasible to be used in experiment. We studied the effect of measurement noise on all previous trained models by adding a Gaussian noise with different standard deviations to the measured features. The trained neural networks noise robustness could be seen in Fig. S3. The study shows that there is not a sudden accuracy fall in presence of the noise, but rather a smooth decline of accuracy.