skip to content
← Scientific Spaces English

Beyond MuP, Part 2: Linear Layers and Steepest Descent

In the previous article,Beyond MuP, Part 1: Three Characteristics of a Good Model, we introduced the three core metrics of forward stability, dependency stability, and update stability, and provided their corresponding mathematical definitions. At the same time, we proposed using whether they satisfy to characterize the quality of a model, which will serve as the theoretical cornerstone for our subsequent analysis and derivations. Next, we will combine them with the concept of steepest descent to customize an update rule for each parameter that pursues speed while maintaining stability.

We take linear layers as the first example. The resulting outcome will likely be familiar to some readers: it is the Muon optimizer that gained prominence over the past year. Of course, our goal is not merely to rediscover Muon, but to demonstrate the process of designing models and optimizers from first principles, providing a unified methodology for dealing with other parameters later on.

Linear Transformations #

For a linear layer, the input is a vector , the parameter is a matrix , and the model is . Note that in the definitions of the three metrics, we did not restrict to be bounded. Consequently, for a naive linear layer, none of the three metrics necessarily exist; for example, is generally infinite. In response to this, we only need to augment the model with operations that keep the result bounded, such as:

where , where we omit the gamma parameter of RMS Norm, assuming its effect is secondary. As we know, residual connections commonly come in two flavors: Pre Norm and Post Norm. Pre Norm clearly corresponds to In Norm, but it is worth pointing out that Post Norm is effectively In Norm as well:

Therefore, compared with Pre Norm, Post Norm merely replaces with . For , both are In Norm; this article likewise takes In Norm as an example.

Compared with Out Norm, In Norm offers another advantage: greater headroom for speedups, because . Theoretically, and can be computed in parallel and then divided, reducing latency—an idea reflected in 《FlashNorm: fast normalization for LLMs》, 《Block-level AI Operator Fusion》, and 《Superoptimizing RMSNorm and Linear》, among other works.

Initial Variance #

Following the discussion in the previous section, we stipulate that we only consider linear layers with In Norm. Then, by the definition of the spectral norm, we can compute the three metrics:

where taking for a matrix denotes its spectral norm. As we can see, all three metrics are variations of the spectral norm, or more precisely, the three metrics I proposed are originally generalizations built upon the spectral norm.

The first two metrics are functions of ; for linear layers, they happen to be identical. If we want them to be , then we have , which at least imposes a requirement on the initialization of . According to Quick Estimation of the Spectral Norm of Random Matrices, for a standard normal matrix of size , its spectral norm is roughly , so for the initialization to satisfy , the initial variance should satisfy

In addition, we can also consider continuously constraining during optimization, which has inspired several works, such as Steepest Descent on Manifolds, Part 4: Muon + Spectral Sphere and 《Controlled LLM Training on Spectral Sphere》; we will discuss this part later.

Steepest Descent #

Next, we focus primarily on the "update stability" metric , which is a spectral norm variant of the parameter increment . As is well known, the update step is determined by the optimizer, so this part provides guidance for the optimizer. Following the principle of "seeking speed within stability", now that we have "stability", when is it fastest?

This is precisely the question that steepest descent aims to answer. We have previously discussed this in articles such as Muon Sequel: Why Did We Choose to Try Muon?, Steepest Descent on Manifolds, Part 1: SGD + Hypersphere, and Steepest Descent on Manifolds, Part 2: Muon + Orthogonality, among others, but for the completeness of this series, we will still patiently repeat it. Steepest descent refers to the update that makes the loss decrease fastest under a given constraint, formally defined as

where is the loss function, is the stability metric of the increment , which we already have here, namely . However, solving this problem directly is still too complex; we need to replace with the first-order approximation , to make solving it feasible. At this point, the problem is equivalent to

where is the gradient of the loss function, and we have used the identity .

Solution Procedure #

Furthermore, we set , rewriting the optimization objective as

Clearly, the optimization of can be carried out independently, and its maximum is attained at ; therefore, we only need to solve

Next, suppose has the SVD , where is the rank of ; we have

By definition, when , , so , and therefore

where is called the nuclear norm of the matrix, with equality holding when all are equal to 1, at which point

Summary of Results #

To briefly summarize, up to this point, starting from the three stability metrics, we have obtained at least two conclusions: first, the parameter 's initialization variance should satisfy

and second, its increment should take the following form:

This is precisely the MuP version of Muon (for the differences between several versions, refer to A Guide to the Muon Optimizer: Quick Start and Key Details; standard Muon replaces with its momentum, which can be viewed as a smoother gradient estimate). In addition, regarding the constraint on , we still have some work to do, which is left for discussion in later posts.

Since we have previously discussed MuP and Muon thoroughly across multiple blog posts, neither of these two results is new. Therefore, this post merely serves as a first case study to demonstrate the reasonableness of the metrics ; they will provide unified stability metric formulas for parameters and their increments across arbitrary layers, thereby generalizing the conclusions of Muon.

Remaining Questions #

Before generalizing, we still have one question to answer: The previous derivations were all based on the In-Norm design, so does every linear layer need to have In-Norm added? If there is no In-Norm, can we still use Muon? To answer this question, let us first borrow a passage from the previous post:

Here, can be a layer, a block composed of several layers, or even the entire model. In theory, the coarser the granularity, the looser—or rather, more accurate—the resulting constraint is, but is also harder to solve, so this depends on our ability to compute .

Simply put, the more accurately the stability metrics are computed, the better, though approximations are permissible. Therefore, in the absence of In-Norm, the extent to which Muon is applicable depends on how well "" holds. For instance, for an FFN layer , if we assume that the activation function has a Lipschitz constant of 1, then the following still holds:

where . As such, even if we only apply RMS Norm to , for the second parameter , the same stability metric approximately holds, making Muon applicable as well.

Similarly, even without applying RMS Norm at all, if we still believe that "" holds to some extent, we can still try the Muon optimizer for the subsequent linear layers.

Summary #

Starting from the three stability metrics of the previous article, this post demonstrated the process of "reproducing" the conclusions related to MuP and Muon for linear layers. Next, we will apply this methodology to "customize" initializations, optimizers, and other components for parameters beyond linear layers.