Training Stability
local graph
Module 23 — Training Stability
Section titled “Module 23 — Training Stability”Training instability is one of the most expensive failure modes in large language model development. A run that has consumed weeks of accelerator time can degrade within a single forward pass, and the cost of rediscovering the cause is substantial. This module examines why instability occurs, how it surfaces in observable training signals, and what interventions keep a run on course. The analysis moves from symptoms visible at the level of the loss curve down into the gradient dynamics that produce them. Data quality issues that survive an apparently clean pipeline can also manifest as training pathologies, and those connections receive careful attention. The module closes with the monitoring and checkpointing practices that make recovery feasible when instability does occur.
Loss Spikes, Divergence, and Collapse
Section titled “Loss Spikes, Divergence, and Collapse”Loss curves during pretraining typically descend smoothly for long stretches of training. When that descent is interrupted by a sudden upward excursion, the event is called a loss spike. A loss spike may recover within a few hundred steps and return the trajectory to its prior path. In other cases the spike persists and evolves into something worse. Chowdhery et al. (2022) described how the team behind PaLM observed dozens of such spikes during training of large configurations. Their empirical response was to restart from a recent checkpoint and skip the offending batches of data, a procedure that became part of the operational playbook for large-scale pretraining.
The mechanism behind a loss spike is almost always a sequence of updates in which a small set of outlier gradients pushes the weights into a region of the loss surface where the model produces qualitatively worse predictions. Once that happens, the next batch of data generates another large gradient, because the model is now far from the configuration that was producing useful outputs. Whether the run can recover depends on whether the optimizer can find its way back to a productive region before the damage accumulates beyond repair.
Divergence describes the condition where loss values begin to grow without bound. Once a model enters this state, gradient magnitudes typically amplify in subsequent updates, producing further corruption of weights. The model at that point no longer produces coherent predictions, and continuing the run wastes compute. Divergence is often preceded by warning signs in gradient norms and parameter statistics, which is why observability practices matter so much. A run that is trending toward divergence frequently shows rising gradient magnitudes for many steps before the loss itself begins to climb, giving practitioners a window in which intervention is still possible.
Representation collapse is a subtler failure mode. Under collapse, the model may maintain acceptable loss values while producing output distributions that are narrow or degenerate. The internal representations converge to low-rank patterns that fail to capture the variety present in the data. Jing et al. (2022) analyzed collapse phenomena in self-supervised learning and showed how they arise from insufficient diversity in the objective signal. Collapse is particularly dangerous because validation loss sometimes appears acceptable while generation quality has silently deteriorated, making the problem invisible until downstream evaluation exposes it.
Understanding the mechanism that produces a given failure mode is what separates superficial responses from durable fixes. A loss spike triggered by a pathological batch of data calls for a data-side investigation. A spike caused by numerical overflow in mixed-precision arithmetic calls for a change in the numerical configuration instead. Treating every spike with the same remedy wastes engineering effort and often fails to prevent recurrence.
Gradient-Level Instability
Section titled “Gradient-Level Instability”The central mechanism behind many loss spikes is gradient explosion. When backpropagated signals grow multiplicatively through a deep stack of layers, the resulting parameter update can push weights far outside any region the optimizer has previously explored. The risk grows with depth because each additional layer provides another opportunity for amplification of a signal that was already outside the nominal range.
Gradient clipping (Module 21) is the standard intervention. A common threshold is 1.0 on the global L2 norm, though values used in practice vary with architecture and batch size. Some implementations supplement global clipping with per-parameter bounds, which can be useful when specific parameter groups show systematically larger gradients than others.
Vanishing gradients produce a different pathology. When gradients become too small to effect meaningful updates, training slows or stalls entirely. Deep residual architectures with careful normalization largely address this concern in modern transformer designs, though poor initialization or unstable normalization statistics can still produce regions of the network where signals fail to reach earlier layers. The choice between pre-normalization and post-normalization placement in a transformer block directly affects gradient flow, and pre-normalization is generally preferred for large-scale training because it produces more stable propagation characteristics across deep stacks (Module 04).
The interaction between batch composition and loss scale also matters. When a batch happens to contain examples that produce unusually large per-token losses, the averaged gradient can exceed the range that the current loss scale was configured to handle. The result may be a transient overflow that is silently suppressed by the dynamic scaler, leaving the model to continue with an effectively skipped update. Infrequent overflows are acceptable, but a sudden rise in their rate is a warning that batch composition has drifted in a way that will soon affect the loss curve.
Data-Driven Instability
Section titled “Data-Driven Instability”Many training pathologies that look like optimizer problems trace back to issues in the training corpus itself. Near-duplicate sequences are one common culprit. When a batch contains many copies of the same document, the gradient signal becomes heavily biased toward reproducing that document, producing an outsized update in one direction.
Domain imbalance creates a related effect. If a particular category of text is overrepresented relative to its value for the target capability, the loss surface becomes unusually steep in directions that serve that category. The optimizer can then take steps that are well calibrated for the overrepresented domain and destructive for others. The manifestation at the loss level can look like a sudden jump when training encounters a batch from an underrepresented domain after a long stretch of the overrepresented one. Investigating such jumps often reveals curriculum problems that were invisible during corpus construction.
Malformed examples that survived the cleaning pipeline present another kind of hazard. An example containing an unusually long repetition of a single token can produce gradients far outside the normal distribution, as can a file that was improperly decoded or an encoded block of binary content that was never converted back to text. These examples are rare in well-curated corpora, which is exactly why their effect is dangerous. They appear seldom enough to be difficult to catch during spot checking, yet often enough over a long run that their cumulative effect on stability becomes substantial. A corpus that looked clean during a sampled review can still contain thousands of pathological sequences in absolute terms.
The connection between data and instability matters because the remedy for a data-induced spike differs from the remedy for a numerical one.
Skipping a problematic batch and resuming from a checkpoint costs only a few minutes of lost progress. Increasing clipping aggressiveness or lowering the learning rate after a data-induced spike dampens learning throughout the remainder of the run without addressing the actual cause, which makes correct diagnosis important before any configuration adjustment. Teams that invest in data-side forensics often recover this cost many times over by preventing the same pathology from triggering further spikes later in the run.
Monitoring and Recovery Strategies
Section titled “Monitoring and Recovery Strategies”Instability becomes tractable when it is detectable early. Running a large training job without observability is like flying an aircraft without instruments, because the symptoms of trouble often precede catastrophic failure by thousands of steps. Practitioners monitor loss at high frequency, typically every training step, and supplement that signal with gradient norm statistics that reveal when updates are becoming unusual before they affect the loss itself. Parameter statistics such as weight norms per layer expose slower drifts that loss alone would miss. Together these signals provide a multi-scale view of training health that a single metric cannot deliver.
Learning rate and optimizer state also warrant logging. An Adam optimizer with corrupted second-moment estimates can produce updates whose magnitudes appear reasonable even as their direction moves weights in counterproductive directions. The only way to detect that condition is to inspect the optimizer state directly. Gradient statistics disaggregated by layer group can localize where instability originates, which helps when debugging interactions between architectural choices and training dynamics. Some teams log histograms of gradient magnitudes at regular intervals so that distributional changes become apparent well before summary statistics reflect them.
Checkpointing converts monitoring from diagnosis into recovery. A checkpoint captures the full state required to resume a training run. The model weights are the most visible component. The optimizer state is equally required, because Adam-style optimizers maintain moment estimates that would reset on reload if those estimates were not preserved.
When divergence does occur, recovery usually means loading a checkpoint from before the problem manifested and resuming with an adjusted configuration. Large-scale training operators use systematic rollback procedures that combine checkpoint loading with data-batch skipping to move past deterministic failure triggers without restarting the full run. The operational discipline here matters as much as the technical configuration, because every rollback consumes engineering attention and compute, and accumulated rollback time can dominate the effective training budget on long runs. Teams that automate the detection-to-rollback pipeline, so that a loss spike automatically triggers a candidate rollback plan, substantially reduce the lag between failure and recovery. Automation also removes the risk that a human operator will make a hurried decision under the pressure of an active incident, when the temptation to lower the learning rate or tighten clipping globally can introduce lasting damage to the run if the actual cause was local to a particular batch of data.
╭──╮ rollback├──○──○──○──○──┼──○──○──○──○──┼──○──○──○──◯──▲──○──○──○──○──┤Day 1 Day 8 Day 15 Day 22 Day 30Step 0 Step 50k Step 100k Step 150k Step 200k
○ Checkpoint ◯ Recovery point ▲ Loss spikeFigure 4-8