# Shared Graph Neural Network for Channel Decoding
## 2 Preliminary  
LDPC, BCH, and Hamming codes are all linear block codes, and the Tanner graph of these codes are bipartite graph. We denote these codes by \((N,K)\), where \(N\) denotes the length of codewords and \(K\) denotes the number of information bits. Suppose that, in a communication system, binary phase shift keying (BPSK) or quadrature phase shift keying (QPSK) modulation are used after information are encoded. Assume that the message obtained is \(Y=X+N\) over the additive white Gaussian noise (AWGN) channel, where \(X\in\mathbb{C}^{M}\) is the transmitted complex symbol, \(N\sim\mathcal{CN}(\mathbf{0},\sigma^{2}\mathbf{I}_{M})\) is the complex AWGN noise. \(M\) represents the number of transmitted symbols. In BPSK modulation, \(M\) measures the length of the transmitted signal as the number of bits per symbol, \(B\) is one, and M is half the signal's length in QPSK as the number of bits per symbol, and \(B\) is 2. \(\mathbf{I}_{M}\) is a matrix of size \(M\)-by-\(M\), \(\sigma^{2}=N_{0}/2\) is the variance of the channel noise, and \(N_{0}\) is noise spectral density. The log-likelihood ratio (LLR) in ref. [23] of the \(v\)-th bit can be computed as  
\[l_{v,i}=\ln\left(\frac{\sum_{X_{v}\in X_{i,1}}e^{-\frac{1}{N_{0}}|Y_{v}-X_{v} |^{2}}}{\sum_{X_{v}\in X_{i,0}}e^{-\frac{1}{N_{0}}|Y_{v}-X_{v}|^{2}}}\right), \tag{1}\]where \(i\in\{1,2,\cdots,B\}\), \(X=\{x_{1},\cdots,x_{2^{B}}\}\) denotes the constellation points with unit energy and \(X_{i,b}\) denotes the subset of \(X\) with the \(i\)-th bit being \(b\in\{0,1\}\). LLR in [23] for BPSK modulation can be expressed as  
\[l_{v}=log(\frac{P(Y_{v}=y_{v}|X_{v}=-1)}{P(Y_{v}=y_{v}|X_{v}=+1)})=\frac{2y_{v} }{\sigma^{2}}. \tag{2}\]  
We use \(E_{b}/N_{0}=1/(2(K/N)\sigma^{2})\) as the signal-to-noise ratio, where \(E_{b}\) is the energy per information bit, \(y_{v}\) is the \(v\)-th value of the received message. GNN-Based Channel DecodingSimilar to the Tanner graph, the GNN-based channel decoding also [22] has two types of nodes, namely, variable nodes (VN) and factor nodes (FN). The variable nodes correspond to the j-th column of the \(H\) matrix, and the factor nodes correspond to the i-th row of the \(H\) matrix, similar to the check node in the BP algorithm. There are \(K\) VNs, denoted by \(\mathcal{V}\), and there are \(N-K\) FNs, denoted by \(\mathcal{U}\). \(\mathcal{E}\) denotes all of the edges in the Tanner graph, which means all the 1s in \(H\). According to graph theory, we assign value and attribute to each node and each edge in the graph, similar to the training parameters in weighted BP and min-sum algorithms [12; 24]. We use \(h_{v_{ij}}\in R^{F_{n}}\), \(h_{v_{ij}}\in R^{F_{n}}\) to denote each of the node values for VN and FN, respectively, which are \(F_{n}-\)dimensional vectors. \(m_{v_{ij}\to u_{j}}\in R^{F_{n}}\), \(m_{u_{ij}\to v_{j}}\in R^{F_{m}}\) are used to assign messages to each directed edge, while different message values are assigned for different directions of each edge. In order to improve the BER performance, appropriate weights to each directional edge and each node are added, similar to the model-driven training weights. We use \(g_{v_{ij}}\in R^{F_{n}}\), \(g_{u_{ij}}\in R^{F_{n}}\) to denote each of the node attribute for VN and FN, respectively, and there are \(2N-K\) node attributes. \(g_{v_{ij}\to u_{ij}}\in R^{F_{m}}\), \(g_{u_{ij}\to v_{j}}\in R^{F_{m}}\) are used to assign each directed edge attributes; there is a total of \(2\mathcal{E}\) edge attributes. As shown in Algorithm 1, we first initialize the FN and VN values, and then enter the decoding process until the maximum number \(T\) of decodings is reached and the iteration terminates. The edge directed message update function and the two-node FN, VN values' update functions are trained to the GNN-based channel decoding algorithm. The GNN-based channel decoding algorithm requires the following four steps:  
1.