# Based on Quantum Topological Stabilizer Color Code Morphism Neural Network Decoder

Authors: Li Ding; Haowen Wang; Yinuo Wang; Shumei Wang
Journal: Quantum Engineering
 (2022)

---

## Abstract

Solving for quantum error correction remains one of the key challenges of quantum computing. Traditional decoding methods are limited by computing power and data scale, which restrict the decoding efficiency of color codes. There are many decoding methods that have been suggested to solve this problem. Machine learning is considered one of the most suitable solutions for decoding task of color code. We project the color code onto the surface code, use the deep Q network to iteratively train the decoding process of the color code and obtain the relationship between the inversion error rate and the logical error rate of the trained model and the performance of error correction. Our results show that through unsupervised learning, when iterative training is at least 300 times, a self-trained model can improve the error correction accuracy to 96.5%, and the error correction speed is about 13.8% higher than that of the traditional algorithm. We numerically show that our decoding method can achieve a fast prediction speed after training and a better error correction threshold.


---

## Body

## 1. Introduction

Color code is a kind of quantum error correction topological coding. As an important part of quantum computing, error correction provides the guarantee of quantum information transmission for the new theory in the field of quantum information [1–3] and quantum computing [4–7]. To ensure that the information of the quantum state will not change after transmission or can still be corrected after error, we must find a fast and accurate method of error correction qubits to protect the quantum information from irresistible external interference and ensure that the information transmission can be completed within the decoherence time. Studying the efficiency and algorithm of quantum error correction coding is an important topic in the field of quantum error correction, and it is a difficult problem that must be solved in the construction of quantum computer.Based on the achievements and experience in the field of traditional communication, Shor [8] proposed a quantum error correction scheme in 1994 to reduce the decoherence of qubits during storage. Nine qubits were successfully used to encode one logic bit. However, Shor’s structure is not convenient to expand, and it is difficult to find a structure to protect a specified number of qubits. Most of the current quantum error correction schemes focus on a coding scheme called stabilizer code proposed by Gottesman [9]. The stabilizer composed of Pauli matrix can encode and detect errors more quickly. The topological stabilizer code [10, 11] is an error correction code based on the stabilizer code, which can be mapped to the geometric model. In terms of decoding, the topological stabilizer code can combine its topological structure with the mapped geometry to construct a variety of decoding methods. The surface code proposed by Mariantoni [12] belongs to topological coding. Another widely concerned topological code is the color code [13–16], which allows the horizontal implementation of the whole Clifford gate group, and it can expand from 2D to higher dimensions [17]. At present, one of the research focuses of quantum error correction is how to decode quickly and stably.For color codes, Sarvepalli proposed an alternating iterative error correction method [18], with an error threshold of 7.8%. Because the algorithm is recursive, the decoding speed is not optimal. Recently, machine learning has been paid attention to by various disciplines [19–22], in which deep learning has been applied to various experiments. Machine learning is also widely used in quantum error correction. Machine learning can be used to build decoder frameworks, and deep learning can decode surface codes. In addition, machine learning can also be used to calculate error correction thresholds in quantum error correction [23–25]. The decoding step of topological code makes it very suitable for machine learning training. Then, the trained model can be decoded quickly, which is more efficient and accurate than the traditional method.At present, part of the research on the decoding of quantum topological error correction codes focuses on the decoding of surface codes, and there are few decoding methods for color codes, especially combined with machine learning. This paper first introduces the basic knowledge of quantum error correction code and then analyzes the principle of quantum topological code and error correction mechanism. Then, we propose a decoding method combining projection color code algorithm and deep learning. Our method uses neural network decoder to decode the color code on the surface code. Compared with other color code decoding methods, the decoder proposed in this paper not only completes the corresponding decoding tasks but also significantly improves the decoding performance.


## 2. Background

Stabilizer code is the core of many quantum fault-tolerant computing schemes. It depends on Pauli group, which is one-dimensional.(1)G1=I,X,Y,Z.It consists of four Pauli operators, and then-order Pauli group is defined as the tensor product of N one-dimensional Pauli operators.(2)Gn=P1⊗P2⊗⋯⊗Pn:Pi∈G1,∀i.Commutative operators are usually used as stabilizers because they have common eigenstates.Topological stabilizer code is a kind of stabilizer code with geometric local generators and undetectable errors with topological properties. The number of qubits supported by the stabilizer of topological stabilizer coding and the number of stabilizer itself are bounded. The topological stabilizer code in geometry is shown in Figure1.Figure 1
Topological stabilizer code on double rings.Ea in the stabilizer error corresponds to the green part of the plane. It is geometrically local, and the error can be corrected. Eb corresponds to the red part. It is in the non-shrinking area, and the error cannot be corrected.Surface code is a kind of topological code defined in two-dimensional physical qubits and is shown in Figure2. Each physical qubit relates to four measured qubits, and each logical qubit is connected with four physical qubits.Figure 2
The surface code. The gray dot in the is the physical qubit, and the colored surface is the qubit used for measurement, that is, the logical qubit, which can also be called the stabilizer, in which the blue part isXL and the yellow part is ZL. The top and bottom are the boundaries of Z and the left and right are the boundaries of X.On the boundary, the measurement qubits are only connected with three physical qubits, while the data qubits contact two or three measurement qubits. Linesa and b in the graph are called string operators, and string operators have specific generation rules [12].Color code is also a kind of topological code. Compared with surface code, it uses three colors of faces. Each face hasX and Z stabilizers and vertex is trivalent. This structure provides a lot of convenience for the detection and correction of color codes. The three colors used are just to distinguish different faces. Use(3)Δ0ℒ⟶Zd+1,to represent a d-dimensional color code defined on the ℒ lattice and its colorable surfaces are d + 1. The color code is shown in Figure 3. The generation rules of the string operator of color code and surface code are the same.Figure 3
The color code. On the left is [6, 6, 6]-color code and on the right is [4, 8, 8]-color code. Like the surface code, the white dots in the figures are physical qubits, and each surface represents a logical qubit. Each face has its own boundary.


## 3. Constructing Color Code Decoding Scheme with Machine Learning

### 3.1. Decoding Method of Stabilizer Codes

Use 3-qubit encoding one-logic bit as an example to explain the decoding process.Decoding process.(1)
Suppose the stabilizers is in G=I,Z1Z2,Z2Z3,Z1Z3.(2)
The subspace of the stabilizer isZ1Z2:000,001,110,111, Z2Z3:000,011,100,111, Z1Z3:000,010,101,111.(3)
Select the stabilizer and eigenstate asS=Z1Z2,Z2Z3,000,111, and then we get the following equations: I=Z1Z22,Z1Z3=Z1Z2Z2Z3.(4)
Calculate the stabilizer and analyze the results. IfZ1Z2=−1, qubit 1 or 2 has bit-flip error; if Z2Z3=−1, qubit 2 or 3 has bit-flip error. Use the stabilizer and eigenstate S=X1X2,X2X3,+++,−−− to detect phase reversal error.(5)
According to the error detection results, the corresponding quantum bits are corrected to restore the information of logical bit.


### 3.2. Neural Network Decoding Method of Color Code

Q-learning [26] is an optimization algorithm based on value expectation in reinforcement learning algorithm. Q is transfer function Qs,a, which represents the value expectation obtained by taking action a in state s at a certain time. State s corresponds to the state of the stabilizer in topological coding, and action a is the correction operator corresponding to s.Find out the next action according to the transfer rules.(4)Qs,a=Rs,a+γ⋅maxa˜Qs˜,a˜,where s,a represent the current state and action and s˜,a˜ represent the next state and action. We build a matrix to store the Q values of all states and actions.Since the vertices of the [6]-color code are trivalent and each face hasX and Z stabilizers, the eigenvalue of the three adjacent stabilizers of the wrong qubit will be −1. This information can then be used for error correction. It is shown in Figure 4. There are many ways to add correctors, and we can use QNN to solve the best decoding method.Figure 4
Error in color code. The red dot indicates the quantum bit in error, and the red circle indicates the face of the stabilizer with eigenvalue −1. For multiple adjacent errors, the stabilizer will flip again.Color code can be projected onto the plane code for error correction [27], and this projection supports all decoding algorithms of the surface code. So, the error correction method of the plane code can be extended to the color code. Projection will map the stabilizer and error of color code to the surface code. This projection has a similar projection method for 3D color code [28].The projection rule is denoted by the chain complexes in topology. Letℒc be a d-dimensional lattice.(5)Cd−k−1ℒc⟶∂d−k−1,dCdℒc⟶∂d,k−1Ck−1ℒc↓πc2↓πc1↓πc0Ck+1ℒs⟶∂k+1Ckℒs⟶∂kCk−1ℒs,where k∈1,…,d−1 and πc is the projection of chain complex of K-type color code on ℒc and K-type surface code on ℒs. ∂ is boundary application of complex. Let δ∈Δdℒ prove πC0∂d,k−1δ=∂kπC1δ transformation of (5).(6)πC0∂d,k−1δ=πC0∑μ∈Δk−1δμ=∑μ∈Δk−1δcoloru⊂Cμ=∑μ∈Δk−1δ∣Cμ,where μ is qubit. For arbitrary n∈0,1,…,k−1, all n-simplices μ contained in C are k-simplices.(7)Δnδ|C=v∈Δnδ∣colorv⊂C.So, we get(8)∑μ∈Δk−1δ|Cμ=∂kδ|C=∂k°πC1δ=πC0∂d,k−1δ.The geometric representation of projection is shown in Figure5.Figure 5
Projection of color code. The bottom layer is the color code with face stabilizer. The upper layer on the right is the color code with dot stabilizer. The upper layer on the left is the result of projecting from the right. Stabilizers represented by dots can more intuitively reflect the projection process.Decoding requires each of the three colors to be cast once, so that there are three kinds of subfaces generated by the color code. If the errors of the three faces are extracted in the color code, respectively, the projection of the final error on the surface code can be obtained.


#### 3.2.1. Constructing Neural Network Training Model

After projecting the color code onto the surface code, we will build a neural network decoder to find the optimal string operator through reinforcement learning. The input layer is ad×d matrix. According to the translational symmetry of topological coding, any qubit can be placed in the center of the matrix. The output layer is the Q value that performs different actions. The hidden layer consists of a convolution layer and some fully connected layers. After continuously traversing all defects using the network, update the Q matrix.It is difficult to store complete values in a large state space, so we choose to use deepQ network [29] to approximate learning. Figure 6 shows the structure of the deep Q network Qs,a;w.Figure 6
DeepQ network decoding structure. w represent the parameters in the network. The first training uses random w values.Errors in coding are a collection of errors accumulated by random phase reversal and bit reversal over a period of time.


#### 3.2.2. Decoding Process after Projection

Based on the periodic boundary condition (PBC) of topological coding, we use any faulty stabilizer as the center to represent the whole state. Choose one error as the center and other errors in its relative position. As shown in Figure7, a set of stabilizer states can be represented in many ways, and the two observations in Figure 7 contain the same information.Figure 7
Decoding process. There are four types ofa, which are up, down, left, and right.When the correspondingQ value is obtained, the next action is determined by the algorithm, and the new corrected result is used as input again until there is no error.


### 3.3. Color Code Optimized Decoding Algorithm

The training starts with a random action and sends the stabilizer state to the program. The program uses theQ network with w parameters to generate new P and a and uses E greedy strategy to select action. E controls the degree of randomness. When the random number is greater than 1−E, it selects the previous optimal action; otherwise, it selects a new action. The value of E will decrease as the number of iterations increases, which can traverse all pairs p,a to improve the accuracy of selection. The objective function is(9)yi=ri+γmaxa′QP′,a′;w,P∈O,P′∈O′,where P′ is the next observation before a′ acts on P and ri is value before execution a′. The objective network is(10)Qs,a;w′,w’s updating formula is(11)wt+1′←ε⋅wt+1+1−ε⋅wt,where wt+1′ is updated network parameter. wt+1 is the last network parameter and wt is the last time network parameters.Because the states are not independent, we extract some tuplesP,a,r,O′ as a unit and put them into the buffer for training to ensure that different units are independent and identically distributed. The pseudo-code description of the program is given in Algorithm 1.Algorithm 1: Color code decoder training algorithm.
(1
) color codeC projection to surface code S(2
)While defects e exist do(3
)  fromS to get the observation P of e(4
)  greedy strategy selects the actiona corresponding to the error e(5
)  perform actiona on e(6
)  calculate the valuer of performing action a on e(7
)  obtain the observation resultsO′ after the action a is executed(8
)  save the tupleP,a,r,O′(9
)  update deep neuralQ network(10
)end while(11
) each random draw tupleT(12
)  calculate the objective functionyi←ri+γQT(13
) end for(14
) update network parametersw


## 3.1. Decoding Method of Stabilizer Codes

Use 3-qubit encoding one-logic bit as an example to explain the decoding process.Decoding process.(1)
Suppose the stabilizers is in G=I,Z1Z2,Z2Z3,Z1Z3.(2)
The subspace of the stabilizer isZ1Z2:000,001,110,111, Z2Z3:000,011,100,111, Z1Z3:000,010,101,111.(3)
Select the stabilizer and eigenstate asS=Z1Z2,Z2Z3,000,111, and then we get the following equations: I=Z1Z22,Z1Z3=Z1Z2Z2Z3.(4)
Calculate the stabilizer and analyze the results. IfZ1Z2=−1, qubit 1 or 2 has bit-flip error; if Z2Z3=−1, qubit 2 or 3 has bit-flip error. Use the stabilizer and eigenstate S=X1X2,X2X3,+++,−−− to detect phase reversal error.(5)
According to the error detection results, the corresponding quantum bits are corrected to restore the information of logical bit.


## 3.2. Neural Network Decoding Method of Color Code

Q-learning [26] is an optimization algorithm based on value expectation in reinforcement learning algorithm. Q is transfer function Qs,a, which represents the value expectation obtained by taking action a in state s at a certain time. State s corresponds to the state of the stabilizer in topological coding, and action a is the correction operator corresponding to s.Find out the next action according to the transfer rules.(4)Qs,a=Rs,a+γ⋅maxa˜Qs˜,a˜,where s,a represent the current state and action and s˜,a˜ represent the next state and action. We build a matrix to store the Q values of all states and actions.Since the vertices of the [6]-color code are trivalent and each face hasX and Z stabilizers, the eigenvalue of the three adjacent stabilizers of the wrong qubit will be −1. This information can then be used for error correction. It is shown in Figure 4. There are many ways to add correctors, and we can use QNN to solve the best decoding method.Figure 4
Error in color code. The red dot indicates the quantum bit in error, and the red circle indicates the face of the stabilizer with eigenvalue −1. For multiple adjacent errors, the stabilizer will flip again.Color code can be projected onto the plane code for error correction [27], and this projection supports all decoding algorithms of the surface code. So, the error correction method of the plane code can be extended to the color code. Projection will map the stabilizer and error of color code to the surface code. This projection has a similar projection method for 3D color code [28].The projection rule is denoted by the chain complexes in topology. Letℒc be a d-dimensional lattice.(5)Cd−k−1ℒc⟶∂d−k−1,dCdℒc⟶∂d,k−1Ck−1ℒc↓πc2↓πc1↓πc0Ck+1ℒs⟶∂k+1Ckℒs⟶∂kCk−1ℒs,where k∈1,…,d−1 and πc is the projection of chain complex of K-type color code on ℒc and K-type surface code on ℒs. ∂ is boundary application of complex. Let δ∈Δdℒ prove πC0∂d,k−1δ=∂kπC1δ transformation of (5).(6)πC0∂d,k−1δ=πC0∑μ∈Δk−1δμ=∑μ∈Δk−1δcoloru⊂Cμ=∑μ∈Δk−1δ∣Cμ,where μ is qubit. For arbitrary n∈0,1,…,k−1, all n-simplices μ contained in C are k-simplices.(7)Δnδ|C=v∈Δnδ∣colorv⊂C.So, we get(8)∑μ∈Δk−1δ|Cμ=∂kδ|C=∂k°πC1δ=πC0∂d,k−1δ.The geometric representation of projection is shown in Figure5.Figure 5
Projection of color code. The bottom layer is the color code with face stabilizer. The upper layer on the right is the color code with dot stabilizer. The upper layer on the left is the result of projecting from the right. Stabilizers represented by dots can more intuitively reflect the projection process.Decoding requires each of the three colors to be cast once, so that there are three kinds of subfaces generated by the color code. If the errors of the three faces are extracted in the color code, respectively, the projection of the final error on the surface code can be obtained.


### 3.2.1. Constructing Neural Network Training Model

After projecting the color code onto the surface code, we will build a neural network decoder to find the optimal string operator through reinforcement learning. The input layer is ad×d matrix. According to the translational symmetry of topological coding, any qubit can be placed in the center of the matrix. The output layer is the Q value that performs different actions. The hidden layer consists of a convolution layer and some fully connected layers. After continuously traversing all defects using the network, update the Q matrix.It is difficult to store complete values in a large state space, so we choose to use deepQ network [29] to approximate learning. Figure 6 shows the structure of the deep Q network Qs,a;w.Figure 6
DeepQ network decoding structure. w represent the parameters in the network. The first training uses random w values.Errors in coding are a collection of errors accumulated by random phase reversal and bit reversal over a period of time.


### 3.2.2. Decoding Process after Projection

Based on the periodic boundary condition (PBC) of topological coding, we use any faulty stabilizer as the center to represent the whole state. Choose one error as the center and other errors in its relative position. As shown in Figure7, a set of stabilizer states can be represented in many ways, and the two observations in Figure 7 contain the same information.Figure 7
Decoding process. There are four types ofa, which are up, down, left, and right.When the correspondingQ value is obtained, the next action is determined by the algorithm, and the new corrected result is used as input again until there is no error.


## 3.2.1. Constructing Neural Network Training Model

After projecting the color code onto the surface code, we will build a neural network decoder to find the optimal string operator through reinforcement learning. The input layer is ad×d matrix. According to the translational symmetry of topological coding, any qubit can be placed in the center of the matrix. The output layer is the Q value that performs different actions. The hidden layer consists of a convolution layer and some fully connected layers. After continuously traversing all defects using the network, update the Q matrix.It is difficult to store complete values in a large state space, so we choose to use deepQ network [29] to approximate learning. Figure 6 shows the structure of the deep Q network Qs,a;w.Figure 6
DeepQ network decoding structure. w represent the parameters in the network. The first training uses random w values.Errors in coding are a collection of errors accumulated by random phase reversal and bit reversal over a period of time.


## 3.2.2. Decoding Process after Projection

Based on the periodic boundary condition (PBC) of topological coding, we use any faulty stabilizer as the center to represent the whole state. Choose one error as the center and other errors in its relative position. As shown in Figure7, a set of stabilizer states can be represented in many ways, and the two observations in Figure 7 contain the same information.Figure 7
Decoding process. There are four types ofa, which are up, down, left, and right.When the correspondingQ value is obtained, the next action is determined by the algorithm, and the new corrected result is used as input again until there is no error.


## 3.3. Color Code Optimized Decoding Algorithm

The training starts with a random action and sends the stabilizer state to the program. The program uses theQ network with w parameters to generate new P and a and uses E greedy strategy to select action. E controls the degree of randomness. When the random number is greater than 1−E, it selects the previous optimal action; otherwise, it selects a new action. The value of E will decrease as the number of iterations increases, which can traverse all pairs p,a to improve the accuracy of selection. The objective function is(9)yi=ri+γmaxa′QP′,a′;w,P∈O,P′∈O′,where P′ is the next observation before a′ acts on P and ri is value before execution a′. The objective network is(10)Qs,a;w′,w’s updating formula is(11)wt+1′←ε⋅wt+1+1−ε⋅wt,where wt+1′ is updated network parameter. wt+1 is the last network parameter and wt is the last time network parameters.Because the states are not independent, we extract some tuplesP,a,r,O′ as a unit and put them into the buffer for training to ensure that different units are independent and identically distributed. The pseudo-code description of the program is given in Algorithm 1.Algorithm 1: Color code decoder training algorithm.
(1
) color codeC projection to surface code S(2
)While defects e exist do(3
)  fromS to get the observation P of e(4
)  greedy strategy selects the actiona corresponding to the error e(5
)  perform actiona on e(6
)  calculate the valuer of performing action a on e(7
)  obtain the observation resultsO′ after the action a is executed(8
)  save the tupleP,a,r,O′(9
)  update deep neuralQ network(10
)end while(11
) each random draw tupleT(12
)  calculate the objective functionyi←ri+γQT(13
) end for(14
) update network parametersw


## 4. Simulation and Analysis

First, randomly build a dataset with a turnover error rate of 16% to 23%. The dataset is divided into fixed size and sent to the program for training. The results of each processing of coding errors are sent to the program as feedback for operation until all errors are corrected, and then a round of training is completed.In the error correction process, we do not need to consider external factors, so the depolarized noise model can be selected as an ideal equi-probability model. In addition, other non-noise factors will also affect the success rate of code error correction, but it can be ignored here. If you want to further optimize the training results, you can useL1 normalization or L2 normalization to limit the cost decision of Q network.


### 4.1. Error Correction Success Rate under Bit-Flip Error

The program uses a 7-layer residual network (ResNet). In order to avoid the problem of too slow training speed caused by too fast gradient decline, ReLU function is used to assist in the training process. For systems with Hamming distanced=3,5,7, the results of error correction success rate after program training under bit reversal error are shown in Figure 8.Figure 8
The error correction success rate under bit-flip error simulation results. We calculated the error correction success rate for distanced= 3 (blue), 5 (orange), and 7 (green).When the flip error rate is lower than 17.4%, the error correction success rate of different code distances is very close. At a lower error rate, the error correction success rate of the three Hamming distances is very high. When the error rate increases by 1%, the error correction success rate decreases by about 20%. When the turnover error rate is between 17.4% and 19.6%, the error correction success rate is the highest whend=3, and then when the error rate is between 19.6% and 20.3%, the error correction success rate when d=5 is higher than that when d=3. After the error rate reaches 20.3%, the error correction success rate under the three Hamming distances tends to be stable. Because with the increase of flip error rate, the error correction success rate of hamming distance will also raise. When the Hamming distance increases, the error correction threshold will also decrease, and the error correction success rate will decrease. Therefore, the error correction code with lower Hamming distance will obtain higher error correction success rate. It is observed that when the error rate reaches 22.1%, the error correction success rate of the error correction code with d=5 decreases significantly compared with the error correction code with other Hamming distances, which indicates that there will be wrong judgment in the actual error correction application of the trained network, which may lead to the greedy strategy choosing the wrong action.


### 4.2. Logical Error Rate under Bit-Flip Error

Different Hamming distance codes have different logic error rates under certain flipping error rates. This is because when the Hamming distance is large, the error caused by bit flipping may become another correct code in the coding table or become an error that cannot be corrected, thus changing its own logic information. Figure9 shows the change of the logic error rate at a high flip-error rate.Figure 9
The logical error rate under bit-flip error simulation results. We calculated the logical error rate for distanced= 5 (blue), 7 (orange), and 9 (green).Whend = 5, the logic error rate is the lowest among the three Hamming distances. When the turnover error rate is 16.0%, the logic error rate of the minimum Hamming distance in the simulation is about 6.2% lower than the maximum. Among them, the size of logical error rate also corresponds to the size of Hamming distance. The logical error rate of D = 9 is higher than that of other smaller Hamming distances within the error rate range shown in the figure. The logical error rate curves of the three Hamming distances are arranged according to the size of Hamming distance as a whole. When the turnover error rate reaches 21.5%, the logical error rate of the three is close to the same, reaching about 62.6%. After the error rate reaches 21.5%, the logic error rate changes around 60.0% and gradually tends to be stable within the range shown in the figure.Through the first two experiments, it is concluded that under the low error rate, this method has good performance with other color code error correction methods, and the error correction success rate is almost equivalent. For the larger Hamming distanced=7, if the error rate is too large, the error correction performance is lower than that of some error correction methods. In the case of large Hamming distance, the state space increases exponentially, and the resulting error correction success rate decreases within a predictable range. However, by upgrading the hardware level, expanding the hardware scale of data processing, and adjusting the size of neural network, the error correction tasks under larger Hamming distance or higher error rate can be handled under the current conditions.For systems with different Hamming distances, the point where the logical error rate is equal to the physical error rate is called level-1 pseudo-threshold, which is obtained by fitting the pseudo-threshold to the following formula [30]:(12)td=ad−1v+t∞,where td is the pseudo-threshold when the Hamming distance is d and t∞ is the threshold under the limit. v is the scaling exponent and a is the coefficient. The least square fitting is used to fit the curve of flip error rate and logic error rate, find the level-1 pseudo-threshold with different Hamming distance, and then bring them into the formula to solve the non-linear equation. After calculation, we obtain t∞≅15.74%,a≅0.0053,v≅23.92.


### 4.3. Influence of Training Iteration Times on Accuracy

The number of iterations and layers of neural network have a great influence on the accuracy of the model. We tested the effect of iteration number on decoding accuracy and used different network layers for comparison. Figure10 shows the number of iterations and training accuracy.Figure 10
The training iteration times on accuracy simulation results. We calculated the hidden layers for numberL= 7 (blue), 14 (orange), and 21 (green).By increasing the number of convolution layers of the network and adjusting the number of training iterations, we can obviously observe that the accuracy of training has improved, but after the number of iterations reaches more than 300, it is easy to have overfitting phenomenon, and the improvement of performance is small, which is basically maintained at about 9.0%. Normally, more precise training data can be obtained by increasing the number of layers of the network. By comparing the network training ofL=7 and L=14, it can be found that before the number of iterations reaches 300, the network of L=14 obtains better accuracy, which is about 0.3% higher than the network of L = 7 in each training interval. Comparing the accuracy curves of L=14 and L=21 networks, it can be seen that before the number of iterations reaches 120, the accuracy of L=21 network is slightly higher than that of L=14 network. After 300 iterations, the accuracy of the three networks began to swing. The network with L=7 had the highest accuracy about 320 times, the network with L = 14 had the highest accuracy about 360 times, and the network with L = 21 had the highest accuracy about 400 times.After fully trained program depth, the Q-value matrix of q-network will be supplemented completely, the performance will be close to the optimal decoder, and the decoding efficiency and accuracy will be improved a lot. Q-depth neural network has few adjustable parameters, which is also convenient for decoding training.


## 4.1. Error Correction Success Rate under Bit-Flip Error

The program uses a 7-layer residual network (ResNet). In order to avoid the problem of too slow training speed caused by too fast gradient decline, ReLU function is used to assist in the training process. For systems with Hamming distanced=3,5,7, the results of error correction success rate after program training under bit reversal error are shown in Figure 8.Figure 8
The error correction success rate under bit-flip error simulation results. We calculated the error correction success rate for distanced= 3 (blue), 5 (orange), and 7 (green).When the flip error rate is lower than 17.4%, the error correction success rate of different code distances is very close. At a lower error rate, the error correction success rate of the three Hamming distances is very high. When the error rate increases by 1%, the error correction success rate decreases by about 20%. When the turnover error rate is between 17.4% and 19.6%, the error correction success rate is the highest whend=3, and then when the error rate is between 19.6% and 20.3%, the error correction success rate when d=5 is higher than that when d=3. After the error rate reaches 20.3%, the error correction success rate under the three Hamming distances tends to be stable. Because with the increase of flip error rate, the error correction success rate of hamming distance will also raise. When the Hamming distance increases, the error correction threshold will also decrease, and the error correction success rate will decrease. Therefore, the error correction code with lower Hamming distance will obtain higher error correction success rate. It is observed that when the error rate reaches 22.1%, the error correction success rate of the error correction code with d=5 decreases significantly compared with the error correction code with other Hamming distances, which indicates that there will be wrong judgment in the actual error correction application of the trained network, which may lead to the greedy strategy choosing the wrong action.


## 4.2. Logical Error Rate under Bit-Flip Error

Different Hamming distance codes have different logic error rates under certain flipping error rates. This is because when the Hamming distance is large, the error caused by bit flipping may become another correct code in the coding table or become an error that cannot be corrected, thus changing its own logic information. Figure9 shows the change of the logic error rate at a high flip-error rate.Figure 9
The logical error rate under bit-flip error simulation results. We calculated the logical error rate for distanced= 5 (blue), 7 (orange), and 9 (green).Whend = 5, the logic error rate is the lowest among the three Hamming distances. When the turnover error rate is 16.0%, the logic error rate of the minimum Hamming distance in the simulation is about 6.2% lower than the maximum. Among them, the size of logical error rate also corresponds to the size of Hamming distance. The logical error rate of D = 9 is higher than that of other smaller Hamming distances within the error rate range shown in the figure. The logical error rate curves of the three Hamming distances are arranged according to the size of Hamming distance as a whole. When the turnover error rate reaches 21.5%, the logical error rate of the three is close to the same, reaching about 62.6%. After the error rate reaches 21.5%, the logic error rate changes around 60.0% and gradually tends to be stable within the range shown in the figure.Through the first two experiments, it is concluded that under the low error rate, this method has good performance with other color code error correction methods, and the error correction success rate is almost equivalent. For the larger Hamming distanced=7, if the error rate is too large, the error correction performance is lower than that of some error correction methods. In the case of large Hamming distance, the state space increases exponentially, and the resulting error correction success rate decreases within a predictable range. However, by upgrading the hardware level, expanding the hardware scale of data processing, and adjusting the size of neural network, the error correction tasks under larger Hamming distance or higher error rate can be handled under the current conditions.For systems with different Hamming distances, the point where the logical error rate is equal to the physical error rate is called level-1 pseudo-threshold, which is obtained by fitting the pseudo-threshold to the following formula [30]:(12)td=ad−1v+t∞,where td is the pseudo-threshold when the Hamming distance is d and t∞ is the threshold under the limit. v is the scaling exponent and a is the coefficient. The least square fitting is used to fit the curve of flip error rate and logic error rate, find the level-1 pseudo-threshold with different Hamming distance, and then bring them into the formula to solve the non-linear equation. After calculation, we obtain t∞≅15.74%,a≅0.0053,v≅23.92.


## 4.3. Influence of Training Iteration Times on Accuracy

The number of iterations and layers of neural network have a great influence on the accuracy of the model. We tested the effect of iteration number on decoding accuracy and used different network layers for comparison. Figure10 shows the number of iterations and training accuracy.Figure 10
The training iteration times on accuracy simulation results. We calculated the hidden layers for numberL= 7 (blue), 14 (orange), and 21 (green).By increasing the number of convolution layers of the network and adjusting the number of training iterations, we can obviously observe that the accuracy of training has improved, but after the number of iterations reaches more than 300, it is easy to have overfitting phenomenon, and the improvement of performance is small, which is basically maintained at about 9.0%. Normally, more precise training data can be obtained by increasing the number of layers of the network. By comparing the network training ofL=7 and L=14, it can be found that before the number of iterations reaches 300, the network of L=14 obtains better accuracy, which is about 0.3% higher than the network of L = 7 in each training interval. Comparing the accuracy curves of L=14 and L=21 networks, it can be seen that before the number of iterations reaches 120, the accuracy of L=21 network is slightly higher than that of L=14 network. After 300 iterations, the accuracy of the three networks began to swing. The network with L=7 had the highest accuracy about 320 times, the network with L = 14 had the highest accuracy about 360 times, and the network with L = 21 had the highest accuracy about 400 times.After fully trained program depth, the Q-value matrix of q-network will be supplemented completely, the performance will be close to the optimal decoder, and the decoding efficiency and accuracy will be improved a lot. Q-depth neural network has few adjustable parameters, which is also convenient for decoding training.


## 5. Conclusions

As a quantum error correction code, the color code studied in this paper obtains good results in quantum error correction under ideal conditions. For the color code and surface code which belong to the same topological stabilizer code, we use the projection method to map the color code to the surface code and then use the depth neural network to correct the projected surface code. The training accuracy can reach about 96.5%. By using the 21-layer residual network, the training time can be further reduced by about 29%. Applying the error correction method of surface code to color code increases the application scope of the traditional error correction method of surface code and expands the error correction idea of color code. However, it can be seen from the simulation results that there are many unstable disturbances outside the ideal situation. For these noises that affect quantum physical transmission, we should combine the current quantum transmission protocols to ensure the effectiveness of color code in coding and transmission. While vigorously developing the error correction theory, we should also pay attention to the combination with some quantum device, bring the actual experimental environment into the consideration of simulation, and reduce the interference of external factors while developing and optimizing the optimal decoding scheme, so as to optimize and improve the accuracy of quantum algorithm and quantum calculation.



---

*Source: 9638108-2022-07-20.xml*