Manuscript Offprint

arXiv:2610.19761

CAST: History-Adaptive Spectral Clipping for LLM Pretraining

Jiacheng Li, Jianchao Tan, Kefeng Zhang, Yuchen Xie, Xunliang Cai

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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.

1 Introduction

Gradient clipping(Zhang et al., 2020) controls large gradients during language model(Team et al., 2025b; Brown et al., 2020; Liu et al., 2024; Yang et al., 2025; DeepSeek-AI et al., 2026; Team et al., 2025a, 2026) pretraining (Pascanu et al., 2013). When applied before AdamW, it also changes the moment estimates used by later updates (Loshchilov and Hutter, 2019). 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(Jiang et al., 2026) develops a smooth spectral transformation for appli-

Figure

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.

cation before or after a base optimizer(Loshchilov and Hutter, 2019; Kingma and Ba, 2017; Jordan et al., 2024). 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. SPEC-TRA'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

∗^{*}Corresponding author.

Figure

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

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.

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.

References (26)