NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

I-BERT: Integer-only BERT Quantization

Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer

TL;DR

I-BERT is a novel quantization scheme that enables Transformer-based models (like BERT and RoBERTa) to perform inference using entirely integer-only arithmetic. By replacing complex non-linear operations like GELU, Softmax, and Layer Normalization with lightweight integer approximations, I-BERT achieves a 2.4–4.0× speedup on hardware like NVIDIA T4 GPUs while maintaining—and sometimes even exceeding—the accuracy of full-precision models.

What Problem Does This Paper Address?

While Transformer models are the gold standard for Natural Language Processing (NLP), they are notoriously resource-hungry. Quantization—representing weights and activations with 8-bit integers (INT8) instead of 32-bit floating point (FP32)—is a common solution to reduce memory and increase speed.

However, most existing "quantized" Transformers are actually "fake quantized." They use integer arithmetic for linear operations (like matrix multiplications) but must "dequantize" back to floating point to calculate non-linear functions like GELU, Softmax, and Layer Normalization.

Comparison of simulated quantization schemes versus I-BERT's fully integer pipeline.

This constant switching creates a bottleneck and prevents these models from running on specialized integer-only hardware (like certain ARM processors or high-throughput integer logical units in modern GPUs).

Methods

The authors introduce I-BERT, which eliminates floating-point math entirely during inference. The core innovations lie in how they handle non-linearities:

  1. Polynomial Approximation (i-GELU & i-Softmax): Instead of calculating transcendental functions (like $e^x$), I-BERT uses second-order polynomials ($ax^2 + bx + c$). To keep errors low, they use "range reduction." For example, for Softmax, they decompose the input so they only have to approximate the exponential function over a very small, specific range ($-\ln 2$ to $0$) where a simple polynomial is highly accurate.
Approximation of GELU and exponential functions using I-BERT's integer-only polynomials.
  1. Integer-only LayerNorm: Layer Normalization requires calculating a square root. I-BERT implements an iterative integer-only square root algorithm based on Newton’s method, which converges in just a few iterations for 32-bit integers.
  2. Dyadic Arithmetic: To handle scaling factors without division (which is slow), they use dyadic numbers, allowing them to replace division with simple bit-shifting operations.

Datasets

The researchers evaluated I-BERT using the GLUE (General Language Understanding Evaluation) benchmark, the standard for testing NLP model performance across various tasks:

  • Sentence Similarity: MRPC, STS-B, QQP.
  • Sentiment/Classification: SST-2, CoLA.
  • Natural Language Inference: MNLI, QNLI, RTE.

They used RoBERTa-Base and RoBERTa-Large as their primary architectures for these tests.

Key Insights and Ideas

  • The "Range" Secret: You don't need a high-degree polynomial to approximate a complex curve if you can force the input into a small, predictable window. By using bit-shifting to handle the "large" parts of an exponential, a simple 2nd-degree polynomial can handle the "small" part with negligible error.
  • Integer-only is not a compromise: Surprisingly, I-BERT often outperformed the FP32 baseline. This suggests that the constraints of quantization might act as a form of regularization, or that the specific fine-tuning required for I-BERT helps the model generalize better.
  • Hardware Readiness: While many researchers use "simulated" quantization to report theoretical gains, the authors implemented customized kernels to prove that these methods translate to real-world wall-clock speedups on modern hardware.

Key Results

  • Accuracy Parity: On the GLUE benchmark, I-BERT (INT8) achieved an average score of 86.3 for RoBERTa-Base (vs. 86.0 for FP32) and 89.5 for RoBERTa-Large (vs. 89.0 for FP32).
  • Significant Speedup: In end-to-end testing on an NVIDIA T4 GPU, I-BERT demonstrated a 2.4× to 4.0× speedup over the FP32 baseline, depending on the sequence length and batch size.
  • Low Error: Their i-GELU approximation achieved a maximum error of only $1.8 \times 10^{-2}$, which is roughly 3x more accurate than previous "hard-sigmoid" approximations used in mobile-optimized models.

Limitations and Future Work

  • Training vs. Inference: I-BERT is designed for integer-only inference. The training and fine-tuning process still requires floating-point arithmetic. The authors suggest that exploring integer-only training could be a promising next step.
  • Hardware Specifics: While the math is integer-only, the current speedup results were measured on a T4 GPU using TensorRT. The authors note that the "greatest value" of this work will be realized when software support catches up for lower-end microprocessors that lack floating-point units entirely.
  • Black Box Accuracy: The authors admit they don't yet have a definitive explanation for why the integer-only model occasionally outperforms the full-precision version, marking it as an area for further theoretical study.

Summary updated

BibTeX
@inproceedings{kim2021i,
  author = {Sehoon Kim and Amir Gholami and Zhewei Yao and Michael W. Mahoney and Kurt Keutzer},
  title = {{I-BERT: Integer-only BERT Quantization}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=dHaip_pZbo},
}
Figure