Four positive numbers, two directions四个正数,两个方向

Consider a linear layer whose weight gradient on one batch is the symmetric matrix G below. Multiply it by a vector with two equal entries, then by one with opposite entries. Along the first direction the gradient has gain 3. Along the second it has gain 1. Those directions are orthogonal, and both carry signal.设一个线性层在当前批次上的权重梯度为下面的对称矩阵 G。拿两个向量分别右乘到 G 上:一个向量的两项相等,另一个的两项互为相反数。沿第一个方向,G 把向量放大到三倍;沿第二个方向,向量的长度保持不变。这两个正交方向都带有梯度信息。

On Adam’s first bias-corrected step, with zero initial moments and negligible numerical damping, each entry is divided by its own absolute value. All four entries become 1. Apply the resulting matrix to the difference vector again: the two columns cancel exactly. A useful diagnostic is therefore the gain along each direction. We compare positive update directions below, before multiplying by the negative learning rate.Adam 从零初始化一阶矩和二阶矩。第一次更新经偏差修正后,若忽略数值稳定项,每个梯度元素都除以自己的绝对值,四项都变成 1。再乘两项互为相反数的向量,两列的贡献恰好抵消。要看清优化器改变了什么,可以比较更新矩阵沿这两个方向的增益。下文先写更新方向,实际调整权重时再乘以负学习率。

Shampoo learns two sets of correlationsShampoo 分别累积行与列的相关性

Write Gₜ for the gradient of an m-by-n weight matrix at step t. The (i,j) entry of GₜGₜᵀ is the inner product between gradient rows i and j: it records whether those two rows vary together across input features. GₜᵀGₜ measures the analogous relationship between columns. The original matrix version of Shampoo accumulates both Gram matrices, starting each accumulator at a small positive multiple of the identity.记第 t 步的梯度为 Gₜ,权重矩阵有 m 行 n 列。GₜGₜᵀ 的第 (i,j) 项是第 i 行与第 j 行梯度的内积,反映它们在各个输入特征上是否同向变化。GₜᵀGₜ 同样比较列。原始 Shampoo 的矩阵版本分别累积这两组内积,两个累积量都从单位矩阵的一个微小正倍数开始。

To see the fourth roots at work, take one observation with singular value σ. Its contribution to each Gram matrix in the matching direction is σ². With negligible damping, the two inverse fourth roots each supply a factor of 1/√σ. Together they remove one power of σ. With a history of gradients, the denominators depend on earlier batches. The same current G can then yield different steps. The factors contain gradient second moments. Computing them requires gradients alone.只看一次观测,设某个奇异值为 σ,对应方向在左、右两个累积矩阵中的特征值都是 σ²。忽略微小稳定项,两边各取负四分之一次幂,就各贡献一个 1/√σ;两边相乘,恰好消去一个 σ。有了梯度历史后,分母也包含过去各批次的贡献,因此即使眼下的 G 相同,更新也可能不同。两侧矩阵记录的是梯度的二阶矩,只需一阶导数就能构造。

For a 4096-by-4096 layer, a dense preconditioner for the flattened gradient has 2⁴⁸ entries. The two unblocked Shampoo factors have 2²⁵ entries in total, or 128 MiB at four bytes per entry, before roots, workspaces or momentum. A dense eigendecomposition costs on the order of m³+n³ operations per refresh. Dividing a layer into blocks reduces the size of each decomposition and sacrifices correlations across block boundaries. Gupta, Koren & Singer · ICML 2018以 4096×4096 的权重层为例,把梯度拉成向量再构造稠密预条件矩阵,需要 2⁴⁸ 个元素。Shampoo 的两个整层因子合计需要 2²⁵ 个元素,按每个元素四字节计算是 128 MiB,还需另算矩阵根、工作区和动量的空间。若每次刷新都做稠密特征分解,运算量为 m³+n³ 的量级。按块分解可以降低开销,代价是块间相关性无法进入各块的预条件矩阵。 Gupta、Koren 与 Singer,ICML 2018

SOAP changes the axes on which Adam measures scaleSOAP 在哪些坐标上运行 Adam?

Suppose Qₗ and Qᵣ contain the eigenvectors of the left and right gradient statistics. Project the gradient into those two bases. Each new entry now describes one input direction paired with one output direction. SOAP tracks the squared size of that particular entry with an exponential moving average. Thus two entries in the same row can receive different denominators even between basis refreshes.设 Qₗ 和 Qᵣ 的列分别是左右梯度统计矩阵的特征向量。将梯度投影到这两组基上,新矩阵的每个元素就对应一对输入和输出方向。SOAP 对每一对方向分别累积梯度平方的指数移动平均。即使两次换基之间保持坐标轴不动,同一行中两个元素的分母仍可分别调整。

Here M is the moving average of gradients in the original basis. Hats denote bias correction, and the square, square root and division inside the projection act entrywise. The displayed recurrence covers a stretch with fixed bases. A refresh must keep the moment estimates aligned with the new directions. SOAP therefore lets the relatively costly update of the axes run less frequently than the update of the denominators. The original implementation uses moving averages for the left and right factors as well. Vyas et al. · SOAP, algorithm and implementationM 是原坐标系中梯度的指数移动平均,帽号表示偏差修正。投影坐标中的平方、平方根和除法都逐元素计算。上式描述基保持不变的一段训练;换基时还要使累积的统计量与新的方向对应。于是坐标轴可以隔多步才刷新一次,每个元素的分母仍能逐步更新。原实现对左右两个因子也采用移动平均。 Vyas 等,SOAP 算法与实现

Muon puts a budget on the largest directional changeMuon 限制任一输入方向上的最大变化

For a hidden linear layer, a weight change ΔW changes its output on input x by ΔWx. If every unit input must see an output change of at most η, the relevant constraint is a spectral-norm bound. Use the current momentum matrix B as the local linear model for loss change and minimize its inner product with the weight change under this bound.对一个隐藏线性层,权重变化 ΔW 会让输入 x 对应的输出改变 ΔWx。如果要求任何单位输入的输出变化都不超过 η,相应的约束就是谱范数上界。用当前的动量矩阵 B 近似局部损失的一阶变化,在这一上界内寻找能让线性近似下降最多的权重改变量。

To verify the result, resolve the inner product into singular directions. Each term is σᵢ times uᵢᵀΔWvᵢ, whose magnitude is at most η. The displayed choice attains the lower bound on every active direction simultaneously. The thin singular-value decomposition keeps just the r positive singular values. Along a direction that has no signal, this solution spends none of the budget.把内积按奇异方向展开,第 i 项等于 σᵢ 乘以 uᵢᵀΔWvᵢ。左右奇异向量都是单位向量,因此后一个因子的绝对值至多为 η。上式的解让所有非零奇异方向同时取到下界。这里的精简奇异值分解只保留 r 个正奇异值,这个解在其余方向上不作更新。

Muon approximates this polar factor of a momentum update with a few Newton–Schulz polynomial iterations. Left and right singular vectors survive each polynomial step, while each singular value is mapped through a scalar polynomial. The inexpensive finite iteration leaves a spread of singular values. Jordan’s original recipe targets hidden weight matrices and uses a companion optimizer for other parameter groups. Its main persistent state for this transform is one momentum buffer. The matrix products still take time and temporary space. Jordan · original Muon design and coefficientsMuon 对动量更新运行少数几次 Newton–Schulz 多项式迭代,近似求出这个极因子。每次迭代都保留左右奇异向量,让奇异值通过同一个标量多项式变换。实际只做有限次,变换后的奇异值仍有差异。Jordan 最初的方案对隐藏层的权重矩阵使用 Muon,其他参数组另配优化器。该变换长期保存的主要状态是一份动量缓冲,迭代中的矩阵乘法还会消耗时间和临时空间。 Jordan,Muon 原始设计与迭代系数

Calculate what survives the update算一算哪些方向被保留下来

Return to the opening matrix. The table gives the eigenvalues of three positive update directions on its common and difference modes. We use one batch, zero initial moments, unit learning rate and the zero-damping limit. For Muon we take B = G and use the exact polar factor to isolate its mathematical target.回到开头的矩阵。下表列出三个更新方向在同向与差分方向上的特征值。设只有一个批次,动量从零开始,学习率为 1,稳定项趋于零。为单独考察 Muon 的数学目标,取 B = G,并使用精确极因子。

Direction matrix更新方向矩阵Common mode同向Difference mode差分
Raw gradient G原梯度 G31
Adam, first updateAdam 首步20
Shampoo, first update / exact polar factorShampoo 首步/精确极因子11

A second observation breaks the apparent equivalence in the last row. Suppose the previous batch had eigenvalues 1 and 3 in the same two directions, and the current batch has 3 and 1. Both Shampoo accumulators now have eigenvalues 10 and 10. Its direction has gains 3/√10 and 1/√10. The exact polar factor of the current G still has gains 1 and 1. In training Muon also depends on history through momentum, so fixing B = G here isolates the orthogonalization step.换一段观测历史,最后一行的两种方法就会分开。假设上一个批次在相同的两个方向上分别取特征值 1 和 3,当前批次取 3 和 1。此时 Shampoo 左右累积矩阵的两个特征值都是 10,所得方向的增益分别为 3/√10 与 1/√10。直接对当前 G 求极因子,增益仍为 1 和 1。训练时 Muon 的动量也包含历史;此处固定 B = G,才能单独看出正交化的作用。

What changes in a training run?换到真实训练,差距有多大?

Four optimizers on the same 300M model同一个 3 亿参数模型,四种优化器

Wen and colleagues trained the same Llama architecture under several token budgets, tuning the optimizers separately. Here are four methods at two budgets. Each cell is the final loss on the English C4 validation set for the selected configuration. Each column reports runs trained to that budget. A lower loss corresponds to a higher geometric mean probability for the tokens that actually occurred. Wen et al., Appendix B.4, Tables 10, 13, 28 and 31.Wen 等人用同一款 Llama 架构,分别为各优化器调参。下表摘出四种方法在两档训练预算下的结果。每一列都是按该预算训练到终点后,在英文 C4 验证集上测得的损失。数值越低,说明模型给实际出现的 token 所分配的概率,其几何平均值越高。Wen 等,附录 B.4,表 10、13、28、31。

Optimizer优化器 12B tokens120 亿 token 48B tokens480 亿 token
AdamW3.1663.043
Lion3.1703.046
Muon3.1433.032
SOAP3.1473.030

At 12B tokens, Muon ends 0.023 below AdamW and 0.004 below SOAP. At 48B, SOAP ends 0.002 below Muon. Both matrix methods improve on AdamW in both columns. The small gap between them calls for repeated runs before choosing on that basis. To choose on GPU hours, we also need throughput. Part 6 compares Muon and AdamW on a fixed clock.用 120 亿个 token 训练,Muon 的损失比 AdamW 低 0.023,比 SOAP 低 0.004。换成 480 亿个 token,SOAP 又比 Muon 低 0.002。两档预算下,两种矩阵方法的损失都低于 AdamW。要在它们之间取舍,这么小的差距值得换几组随机种子复测。如果关心的是 GPU 账单,还得看吞吐量。第六期给出了固定训练时间下的实测结果。

Even with a fixed corpus budget, the batch size can change the ordering. Dang and colleagues held training at about 1.7B tokens and tuned each method at each batch size. At 128K tokens per step, KL-SOAP-W finished at 3.2536 versus 3.2650 for ShampooW. At 2M per step, ShampooW finished at 3.3622 versus 3.3833 for KL-SOAP-W. These are final FineWeb validation losses in nats per token. The larger batch allowed only 813 updates, down from 13,000. Dang et al., Table 11.即使总训练量固定,每步读多少数据也会改变结果。Dang 等人固定约 17 亿个训练 token,在每种批量下分别调参。每步 128K 个 token 时,KL-SOAP-W 的最终验证损失为 3.2536,低于 ShampooW 的 3.2650。每步提高到 2M 个 token 后,ShampooW 为 3.3622,低于 KL-SOAP-W 的 3.3833。这里用的是 FineWeb 验证集,单位为 nat/token。批量增大后,同样的数据只够更新 813 次,原先可以更新 13,000 次。Dang 等,表 11。

Do fewer steps repay the cost per step?少走几步,能否抵消每一步的额外开销?

Vyas and colleagues trained 360M- and 660M-parameter language models. In their large-batch experiments SOAP reached the target with over 40% fewer iterations and over 35% less wall time than AdamW. These are two different measurements. If an update costs 20% more per step on your machine, the step count must fall by more than one sixth before elapsed time improves. SOAP · experiments, 2024 preprint, ICLR 2025Vyas 等在 3.6 亿和 6.6 亿参数的语言模型上做了预训练。在论文的大批量实验中,与 AdamW 相比,SOAP 达到目标所用的迭代次数减少超过 40%,实际耗时缩短超过 35%。这两个指标需要分别测量。假设在自己的机器上每步耗时增加 20%,则达到同一目标所需的步数必须减少超过六分之一,总耗时才会缩短。 SOAP 实验,2024 年预印本,ICLR 2025

In 2025 Liu and colleagues matched update scales across parameter shapes and added weight decay to their Muon recipe. Their scaling-law fit estimated roughly half the training FLOPs of AdamW at matched loss under compute-optimal training. Applying that factor to a system’s wall clock would also require measuring optimizer kernels, communication and the other parameter groups. Liu et al. · Muon scaling experiments2025 年,Liu 等调整了不同形状参数的更新尺度,并在 Muon 方案中加入权重衰减。在按计算预算选择训练配置的条件下,论文的尺度律拟合估计,达到相同损失所需的训练浮点运算量约为 AdamW 的一半。要换算成某个系统上的耗时,还需测量优化器内核、通信和其余参数组的开销。 Liu 等,Muon 规模实验

A July 2026 preprint by Khona and colleagues matched the root-mean-square size of updates when comparing AdamW, SOAP and Muon. At very large batch sizes they observed loss spikes with earlier SOAP settings and changed the implementation, including QR orthogonalization at each step. Their next-token experiments reached batches of 100 million tokens. When reproducing a comparison, record the exact algorithm variant, tokens per step, validation target, elapsed time and peak memory. Those details determine whether the extra matrix operations pay off on a particular system. Khona et al. · July 2026 preprintKhona 等人在 2026 年 7 月的预印本中对齐了更新量的均方根,再比较 AdamW、SOAP 和 Muon。超大批量下,早期 SOAP 配置出现损失尖峰,作者为此修改了实现,包括每步都做 QR 正交化。其下一词元预测实验的批量最高达到每步一亿个 token。复现实验时要记录具体算法版本、每步 token 数、目标验证损失、实际耗时与峰值内存,才能判断额外的矩阵运算在自己的系统上是否划算。 Khona 等,2026 年 7 月预印本