Source-linked AI summary

A Study of BFLOAT16 for Deep Learning Training

Dhiraj Kalamkar, Dheevatsa Mudigere, Naveen Mellempudi, Dipankar Das, Kunal Banerjee, Sasikanth Avancha, Dharma Teja Vooturi, Nataraj Jammalamadaka, Jianyu Huang, Hector Yuen, Jiyan Yang, Jongsoo Park, Alexander Heinecke, Evangelos Georganas, Sudarshan Srinivasan, Abhisek Kundu, Misha Smelyanskiy, Bharat Kaul, Pradeep Dubey

arXiv:1905.12322v3cs.LGstat.ML

TL;DR

This paper studies whether BFLOAT16 can support deep learning training while avoiding the narrow-range and loss-scaling issues of IEEE 754 half-precision. It develops and evaluates mixed-precision BFLOAT16 emulation across diverse workloads, finding comparable or state-of-the-art results to FP32 without hyperparameter changes.

  • Problem

    IEEE 754 half-precision has a narrow dynamic range that may not represent error gradients during backpropagation, requiring loss scaling for training.

  • Method

    The paper develops mixed-precision BFLOAT16 training methodology and emulates BFLOAT16 operations across multiple deep learning frameworks using FP32 operations, bit manipulation, and rounding.

  • Results

    BFLOAT16 training achieves SOTA results across image, speech, language, generative, and recommendation workloads without hyperparameter changes, with accuracy matching or closely following FP32 baselines.

  • Takeaways & Limitations

    BFLOAT16 provides a robust half-precision training format across application domains while preserving FP32's dynamic range and avoiding complex loss scaling or block-quantization management.

Abstract

from arXiv · show

This paper presents the first comprehensive empirical study demonstrating the efficacy of the Brain Floating Point (BFLOAT16) half-precision format for Deep Learning training across image classification, speech recognition, language modeling, generative networks and industrial recommendation systems. BFLOAT16 is attractive for Deep Learning training for two reasons: the range of values it can represent is the same as that of IEEE 754 floating-point format (FP32) and conversion to/from FP32 is simple. Maintaining the same range as FP32 is important to ensure that no hyper-parameter tuning is required for convergence; e.g., IEEE 754 compliant half-precision floating point (FP16) requires hyper-parameter tuning. In this paper, we discuss the flow of tensors and various key operations in mixed precision training, and delve into details of operations, such as the rounding modes for converting FP32 tensors to BFLOAT16. We have implemented a method to emulate BFLOAT16 operations in Tensorflow, Caffe2, IntelCaffe, and Neon for our experiments. Our results show that deep learning training using BFLOAT16 tensors achieves the same state-of-the-art (SOTA) results across domains as FP32 tensors in the same number of iterations and with no changes to hyper-parameters.

1 Introduction

The paper presents BFLOAT16 as a practical half-precision format for deep learning training and evaluates it across diverse workloads. Its methodology uses FP32-based emulation to reproduce BFLOAT16 behavior while preserving mixed-precision training workflows.

  • 1 Introduction: The study uses FP32 operations to emulate BFLOAT16 by zeroing lower bits and rounding input operands.This approach approximates BFLOAT16 tensor behavior while retaining FP32 execution support.
  • 1 Introduction: Quantlib implements BFLOAT16 emulation across IntelCaffe, Caffe2, Neon, and TensorFlow.It modifies FP32 tensors before planned BFLOAT16 operations.
  • 1 Introduction: BFLOAT16 training is evaluated across image, speech, language, generative, and recommendation workloads.The study covers AlexNet, ResNet-50, DC-GAN, SR-GAN, DeepSpeech2, GNMT, and two industrial recommendation workloads.
  • 1 Introduction: BFLOAT16 experiments achieve SOTA results without hyperparameter changes, unlike FP16 and INT16 methods requiring additional management.FP16 requires loss scaling, while INT16 requires fine-grained block quantization and scaling factors.
  • 1 Introduction: The paper details BFLOAT16 data flow, operations, and rounding, then reports experiments across multiple frameworks and application domains.The paper’s later sections cover related work, BFLOAT16 training methodology, experiments, and conclusions.

2 Related Work

Related work spans floating-point and custom fixed-point formats for low-precision deep learning. Prior approaches trade precision, dynamic range, speed, or software complexity, while BFLOAT16 avoids loss scaling through its wider range.

  • 2 Related Work: Low-precision deep learning methods broadly use standard floating-point or custom fixed-point representations.The literature includes reduced-precision formats designed for power, performance, precision, or dynamic range.
  • 2 Related Work: Fixed-point methods can increase precision and dynamic range but require separate management of integer values for both properties.Some dynamically scaled fixed-point methods report faster convolutional-network execution.
  • 2 Related Work: Sub-16-bit methods commonly use custom fixed-point schemes, including binary weights, binary activations, and low-bit operations.Several approaches retain gradients or weights in full precision while quantizing other tensors.
  • 2 Related Work: Some reduced-precision methods work on smaller benchmarks but show non-trivial accuracy drops on larger ImageNet classification tasks.Flexpoint is reported to outperform FP16 and reach numerical parity with FP32 across diverse workloads.
  • 2 Related Work: Integer representations add overhead from shared-exponent handling and accumulator-overflow management.Predicting shared exponents still requires additional layer statistics that are inefficient on general-purpose hardware.
  • 2 Related Work: FP16 mixed-precision training stores low-precision tensors while accumulating in FP32 and preserving master FP32 weights for updates.This methodology succeeds across broad applications with minimal loss relative to FP32 but requires loss scaling.
  • 2 Related Work: BFLOAT16 avoids the need for loss scaling and has been reported across machine learning, simulation, and programming-language applications.The cited work includes image classification, segmentation, object detection, machine translation, Monte Carlo simulation, and Julia.

3 Training with Brain Floating Point

BFLOAT16 preserves a dynamic range comparable to FP32 while using reduced precision, allowing smaller gradients to be represented without complicated loss scaling. The training flow converts tensors around FP32 accumulation and BFLOAT16 inputs.

  • 3 Training with Brain Floating Point: BFLOAT16 uses truncated full-precision values with 8 mantissa bits and a dynamic range comparable to FP32.Its extended range distinguishes it from narrower half-precision representations.
  • 3 Training with Brain Floating Point: The extended dynamic range represents smaller gradients without complicated loss scaling methods.This is described as enabling easier migration of workloads to BFLOAT16 hardware.
  • 3 Training with Brain Floating Point: BFLOAT16 compute primitives such as FMA can use 8-bit multipliers while preserving FP32 dynamic range.The paper identifies potential area and power savings from this design.
  • 3 Training with Brain Floating Point: The paper compares BFLOAT16 with IEEE-754 FP32 and FP16 formats in Table 1.The comparison concerns numeric-format characteristics used in the training discussion.
  • 3 Training with Brain Floating Point: GEMM kernels accept BFLOAT16 inputs, accumulate outputs in FP32, and use Quantlib to convert tensors before the next layer.Quantlib also converts a copy of FP32 weights for the forward pass.

4 Results

The evaluation applies the Quantlib tensor-modification method to deep learning models from different application domains and frameworks.

  • 4 Results: The evaluation covers the deep learning models and application domains described earlier in the paper.Experiments use the Quantlib tensor-modification method across multiple frameworks.
  • 4 Results: The experiments assess BFLOAT16 training rather than only numeric-format properties.The method is applied to complete model workloads from different domains.
  • 4 Results: Quantlib provides the tensor modification used to conduct the BFLOAT16 evaluation.This connects the experimental setup to the emulation method introduced in Section 1.

4.1 Convolution Neural Networks

BFLOAT16 training closely tracks FP32 for representative CNN workloads, including AlexNet and ResNet-50, while using BFLOAT16 emulation across the training pipeline.

  • Scope: The CNN evaluation covers AlexNet and ResNet-50 as representative ImageNet models.These models represent ILSVRC 2012 and ILSVRC 2015, respectively.
  • Method: The experiments emulate BFLOAT16 for convolutional, inner-product, ReLU, batch-normalization, pooling, dropout, and elementwise layers.This setup was intended to use BFLOAT16 throughout the training pipeline rather than higher precision for intermediate tensor outputs.
  • AlexNet: AlexNet BFLOAT16 emulation follows FP32 closely, reaching 57.2% top-1 and 80.1% top-5 accuracy after 88 epochs.The FP32 baseline reached 57.4% top-1 and 80.7% top-5 accuracy with a global minibatch of 1024 on 16 nodes.
  • ResNet-50: ResNet-50 BFLOAT16 emulation follows the FP32 baseline almost exactly, achieving the same top-1 and top-5 accuracy.The fully trained BFLOAT16 model achieved 75.7% top-1 test accuracy with global sample statistics, matching the baseline FP32 results.

4.2 Recurrent Neural Networks

BFLOAT16 is evaluated on recurrent workloads spanning speech recognition and neural machine translation, with translation results closely matching FP32.

  • Motivation: RNNs are evaluated because sequence models have demanding numerical-range requirements and are more sensitive to half-precision formats.The workloads include automatic speech recognition and language processing applications.
  • Speech Recognition: Deep Speech 2 uses convolutional and bidirectional GRU layers with Adam optimization and CTC loss on the 460-hour LibriSpeech corpus.The model uses a batch size of 64 and a learning rate of 0.0005.
  • Neural Machine Translation: GNMT evaluation compares BFLOAT16 emulation with FP32 on small Vietnamese-to-English and big German-to-English models.The comparison uses BLEU scores on the IWSLT’15 and WMT’16 datasets.
  • Results: BFLOAT16 emulation achieves the same or better translation accuracy than the FP32 baseline.Figure 3 shows the BFLOAT16 run following the FP32 baseline closely during training.

4.3 Generative Adversarial Networks (GANs)

BFLOAT16 is tested on DC-GAN and SR-GAN, covering adversarial generation and super-resolution, with DC-GAN outputs comparable to FP32.

  • Scope: The GAN evaluation includes DC-GAN and SR-GAN models because GAN training combines regression and discrimination tasks with distinct precision and range requirements.GANs use tightly coupled generator and discriminator networks.
  • DC-GAN: DC-GAN experiments convert input activations and weights to BFLOAT16 while implementing the model with convolutional and normalization components.The generator uses fractionally strided convolutions and ReLU activations, while the discriminator uses convolutions and leaky ReLU activations.
  • DC-GAN: FP32 and BFLOAT16 DC-GAN outputs are comparable on inception scores and MS-SSIM.The comparison is reported for the face dataset in Table 3.
  • SR-GAN: SR-GAN generates high-resolution images by scaling low-resolution inputs 4×, with quality measured using SSIM, MS-SSIM, and PSNR.The model uses a ResNet-based generator and a discriminator.
  • SR-GAN: For SR-GAN, convolution-layer weights and activations use BFLOAT16 while batch normalization, activations, and elementwise layers remain at full precision.The model is evaluated on the DIV2K dataset.

4.4 Industrial Scale Recommendation System

BFLOAT16 is evaluated on small and large industrial recommendation workloads, where round-to-nearest nearly matches FP32 accuracy.

  • Workloads: The study evaluates a Deep & Cross Network on a small Kaggle Criteo dataset and a DNN recommender on a large Terabyte Criteo dataset.Both models predict advertisement click-through rates using log loss as the accuracy measure.
  • Method: Recommendation-model activations and weights are converted to BFLOAT16 in fully connected layers during forward and backward propagation.FP32 master weights are retained during updates, with round-to-nearest or direct truncation used for conversion.
  • Results: BFLOAT16 with round-to-nearest produces accuracy almost the same as the FP32 baseline.The results are reported as log loss for the two Criteo recommendation workloads in Table 5.
  • Results: Direct truncation causes a tiny accuracy degradation of approximately 0.02%.This comparison is reported for the recommendation-system accuracy evaluation.

4.5 Beyond Emulation - Towards Bare Metal Execution

The study moves beyond emulation toward bare-metal BFLOAT16 execution using AVX512BF16 instructions, while retaining FP32 accumulation and achieving state-of-the-art ResNet-50 accuracy.

  • Bare-metal operator implementation: AVX512BF16 implements convolution, fully-connected, batch-normalization, and pooling operators with 16-bit activation and weight data.The implementation uses VNNI data layout to support BFLOAT16 dot products with FP32 accumulation.
  • Bare-metal evaluation: 75.62% Top-1 accuracy on ImageNet ResNet-50 matches current state-of-the-art performance.
  • Execution platform: Bit-accurate emulation on current AVX512 silicon incurs only a very slight performance tax.
  • Implementation status: The BFLOAT16 implementation is heavily optimized, and a full BFLOAT16 LSTM cell has been implemented for TensorFlow integration.

5 Conclusion

The paper establishes BFLOAT16 as an alternative half-precision format for Deep Learning training because it combines FP32’s dynamic range with straightforward conversion. Its empirical study finds robust coverage across application domains without the tuning or complex quantization management required by competing formats.

  • Conclusion: BFLOAT16 has the same dynamic range as FP32, and conversion to and from FP32 is straightforward.
  • Conclusion: BFLOAT16 training eliminates hyperparameter tuning and complex block-quantization software management required by IEEE 754 half-precision and 16-bit Integer formats.
  • Conclusion: BFLOAT16 robustly covers tensor ranges across vision, speech, language, generative networks, and recommendation systems.
  • Conclusion: The authors expect industry-wide adoption of BFLOAT16 across emerging domains.
Loading 1905.12322v3…