AI Glossary / Mathematics and optimization / Intermediate
Skip connection
Definition
A skip connection is a neural-network connection that carries information past one or more intervening layers to a later part of the network. The bypassed information is then combined with that later representation, commonly through addition or concatenation.
What it means
In a plain stack, each layer receives the previous layer's output. A skip connection adds another path from an earlier representation. This lets later computation use information that has not passed through every transformation in the intervening block.
Residual networks commonly add a block's input to its learned transformation, giving y=x+F(x). The block can then learn a change relative to the input. Encoder-decoder architectures may instead concatenate earlier features with later features, retaining both as separate channels.
These forms serve related but different purposes. Addition requires compatible dimensions and combines corresponding values. Concatenation extends a selected axis and leaves later layers to combine the expanded representation. The word skip does not mean the intervening layers are necessarily omitted from execution.
How it works
For an identity residual connection, compute F(x) through the main branch and add x. If the branches have incompatible dimensions, the shortcut may use a projection P(x), giving y=P(x)+F(x). Such a projection can have learned parameters.
The derivative of an identity residual block is I+JF(x), where JF is the Jacobian of the main branch. The identity contribution creates a direct route for gradients. This can help optimization, but the total derivative can still be poorly behaved; for example, JF=−I cancels it.
In a concatenating connection, both branches must agree on the dimensions that are not being concatenated. A feature map may need cropping, resizing or another defined alignment operation before combination. The operation must preserve the intended correspondence between positions.
Normalization and activation placement also affect behavior. A block with an activation after addition is not identical to a bare sum. Architecture diagrams and implementations should make the exact sequence clear rather than treating every shortcut as the same formula.
Three practical examples
- An image-recognition model uses residual additions so that a block can refine an existing representation.
- A segmentation model combines earlier spatial detail with later semantic features through encoder-decoder connections.
- A model-conversion engineer checks that a projected shortcut matches the destination branch's channel and spatial dimensions.
Think of it this way
Think of sending an earlier draft directly to a later editing stage alongside the revisions produced by intermediate editors. The later stage can preserve useful original material while incorporating changes.
The analogy does not mean the original input is always copied unchanged into the final answer. Addition can alter or cancel values, concatenation changes representation size, and later layers still determine how the information is used.
Worked example
Addition, concatenation and a gradient check
Let x=(2,3) and F(x)=(0.1x₁,−0.2x₂)=(0.2,−0.6). An additive identity shortcut gives y=x+F(x)=(2.2,2.4). The result still has two coordinates.
Concatenating the same two vectors instead gives (2,3,0.2,−0.6), with four coordinates. The operations are therefore not interchangeable even though both carry earlier information forward.
For the additive block, the Jacobian is diag(1.1,0.8). If a teaching loss is L=½(y₁²+y₂²), the gradient with respect to x is diag(1.1,0.8)y=(2.42,1.92). The identity branch contributes to that derivative.
Now consider a different main branch F(x)=−x. The additive output is zero and its Jacobian is zero, because I+(−I)=0. This counterexample shows why a shortcut does not mathematically guarantee a nonzero gradient everywhere. It changes the architecture and available paths, while the complete learned function determines the actual gradient.
Illustrative case study
A fictional visual-inspection team builds an encoder-decoder model for locating small defects. Its first implementation connects an early feature map to the decoder without checking spatial alignment. The dimensions are made compatible by a reshape, but corresponding image positions no longer match.
The engineers replace that operation with the intended alignment and verify it using inputs with recognizable locations. They also document whether the connection adds or concatenates features, since that choice changes channel counts and subsequent layers.
The team evaluates defect localization on held-out images. The presence of a skip connection is an architectural fact, not evidence by itself that small defects will be detected reliably.
Common misconceptions and mistakes
- Skip connections always skip computation. Usually the main branch still runs and its result is combined with the shortcut.
- Every shortcut is parameter free. A projection or gate can introduce parameters.
- Addition and concatenation mean the same thing. They produce different representations.
- A shortcut guarantees gradients never vanish. Cancellation, activations and other parts of the network can still affect gradients.
- Any matching shape ensures correct alignment. Axis meaning and spatial correspondence also matter.
Business use
Skip connections are relevant when assessing model architecture, computational cost and conversion fidelity. They can support useful information paths, but their practical effect depends on the network and task.
For implementation reviews, inspect merge operations, dimension changes and alignment. Measure memory and execution costs on the actual model, because retaining earlier activations and concatenating features can affect resource use. When comparing architectures, evaluate outcomes under a controlled training setup instead of attributing every difference to the presence or absence of shortcuts.
People also ask
Are skip connections only for image models?
No. The architectural idea can be used wherever compatible representations are connected across intervening computation.
Does an identity shortcut add learned weights?
The identity mapping itself does not, although the surrounding block and merge operation still require computation.
Can the main branch learn no change?
In a residual sum y=x+F(x), F(x)=0 yields the identity at that sum, subject to any later operations.
Check your understanding
Two vectors of length two are combined by concatenation. Is the result equivalent to adding them elementwise?
Answer: No. Concatenation produces four entries, while addition produces two summed entries. Later layers must be designed for the chosen operation.
Related terms
- Backpropagation
- Encoder-decoder
- Residual network
- residual block
- concatenation
- tensor shape
Learn next
Read residual learning and backpropagation. Draw the two paths in y=x+F(x), then identify where a projection would be required if F changes the number of feature channels.
More in Mathematics and optimization
- Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
- Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
- Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
- Σ-algebra
- Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
- Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.
Sources
He and colleagues, Deep Residual Learning for Image Recognition: https://arxiv.org/pdf/1512.03385. Primary residual shortcut formulation.
Ronneberger, Fischer and Brox, U-Net: https://arxiv.org/pdf/1505.04597. Primary encoder-decoder architecture with feature concatenation.
Aalto Dictionary of Machine Learning: https://aaltodictionaryofml.github.io/ADictML_Main.pdf. Source-list term. Vector and derivative examples are original calculations.
Previous: Skill chaining Next: Skip-gram