Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Mixed Precision Training

Half-precision training with FP32 master weights matches FP32 accuracy

  • Problem Training larger networks on larger datasets needs more memory and compute. Earlier low-precision methods kept gradients in single precision or lost accuracy on large CNNs and RNNs.
  • Method Mixed Precision Training stores weights, activations and gradients in FP16 and runs both passes in FP16. It keeps an FP32 master copy for updates and scales the loss so small gradients stay nonzero.
  • Results Across six ILSVRC12 CNNs, mixed precision matched FP32 top-1 accuracy with the same hyper-parameters. Resnet50 reached 76.04% against 75.92% for FP32.

Why reduce training precision?

Training larger networks on larger datasets raises the memory and compute that training consumes. The network in Hannun et al. (2014) had 11 million parameters, and the GRU models of Amodei et al. (2016) reached 116 million. Recent GPUs run half-precision math at 2 × to 8× the single-precision throughput, and reduced formats also shrink the memory that training needs.

Several earlier CNN methods quantized weights and activations but kept gradients in single precision, and the larger ILSVRC models lost non-trivial accuracy under these approaches. Gupta et al. (2015) trained CNNs on MNIST and CIFAR-10 with 16-bit fixed point, but it was unclear whether that would hold for larger CNNs or for RNNs. For recurrent networks, He et al.

(2016c) and Ott et al. (2016) quantized weights and activations, while the gradients stayed in single precision and back-propagation cost did not fall.

The goal here is different: every tensor and every arithmetic operation of the forward and backward passes runs in FP16, layer widths and hyper-parameters stay unchanged, and accuracy is matched against FP32 baselines.

An FP32 master copy and why it is needed

Weights, activations and gradients are stored in FP16, and the forward and backward passes use FP16 copies. The weight update, however, is applied to an FP32 master copy during the optimizer step, and that copy is rounded to FP16 at the start of each iteration. Because only the FP16 copy moves through the passes, weight storage and bandwidth are halved relative to FP32 training.

The first failure mode is underflow of the update: a weight gradient multiplied by the learning rate can fall below 2−24, and FP16 turns any such value into zero. The second failure mode is a magnitude ratio. When a normalized weight is at least 2048 times larger than its update, the addition shifts the update's implicit bit by 11 or more positions, which can erase it even though the update alone is representable.

Computing the update in FP32 avoids both failure modes.

The extra copy raises weight memory by 50% compared with single-precision training. Activations dominate training memory because batch sizes are large and each layer's activations are kept for the backward pass, and those are also stored in half precision, so total training memory is roughly halved.

On the Mandarin speech model, trained on approximately 800 hours of speech for 20 epochs, an FP32 master copy matched FP32 training, while updating the FP16 weights led to 80% relative accuracy loss. This illustration run uses about 800 hours, whereas the Mandarin results in the speech section come from a 2600-hour internal training set, so the two runs are separate.

Loss scaling for small gradients

The FP16 exponent bias places normalized exponents in [−14, 15], while gradients in practice cluster at small magnitudes with negative exponents. In the Multibox SSD activation gradient histogram, much of the representable FP16 range went unused, and many values lay below the smallest representable magnitude and became zero. In that histogram, 67% of the values were zero, and gradient values below 2−27 were irrelevant to training while values in [2−27, 2−24) mattered.

The method multiplies the loss from the forward pass by a scaling factor before back-propagation starts, so the chain rule scales every gradient by the same amount and no extra operations are needed during back-propagation. Weight gradients are divided by the scaling factor before weight update, and this unscaling is placed right after the backward pass and before gradient clipping or other gradient computations, so clipping thresholds and weight decay do not need retuning.

The simplest choice is one constant factor; the authors tried factors from 8 to 32K, and many networks needed no scaling. A factor can also be set from gradient statistics so that its product with the largest absolute gradient stays below 65,504, the largest value FP16 can represent. An overflow produces infinities and NaNs in the weight gradients that permanently damage the weights after an update, so overflow is checked on the unscaled gradients, and the update can be skipped on the next iteration.

Where accumulation stays in FP32

Neural network arithmetic falls into vector dot-products, reductions and point-wise operations, and each needs a different precision treatment. Some networks needed vector dot-products to accumulate partial products into FP32 before writing the result to memory as FP16, and without this some FP16 models did not reach baseline accuracy. Volta Tensor Cores multiply FP16 input matrices and accumulate the products into either FP16 or FP32 outputs.

Large reductions, such as batch-normalization statistics and softmax sums, are carried out in FP32. Those layers still read and write FP16 tensors and do arithmetic in FP32, and this did not slow training because they are memory-bandwidth limited. Point-wise operations are memory-bandwidth limited as well, so either FP16 or FP32 math can be used for them.

How the FP32 and mixed precision runs differ

The FP32 baseline stores activations, weights and gradients in single precision and computes in FP32. Mixed precision runs store everything in FP16, keep an FP32 master copy for updates, and use Tensor Core operations that accumulate into FP32 for convolutions, fully-connected layers and recurrent matrix multiplies. Baselines ran on Maxwell or Pascal GPUs and mixed precision runs on Volta V100 GPUs, except the speech experiments, which used Maxwell GPUs with FP16 storage only to emulate Tensor Core arithmetic.

Several networks were checked in that emulation mode against training on Volta V100, and the accuracies matched.

ImageNet classification results

Six CNNs were trained on ILSVRC12 with mixed precision: AlexNet, VGG-D, GoogLeNet, Inception v2, Inception v3 and pre-activation Resnet-50. Each network used the same hyper-parameters as its FP32 baseline, and Caffe was modified for Volta TensorOps, while Resnet50 was trained in PyTorch. Training schedules came from public repositories where available, and the baseline accuracies differ from published numbers in a few cases because of single-crop testing and simpler augmentation.

Top-1 accuracy on the ILSVRC validation set was 56.77% for FP32 AlexNet against 56.93% for mixed precision, and 65.40% against 65.43% for VGG-D. GoogLeNet went from 68.33% to 68.43%, and Inception v3 from 73.85% to 74.13%. Inception v2 was slightly lower in mixed precision, at 70.02% against 70.03%, and Resnet50 rose from 75.92% to 76.04%.

No loss scaling was needed for any of these networks, although the forward and backward tensors were FP16 and the master weights were updated in FP32.

Detection and the loss scale that makes SSD train

Object detection predicts bounding box coordinates and a class probability for each box, and two detectors were trained: Faster R-CNN and Multibox SSD, both with a VGG-16 backbone. Mean average precision was computed on the Pascal VOC 2007 test set, but Faster R-CNN was trained on VOC 2007 training data while SSD was trained on the union of VOC 2007 and 2012, which explains the baseline difference between them.

Faster R-CNN reached 69.1% mAP in the baseline, 68.6% in mixed precision without loss scale, and 69.7% with loss scale. Multibox SSD reached 76.9% as the baseline, diverged in FP16 without loss scaling, and reached 77.1% with loss scale. Without scaling, small gradients became zero and the learned weights were poor, while a loss-scaling factor of 8 recovered the relevant gradient values and matched FP32 mAP.

Speech recognition in pseudo FP16 mode

The Mandarin model has a similar architecture with 215 million parameters and was trained on 2600 hours of internal training data. Both were trained for 20 epochs with Nesterov SGD, and learning rate, annealing schedule and momentum were kept the same between baseline and pseudo FP16 runs.

On the English WSJ '92 test set, character error rate fell from 2.20 in the baseline to 1.99 in mixed precision, and on the internal Mandarin test set it fell from 15.82 to 15.01. The authors describe the pseudo FP16 results as roughly 5 to 10% better than the baseline and suggest that half-precision storage may act as a regularizer. The authors also note that speech training runs involve unusually many time-steps, and that these models are the largest trained with this technique.

Translation and language modeling need loss scaling

The English to French translation models follow a TensorFlow tutorial, with 100K and 40K word vocabularies for English and French, 3 or 5 layers of 1024 LSTM cells in the encoder and decoder, and SGD on WMT15. Identical FP32 settings gave noticeably different curves across runs, so the comparison reads against several FP32 runs. Mixed precision with loss scaling matched the FP32 perplexity, while mixed precision without loss scaling degraded slightly, and the 5-layer model showed the same behavior.

The bigLSTM model has two layers of 8192 LSTM cells with a projection to a 1024-dimensional embedding and was trained for 50 epochs with Adagrad on the 1 billion word dataset. It uses a sampled softmax with 8K negative samples and a batch size of 1024 aggregated over 4 GPUs. Without loss scaling, FP16 training diverged from the FP32 perplexity after 300K iterations.

A scaling factor of 128 recovered the gradient values, and FP16 training then matched the baseline run.

Qualitative GAN results

The generator has seven fractionally-strided convolution layers, and the discriminator has six convolution layers and two fully-connected layers. The output images were a randomly selected set, not a curated one.

There is no widely accepted quantitative measure for GAN quality, so the comparison is qualitative, and the FP32 and mixed precision outputs appear comparable. This network did not need loss scaling to match FP32 results.

Speed and memory gains

DeepBench operations on Volta GPUs showed 2-6x speedups over FP32 implementations when they were limited by memory or arithmetic bandwidth. Speedups were lower for latency-limited operations, and full-network speedups depend on library and framework support for mixed precision, which the authors treat as future work.

Limits of the evidence

The speech experiments emulated Tensor Core operations on Maxwell GPUs using FP16 storage only, rather than running on Volta V100 hardware. The experiments were run with early versions of libraries and frameworks, so full-network speed results were not measured. Automatic selection of the loss-scaling factor, text-to-speech systems and deep reinforcement learning were left as future work.

Run-to-run variation among FP32 translation runs with identical settings was noticeable, and each network was compared on the configurations listed above.

Paper info

Authors
Micikevicius, Paulius, Narang, Sharan, Alben, Jonah, Diamos, Gregory, Elsen, Erich, Garcia, David, Ginsburg, Boris, Houston, Michael, Kuchaiev, Oleksii, Venkatesh, Ganesh, Wu, Hao
Venue
arXiv · Preprint
First published
2017-10-10
Added
2026-11-12
Updated
2018-2-15
Version
v3
arXiv
1710.03740
Category
cs.AI · cs.LG · stat.ML
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Micikevicius, Paulius, Narang, Sharan, Alben, Jonah, Diamos, Gregory, Elsen, Erich, Garcia, David, Ginsburg, Boris, Houston, Michael, Kuchaiev, Oleksii, Venkatesh, Ganesh, Wu, Hao (2017). Mixed Precision Training. arXiv:1710.03740v3. https://arxiv.org/abs/1710.03740v3

BibTeX
@misc{paulius2017mixed,
  title = {{Mixed Precision Training}},
  author = {Micikevicius, Paulius and Narang, Sharan and Alben, Jonah and Diamos, Gregory and Elsen, Erich and Garcia, David and Ginsburg, Boris and Houston, Michael and Kuchaiev, Oleksii and Venkatesh, Ganesh and Wu, Hao},
  year = {2017},
  eprint = {1710.03740},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.03740v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up