Residual Connections
A residual connection adds a layer's input straight to its output, so the layer only has to learn the correction needed on top of what it was already given, which is what makes very deep networks trainable at all.
Prerequisites: The Multilayer Perceptron, Backpropagation
Stack enough ordinary layers and, counterintuitively, training gets worse, not just slower. This isn't overfitting — a 56-layer plain network can have higher training error than a 20-layer one on the exact same data. The reason is what happens to the gradient during backpropagation: it has to travel back through every layer, getting multiplied by that layer's weights each time. Multiply enough small numbers together and the signal that reaches the early layers is vanishingly faint; those layers barely learn anything, and the whole network is stuck.
Imagine relaying a message through fifty people, each one only allowed to whisper their own edited version onward — by person fifty the original message is unrecognizable static. A residual connection is the fix: hand each person a copy of the original note alongside whatever they whisper, so the message never depends entirely on fifty consecutive accurate retellings.
The mechanics, one symbol at a time
Let be a layer's input and be whatever transformation the layer's weights compute (its ordinary forward pass — some matrix multiplies and nonlinearities). A plain layer outputs . A residual layer instead outputs:
In words: don't ask the layer to produce the whole answer — just ask it to produce the change needed on top of what came in, and add that change back to the original input. If the ideal transformation for this layer happens to be "do nothing," the layer only has to learn , which is far easier for gradient descent to find than learning the identity mapping exactly using ordinary weighted sums and nonlinearities.
The gradient benefit follows directly. Differentiating with respect to gives . That leading means a direct, unobstructed path for the gradient straight back through the skip connection, no matter how small or poorly conditioned is. The signal from the loss can always reach earlier layers through that "+1" highway, even if the layer's own learned transformation is contributing almost nothing useful yet.
Worked example 1: a forward pass with and without the skip
A single residual block, input . Its internal transformation is .
.
Plain layer output: — the input's own scale is gone entirely; downstream layers see only the small correction.
Residual layer output: — the input's information survives, lightly adjusted. If is badly initialized and produces something close to zero or noise, the plain layer passes that noise onward as its entire output, while the residual layer still passes a nearly-unchanged, sensible .
Worked example 2: gradient flow through a chain
Chain three plain layers where each layer's local gradient happens to be small, at the current weights (this happens easily early in training or with saturating activations). The gradient reaching the input, by the chain rule, is roughly — the signal has shrunk by more than 99%, and the earliest layer barely updates.
Now make each layer residual, so each local derivative is instead. Chained: . The gradient not only survives three layers, it doesn't shrink at all. This is the concrete mechanism behind "residual connections fix vanishing gradients": the additive in every layer's derivative stops the chain rule from being a chain of pure multiplication.
Use the explorer above with a base below 1 to see how fast repeated multiplication by a number less than one collapses toward zero — that curve, applied to gradients instead of a variable, is exactly what happens to a plain deep network and exactly what the residual's interrupts.
What this means in practice
Residual connections are what made networks with 50, 100, even 1000+ layers trainable, and they are now a default architectural choice, not a special trick — they sit inside every transformer block (around both the attention step and the feed-forward step) and every modern convolutional network. One practical requirement: and must have the same shape to be added, so architectures using residual connections are built with that constraint in mind, sometimes inserting a small linear projection on the skip path when a layer changes dimensionality. Financial deep learning models are rarely hundreds of layers deep, so you will meet residual connections less as "the reason training works at all" and more as a component inherited from transformer-based architectures used for sequence data.
A residual connection reframes what a layer has to learn: instead of the whole output, it learns only the correction on top of its input, and the added identity path gives the gradient an unobstructed route back through arbitrarily many layers.
The classic confusion: thinking residual connections make depth free, with no trade-off. They fix the optimization problem of vanishing gradients, but a deeper residual network still has more parameters, costs more compute, and can still overfit a small financial dataset — depth stops being untrainable, it does not stop being a capacity choice you have to justify with data.
Practice in interviews
Further reading
- He et al., Deep Residual Learning for Image Recognition
- Goodfellow, Bengio & Courville, Deep Learning, ch. 8