Lecture 7 · Machine Learning for ICE · University of Klagenfurt, 2023
Lecture 7 of 8
Back to communications, with the tools of lectures 2 to 6:
From Machine Learning for ICE at the University of Klagenfurt, first taught in 2022: this is the 2023 edition, so some of it may be a little dated. All lectures.
01
The receiver can be treated as one supervised learning problem. Tasks usually solved one by one, such as channel estimation, equalization (demodulation), channel decoding and source decoding, can in principle be solved jointly by a neural network.
y(t) Demodulator Channel decoder Source decoder \hat s_k
traditional approach
y(t) Neural receiver \hat s_k
learning approach
Input message s\sim p_S(s) Transmitter not trainable x\sim p_X(x) Medium p_{Y\mid X}(y\mid x) y\sim p_Y(y) Receiver trainable Estimated message \hat s\sim p_S(s\mid y;\theta)
With M possible messages, the receiver is a classifier with M outputs: a network takes the received samples y_1,y_2,\dots and returns the probabilities p_S(s=s_0\mid y;\theta),\,p_S(s=s_1\mid y;\theta),\dots through a softmax.
It is trained with the cross-entropy, over pairs of transmitted messages and received samples:
\hat\theta=\arg\min_\theta\,-\mathbb{E}_{(s,y)\sim p(s,y)}\big[\log p_S(s\mid y;\theta)\big]
s_k Source encoder b_k: 0101 Hamming (7,4) encoder c_k: 0101100 BPSK modulator x_k
The messages s_k\in\{0,1,\dots,15\} are converted to 4 bits \mathbf{b}_k, then encoded with the Hamming (7,4) code:
\mathbf{c}_k=\mathbf{b}_k\,\mathbf{G}_{7,4}\bmod2,\qquad\mathbf{G}_{7,4}=\begin{bmatrix}1&0&0&0&1&0&1\\0&1&0&0&1&1&1\\0&0&1&0&1&1&0\\0&0&0&1&0&1&1\end{bmatrix}
For example, s_k=5 gives \mathbf{b}_k=[0\,1\,0\,1] and \mathbf{c}_k=[0\,1\,0\,1\,1\,0\,0].
def build_classifier(self):
model = Sequential()
model.add(Dense(100, input_dim=7))
model.add(LeakyReLU(alpha=0.2))
model.add(GaussianNoise(0.3)) # regularizes training
model.add(Dense(100))
model.add(LeakyReLU(alpha=0.2))
model.add(Dense(16, activation='softmax'))
# one network per Eb/N0: 500 steps of 256 noisy codewords
data_rx = data_tx + eps*np.random.normal(0, 1, (batch_size, 7))
y_cat = to_categorical(from_zero_mean_bits_to_digit(2*data_tx_1-1, 2), num_classes=16)
d_loss = self.combined.train_on_batch(data_rx, y_cat)
neural decoder (ND) against maximum likelihood (MaxL)
The network learns the maximum-likelihood decoder almost exactly, without being told the code: the curves overlap up to about 3 dB and part only where errors become rare, and so are the training examples of them.
A detail of the script: it divides the bit errors by the code length once more, so the vertical axis is 7 times too low. The comparison between the two decoders is unaffected.
02
Treat the whole communication chain as one learning problem.
The tasks of the transmitter (coding, modulation) and of the receiver (equalization, demodulation, decoding) have always been solved separately, which leads to sub-optimal solutions. Instead, see transmitter and receiver as two neural networks joined into one end-to-end model: the autoencoder.
s_k Transmitter x_k Medium model y_k Receiver \hat s_k
the autoencoder: trained end to end, with the channel as a layer in the middle
Input message s\sim p_S(s) Transmitter trainable x\sim p_X(x) Medium p_{Y\mid X}(y\mid x) y\sim p_Y(y) Receiver trainable Estimated message \hat s\sim p_S(s\mid y;\theta)
Decoding is still a classification problem. But now the encoder learns its own channel code x: the transmitter maps the message, one-hot, to the channel inputs x_1,\dots,x_n, the receiver maps the channel outputs back to the probabilities of the messages.
The autoencoder is trained end to end with the cross-entropy:
\hat\theta=\arg\min_\theta\,-\mathbb{E}_{(s,y)\sim p(s,y)}\big[\log p_S(s\mid y;\theta)\big]
where \theta now holds the parameters of both networks. The gradients flow from the receiver, through the channel, back to the transmitter: the channel model must be differentiable.
The input is s\sim p_S(s) and the task is to estimate the input itself, so this can be cast as an unsupervised problem: what we really learn is an internal representation x\sim p_X(x) that is robust to channel impairments and noise.
Unlike autoencoders for compression, here the code is not meant to be small but robust: the code length n (channel uses per message) typically adds redundancy. The communication rate is
R=\frac{\log_2M}{n}\quad\text{[bits per channel use]}
with M the number of messages. Autoencoders are used for
A regularization term is often added to the loss.
Consider an autoencoder with M=16 messages and a code of length n=2.
k, n = 4, 1 # M = 2^k = 16 messages, 1 complex channel use
R = k / (2*n) # 2 bits per real channel use
N = pow(10, -0.1*EbN0) / (2*R) # noise power for this Eb/N0
s_in = Input(shape=(16,)) # one-hot message
x = self.transmitter(s_in) # Dense(16, relu), Dense(2)
# the channel, as layers: average power 1, then AWGN
x_n = BatchNormalization(axis=-1, center=False, scale=False)(x)
y = GaussianNoise(np.sqrt(N))(x_n)
s_out = self.receiver(y) # Dense(16, relu), Dense(16, softmax)
self.combined = Model(s_in, s_out)
self.combined.compile(loss='categorical_crossentropy', optimizer=Adam(0.01, 0.5))the yardstick, not the network’s output: 16-QAM
The batch normalization is the power constraint, and the noise layer is the channel: gradients flow through both. The interesting result is the plot of the learned codes x_k: compare its BLER with that of 16-QAM, the textbook answer for 16 points in a plane.
The original idea: T. O’Shea, J. Hoydis, An introduction to deep learning for the physical layer, 2017.
letizia.tech · Machine Learning for ICE · University of Klagenfurt