# DLSTM-Based Successive Cancellation Flipping Decoder for Short Polar Codes
## 3 The Proposed SC Flipping Algorithm
### DLSTM Network Structure  
The first error bit plays an important role in the flipping algorithm. Since the first error bit cannot be accurately located by the LLR value, we adopt the neural network to predict it. A DLSTM network structure is illustrated in Figure 6b. This network mainly consists of an input layer, a DLSTM layer, and an output layer. The DLSTM layer contains \(2N\) hidden  
Figure 4: Frequency of errors caused by the channel noise at different \(E_{b}/N_{0}\) for \(P(64,32)\), \(1\times 10^{5}\) polar codes.  
Figure 5: The percentage of error bits caused by different reasons at different \(E_{b}/N_{0}\) for \(P(64,32)\), \(1\times 10^{5}\) polar codes.  
LSTM units, where \(N\) is the length of a polar code. The output layer is a fully connected layer with \(K\) neurons. This \(K\) represents the classification that the DLSTM network can recognize, as well as the length of the information bits. The \(K\) neurons in output layer activated by softmax function:  
\[s(\hat{y}_{i})=\frac{\hat{y}_{i}}{\sum_{j=0}^{K-1}\hat{y}_{j}}\enspace, \tag{13}\]  
where \(\hat{y}_{i}\) is the output of the \(i\)th neuron. With this activation function, a \(K\)-dimensional vector is produced.  
The input and output of the DLSTM network are:  
* Input: The absolute value of the LLR sequence (both the information bits and the frozen bits) that fails CRC detector in the SC decoding.
* Output: A \(K\)-dimensional vector, the element of which corresponds to the probability of error occurrence for each information bit.  
The details of the DLSTM unit are shown in Figure 7. At \(t\) time, the input of the DLSTM network is \([\mathbf{h}_{t-1}^{1},\mathbf{x}_{t}]\), which represents the output \(\mathbf{h}_{t-1}^{1}\) at \(t-1\) time and the input \(\mathbf{x}_{t}\) at the current time concatenated into a vector. The vector passes through the forget gate \(\mathbf{f}_{t}^{1}\), the input gate \(\mathbf{i}_{t}^{1}\), and the output gate \(\mathbf{o}_{t}^{1}\) in turn. \(\mathbf{h}_{t}^{1}\) and \(\mathbf{h}_{t}^{2}\) denote the two outputs of the DLSTM unit. The cell states \(\mathbf{c}_{t}^{1}\) and \(\mathbf{c}_{t}^{2}\) hold the different long-term memories. The output gate \(\mathbf{o}_{t}^{1}\) of the DLSTM has two directions, one is transmitted the \(t+1\) moment and the other is the input of the next layer at \(t\) moment. Thus, the input to the second LSTM layer is \([\mathbf{h}_{t-1}^{2},\mathbf{h}_{t}^{1}]\), which is different from the input to the first layer. The relationship between the inputs \([\mathbf{h}_{t-1}^{2},\mathbf{h}_{t}^{1}]\) and outputs \(\mathbf{h}_{t}^{2}\) of the second LSTM layer is described as follows:  
\[\left\{\begin{array}{l}\mathbf{f}_{t}^{2}=\sigma\left(\mathbf{W}_{f}^{2} \cdot[\mathbf{h}_{t-1}^{2},\mathbf{h}_{t}^{1}]+\mathbf{b}_{f}^{2}\right)\\ \mathbf{i}_{t}^{2}=\sigma\left(\mathbf{W}_{f}^{2}\cdot[\mathbf{h}_{t-1}^{2}, \mathbf{h}_{t}^{1}]+\mathbf{b}_{f}^{2}\right)\\ \mathbf{o}_{t}^{2}=\sigma\left(\mathbf{W}_{o}^{2}\cdot[\mathbf{h}_{t-1}^{2}, \mathbf{h}_{t}^{1}]+\mathbf{b}_{o}^{2}\right)\\ \mathbf{c}_{t}^{\prime 2}=\tanh\left(\mathbf{W}_{c}^{2}\cdot[\mathbf{h}_{t-1}^{2}, \mathbf{h}_{t}^{1}]+\mathbf{b}_{c}^{2}\right)\\ \mathbf{c}_{t}^{\prime 2}=\mathbf{f}_{t}^{2}\circ\mathbf{c}_{t-1}^{2}+\mathbf{i}_{t}^{ 2}\circ\mathbf{c}_{t}^{\prime 2}\\ \mathbf{h}_{t}^{2}=\mathbf{o}_{t}^{2}\circ\tanh\left(\mathbf{c}_{t}^{2}\right) \end{array}\right.\enspace. \tag{14}\]  
Due to this unit structure, the DLSTM network structure is more favorable than the traditional LSTM. Because of the DLSTM network's good memory characteristic, it can show superiority in extracting historical data features and can preserve long-term relevancy.  
Figure 6: (a) System simulation model. (b) The DLSTM network structure for predicting the first error bit of \(P(64,32)\).