Scaling Residual Branches with Depth
How residual branches should shrink as networks deepen, and which scaling lets hyperparameters transfer.
Make a residual network ten times deeper and something has to give: either every branch shrinks, or the stream's variance explodes. How fast the branches shrink, like or like , decides what an infinitely deep network becomes (a stochastic or an ordinary differential equation), and whether the learning rate tuned on a shallow model still works on a deep one. The theory is clean; which scaling suits transformers is still argued.
What you’ll learn
- Show that with i.i.d. initialization a branch multiplier makes the stream explode for , collapse to the identity for , and stay non-degenerate only at , and state the Stable ResNet gradient bound.
- Explain why leads to a stochastic differential equation and to an ordinary one, and what each limit demands of the weights.
- Analyze zero-initialized gates (ReZero), layer scales and DeepNet's up-weighted shortcut, and derive why pre-LN acts as an implicit branch scale with polynomially growing gradients.
- Compare Depth-μP and CompleteP as recipes for transferring hyperparameters across depth, and say what the evidence for each does and does not show.
Three regimes for one multiplier
From Residual Connections: at initialization the branch is uncorrelated with the stream, so mean squares add. If an unscaled branch would add a fraction of the stream's mean square , the multiplier adds :
The exponent sorts every choice into three regimes. For the log grows without bound: explosion. For it tends to : the branches become negligible and the network tends to the identity. Only leaves a finite, non-trivial change:
This is an average. The theorem below shows that the typical network behaves the same way, and that at the random fluctuations around the average do not die out.
A residual network has 100 blocks, and each unscaled branch would add as much variance as the stream already has (), multiplying it by . Every branch is now multiplied by . By what factor does the variance grow over the 100 blocks?
Show the answer
2.7 ×
Each block now multiplies the variance by , and , essentially with . Doubling the depth to 200 with the matching scale gives : the rule makes the growth independent of depth.
Two continuum limits: noise or drift
Read the layer index as time, , with step . What an infinitely deep network becomes depends on whether the branches add up like noise or like drift.
with i.i.d. weights. Given , the increment has mean zero, a covariance of order , and is independent of the earlier increments, exactly like the increment of a Brownian motion over a time step :
The stream becomes a diffusion, the solution of a stochastic differential equation (Peluchetti & Favaro, 2020; Marion et al., 2022). Its paths are rough: two neighboring layers are independent random maps.
with smoothly varying weights. If the block parameters are samples of a smooth function of depth, , then each block is one forward-Euler step, and the network converges to a neural ODE (Chen, Rubanova, Bettencourt & Duvenaud, 2018):
with i.i.d. weights gives neither. The increments are independent with mean zero and size , so their sum has standard deviation of order : by the law of large numbers the network tends to the identity, the case above. An ODE needs coherent drift, which i.i.d. initialization does not provide.
So the popular reading of ResNets as discretized ODEs holds only under conditions: a scale and weights that vary smoothly from layer to layer. Marion et al. found experimentally that the branch scale and the regularity of the weights in depth jointly select among a continuum of regimes, before and after training. Sander, Ablin and Peyré (2022) proved that for residual networks with linear residual functions and a small enough initial loss, gradient descent preserves smoothness in depth, giving an implicit pull toward a limiting neural ODE at rate in the depth ; with residual functions that are not smooth in depth, the distance to the ODE does not shrink as depth grows.
Gates, layer scales and normalization
The simplest way to shrink a branch is to let training decide how much of it to use. ReZero (Bachlechner, Majumder, Mao, Cottrell & McAuley, 2021) multiplies every branch by a learnable scalar that starts at zero, with . The network is then the identity at initialization, which trivially has dynamical isometry. The authors trained fully connected networks of 10,000 layers and transformers of more than 100 layers without learning-rate warmup, LayerNorm or auxiliary losses, and a 12-layer transformer converged 56% faster on enwik8.
Take single-unit layers that share one weight and one gate : . Both gradients carry the factor :
With the gate fixed at , an ordinary residual network, the factor explodes for and vanishes near ; starting near , gradient descent needs a learning rate that shrinks exponentially with . Even gives at depth 100.
At the factor is exactly . The first step moves only the gate, since the gradient in carries the factor . For a well-conditioned loss, Bachlechner et al. argue, that step takes the gate to a value that keeps near , so training starts in a well-conditioned region and needs a learning rate that shrinks only polynomially with .
In a ReZero network every gate starts at and the branch weights are random. Which parameters receive a nonzero gradient at the first step?
- All of them, as in any network
- None: with every gate at zero, the network is the identity and the loss has no gradient
- Only the branch weights, since a gate is just a constant multiplier
- Only the gates: each branch weight's gradient carries the factor , while is nonzero
Show the answer
D. Only the gates: each branch weight's gradient carries the factor , while is nonzero
The branch output is a nonzero random vector, so the gate gets a gradient; the branch weights only influence the loss through . Once the gates are nonzero, the branch weights start learning. Compare a zero-initialized last layer, where that last layer learns first.
| Scheme | Block | At initialization | Used in |
|---|---|---|---|
| Zero last layer or zero BN scale | , last layer of (or its ) set to | exact identity | ResNets (Goyal et al., 2017) |
| ReZero | , scalar , learned | exact identity | deep MLPs and transformers without normalization |
| LayerScale | , learned per channel, with up to depth 18, at 24, beyond | near identity | CaiT image transformers (Touvron et al., 2021) |
| initialization | weights of the residual layers scaled by | branches of relative size about | GPT-2 (Radford et al., 2019) |
| DeepNorm | with , some branch weights initialized with gain , for an -layer decoder | shortcut up-weighted inside post-LN | DeepNet, 1,000 layers (Wang et al., 2022) |
In a pre-LN block the branch reads a unit-variance input, so it adds a fixed mean square while the stream holds . Relative to the stream, block carries an effective multiplier with
The sum diverges, but only logarithmically: between Stable ResNet's bounded sum and the unscaled network's sum of order . Backward, LayerNorm divides the incoming gradient by the stream's RMS , so for a branch at gain each block adds a fraction to the gradient's mean square, with , (a mean-field estimate that treats the weights as independent of the gradient):
So the gradient's RMS grows like a power of depth, , rather than exponentially. For tanh at gain , and , an exponent of about : multiplying out the product predicts about ×4.8 at depth 50 and ×7.2 at depth 100, and the
signalpropwidget with residual connections and LayerNorm both on measures ×4.85 and ×7.11. The same growth of means the deepest blocks of a pre-LN network start, and can stay, close to the identity (Normalization & Stability in Transformers; Reading the Residual Stream).
Which scaling transfers hyperparameters?
Width has a recipe for hyperparameter transfer: under μP the best learning rate found on a narrow model stays nearly optimal on a wide one (μP & Hyperparameter Transfer). Depth needs its own rule, and a multiplier that tames the initialization is not enough: the learning rate must scale too, or the updates grow with depth.
| Multiplier , updates | Behavior as |
|---|---|
| features explode at initialization | |
| training updates explode | |
| training changes nothing in the limit (trivial) | |
| , | hidden activations explode during training |
| , | stable but redundant: neighboring layers compute nearly the same thing, as in a neural ODE, with no feature diversity |
| Depth-μP: stable, with feature learning and feature diversity |
For one-layer blocks they found the learning rate transferred across depth in practice, plus a surprise: among homogeneous nonlinearities, the absolute value maximizes feature diversity and trained better. For blocks of two or more layers, which includes every transformer block, they showed that all infinite-depth limits in this family have fundamental limitations. In Megatron transformers trained on Common Crawl, seemed to transfer the learning rate by the end of training, but deeper models did worse early in training, in the middle of training the optimal learning rate stayed roughly the same at every depth instead of shrinking like , and performance hardly depended on ; they judged the scaling likely to be brittle. Bordelon, Noci, Li, Hanin and Pehlevan (2024) were more positive about the same branch scale combined with μP: convolutional ResNets and vision transformers showed transfer across width and depth on CIFAR-10 and ImageNet, backed by a dynamical mean-field theory of the joint limit.
Take a block of depth two in a scalar toy model where only depth grows, . Stable, maximal training needs updates . Expand the change of caused by updating its own block:
The ratio of the nonlinear to the linear part is . For any it vanishes as depth grows, and each block becomes lazy, effectively linear in its own parameters; at and it is already 10 times smaller. Only keeps every block nonlinear in its parameters, which Dey et al. call complete feature learning, hence the name CompleteP.
With the multiplier plus depth rules for the LayerNorm and bias learning rates, weight decay and AdamW's , Dey et al. trained pre-LN transformers from 2 to 128 layers: only kept the optimal learning rate and initialization scale fixed across depth (μP and did not). At 1.5 billion non-embedding parameters, CompleteP needed 11.8% fewer FLOPs than μP at the compute-optimal shape and 34.4% fewer for a 179-layer model. In Yang et al.'s table, with Adam learning rates that do not shrink with depth is the ODE-like corner , predicted to lack feature diversity for one-layer blocks; Dey et al. argue that for the multi-layer blocks of real transformers, laziness within a block is what matters.
Key takeaways
- With i.i.d. initialization a branch multiplier makes the stream explode for , collapse to the identity for , and stay non-degenerate only at (Marion et al.); gradients stay bounded at infinite width exactly when does (Stable ResNet).
- branches add like noise and lead to a stochastic differential equation; leads to a neural ODE only when the weights vary smoothly with depth, and to the identity otherwise.
- Zero-initialized gates (ReZero), small layer scales and initialization start every block near the identity; DeepNet up-weights the shortcut inside post-LN instead; pre-LN acts as an implicit scale, so its gradients grow only polynomially with depth.
- Depth-μP (, Adam learning rate ) and CompleteP () are competing recipes for transferring hyperparameters across depth; as of the mid-2020s which one fits real transformers best is an open question.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Residual branches carry the multiplier and the weights are i.i.d. at a standard scale. What happens to as ?
- It explodes for and collapses to for
- It stays non-degenerate for every , since the shortcut always carries the signal
- It explodes for , collapses to the identity for , and has non-vanishing random fluctuations only at
- It converges to the solution of an ODE for every
Show the answer
C. It explodes for , collapses to the identity for , and has non-vanishing random fluctuations only at
The log of the variance ratio behaves like : unbounded below , vanishing above. Marion et al. proved the same trichotomy for the typical network, not just the average.
Why does a branch scale with i.i.d. random weights not make a deep ResNet behave like a neural ODE at initialization?
- Because is too large and the stream explodes
- Because the independent, zero-mean increments of size add up to only , so the network tends to the identity; an ODE needs increments that vary smoothly from layer to layer
- Because ODE solvers need adaptive step sizes
- Because a neural ODE has no trainable parameters
Show the answer
B. Because the independent, zero-mean increments of size add up to only , so the network tends to the identity; an ODE needs increments that vary smoothly from layer to layer
Independent increments cancel like a random walk: steps of size travel only about . Coherent drift needs weights that are close for neighboring layers.
A residual network with one-layer blocks follows Depth-μP and is trained with Adam. You make it 4 times deeper, keeping the branch multiplier. What should happen to the hidden layers' learning rate?
- Keep it the same: the multiplier already accounts for depth
- Divide it by 4
- Halve it, since Depth-μP sets Adam's learning rate to
- Double it, to make up for the smaller branches
Show the answer
C. Halve it, since Depth-μP sets Adam's learning rate to
Depth-μP requires every weight update to be of order . Adam normalizes away the gradient's scale, so the learning rate itself must carry the factor: . With SGD the multiplier already shrinks the gradient by , so the learning rate stays constant.
What is the disagreement between Depth-μP (Yang et al., 2024) and CompleteP (Dey et al., 2025)?
- Depth-μP scales branches by , optimal for one-layer blocks because it maximizes feature diversity; CompleteP scales by , arguing that only this keeps multi-layer blocks such as transformer blocks from becoming lazy, and reports better depth transfer in pre-LN transformers
- They agree on and differ only in how the width is scaled
- Depth-μP uses and CompleteP uses
- CompleteP removes the residual connections and Depth-μP keeps them
Show the answer
A. Depth-μP scales branches by , optimal for one-layer blocks because it maximizes feature diversity; CompleteP scales by , arguing that only this keeps multi-layer blocks such as transformer blocks from becoming lazy, and reports better depth transfer in pre-LN transformers
Both scale branches and learning rates together with . Yang et al. single out for one-layer blocks and found every option limited for deeper blocks; Dey et al. show that for blocks of two or more layers, any makes each block linear in its own parameters as , and measured transfer from 2 to 128 layers with . Which idealization predicts large models best is open.
Further reading
- S. Hayou, E. Clerico, B. He, G. Deligiannidis, A. Doucet & J. Rousseau, "Stable ResNet," AISTATS (2021).
- P. Marion, A. Fermanian, G. Biau & J.-P. Vert, "Scaling ResNets in the large-depth regime," arXiv:2206.06929 (2022; accepted to JMLR).
- T. Bachlechner, B. P. Majumder, H. H. Mao, G. W. Cottrell & J. McAuley, "ReZero is all you need: Fast convergence at large depth," UAI (2021).
- G. Yang, D. Yu, C. Zhu & S. Hayou, "Tensor Programs VI: Feature learning in infinite-depth neural networks," ICLR (2024).
- N. Dey, B. C. Zhang, L. Noci, M. Li, B. Bordelon, S. Bergsma, C. Pehlevan, B. Hanin & J. Hestness, "Don't be lazy: CompleteP enables compute-efficient deep transformers," NeurIPS (2025).