# Convolutional-Neural-Network-Based Hexagonal Quantum Error Correction Decoder
## 3 Designing a Machine-Learning-Based Decoder for the Heavy Hexagonal Code  
### Error Correction  
Surface codes and Bacon-Shor codes are the most promising error-correcting codes for building quantum computers. Stabilizer formalism is an important basis for understanding the heavy hexagonal code. The hexagonal lattice code is a quantum error-correcting code that maps \(k\) logical qubits to n physical qubits and uses a \(2^{k}\)-dimensional code space \(\mathcal{H}_{C}\) to accommodate these encoded qubits. The code space can be viewed as a \(2^{k}\)-dimensional subspace of the \(2^{n}\)-dimensional Hilbert space defined by codewords \(|\psi\rangle\),  
\[\mathcal{H}_{C}=\{|\psi\rangle\in\mathcal{H}\ |\ g|\psi\rangle=|\psi\rangle \forall g\in\mathcal{S}\}. \tag{4}\]  
The stabilizer group \(\mathcal{S}\) is an Abelian subgroup consisting of the Pauli group \(P_{n}\) of \(n\)-qubits. \(\mathbb{Z}(\mathcal{S})\) is the set of Pauli group elements that satisfy \(\mathbb{Z}(\mathcal{S})\)= \(\{P\in P_{n}\ |\ PS=SP\ |\ \forall S\in\mathcal{S}\}\). The stabilizer code \(\mathbb{C}(\mathcal{S})\) is composed of the minimum number of \(m\) generators \(S_{j}\). \[\mathcal{S}=\langle S_{1},S_{2},\ldots S_{m}\rangle, \tag{5}\]  
and each encoded qubit has a pair of logical operators \((\overline{X}_{j},\overline{Z}_{j})\),  
\[\overline{X}_{j},\overline{Z}_{j}\in\mathbb{Z}(\mathcal{S})\diagdown\mathcal{ S},\qquad\overline{X}_{j}\overline{Z}_{j}=-\overline{Z}_{j}\overline{X}_{j}. \tag{6}\]  
Then, we perform a stabilizer measurement for each generator \(S_{j}\) in \(\mathcal{S}\) and define the syndrome vector \(s\in Z_{2}^{m}\) as  
\[s=(s_{1},s_{1}\ldots s_{m})\ where\ s_{j}= \begin{cases}0,&if\ measurement\ of\ S_{j}\ yields\ +1.\\ 1,&otherwise\end{cases}  \tag{7}\]  
The heavy hexagonal code can be thought of as a hybrid of surface codes and Bacon-Shor codes. Therefore, we can use the error correction properties of surface codes and Bacon-Shor codes to perform error correction on the heavy hexagonal code. In the hexagonal code error, the \(X\) and \(Z\) errors can be corrected by the decoding process of the surface code and the Bacon-Shor code, respectively, where the \(X\)-error correction corresponds to a classical topological surface code [31; 32]. Figure 2 is a circuit diagram for measuring the gauge operators of \(X\)-type and \(Z\)-type. CNOT gates are one of the most commonly used gates in quantum computing for implementing interactions between quantum bits. In CNOT scheduling, we try to optimize the order of operation of CNOT gates to minimize the total number of error positions in the synthesis measurement. A single error correction cycle requires 11 time steps (7 for \(X\) and 4 for \(Z\)), which include qubit initialization and measurement. As shown, the heavy hexagonal code have deeper measurement circuits compared to topological surface codes, but utilizing flag qubits can correct weight-two errors caused by a single error during measurements of the weight-four \(X\)-gauge. This is also a major advantage of the heavy hexagonal code. In this paper, in order to simplify the noise model, we combine the depolarization noise model with the heavy hexagonal code to verify the error correction performance of the heavy hexagonal code. For simpler noise models, the processing of the depolarized noise model is independent. Given a quantum state \(\rho\), the evolution of the state in the depolarization noise model is:  
\[\rho\rightarrow\big{(}1-p_{x}-p_{y}-p_{z}\big{)}\rho+p_{x}X\rho X^{\dagger}+p_ {y}Y\rho Y^{\dagger}+p_{z}Z\rho Z^{\dagger}, \tag{8}\]  
and \(p_{x}=p_{y}=p_{z}\). Among them, \(p_{x}\), \(p_{y}\), and \(p_{z}\), respectively, represent the probability of different Pauli \(X\), \(Y\), and \(Z\) errors. In the heavy hexagonal code measurement circuit, we say that the flag qubit is flagged when it has a nontrivial measurement result. Notethat, nontrivial flag results indicate a weight-two or weight-four data qubit error occurred, or a measurement error triggered the flag.