Deeper networks can reuse features and build more abstract ones, but adding layers eventually makes training difficult. The vanishing gradient problem occurs when the error signal needed to update early parts of a long chain no longer gets through effectively. section 9.1 section 9.2
A chain that cannot learn at its beginning
Imagine `y = f4(f3(f2(f1(x))))`. Training uses the loss at the output to adjust every function. To adjust `f1`, error information must pass backward through `f4`, `f3`, and `f2`. Extend that chain far enough, and successive steps can overwhelm the useful gradient signal. The early functions then become hard to train. section 9.2
Two practical responses address the problem in different architectures:
- In a deep ConvNet, use a residual connection: save a block’s input and add it to the block’s output. This shortcut helps information and error gradients pass around blocks that might disrupt them. section 9.2
- If the input and output shapes differ, project the saved input with a 1 × 1 `Conv2D` layer before adding it. Match downsampling with the projection’s stride when the block includes pooling. section 9.2
- For long sequences, do not expect `SimpleRNN` to reliably learn dependencies across many timesteps. `LSTM` and `GRU` were designed to address this limitation; an LSTM carries information forward so older signals need not fade during processing. section 13.3.2 section 13.3.2
Listing 9.1 A residual connection in pseudocode
x = ... #1 residual = x #2 x = block(x) #3 x = add([x, residual]) #4
The pseudocode shows the essential shortcut: keep `residual = x`, process `x` through a block, then add the saved input back. section 9.2
Rule of thumb: when depth makes a feedforward network hard to train, consider a route around processing blocks; when a simple recurrent network loses distant context, consider a recurrent layer designed to carry information across timesteps. These are related responses to the same training difficulty, not identical implementations. section 9.2 section 13.3.2













