Scaling General Architectures and Optimizers with Automatic Parameterization
Abstract
How should the initialization, learning rate, and other hyperparameters of a neural network scale with its width, depth, context length, or batch size? Each answer has so far been derived by hand for a particular architecture, optimizer, and scaling axis, as in μP for width, Depth-μP and CompleteP for depth, and stochastic differential equation (SDE) models of stochastic gradient training for batch size. We show that these rules follow from a single principle: as the scaled sizes grow, the training program should approach a limit that is still the same program. In this limit, no value diverges, no hyperparameter or computed value loses its effect on the loss, and no nonlinear instruction responds only linearly to the change that training makes to its input. Since the principle is a statement about the instructions of a program, and every size enters a program through sums that grow either coherently or incoherently, it can be applied to any training program automatically. We develop automatic parameterization (AutoP), a general formulation that turns the principle into inequalities on the exponents of all hyperparameters and solves them. AutoP recovers μP, the depth scalings, and the SDE batch-size rules across architectures and optimizers, and finds rules that transfer hyperparameters in settings without an accepted scaling rule, such as the recurrences of looped transformers and the batch size under Muon. Much as automatic differentiation made derivatives of any program automatic, AutoP lets practitioners scale up new architectures and optimizers without rederiving the theory behind them.