XpookyNet: Advancement in Quantum System Analysis through Convolutional
  Neural Networks for Detection of Entanglement
The application of machine learning models in quantum information theory has
surged in recent years, driven by the recognition of entanglement and quantum
states, which are the essence of this field. However, most of these studies
rely on existing prefabricated models, leading to inadequate accuracy. This
work aims to bridge this gap by introducing a custom deep convolutional neural
network (CNN) model explicitly tailored to quantum systems. Our proposed CNN
model, the so-called XpookyNet, effectively overcomes the challenge of handling
complex numbers data inherent to quantum systems and achieves an accuracy of
98.5%. Developing this custom model enhances our ability to analyze and
understand quantum states. However, first and foremost, quantum states should
be classified more precisely to examine fully and partially entangled states,
which is one of the cases we are currently studying. As machine learning and
quantum information theory are integrated into quantum systems analysis,
various perspectives, and approaches emerge, paving the way for innovative
insights and breakthroughs in this field.
Ali Kookani, Yousef Mafi, Payman Kazemikhah, Hossein Aghababa, Kazim Fouladi, Masoud Barati
XpookyNet: Advancement in Quantum System Analysis through Convolutional Neural Networks for Detection of Entanglement

###### Abstract

The application of machine learning models in quantum information theory has surged in recent years, driven by the recognition of entanglement and quantum states, which are the essence of this field. However, most of these studies rely on existing prefabricated models, leading to inadequate accuracy. This work aims to bridge this gap by introducing a custom deep convolutional neural network (CNN) model explicitly tailored to quantum systems. Our proposed CNN model, the so-called XpookyNet, effectively overcomes the challenge of handling complex numbers data inherent to quantum systems and achieves an accuracy of 98.5%. Developing this custom model enhances our ability to analyze and understand quantum states. However, first and foremost, quantum states should be classified more precisely to examine fully and partially entangled states, which is one of the cases we are currently studying. As machine learning and quantum information theory are integrated into quantum systems analysis, various perspectives, and approaches emerge, paving the way for innovative insights and breakthroughs in this field.

* September 2023

## 1 Introduction

In quantum mechanics, an extraordinary phenomenon known as quantum entanglement arises when two or more particles interact so that their quantum states become related [1]. This relation indicates that the particles become correlated and can no longer be described independently [2]. Any change made to one particle will be instantaneously reflected in the others, even if they are far apart [3]. Creating and increasing entanglement in arbitrary qubits for quantum algorithms and quantum information (QI) theory protocols, in which entanglement is a vital resource, plays an influential role [4]. As proof, it excludes undesirable energy levels in quantum
annealing [5] and facilitates the exchange of quantum information over long distances [6]. It also provides conditions for transferring classical bits of information with fewer qubits [7].

The first step in creating and increasing entanglement is recognizing its existence and amount. In recent years, various entanglement detection criteria have been proposed [8]. Yet, the positive partial transpose (PPT) criterion determines entanglement only in \(2\otimes 2\) and \(2\otimes 3\) non-mixed bi-party states by indicating the state is separable if the partial transpose of the density matrix is positive semi-definite [9]. In other words, there are some mixed states that are entangled but still meet the PPT conditions, which are called bound entangled states, as they cannot be used to create a maximally entangled state through local operations and classical communication (LOCC), even though the reduction criterion has been practical here [10]. Moreover, Werner states are another instance in which PPT is violated [11].

Alternatively, concurrence, negativity, and relative entropy of entanglement (REE) are some well-known measurements for measuring entanglement. In a density matrix, concurrence is the maximum of 0 and the largest eigenvalue subtracted by the aggregate of all the other eigenvalues [12]. Negativity is the sum of the negative eigenvalues of a density matrix's partial transpose [13]. REE measures a quantum system's uncertainty compared to the nearest separable state by von Neumann entropy [14]. Similarly, the Entanglement of Formation (EoF) measures the level of entanglement required to generate a quantum state and represents the minimum average entanglement needed. EoF is measured by tracing a subsystem and optimizing entropy over all possible state decompositions [15]. Generally, EoF distinguishes entangled states from separable ones, even in mixed states, resulting in values between 0 and \(\log_{2}(d)\), where d is the dimension of the subsystem.

From three qubits onwards, finding a real solution is as hard as those that take more than polynomial time. Hence, entanglement witnesses are tools used to detect entanglement in quantum systems. A witness \(W\) is a Hermitian operator with a non-negative expectation value for all separable states, but can have a negative expected value for some entangled states [16]. It performs entanglement detection to find a more suitable witness without fully characterizing the system or performing a full tomography; however, owing to the exponential growth of variables with the rise in qubit numbers, they require optimization in high-dimensional spaces. Quantum witnesses can be optimized using machine learning because they can quickly identify patterns in large datasets, making them ideal for solving complex problems [17; 18]. Four illustrations in Fig. 1 show how some of the most commonly used division methods are used for classifying separable and entangled states.

Deep learning (DL) models have transformed research fields and impacted our daily lives due to their robustness and versatility. These widely used models can attain accurate results on any dataset regardless of the intended application, as long as the data is encoded to be more simplistic. Furthermore, the model must be adapted to the data.

A link between learner models and QI has been extensively studied recently. Quantum neural networks detect entanglement and separability in multipartite quantum states using both discrete and continuous variations. Newly developed realignment criteria and generalized partial transposition criteria have led to the training of a neural network (NN) on bipartite and multipartite quantum systems [21]. The study of bound and noisy tripartite entanglement employs an NN with separable quantum states and a hidden mixing layer that encodes the classical probabilities
of mixed quantum states. This research determines the quantum channel capacity using an NN, witnesses W/GHZ entanglement, and examines entanglement behavior based on environmental properties [22]. Generative models and multilayer perceptrons construct separable states for comparison in bipartite and multipartite systems based on separable approximations of target states and noise thresholds. The algorithm uses an ansatz to find the nearest separable state, then establishes the boundaries of separability for entangled states with bound entanglement [23]. A novel method, combining a pseudo-Siamese network with a generative adversarial net, has been developed to detect entanglement. This technique reframes the problem as an anomaly detection task, achieving over 97.5% accuracy and investigating partial entanglement [24]. NNs also classify quantum states using Bell-type inequality for relative coherence entropy and supervised learning. The NN detects entanglement and predicts its properties. This method can be expanded to multiparty systems using Bell states in noisy channels [25].

All in all, there has not yet been a model with sufficiently rigorous accuracy for two-qubit data, and the design of DL models for QI applications remains relatively unexplored. Additionally, research needs to be more comprehensive in generating data beyond two qubits under entanglement categories and is currently limited to Bell-type data. Based on the findings of this study, a highly appropriate customized model has been developed for use as a criterion. The model can fit complex number data from QI theory into a common framework. Furthermore, there is an investigation of how purity affects the identification of states.

Section 2 discusses density matrices in QI theory, highlighting their application, classification, and detection of entanglement footprints in many-body quantum

Figure 1: State space is divided into two parts based on whether states are entangled or separable. (a) Adjustment of a witness as a linear hyperplane and its optimization failure. (b) Entanglement witness optimization approaches, including linear: from \(W_{1}\) to \(W_{1}^{\prime}\), and nonlinear: from \(W_{2}\) to \(W_{2}^{\prime}\)[19; 20]. (c) The convexity of the target space impedes precision, even when encircling the separable states with several witnesses. (d) Using simple learner models to improve the convex witnesses isolator (which often does not accurately cover the target space).
systems. Section 3 outlines the process of building a deep custom model from scratch and exploring advanced techniques throughout its design and learning processes. Additionally, quantum complex number data preprocessing is addressed. Section 4 outlines the methods of generating quantum states by computer and outside of a laboratory. In Section 5, the model performance results are evaluated and scrutinized based on the data obtained in Section 4.

## 2 Quantum Entanglement Formation

Quantum systems involving more than one qubit, known as multi-party quantum systems, can exhibit quantum entanglement, where each qubit interacts with the others. The density matrix is a Hermitian matrix that allows us to expand it in terms of its eigenvectors and eigenvalues. Generally, it is defined as \(\rho=|\psi\rangle\langle\psi|\) for any quantum state \(|\psi\rangle\). It serves as a mathematical representation of a multi-party quantum system, especially when it is in a mixed state. Since there is no such thing as a pure state in reality, and because the coherence of the system is reduced by noise and interaction with the environment, the resulting state is a mixed quantum state. Density matrices enable us to calculate properties such as entanglement and coherence of quantum systems [26]. In terms of mixed states, they facilitate obtaining the expectation values and the time evolution of the quantum system [27]. This leads to the transformation of the equation for the expectation value in pure states, initially given as \(\langle\hat{A}\rangle=\langle\psi|\hat{A}|\psi\rangle\), to \(\langle\hat{A}\rangle=\mathrm{Tr}(\hat{\rho}\hat{A})\). Similarly, the Schrodinger equation describing the time evolution of pure states, originally stated as \(\frac{d}{dt}|\psi(t)\rangle=\frac{1}{i\hbar}\hat{H}(t)|\psi(t)\rangle\), is transformed into \(\frac{d}{dt}\hat{\rho}(t)=\frac{1}{i\hbar}[\hat{H}(t),\hat{\rho}]\), where the relative density matrix of \(|\psi\rangle\) is represented by \(\hat{\rho}\).

Density matrices are viewed as raw but valuable data that contain latent patterns [28, 29, 30]. As these matrices are fed into the DL models and represented as data through their convolutional layers (which apply a set of filters), models analyze the density matrices thoroughly to decipher hidden patterns within them. Models perform their processes according to a label that describes the process they need to follow. As part of this work, the labeling was conducted according to the EoF criteria because the function was accurate and ready.

The positive value of EoF between two systems indicates an entanglement between the two systems. To determine the EoF for bipartite systems, the Schmidt decomposition of the quantum state must be computed. The EoF is then obtained by evaluating the von Neumann entropy of each eigenvalue, and summing over the probabilities of the respective states:

\[EoF=\inf{[\sum_{i}p_{i}S(\rho_{i})]}. \tag{1}\]

Here, the infimum is taken over all possible state decompositions into a probabilistic mixture of pure product states. Additionally, to calculate the von Neumann entropy of the reduced density matrix for subsystem A or B (obtained by tracing out the other subsystem), the following equation is used:

\[S(\rho_{A})=-\mathrm{Tr}[\rho_{A}\log_{2}{(\rho_{A})}], \tag{2}\]

where \(\rho_{A}\) represents the reduced density matrix of subsystem A.
## 3 Designing Custom Model

The DL models are graphs of convolutional layers; each consists of several kernels. The presence of multiple kernels in each layer, along with the diffusion of information from one layer to the next, leads to the extraction of patterns from the lowest-level features up to the highest-level features. Through these processes, complicated patterns within a matrix can ultimately be extracted [31].

In DL, the 3D convolution operation is expressed as follows [32]:

\[Y_{i,j,k}=\sigma\left(b+\sum_{p=0}^{P-1}\sum_{q=0}^{Q-1}\sum_{r=0}^{R-1}X_{i+p, j+q,k+r}\times W_{p,q,r}\right), \tag{3}\]

where \(Y_{i,j,k}\) is the output element at position \((i,j,k)\), \(X_{i+p,j+q,k+r}\) is the input element at position \((i+p,j+q,k+r)\), \(W_{p,q,r}\) is the weight element at position \((p,q,r)\), \(b\) is the bias term, and \(\sigma\) is the activation function. In this formula, \(P\), \(Q\), and \(R\) are the dimensions of the convolutional kernel or filter. The sum over \(p\), \(q\), and \(r\) represents the convolution operation, where the kernel is slid over the input tensor and multiplied element-wise with the corresponding elements in the input tensor. The bias term is added to each output value, and the activation function is applied to the result. The activation function introduces non-linearity into the output of the convolutional layer, allowing the network to learn complex patterns between the input and output.

The intricate nature of entanglement detection necessitates a high-capacity model with many layers. The longer the sequence of layers, the greater the chance that the gradient value of the loss function will approach zero [33]. This major problem, called vanishing gradients, is caused by activation functions that map input values to small intervals. In order to train the model effectively, the activation function must separate and focus on important information. Using Leaky ReLU as a solution to vanishing gradients, a slight negative slope is introduced for values below zero, thus allowing for continued learning [34]. In this way, we will be able to resolve the over-fitting problem and the vanishing gradient problem to a large extent.

The Leaky ReLU function is defined as follows:

\[f(x)=\begin{cases}ax&;x<0\\ x&;\text{else}\end{cases}, \tag{4}\]

where \(a\) represents a small positive constant, the function applies a linear transformation with a slope of \(a\) to the input when \(x\) is less than zero.

Optimizing weights in the convolution layer kernels leads to improved accuracy for DL models. The back-propagation algorithm is utilized for this optimization process, where the weights are adjusted based on a loss function called categorical cross entropy (CCE). This function is calculated for a given number of classes, denoted as \(C\), using the following equation:

\[L_{CCE}=-\sum_{i=1}^{C}y_{i}\log\left(\hat{y}_{i}\right) \tag{5}\]

In this equation, \(y_{i}\) represents the actual label for class \(i\), and \(\hat{y}_{i}\) denotes the predicted SoftMax probability for class \(i\).

However, when entanglement detection is the sole objective, or when the system consists of only two qubits, equation (1) can be simplified to a binary classification
problem by setting \(C=2\). The modified equation becomes:

\[-\sum_{i=1}^{2}y_{i}\log\left(\hat{y_{i}}\right)=-y_{1}\log\left(\hat{y_{1}} \right)-y_{2}\log\left(\hat{y_{2}}\right) \tag{6}\]

This equation can be further simplified to represent the formula for binary cross entropy (BCE) as follows:

\[L_{BCE}=-y\log\left(\hat{y}\right)-\left(1-y\right)\log\left(1-\hat{y}\right) \tag{7}\]

The DL model can be designed and developed by incorporating these components and assembling them in the forward flow, backpropagation, and selection processes. The results of this analysis provide valuable insights for further refinement and optimization.

### Deep Convolution Model

DL requires layers to be appropriately arranged and hyper-parameters to be selected wisely, such as the number of kernels and filters in each layer. We arranged different kernel sizes as shown in Fig. 2. Selection and arrangement of kernel sizes are based on the area that a kernel covers within the input tensor, e.g., a \(2\times 2\) kernel identifies the patterns between values in dimensions \(2\times 2\times N\). Typically, a smaller kernel identifies a more detailed pattern, whereas a larger kernel identifies a broader pattern [35].

Thus, the model's base path gradually reduces the size of the tensors. The parallel paths (branched model) process tensor generalities. By combining these paths, we can identify both general and specific patterns within the density matrix. The proposed model can determine entanglement, its amount, and the entangled qubits in three or more qubits. This is achieved by changing the last layer's activation function. As we examine processes like EoF and PPT, we realize there may be additional connections between density matrix values that cannot be identified mathematically.

Thus, to detect _spooky action at a distance_, XpookyNet is designed to extract patterns from density matrix values using dexterous learning techniques. Regardless of how tempting it seems to simplify the complex number form of raw density matrices through measurements, we do not alter their original form [36]. It is wise to divide them into two matrices, one consisting of real numbers and the other consisting of imaginary numbers.

Figure 2: XpookyNet’s overall scheme is as follows. The activation function of its last layer varies depending on whether the model is intended to detect entanglement or to predict the amount of entanglement. It also varies when categorizing the presence of entanglement among qubits.
### Improving Deep Model

We developed our model with more layers, drawing inspiration from well-known convolutional models such as VGGNET, INCEPTION, and ResNet, which have achieved unprecedented accuracy in various databases [37, 38, 39]. This model contains parallel layers with expanded kernel sizes and layers aligned in rows, as shown in Fig. 2. The main artery of the layers, depicted in blue, is in charge of extracting patterns by gradually reducing the dimensions of the data. Since the expansion of two-qubit data results in an input tensor with dimensions of \(4\times 4\times 2\), which is not large, the Max Pooling layer is not used. Parallel arteries, depicted in green, play a significant role in extracting larger patterns. A more efficient set can be produced by replacing these simple convolutional layers with "separable convolutional layers", complemented with Batch Normalization (BN).

_Batch Normalization_ is a technique used in DL to improve the performance, accuracy, and speed of DL models. When BN is applied to DL models, they become more stable. This is because the output of the layers becomes less sensitive to changes in the input [40].

Furthermore, Separable convolutions make CNN training more effortless and less overfitting-prone, reduce computational complexity, allowing faster training and inference, and improve accuracy by capturing more sophisticated features. Nevertheless, they may not be as effective as standard convolutions when dealing with low-dimension tensors. Additionally, they may require more layers than traditional CNNs to achieve similar accuracy levels [41].

### Constructing Extended-Tensor

QI relies on complex numbers, but DL models cannot accommodate them. This method is inspired by models that discover patterns within images defined by three channels: red, green, and blue, known as RGB, and convert the density matrices into three-dimensional tensors (as indicated in Fig. 3). We use typical and advanced models designed for working with images or similar datasets to process quantum data instead of limited, eccentric, and intricate models. As illustrated in Fig. 3, we divide the density matrices into two matrices: one containing real numbers and the other containing imaginary numbers. Finally, we obtain a tensor that forms the input data.

### Training Convolution Model

Optimization, a fundamental component of DL algorithms, updates the weights and biases of the model to correspond with the loss function so that the loss function reaches its minimum.

In the proposed model, the stochastic gradient descent (SGD) optimizer with a momentum of \(0.9\) is used to explore the loss function space to find and save the most accurate model with the minimum loss function. At the end of each epoch, the most accurate model is saved compared between the current and last model. When the loss function reaches a plateau, the learning process should be halted, and the optimizer's learning rate should be adjusted. This is to detect small hollows in the loss function and converge to its minimum. The model's learning rate is cut by one-tenth each time it hits a plateau.

In addition, the parallel paths benefit the model by passing the data through larger kernel sizes and preventing vanishing gradients with shortcuts in
backpropagation. Preprocessing quantum data by balancing and shuffling is a simple but highly effective method in improving results. Entangled data is likely to be produced, and with the increase of qubits, this probability will rise even more. However, giving all the data of one label after all the data of another label causes model bias and reduces generalization.

## 4 Quantum Data Generation

### Two-qubit Entangled State

In order to generate two-qubit state data, we use the QuTiP library [42]; it provides a random density matrix with complex number elements, which ensures that the matrix is Hermitian, positive-semidefinite, and normalized to have a trace value of one. However, since generating random bipartite entangled data is approximately three times more likely than generating bipartite separable data, it's crucial that we store an equal number of matrices as our dataset for each class to prevent model bias. As a result of this simple action, the model's generalization improves, and as the generalization improves, so does the accuracy.

We generate one million \(4\times 4\) random density matrices as the dataset. This dataset contains 500,000 entangled and 500,000 separable data. The matrices are labeled by calculating the EoF of each matrix using the Qiskit library [43]. The amount of entanglement is also stored as a result of the EoF function.

### Three-qubit Entangled States

According to Fig. 4(a), Appendix A to describe each category. Besides generating entangled tripartite data, which only leads to the known states of GHZ state, W state, and Graph state, generating entangled \(B|AC\) partial data is also challenging,

Figure 3: The process of converting complex number data to real number data provides simplicity in typical models.
as detailed in Appendix B. In two-qubit entanglement cases, partial entanglements \(A|BC\) and \(C|AB\) are only provided with the tensor product operator between a single state and a bipartite entangled state. Fig. 4(b) demonstrates the method of physically generating states which exert randomness by single random unitary operations \(U_{rand}^{A,B,C}\) and entanglement by \(U_{Ent.}\) operator. We create 250,000 density matrices for three-qubit states, divided into five balanced categories as a dataset, which takes only 168 seconds to prepare when running on a regular CPU. The states are entirely pure, but if we wish to generate less pure data, we must mix more states, which requires a longer time.

## 5 Results Evaluation

We summarize the key statistics and trends using a table and a graph. Next, we evaluate the performance of our classification algorithm using a confusion matrix and identify areas where it might need improvement. Finally, we present a plot that visualizes the relationships between different variables in our dataset.

### Two-qubit Entanglement Detection

XpookyNet is tested with various approaches to achieve the state-of-the-art model presented thus far. It is imperative to know how effective each approach is to gain more meaningful insight into practice. This is because the design of customized learning models in QI has been sparse.

We present in Table 1 the results of our tests, which comprised 10,000 two-qubit states. The table provides an overview of each of the approaches or their combination, its effect on the model's parameters, the required time to complete an epoch of learning, and, above all, the model's accuracy on the test data.

As is evident from comparing the accuracy, one can immediately notice the significant superiority of the convolutional model over the NN. However, achieving near 100% accuracy still requires advanced considerations.

In comparing the three methods proposed separately to achieve higher accuracy, it is observed that reducing the learning rate on plateaus (ReduceLROnPlateau) is the most effective. The separable convolutional and BN methods constantly interact and are more effective than branched models. Nevertheless, when these methods are

Figure 4: An overview of three qubits: (a) An allegory of how state space is divided into categories. (b) The quantum circuit used for preparing known tripartite entangled states incorporates the single random unitary operators \(U_{rand}^{A,B,C}\) and the entanglement operation \(U_{Ent.}\).
combined two by two, the branched model along with ReduceLROnPlateau achieves the highest accuracy, even better than the combination of all methods. As mentioned, separable convolutions are not suitable for working with small tensors. Due to the quadrupling of the tensor size in three qubits, the use of separable convolutional, along with the other methods, results in an improvement.

Aside from these factors, we considered that the designed model would be highly accurate with a generalization ability, in addition to having a reasonable learning speed, and that it would be capable of attaining the highest accuracy in a relatively short time. We achieved an accuracy of 98.53% with only 14 epochs of XpookyNet; this result was obtained from test data, which is noteworthy. Additionally, with the help of our multi-functional model, in addition to detecting entanglement, XpookyNet can also determine the degree of entanglement.

Observing and comparing the learning process of each situation mentioned in the table and the degree of improvement in their accuracy provides more insight. Fig. 5 shows the loss function diagrams and accuracy diagrams separately for simple and combined models. The shortcomings of the NN model compared to convolutional models and the leap caused by ReduceLROnPlateau are evident both in the loss function and in accuracy at a glance. This phenomenon is depicted in Fig. 5 (c) and (d), where it is evident that the application of ReduceLROnPlateau at epochs 8 and 12 leads to a substantial reduction in the loss function. This model has an excellent start in the first epoch thanks to separable convolutional and BN layers. Alternatively, reducing the learning rate on plateaus leads to better results.

### Three-qubit Entanglement Detection

The XpookyNet model was put to work on three-qubit data, with the only difference being that separable convolution layers were employed along with BN, instead of using convolution layers, as shown in the last case of Table 1.

A comprehensive investigation of partial entanglements and mixed-state data was performed since they are ignored when classifying three-qubit data with high accuracy if the data is limited to a few categories, making tripartite entanglement and so on insignificant. XpookyNet classifies all five categories with an accuracy of 99.88%, whereas the state mixing transformation relatively reduces its accuracy. The decrease

\begin{table}
\begin{tabular}{l l l l l l} \hline \hline  & & & \multicolumn{3}{c}{Model Structure} \\ \cline{4-6} Models & Max. & Epoch & Number & of & Number of \\  & ACC & Time & Conv. & Layer & FC Layer & Parameters \\ \hline NN & 0.8325 & 19s44ms & 0 & 3 & 3,233 \\ Simple Conv. & 0.9500 & 51s55ms & 10 & 2 & 1,334,913 \\ Brch. & 0.9624 & 63s22ms & 14 & 2 & 2,015,521 \\ BN. Sep. & 0.9632 & 57s20ms & 10 & 2 & 1,080,263 \\ Plat. & 0.9789 & 48s33ms & 10 & 2 & 1,334,913 \\
**Brch. Plt.** & **0.9852** & **64s58ms** & **14** & **2** & **2,015,521** \\ Plt. BN. Sep. & 0.9749 & 60s47ms & 10 & 2 & 1,080,263 \\ Brch. BN. Sep. & 0.9664 & 75s62ms & 14 & 2 & 1,324,615 \\ Brch. Plt. BN. Sep. & 0.9761 & 75s95ms & 14 & 2 & 1,335,430 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Overview of Methods used in this study. The words Conv., Brch., Sep., and Plat. stand for Convolutional, Branched model, Separable convolution, and ReduceLROnPlateau, respectively.
in states' purity makes them more difficult to analyze. From Fig. 6, it is evident that XpookyNet can quickly classify the state space in its first epoch with a high degree of precision. However, its performance diminishes with a decline in purity. Further, it is evident that even though XpookyNet classified the GHZ state, W state, and Graph state as tripartite, as learning progressed, it differentiated them and divided them into three distinct categories. Most importantly, the confluence between separable and partially entangled states experiences the highest amount of collision.

In the next step, we display in Fig. 7 the two and three-qubit classification confusion matrix as a performance metric for evaluating XpookyNet. In the two-qubit entanglement case, the error in detecting full entanglement is expectedly higher, but when three qubits are considered, full entanglement can be detected with fewer errors. As the number of qubits (\(N\)) increases, detecting \(N\)-partite entanglement becomes undoubtedly more challenging. To address this apparent contradiction, all bipartite entanglements, whether two-qubit or partially entangled, are generated randomly with varying purities and aren't limited to known types due to their labeling indexes. The tripartite set is quite limited as it only includes the GHZ state, W state, and Graph state, representing a small fraction of the entire set. Additionally, as observed, the most significant error in prediction arises when partial entanglements are incorrectly characterized as separable.

## 6 Conclusion and Discussion

In recent years, quantum information theory has witnessed rapid growth and faced notable challenges. One significant hurdle is applying artificial intelligence (AI) to this

Figure 5: Loss function and accuracy graphs for the methods listed in Table 1. (a) Comparison of basic models and models that adopt one of the approaches in terms of accuracy. (b) The accuracy of the combined approach is zoomed in due to their high accuracy. (c) Loss function graphs of part a are shown in the same colors. (d) Loss function graphs of part b are shown in the same colors.
Figure 6: A three-qubit state classification plot visualizes how the purity of the states and the number of epochs elapsed affect the model’s ability to classify data.

Figure 7: The confusion matrices for two-qubit and three-qubit classification.
field due to the complexity of feeding data with complex numbers into conventional AI models. However, this article presents a groundbreaking solution that addresses this challenge and propels the field forward. The key contribution of this research is the development of an advanced deep Convolutional Neural Network (CNN) model, boasting an impressive accuracy rate of 98.5%. This innovative model successfully overcomes the limitations of handling data with complex numbers, thereby unlocking new possibilities for effectively leveraging advanced machine learning techniques in processing quantum information.

Furthermore, we have investigated the preparation and labeling of three-qubit states, considering both tripartite and partially entangled states. We have explored the impact of purity on the complexity of these states, shedding light on quantum systems' fundamental properties. Understanding quantum states better is of the utmost importance in QI theory, as it forms the foundation for various quantum algorithms and applications.

We can solve previously unsolved problems in QI theory by leveraging advanced machine learning models, such as the deep CNN we have developed. These models offer powerful tools for analyzing and processing quantum data, enabling us to gain deeper insights into quantum phenomena. Moreover, applying these models to analyze mixed states offers new perspectives for studying noise and imperfections in quantum systems. It can alter how we investigate and mitigate noise in quantum systems, enhancing performance and robustness.

Applied QI techniques hold promise for quantum computing and information processing in the future. In addition to providing insights into quantum states, our research represents a tremendous leap forward in developing a high-accuracy deep CNN model. The potential impact of these findings extends beyond theoretical research, contributing to advancing this interdisciplinary field.

## Appendix A A Generation of The Two-qubits Entangled State

Two-qubit separable states are generated by:

\[\rho_{sep}=\sum_{i=1}^{m}\lambda_{i}\rho_{i}^{A}\otimes\rho_{i}^{B}, \tag{1}\]

where \(\sum_{i}\lambda_{i}=1\) and \(0\leq\lambda_{i}\leq 1\), with \(m\) iterating from 1 to an arbitrary number beyond, and density matrices of A and B qubits are \(\rho_{i}^{A}\) and \(\rho_{i}^{B}\), respectively. Entangled states are selected from the system's randomly generated states using the EoF criterion. Therefore, Two-qubit entangled states can be considered as the following:

\[\rho_{ent}=\sum_{i=1}^{m}\lambda_{i}\rho_{i}^{AB}, \tag{2}\]

where the density matrix of the two-qubit entangled state is \(\rho_{i}^{AB}\).

## Appendix B A Generation of Three-qubits Entangled State

In the three qubits case, two entanglement classes (bipartite and tripartite entangled state) need to be generated.
### Three-qubit Separable State

Separable states are prepared by applying three single qubit operators \(U_{rand}^{A,B,C}\) to a fixed initial state \(\psi_{0}\rangle\). Therefore, three-qubit separatable states are generated by:

\[\rho_{sep}=\sum_{i=1}^{m}\lambda_{i}\rho_{i}^{A}\otimes\rho_{i}^{B}\otimes\rho_ {i}^{C}, \tag{10}\]

where \(\sum_{i}\lambda_{i}=1\) and \(0\leq\lambda_{i}\leq 1\), with \(m\) iterating from 1 to 20.

### Bipartite entangled state

Bipartite entangled states of a three-qubit system are prepared by generating a randomly separated one-qubit and an entangled pair of two-qubit. Entangled states are selected from randomly generated states of the entire system using the EoF criterion.

Case 1: Entangled pairs B and C:

Bipartite entangled states are generated by:

\[\rho_{A|BC}=\sum_{i=1}^{m}\lambda_{i}\rho_{i}^{A}\otimes\rho_{i}^{BC}, \tag{11}\]

where \(\sum_{i}\lambda_{i}=1\) and \(0\leq\lambda_{i}\leq 1\), with \(m\) iterating from 1 to an arbitrary number higher than one, and \(\rho_{i}^{BC}\) is the generated entangled states for subsystem BC using the EoF criterion.

Case 2: Entangled pairs A and B:

Bipartite entangled states are generated by:

\[\rho_{C|AB}=\sum_{i=1}^{m}\lambda_{i}\rho_{i}^{AB}\otimes\rho_{i}^{C}, \tag{12}\]

where \(\sum_{i}\lambda_{i}=1\) and \(0\leq\lambda_{i}\leq 1\), with \(m\) iterating from 1 to 20, and \(\rho_{i}^{AB}\) is the generated entangled states for subsystem AB using the EoF criterion.

Case 3: Entangled pairs A and C:

The state vectors of the entangled state \(|\psi_{AC}\rangle\) and separated state \(|\psi_{B}\rangle\) considered as:

\[|\psi_{AC}\rangle=[a_{0}\ \ a_{1}\ \ a_{2}\ \ a_{3}]^{T} \tag{13}\]

and

\[|\psi_{B}\rangle=[b_{0}\ \ b_{1}]^{T}. \tag{14}\]

Therefore, the bipartite entangled states can be considered as:

\[|\psi_{B|AC}\rangle=\frac{1}{N_{B|AC}}[a_{0}b_{0}\ \ a_{1}b_{0}\ \ a_{0}b_{1}\ \ a_{1}b_{1}\ \ a_{2}b_{0}\ \ a_{3}b_{0}\ \ a_{2}b_{1}\ \ a_{3}b_{1}]^{T}, \tag{15}\]

where \(a\) and \(b\) are state vector coefficients that should satisfy normalization condition, \(\sum_{i}|a_{i}|^{2}=1\), and \(\sum_{i}|b_{i}|^{2}=1\). Also, \(N_{B|AC}\) is the normalization coefficient of the three-qubit state vector. Ultimately, the bipartite entangled states are generated by:

\[\rho_{B|AC}=\sum_{i=1}^{m}\lambda_{i}\left(|\psi_{B|AC}\rangle\langle\psi_{B| AC}|\right)_{i}, \tag{16}\]

where \(\sum_{i}\lambda_{i}=1\) and \(0\leq\lambda_{i}\leq 1\), with \(m\) iterating from 1 to 20, and \(|\psi_{B|AC}\rangle\) is the generated bipartite entangled states for subsystem AC and separated qubit B.
### Tripartite GHZ state

The state vector of the tripartite GHZ state (final three-qubit entangled state \(|\psi_{f}\rangle\)) can be considered as:

\[|\psi_{f}\rangle=|\Psi_{GHZ}\rangle=\frac{1}{\sqrt{N_{GHZ}}}\left(\cos{(\epsilon )}|000\rangle+\sin{(\epsilon)}e^{i\phi}|\varphi_{A}\varphi_{B}\varphi_{C} \rangle\right) \tag{11}\]

with initial states:

\[|\varphi_{A}\rangle=\cos{(\theta_{A})}|0\rangle+e^{i\phi_{A}}\sin{( \theta_{A})}|1\rangle, \tag{12}\] \[|\varphi_{B}\rangle=\cos{(\theta_{B})}|0\rangle+e^{i\phi_{B}}\sin{ (\theta_{B})}|1\rangle,\] (13) \[|\varphi_{C}\rangle=\cos{(\theta_{C})}|0\rangle+e^{i\phi_{C}}\sin{ (\theta_{C})}|1\rangle, \tag{14}\]

where \(N_{GHZ}=1/(1+\cos{(\delta)}\sin{(\delta)}\cos{(\alpha)}\cos{(\beta)}\cos{( \phi)})\). The angles belong to the intervals \(\delta\in(0,~{}\pi/4]\), \((\alpha,~{}\beta,~{}\gamma)\in(0,~{}\pi/2]\), and \(\phi\in[0,~{}2\pi)\).

### Tripartite W-state

Every W-state can be written as:

\[|\psi_{f}\rangle=|\Psi_{W}\rangle=\frac{1}{\sqrt{N_{W}}}\left(a~{}|001\rangle+ b~{}|010\rangle+c~{}|100\rangle+d~{}|\phi\rangle\right), \tag{15}\]

where normalization coefficient is \(N_{W}=1/\sqrt{|a|^{2}+|b|^{2}+|c|^{2}+|d|^{2}}\), and \(|\phi\rangle\) is a superposition of remaining states that superposed with W-state.

### Tripartite Graph state

The Graph state vector can be considered as:

\[|\psi_{f}\rangle=|\Psi_{Graph}\rangle=\frac{1}{\sqrt{N_{Graph}}}( \alpha_{0}~{}|000\rangle+\alpha_{1}~{}|001\rangle+\alpha_{2}~{}|010\rangle\] \[-\alpha_{3}~{}|011\rangle+\alpha_{4}|100\rangle+\alpha_{5}~{}|10 1\rangle-\alpha_{6}~{}|110\rangle+\alpha_{7}~{}|111\rangle), \tag{16}\]

where normalization coefficient is \(N_{Graph}=1/\sqrt{|\alpha_{0}|^{2}+\ldots+|\alpha_{7}|^{2}}\).
