{'fraction_non_alphanumeric': 0.0305481455984855, 'fraction_numerical': 0.014069357198175717, 'mean_word_length': 4.0616289198606275, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Two-Bit Bit Flipping Decoding of LDPC Codes

In this paper, we propose a new class of bit flipping algorithms for low-density parity-check (LDPC) codes over the binary symmetric channel (BSC). Compared to the regular (parallel or serial) bit flipping algorithms, the proposed algorithms employ one additional bit at a variable node to represent its"strength."The introduction of this additional bit increases the guaranteed error correction capability by a factor of at least 2. An additional bit can also be employed at a check node to capture information which is beneficial to decoding. A framework for failure analysis of the proposed algorithms is described. These algorithms outperform the Gallager A/B algorithm and the min-sum algorithm at much lower complexity. Concatenation of two-bit bit flipping algorithms show a potential to approach the performance of belief propagation (BP) decoding in the error floor region, also at lower complexity.


I. INTRODUCTION
High speed communication systems such as flash memory, optical communication and free space optics require extremely fast and low complexity error correcting schemes. Among existing decoding algorithms for LDPC codes [1] on the BSC, the bit flipping (serial or parallel) algorithms are least complex yet possess desirable error correcting abilities. First described by Gallager [1], the parallel bit flipping algorithm was shown by Zyablov and Pinsker [2] to be capable of asymptotically correcting a linear number of errors (in the code length) for almost all codes in the regular ensemble with left-degree γ ≥ 5. Later, Sipser and Spielman [3] used expander graph arguments to show that this algorithm and the serial bit flipping algorithm can correct a linear number of errors if the underlying Tanner graph is a good expander. Note that their arguments also apply for regular codes with left-degree γ ≥ 5. It was then recently shown by Burshtein [4] that regular codes with left-degree γ = 4 are also capable of correcting a linear number of errors under the parallel bit flipping algorithm.
Despite being theoretically valuable, the above-mentioned capability to correct a linear number of errors is not practically attractive. This is mainly because the fraction of correctable errors is extremely small and hence the code length must be large. Besides, the above-mentioned results do not apply for column-weight-three codes, which allow very low decoding complexity. Also, compared to hard decoding message passing algorithms such as the Gallager A/B algorithm, the error performance of the bit flipping algorithms on finite length codes is usually inferior. This drawback is especially visible for column-weight-three codes for which the guaranteed error correction capability is upper-bounded by ⌈g 4⌉ − 1 (to be discussed later), where g is the girth of a code. The fact that a code with g = 6 or g = 8 can not correct certain error patterns of weight two indeed makes the algorithm impractical regardless of its low complexity.
In recent years, numerous bit-flipping-oriented decoding algorithms have been proposed (see [5] for a list of references). However, almost all of these algorithms require some soft information from a channel with capacity larger than that of the BSC. A few exceptions include the probabilistic bit flipping algorithm (PBFA) proposed by Miladinovic and Fossorier [6]. In that algorithm, whenever the number of unsatisfied check nodes suggests that a variable (bit) node should be flipped, it is flipped with some probability p < 1 rather than being flipped automatically. This random nature of the algorithm slows down the decoding, which was demonstrated to be helpful in practical codes whose Tanner graphs contain cycles. The idea of slowing down the decoding can also be found in a bit flipping algorithm proposed by Chan and Kschischang [7]. This algorithm, which is used on the additive white Gaussian noise channel (AWGNC), requires a certain number of decoding iterations between two possible flips of a variable node.
In this paper, we propose a new class of bit flipping algorithms for LDPC codes on the BSC. These algorithms are designed in the same spirit as the class of finite alphabet iterative message passing algorithms [8]. In the proposed algorithms, an additional bit is introduced to represent the strength of a variable node. Given a combination of satisfied and unsatisfied check nodes, the algorithm may reduce the strength of a variable node before flipping it. An additional bit can also be introduced at a check node to indicate its reliability. The novelty of these algorithms is three-fold. First, similar to the above-mentioned PBFA, our class of algorithms also slows down the decoding. However they only do so when necessary and in a deterministic manner. Second, their deterministic nature and simplicity allow simple and thorough analysis. All subgraphs up to a certain size on which an algorithm fails to converge can be found by a recursive algorithm. Consequently, the guaranteed error correction capability of a code with such algorithms can be derived. Third, the failure analysis of an algorithm gives rise to better algorithms. More importantly, it leads to decoders which use a concatenation of two-bit bit flipping algorithms. These decoders show excellent trade offs between complexity and performance.
The rest of the paper is organized as follows. Section II provides preliminaries. Section III motivates and describes the class of two-bit bit flipping algorithms. Section IV gives a framework to analyze these algorithms. Finally, numerical results are presented in Section V along with discussion.

II. PRELIMINARIES
Let C denote an (n, k) LDPC code over the binary field GF (2). C is defined by the null space of H, an m × n parity check matrix. H is the bi-adjacency matrix of G, a Tanner graph representation of C. G is a bipartite graph with two sets of nodes: n variable nodes and m check nodes. In a γ-left-regular code, all variable nodes have degree γ. Each check node imposes a constraint on the neighboring variable nodes. A check node is said to be satisfied by a setting of variable nodes if the modulo-two sum of its neighbors is zero, otherwise it is unsatisfied. A vector v = {v 1 , v 2 , . . . , v n } is a codeword if and only if all check nodes are satisfied. The length of the shortest cycle in the Tanner graph G is called the girth g of G.
In this paper, we consider 3-left-regular LDPC codes with girth g = 8, although the class of two-bit bit flipping algorithms can be generalized to decode any LDPC code. We assume transmission over the BSC. A variable node is said to be corrupt if it is different from its original sent value, otherwise it is correct. Throughout the paper, we also assume without loss of generality that the all-zero codeword is transmitted. Let y = {y 1 , y 2 , . . . , y n } denote the input to an iterative decoder. With the all-zero codeword assumption, the support of y, denoted as supp(y) is simply the set of variable nodes initially corrupt. In our case, a variable node is corrupt if it is 1 and is correct if it is 0.
A simple hard decision decoding algorithm for LDPC codes on the BSC, known as the parallel bit flipping algorithm [2], [3] is defined as follows. For any variable node v in a Tanner graph G, let n • Repeat until all check nodes are satisfied.

III. THE CLASS OF TWO-BIT BIT FLIPPING ALGORITHMS
The class of two-bit bit flipping algorithms is described in this section. We start with two motivating examples. The first one illustrates the advantage of an additional bit at a variable node while the second illustrates the advantage at a check node.

A. First Motivating Example: Two-bit Variable Nodes
In this subsection, symbols and denote a correct and a corrupt variable node while ◻ and ∎ denote a satisfied and an unsatisfied check node. Let C be a 3-left-regular LDPC code with girth g = 8 and assume that the variable nodes v 1 , v 2 , v 3 and v 4 form an eight cycle as shown in Fig. 1. Also assume that only v 1 and v 3 are initially in error and that the parallel bit flipping algorithm is employed. In the first iteration illustrated in Fig. 1(a), c 1 , c 2 , c 3 , c 4 , c 5 and c 7 are unsatisfied while c 6 and c 8 are satisfied. Since n (u) and v 3 are flipped and become correct. However, v 2 and v 4 are also flipped and become incorrect since n In the second iteration ( Fig. 1(b)), the algorithm again flips v 1 , v 2 , v 3 and v 4 . It can be seen that the set of corrupt variable nodes alternates between {v 1 , v 3 } and {v 2 , v 4 }, and thus the algorithm does not converge.
The parallel bit flipping algorithm fails in the above situation because it uses the same treatment for variable nodes with n (u) The algorithm is too "aggressive" when flipping a variable node v with n This modified algorithm will converge in the above situation. However, if only v 1 and v 2 are initially in error ( Fig. 1(c)) then the modified algorithm does not converge because it does not flip any variable node. The modified algorithm is now too "cautious" to flip a variable node v with n (u) Both decisions (to flip and not to flip) a variable node v with n (u) c (v) = 2 can lead to decoding failure. However, we must pick one or the other due the assumption that a variable node takes its value from the set {0, 1}. Relaxing this assumption is therefore required for a better bit flipping algorithm.
Let us now assume that a variable node can take four values instead of two. Specifically, a variable node takes its value from the set A v = {0 s , 0 w , 1 w , 1 s }, where 0 s (1 s ) stands for "strong zero" ("strong one") and 0 w (1 w ) stands for "weak zero" ("weak one"). Assume for now that a check node only sees a variable node either as 0 if the variable node is 0 s or 0 w , or as 1 if the variable node is 1 s or 1 w . Recall that n Table I. 0  1  2  3  0  1  2  3  0s  0s  0s  0w  1s  1w  1s  0w  0s  0s  0w  0s  1w  1s  1s  1s  1s  1s 1w 0s Consider the following bit flipping algorithm.
Compared to the parallel bit flipping algorithm and its modified version discussed above, the TBFA1 possesses a gentler treatment for a variable node v with n (u) c (v) = 2. It tries to reduce the "strength" of v before flipping it. One may realize at this point that it is rather imprecise to say that the TBFA1 flips a variable node v from 0 s to 0 w or vice versa, since a check node still sees v as 0. However, as the values of v can be represented by two bits, i.e., A v can be mapped onto the alphabet {01, 00, 10, 11}, the flipping of v should be understood as either the flipping of one bit or the flipping of both bits.
It is easy to verify that the TBFA1 is capable of correcting the error configurations shown in Fig. 1. Moreover, the guaranteed correction capability of this algorithm is given in the following proposition.
Proposition 1: The TBFA1 is capable of correcting any error pattern with up to g 2−1 errors in a left-regular columnweight-three code with Tanner graph G which has girth g ≤ 12 and which does not contain any codeword of weight w < g. Proof: The proof is omitted due to page limits. Remarks: • It can be shown that the guaranteed error correction capability of a 3-left-regular code with the parallel bit flipping algorithm is strictly less than ⌈ g 4 ⌉. Thus, the TBFA1 increases the guaranteed error correction capability by a factor of at least 2.
• In [9], we have shown that the Gallager A/B algorithm is capable of correcting any error pattern with up to g 2 − 1 errors in a 3-left-regular code with girth g ≥ 10. For codes with girth g = 8 and minimum distance d min > 8, the Gallager A/B algorithm can only correct up to two errors. This means that the guaranteed error correction capability of the TBFA1 is at least as good as that of the Gallager A/B algorithm (and better for codes with g = 8). It is also not difficult to see that the complexity of the TBFA1 is much lower than that of the Gallager A/B algorithm. Now that the advantage of having more than one bit to represent the values of a variable node is clear, let us explore the possibility of using more than one bit to represent the values of a check node in the next subsection.

B. Second Motivating Example: Two-bit Check Nodes
In this subsection, we use the symbols and to denote a 0 s variable node and a 1 s variable node, respectively. The symbols used to denote a 0 w variable node and a 1 w variable node are shown in Fig. 2(b) where v 2 is a 0 w variable node and v 1 is a 1 w variable node . The symbols ◻ and ∎ still represent a satisfied and an unsatisfied check node. Assume a decoder that uses the TBFA1 algorithm. Fig. 2(a), (b) and (c) illustrates the first, second and third decoding iteration of the TBFA1 on an error configuration with four variable nodes v 1 , v 3 , v 4 and v 6 that are initially in error. We assume that all variable nodes which are not in this subgraph remain correct during decoding and will not be referred to. In the first iteration, variable nodes v 1 , v 2 , v 5 , v 6 and v 7 are strong and connected to two unsatisfied check nodes. Consequently, the TBFA1 reduces their strength. Since variable nodes v 3 and v 4 are strong and only connected to one unsatisfied check node, their values are not changed. In the second iteration, all check nodes retain their values (satisfied or unsatisfied) from the first iteration. The TBFA1 hence flips v 1 and v 6 from 1 w to 0 s and flips v 2 , v 5 and v 7 from 0 w to 1 s . At the beginning of the third iteration, the value of any variable node is either 0 s or 1 s . Every variable node is connected to two satisfied check nodes and one unsatisfied check node. Since no variable node can change its value, the algorithm fails to converge.
The failure of the TBFA1 to correct this error configuration can be attributed to the fact that check node c 3 is connected to two initially erroneous variable nodes v 3 and v 4 , consequently preventing them from changing their values. Let us slightly divert from our discussion and revisit the PBFA proposed by Miladinovic and Fossorier [6]. The authors observed that variable node estimates corresponding to a number close to ⌈γ 2⌉ unsatisfied check nodes are unreliable due to multiple errors, cycles in the code graph and equally likely a priori hard decisions. Based on this observation, the PBFA only flips a variable node with some probability p < 1. In the above error configuration, a combination of two unsatisfied and one satisfied check nodes would be considered unreliable. Therefore, the PBFA would flip the corrupt variable nodes v 1 and v 6 as well as the correct variable node v 2 , v 5 and v 7 with the same probability p. However, one can see that a combination of one unsatisfied and two satisfied check nodes would also be unreliable because such combination prevents the corrupt variable nodes v 3 and v 4 from being corrected. Unfortunately, the PBFA can not flip variable nodes with less than γ 2 unsatisfied check nodes since many other correct variable nodes in the Tanner graph would also be flipped. In other words, the PBFA can not evaluate the reliability of estimates corresponding to a number close to ⌊γ 2⌋ unsatisfied check nodes. We demonstrate that such reliability can be evaluated with a new concept introduced below.
Revisit the decoding of the TBFA1 on the error configuration illustrated in Fig. 2. Notice that in the third iteration, except check node c 3 , all check nodes that are unsatisfied in the second iteration become satisfied while all check nodes that are satisfied in the second iteration become unsatisfied. We will provide this information to the variable nodes.
Definition 1: A satisfied (unsatisfied) check node is called previously satisfied (previously unsatisfied) if it was satisfied (unsatisfied) in the previous decoding iteration, otherwise it is called newly satisfied (newly unsatisfied).

Consider the following bit flipping algorithm:
Algorithm 2 Two-bit Bit Flipping Algorithm 2 (TBFA2) Initialization: Each variable node v is initialized to 0 s if y v = 0 and is initialized to 1 s if y v = 1. In the first iteration, check nodes are either previously satisfied or previously unsatisfied.
• Repeat until all check nodes are satisfied.
The TBFA2 considers a combination of one newly unsatisfied, one newly satisfied and one previously satisfied check node to be less reliable than a combination of one previously unsatisfied and two previously satisfied check nodes. Therefore, it will reduce the strength of v 3 and v 4 at the end of the third iteration. Consequently, the error configuration shown in Fig. 2 can now be corrected after 9 iterations. Proposition 1 also holds for the TBFA2.
Remarks: Let Q be the set of all functions from A v × {0, 1, 2, 3} → A v . A natural question to ask is whether f 1 can be replaced with some f ′ 1 ∈ Q such that the TBFA1 algorithm can correct the error configuration shown in Fig. 2. Brute force search reveals many of such functions. Unfortunately, none of those functions allow the algorithm to retain its guaranteed error correction capability stated in Proposition 1.
We recap this section by giving the formal definition of the class of two-bit bit flipping algorithms.
Definition 2: For the class of two-bit bit flipping algorithms, a variable node v takes its value from the set A v = {0 s , 0 w , 1 w , 1 s }. A check node sees a 0 s and a 0 w variable node as 0 and sees a 1 s and a 1 w variable node as 1. According to Definition 1, a check node can be previously satisfied, previously unsatisfied, newly satisfied or newly unsatisfied. An algorithm F is defined by a mapping f ∶ A v ×{0, 1, . . . , γ} 3 → A v , where γ is the column-weight of a code.
Different algorithms in this class are specified by different functions f . In order to evaluate the performance of an algorithm, it is necessary to analyze its failures. To that task we shall now proceed.

IV. A FRAMEWORK FOR FAILURE ANALYSIS
In this section, we describe a framework for the analysis of two-bit bit flipping algorithms (the details will be provided in the journal version of this paper). Consider the decoding of a two-bit bit flipping algorithm F on a Tanner graph G. Assume a maximum number of l iterations and assume that the channel makes k errors. Let I denote the subgraph induced by the k variable nodes that are initially in error. Let S be the set of all Tanner graphs that contain I. Let S e be the subset of S with the following property: if S ∈ S e then there exists an induced subgraph J of S such that (i) J is isomorphic to I and (ii) the two-bit bit flipping algorithm F fails to decode on S after l iterations if the k initially corrupt variable nodes are variable nodes in J. Let S r e be a subset of S e such that any graph S 1 ∈ S e contains a graph S 2 ∈ S r e and no graph in S r e contains another graph in S r e . With the above formulation, we give the following proposition.
Proposition 2: Algorithm F will converge on G after l decoding iterations if the induced subgraph I is not contained in any induced subgraph K of G that is isomorphic to a graph in S r e . Proof: If F fails to converge on G after l iterations then G ∈ S e , hence I must be contained in an induced subgraph K of G that are isomorphic to a graph in S r e . We remark that Proposition 2 only gives a sufficient condition. This is because K might be contained in an induced subgraph of G that is not isomorphic to any graph in S e . Nevertheless, S r e can still be used as a benchmark to evaluate the algorithm F. A better algorithm should allow the above sufficient condition to be met with higher probability. For a more precise statement, we give the following.
Proposition 3: The probability that a Tanner graph I is contained in a Tanner graph K 1 with k 1 variable nodes is less than the probability that I is contained in a Tanner graph K 2 with k 2 variable nodes if k 1 > k 2 contains K 2 , the probability that I is contained in K (s) 2 is less than the probability that I is contained in K 2 by conditional probability.
Proposition 3 suggests that a two-bit bit flipping algorithm should be chosen to maximize the size (in terms of number of variable nodes) of the smallest Tanner graph in S r e . Given an algorithm F, one can find all graphs in S r e up to a certain number of variable nodes by a recursive algorithm. Let V (i) e denote the set of corrupt variable nodes at the beginning of the i-th iteration. The algorithm starts with the subgraph I, which is induced by the variable nodes in V e ) can be unsatisfied. Therefore, if a correct variable node becomes corrupt at the end of the first iteration then it must connect to at least one check node in N (V (i) e ). In all possible ways, the algorithm then expands I recursively by adjoining new variable nodes such that these variable nodes become corrupt at the end of the first iteration. The recursive introduction of new variable nodes halts if a graph in S r e is found. Let T 1 be the set of graphs obtained by expanding I. Each graph in T 1 S r e is then again expanded by adjoining new variable nodes that become corrupt at the end of the second iteration. This process is repeated l times where l is the maximum number of iterations.

V. NUMERICAL RESULTS AND DISCUSSION
We demonstrate the performance of two-bit bit flipping algorithms on a regular column-weight-three quasi-cyclic LDPC code of length n = 768. The code has rate R = 0.75 and minimum distance d min = 12. Two different decoders are considered. The first decoder, denoted as BFD1, employs a single two-bit bit flipping algorithm. The BFD1 may perform iterative decoding for a maximum number of 30 iterations. The second decoder, denoted as BFD2, is a concatenation of 55 algorithms, namely F 1 , F 2 , . . . F 55 . Associated with algorithm F i is a maximum number of iterations l i . The BFD2 operates by performing decoding using algorithm F i on an input vector y for i = 1, 2, . . . , 55 or until a codeword is found. The maximum possible number of decoding iterations performed by the BFD2 is ∑ 55 i=1 l i = 1950. Details on the algorithms F 1 , F 2 , . . . F 55 as well as the parity check matrix of the quasicyclic LDPC code can be found in [10].
Simulations for frame error rate (FER) are shown in Fig.  4. Both decoders outperform decoders which use the Gallager A/B algorithm or the min-sum algorithm. In particular, the FER performance of the BFD2 is significantly better. More importantly, the slope of the FER curve of the BFD2 is larger than that of the BP decoder. This shows the potential of twobit bit flipping decoders with comparable or even better error floor performance than that of the BP decoder. It is also   important to remark that although the BFD2 uses 55 different decoding algorithms, at cross over probability α < 0.0025, more than 99.99% of codewords are decoded by the first algorithm. Consequently, the average number of iterations per output word of the BFD2 is not much higher than that of the BFD1, as illustrated in Fig. 5. This means that similar to the BFD1, the BFD2 has an extremely high speed.
ACKNOWLEDGMENT This work was funded by NSF under the grants CCF-0963726 and CCF-0830245.