Beyond Plain Residuals
Highway networks, dense connections and learned hyper-connections.
The identity shortcut looks too simple to be the last word. Why not let the network learn how much of each layer to keep, wire every layer to every earlier one, skip blocks at random, or widen the residual stream into several streams that mix? All of these have been tried, some with real gains. Together they teach one lesson twice, ten years apart: whatever else a connection does, it must leave an identity path intact.
What you’ll learn
- Write the highway layer and its gates, explain why the gates start biased toward carrying, and recognize the same structure in the GRU.
- Use He et al.'s ablations and a product-of-gates estimate to explain why gated, scaled, convolutional and dropped-out shortcuts train worse than the identity, and why a gate's initial bias must be at most about .
- Compare concatenation (DenseNet) and learned depth averaging (DenseFormer) with addition, and analyze stochastic depth, LayerDrop and mixture-of-depths as ways of skipping blocks.
- Describe hyper-connections, explain why unconstrained mixing of residual streams becomes unstable at scale, and prove the properties of doubly stochastic mixing that restore an identity path.
Highways with gates
Months before ResNets, Srivastava, Greff and Schmidhuber (2015) trained feedforward networks hundreds of layers deep by borrowing the gating of LSTMs. A highway layer mixes a transformation of its input with the input itself, through a learned gate :
Because never reaches , the identity is approached but never reached. Srivastava et al. therefore initialized the gate biases to negative values, so that every layer starts out mostly carrying its input, following the earlier practice of biasing LSTM gates to bridge long time lags early in learning. They suggested , and for convolutional highway networks about 10, 20 and 30 layers deep. Plain networks became much harder to optimize as they deepened, while highway networks of up to 100 layers trained well, and in pilot experiments optimization did not stall even beyond 1,000 layers.
The same form in time. A GRU updates its state as : a highway layer applied once per time step, with the update gate as the carry gate and the weights shared across steps. Raising the bias of does what a negative does in a highway network: it makes carrying the default.
Trained highway networks used their gates selectively. In a 50-layer network trained on MNIST, closing the gates of any one of layers 15 to 45 barely changed performance: about 60% of the layers had learned to do nothing. On CIFAR-100, removing any of roughly the first 40 layers hurt noticeably. The gates also routed different inputs and classes through different layers, so the gating was part of the computation, not only an aid to training.
Why the plain identity won
If a learned gate can always open fully, a gated shortcut should be at least as good as a fixed identity. He, Zhang, Ren and Sun (2016) tested this in "Identity mappings in deep residual networks", replacing the identity shortcut of every residual unit of a 110-layer ResNet (54 residual units) on CIFAR-10 and changing nothing else:
| Shortcut | Shortcut multiplied by | Branch multiplied by | Test error |
|---|---|---|---|
| Identity (baseline) | 6.61% | ||
| Constant scaling | fail | ||
| Constant scaling | 12.35% | ||
| Exclusive (highway-style) gating, to | fail | ||
| Exclusive gating, ; | 8.70%; 9.81% | ||
| Shortcut-only gating, ; | 12.86%; 6.91% | ||
| convolution | a convolution | 12.22% | |
| Dropout on the shortcut (ratio 0.5) | a random mask | fail |
Give block a shortcut factor , which may be a constant, a gate value or a random mask: . Unrolling from block to the top multiplies the factors along the direct path:
The gradient's direct term carries the same product, which shrinks or grows exponentially with depth unless every :
For a gate at initialization, when , so over units the direct path keeps . It survives only if , that is . With 54 units, :
The estimate treats each gate as the constant , ignoring its input-dependent part, and gives only a necessary condition. The table respects it: exclusive gating failed for every bias from to (although at the direct path would already keep ) and worked best at , and shortcut-only gating improved from 12.86% to 6.91% when the bias went from to . The highway guideline of , , for depths of 10, 20 and 30 points the same way but is milder than (, , ), and Srivastava et al. treated the bias as a hyperparameter to tune. Note also what exclusive gating does to the branch at : it multiplies by , a strongly shrunk branch (Scaling Residual Branches with Depth).
Shortcut-only gating and convolutions contain the identity as a special case, so they are at least as expressive, yet they reached higher training error: as with the degradation problem, the failure is one of optimization, not capacity. Dropout on the shortcut imposes a random scale with mean 0.5 and failed like constant scaling. He et al.'s conclusion was to keep the shortcut free of multiplicative manipulations of any kind (scaling, gating, convolutions, dropout). The rule carried over to transformers as pre-LN, and, as the last step shows, it had to be rediscovered for learned multi-stream residuals.
In a 110-layer ResNet with 54 residual units, gating only the shortcut, , gave 12.86% test error with gate bias and 6.91% with . What is the best explanation?
- With each shortcut passes about half of its input, so at initialization the direct path is multiplied by about ; with it keeps about
- The bias gives the network more parameters to fit the data
- With the residual branches are switched off
- The bias makes the gates sparse, which regularizes the network and lowers the test error
Show the answer
A. With each shortcut passes about half of its input, so at initialization the direct path is multiplied by about ; with it keeps about
The direct path is a product of 54 gate values, . At it is astronomically small, so gradients must squeeze through the branches as in a plain network; at almost the whole identity survives, and the result is close to the 6.61% of the plain identity.
Concatenate, average or skip
Concatenate. Where ResNet adds, keeping the width fixed and the identity free, DenseNet (Huang, Liu, van der Maaten & Weinberger, 2017) concatenates: within a dense block, layer receives , so every earlier feature map reaches every later layer untouched, and every layer receives gradient directly from all the layers after it. CNN Architectures: LeNet to ConvNeXt covers the growth rate and the transition layers. The price is memory: implemented naively, the concatenations and normalizations copy feature maps until the stored activations grow quadratically with depth. With shared memory allocations Pleiss et al. (2017) brought this down to linear, enough to train a 264-layer DenseNet of 73 million parameters on one workstation with eight GPUs.
Average, with learned weights. DenseFormer (Pagliardini, Mohtashami, Fleuret & Jaggi, 2024) brings the idea to transformers without widening anything. After block , a depth-weighted average replaces the stream by a learned combination of the embedding and all block outputs so far, , and the next block reads . Initialized with and all other weights , it starts as a standard transformer and adds only scalars for blocks. On OpenWebText2 a 48-block DenseFormer reached the perplexity of a 72-block transformer, and a sparser variant (each average over every fourth earlier output, placed after every fifth block) matched it while running 1.4 times faster at inference. The learned weights showed the same pattern of reuse of distant layers across random seeds.
Skip at random. Stochastic depth (Huang, Sun, Liu, Sedra & Weinberger, 2016) drops whole residual branches during training. For each mini-batch, block computes with , so a dropped block is the identity. The survival probability decays linearly with depth, with , on the intuition that early layers extract low-level features that later layers rely on. At test time every block runs, its branch scaled by . Training a different, shallower network on every mini-batch cut the CIFAR-10 test error of a 110-layer ResNet from 6.41% to 5.25%, and let a 1,202-layer ResNet improve further to 4.91% where its constant-depth version reached 6.67%, while the skipped blocks saved about a quarter of the training time.
A ResNet with residual blocks is trained with stochastic depth, using the linear rule with . On average, how many blocks are active in a training step?
Show the answer
40.25 blocks
. Training uses about three quarters of the blocks on average, which is where the time saving comes from, while the test-time network has all 54.
Transformers took up skipping twice. LayerDrop (Fan, Grave & Joulin, 2020) drops whole transformer layers during training and, as a bonus, lets a trained model be cut to a smaller depth at inference without fine-tuning. Mixture-of-depths (Raposo et al., 2024) makes skipping a learned decision per token: at a block, a router scores every token, and only the top , as few as 12.5% of the sequence at every other block, pass through attention and the MLP, while the rest ride the residual stream unchanged. The block's output is multiplied by the router's weight, which keeps the router on the gradient path. Matched for training FLOPs, these models equaled the baseline while needing a fraction of its FLOPs per forward pass, and could be more than 50% faster to step when sampling. Choosing the top of a sequence looks at future tokens, so for sampling Raposo et al. either train the router with an auxiliary loss or add a small predictor of the routing decision, so that the choice depends only on past tokens. All three methods work only because a skipped block passes its input through unchanged.
Learned multi-stream residuals
Every connection so far keeps a single residual stream. Hyper-connections (Zhu et al., 2025) widen it into streams, the rows of : the input is copied times at the bottom and the streams are summed at the top. Each layer reads a learned combination of the streams, writes its output back to every stream with learned weights, and mixes the streams with a learned matrix:
Zhu et al. motivate the design as an escape from a seesaw: post-LN suffers vanishing gradients, while pre-LN suffers representation collapse, deep layers whose inputs are nearly identical to their neighbors'. In OLMo-1B models, adjacent layers' inputs were less similar with hyper-connections than with pre-LN, and in the mixture-of-experts model OLMoE-1B-7B, dynamic hyper-connections with converged 1.8 times faster and scored 6 points higher on ARC-Challenge after 500 billion tokens. A single stream, , did not help.
But look at the direct path. Unrolled, contains : learned matrices take the place of the identity, exactly like the scaled and gated shortcuts of the previous step. Unconstrained, their product drifts away from the identity, and signals along the streams can be amplified or attenuated without bound. Xie et al. (2026) saw this in a 27-billion-parameter model: the composite map's largest row or column sum, a worst-case gain, peaked near 3,000, and training with hyper-connections showed a loss surge around step 12,000 that tracked a surge in the gradient norm. Their fix, manifold-constrained hyper-connections (mHC), projects every onto the doubly stochastic matrices with the Sinkhorn–Knopp algorithm and keeps the read and write weights nonnegative, for 6.7% extra training time at .
The largest absolute column sum is and the largest absolute row sum is . For any matrix, , since no eigenvalue exceeds an induced norm:
Products keep all three defining properties. Entries of are sums of products of nonnegative numbers, and
So the composite map along the residual path is doubly stochastic at every depth. It cannot amplify anything, and on the component the streams share it is exactly the identity; mixing can only shuffle and average the streams toward one another:
import torch
def sinkhorn(logits: torch.Tensor, iters: int = 30) -> torch.Tensor:
"""Sinkhorn-Knopp: map an n×n matrix of logits to a (nearly) doubly stochastic matrix."""
M = logits.exp()
for _ in range(iters):
M = M / M.sum(dim=1, keepdim=True) # rows sum to 1
M = M / M.sum(dim=0, keepdim=True) # columns sum to 1
return M
torch.manual_seed(0)
n, L = 4, 60 # 4 residual streams, 60 layers
mixes = [sinkhorn(torch.randn(n, n)) for _ in range(L)]
P = torch.linalg.multi_dot(mixes) # composite map along the residual path
print(torch.linalg.matrix_norm(mixes[0], ord=2)) # at most 1, up to the iteration's tolerance
print(P.sum(dim=0), P.sum(dim=1)) # all close to 1: still doubly stochastic
free = [torch.eye(n) + 0.3 * torch.randn(n, n) for _ in range(L)] # unconstrained mixing
print(torch.linalg.matrix_norm(torch.linalg.multi_dot(free), ord=2)) # drifts far from 1Alternately normalizing rows and columns drives a positive matrix to a doubly stochastic one (Sinkhorn & Knopp, 1967); thirty rounds suffice here. The product of 60 such matrices stays doubly stochastic. The product of 60 unconstrained perturbations of the identity ( plus Gaussian noise of standard deviation ) has a spectral norm of about 1,000 at this seed, and anywhere from about 20 to about 15,000 over twenty seeds: the scaled-shortcut problem again, in matrix form.
Key takeaways
- A highway layer mixes a transformation with its carried input through sigmoid gates that start biased toward carrying; the GRU has the same form in time, with weights shared across steps.
- Any factor on the shortcut (a constant, a gate, a convolution, dropout) is multiplied along the path, ; in He et al.'s 110-layer ablations every such variant trained worse than the identity despite equal or greater expressive power, and a gate's initial bias must be at most about for the carry path to survive.
- DenseNet concatenates earlier feature maps and DenseFormer averages earlier block outputs with learned weights that start at the identity; stochastic depth, LayerDrop and mixture-of-depths skip blocks, which works only because the shortcut keeps a skipped block's output equal to its input.
- Hyper-connections widen the residual stream into learned, mixing streams. Unconstrained mixing compounds like a scaled shortcut; doubly stochastic mixing (mHC) has norm at most , is closed under products and keeps an exact identity on the streams' shared part.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why did Srivastava, Greff and Schmidhuber initialize the transform-gate biases of highway networks to negative values?
- So that every gate starts fully open and every layer transforms its input
- So that each layer starts out mostly carrying its input, giving signals and gradients a nearly identity path through a deep stack, as biased gates do in LSTMs
- To keep the layer outputs nonnegative
- To make the sigmoid cheaper to compute
Show the answer
B. So that each layer starts out mostly carrying its input, giving signals and gradients a nearly identity path through a deep stack, as biased gates do in LSTMs
A negative bias makes small, so at the start. Training then opens the gates where transformation helps; the deeper the network, the more negative the bias needs to be.
In He et al.'s ablations on a 110-layer ResNet, a -convolution shortcut and a gated shortcut, both able to represent the identity, reached higher training error than the plain identity shortcut. What does this show?
- The extra parameters made the networks overfit
- convolutions are less expressive than the identity
- The obstacle is optimization: any multiplicative operation on the shortcut compounds along the path and impedes signal propagation, even when the identity is reachable in principle
- Gating is incompatible with batch normalization
Show the answer
C. The obstacle is optimization: any multiplicative operation on the shortcut compounds along the path and impedes signal propagation, even when the identity is reachable in principle
Higher training error rules out overfitting, and containing the identity rules out a capacity gap. What remains is the product of shortcut factors along the direct path, which the optimizer must first undo.
With stochastic depth, residual block is kept with probability during training, and every block runs at test time. What do Huang et al. do to each branch at test time?
- Multiply it by
- Keep only the blocks with
- Leave it unchanged, since the shortcut already keeps the scale fixed
- Multiply it by , so its contribution matches its average contribution during training
Show the answer
D. Multiply it by , so its contribution matches its average contribution during training
During training the next layers saw block 's branch only a fraction of the time, so at test time it enters as . Read as an ensemble, this averages all subnetworks into one, each layer weighted by its survival probability.
Hyper-connections mix residual streams with a learned matrix at every layer, so the direct path from layer to the top is multiplied by . Why does constraining every to be doubly stochastic, as mHC does, stabilize deep models?
- Doubly stochastic matrices have spectral norm at most and are closed under multiplication, so the composite map stays doubly stochastic at any depth, and the part of the streams they all share passes through it unchanged
- Doubly stochastic matrices are orthogonal, so they preserve every norm exactly
- The constraint forces , which removes the mixing
- The constraint makes the matrices sparse, which cuts memory traffic
Show the answer
A. Doubly stochastic matrices have spectral norm at most and are closed under multiplication, so the composite map stays doubly stochastic at any depth, and the part of the streams they all share passes through it unchanged
, products stay nonnegative with unit row and column sums, and means equal streams are left as they are. The composite map can shuffle and average the streams but neither amplify them nor wipe out their common part.
Further reading
- R. K. Srivastava, K. Greff & J. Schmidhuber, "Training very deep networks," NeurIPS (2015).
- K. He, X. Zhang, S. Ren & J. Sun, "Identity mappings in deep residual networks," ECCV (2016).
- G. Huang, Y. Sun, Z. Liu, D. Sedra & K. Q. Weinberger, "Deep networks with stochastic depth," ECCV (2016).
- D. Zhu, H. Huang, Z. Huang, Y. Zeng, Y. Mao, B. Wu, Q. Min & X. Zhou, "Hyper-connections," ICLR (2025).
- Z. Xie et al., "mHC: Manifold-constrained hyper-connections," ICML (2026); arXiv:2512.24880.