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.

Figure 2. CAST adds historical scaling (HS) and output feedback around SSC (Algorithm 1). AdamW uses restored ; its becomes the next , bias-corrected within . The EMA tracks the estimated . 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: , ; threshold ; iterations
Ensure: Output and clipping flag
if then
return
end if
;
;
for do
;
end for
return
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 and threshold , the SPECTRA soft map is
It slightly reduces small singular values and applies a stronger reduction to larger ones. For with , its matrix form is
The inverse square root acts on the full 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 with Newton–Schulz iterations. We also return a Boolean 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 , following the functional view of SSC in Jiang et al. [10]. (b) The same soft map at for three illustrative values of the previous output history . 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 be a gradient after accumulation, distributed reduction, and mixed-precision unscaling. We transform it into before either AdamW moment is updated:
AdamW then applies its usual bias correction and decoupled weight decay. We write and for elementwise multiplication and division, and 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 moment updates, let denote the bias-corrected previous second moment. Its row, column, and overall means are
Algorithm 2 CAST gradient preprocessing for AdamW
Require: Gradients , old corrected moments , histories
for each selected matrix after calibration do
HS
▷ Equation (5)
;
Threshold from output history
▷ Algorithm 1
if then
end if
if then
Stage
end if
end for
Clip other tensors with the historical norm rule
Apply AdamW to all transformed gradients
Commit staged state after a successful update
With and , define
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 .
Adaptive Thresholds
We adapt the clipping threshold separately for each selected gradient matrix. Each matrix maintains a positive scalar history of its clipped output’s estimated spectral norm. The current threshold uses its previous value:
We orient so that has the smaller dimension as its row count, then call Algorithm 1 with . When the algorithm returns , we keep the original directly. Otherwise, we restore the clipped matrix to ’s orientation and set .
The controller observes the complete standardized output through three power iterations:
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 , where 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 , its matrix arithmetic costs , with and . § 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 , , and weight decay 0.1. The learning rate reaches 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 . SSC-cosine decays 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 below SSC-constant and 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 . CAST’s training loss remained lowest across the 100-, 200-, and 500-step tail windows.
| Method | Train loss ↓ | Validation loss ↓ | CAST lower |
| CAST | 1.6516 | 1.8738 | — |
| GlobalGC | 1.6718 | 1.8962 | 19/20 |
| AdaGC | 1.6625 | 1.8872 | 20/20 |
| SSC-constant | 1.6638 | 1.8864 | 20/20 |
| SSC-cosine | 1.6700 | 1.8947 | 19/20 |
| GradientStabilizer | 1.6828 | 1.9034 | 18/20 |
| GradPower | 1.6823 | 1.9139 | 20/20 |
| ClipByValue | 1.6789 | 1.9022 | 20/20 |
| AGC | 1.6641 | 1.8856 | 19/20 |
| ZClip | 1.6711 | 1.8937 | 19/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 , retaining the spectral EMA and AdamW’s moments. The other variants keep and use fixed or cosine in standardized coordinates. All three keep CAST’s calibration and output-norm controller for unselected tensors.
| Condition | Train loss | Validation loss | Gate fraction |
| CAST | 1.6516 | 1.8738 | 0.884 |
| w/o HS | 1.6541 | 1.8747 | 0.403 |
| w/ | 1.6937 | 1.9215 | 1.000 |
| w/ cosine | 1.6767 | 1.9034 | 1.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 and $8.96 \times
, respectively. CAST had lower loss on 18 validation subsets.
Replacing the fixed threshold with cosine decay lowered training and mean validation losses by and . CAST’s mean validation loss was 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.
| Method | Median norm | P99 norm | Maximum norm | Steps with norm | Relative spikes |
| CAST | 0.1510 | 0.3702 | 0.5476 | 0 | 1 |
| GlobalGC | 0.1541 | 0.4574 | 15.1610 | 10 | 38 |
| AdaGC | 0.1343 | 0.3485 | 1.0541 | 1 | 6 |
| SSC-constant | 0.1591 | 0.4723 | 1.1829 | 1 | 22 |
| SSC-cosine | 0.1653 | 0.4996 | 1.1922 | 2 | 21 |
| GradientStabilizer | 0.1701 | 0.6413 | 4.1736 | 5 | 31 |
| GradPower | 0.1142 | 0.6987 | 4.9144 | 25 | 422 |
| ClipByValue | 0.1645 | 0.6814 | 5.0252 | 22 | 58 |
| AGC | 0.1425 | 0.4701 | 3.9416 | 25 | 52 |
| ZClip | 0.1540 | 1.2761 | 918.7862 | 52 | 75 |
| CAST w/o HS | 0.1463 | 0.3382 | 0.4548 | 0 | 3 |
| CAST w/ | 0.1207 | 2.7853 | 4.0557 | 194 | 6 |
| CAST w/ cosine | 0.1083 | 0.8505 | 1.6856 | 21 | 2 |
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.
| Measure | CAST | SSC-constant | ClipByValue |
| Mean (s) | 44.408 | 43.533 | 43.580 |
| Median (s) | 44.206 | 43.329 | 43.375 |
| P95 (s) | 44.876 | 43.960 | 44.119 |
| Tokens/s/device | 5903 | 6022 | 6015 |
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 , where 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 , the implementation forms a full matrix with rows. It uses when , and otherwise, including square matrices. The output is transposed back before restoring . This convention makes the left Gram the smaller Gram.
The Newton–Schulz routine scales its inputs before forming the Gram matrix. Let
where is the maximum absolute row sum. The gate returns an unchanged gradient copy when . In the active branch, define
Starting with , the coupled iteration is
The transformed matrix is
The rightmost factor is the original full matrix . An unrepresentable positive normalized threshold or a nonfinite intermediate raises a numerical error before state commit.
Spectral Norm Estimation
For a nonzero output , PowerTop starts from a normalized Gaussian vector . Each round normalizes and then . After three rounds, the observation is . 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 setting | Value |
| Selected spectral space | Full matrix |
| Newton–Schulz iterations | 5 |
| Output power iterations | 3 |
| Multiplier | 1.3 |
| History decay | 0.95 |
| Calibration updates / cap | 40 / 1 |
| Scale floor | 0.01 |
| Scale epsilon | |
| History floors | |
| Probe seed | 1234 |
| Additional global clipping | None |
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 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 outside the spectral branch, the active transformation is
with zero output for zero input. Positive output norms update with the same initialization and decay rules as . The histories have floor . There is no additional global cap after the active branches.
If an active tensor returns after a gap of successful global updates, its history uses decay . 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
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 component | Count across the model |
| 20 MLA modules, including low-rank normalization | 114,698,240 |
| 20 dense SwiGLU modules | 283,115,520 |
| Learned experts | 18,119,393,280 |
| MoE input/output projections | 47,185,920 |
| Routers | 13,762,560 |
| Block and MoE normalization | 76,800 |
| Input embedding and output projection | 503,316,480 |
| Final normalization | 1,536 |
| Total | 19,081,550,336 |
| Target activated backbone, excluding embedding/output | 647,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
Here 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 without another clipping step. AGC uses multiplier 0.01, weight-norm floor , and gradient-norm floor , including embedding and output tensors. ZClip uses decay 0.97, z-score threshold 2.5, 25 calibration steps, and epsilon . 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 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.
| Label | CAST | GlobalGC | AdaGC | SSC-constant | SSC-cosine |
| 01 Academic / vocational | 2.2466 | 2.2718 | 2.2569 | 2.2601 | 2.2693 |
| 02 Clinical / health | 1.9951 | 2.0179 | <u>2.0054</u> | 2.0078 | 2.0168 |
| 03 Consumer / leisure | 2.1824 | 2.2031 | <u>2.1924</u> | 2.1935 | 2.2026 |
| 04 Economy / services | 2.0175 | 2.0434 | 2.0310 | <u>2.0309</u> | 2.0399 |
| 05 IT / programming | 1.8519 | 1.8727 | <u>1.8631</u> | 1.8646 | 1.8713 |
| 06 Periodicals | 2.7619 | 2.7855 | 2.7760 | <u>2.7744</u> | 2.7822 |
| 07 Regional culture | 2.1047 | 2.1263 | <u>2.1155</u> | 2.1164 | 2.1243 |
| 08 Science / technology | 1.8652 | 1.8862 | <u>1.8752</u> | 1.8782 | 1.8852 |
| 09 Sports / vehicles | 2.2699 | 2.2944 | 2.2844 | <u>2.2838</u> | 2.2921 |
| 10 CMMLU text | 1.4037 | 1.4355 | 1.4218 | 1.4363 | 1.4444 |
| 11 Open-source code A | 0.9368 | 0.9520 | 0.9450 | 0.9433 | 0.9495 |
| 12 Open-source code B | 0.9367 | 0.9518 | 0.9449 | 0.9432 | 0.9493 |
| 13 English books | 2.9816 | 3.0043 | 2.9952 | <u>2.9944</u> | 2.9987 |
| 14 FullStackBench text | 1.1398 | 1.1726 | 1.1725 | <u>1.1415</u> | 1.1682 |
| 15 GSM8K text | 0.7507 | 0.7656 | 0.7526 | 0.7604 | 0.7587 |
| 16 HumanEval text | 1.1460 | 1.1416 | 1.1612 | 1.1466 | <u>1.1357</u> |
| 17 MMLU text | <u>1.4045</u> | 1.4435 | 1.4355 | 1.4263 | 1.4555 |
| 18 English web | 2.7558 | 2.7810 | <u>2.7697</u> | 2.7709 | 2.7797 |
| 19 Chinese essays | 3.9568 | 3.9867 | <u>3.9759</u> | 3.9789 | 3.9880 |
| 20 Software engineering | 0.7679 | 0.7873 | <u>0.7703</u> | 0.7767 | 0.7831 |
| Label | GS | GradPower | Value | AGC | ZClip |
| 01 Academic / vocational | 2.2849 | 2.2943 | 2.2801 | 2.2603 | 2.2716 |
| 02 Clinical / health | 2.0304 | 2.0401 | 2.0255 | 2.0082 | 2.0181 |
| 03 Consumer / leisure | 2.2195 | 2.2273 | 2.2124 | 2.1938 | 2.2050 |
| 04 Economy / services | 2.0575 | 2.0645 | 2.0512 | 2.0329 | 2.0422 |
| 05 IT / programming | 1.8864 | 1.8941 | 1.8807 | 1.8634 | 1.8758 |
| 06 Periodicals | 2.7960 | 2.8002 | 2.7914 | 2.7766 | 2.7865 |
| 07 Regional culture | 2.1391 | 2.1479 | 2.1330 | 2.1168 | 2.1267 |
| 08 Science / technology | 1.8992 | 1.9072 | 1.8944 | 1.8773 | 1.8881 |
| 09 Sports / vehicles | 2.3096 | 2.3162 | 2.3025 | 2.2840 | 2.2947 |
| 10 CMMLU text | 1.4010 | 1.4414 | 1.4344 | 1.4142 | 1.4178 |
| 11 Open-source code A | 0.9586 | 0.9604 | 0.9525 | <u>0.9427</u> | 0.9534 |
| 12 Open-source code B | 0.9585 | 0.9603 | 0.9524 | <u>0.9426</u> | 0.9532 |
| 13 English books | 3.0211 | 3.0242 | 3.0098 | 2.9957 | 3.0059 |
| 14 FullStackBench text | 1.1778 | 1.1702 | 1.1694 | 1.1526 | 1.1626 |
| 15 GSM8K text | 0.7760 | 0.7770 | 0.7680 | <u>0.7510</u> | 0.7664 |
| 16 HumanEval text | 1.1651 | 1.1835 | 1.1718 | 1.1351 | 1.1394 |
| 17 MMLU text | 1.3934 | 1.4597 | 1.4359 | 1.4423 | <u>1.4108</u> |
| 18 English web | 2.7981 | 2.8058 | 2.7888 | 2.7716 | 2.7816 |
| 19 Chinese essays | 4.0075 | 4.0102 | 3.9984 | 3.9766 | 3.9908 |
| 20 Software engineering | 0.7882 | 0.7939 | 0.7918 | 0.7737 | 0.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]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]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]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]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]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]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]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
- [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
- [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
- [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.
- [12]Diederik P. Kingma and Jimmy Ba. 2017. Adam: A method for stochastic optimization. Preprint, arXiv:1412.6980.arxiv.org/abs/1412.6980
- [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
- [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
- [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
- [16]Ilya Loshchilov and Frank Hütter. 2019. Decoupled weight decay regularization. Preprint, arXiv:1711.05101.arxiv.org/abs/1711.05101
- [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.
- [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
- [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
- [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.
- [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.
- [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
- [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
- [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
- [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
- [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
- [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







