Skip to main content
QUICK REVIEW

[Paper Review] Towards Efficient Post-training Quantization of Pre-trained Language Models

Haoli Bai, Lu Hou|arXiv (Cornell University)|Sep 30, 2021
Topic ModelingComputer Science76 references21 citations
TL;DR

This paper proposes Module-wise Reconstruction Error Minimization (MREM), a post-training quantization method for pre-trained language models that partitions the model into modules to jointly optimize quantization error, enabling fast, memory-efficient, and data-private inference. By training modules in parallel with annealed teacher forcing, MREM achieves near-theoretical speedup and performance close to quantization-aware training, reducing training time by over 150× and memory usage by 3× while using only 4,096 calibration samples.

ABSTRACT

Network quantization has gained increasing attention with the rapid growth of large pre-trained language models~(PLMs). However, most existing quantization methods for PLMs follow quantization-aware training~(QAT) that requires end-to-end training with full access to the entire dataset. Therefore, they suffer from slow training, large memory overhead, and data security issues. In this paper, we study post-training quantization~(PTQ) of PLMs, and propose module-wise quantization error minimization~(MREM), an efficient solution to mitigate these issues. By partitioning the PLM into multiple modules, we minimize the reconstruction error incurred by quantization for each module. In addition, we design a new model parallel training strategy such that each module can be trained locally on separate computing devices without waiting for preceding modules, which brings nearly the theoretical training speed-up (e.g., $4 imes$ on $4$ GPUs). Experiments on GLUE and SQuAD benchmarks show that our proposed PTQ solution not only performs close to QAT, but also enjoys significant reductions in training time, memory overhead, and data consumption.

Motivation & Objective

  • Address the limitations of quantization-aware training (QAT) in pre-trained language models, including slow training, high memory usage, and data privacy concerns.
  • Develop a post-training quantization method that maintains high model accuracy while reducing training time, memory overhead, and data access requirements.
  • Improve upon layer-wise PTQ by modeling correlations across multiple transformer layers through module-wise optimization.
  • Enable scalable and distributed training of quantized models via a novel model parallel strategy with minimal communication overhead.
  • Ensure robust performance under low-data regimes by optimizing for small calibration datasets without sacrificing accuracy.

Proposed method

  • Partition the pre-trained language model into multiple modules, each containing multiple Transformer layers, to capture inter-layer correlations during quantization.
  • Minimize reconstruction error for each module independently using a module-wise objective function, improving accuracy over layer-wise methods.
  • Implement a model parallel training strategy where each module is trained locally on separate devices, achieving nearly theoretical speedup (e.g., 4× on 4 GPUs).
  • Introduce annealed teacher forcing to break reconstruction error propagation: use full-precision modules to provide clean signals to subsequent quantized modules.
  • Use a small, fixed-size calibration dataset (default: 4,096 samples) to tune quantization parameters without requiring full training data access.
  • Optimize quantization parameters via gradient-based minimization of reconstruction error, with flexible module size to balance memory and performance.

Experimental results

Research questions

  • RQ1Can module-wise optimization improve post-training quantization accuracy in pre-trained language models compared to layer-wise methods?
  • RQ2How does parallel training of model modules affect convergence speed and performance in post-training quantization?
  • RQ3To what extent can reconstruction error propagation degrade performance, and can it be mitigated effectively?
  • RQ4What is the optimal calibration data size for achieving high accuracy with minimal data access in post-training quantization?
  • RQ5Does per-channel quantization provide significant gains in post-training quantization of PLMs, especially under module-wise optimization?

Key findings

  • MREM achieves 85.5% accuracy on BERT-large with 4-bit weights and 8-bit activations using only 4,096 calibration samples, outperforming QAT in data efficiency.
  • The proposed parallel training strategy achieves over 150× speedup compared to conventional QAT training, with near-theoretical speedup on 4 GPUs.
  • Memory usage per GPU is reduced to one-third of QAT, enabling deployment on resource-constrained devices.
  • MREM reduces reconstruction error across layers by up to 40% compared to layer-wise methods, with slower error propagation and lower overall error.
  • Per-channel quantization provides minimal gains on MREM (≤1.0% improvement), suggesting that MREM’s joint optimization already achieves effective quantization distribution learning.
  • The method maintains high performance even with small calibration sets, demonstrating strong sample efficiency and robustness.

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.