Learning from the Syndrome

In this paper, we introduce the syndrome loss, an alternative loss function for neural error-correcting decoders based on a relaxation of the syndrome. The syndrome loss penalizes the decoder for producing outputs that do not correspond to valid codewords. We show that training with the syndrome loss yields decoders with consistently lower frame error rate for a number of short block codes, at little additional cost during training and no additional cost during inference. The proposed method does not depend on knowledge of the transmitted codeword, making it a promising tool for online adaptation to changing channel conditions.


I. INTRODUCTION
Researchers are currently exploring the use of neural networks in digital communication systems, either as replacements for certain components or as an end-to-end solution. Much of this work has focused on trying to train improved decoders for error-correcting codes, since for many codes and channels the design of a near-optimal decoder is an unsolved problem. There have been many attempts to build machine learning-based decoders over the years [1]- [7], but these attempts have largely been thwarted by the "curse of dimensionality" described in [8]: for a code with k-bit messages, there are 2 k possible codewords, and a naïvely configured learning algorithm may not generalize to the many codewords not seen during training. Indeed, [9] found that a fully-connected neural network for decoding even the simple (7,4) Hamming code could not successfully decode received vectors corresponding to codewords never shown during training.
A few recent breakthroughs have reignited interest in the idea of decoding using deep learning. First, in [10], Nachmani et al. showed that by unrolling the belief propagation decoding algorithm for a number of iterations and assigning learnable weights to each iteration, a neural network is formed that can be trained to achieve error correction performance significantly better than that of the conventional belief propagation decoder for short high-density parity-check (HDPC) codes. Since the code is hardwired into the neural network structure, it suffices to train it using only the all-zeros codeword, thus sidestepping the curse of dimensionality. Subsequent works modified Nachmani et al.'s approach to be more hardwarefriendly [11], use fewer parameters through weight sharing and attain close to optimal performance by being combined with a state-of-the-art HDPC decoder [12], [13], and handle channels with correlated noise using a convolutional neural 1 The first author performed this work while at McGill University. network [14]. Second, in [8], Gruber et al. reported the same failure of fully-connected neural networks to generalize to new codewords as was originally reported in [9], but found that the effect was much less pronounced for codes for which the parity-check matrix is not random but rather has structure (specifically, polar codes [15]), suggesting that fully-connected neural networks are capable of learning something like a decoding algorithm rather than simply memorizing the code. The approaches in [16] and [17] strike a balance between fully-connected neural networks and conventional decoding algorithms to achieve lower latency decoding of polar codes.
Existing methods for training neural channel decoders have typically used the binary cross-entropy as the loss function for supervised learning. The cross-entropy loss is indeed an appropriate loss function for training a binary classifier. However, error correction is not a simple binary classification problem but rather a structured prediction problem, since the bits to be predicted are related to each other through the code structure. We therefore hypothesize that decoder training can be improved by incorporating knowledge of the code structure into the loss function.
To test this hypothesis, we introduce a new loss function, the syndrome loss, which penalizes the decoder for producing outputs that do not correspond to valid codewords. We show that combining the syndrome loss with the cross-entropy loss improves the frame error rate of several neural channel decoders for short block codes across all signal-to-noise ratios.
Perhaps more interestingly, the syndrome loss is completely unsupervised: that is, the decoder does not require knowledge of the transmitted codeword in order to compute the loss. Unsupervised learning could enable online training of decoders without the use of pilot signals, a useful property for receivers that must adapt quickly to changing channel conditions [18]. We show that, while taking care not to overfit to the training codewords, decoders can indeed be trained using only unsupervised learning.
In the rest of the paper, we define the syndrome loss, relate it to previous work, and show how it may be useful using a set of supervised and unsupervised learning experiments.

II. THE SYNDROME LOSS
In this work, we consider communication systems that use a binary linear code to transmit over an additive white Gaussian noise (AWGN) channel, although our method could potentially be applied to other types of channel. The transmitter encodes a k-bit message u ∈ GF(2) k using a generator matrix G ∈ GF(2) n×k to obtain an n-bit codeword c = Gu ∈ GF(2) n . The codeword is put in a bipolar format x = 1 − 2c ∈ {−1, +1} n and transmitted over the channel. The receiver receives a noisy signal y = x + w ∈ R n , where w ∈ R n is a vector of AWGN channel noise with variance σ 2 . The decoder must estimate x from y. We consider decoders that produce a soft output s ∈ R n , where the estimated bipolar codeword is found by taking the hard decisionx = sign(s), and the corresponding estimated binary codeword isĉ = 0.5 − 0.5x.
A linear code can be described by a parity-check matrix H ∈ GF(2) (n−k)×n . For example, the following is a paritycheck matrix for the (7,4)-Hamming code: The product Hĉ ∈ GF(2) n−k is called the syndrome. Ifĉ is a codeword, the syndrome will contain only 0; otherwise, the syndrome will contain at least a single 1. The syndrome can therefore be used to check if the decoder has successfully produced a valid codeword as an output.
Since adding numbers in GF (2) is equivalent to multiplying numbers in {−1, +1}, the syndrome can be expressed equivalently in the bipolar format in terms of the soft output s as follows: where M(i) is the set of columns in the ith row of H equal to 1.
One could imagine training a decoder to produce outputs that are codewords by minimizing the number of entries of the syndrome equal to −1. However, the syndrome is not well suited for conventional gradient-based learning, since the gradient of each entry is 0 almost everywhere. Accordingly, we introduce the "soft syndrome", a relaxation of the usual "hard syndrome". The soft syndrome is defined as follows: Note that this is just the check node equation from min-sum decoding, which has a non-trivial gradient (c.f. Chapter 5 of [19]).
As an example illustrating the behavior of the soft syndrome, suppose that the transmitter using the (7,4)-Hamming code sends the all-zeros codeword, We can construct a loss function, the syndrome loss, based on the soft syndrome that penalizes all the entries that are negative as follows: The usual supervised binary classification loss function is the cross-entropy loss: where g(·) is the logistic sigmoid function.
We propose to combine the syndrome loss with the crossentropy loss to obtain a complete loss function: ℓ total (c, s) = (1 − λ) · ℓ syndrome (s) + λ · ℓ cross-entropy (c, s), (10) where λ ∈ [0, 1]. When λ = 1, the loss is just the usual supervised loss; when 0 < λ < 1, the loss is supervised with the syndrome loss as a regularization term; when λ = 0, there is no dependence on the transmitted codeword, so the loss is unsupervised.

III. RELATED WORK
Other papers have proposed the use of something like the syndrome loss for decoding applications. In [20], the authors interpreted an iterative decoding algorithm as a gradient descent-based algorithm for minimizing a "generalized syndrome weight". This generalized syndrome weight was also treated in [21] and [22] in a similar way. In [23] and [24], Xia and Wu approached the problem of blind detection and identification of LDPC codes using "syndrome LLRs" for each candidate code.
It is important to distinguish our syndrome-based training method from that of [25], in which the syndrome is calculated from the received signal and used as part of the input to a neural network decoder. In our method, the decoder can take on any form, as long as the output is a soft estimate of the transmitted codeword. Thus, our method is not suitable for decoders in which the output is an estimate of the original message u, such as the polar decoder of [8].

IV. SUPERVISED LEARNING EXPERIMENTS
We trained neural normalized min-sum (NNMS) decoders [13] for four short block codes: a (63, 45) BCH code, a (16,8) LDPC code, a (128,64) polar code, and a (200,100) LDPC code. For all experiments described in this paper, we used the Adam update rule [26] with a learning rate of 0.01, and trained on 10,000 minibatches of 120 codewords each, with added noise drawn uniformly from all signal-to-noise ratios (SNRs). The all-zeros codeword was used during training, and random codewords were used during testing. We used the "multi-loss" approach proposed in [10]: the loss is computed for the soft output of every decoding iteration and these losses are summed to obtain the final loss. We measured the frame error rate (FER) of the decoders using Monte Carlo simulation, requiring a minimum of 100 frame errors to be detected and at least 100,000 frames for each SNR to be simulated to minimize the variance of the FER estimates. The hyperparameter λ was set to either 1 (purely supervised) or 0.5 (supervised + regularized). Slightly better results can be obtained by tuning the value of λ; we have not attempted this here to show that the syndrome loss works even without careful tuning. The performance of the decoders is shown in Fig. 1, 2, 3, and 4. The performance for decoders without learning (i.e., all weights are equal to 1) is also shown for comparison. It can be seen that the decoders trained with the syndrome loss have a small but consistent improvement in FER across all signalto-noise ratios. Thus, using the syndrome loss, decoders can be obtained with better FER performance at no additional cost during inference and little additional cost during training. The impact of the syndrome loss on bit error rate (BER), however, is less consistent. In some instances, we have found that BER is improved, and in others BER is made worse. It may be that the decoder attempts to output a valid codeword at the expense of making more bit errors.

V. UNSUPERVISED LEARNING EXPERIMENTS
We attempted to train decoders using purely unsupervised learning, i.e. with λ = 0. In some instances, training the decoder with λ = 0 led to the decoder having FER ≈ 1 across all SNRs. In these instances, because the decoder was trained using only the all-zeros codeword, it was able to find a set of positive and negative weights which, when multiplied with the all-zeros codeword, yield a valid (but incorrect) codeword. Two techniques were found to prevent this failure mode: 1) constraining the weights to being positive, e.g. using the softplus function (since we have observed that the weights are generally all positive after supervised learning), or 2) training using random codewords instead of the all-zeros codeword. The latter technique is preferable, since in theory some of the weights could be negative for the optimal parameter setting. The performance of an NNMS decoder for the (63, 36) BCH code trained on random codewords with λ = 0 is shown in Fig.  5. The performance of the decoder with unsupervised learning is better than the decoder without learning, suggesting that the syndrome loss could potentially be used for online learning in  decoders when the transmitted codewords are unknown. While the syndrome loss does teach the decoder about the structure of the code, in principle there is no guarantee that this will help the decoder learn to decode. For example, a decoder that simply outputs a random codeword independent of the received signal would incur no syndrome loss. Therefore, some prior information about the goal of decoding must be provided to the decoder. For a neural belief propagation decoder, this information is built into the network through the graphical model of the code. For a tabula rasa neural network, the prior information must be supplied in some other way, such as pre-training the model using supervised learning. We have not attempted to train an unconstrained neural network using the syndrome loss; we leave this for future work.

VI. CONCLUSION
In this paper, we introduced the syndrome loss, a new loss function for neural error-correcting decoders. The syndrome loss is designed to teach decoders to produce outputs with a correct structure. Decoders trained using the syndrome loss have consistently lower frame error rate when the syndrome loss is used as a regularization term and are capable of purely unsupervised learning when the appropriate precautions are taken.
ACKNOWLEDGMENT Thanks to Ali Hashemi for providing the parity-check matrix for the polar code used in our experiments.