Depthwise Hyperparameter Transfer in Residual Networks: Dynamics and Scaling Limit

Blake Bordelon, Lorenzo Noci, Mufan Bill Li, Boris Hanin, Cengiz Pehlevan

Hyperparameter tuning is the "hidden tax" of deep learning. As models grow to billions or trillions of parameters, finding the optimal learning rate via trial and error becomes prohibitively expensive. While recent breakthroughs like the Maximal Update Parameterization ($\mu$P) allow practitioners to find optimal settings on a narrow "proxy" model and transfer them to a wide one, a major hurdle has remained: depth. If you change the number of layers, the old rules of thumb often break.

A new paper from researchers at Harvard, ETH Zürich, and Princeton proposes a solution. By combining $\mu$P with a specific scaling rule for residual branches, they demonstrate that hyperparameters can finally transfer across both width and depth simultaneously.

TL;DR

The authors introduce a parameterization for Residual Networks (ResNets) and Vision Transformers (ViTs) that enables "depthwise" hyperparameter transfer. By scaling residual branches by $1/\sqrt{\text{depth}}$, they ensure that the optimal learning rate for a small, shallow model remains optimal for a massive, deep one. This empirical success is backed by a rigorous theoretical "infinite-depth-and-width" limit.

What Problem Does This Paper Address?

In the current era of "Scaling Laws," we know that bigger is usually better. However, a model's performance is highly sensitive to hyperparameters like learning rate, momentum, and weight decay.

Standard ResNet with μP

The $\mu$P framework was a game-changer because it showed that if you scale weights and learning rates correctly, the optimal learning rate doesn't change as you make the model wider. But $\mu$P doesn't account for depth. In standard ResNets, if you double the number of layers, the signal dynamics change. As seen in the figure above, this causes the optimal learning rate to shift, often requiring a completely different learning rate to avoid divergence or slow training. This forces practitioners to re-tune every time they increase model depth, wasting massive amounts of compute.

Methods

The researchers propose a simple but powerful modification to the residual architecture. The core idea is the $1/\sqrt{L}$-residual scaling, where $L$ is the depth (number of residual blocks).

  1. Residual Branch Scaling: They scale the output of each residual branch by $1/\sqrt{L}$.
  2. $\mu$P Integration: They combine this with $\mu$P's width-scaling rules (e.g., scaling the output layer by $1/\sqrt{\text{width}}$ and adjusting learning rates by width).
  3. Theoretical Backbone: To prove this isn't just a lucky empirical find, they use Dynamical Mean Field Theory (DMFT). They show that as width ($N$) and depth ($L$) both go to infinity, the network's learning dynamics converge to a well-defined "scaling limit." In this limit, the way features evolve during training becomes independent of the model's size.

Key Insights and Ideas

  • The $1/\sqrt{L}$ "Magic": This specific scaling factor ensures that the "total" update to the hidden states across all layers remains stable. Without it, the signal either explodes or vanishes as depth increases.
  • Beyond Width: While $\mu$P solved the "horizontal" scaling problem, this work completes the picture "vertically." The result is a 2D grid where the optimal hyperparameter "peak" stays in the same spot regardless of the model's shape.
  • Normalization isn't enough: While BatchNorm or LayerNorm can help stabilize deep models, they don't inherently guarantee hyperparameter transfer. The authors show that their $1/\sqrt{L}$ scaling provides much more consistent transfer than normalization alone.
  • Feature Learning vs. Lazy Training: Unlike some theories that only work when the model doesn't change much (the "kernel" or "lazy" regime), this framework specifically accounts for feature learning, where the model's internal representations evolve significantly.

Key Results

Proposed 1/√L-ResNet with μP
  • Perfect Alignment: As shown in the figure above, applying the proposed $1/\sqrt{L}$ scaling causes the "loss vs. learning rate" curves for different depths and widths to align almost perfectly. They all share the exact same optimal learning rate ($\eta^*$).
  • Universal Transfer: The authors successfully demonstrated transfer for not just learning rates, but also momentum coefficients and weight decay strengths.
  • ViT Success: The method isn't limited to CNNs; Vision Transformers trained with Adam also showed excellent depthwise transfer on Tiny ImageNet and ImageNet.
  • Convergence Rates: Theoretically and empirically, they found that finite-size models converge to the infinite-depth limit at a rate of $O(1/L)$.

Limitations and Future Work

  • Epoch Constraints: Due to computational limits, most experiments were capped at 10–20 epochs. It remains to be seen if the transfer holds perfectly for massive models trained for hundreds of epochs, though early dynamics are usually highly predictive.
  • Dataset Scaling: The study treats the dataset size as fixed. A promising future direction is combining this depthwise transfer with "Chinchilla-style" scaling laws, which dictate how dataset size should grow alongside model parameters.
  • Theoretical Rigor: The authors note their theoretical results are at the "level of rigor of physics" (using DMFT) rather than a formal epsilon-delta mathematical proof, leaving a gap for pure mathematicians to fill.

By providing a recipe to tune once and scale infinitely in any direction, this work brings us one step closer to a "set it and forget it" era of deep learning architecture design.

Summary updated

BibTeX
@inproceedings{bordelon2024depthwise,
  author = {Blake Bordelon and Lorenzo Noci and Mufan Bill Li and Boris Hanin and Cengiz Pehlevan},
  title = {{Depthwise Hyperparameter Transfer in Residual Networks: Dynamics and Scaling Limit}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=KZJehvRKGD},
}
Figure