betaFeedback

WorksComputer Science

CAST: History-Adaptive Spectral Clipping for LLM Pretraining

Abstract

Soft spectral clipping (SSC) reduces gradient singular values, but its effect depends on the gradient scale and clipping threshold. We introduce CAST (Clipping with Adaptive Scales and Thresholds), a history-adaptive extension of SSC. AdamW's previous second moment sets row and column scales. An exponential moving average of the clipped output's estimated spectral norm sets each matrix's threshold. CAST restores the original coordinates before the AdamW update. We train a mixture-of-experts (MoE) model with 19.08B total parameters for 83.89B tokens. CAST achieves lower training and mean validation losses than nine gradient-processing baselines, with the fewest relative gradient spikes. It reaches the best baseline's final smoothed training loss in 7.2% fewer steps.

Introduction

Gradient clipping[28] controls large gradients during language model[23, 2, 14, 27, 5, 22, 21] pretraining [18]. When applied before AdamW, it also changes the moment estimates used by later updates [16]. The clipping rule therefore affects both the current update and the optimizer’s state over time.

Global norm clipping rescales the whole gradient by a single factor. This limits the influence of an unusually large gradient while preserving its direction. A matrix gradient can be large mainly along a few directions. Rescaling the entire matrix then also weakens other directions, even when their magnitudes are already moderate. Spectral clipping controls the gradient magnitude in each singular direction. SPECTRA[10] develops a smooth spectral transformation for appli-

cation before or after a base optimizer[16, 12, 11]. We use pre-optimizer SSC (SSC-Pre) because CAST also acts on gradients before AdamW. We label its constant and cosine threshold schedules SSC-constant and SSC-cosine.

A clipping threshold is meaningful only relative to the gradient scale. Persistent differences in row and column magnitudes affect the spectrum on which clipping acts. An unusually large value in one part of a matrix may be routine in another, and the overall scale can change over training. A fixed threshold may therefore apply different clipping strengths as the gradient scale changes. SPECTRA’s decaying pre-clipping threshold shows the value of adjusting this threshold during training. Such a schedule depends on the training step. A history-based rule can instead respond to changes in each matrix. We therefore use each matrix’s history to set its gradient scale and clipping threshold.

We introduce CAST (Clipping with Adaptive Scales and Thresholds), which uses two complementary histories (Figure 2). Historical scaling (HS) uses row and column summaries of AdamW’s previous second moment to set the scale for each gradient matrix. SSC acts in these standardized coordinates, and the output returns to its original scale before updating AdamW. AdamW updates both moments from this restored gradient. The updated second moment supplies the scale used at the next step.

CAST historical scaling and output feedback diagram

Figure 2. CAST adds historical scaling (HS) and output feedback around SSC (Algorithm 1). AdamW uses restored GoutG_{\mathrm{out}}; its VV becomes the next VoldV_{\mathrm{old}}, bias-corrected within SS. The EMA holdh_{\mathrm{old}} tracks the estimated ∥Zout∥2\lVert Z_{\mathrm{out}}\rVert_2. Dashed histories advance only after a successful update.

We also maintain an exponential moving average (EMA) of the clipped output’s estimated spectral norm, computed in the same standardized coordinates. This estimate measures the largest singular value after clipping. The previous EMA sets the current threshold before clipping begins. CAST retains SSC’s soft map and Newton–Schulz routine. The two histories control the input coordinates and clipping threshold.

Our contributions are threefold:

  • Historical scaling. We use row and column summaries of the previous second moment to define the coordinates of spectral clipping. We then restore the gradient’s original scale.

  • Output feedback. We adapt each matrix’s threshold to its clipped output history, so the threshold follows changes in the clipped spectrum.

  • Pretraining results. CAST achieves the lowest training and mean validation losses among nine baselines in our MoE study (Figure 1). We examine its component effects, gradient dynamics, and training cost.

Figure 1. Validation loss after 5,000 steps: unweighted mean over 20 subsets (one run per method; seed 48). GS: GradientStabilizer. The vertical axis is truncated. Full comparison: Table 1.

Related Work

Spectral Clipping

SPECTRA is the direct starting point for this work (Jiang et al., [10]). It smoothly reduces singular values through a matrix inverse square root, computed with Newton–Schulz iterations (Liu et al., [15]). Its framework combines spectral clipping of optimizer updates with optional gradient preprocessing. This gradient preprocessing forms the SSC baselines in our study.

SPECTRA also studies how the clipping threshold changes during training. Its pre-clipping study compares a fixed threshold of 0.1 with cosine decay from 10 to 0.01. The decaying schedule gives better results. We use the previous second moment to set the clipping scale and the complete clipped output to update the threshold. We retain full-matrix soft clipping throughout. § 5.1 describes our SSC baselines.

Gradient Transformations

Adafactor represents second moments through row and column statistics (Shazeer and Stern, [20]). Our scale uses the same factored structure, with positive floors, to define the coordinates of spectral clipping. AdamW keeps its full moment states and uses the gradient after we restore its original scale.

AdaGC adapts per-tensor thresholds from previous clipped norms (Wang et al., [25]). Our spectral history follows this output-based principle for each matrix. It uses an estimated spectral norm in standardized coordinates. Parameters outside the spectral branch use an output-norm controller. ZClip uses running global norm statistics to detect spikes (Kumar et al., [13]). GradientStabilizer transforms global magnitude using two scalar moving averages (Huang et al., [7]). These histories track different quantities from AdamW’s coordinatewise second moment.

Other transformations use current parameter or gradient magnitudes. AGC bounds unitwise gradient norms relative to parameter norms (Brock et al., [1]); coordinate clipping bounds individual en-

Algorithm 1 Soft spectral clipping (SSC) (Jiang et al., [10])

Require: B∈Rq×dB \in\mathbb{R}^{q \times d}, q≤dq \le d; threshold τ>0\tau> 0; iterations KK

Ensure: Output BoutB_{\mathrm{out}} and clipping flag aa

  1. C←BBTC \leftarrow BB^{\mathsf{T}}

  2. u←min⁡{∥C∥F,max⁡i∑j∣Cij∣}u \leftarrow\min\{\lVert C\rVert_{\mathrm{F}}, \max_i \sum_j \lvert C_{ij}\rvert\}

  3. if u≤τ2u \le\tau^2 then

  4.     return (B,false)(B,\mathrm{false})

  5. end if

  6. α←τ2+u\alpha\leftarrow\tau^2 + u; A0←(τ2I+C)/αA_0 \leftarrow(\tau^2 I + C)/\alpha

  7. Y←A0Y \leftarrow A_0; R←IR \leftarrow I

  8. for j=1,…,Kj=1,\ldots,K do

  9.     T←(3I−RY)/2T \leftarrow(3I-RY)/2

  10.     Y←YTY \leftarrow YT; R←TRR \leftarrow TR

  11. end for

  12. return ((τ/α)RB,true)((\tau/\sqrt{\alpha})RB,\mathrm{true})

tries. GradPower applies a signed elementwise power before the optimizer (Wang et al., [26]). These methods cover global, tensor, coordinate, and spectral gradient processing.

Soft Spectral Clipping

For a singular value σ≥0\sigma\ge0 and threshold τ>0\tau> 0, the SPECTRA soft map is

ϕτ(σ)=σ1+(σ/τ)2.(1)\phi_{\tau}(\sigma)=\frac{\sigma}{\sqrt{1+(\sigma/\tau)^2}}. \tag*{(1)}

It slightly reduces small singular values and applies a stronger reduction to larger ones. For B∈Rq×dB \in\mathbb{R}^{q \times d} with q≤dq \le d, its matrix form is

Hτ(B)=τ(τ2I+BBT)−1/2B.(2)H_{\tau}(B)=\tau(\tau^2I+BB^{\mathsf{T}})^{-1/2}B. \tag*{(2)}

The inverse square root acts on the full q×qq \times q Gram matrix. Newton–Schulz iterations approximate this matrix function without computing an explicit singular value decomposition (Jiang et al., [10]).

Algorithm 1 restates the SSC routine from SPECTRA in our notation. It first bounds the largest squared singular value using the full Gram matrix. If that bound is at or below the squared threshold, it returns the input unchanged. Otherwise, it approximates HτH_{\tau} with KK Newton–Schulz iterations. We also return a Boolean aa that records whether clipping was applied. This flag lets the caller preserve the original gradient exactly when SSC is bypassed.

The soft map in Equation (2) describes the active clipping branch. Figure 3 illustrates its shape and the effect of changing the threshold. CAST and both SSC baselines share the gate and the Newton–Schulz approximation. Appendix § 8 gives the input rescaling used to evaluate Algorithm 1 safely in FP32.

Figure 3. The soft map and CAST’s threshold choice. (a) Hard and soft clipping at τ=1\tau= 1, following the functional view of SSC in Jiang et al. [10]. (b) The same soft map at τ=1.3h\tau= 1.3h for three illustrative values of the previous output history hh. These analytical curves describe the active branch in standardized coordinates; the bypass gate and finite Newton–Schulz approximation are separate steps in Algorithm 1.

Method: CAST

Let G∈Rm×nG \in\mathbb{R}^{m \times n} be a gradient after accumulation, distributed reduction, and mixed-precision unscaling. We transform it into GoutG_{\mathrm{out}} before either AdamW moment is updated:

Mt=β1Mt−1+(1−β1)Gout,Vt=β2Vt−1+(1−β2)Goutodot2.(3)\begin{aligned} M_t &= \beta_1 M_{t-1}+(1-\beta_1)G_{\mathrm{out}},\\ V_t &= \beta_2 V_{t-1}+(1-\beta_2)G_{\mathrm{out}}^{\\odot2}. \tag*{(3)} \end{aligned}

AdamW then applies its usual bias correction and decoupled weight decay. We write ⊙\odot and ⊘\oslash for elementwise multiplication and division, and ∥⋅∥F\lVert\cdot\rVert_{\mathrm{F}} for the Frobenius norm.

Our method makes two changes around Algorithm 1: it standardizes the input and derives the threshold from output history. SSC acts on the full matrix of each selected parameter. We select two-dimensional tensors in the dense optimizer group, excluding embeddings and output matrices by name. Other tensors, including parameters assigned to the expert optimizer, use the output-norm controller described below. Appendix § 9.§ 1 gives the selection rule for MoE projections and routers.

Algorithm 2 separates these additions from the inherited SSC routine. It shows matrices that have completed calibration and have a gradient at every step. Appendix § 9 covers initialization and missing gradients. Both histories are read before the current AdamW update and committed only after it succeeds.

Historical Scaling

We use the previous second moment to measure each gradient relative to its historical coordinate scales. After k≥1k \ge1 moment updates, let V^=V/(1−β2k)\widehat{V}=V/(1-\beta_2^k) denote the bias-corrected previous second moment. Its row, column, and overall means are

ri=1n∑jV^ij,cj=1m∑iV^ij,r_i=\frac{1}{n}\sum_j\widehat{V}_{ij},\qquad c_j=\frac{1}{m}\sum_i\widehat{V}_{ij},
b0=1mn∑i,jV^ij.(4)b_0=\frac{1}{mn}\sum_{i,j}\widehat{V}_{ij}. \tag*{(4)}

Algorithm 2 CAST gradient preprocessing for AdamW

Require: Gradients GG, old corrected moments V^\widehat{V}, histories hh

  1. for each selected matrix after calibration do

    1. HS

    2. S←Scale⁡(V^)S \leftarrow\operatorname{Scale}(\widehat{V}) ▷ Equation (5)

    3. Z←G⊙SZ \leftarrow G \mathbin{\odot} S; B←Orient⁡(Z)B \leftarrow\operatorname{Orient}(Z)

    4. Threshold from output history

    5. τ←1.3h\tau\leftarrow1.3h

    6. (Bout,a)←SSC⁡(B,τ,5)(B_{\mathrm{out}}, a) \leftarrow\operatorname{SSC}(B,\tau,5) ▷ Algorithm 1

    7. Zout←Unorient⁡(Bout)Z_{\mathrm{out}} \leftarrow\operatorname{Unorient}(B_{\mathrm{out}})

    8. Gout←GG_{\mathrm{out}} \leftarrow G

    9. if a=truea = \mathrm{true} then

    10. Gout←S⊙ZoutG_{\mathrm{out}} \leftarrow S \mathbin{\odot} Z_{\mathrm{out}}

    11. end if

    12. s←PowerTop⁡(Zout,3)s \leftarrow\operatorname{PowerTop}(Z_{\mathrm{out}},3)

    13. if s>0s > 0 then

    14. Stage h′←0.95h+0.05sh^\prime\leftarrow0.95h + 0.05s

    15. end if

    16. end for

    17. Clip other tensors with the historical norm rule

    18. Apply AdamW to all transformed gradients

    19. Commit staged state after a successful update

With ρ=0.01\rho= 0.01 and ϵs=10−8\epsilon_s = 10^{-8}, define

b=max⁡{b0,(ϵsρ)2},b = \max\left\{b_0,\left(\frac{\epsilon_s}{\rho}\right)^2\right\},
Sij=max⁡(ri,ρb)max⁡(cj,ρb)b,(5)S_{ij} = \sqrt{\frac{\max(r_i,\rho b)\max(c_j,\rho b)}{b}}, \tag*{(5)}
Z=G⊙S.Z = G \mathbin{\odot} S.

The floors provide a positive reference for sparsely active coordinates. The row and column factors account for persistent differences in gradient magnitudes. Each coordinate uses one row factor and one column factor. After clipping, we restore the original coordinates with Gout=S⊙ZoutG_{\mathrm{out}} = S \mathbin{\odot} Z_{\mathrm{out}}.

Adaptive Thresholds

We adapt the clipping threshold separately for each selected gradient matrix. Each matrix maintains a positive scalar history hh of its clipped output’s estimated spectral norm. The current threshold uses its previous value:

τt=λht−1,λ=1.3.(6)\tau_t = \lambda h_{t-1}, \qquad\lambda= 1.3. \tag*{(6)}

We orient ZZ so that BB has the smaller dimension as its row count, then call Algorithm 1 with K=5K = 5. When the algorithm returns a=falsea = \mathrm{false}, we keep the original GG directly. Otherwise, we restore the clipped matrix to ZZ’s orientation and set Gout=S⊙ZoutG_{\mathrm{out}} = S \mathbin{\odot} Z_{\mathrm{out}}.

The controller observes the complete standardized output through three power iterations:

st=PowerTop⁡(Zout,t,3),s_t = \operatorname{PowerTop}(Z_{\mathrm{out},t},3),
ht=βhht−1+(1−βh)st,βh=0.95.(7)h_t = \beta_h h_{t-1} + (1-\beta_h)s_t, \qquad\beta_h = 0.95. \tag*{(7)}

After calibration, positive observations update the history; zero outputs leave it unchanged. Each observation uses the same scale as the current transform. The updated history sets the next threshold.

Implementation

The first 40 successful optimizer updates use global clipping at norm 1 to initialize moments and histories. A selected matrix enters the spectral branch when its previous second moment, history, and participation count are ready. Other tensors use a threshold λf\lambda f, where ff tracks their clipped output norms. These tensors include the MoE experts and embeddings, so the output-norm controller covers a large part of the model. Appendix § 9 specifies initialization, intermittent participation, and checkpoint restoration.

The distributed implementation all-gathers gradient fragments into complete logical matrices, applies the transformation, and writes each rank’s local optimizer slice. Stored row and column summaries recover the previous second-moment scale without repeatedly gathering the full moment tensor. The transform uses FP32 within BF16 training[17]. For q=min⁡(m,n)q = \min(m,n), its matrix arithmetic costs O(max⁡(m,n)q2+Kq3+pmn)O(\max(m,n)q^2 + Kq^3 + pmn), with K=5K = 5 and p=3p = 3. § 5.5 reports the time per step observed during training.

Experiments

We evaluate pretraining quality, component effects, and training cost over 5,000 steps (83.89B nominal tokens).

Experimental Setup

Model and recipe. We train a shortcut MoE model[3] with 10 blocks, hidden size 1536, and 16 attention heads[24]. Each block contains two multi-head latent attention modules[4], two dense SwiGLU modules, and one MoE module[6, 9] (Shazeer et al. 2017). The model structure gives approximately 19.08B total parameters. Its target activated backbone has 647.6M parameters, excluding input and output embeddings. Actual expert activation depends on routing. The full calculation appears in Appendix § 10.

The runs share the recorded data and tokenizer configurations. We use sequence length 8192, global batch size 2048, microbatch size 1, and training seed 48. AdamW uses (β1,β2)=(0.9,0.95)(\beta_1, \beta_2) = (0.9, 0.95), ϵ=10−16\epsilon= 10^{-16}, and weight decay 0.1. The learning rate reaches 8×10−48 \times10^{-4} after 500 warmup iterations and remains constant through the comparison window. Training uses BF16 and expert parallelism of eight. The model, optimizer fields, and recorded learning-rate trajectory agree across the conditions.

Baselines. We compare with GlobalGC, AdaGC, SSC-constant, SSC-cosine, GradientStabilizer, GradPower, ClipByValue, AGC, and ZClip. Appendix § 10.§ 2 gives each baseline’s processing order and hyperparameters.

Both SSC baselines use five Newton–Schulz iterations on the same selected matrices in raw coordinates. SSC-constant uses τ=0.1\tau= 0.1. SSC-cosine decays τ\tau from 10 to 0.1 over 5,000 steps. The component study adds three variants of CAST.

Measurements. Training loss is the mean language modeling loss over iterations 4801–5000. We average validation loss over the same 20 subsets at step 5000. These include domain corpora, question–answer text, and code-formatted text. We use the recorded token-loss definition for each subset. The 100- and 500-step training windows provide a sensitivity check. Each condition has one run with seed 48; subsets and time points describe within-run variation.

Pretraining Results

CAST achieved the lowest training and mean validation losses among the nine baselines at step 5000 (Table 1). CAST’s mean validation loss was 1.26×10−21.26 \times10^{-2} below SSC-constant and 2.10×10−22.10 \times10^{-2} below SSC-cosine. CAST had lower loss on 20 and 19 subsets, respectively. SSC-cosine had higher training and mean validation losses than SSC-constant. AGC had the closest mean validation loss, with a gap of 1.18×10−21.18 \times10^{-2}. CAST’s training loss remained lowest across the 100-, 200-, and 500-step tail windows.

MethodTrain loss ↓Validation loss ↓CAST lower
CAST1.65161.8738—
GlobalGC1.67181.896219/20
AdaGC1.66251.887220/20
SSC-constant1.66381.886420/20
SSC-cosine1.67001.894719/20
GradientStabilizer1.68281.903418/20
GradPower1.68231.913920/20
ClipByValue1.67891.902220/20
AGC1.66411.885619/20
ZClip1.67111.893719/20

Table 1. Pretraining at 5,000 steps (83.89B nominal tokens). Train: mean over steps 4801–5000. Validation: unweighted mean over 20 subsets at step 5000. The final column counts subsets where CAST has lower loss. All runs use seed 48.

Figure 4 shows the loss curves. Appendix § 11 reports the losses for all 20 validation subsets.

Figure 4. Quality trajectories for all ten primary conditions. Training curves show trailing 100-step means from iteration 2000 onward; validation curves average the same 20 subsets at each complete checkpoint. Appendix § 12 includes the training trajectory from initialization.

Ablation Study

Table 2 compares CAST with three component variants. The variant without HS sets S=1S = 1, retaining the spectral EMA and AdamW’s moments. The other variants keep SS and use fixed τ=0.1\tau= 0.1 or cosine τ\tau in standardized coordinates. All three keep CAST’s calibration and output-norm controller for unselected tensors.

ConditionTrain lossValidation lossGate fraction
CAST1.65161.87380.884
w/o HS1.65411.87470.403
w/ τ=0.1\tau= 0.11.69371.92151.000
w/ cosine τ\tau1.67671.90341.000

Table 2. CAST component study (HS: historical scaling). Loss windows follow Table 1; bold marks the lowest values. Gate fraction is the mean share of eligible matrices entering SSC over steps 4801–5000.

The variant without HS increased training and mean validation losses by 2.42×10−32.42 \times10^{-3} and $8.96 \times

10−410^{-4}, respectively. CAST had lower loss on 18 validation subsets.

Replacing the fixed threshold with cosine decay lowered training and mean validation losses by 1.70×10−21.70 \times10^{-2} and 1.82×10−21.82 \times10^{-2}. CAST’s mean validation loss was 2.96×10−22.96 \times10^{-2} lower than the cosine-threshold variant’s. Both threshold variants activated SSC for every eligible matrix in the tail window.

Training Stability

Input-gradient spikes mark abrupt increases before clipping. Figure 6 shows these norms after learning-rate warmup. We count norms above 1 and relative spikes. A relative spike exceeds twice the preceding 100-step median, including pre-window points when needed. Both counts include consecutive exceedances. Relative spikes track sudden increases against each run’s recent gradient scale. The absolute count applies the same norm threshold across runs.

Figure 6. Raw input-gradient norms over iterations 501–5000 for ten primary conditions and three CAST ablations. The final row removes HS (historical scaling) or replaces the spectral EMA with fixed or cosine thresholds. All panels share a logarithmic vertical scale. Titles report relative spike counts; the dashed line marks norm 1. Table 3 gives the statistics.

Figure 5. Training trajectories for CAST and its three component variants (HS: historical scaling). Curves show trailing 100-step means from iteration 2000 onward; Table 2 reports their final training and validation losses.

CAST recorded one relative spike and no input norm above 1 during iterations 501–5000. SSC-constant and SSC-cosine recorded 22 and 21 relative spikes, respectively (Table 3). CAST and SSC-constant had similar median norms, while CAST had a smaller upper tail.

MethodMedian normP99 normMaximum normSteps with norm >1> 1Relative spikes
CAST0.15100.37020.547601
GlobalGC0.15410.457415.16101038
AdaGC0.13430.34851.054116
SSC-constant0.15910.47231.1829122
SSC-cosine0.16530.49961.1922221
GradientStabilizer0.17010.64134.1736531
GradPower0.11420.69874.914425422
ClipByValue0.16450.68145.02522258
AGC0.14250.47013.94162552
ZClip0.15401.2761918.78625275
CAST w/o HS0.14630.33820.454803
CAST w/ τ=0.1\tau= 0.10.12072.78534.05571946
CAST w/ cosine τ\tau0.10830.85051.6856212

Table 3. Input-gradient norms before clipping, steps 501–5000. P99: 99th percentile. Relative spikes exceed twice the preceding 100-step median, counting consecutive steps. Bold/underline: lowest/second-lowest counts, including ties. Last three rows: CAST ablations (HS: historical scaling).

Among the baselines, GradPower had the lowest median norm but 422 relative spikes. ZClip had the largest isolated norm, at 918.79, and 75 relative spikes. AdaGC had six relative spikes and a lower 99th-percentile norm than CAST. CAST combines the fewest relative spikes with the lowest mean validation loss.

Cosine decay reduced the fixed-threshold variant’s relative spikes from six to two and norms above 1 from 194 to 21.

Training Efficiency

Table 4 compares 64-device runs on the same hardware type. Each device has about 60% of an NVIDIA H100’s compute capacity. CAST takes 2.0% longer per step than SSC-constant and 1.9% longer than ClipByValue. Timings include execution and logging and vary with cluster load. AdaGC has the lowest final smoothed loss among the baselines. CAST first reaches this loss at step 4,639, using 7.2% fewer steps (Figure 7). At the mean step times in Table 4, reaching AdaGC’s loss target takes an estimated 5.5% less time than 5,000 ClipByValue steps.

MeasureCASTSSC-constantClipByValue
Mean (s)44.40843.53343.580
Median (s)44.20643.32943.375
P95 (s)44.87643.96044.119
Tokens/s/device590360226015

Table 4. Iteration times over steps 4801–5000 (200 steps per method, 64 devices). Mean is the arithmetic average; Median and P95 are the 50th and 95th percentiles. Throughput is 2048×8192/(64tˉ)2048 \times8192/(64\bar{t}), where tˉ\bar{t} is the mean iteration time in seconds. Timings include execution and logging.

Figure 7. Final 500 steps for CAST and nine baselines (100-step means). CAST reaches AdaGC’s final loss (dashed) at step 4,639. Colors follow Figure 9.

Conclusion

CAST uses two histories to guide spectral clipping in pretraining. AdamW’s previous second moment sets the gradient scale. An EMA of the clipped output’s estimated spectral norm sets each matrix’s threshold. In 5,000-step MoE pretraining, CAST achieved lower training and mean validation losses than nine baselines and three component variants. It also had the fewest relative gradient spikes. CAST reached AdaGC’s final smoothed loss in 7.2% fewer steps. Including per-step overhead, the estimated time saving is 5.5% relative to 5,000 ClipByValue steps. These results support using both histories to improve pretraining quality and efficiency.

Limitations

Full-matrix computation and communication times depend on tensor shape. The reported timings also reflect the cluster environment. Changes in hardware or training settings can also change the exact speedup. The timing comparison uses the same model, training settings, hardware type, and device count. This shared setup supports a fair comparison, so the estimated relative speedup remains a useful reference.

Numerical Details

Orientation and Normalization

For a standardized gradient Z∈Rm×nZ \in\mathbb{R}^{m \times n}, the implementation forms a full matrix BB with q=min⁡(m,n)q = \min(m,n) rows. It uses B=ZB = Z when m<nm < n, and B=ZTB = Z^{\mathsf{T}} otherwise, including square matrices. The output is transposed back before restoring SS. This convention makes the left Gram BBTBB^{\mathsf{T}} the smaller Gram.

The Newton–Schulz routine scales its inputs before forming the Gram matrix. Let

d∗=max⁡{τ,max⁡i,j∣Bij∣},d_* = \max\left\{\tau,\max_{i,j}\lvert B_{ij}\rvert\right\},
B0=B/d∗,t0=τ/d∗,B_0 = B/d_*, \qquad t_0 = \tau/d_*,
C0=B0B0T,u0=min⁡{∥C0∥F,∥C0∥∞}.(8)C_0 = B_0B_0^{\mathsf{T}}, \qquad u_0 = \min\{\lVert C_0\rVert_{\mathrm{F}},\lVert C_0\rVert_{\infty}\}. \tag*{(8)}

where ∥C0∥∞\lVert C_0\rVert_{\infty} is the maximum absolute row sum. The gate returns an unchanged gradient copy when u0≤t02u_0 \le t_0^2. In the active branch, define

α=t02+u0,A0=(t02I+C0)/α.(9)\alpha= t_0^2 + u_0, \qquad A_0 = (t_0^2I + C_0)/\alpha. \tag*{(9)}

Starting with (Y0,R0)=(A0,I)(Y_0,R_0)=(A_0,I), the coupled iteration is

Tj=12(3I−RjYj),T_j = \frac{1}{2}(3I - R_jY_j),
Yj+1=YjTj,Rj+1=TjRj.(10)Y_{j+1}=Y_jT_j, \qquad R_{j+1}=T_jR_j. \tag*{(10)}

The transformed matrix is

B~=(t0/α)R5B.(11)\widetilde{B} = (t_0/\sqrt{\alpha})R_5B. \tag*{(11)}

The rightmost factor is the original full matrix BB. An unrepresentable positive normalized threshold or a nonfinite intermediate raises a numerical error before state commit.

Spectral Norm Estimation

For a nonzero output XX, PowerTop(X,3)(X,3) starts from a normalized Gaussian vector xx. Each round normalizes XxXx and then XT(Xx/∥Xx∥2)X^{\mathsf{T}}(Xx/\lVert Xx\rVert_2). After three rounds, the observation is ∥Xx∥2\lVert Xx\rVert_2. The vector is seeded by the logical parameter identity, successful update index, and probe purpose, using base seed 1234. A degenerate normalization triggers one retry with a different seeded probe. A zero matrix supplies no positive observation.

State and Communication

Table 5 lists the controller settings.

Controller settingValue
Selected spectral spaceFull matrix
Newton–Schulz iterations5
Output power iterations3
Multiplier λ\lambda1.3
History decay βh\beta_h0.95
Calibration updates / cap40 / 1
Scale floor ρ\rho0.01
Scale epsilon ϵs\epsilon_s10−810^{-8}
History floors10−1210^{-12}
Probe seed1234
Additional global clippingNone

Table 5. Main-method controller settings. The training seed is separately fixed at 48.

Parameter Selection

Selection uses each complete logical parameter before optimizer sharding is restored. The spectral branch selects two-dimensional logical parameters in the dense optimizer group. It excludes parameters whose lowercase names contain an embedding/output exclusion marker. Those markers include embedding, lm_head, and output_layer; position embeddings are also excluded. The expert-matrix and embedding-matrix inclusion switches are both false. MoE projections and routers follow the same selection rule. Routing tensors assigned to the expert optimizer follow the norm branch even when their logical shape is two-dimensional. All other shapes also use the norm branch.

Calibration and State Updates

The first 40 successful global updates apply GlobalGC with norm cap 1. Each logical tensor separately counts its successful participating updates. Spectral observations begin when a valid previous second moment is available. The first positive observation initializes hh directly. Subsequent calibration observations use the ordinary EMA. The spectral branch becomes active once its history and previous second moment are ready and calibration is complete. A late-participating tensor uses norm cap 1 until ready.

For a tensor TT outside the spectral branch, the active transformation is

Tout=Tmin⁡{1,λf∥T∥F},(12)T_{\mathrm{out}} = T \min\left\{1, \frac{\lambda f}{\lVert T\rVert_{\mathrm{F}}}\right\}, \tag*{(12)}

with zero output for zero input. Positive output norms update ff with the same initialization and decay rules as hh. The histories have floor 10−1210^{-12}. There is no additional global cap after the active branches.

If an active tensor returns after a gap of Δ\Delta successful global updates, its history uses decay βhΔ\beta_h^{\Delta}. A missing gradient leaves state unchanged. A genuine zero gradient can advance participation without providing a positive history observation. Moment update counts, participation counts, and observation indices remain distinct. The optimizer stages transformed gradients and candidate controller states, then calls AdamW once. It commits the controller states only when that update succeeds. Checkpoints preserve these histories, counts, factored moment summaries, and a configuration fingerprint.

Gradient fragments are packed into buckets and all-gathered within the relevant data-parallel or expert-data-parallel group. Each rank reconstructs and transforms the same complete logical matrix, then writes its local optimizer slice. Full-matrix temporaries and communication therefore remain part of the implementation cost. The norm branch obtains its magnitudes through scalar reductions.

The row summary of the uncorrected moment obeys

rˉi,t=β2rˉi,t−1+(1−β2)1n∑j(Gout,t)ij2.(13)\bar{r}_{i,t} = \beta_2 \bar{r}_{i,t-1} + (1-\beta_2)\frac{1}{n}\sum_j \left(G_{\mathrm{out},t}\right)_{ij}^{2}. \tag*{(13)}

Column and global summaries follow the same update rule. Linearity makes these the corresponding means of AdamW’s second moment in exact arithmetic. Bias correction recovers the scale inputs in Equation (5). The optimizer still stores and uses its full moments. The summaries support clipping and avoid repeatedly gathering the full previous second moment.

Model and Baselines

Parameter Counts

Each of the 10 shortcut blocks contains two MLA attention modules, two dense SwiGLU modules, and one MoE module. The hidden width is 1536 and the dense feed-forward width is 3072. Each MLA has 16 heads, query low-rank width 384, and key/value low-rank width 128. Its non-RoPE query/key width is 128 per head, RoPE width is 64, and value width is 128. These dimensions give 5,734,912 parameters per MLA, including its low-rank normalization parameters.

Parameter componentCount across the model
20 MLA modules, including low-rank normalization114,698,240
20 dense SwiGLU modules283,115,520
Learned experts18,119,393,280
MoE input/output projections47,185,920
Routers13,762,560
Block and MoE normalization76,800
Input embedding and output projection503,316,480
Final normalization1,536
Total19,081,550,336
Target activated backbone, excluding embedding/output647,584,256

caption: Parameter counts from the recorded architecture and model source. Replicated parameters are counted once. The activated backbone uses the target of 32 learned experts per MoE module; the actual count varies across tokens. Selecting 48 learned experts per MoE module gives an upper bound of approximately 0.742B activated backbone parameters.

:::

Each MoE module contains 3,072 learned experts and 512 identity experts without feed-forward weights. Learned experts operate on 384-dimensional inputs with feed-forward width 512. Routing selects 48 candidates in total and targets 32 learned-expert activations per token; the actual learned-expert count varies with routing. The input embedding and output projection are untied, with vocabulary size 163840. Table 6 summarizes the parameter counts.

Baseline Settings

All transformations precede both AdamW moment updates. GlobalGC uses a global norm cap of 1. AdaGC uses per-tensor multiplier 1.04, EMA decay 0.99, and 100 calibration steps. These values come from AdaGC’s run configuration.

SSC-constant applies Equation (2) to the selected dense matrices in raw coordinates, with threshold 0.1 and five Newton–Schulz iterations. It starts immediately and passes all unselected tensors through unchanged. For square gradients, it forms the Gram matrix from the untransposed input. SSC-cosine replaces the fixed threshold with

τk=0.1+4.95[1+cos⁡(πuk)],uk=min⁡{k−14999,1}.(14)\tau_k = 0.1 + 4.95\left[1+\cos(\pi u_k)\right], \qquad u_k = \min\left\{\frac{k-1}{4999},1\right\}. \tag*{(14)}

Here kk is the one-based training iteration, including skipped updates. The threshold starts at 10 and reaches 0.1 at iteration 5000. It stays at 0.1 afterward.

GradientStabilizer uses global norm and squared-norm EMA decays 0.6 and 0.999, without bias correction or an extra global cap. GradPower applies GlobalGC(1), then the signed elementwise power with exponent 1.2. ClipByValue clamps each coordinate to [−0.1,0.1][-0.1,0.1] without another clipping step. AGC uses multiplier 0.01, weight-norm floor 10−310^{-3}, and gradient-norm floor 10−610^{-6}, including embedding and output tensors. ZClip uses decay 0.97, z-score threshold 2.5, 25 calibration steps, and epsilon 10−610^{-6}. It applies an additional norm cap of 1 without skipping spike steps.

The three component variants preserve CAST’s calibration and output-norm controller for unselected tensors. The variant without HS removes the clipping scale SS while retaining AdamW’s second moment. The fixed-threshold variant sets the selected spectral threshold to 0.1 while retaining HS. The cosine-threshold variant uses Equation (14) in the same standardized coordinates. Its schedule follows the training iteration throughout calibration and checkpoint resumes.

Validation Results

Table 7 includes every baseline and validation label. Question–answer and benchmark-formatted rows measure the configured token loss for those texts. Figure 8 shows the loss differences for each baseline and validation subset.

Figure 8. Every baseline-minus-CAST validation loss difference. Positive values favor CAST; outlined negative cells favor the baseline. Subsets correspond to Table 7.

LabelCASTGlobalGCAdaGCSSC-constantSSC-cosine
01 Academic / vocational2.24662.27182.25692.26012.2693
02 Clinical / health1.99512.0179<u>2.0054</u>2.00782.0168
03 Consumer / leisure2.18242.2031<u>2.1924</u>2.19352.2026
04 Economy / services2.01752.04342.0310<u>2.0309</u>2.0399
05 IT / programming1.85191.8727<u>1.8631</u>1.86461.8713
06 Periodicals2.76192.78552.7760<u>2.7744</u>2.7822
07 Regional culture2.10472.1263<u>2.1155</u>2.11642.1243
08 Science / technology1.86521.8862<u>1.8752</u>1.87821.8852
09 Sports / vehicles2.26992.29442.2844<u>2.2838</u>2.2921
10 CMMLU text1.40371.43551.42181.43631.4444
11 Open-source code A0.93680.95200.94500.94330.9495
12 Open-source code B0.93670.95180.94490.94320.9493
13 English books2.98163.00432.9952<u>2.9944</u>2.9987
14 FullStackBench text1.13981.17261.1725<u>1.1415</u>1.1682
15 GSM8K text0.75070.76560.75260.76040.7587
16 HumanEval text1.14601.14161.16121.1466<u>1.1357</u>
17 MMLU text<u>1.4045</u>1.44351.43551.42631.4555
18 English web2.75582.7810<u>2.7697</u>2.77092.7797
19 Chinese essays3.95683.9867<u>3.9759</u>3.97893.9880
20 Software engineering0.76790.7873<u>0.7703</u>0.77670.7831
LabelGSGradPowerValueAGCZClip
01 Academic / vocational2.28492.29432.28012.26032.2716
02 Clinical / health2.03042.04012.02552.00822.0181
03 Consumer / leisure2.21952.22732.21242.19382.2050
04 Economy / services2.05752.06452.05122.03292.0422
05 IT / programming1.88641.89411.88071.86341.8758
06 Periodicals2.79602.80022.79142.77662.7865
07 Regional culture2.13912.14792.13302.11682.1267
08 Science / technology1.89921.90721.89441.87731.8881
09 Sports / vehicles2.30962.31622.30252.28402.2947
10 CMMLU text1.40101.44141.43441.41421.4178
11 Open-source code A0.95860.96040.9525<u>0.9427</u>0.9534
12 Open-source code B0.95850.96030.9524<u>0.9426</u>0.9532
13 English books3.02113.02423.00982.99573.0059
14 FullStackBench text1.17781.17021.16941.15261.1626
15 GSM8K text0.77600.77700.7680<u>0.7510</u>0.7664
16 HumanEval text1.16511.18351.17181.13511.1394
17 MMLU text1.39341.45971.43591.4423<u>1.4108</u>
18 English web2.79812.80582.78882.77162.7816
19 Chinese essays4.00754.01023.99843.97663.9908
20 Software engineering0.78820.79390.79180.77370.7830

Table 7. Token LM losses on all 20 validation subsets at iteration 5000. Bold and underline mark the best and second-best values across all ten conditions, spanning both panels. GS is GradientStabilizer; Value is ClipByValue.

Full Training Curves

The full training overview is shown in Figure 9. The main-text Figure 6 and Table 3 contain the input-gradient traces and statistics for these conditions.

Figure 9. Training from the first complete 100-step averaging window through iteration 5000. All ten primary conditions and three CAST ablations (HS: historical scaling) use trailing 100-step means. The main plot uses a logarithmic vertical axis; the box and connected inset show the final 500 steps on a linear scale.

References

  1. [1]Andy Brock, Soham De, Samuel L Smith, and Karen Simonyan. 2021. High-performance large-scale image recognition without normalization. In International conference on machine learning, pages 1059–1071. PMLR.arxiv.org/abs/2102.06171
  2. [2]Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, and 12 others. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc.arxiv.org/abs/2005.14165
  3. [3]Weilin Cai, Juyong Jiang, Le Qin, Junwei Cui, Sunghun Kim, and Jiayi Huang. 2025. Shortcut-connected expert parallelism for accelerating mixture-of-experts. Preprint, arXiv:2404.05019.arxiv.org/abs/2404.05019
  4. [4]DeepSeek-AI, Aixin Liu, Bei Feng, Bin Wang, Bingxuan Wang, Bo Liu, Chenggang Zhao, Chengqi Deng, Chong Ruan, Damai Dai, Daya Guo, Dejian Yang, Deli Chen, Dongjie Ji, Erhang Li, Fangyun Lin, Fuli Luo, Guangbo Hao, Guanting Chen, and 138 others. 2024. Deepseek-v2: A strong, economical, and efficient mixture-of-experts language model. Preprint, arXiv:2405.04434.arxiv.org/abs/2405.04434
  5. [5]DeepSeek-AI, Anyi Xu, Bangcai Lin, Bing Xue, Bingxuan Wang, Bingzheng Xu, Bochao Wu, Bowei Zhang, Chaofan Lin, Chen Dong, Chenchen Ling, Chengda Lu, Chenggang Zhao, Chengqi Deng, Chengyu Hou, Chenhao Xu, Chenze Shao, Chong Ruan, Conner Sun, and 300 others. 2026. Deepseek-v4: Towards highly efficient million-token context intelligence. Preprint, arXiv:2606.19348.
  6. [6]William Fedus, Barret Zoph, and Noam Shazeer. 2022. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. Journal of Machine Learning Research, 23(120):1–39.arxiv.org/abs/2101.03961
  7. [7]Tianjin Huang, Zhangyang Wang, Haotian Hu, Zhenyu Zhang, Gaojie Jin, Xiang Li, Li Shen, Jiaxiang Shang, Tianlong Chen, Ke Li, Lu Liu, Qingsong Wen, andarxiv.org/abs/2502.17055
  8. [9]Albert Q. Jiang, Alexandre Sablayrolles, Antoine Roux, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Sandeep Subramanian, Sophia Yang, and 7 others. 2024. Mixtral of experts. Preprint, arXiv:2401.04088.arxiv.org/abs/2401.04088
  9. [10]Xiaowen Jiang, Andrei Semenov, and Sebastian U. Stich. 2026. Enhancing llm training via spectral clipping. Preprint, arXiv:2603.14315.arxiv.org/abs/2603.14315
  10. [11]Keller Jordan, Yuchen Jin, Vlado Boza, You Jiacheng, Franz Cesista, Laker Newhouse, and Jeremy Bernstein. 2024. Muon: An optimizer for hidden layers in neural networks, 2024. URL https://kellerjordan.github.io/posts/muon, 6(3):4.
  11. [12]Diederik P. Kingma and Jimmy Ba. 2017. Adam: A method for stochastic optimization. Preprint, arXiv:1412.6980.arxiv.org/abs/1412.6980
  12. [13]Abhay Kumar, Louis Owen, Nilabhra Roy Chowdhury, and Fabian Güra. 2025. Zclip: Adaptive spike mitigation for llm pre-training. Preprint, arXiv:2504.02507.arxiv.org/abs/2504.02507
  13. [14]Aixin Liu, Bei Feng, Bing Xue, Bingxuan Wang, Bochao Wu, Chengda Lu, Chenggang Zhao, Chengqi Deng, Chenyu Zhang, Chong Ruan, et al. 2024. Deepseek-v3 technical report. arXiv preprint arXiv:2412.19437.arxiv.org/abs/2412.19437
  14. [15]Jingyuan Liu, Jianlin Su, Xingcheng Yao, Zhejun Jiang, Guokun Lai, Yulun Du, Yidao Qin, Weixin Xu, Enze Lu, Junjie Yan, Yanru Chen, Huabin Zheng, Yibo Liu, Shaowei Liu, Bohong Yin, Weiran He, Han Zhu, Yuzhi Wang, Jianzhou Wang, and 9 others. 2025. Muon is scalable for llm training. Preprint, arXiv:2502.16982.arxiv.org/abs/2502.16982
  15. [16]Ilya Loshchilov and Frank Hütter. 2019. Decoupled weight decay regularization. Preprint, arXiv:1711.05101.arxiv.org/abs/1711.05101
  16. [17]Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, and Hao Wu. 2018. Mixed precision training. Preprint, arXiv:1710.03740.
  17. [18]Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. 2013. On the difficulty of training recurrent neural networks. In International conference on machine learning, pages 1310–1318. Pmlr.arxiv.org/abs/1211.5063
  18. [20]Noam Shazeer and Mitchell Stern. 2018. Adafactor: Adaptive learning rates with sublinear memory cost. In International conference on machine learning, pages 4596–4604. PMLR.arxiv.org/abs/1804.04235
  19. [21]Kimi Team, Tongtong Bai, Yifan Bai, Yiping Bao, M. C., Jianfeng Cai, Xinyuan Cai, Peizhou Cao, Yuxuan Cao, Ziwei Chai, Y. Charles, H. S. Che, Guanduo Chen, Guangyu Chen, Guanzheng Chen, Huarong Chen, Jia Chen, Jianlong Chen, Jun Chen, and 383 others. 2026. Kimi k3: Open frontier intelligence. Preprint, arXiv:2607.24653.
  20. [22]Kimi Team, Yifan Bai, Yiping Bao, Guanduo Chen, Jiahao Chen, Ningxin Chen, Ruijue Chen, Yanru Chen, Yuankun Chen, Yutian Chen, Zhuofru Chen, Jialei Cui, Hao Ding, Mengnan Dong, Angang Du, Chenzhuang Du, Dikang Du, Yulun Du, Yu Fan, and 150 others. 2025a. Kimi k2: Open agentic intelligence. Preprint, arXiv:2507.20534.
  21. [23]Meituan LongCat Team, Bayan, Bei Li, Bingye Lei, Bo Wang, Bolin Rong, Chao Wang, Chao Zhang, Chen Gao, Chen Zhang, Cheng Sun, Chengcheng Han, Chenguang Xi, Chi Zhang, Chong Peng, Chuan Qin, Chuyu Zhang, Cong Chen, Congkui Wang, and 163 others. 2025b. Longcat-flash technical report. Preprint, arXiv:2509.01322.arxiv.org/abs/2509.01322
  22. [24]Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. Advances in neural information processing systems, 30.arxiv.org/abs/1706.03762
  23. [25]Guoxia Wang, Shuai Li, Congliang Chen, Jinle Zeng, JIabian Yang, Dianhai Yu, Yanjun Ma, and Li Shen. 2026a. Adagc: Enhancing llm pretraining stability via adaptive gradient clipping. Preprint, arXiv:2502.11034.arxiv.org/abs/2502.11034
  24. [26]Jinbo Wang, Mingze Wang, Jiaqi Zhang, Wei Wang, Peng Pei, Xunliang Cai, Weinan E, and Leilei Wu. 2026b. Gradpower: Powering gradients for faster language model pre-training. Preprint, arXiv:2505.24275.arxiv.org/abs/2505.24275
  25. [27]An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chengchen Huang, Chenxu Lv, Chujie Zheng, Dayiheng Liu, Fan Zhou, Fei Huang, Feng Hu, Hao Ge, Haoran Wei, Huan Lin, Jialong Tang, and 41 others. 2025. Qwen3 technical report. Preprint, arXiv:2505.09388.arxiv.org/abs/2505.09388
  26. [28]Jingzhao Zhang, Tianxing He, Suvrit Sra, and Ali Jadbabaie. 2020. Why gradient clipping for adaptivity: A theoretical justification for adaptivity. Preprint, arXiv:1905.11881.arxiv.org/abs/1905.11881

Paper details

vlnc:W_8yzfqc65
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 9

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents