
Hyperconnections-alternative to residual connections
- Hyper-connections are introduced as an alternative to residual connections. This addresses the "seesaw effect" caused by the trade-off between vanishing gradients and representation collapse. Theoretically, hyper-connections allow the network to control the strength of connections at features of different depths and dynamically rearrange layers.
Introduction
- Deep learning has had immense success with residual connections in various domains, including CNNs and Transformers.
- Residual connections help reduce the vanishing gradient problem, though they are not an infallible solution.
- The two main variants of residual connections are:
- Pre-Norm: Normalization is applied before the residual block. This mitigates vanishing gradients but introduces representation collapse, where deeper layers become extremely similar.
- Post-Norm: Normalization happens after the residual block. This mitigates representation collapse but reintroduces the vanishing gradient issue.
- Balancing these two issues is like a "seesaw" because these variants predefine the fixed strength of the output and input within the layer.

- Driven by these limitations, the authors explored whether a network can autonomously learn the optimal strength of connections to improve performance.
- Hyper-connections achieve this, improving performance with almost negligible increases in computation and parameters.
- The core idea is to propose learnable depth and width connections, flexibly integrating features vertically across depths compared to standard residual connections.
- Depth connections act as generalized residual connections, assigning weights to the links between input and output.
- To model different depth connections simultaneously, the input is expanded into copies, each with its own depth connection. This allows multiple hidden vectors to preserve various patterns from preceding layers.
- Width connections exist between these hidden vectors, allowing information exchange within the same layer.
- Experiments suggest that is required for performance improvements; with , the seesaw effect persists.
- When , hyper-connections can learn to adjust residual strength and rearrange layers both sequentially and in parallel.
- Dynamic Hyper Connections (DHC) further enhance flexibility by enabling the network to adjust connection weights based on the input.
- Despite the width increasing times, the computational costs remain almost negligible.
- While primary research focused on LLMs, the benefits extend to image generation and classification tasks.
- Using Pre-Norm as a baseline, hyper-connections show benefits across 1B, 7B dense models, and 70B MoE models.
- Models using hyper-connections converge 1.8 times faster and maintain lower feature similarity across adjacent layers.
Method
- Consider the hidden vector for the layer. It has an initial input vector called which is the initial hidden vector for the layer.
- is repeated '' times to get a hyper hidden matrix. This is denoted by .
- The variable '' is called the expansion rate.
- For the layer, it contains the hyper hidden matrix of the layer. It is denoted as .
- Finally, the sum of rows of the last hyper hidden matrix is taken to obtain the hidden vector, which is then passed through a projection layer so that it produces the output of the network.
- The hyper connections can be denoted as a matrix where each element is a connection weight.
- The matrix is made of 3 smaller matrices: , , and .
- The matrix is denoted as:
- Consider a network layer . The output of is denoted by and is formulated as:
- is used as a weighted sum of the input to obtain the input of the current network layer :
- is used to connect and map it to the hyper hidden matrix:
- The 2 types of hyper connections are denoted as:
- a. Depth wise:
- b. Width wise:
Dynamic Hyper Connections
- The entries of can dynamically depend on the input . The matrix representation of this is as follows:
- In practice, we combine both dynamic and static matrices to achieve DHC. The dynamic parameters are obtained through linear transformation of the input .
- To stabilize the training process, normalization is done and then tanh activation is done:
Initialization
- In order to make the initializations the same as pre-norm residual connections, the and in the above equation are set to zero.
- The static matrices are defined as follows:
where is the index of the layer and \pmod denotes the modulo operation.
Why Hyper Connections
- They explore how hyper connection in their non-trainable form represent pre-norm and post-norm architectures.
- The concept of sequential-parallel duality is introduced so that it can be visualized how hyper connections can dynamically optimize layer arrangement to enhance network performance.
- Pre-norm and post-norm connections can be represented as the following hyperconnection matrices with the expansion rate :
-
and are the standard deviations of the input and output layers. The covariance between these are represented as .
-
For pre-norm, the hyper connection matrix is a matrix, with s on the right lower upper triangle part and the rest have a placeholder value of zero in them.
-
For post-norm, the weights depend on the co-variance and variances of the input and output layer. This gives us a non-trainable matrix.
-
Hyper connections give us a trainable matrix.
-
Given a series of neural networks, we have the option to arrange them either sequentially or in parallel. Hyper-connections make it possible to blend both of these configurations into one.

Result table
- Based on the results, increasing the expansion rate n generally improves model performance by reducing evaluation loss and perplexity (PPL) across both V2 and V3 datasets, with the OLMo-1B-DHC 8 configurations consistently achieving the lowest loss and PPL values.

References
-
Zhu, D., Huang, H., Huang, Z., Zeng, Y., Mao, Y., Wu, B., Min, Q., & Zhou, X. (2024). Hyper-Connections. arXiv preprint arXiv:2409.19606.
-
He, K., Zhang, X., Ren, S., & Sun, J. (2016). Deep Residual Learning for Image Recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR). arXiv:1512.03385.