Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Can you explain the role of FP8 precision in the training process of DeepSeek-V3


Can you explain the role of FP8 precision in the training process of DeepSeek-V3


FP8 precision plays a crucial role in the training process of DeepSeek-V3, significantly enhancing efficiency and reducing computational costs. Here's a detailed explanation of its role:

Introduction to FP8 Precision

FP8 is an 8-bit floating-point format that offers a more compact representation compared to traditional 16-bit or 32-bit formats. This compactness results in reduced memory usage and faster computation, making it ideal for large-scale AI model training like DeepSeek-V3[3][5].

Mixed Precision Framework

DeepSeek-V3 employs a mixed precision framework, where different parts of the model use different levels of precision. Most compute-intensive operations, such as General Matrix Multiplication (GEMM), are performed in FP8 to optimize speed and memory usage. However, certain operations that require higher precision, like the embedding module, output head, MoE gating modules, normalization operators, and attention operators, are kept in higher precision formats (FP16 or FP32) to maintain accuracy[1][5].

Fine-Grained Quantization

To address the challenges of FP8's limited dynamic range, DeepSeek-V3 introduces a fine-grained quantization strategy. This involves grouping activations into 1x128 tiles and weights into 128x128 blocks, each scaled independently. This approach prevents extreme values from distorting the entire tensor, reducing quantization errors and maintaining model accuracy[1][5].

Online Quantization

DeepSeek-V3 uses online quantization, where scaling factors are dynamically calculated for each activation tile or weight block during training. This eliminates the need for delayed quantization methods that rely on historical maximum values, simplifying the framework and improving accuracy[1][5].

Increased Accumulation Precision

To mitigate errors caused by FP8's limited accumulation precision in Tensor Cores, DeepSeek-V3 promotes partial results to FP32 registers at specific intervals during GEMM operations. This ensures that the accumulation of small errors is minimized, maintaining the overall accuracy of the model[1][5].

Unified E4M3 Format

Unlike previous frameworks that used hybrid FP8 formats (e.g., E4M3 for the forward pass and E5M2 for the backward pass), DeepSeek-V3 universally adopts the E4M3 format. This is made possible by its fine-grained quantization strategy, which effectively shares exponent bits among grouped elements, maintaining precision across all computations[1][5].

Impact on Training Efficiency

The use of FP8 precision significantly accelerates the training process of DeepSeek-V3. The model was trained using a data center of 2048 GPUs in just around two months, requiring only 2.664 million H800 GPU hours for pre-training and an additional 0.1 million GPU hours for subsequent stages. This efficiency is attributed to the reduced memory consumption and increased computational speed offered by FP8[3][6].

In summary, FP8 precision in DeepSeek-V3 is crucial for achieving high training efficiency while maintaining model accuracy. It is carefully integrated into a mixed precision framework, leveraging fine-grained quantization and online quantization to mitigate the limitations of FP8.

Citations:
[1] https://community.aws/content/2rJj1WkztSfYwVfsIibhWxeqMf1/four-unique-takeaways-from-deepseek-v3?lang=en
[2] https://arxiv.org/pdf/2412.19437.pdf
[3] https://dirox.com/post/deepseek-v3-the-open-source-ai-revolution
[4] https://www.nextplatform.com/2025/01/27/how-did-deepseek-train-its-ai-model-on-a-lot-less-and-crippled-hardware/
[5] https://www.linkedin.com/pulse/deepseek-v3s-key-innovations-8-bit-floating-point-fp8-qi-he-e3dgf
[6] https://huggingface.co/deepseek-ai/DeepSeek-V3
[7] https://martinfowler.com/articles/deepseek-papers.html
[8] https://research.colfax-intl.com/deepseek-r1-and-fp8-mixed-precision-training/