To FP8 and Back Again: Quantifying the Effects of Reducing Precision on LLM Training Stability

Joonhyung Lee, Jeongin Bae, Byeongwook Kim, Se Jung Kwon, Dongsoo Lee · OpenReview

Abstract

The massive computational costs associated with large language model (LLM) pretraining have spurred great interest in reduced-precision floating-point representations to accelerate the process. As a result, the BrainFloat16 (BF16) precision has become the de facto standard for LLM training, with hardware support included in recent accelerators. This trend has gone even further in the latest processors, where FP8 has recently been introduced. However, prior experience with FP16, which was found to be less stable than BF16, raises concerns as to whether FP8, with even fewer bits than FP16, can be a cost-effective option for LLM training. We argue that reduced-precision training schemes must have similar training stability and hyperparameter sensitivities to their higher-precision counterparts in order to be cost-effective. However, we find that currently available methods for FP8 training are not robust enough to allow their use as economical replacements. This prompts us to investigate the stability of reduced-precision LLM training in terms of robustness across random seeds and learning rates. To this end, we propose new evaluation techniques and a new metric for quantifying loss landscape sharpness in autoregressive language models. By simulating incremental bit reductions in floating-point representations, we analyze the relationship between representational power and training stability with the intent of aiding future research into the field.

Introduction

Training Large Language Models (LLMs) is a massive financial and computational undertaking. To optimize throughput and reduce costs, the industry has transitioned from 32-bit (FP32) to 16-bit (BF16) precision, with a current push toward 8-bit (FP8) formats. However, this transition introduces a significant hidden cost: training instability.

When a training run diverges—characterized by the loss spiking toward infinity—the resulting loss of time for restarts and the necessity for extensive hyperparameter re-tuning can quickly negate the hardware efficiency gains of lower precision. For FP8 to be a truly viable "economical replacement" for BF16, it must demonstrate comparable robustness. Our research suggests that current FP8 implementations fall short of this standard, significantly narrowing the "safe" window for hyperparameters and data quality.

Training loss divergence across different random seeds.

Methodology

To quantify the stability gap, we employed several novel experimental techniques:

Bit-Reduction Simulation

Rather than a binary comparison between BF16 and FP8, we simulated intermediate precisions by systematically masking (clipping) mantissa bits. This allowed us to observe the granular decay of stability from E8M7 (standard BF16) down to E8M3. Our findings indicate that stability issues are primarily driven by the loss of mantissa bits (precision) rather than exponent bits (range), although reducing the latter causes immediate failure.

Logit-Space Sharpness Metric

Measuring the "sharpness" of a loss landscape—a known indicator of generalization and stability—is typically computationally prohibitive for LLMs. We propose a new metric, $\phi_\epsilon$, which identifies the largest loss spike in the neighborhood of the last token's logit. This approach requires only a single forward pass per measurement, making it a practical tool for real-time monitoring.

Real-World Testing

We validated our simulations using the MegaScale Automatic Mixed Precision (MS-AMP) library to test actual FP8 implementations on NVIDIA H100 GPUs, ensuring our theoretical findings translated to production-grade hardware.

Data Quality and Robustness

Our experiments utilized a range of datasets, from the high-quality FineWeb Edu to the more "noisy" OpenWebText. A key insight emerged: data quality acts as a precision multiplier. While FP8 training converged successfully on clean data, it frequently diverged on noisier datasets where BF16 remained stable. This suggests that adopting FP8 may necessitate higher expenditures on data filtering and curation.

Results and Analysis

Sharpness as a Leading Indicator

The proposed sharpness metric often begins to rise well before the training loss actually spikes. This "smoke detector" effect allows engineers to predict impending training collapses. In models with reduced mantissa bits (e.g., E8M4 and E8M5), sharpness increased steadily until reaching a critical threshold, at which point divergence became inevitable.

Quantifying the Precision Gap

As mantissa bits are removed, the loss landscape becomes measurably more jagged. For instance, at 5,000 training steps, an E8M3 model exhibited a sharpness value nearly 10x higher than an E8M7 (BF16) model. This increased jaggedness directly correlates with heightened sensitivity to hyperparameters; learning rates that were perfectly stable for BF16 caused frequent failures in lower-precision configurations.

Comparison of loss landscape sharpness between different precision settings.

Discussion and Limitations

While our study highlights the risks of FP8, it also points toward a path forward. We acknowledge that our focus was primarily on the early stages of pretraining; some instabilities, such as those related to SwiGLU activation growth, may only emerge after hundreds of billions of tokens. Furthermore, while we focused on training loss, future work must determine if stable FP8 runs achieve the same downstream task performance (e.g., MMLU scores) as their BF16 counterparts.

We conclude that while FP8 represents the future of efficient LLM training, it is currently a high-stakes gamble. More sophisticated stabilization techniques—such as maintaining specific sensitive layers at higher precision—are required before FP8 can reliably replace BF16 in production environments.

Summary updated

BibTeX
@misc{lee2024fp,
  author = {Joonhyung Lee and Jeongin Bae and Byeongwook Kim and Se Jung Kwon and Dongsoo Lee},
  title = {{To FP8 and Back Again: Quantifying the Effects of Reducing Precision on LLM Training Stability}},
  year = {2024},
  eprint = {2405.18710},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.18710},
}
Figure