Trapping Sets of Quantum LDPC Codes

Iterative decoders for finite length quantum low-density parity-check (QLDPC) codes are attractive because their hardware complexity scales only linearly with the number of physical qubits. However, they are impacted by short cycles, detrimental graphical configurations known as trapping sets (TSs) present in a code graph as well as symmetric degeneracy of errors. These factors significantly degrade the decoder decoding probability performance and cause so-called error floor. In this paper, we establish a systematic methodology by which one can identify and classify quantum trapping sets (QTSs) according to their topological structure and decoder used. The conventional definition of a TS from classical error correction is generalized to address the syndrome decoding scenario for QLDPC codes. We show that the knowledge of QTSs can be used to design better QLDPC codes and decoders. Frame error rate improvements of two orders of magnitude in the error floor regime are demonstrated for some practical finite-length QLDPC codes without requiring any post-processing.


Introduction
Quantum low-density parity check (QLDPC) codes are an important class of quantum error correction (QEC) [2,3] codes that can realize scalable fault-tolerant quantum computers (FTQCs) with a finite multiplicative overhead [4]. In addition, they have finite asymptotic rates with non-zero fault-tolerant thresholds [5], and support low-complexity iterative decoding.
The existing QLDPC code literature primarily focuses on constructing asymptotically good code families with improved minimum distance scaling with the block length and higher code rates, as well as on designing better iterative decoding algorithms [6][7][8][9][10][11][12]. However, QLDPC codes implemented in practical QEC systems will be of finite length and will exhibit performance degradation due to the failure of iterative decoders to converge to a correct error pattern. This phenomenon specific to finite-length codes is well understood in classical literature, but similar analysis for QLDPC codes and precise mathematical characterization requires further attention in the QEC literature [7,13]. The convergence failure manifests itself as an error floor of the decoding probability of error [14] at low physical error rate levels -an operating regime for large-scale FTQCs -and is observed in all state-of-the-art iterative message-passing decoders for QLDPC codes such as belief propagation (BP), min-sum algorithm (MSA) and their variants [15][16][17].
A typical approach in QEC literature to reduce the error floor of the above decoding algorithms is to couple them with ordered statistics decoding (OSD) and post-processing [15,17]. However, although exhibiting good performance, this technique is too complex to implement in hardware due to the high complexity of the OSD algorithm [18] which scales cubically with the code dimension (see Eq. 4 in [19]). In contrast, the philosophy of our approach and our ultimate goal is to develop message-passing decoders for QLDPC codes that do not require a post-processing step to achieve strong error correction.
Iterative message-passing decoder operates on a Tanner graph which is the graphical representation of a parity check matrix of the underlying code. Error floor is attributed to the presence of specific topologies of sub-graphs in the Tanner graph, generically referred to as trapping sets (TSs) that are detrimental to iterative decoders. Since a trapping set depends both on the topol-ogy of the sub-graph and on the decoder, one must understand key differences of QEC, specifically QLDPC codes and decoding with respect to classical error correction.
The first difference comes as the fact that the stabilizer commutativity/symplectic inner product (SIP) requirement for the parity check matrices introduces additional code construction constraints resulting in unavoidable cycles in the Tanner graph. Furthermore, QLDPC codes are known to be highly degenerate, i.e., their minimum distance is higher than the weight of their stabilizers. From the decoder perspective, this implies that the decoders need to account for degenerate errors, which have no equivalent in classical error correction. However, iterative algorithms based on BP are sub-optimal in the presence of cycles and, also, are not capable of correcting all degenerate errors [13,20]. Another key difference from classical LDPC decoding stems from the inability to directly measure qubits for error correction. Hence, the iterative messagepassing algorithms used for decoding of QLDPC codes are modified to only make use of the syndrome information to infer the error introduced by the channel. How the classical trapping sets definition accommodates a syndrome-based decoder is not clearly understood. As we show, degenerate errors having no classical analogy introduces new failure configurations unique to the QLDPC codes. The approach presented in this paper accounts for these key differences and their implications.
Failure configurations of QLDPC codes are relatively unknown when compared to the classical trapping set research. One major drawback of BP as pointed out in [21] is that the decoding ability of BP is typically limited by the row weight of the parity-check matrix due to the SIP constraint and identifies pseudo-codeword structures for cycle codes. However, generalization from cycle codes to QLDPC codes is non-trivial.
In this paper, we define quantum trapping sets (QTSs) by investigating failure configurations for syndrome based iterative message passing algorithms. The quantum trapping set formulation is modified to the syndrome decoding scenario for QLDPC codes considering Pauli X and Z errors separately. We identify QTSs of prominent QLDPC code families and show that the QTSs must be analyzed in conjunction with the partic-ular iterative decoder used along with their location in the Tanner graph [22]. In the same flavor as in classical LDPC codes where the knowledge of trapping sets has resulted in low-complexity decoders surpassing the traditional BP decoder [23], in this paper, we demonstrate two practical advantages of our quantum trapping set study: (i) ability to construct QLDPC codes devoid of such graphical configurations, and (ii) ability to devise new decoding algorithms that escape from such graphical configurations without post-processing. The message update rules and scheduling strategies thus identified help to improve the error floor performance.
The rest of this paper is organized as follows. In Section 2, we introduce QLDPC codes using the stabilizer formalism reviewing some basic notations, and then discuss the syndrome decoding problem and classical trapping sets. In Section 3, we analyze the different failure configurations and the relation between trapping sets and decoder-error correction properties. We also formally define quantum trapping sets and describe the methodology used to identify those specifically for Calderbank, Shor, Steane (CSS) codes [24]. Trapping sets of some classes of CSS codes are analyzed in Section 4. Based on these analyses, we present simulation results that briefly explore two strategies of code and decoder improvement. We explore CSS code constructions without some of the harmful configurations and compare the performance of trapping set-aware decoding strategies in Section 5 followed by concluding remarks and future research directions in Section 6.

Stabilizer Formalism
Stabilizer codes, the quantum analog of classical linear codes, are the most common type of QEC codes considered in both theory and practice [25,26]. An n, k, d quantum stabilizer code maps k qubit quantum state |φ to an entangled n-qubit codeword |ψ (a unit vector in the 2 n -dimensional Hilbert space) and is defined as a 2 k -dimensional subspace of the Hilbert space which is a common +1 eigenspace of the stabilizer group S. The n-qubit codeword |ψ is stabilized by all stabilizer elements in S. i.e., s j |ψ = + |ψ for any s j ∈ S. We denote a gen-erator set of a given stabilizer group S by the set S = {s 1 , s 2 , . . . , s m }. The stabilizer generators form the m = n − k rows of the corresponding stabilizer matrix H p whose entries are the singlequbit Pauli matrices Kronecker products of n single-qubit Paulis and scalars ı κ , where κ ∈ Z 4 = {0, 1, 2, 3} forms the n-qubit Pauli group P n , of which the stabilizer group S is a commutative subgroup that contains only Hermitian Paulis and excludes −I n . The weight w(P ) of a Pauli operator P ∈ P n is the number of qubits on which it applies a non-identity Pauli matrix. A QLDPC code is a stabilizer code with all stabilizer generators having low weight [2]. Analogous to the classical minimum distance, n, k, d code have logical operators L ∈ P n \ S that commutes with all s i having minimum weight d. Like the codeword generators, the logical operators of the code map an n-qubit codeword to another. Logical group L is generated by k logical X generators: L X = {lx 1 , lx 2 , . . . , lx k } and k logical Z generators: L Z = {lz 1 , lz 2 , . . . , lz k } obtained by using either Gottesman's [26] or Wilde's algorithm [27].
The stabilizers commute with each other following the commutativity relation between two n-qubit Pauli operators P and Q defined as follows: The Pauli operators P and Q commute if P • Q = +1 and anti-commute if P • Q = −1. Every logical generators commute with the stabilizers, and Lx i commutes with every other generators except with Lz i ∀i ∈ {1, k}.

Stabilizers as binary parity checks
An alternative binary representation maps Pauli matrices to binary tuples as follows: More generally, binary representation of an nqubit Pauli operator P will be a binary vector of length 2n of the form p = (p X , p Z ), where p X and p Z are of length n each with ones at positions of X-and Z-Pauli components, respectively. Such a mapping aids in the construction of quantum stabilizer codes using extensive classical coding literature. The binary representation H b of the stabilizer matrix of dimension m × 2n given by where H X and H Z represent binary parity check matrices used for error correction. Each row in H b denotes a stabilizer generator, and a pair of corresponding columns in H X and H Z represent a qubit. Equivalent to the commutativity relation defined for Pauli operators, the stabilizer generators commute with each other based on the symplectic inner product (SIP) in their binary representation [25]. Any two rows p = (p X , p Z ) and This leads to the condition where the right hand side (0) is an m × m zero matrix, T denotes the transpose of a matrix, and operations (addition and multiplication) are done modulo-2. We will refer to Eq. (2) as the SIP constraint.

Decoding Problem
Following the approach in [2], to assess performance of binary syndrome decoding of CSS codes, it is sufficient to consider the two independent binary symmetric channels (BSCs) rather than the depolarizing channel, thus ignoring the correlation between bit flip (X) and phase flip (Z) errors. In this case, the BSCs for X and Z errors have a cross-over probability of 2p/3, decoded using H Z and H X , respectively. Let e = (e X , e Z ) be the binary representation of a Pauli error acting on the n qubits. The corresponding syndrome is computed as All-zero syndrome σ =0 indicates that all the stabilizers commute with the error pattern (undetectable error), whereas non-zero entries/ones in σ indicate that some stabilizer generators anticommute with the error pattern (detectable error). A syndrome based decoder's task is to estimate the error patternê whose syndromeσ matches with the initial input syndrome σ. If σ = σ, the estimated error patternê is applied to reverse the error e introduced by the channel.
Error correction process is successful ifê = e ⊕ h, where h ∈ rowspace(H b ), i.e., if the code word is recovered up to a stabilizer (ê ⊕ e is a stabilizer, where ⊕ denotes pairwise XOR). Error correction fails when the decoder is unable to find an error pattern that matches the syndrome σ or when the decoding process results in a logical error, also referred to as miss-correction in classical coding theory literature. A logical error occurs if e ⊕ e is a logical operator such that post error correction state is a codeword different from the original codeword. We can detect a logical error if Pauli representation ofê ⊕ e anti-commutes with any of the 2k logical generators.

Iterative Decoding of CSS codes
Although the syndrome decoding paradigm is applicable to any class of quantum codes, trapping set analysis in this paper is focused on QLDPC families: hypergraph product (HP) codes [8], bicycle codes [2] and generalized bicycle codes [15] representing the CSS class of codes [24]. An attractive property of CSS codes constructed from two classical codes C 1 and C 2 , where C ⊥ 2 ⊆ C 1 is that the parity check matrix can be written in a separable form: codes have a sparse matrix H b with the SIP constraint: H Z .H T X = 0. We can perform error correction for the X and Z errors separately using H Z and H X matrices, respectively. The corresponding input syndromes are obtained as σ X = mod (H Z .e T X , 2) and σ Z = mod (H X .e T Z , 2), respectively. For simplicity going forward, we use H, L and σ, e for the parity check matrix, logical generator matrix, input syndrome, and channel error vector, respectively.
The stabilizer generator matrix/parity check matrix H is the bi-adjacency matrix of a bipartite Tanner graph G = (V ∪ C, E), where V represents the set of n qubit/variable nodes (VNs), C is the set of m stabilizer generators/check nodes (CNs) and E is the set of edges between them. CN c i ∈ C and VN v j ∈ V are neighbors if there is an edge (v j , c i ) ∈ E between the nodes, corresponding to the non-zero entry in the parity check matrix H c i ,v j = 1. Diagrammatically, Tanner graphs are drawn with circles representing VNs, squares representing CNs, and solidlines representing the edges. Let us denote the set of CNs connected to a VN v j by N (v j ), and |N (v j )|, where | · | denotes cardinality, is referred to as the degree of the VN v j . Similarly, we can define the neighbor set and the degree of a CN c i as N (c i ) and |N (c i )|, respectively. A (γ, ρ) QLDPC code have a sparse stabilizer matrix with the variable and stabilizer degree upper-bounded by γ and ρ respectively. For a subset of VNs, say K ⊆ V, N (K) denotes the set of CN neighbors. The induced sub-graph G(K) is the graph containing the nodes K ∪N (K) along with the edges {(x, y) ∈ F : x ∈ K, y ∈ N (K)}. The girth, g, of the Tanner graph G is the length of the shortest cycle in G. Denote the number of cycles of length g, g +2, . . . by χ g , χ g+2 , . . ., respectively. If G has χ g , χ g+2 , . . . cycles of length g, g + 2, . . ., then the cycle enumerator series CYC(x) = r≥0 χ r x r defines the cycle profile of G.
The goal of a syndrome-based iterative decoder D s is to output an error pattern that matches the input syndrome. This is different from the traditional iterative decoder D that uses the channel information as initial likelihoods to recover the codeword matching to an all-zero syndrome. Starting from an input syndrome σ and an allzero error vector estimate, D s performs a finite number max of iterations of decoding over the Tanner graph. The messages are passed over the edges of the Tanner graph from check nodes to their neighboring variable nodes and vice versa at every iteration of message passing decoding. Decoder update rules and message alphabet size can be of varying complexity ranging from the simplest binary message passing algorithms such as Gallager-B [28] to finite alphabet iterative decoders [23], and MSA or BP using floating point messages [2]. Also, schedule of message passing in D s can be implemented with a flooding/parallel schedule or a layered/serial schedule. Trapping set analysis presented here is applicable for all such decoder implementations. We discuss a generic syndrome-based iterative decoder in Appendix A for completeness. Based on the update rules, D s outputs an error vector estimatê i as the value of the variable/check node v j /c i at iteration ≤ max . We conclude that D s is successful if the output syndromeσ ( ) is equal to the input syndrome σ (we also say that syndromes are matched ). Then, the n-length error patternê ( ) is decided as the most likely error pattern. The iterative procedure is halted if successfully matched or if max number of iterations is reached. At the end of iterative decoding, the syndrome decoding process is successful if the syndromes are matched. Otherwise, the decoding is said to have failed.

Classical Trapping Sets
A classical trapping set example is shown in Fig. 1 illustrating the failure of a classical iterative decoder D on a small sub-graph inside the Tanner graph. Let us consider a simple binary message passing decoder -Gallager-B decoder which performs XOR operation at the check nodes and a majority voting at the variable nodes. More precisely, the outgoing check node message over an edge is computed as the XOR of extrinsic (all incoming messages except the edge for the message is updated) variable node messages. The outgoing variable node message is the majority value among incoming extrinsic check node messages and the channel value. The messages passed over corresponding edges are marked next to the directed arrows in the figure. All-zero transmitted codeword has errors only on three variable nodes The decoder is unable to converge to the all-zero codeword. In fact, the decoder oscillates from the error pattern (v 2 , v 4 , v 5 ) to (v 1 , v 3 ) and back as its output during the decoding iterations, thus failing to converge.
A classical iterative decoder is said to converge correctly if the decoder output word for any ≤ max matches to the transmitted codeword and fails to converge correctly otherwise. A variable node v j is eventually correct if there exists a positive integer I j such that for all iterations ≥ I j , the decoder's estimate of v j is equal to the transmitted bit value. Then, trapping set is defined as Definition 1 ( [16]) A trapping set T for an iterative decoder D is a non-empty set of variable nodes in a Tanner graph G that are not eventually correct. If the sub-graph G(T ) induced by such a set of variable nodes has a variable nodes and b odd degree check nodes, then the trapping set T is conventionally labeled as an (a, b) trapping set.  graphs observed in classical LDPC codes. Even at low physical error rate levels, the presence of such small sub-graphs can result in decoding failures resulting in the characteristic error floors in their decoding performance (frame error rate (FER) vs. physical error rate) curves.
Harmfulness of a TS is also closely linked to the decoder through their critical number µ and strength s defined as follows: Definition 2 Critical number µ of a trapping set T is the minimal number of variable nodes that have to be initially in error for the decoder to fail to converge.
Let failure inducing set be the set of variable nodes that have to be initially in error for the decoder to fail to converge.  TS. The first one is that the minimum distance of the code is large compared to the size of the TS. The second is an isolation assumption [23] which ensures that messages from outside the TS are correct for the TS failure analysis. For example, from Fig. 1, the critical number µ for the (5, 3) TS with Gallager-B decoder is 3 and the number of weight-µ error patterns that fail is s = 1. Note that the decoder also fails to correct weight-4 error patterns and the weight-5 error pattern in the TS. Error floor of the decoder is dominated by the minimum critical number µ min and the number of weight-µ min failure inducing error patterns. Analytical/semi-analytical estimation of error floors of QLDPC codes using critical number and strength of TSs is beyond the scope of this paper and we refer the reader to classical LDPC literature [16,22].

Quantum Trapping Sets
As our focus is on the error floor regime, we are interested in error patterns with small weight, well below the maximum likelihood (ML) error correction capability of the QLDPC code for which the syndrome-based iterative decoder D s fails to converge. Such low-weight error patterns are either part of a classical-type TS or a symmetric stabilizer, defined as a quantum trapping set (QTS).

Definition of a Quantum Trapping Set
After pre-defined number of iterations, max , of iterative syndrome decoding, we declare that the decoder D s failed for a particular input syndrome/error pattern if the decoder is not able to find an error pattern with a syndrome equal to the input syndrome. More precisely, a decoder failure is said to have occurred if there does not exist ≤ max such that supp(σ ( ) + σ) = ∅, where supp denotes the support set (indices of non-zero elements). During iterative decoding, a check node c i is eventually satisfied if there exists a positive integer I i such that for all ≥ I i , σ ( ) i = σ i . We say that the variable node v i has eventually converged if there exists a positive in- is not necessarily the correct estimate of error on the i th -variable node. With these definitions, we define quantum TSs as follows: Definition 4 A trapping set T s for a syndromebased iterative decoder D s is a non-empty set of variable nodes in a Tanner graph G that are not eventually converged or are neighbors of the check nodes that are not eventually satisfied Remark 1 If the sub-graph G(T s ) induced by such a set of variable nodes has a variable nodes and b unsatisfied check nodes, then the trapping set T s is conventionally labeled as an (a, b) trapping set.
The QTSs similar to the TSs in classical LDPC codes have exactly the same definition as Def. 1, and we refer to them as classical-type trapping sets. The second class of trapping sets are specifically the harmful degenerate errors observed within the stabilizers classified as symmetric stabilizer trapping sets. We will see that in such trapping sets, even though the variable nodes eventually converge to some error pattern, there exist check nodes that are not eventually satisfied. The definitions and assumptions for critical number and strength of the QTS remain the same as for the classical trapping set.
In the next two paragraphs, we give examples of these two classes of trapping sets. We assume that D s is the well-known Gallager-B decoding algorithm. This assumption is made mostly for pedagogical reasons, but also because some trapping sets of Gallager-B are also trapping sets of other decoders such as BP or MSA.

Classical-type trapping set
We will first show in an illustration why classicaltype TSs as shown in Fig. 2 are also failure configurations of syndrome decoders. The same error pattern of the (5,3) TS given in Fig. 1 is redrawn for a syndrome based Gallager-B decoder in Fig. 3. The syndrome input is all-one vector, Figure 3: An illustration of a failure configuration of syndrome-based Gallager-B decoder [28].
The shaded squares represent the anti-commuting stabilizers/checks. Syndrome iterative decoder starts message passing with an all zero error pattern trying to find the true error pattern that matches with the all-one syndrome but is unable to converge successfully. The messages passed within the sub-graph in consecutive iterations oscillates showing that the decoder is trapped.
indicated by the black squares and the decoder starts from the all-zero error pattern (no error). The outgoing check node message over an edge is computed as the XOR of extrinsic variable node messages and the syndrome input value at the check node, and the variable node message computation remains the same as in regular Gallager-B decoder. The messages passed over corresponding edges are marked next to the directed arrows. Note that even though the messages passed in Fig. 3 are different from that in Fig. 1 of the regular Gallager-B decoder, the syndrome decoder is also unable to converge, and its output oscillates from the all-zero error pattern to errors in v 2 , v 4 , and v 5 and back. Hence, the (5, 3) TS in Fig. 3 is classified as a QTS for the syndrome decoder as well.
In addition to classical-type TSs, iterative decoders on QLDPC codes fail for specific degenerate errors. Our quantum trapping set Definition 4 captures such failure configurations as well. This distinctive difference from classical codes deserves further analysis in the next section.

Symmetric stabilizer trapping set
Recall the quantum decoding problem in Section 2.3, wherein the decoder needs to identify any recovery operator such thatê ⊕ e = rowspace(H b ). This is in contrast to the classical decoding problem where an exact match of errorê = e is required. In quantum decoding, we say error vectors e and f are degenerate errors if e⊕f is a stabilizer, which makes it equivalent to output any one of the degenerate errors as the candidate error pattern for matching the syndrome. However, in QLDPC codes whose minimum distance is higher than their stabilizer weight, some degenerate errors can be detrimental to iterative decoding. A symmetric topology of the stabilizer sub-graph that contains degenerate error patterns e and f of equal weight will result in a decoding failure.
We will see more examples of such decoder failure when the iterative decoder attempts to converge to error patterns e and f simultaneously, thus not matching the input syndrome. This failure can be attributed to the symmetry of the both the stabilizer and the decoder message update rules. Hence, such errors are referred to as symmetric degenerate errors and corresponding sets of variable nodes as symmetric stabilizer trapping sets or just symmetric stabilizers, for short. Although degenerate errors are typically classified as harmless for quantum decoding, from the above discussion it follows that some (not all) degenerate error patterns in a symmetric stabilizer are harmful for iterative decoders.
Definition 5 A symmetric stabilizer is a stabilizer with the set of variable/qubit nodes, whose induced sub-graph has no odd-degree check nodes, and that can be partitioned into an even number of disjoint subsets, so that: (a) sub-graphs induced by these subsets of variable nodes are isomorphic, and (b) each subset has the same set of odd degree check node neighbors in its induced sub-graph.
Example 1 Consider the Fig. 4(b) with the stabilizer sub-graph induced by ten variable nodes that are partitioned into two disjoint sets with the coloring • and •. The induced sub-graphs from • and • variable nodes are shown in the Fig. 5. The sub-graphs in Fig. 5(a) and Fig. 5(b) are isomorphic and have the same odd-degree checks represented using dark squares . Hence, the stabilizer shown in Fig. 4(b) satisfies the definition of a symmetric stabilizer.

Remark 2
The symmetric stabilizer shown in Fig. 4(b) is present in generalized bicycle codes given in [15]. Surface codes are highly degenerate, and symmetric stabilizers, for example as shown in Fig. 4(a), are ubiquitous in them. Now, we discuss how degenerate errors within the symmetric stabilizer are harmful for iterative decoders. As a non-trivial example of a symmetric degenerate error, let the error pattern e be located on the • variable nodes in Fig. 6(a). They result in unsatisfied check shown as . Note, however, that the sub-graph is symmetric with respect to the vertical axis, and therefore each erroneous node has a • twin. The set of all • twins form an alternative error pattern f . The existing iterative decoders fail as they simultaneously attempt to converge to both these error (a) (b) Figure 6: Degenerate errors e and f located on • and • variable nodes, respectively in the symmetric stabilizer in 6(a) result in an iterative decoder failure. Introducing asymmetry during the QLDPC code design can lead to decoder success taking advantage of degeneracy of the QLDPC codes. As an example, for the sub-graph in 6(b), a BP decoder is able to match to the syndrome (dark squares represent unsatisfied checks) correctly with the red error pattern.
patterns. It is not difficult to see that such "ambiguity" happens for all decoders for which: (a) the check and message update rules are symmetric functions in incoming messages, and (b) in the same iteration all variable/check nodes in the graph apply in parallel the same variable/check update function, respectively. For example, during the iterations of the Gallager-B decoder, every unsatisfied CN sends the binary message, one back to the VNs. Because of the symmetry, the VNs in both e and f receive exactly the same messages, thus converging to e ⊕ f , the symmetric stabilizer.
Based on the Definition 4, the set of VNs involved in the symmetric stabilizer form a QTS and the sub-graph in Fig. 6(a) is a (10,0) TS by convention. We can prove as in the following lemma pertaining to the general case. (a, b = 0) trapping set, and a is even.

Lemma 1 A symmetric stabilizer is an
Proof Let the cardinality of the set of VNs of the stabilizer be a. By definition, the induced sub-graph having no odd-degree check nodes implies that b = 0. Also, according to the symmetric stabilizer definition, the disjoint VN sets that partitions the stabilizer must have the same odd degree check node neighbor set. This implies that there can only be even number of such disjoint sets which further implies that the parameter a is even.
When there are more than a pair (an even number greater than two) of disjoint sets of VNs, the symmetric stabilizer can be split into smaller symmetric stabilizers.
From the discussion earlier, it follows that symmetric stabilizers are trapping sets not only for the syndrome BP decoder, but for many other iterative decoders, such as bit-flipping, Gallager-B and MSA with different critical number and strength. Harmfulness of symmetric stabilizers associated with decoders is distinct from classicaltype trapping sets, as summarized in the following lemma.
Lemma 2 For an (a, 0) symmetric stabilizer TS with any iterative decoder with a critical number a/2, no error pattern on more than a/2 nodes of the symmetric stabilizer is a trapping set.
Proof Consider an (a, 0) symmetric stabilizer with critical number a/2 for a syndrome decoder D s . By the definition of the critical number, any error pattern of weight smaller than the critical number a/2 with support on the symmetric stabilizer is corrected by the decoder D s . Error patterns of weight larger than the critical number a/2 with support on the symmetric stabilizer are decoded correctly, converging to their respective low-weight degenerate error pattern.
In Fig. 4(b), if a syndrome decoder D s is able to correct all error patterns of weight smaller than five, it can also correct error patterns of weight six and more by converging to their respective low-weight degenerate error patterns.
The strength of an (a, 0) symmetric stabilizer TS with critical number a/2 is given by the twice the number of possible partitions into two disjoint subsets of VNs that satisfy the symmetric stabilizer definition. Each of such partition (distinct by their unsatisfied syndromes) contributes two error patterns each to the decoder failure in the TS.

Searching for Quantum Trapping Sets
Using the definition of a QTS, one can search for small sub-graphs in the Tanner graph of the QLDPC code to identify and enumerate the QTSs. There are efficient algorithms for TS search widely used in classical literature [29,30] to identify sub-graphs that are (a, b) TSs. Such techniques are utilized in the search for classicaltype TSs. Note that there can be more than one non-isomorphic sub-graphs with the same (a, b) parameters. For example, a (5, 3) TS can have non-isomorphic sub-graphs as in Fig. 2(b) and Fig. 3. Observe that they all have different combinations of short cycles of length six, eight and ten. Enumeration of cycles and their combinations also allows to find harmful classical-type TSs in the QLDPC code. Unlike these classicaltype TSs, the search for symmetric stabilizer TSs requires a different approach of finding low-weight codeword sub-graphs [31] with additional symmetry constraints. In the case of CSS codes, the H Z even-weight stabilizer generators are examples of symmetric stabilizer TSs for iterative decoding over the Tanner graph of H X matrix and viceversa. After obtaining the list of relevant QTSs, we can perform decoder simulation with an iterative decoder D s to verify their relative harmfulness. In the next section, we find and enumerate QTSs in some prominent QLDPC code families presented in the literature. We also provide the harmfulness analysis of "dominant" QTSs present in these code families.

Trapping Set Analysis of CSS codes
A myriad QLDPC code families have been proposed over the years. They include the CSSbased constructions (bicycle codes [2], hypergraph product (HP) codes [8] and their generalizations [15], expander codes [9]), non-CSS based QLDPC codes [32,33] and quaternary QLDPC codes [34]. In this section, we analyze trapping sets of CSS based QLDPC codes, the generalized bicycle codes, and HP codes, in particular. Similar analysis may be extended to the general class of stabilizer codes.

Generalized bicycle codes
Bicycle codes [2] were generalized by Kovalev and Pryadko in [35] as follows: Consider two binary n/2×n/2 matrices A and B that commute (AB = BA). Let The SIP condition is clearly satisfied by definition, and in [35], A and B are chosen as binary circulant matrices so that they commute. Bicycle codes are dual containing CSS codes where B = A T . Compared to the HP codes, these codes generally have a wider range of parameters; in particular, they can have a higher rate while preserving the estimated error threshold [35]. In [15], Panteleev and Kalachev use binary polynomials over rings to define the circulant matrices for constructing [[n, k]] family of generalized bicycle codes. The choice of circulant matrices determines the properties of both the classical-type TSs and the symmetric stabilizers in the code. Hence, the observations on QTSs in the example we discuss next can be generalized to the code family.

Classical-type trapping sets
Based on our QTS definition, we search for QTSs of small size (upto a = 5) present in the A1 code in Ex. 2. As noted in [15], based on the circulant matrices in the A1 code, it does not have (a, b) trapping sets with b ≤ 5. The (5, 5) TS is the most harmful small sub-graph present in the Tanner graph, making BP based iterative decoders to fail for low weight error patterns. The critical number and strength of this TS are determined by the specific decoder used and the neighborhood of the (5, 5) TS. Fig. 7 shows the dense (5, 5) TS present in both the circulant matrices A and B. From their cyclic property, we can locate 127 (equal to the circulant size) isomorphic (5, 5) TSs in each of them. In the Fig. 7, blue and red shaded circles for the VNs indicate their relative position in the H X matrix, from A and B respectively.
The (5,5) trapping set in Fig. 7 has five variable nodes. Every variable nodes have exactly the same VN degree ρ = 5 and one odd-degree check node neighbor (black squares). The number of small cycles within the trapping set and their symmetry makes this a hard configuration to decode. For simple binary decoders like syndrome based Gallager-B, any weight three or more error patterns will result in a failure inducing set. Hence, the critical number for the (5, 5) TS with the Gallager-B algorithm is µ = 3. For stronger decoders such as BP and MSA decoder, the behavior is more complex and interesting. Any weight-5 error pattern in the TS in the circulant matrix A indicated by blue qubits results in a failure, whereas similar error patterns in the TSs in the circulant matrix B (indicated by the red qubits) are decoded correctly. Such a behavior is typically attributed to the neighborhood of the TS in the Tanner graph. Whether a TS is harmful depends not just on the graphical configuration, but also on the neighborhood and the decoder. This "true" behavior of all such quantum TSs can be systematically analyzed and characterized by extending the sub-graph expansioncontraction algorithm [22] developed for classical LDPC codes to quantum codes, and it is left for future work.

Symmetric stabilizer trapping sets
Failures of syndrome-based iterative decoding on generalized bicycle code also consist of the degenerate error patterns in symmetric stabilizers discussed in the Section 3.1.2. An example of a pair of symmetric degenerate error patterns of weight five in the Ex. 2 code is shown in Fig. 5(a) and Fig. 5(b). Together, they form a (10, 0) TS shown in Fig. 4(b) referred as a symmetric stabilizer. Interestingly, the blue and red shaded circles indicates the variable nodes relative position as before in case of the (5, 5) TS coloring. Also, these error patterns induce isomorphic sub-graphs -trees without any cycles, quite distinct from the error patterns in classical-type TSs which are usually composed of one or more cycles. Using the cyclic property of the circulant matrices in the code, we can easily locate 127 isomorphic symmetric stabilizers present in the Tanner graph of H X , and similarly for H Z .

Remark 3
The input syndrome (dark squares representing odd-degree checks) in both Fig. 5(a) and Fig. 5(b) is not matched correctly using iterative decoder using a parallel or flooding schedule. Breaking such TSs requires use asymmetric update of variable node decisions such as used in a layered/serial decoder. Since such symmetric trapping sets have clear distinction of red and blue nodes with respect to the cyclic matrices A and B, we can identify the layered decoder schedule that can break such trapping sets.

Hypergraph product codes
HP codes by Tillich and Zemor [8] and their improvements by Kovalev and Pryadko [36] are constructed by taking Kronecker product (denoted as ⊗) of two classical LDPC codes. Using two classical parity check matrices H 1 and H 2 of dimensions m 1 × n 1 and m 2 × n 2 respectively, we have Example 3 For our trapping set analysis, we use the example of a [[900, 36,10]] HP code given in [17] using a symmetric Kronecker product of a single (n = 24, k = 6, d = 10) classical code.
The classical LDPC code determines the HP code properties and its trapping sets. As we analyze the cycle profile of the Tanner graph of the classical code used in Ex. 3, we observe that there are 54 cycles of length six (6-cycles) and 160 8-cycles. These cycles appear in the HP codes, multiplying according to the size of the classical parity check matrix (m = 18, n = 24) as given in Table  1. For example, 54 six cycles in the classical code gives rise to (54 × 24) + (54 × 18) = 2268 6-cycles in both H X and H Z matrix of the [[900, 36,10]] code. This behavior is consistent across the symmetric HP code family.
Lemma 3 Tanner graphs of hypergraph product codes have girth at most 8.

Proof
The Kronecker product of the constituent LDPC code graphs results in unavoidable 8-cycles in the Tanner graphs of H X and H Z matrices, upper bounding the girth of HP codes by 8 [8]. Let the two constituent code Tanner graphs be (V ∪ C) and (V ∪ C ), then one can find a cycle of length 8 in the Tanner graph of H X by looking at H Z rows. Consider a variable node v ∈ V and a check node c ∈ C. Let v be connected to check nodes c 1 and c 2 in the graph (V ∪ C ). Similarly, let the check node c has variable node neighbors v 1 and v 2 in the graph (V ∪ C). Based on the Kronecker product, the following length-8 cycle is formed involving variable node (v 1 , v ) in the hypergraph product: Our TS search procedure identified thirty (4, 2) trapping sets and ten (5, 1) trapping sets in the classical code. Also, there are two non-isomorphic topologies of (5, 3) TSs: one hundred and seventy (5, 3) TSs whose induced graph has a six, eight, and ten-cycle, and fifteen (5, 3) TSs having three eight cycles. All these trapping sets manifest themselves in the HP code with their count scaling as in the case of small cycles. In Table 2, we enumerate all the smallest QTSs (with a ≤ 5, b ≤ a) present in the [[900, 36,10]] HP code having no CN with degree > 2 in their induced sub-graphs. These values for a and b are chosen as such classical-type TSs are typically the most harmful for iterative decoders. The QTS enumeration of H X and H Z for symmetric HP codes is the same. Also, the cycle enumerator series CYC(x) = r≥0 χ r x r for each QTS sub-graph in the parameters column in the Table indicates the number of small cycles present, which we refer to as its cycle profile. Observe that the (5, 3) QTS with γ = 3 has two non-isomorphic topologies with different cycle profiles. Another interesting observation specific to these HP codes having VNs with degree 3 and 4 is the presence of (5, 3) and (5, 5) QTSs with the same cycle profile -CYC(x) = 3x 8 . The (5,5) QTSs are indeed the result of the Kronecker product in the HP codes. The QTSs in Table 2 are the main reason for poor iterative decoding performance of such family of codes. Observe that the node degree of the classical parity check Tanner graph influences the symmet-ric property of the stabilizers of the HP code. In Ex. 3, since the classical parity check code chosen has γ = 3 and ρ = 4 in its Tanner graph, the variable nodes of the HP code have VN degrees 3 and 4. For the stabilizer in Fig. 8, the VNs with degree γ = 4 are shown as • and those with γ = 3 as •. The stabilizer is not symmetric according to the Definition 5. Suppose the input syndrome corresponds to all the check nodes in the sub-graph in error, then an iterative BP or MSA decoder (based on the update rule) will be able to successfully converge to the red error pattern. This happens as every • VN uses messages from four CNs compared to three CNs for the • VNs in the decoding process to successfully converge. Note that the above statement depends on the decoder update rule chosen. For example, the red and blue error patterns in the stabilizer are indeed failure configurations for a simple binary decoding algorithm like Gallager-B algorithm.
This observation emphasizes the importance of the decoder in characterizing the harmfulness of QTSs as in the case of classical TSs [22]. In the subsequent section showing the applications of TS analysis, we will use the example of different decoding schedule that "breaks" such symmetry of the stabilizer.

Using the QTS to design better QLDPC codes and better decoders
In this section, we explain practical importance of QTS analysis by providing two approaches for finite length QLDPC code and decoder design with QTS knowledge.

Improved Code Design
While previous research has observed the issue of symmetric degenerate errors [13,20], there has been no effort to fully characterize them. Identifying symmetric stabilizers, particularly of low weight in the QLDPC code is an important step in quantifying the effect of degenerate errors on iterative decoding. Removal of symmetry in lowweight stabilizers present in the Tanner graph, especially during the QLDPC code design, significantly reduces the number of instances of iterative decoder failure. For example, during the row removal step in the bicycle code [2] we carefully modify the original bicycle code to obtain codes wherein the stabilizer is asymmetric as in Fig. 6(b). The BP decoder will able to match to the syndrome (dark squares represent unsatisfied checks) correctly with the red error pattern, in contrast to the symmetric stabilizer in Fig. 6(a). Similarly, in the case of HP codes, careful removal of TSs in the constituent classical LDPC codes helps to further optimize rate and minimum distance properties. Such code design improvements lead to performance gains especially in the error floor region for QLDPC codes. Here, we show an example of such an improved HP code design with quasi-cyclic (QC) LDPC [37] code for the constituent classical LDPC code.

Improved HP codes without harmful TSs
One of the disadvantages of QLDPC codes is that the random code construction makes the stabilizers highly non-local, requiring arbitrary qubit-qubit inter-connectivity to perform check operations. Using QC LDPC code brings structure to the constituent codes and flexibility in improving finite length QLDPC codes along with efficient implementation of decoders. Instead of the random codes which are only optimized for girth g = 6, we construct QC [40,10,12] code with girth 8, and make sure that small trapping sets are not present. The QC code with circulant size Q = 10 is constructed by carefully choosing circulants to build the Tanner graph that is free of (4, 2), (4,4), and (5, 1) harmful trapping sets. For a fair comparison, we use a random code of the same size and minimum distance. The random [40,10,12] code is constructed to be cycle-4 free. The HP codes constructed from these constituent classical codes both have the same number (= 21600) of unavoidable length-8 cycles (see Lemma 3) in their respective Tanner graphs, as it only depends on the size of the component code and their variable and check node degrees. For the symmetric HP code from regular LDPC code, we can count these as m × ρ 2 × n × γ 2 , where m and n correspond to the number of check nodes and variable nodes, respectively, and d v and d c are variable and check node degrees, respectively of the constituent classical code. These 8-cycles can be classified as (4, 6) TSs and are not harmful for iterative decoders like min-sum or BP algorithm. Fig. 9 shows improved decoding performance (flooding BP decoder with max = 100 iterations) in the error floor regime for the newly constructed QC HP code. Even though the curves start with a similar waterfall performance (due to same minimum distance), the randomly constructed code performs worse in the error floor regime compared to the QC code. For the same code parameters, using the QC component code improves the FER by nearly an order of magnitude at p ≈ 0.005. This improvement can be clearly attributed to the absence of harmful TSs which were removed in the constituent QC code construction. The example of the HP-LDPC code construction with QC constituent code is chosen considering their hardware friendly nature and simple bookkeeping of trapping sets. In general, no specific code structure is required in our method, and the concept, definition and analysis of trapping sets are applicable to random codes as well.  Figure 9: FER performance comparison between the symmetric HP codes constructed using random constituent codes ( [20,5,8] code and [24,6,10] code in [17], and [40,10,12] code with girth g = 6) and the symmetric HP code constructed using a trapping set aware QC [40,10,12] code. All curves are decoded using a BP decoder for max = 100 iterations with the flooding schedule. For the same code parameters, using the QC component code without harmful trapping sets shows FER improvement (close to an order of magnitude) over the random constituent code in the error floor region.

Novel Decoder Design
An alternative or complementary approach is to devise iterative decoders that do not fail for the error patterns in the QTSs identified for the QLDPC code. This approach, prevalent in classical LDPC decoders (finite alphabet iterative decoding (FAID) algorithms such as in [23]) do not ignore the topology of the TSs while devising decoder update rules. Breaking the symmetry of messages by using non-linear message update rules leads to orders of magnitude decoding error performance improvement [23]. For QLDPC iterative decoders, the typically used parallel/flooding message update schedule (in the same iteration all variable/check nodes in the Tanner graph apply in parallel the same variable/check update function, respectively) attributes to decoders' failure to symmetric degenerate errors. We devise decoder strategy that corrects these errors by taking into account the topology of the low-weight symmetric stabilizers in the code. Specifically, we show that an MSA decoder with sequential message update schedule (layered decoder as in classical literature [38]) that uses the knowledge of location of the sym-  28]] code using the min-sum algorithm (MSA) for two different schedules: flooding/parallel and layered schedule. The layered schedule is able to decode all the symmetric stabilizer TSs and numerous classicaltype TSs correctly leading to two orders of magnitude improvement in the error floor regime (low physical error rates).
metric stabilizers in the code as well as other harmful trapping sets improves the error floor decoding performance. As an intuitive example, suppose the symmetric stabilizer of weight 6 has support on variable nodes v 1 , . . . , v 6 with symmetric degenerate error patterns: e 1 , e 2 , e 3 and e 4 , e 5 , e 6 . A layered decoder with the update order: starting with VN update of v 1 , v 2 , v 3 , followed by the check node updates, and then VN update of v 4 , v 5 , v 6 converges to the correct error pattern without getting trapped. Since the schedule order is with respect to the variable nodes corresponding to the columns of the H matrix, we refer to such schedule as column-layered. In addition to fast decoder convergence in terms of the number of iterations [38,39], column-layered decoders break some harmful TSs in classical LDPC codes [40]. In the following section 5.2.1, we compare the two schedules: flooding MSA and layered MSA decoders for the chosen QLDPC code.

Layered Decoding to break QTSs
We employ a specific layered decoding schedule to break the symmetric stabilizers in the A1 [[254, 28]] code in Fig. 10 using a column layered schedule. The layered schedule employed here is based on the circulant-size of the cyclic matrices A and B. The symmetric trapping sets have a clear distinction of red and blue nodes with respect to these cyclic matrices, giving a straight forward update order: v 1 , . . . , v 127 followed by v 128 , . . . , v 254 . The column-layered decoder (MSA with max = 20 iterations) is able to decode all the symmetric stabilizer TSs and numerous classical-type TSs correctly leading to two orders of magnitude improvement in the error floor regime (low physical error rates) compared to the flooding MSA decoder. 2 Remark 4 (Random perturbation and postprocessing) With the QTS knowledge, we can construct iterative decoders without computationally expensive post-processing steps, and thus reduce the decoding complexity and latency. Note that the two curves in Fig. 10 use same maximum number of decoding iterations ( max = 20). In contrast, the heuristic random perturbation approach in [13] requires many rounds of decoding attempts (D r ) with additional BP decoder iterations ( r ) each of which are initialized with perturbed channel log-likelihood ratios on variable nodes that are neighbors of the unsatisfied syndromes. If we allot the same total number of decoding iterations to compare the random perturbation method with BP, we observe that the advantage of using random perturbation is only observed with very large number of iterations. However, if the total number of iterations is set to 100 iterations, the decoding performance improvement using heuristic methods is not significant as illustrated in Fig. 11. For a significant performance improvement, post processing step with random perturbation decoder requires much more decoding rounds (using max + (D r × r ) = 1700 iterations which is >> 100) as shown in dashedred-diamond curve. The heuristic choice of the randomness parameter can be further improved by using feedback as in [41]. This is also shown to improve the convergence speed of the postprocessing step, but it does not eliminate this step completely. The performance improvement shown with the chosen layered schedule is to demonstrate the usefulness of the QTS analysis. If required, post-processing techniques as well as improvements over heuristic approaches such as 2 In the Monte-Carlo simulations presented in the paper, we collect at least 100 errors for simulation points in the low FER region ensuring that they are statistically significant.  28]] code using the belief propagation decoder with the flooding schedule with/without perturbation rounds (dashed/solid lines). When the total number of iterations allowed are only 100 iterations, the dashedblue-square marked and dashed-cyan-triangle marked (BP with random perturbation) curves do not outperform the solid-red-diamond BP-only curve for 100 iterations. For a significant performance improvement, post processing step with random perturbation decoders requires much more decoding rounds as shown in dashedred-diamond curve. Also, note that the heuristic choice of noise parameter value affects these decoding improvements.
enhanced feedback decoding [41] and augmented decoding [20] can be used as additional tools over the iterative decoder based on QTS analysis.
An interesting result to note is that using more iterations in the BP algorithm results in matching with many degenerate error patterns in case of quantum LDPC codes. FER versus iterations of BP plotted in Fig. 12 shows that increasing iterations of flooding BP do not lower the FER in terms of purely classical errors (for the red curve, the degenerate error patterns that match the corresponding syndrome are considered as errors). However, such degenerate error patterns that match the syndrome without introducing a logical error are harmless for QLDPC codes, resulting in lowering the FER with increasing iterations of BP. In our future work, we will devise improved message passing algorithms of lower complexity than BP that exploits the degeneracy of QLDPC codes systematically. The blue-diamond marked curve corresponds to the FER curve in QLDPC codes wherein degenerate error pattern matching is not considered as an error. In contrast, classical-like BP errors are plotted with the red-square marked curve with degenerate matching also classified as an error in addition to the decoding failures. Quantum decoders are observed to lower the FER with increasing iterations of BP resulting from degenerate error matching.
and their structure is fixed and modifying it is not an option (due to technology or system-level constraints in the future). Clearly, joint code and decoder design would guarantee further decoding performance improvement and a higher threshold.

Summary and Future Work
In this paper, we identified and classified quantum trapping sets using their definition adapted from the classical error correction to address the syndrome decoding scenario for QLDPC codes. The knowledge of QTSs is shown to significantly improve stabilizer code/decoder designs and also decoder performance in the error floor regimes of practical finite-length QLDPC codes. Analysis of failure configurations of the QLDPC codes, which are a generalization of the surface codes, will have near-future implications in surface code designs and their decoders.
In future work, we will analyze the finite length performances of recently proposed QLDPC codes that break the √ n growing minimum distance barrier [10] based on their QTS enumeration. We will establish the parent-child relationship between the harmful sub-graphs and determine their relative harmfulness. Understanding the effect of neighborhood of the Tanner graph with respect to the decoder used is not easy, but important to understand the actual harmful error patterns. In future work, we plan to modify the expansion-contraction method [22] to QLDPC codes to obtain the exact set of most harmful configurations that should be avoided in the Tanner graph of QLDPC codes. Enumeration of symmetric stabilizers in QLDPC codes is also an important step towards exploiting degeneracy to the decoder's advantage. Approaches used in classical literature for structured QLDPC code constructions such as efficient low-weight codeword search are promising in this direction. In addition, the extension of QTS definition to consider X and Z type errors together (correlated errors) and non-CSS stabilizer codes in general will set up the framework to study and explore non-binary quantum trapping sets.