Skip to main content
QUICK REVIEW

[Paper Review] FP8 Formats for Deep Learning

Paulius Micikevicius, Dušan Stošić|arXiv (Cornell University)|Sep 12, 2022
Advanced Neural Network ApplicationsComputer Science49 citations
TL;DR

The paper proposes FP8 binary interchange formats (E4M3 and E5M2) for deep learning, and shows FP8 training and inference can match 16-bit precision across CNNs, Transformers, and large language models up to 175B parameters, using the same hyperparameters.

ABSTRACT

FP8 is a natural progression for accelerating deep learning training inference beyond the 16-bit formats common in modern processors. In this paper we propose an 8-bit floating point (FP8) binary interchange format consisting of two encodings - E4M3 (4-bit exponent and 3-bit mantissa) and E5M2 (5-bit exponent and 2-bit mantissa). While E5M2 follows IEEE 754 conventions for representatio of special values, E4M3's dynamic range is extended by not representing infinities and having only one mantissa bit-pattern for NaNs. We demonstrate the efficacy of the FP8 format on a variety of image and language tasks, effectively matching the result quality achieved by 16-bit training sessions. Our study covers the main modern neural network architectures - CNNs, RNNs, and Transformer-based models, leaving all the hyperparameters unchanged from the 16-bit baseline training sessions. Our training experiments include large, up to 175B parameter, language models. We also examine FP8 post-training-quantization of language models trained using 16-bit formats that resisted fixed point int8 quantization.

Motivation & Objective

  • Motivate a compact 8-bit floating point format to accelerate DL training and inference.
  • Propose two FP8 encodings (E4M3 and E5M2) and discuss design choices like dynamic range and per-tensor scaling.
  • Demonstrate FP8 training and FP8-based inference across CNNs, RNNs, and Transformer models including very large language models (up to 175B parameters).
  • Evaluate post-training quantization of FP16/bfloat16-trained models to FP8 and compare to int8 quantization.
  • Provide guidance on FP8 usage such as scaling, overflow handling, and special-value representations in practical DL pipelines.

Proposed method

  • Define FP8 binary interchange formats E4M3 (4-bit exponent, 3-bit mantissa) and E5M2 (5-bit exponent, 2-bit mantissa).
  • Explain per-tensor scaling factors and the rationale for maintaining IEEE-like exponent bias (7 for E4M3, 15 for E5M2).
  • Simulate FP8 by clipping tensor values to FP8 representable ranges during training, performing arithmetic in wider precision, then casting to FP8 for storage as needed.
  • Train a wide range of models (CNNs, RNNs, Transformers) with FP8 inputs while keeping baseline 16-bit hyperparameters fixed, including very large language models up to 175B parameters.
  • Evaluate FP8 inference and FP8 post-training quantization (PTQ) of models trained in higher precision, comparing to int8 and to 16-bit baselines.
  • Discuss per-tensor scaling necessity in some networks and the impact on accuracy.

Experimental results

Research questions

  • RQ1Can FP8 (E4M3 and E5M2) training achieve comparable accuracy to 16-bit training across diverse architectures (CNNs, RNNs, Transformers) without changing hyperparameters?
  • RQ2What are the implications of FP8 dynamic range and special-value representations for training stability and accuracy?
  • RQ3Is per-tensor scaling necessary for FP8 inference to preserve accuracy, and how does FP8 PTQ compare to int8 quantization?
  • RQ4How does FP8 impact training of very large language models (up to 175B parameters) and post-training quantization for deployment?

Key findings

  • FP8 training matches FP16 or bfloat16 training results for a variety of tasks and architectures when using the same model, optimizer, and hyperparameters.
  • Image models on ImageNet show FP8 accuracy within run-to-run variation of FP16/bfloat16 baselines across multiple architectures (e.g., ResNet variants, DenseNet, Xception, DeiT).
  • Language models, including Transformer-based and GNMT architectures, achieve FP8-trained BLEU and perplexity scores within run-to-run variation of 16-bit baselines, up to 175B parameters.
  • Post-training quantization of FP16/bfloat16-trained models to FP8 (E4M3) maintains accuracy better than int8 PTQ in several NLP tasks (e.g., BERT, GPT-3 scale), with per-tensor scaling improving results.
  • Per-tensor scaling is sometimes necessary to preserve accuracy when more tensors are stored in FP8, as shown by perplexity experiments on wikitext103.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.