# µP, Momentum & Weight Decay Predictions | Stanford CS312 Quiz Review with Tatsunori Hashimoto

## Executive summary

This review analyzes advanced deep learning optimization techniques, focusing on the interplay between learning rate (LR) and weight decay (WD). Key topics include comparing $\mu P$ and CompleteP methods, determining the sensitivity of momentum across different batch sizes, and analyzing the scaling behavior of Hyperball. The lecture emphasizes that the loss is minimized when the product of LR and WD is constant, and provides rules of thumb for predicting optimization penalties.

## Key takeaways

- LR and WD Tradeoff Penalty: Loss is lowest along the diagonal where LR times WD is constant. Deviations from this diagonal result in a penalty that is roughly quadratic, estimated by taking the log of the distance, squaring it, and multiplying by approximately 0.01.
- Momentum Sensitivity by Batch Size: At small batch sizes (e.g., 8), loss is fairly insensitive to momentum. However, at large batch sizes (e.g., 256), removing momentum can lead to a 'catastrophic' loss increase (e.g., 0.25).
- Scaling Weight Decay vs. Learning Rate: For large batch sizes, scaling weight decay is often the preferable option compared to scaling the learning rate, as the optimal weight decay can continue to increase with larger batch sizes.

## Technical details

- CompleteP vs. $\mu P$ Behavior: When comparing standard and depth $\mu P$ methods, CompleteP was observed to give the lowest loss after five steps, particularly when dealing with shared parameter blocks, as it corrects for the case where everything is aligned (perfect correlation).
- Hyperball Learning Rate Scaling: Hyperball normalizes updates to the weight's Frobenius norm, which acts like a $1/\sqrt{width}$ step size. Seeded runs showed exponents for optimal learning rate scaling between -0.38 and -0.55.
- Readout Impact: In certain models, the readout contribution is a very small factor relative to the rest of the network, leading the optimal learning rate ratio between different widths to be close to one (constant).

## Practical implications

- When tuning hyperparameters, prioritize keeping the product of Learning Rate and Weight Decay constant to maintain low loss.
- Use momentum carefully; its necessity increases significantly as batch size increases.
- When scaling models, consider the specific normalization method (e.g., Hyperball) to predict the correct learning rate scaling factor.

## Topics

Deep Learning, Optimization, Learning Rate, Weight Decay, Momentum, Batch Size Scaling, AI, Stanford Online

Source: https://www.youtube.com/watch?v=hpkd9OYyrXU
