Recurrent Neural Networks

This section covers networks that read a sequence one step at a time and carry a hidden state forward. A CNN shares one kernel across positions in space. An RNN shares one update rule across steps in time. 5.3.1. RNNs starts from filters in signal processing. An FIR filter is a convolution over time, and an IIR filter keeps a state. The linear state-space model is the simplest IIR filter, and the RNN adds a nonlinearity to its update. The note also covers stacked RNNs and the Kalman filter as a learned linear RNN. 5.3.2. Backpropagation Through Time trains an RNN by unrolling it over the sequence. It explains vanishing and exploding gradients and the cost of the sequential steps. 5.3.3. Sequence-to-Sequence Models pairs an encoder RNN with a decoder RNN for tasks such as translation. Its bottleneck leads to attention.

Prerequisites

Contents

  • 5.3.1. RNNs: FIR and IIR filters, the LTI state-space model and its taps, the vanilla RNN, stacked RNNs with residual connections and LayerNorm, task shapes, the state needed for running summaries, the Kalman filter as a learned linear RNN, and identifiability up to a change of basis. Not taught: the names of the task shapes, LSTM, GRU and bidirectional RNNs.
  • 5.3.2. Backpropagation Through Time: unrolling, gradients of shared weights, Jacobian products, vanishing and exploding gradients, tanh versus ReLU, cost and memory, scheduling a stacked RNN, and parallel scans for linear recurrences. Not taught: gradient clipping and truncated BPTT. The exploding case and the tanh-ReLU comparison come from the homework, and the cost counts and the parallel scan come from discussion.
  • 5.3.3. Sequence-to-Sequence Models: the encoder-decoder, teacher forcing, autoregressive generation, greedy decoding, sampling, beam search and the bottleneck. Not taught: temperature, top- and nucleus sampling.

Recommended Path

Read 5.3.1. RNNs first, then 5.3.2. Backpropagation Through Time and 5.3.3. Sequence-to-Sequence Models. The last one leads into 7.1. Attention. The learned Kalman filter returns in 8.1. Self-Supervised Learning, where it illustrates partial patterns and scaffolding.