Skip to main content
QUICK REVIEW

[Paper Review] Efficient 8-Bit Quantization of Transformer Neural Machine Language Translation Model

Aishwarya Bhandare, Vamsi Sripathi|arXiv (Cornell University)|Jun 3, 2019
Topic ModelingComputer Science14 references57 citations
TL;DR

The paper quantizes a trained Transformer translation model to 8-bit integers using INT8/VNNI on Intel CPUs, achieving less than 0.5 BLEU drop and up to 1.5x net speedup over FP32, with several graph and pipeline optimizations.

ABSTRACT

In this work, we quantize a trained Transformer machine language translation model leveraging INT8/VNNI instructions in the latest Intel$^\circledR$ Xeon$^\circledR$ Cascade Lake processors to improve inference performance while maintaining less than 0.5$\%$ drop in accuracy. To the best of our knowledge, this is the first attempt in the industry to quantize the Transformer model. This has high impact as it clearly demonstrates the various complexities of quantizing the language translation model. We present novel quantization techniques directly in TensorFlow to opportunistically replace 32-bit floating point (FP32) computations with 8-bit integers (INT8) and transform the FP32 computational graph. We also present a bin-packing parallel batching technique to maximize CPU utilization. Overall, our optimizations with INT8/VNNI deliver 1.5X improvement over the best FP32 performance. Furthermore, it reveals the opportunities and challenges to boost performance of quantized deep learning inference and establishes best practices to run inference with high efficiency on Intel CPUs.

Motivation & Objective

  • Demonstrate quantization of a trained FP32 Transformer translation model to INT8 with minimal BLEU loss.
  • Investigate the impact of 8-bit quantization on Transformer self-attention and non-linear components.
  • Develop calibration and graph-optimization techniques to preserve accuracy while accelerating inference.
  • Enhance inference throughput through optimized MatMul kernels, data flows, and parallel batching on Intel CPUs.

Proposed method

  • Replace FP32 MatMul operations with QuantizedMatMul using INT8/UINT8 operands and INT32 accumulation.
  • Calibrate quantization thresholds using KL-divergence to minimize distributional divergence between FP32 and INT8 tensors.
  • Tune Intel MKL/BLAS kernels to exploit VNNI instructions for accelerated 8-bit MatMuls.
  • Reorder and prune the computation graph to reduce redundant operations and overhead (e.g., GatherNd, dequantization).
  • Sort input sentences by token length and apply parallel batching to maximize CPU utilization during inference.

Experimental results

Research questions

  • RQ1Can a trained Transformer translation model be quantized to INT8 with less than 0.5 BLEU score drop?
  • RQ2Which calibration strategy and tensor distributions best preserve accuracy during INT8 quantization?
  • RQ3What graph-level and system-level optimizations yield the most significant throughput gains for INT8/VNNI inference?
  • RQ4How do MatMul and non-linear components (Softmax, LayerNorm) influence quantization viability in Transformer models?
  • RQ5What is the achievable speedup of INT8/VNNI quantized inference compared with FP32 on Intel CPUs?

Key findings

  • INT8/VNNI quantization maintained BLEU drop under 0.5 points.
  • MKL INT8/GEMM kernels with VNNI achieved substantial speedups over FP32—up to 3.7x vs FP32 for MatMul, and 2.3x over AVX512 for INT8 MatMul.
  • Calibration via KL-divergence with symmetric thresholding yielded best accuracy among modes tested (27.30–27.33 BLEU range).
  • Optimizations to GatherNd and operation fusion reduced data movement and execution time, improving throughput.
  • Sorting input by token count and parallel batching increased CPU utilization, contributing to up to 1.5x overall throughput gain over best FP32 setup.
  • Overall, the approach achieved a net 1.5x throughput improvement for the quantized model over the best FP32 performance.

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.