Extending P: Spectral Conditions for Feature Learning Across Optimizers
Organizations: Purdue University · Argonne National Laboratory
Abstract
Several variations of adaptive first-order and second-order optimization methods have been proposed to accelerate and scale the training of large language models. The performance of these optimization routines is highly sensitive to the choice of hyperparameters (HPs), which are computationally expensive to tune for large-scale models. Maximal update parameterization P is a set of scaling rules which aims to make the optimal HPs independent of the model size, thereby allowing the HPs tuned on a smaller (computationally cheaper) model to be transferred to train a larger, target model. Despite promising results for SGD and Adam, deriving P for other optimizers is challenging because the underlying tensor programming approach is difficult to grasp. Building on recent work that introduced spectral conditions as an alternative to tensor programs, we propose a novel framework to derive P for a broader class of optimizers, including AdamW, ADOPT, LAMB, Sophia, Shampoo and Muon. We implement our P derivations on multiple benchmark models and demonstrate zero-shot learning rate transfer across increasing model width for the above optimizers. Further, we provide empirical insights into depth-scaling parameterization for these optimizers.
Figures & tables
| Optimizer | |
|---|---|
| AdamW / ADOPT | |
| Sophia | |
| LAMB | |
| Shampoo | |
| Muon |
| Input Weights | Output Weights | Hidden Weights | |
|---|---|---|---|
| Init. Var. | 1\;\color[rgb]{1,0,0}{(\tfrac{1}{n_{l-1}})} | 1\;\color[rgb]{1,0,0}{(\tfrac{1}{n^{2}_{l-1}})} | 1\;\color[rgb]{1,0,0}{(\tfrac{1}{n_{l-1}})} |
| Multiplier | \tfrac{1}{\sqrt{n_{l-1}}}\;\color[rgb]{1,0,0}{(1)} | \tfrac{1}{n_{l-1}}\;\color[rgb]{1,0,0}{(1)} | \tfrac{1}{\sqrt{n_{l-1}}}\;\color[rgb]{1,0,0}{(1)} |
| AdamW / ADOPT | 1\;\color[rgb]{1,0,0}{(1)} | \tfrac{1}{n_{l-1}}\;\color[rgb]{1,0,0}{(\tfrac{1}{n_{l-1}})} | \tfrac{1}{n_{l-1}}\;\color[rgb]{1,0,0}{(\tfrac{1}{n_{l-1}})} |
| Sophia LR | 1\;\color[rgb]{1,0,0}{(-)} | \tfrac{1}{n_{l-1}}\;\color[rgb]{1,0,0}{(-)} | \tfrac{1}{n_{l-1}}\;\color[rgb]{1,0,0}{(-)} |
| LAMB LR | 1\;\color[rgb]{1,0,0}{(-)} | 1\;\color[rgb]{1,0,0}{(-)} | 1\;\color[rgb]{1,0,0}{(-)} |
| Shampoo LR | \sqrt{n_{l}}\;\color[rgb]{1,0,0}{(-)} | \tfrac{1}{\sqrt{n_{l-1}}}\;\color[rgb]{1,0,0}{(-)} | \sqrt{\tfrac{n_{l}}{n_{l-1}}}\;\color[rgb]{1,0,0}{(-)} |
Appendix figures & tables30 assets
Supplementary material from the paper’s appendix.
Appendix
| Architecture | NanoGPT Karpathy (2022) |
|---|---|
| Width | 128 (scaled to 2048) |
| Depth | 8 |
| Number of heads | 2 |
| Total parameters | 1.59 M (scaled to 403 M) |
| Dataset | Tiny Shakespeare |
| Vocab size | 65 |
| Architecture | NanoGPT Karpathy (2022) |
|---|---|
| Width | 256 |
| Depth | 2 (scaled to 64) |
| Total parameters | 1.6 M (scaled to 50.56 M) |
| Dataset | Tiny Shakespeare |
| Vocab size | 65 |
| Tokens per iteration | 8192 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 2.54111195 | 2.54770319 | 2.50132585 | 2.53559383 | 2.45719266 | |
| 2.57009896 | 2.56583707 | 2.57900651 | 2.53385917 | 2.51431378 | |
| 2.63474766 | 2.6022807 | 2.64679337 | 2.63449661 | 2.55710355 | |
| 3.38827054 | 3.5544157 | 3.38896998 | 3.44941664 | 3.44561863 | |
| 4.09221347 | 4.08871428 | 4.05257797 | 4.08837303 | 4.08405908 |
| LR / Depth | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|
| 2.53525917 | 2.55192765 | 2.53510944 | 2.50357556 | 2.51294963 | 2.53008548 | |
| 2.52700798 | 2.49422677 | 2.50334986 | 2.29428236 | 2.45176029 | 2.36860998 | |
| 2.55682977 | 2.52176666 | 2.56583563 | 2.30422862 | 2.45500112 | 2.5650301 | |
| 2.59745781 | 2.63078475 | 2.60228316 | 2.61588136 | 2.64065663 | 2.65051214 | |
| 3.41396125 | 3.41677833 | 3.55441554 | 3.45801504 | 3.43285489 | 3.47577778 | |
| 4.09297959 | 4.05970796 | 4.08871428 | 4.08113146 | 4.06712834 | 4.10902596 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 2.55120134 | 2.54616404 | 2.54178079 | 2.5524296 | 2.54457998 | |
| 2.48560476 | 2.44316975 | 2.37087123 | 2.50733534 | 2.50883015 | |
| 2.43175697 | 2.58847451 | 2.57006375 | 2.54323697 | 2.53191725 | |
| 2.63016931 | 2.6073552 | 2.65681744 | 2.66118956 | 2.55337548 | |
| 3.528404 | 3.49065232 | 3.49065232 | 3.42789133 | 3.43255997 | |
| 4.09183598 | 4.08832375 | 4.0521698 | 4.08806594 | 4.08391444 |
| LR / Depth | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|
| 2.56129368 | 2.51452438 | 2.54788987 | 2.51456078 | 2.52271922 | 2.55469418 | |
| 2.48695572 | 2.47477563 | 2.53124801 | 2.48145302 | 2.50687472 | 2.54724765 | |
| 2.56718413 | 2.50419029 | 2.58847276 | 2.44447954 | 2.54996069 | 2.52524622 | |
| 2.67992798 | 2.62949713 | 2.6073552 | 2.60433618 | 2.61753988 | 2.6286815 | |
| 3.41052596 | 3.46538957 | 3.56757394 | 3.47856442 | 3.43608022 | 3.56190586 | |
| 4.09267759 | 4.05929391 | 4.08832375 | 4.08074443 | 4.06675259 | 4.10877307 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 3.0969398 | 2.57144117 | 2.56875261 | 2.62573036 | 2.57240287 | |
| 2.27450609 | 2.27830847 | 2.31632638 | 2.53347905 | 1.98427689 | |
| 2.5456597 | 2.61430057 | 2.5594302 | 2.54869485 | 2.65462987 | |
| 3.35409013 | 3.54614369 | 3.36089802 | 3.35862382 | 3.36431138 | |
| 4.08766381 | 4.08859126 | 4.06069756 | 4.08811712 | 4.08371623 |
| LR / Depth | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|
| 2.5213503 | 3.01081316 | 3.22649105 | 3.34855215 | 3.24310446 | 3.12229093 | |
| 2.4717048 | 2.27232289 | 2.24736114 | 2.47475751 | 2.46061246 | 1.93401444 | |
| 2.54103192 | 2.58136233 | 2.61035593 | 2.610612 | 2.45068415 | 2.55488427 | |
| 3.40887721 | 3.52765425 | 3.54587563 | 3.40669481 | 3.33997742 | 3.47574107 | |
| 4.09267314 | 4.06576761 | 4.08859126 | 4.08140405 | 4.066552 | 4.10874732 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 3.3306915 | 2.91992474 | 2.75658234 | 2.84724092 | 2.84511503 | |
| 2.27427769 | 2.55330944 | 2.53250345 | 2.50694895 | 2.51612274 | |
| 2.46762419 | 2.42723028 | 2.47571055 | 2.49152549 | 2.46575729 | |
| 3.69672974 | 3.70961714 | 3.66877778 | 3.2370429 | 3.37923479 | |
| 4.16929531 | 4.1694754 | 4.1684103 | 4.1674579 | 4.16771809 |
| LR / Depth | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|
| 2.76534136 | 2.85949779 | 2.88115621 | 3.26932732 | 3.24093787 | 3.097018 | |
| 2.50858307 | 2.51164389 | 2.55355501 | 2.33967662 | 2.48308444 | 2.11406271 | |
| 2.45117172 | 2.46691815 | 2.50231234 | 2.45691435 | 2.48629936 | 2.45780365 | |
| 2.50483624 | 2.54284684 | 2.42723123 | 2.43291903 | 2.43262172 | 2.42000318 | |
| 3.6441706 | 3.79367606 | 3.70963343 | 3.57373738 | 3.61402575 | 3.42223287 | |
| 4.16981506 | 4.1691486 | 4.1694754 | 4.16932933 | 4.16817395 | 4.16773876 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 2.64432065 | 3.00841006 | 3.26729711 | 3.39512682 | 4.17380921 | |
| 2.6650331 | 2.89549454 | 3.20741065 | 3.45321918 | 3.41602135 | |
| 2.63122805 | 2.67693043 | 3.30215279 | 3.32265353 | 3.36052688 | |
| 2.67303157 | 2.85103401 | 3.37194387 | 3.46975843 | 3.49201838 | |
| 2.90583165 | 2.97975628 | 3.61035117 | 3.57224735 | 3.72281067 |
| LR / Depth | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|
| 2.83468819 | 2.94637481 | 3.3811605 | 3.27378623 | 3.32534583 | 3.31375853 | |
| 2.63917089 | 2.6383814 | 2.66823014 | 3.2278808 | 3.24864435 | 3.20088768 | |
| 2.64190022 | 2.61007253 | 2.73991227 | 3.12863938 | 3.20985778 | 3.37485345 | |
| 2.77703945 | 2.72295157 | 2.72794461 | 2.93629122 | 3.25431808 | 3.37258538 | |
| 2.7143542 | 2.97368789 | 2.85365486 | 3.32030662 | 3.27988537 | 3.40830247 |
| Architecture | Llama 2 |
|---|---|
| Width | 256 (scaled to 2048) |
| Depth | 16 |
| Number of attention heads | 32 |
| Total parameters | 154M (scaled to 1.38 B) |
| Dataset | Wikitext-103 |
| Sequence length | 4096 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 4.55491 | 4.02676 | 3.81251 | 3.73573 | 3.79477 | |
| 4.24978 | 3.90242 | 3.83252 | 3.89484 | 3.75046 | |
| 4.48696 | 4.21314 | 4.05265 | 4.02101 | 3.95419 | |
| 4.70421 | 4.4353 | 4.39753 | 4.34169 | 4.31635 | |
| 5.57795 | 5.56284 | 5.56173 | 5.55771 | 5.55774 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 4.39033 | 4.02007 | 3.83932 | 3.77732 | 3.76814 | |
| 4.11789 | 3.85536 | 3.72552 | 3.67802 | 3.66973 | |
| 4.23765 | 3.87949 | 3.78242 | 3.80016 | 3.78846 | |
| 4.32335 | 4.07597 | 3.9912 | 3.91654 | 3.95519 | |
| 4.43819 | 4.22574 | 4.13565 | 4.06852 | 4.0683 | |
| 4.64121 | 4.38096 | 4.31582 | 4.22186 | 4.21248 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 7.18452 | 6.35059 | 6.0384 | 6.52966 | 6.13429 | |
| 5.58878 | 5.5638 | 5.56049 | 5.79174 | 6.01439 | |
| 6.57476 | 6.60454 | 6.66398 | 6.98093 | 7.0471 | |
| 10.25112 | 10.23998 | 10.22575 | 10.21199 | 10.19599 | |
| 10.32997 | 10.32776 | 10.32398 | 10.32062 | 10.31677 |
| LR / Width | 128 | 256 | 512 | 1024 | 2048 |
|---|---|---|---|---|---|
| 7.19403 | 6.99576 | 6.68992 | 6.60376 | 6.31375 | |
| 6.17604 | 5.90826 | 5.80694 | 5.6738 | 5.71962 | |
| 4.14122 | 3.83654 | 3.75926 | 3.67419 | 3.62891 | |
| 4.42758 | 4.31702 | 4.05756 | 3.93561 | 3.94189 | |
| 4.76632 | 4.51022 | 4.41358 | 4.34452 | 4.30914 | |
| 4.82305 | 4.79592 | 4.73067 | 4.67473 | 4.74689 |
Hyperparameter Transfer
Hyperparameter transfer studies how to reuse training settings across model sizes, architectures, tasks, and training horizons.
See all 39 papers