Source-linked AI summary

GPTAQ: Efficient Finetuning-Free Quantization for Asymmetric Calibration

Yuhang Li, Ruokai Yin, Donghyun Lee, Shiting Xiao, Priyadarshini Panda

arXiv:2504.02692v3cs.LG

TL;DR

Large transformer models make fine-tuning-based quantization costly, while GPTQ’s layerwise symmetric calibration does not account for deviations introduced by earlier quantized layers. GPTAQ uses asymmetric calibration with an optimal-brain-compression-based solution and efficient parallelization, improving low-bit quantization while remaining finetuning-free and scalable to huge transformers.

  • Problem

    GPTQ calibrates each layer using inputs from previous quantized layers rather than the full-precision model’s inputs, allowing asymmetry error to accumulate through the network.

  • Method

    GPTAQ matches quantized-layer outputs to full-precision outputs, explicitly accounting for quantization error, inverse Hessian information, and input deviation through an efficient asymmetric-calibration solution.

  • Results

    GPTAQ improves low-bit quantization performance over GPTQ across vision and language transformers and quantizes EVA-02 and LLaMA3.1-405B on a single A100 GPU.

  • Takeaways & Limitations

    GPTAQ reduces accumulated asymmetry error without finetuning, while requiring only 20 more lines of code than GPTQ.

  • Takeaways & Limitations

    The direct asymmetric-calibration implementation is computationally prohibitive because it requires repeated residual estimation and matrix multiplications for large transformer models.

Abstract

from arXiv · show

We introduce GPTAQ, a novel finetuning-free quantization method for compressing large-scale transformer architectures. Unlike the previous GPTQ method, which independently calibrates each layer, we always match the quantized layer's output to the exact output in the full-precision model, resulting in a scheme that we call asymmetric calibration. Such a scheme can effectively reduce the quantization error accumulated in previous layers. We analyze this problem using optimal brain compression to derive a close-formed solution. The new solution explicitly minimizes the quantization error as well as the accumulated asymmetry error. Furthermore, we utilize various techniques to parallelize the solution calculation, including channel parallelization, neuron decomposition, and Cholesky reformulation for matrix fusion. As a result, GPTAQ is easy to implement, simply using 20 more lines of code than GPTQ but improving its performance under low-bit quantization. Remarkably, on a single GPU, we quantize a 405B language transformer as well as EVA-02, the rank first vision transformer that achieves 90% pretraining Imagenet accuracy. Code is available at Github.

1. Introduction

Transformer scaling creates severe deployment challenges, while fine-tuning-based quantization becomes impractical for very large models. GPTAQ addresses GPTQ’s symmetric calibration by matching quantized-layer outputs to full-precision inputs and accounting for accumulated asymmetry error.

  • Motivation: Vision and language transformers have reached scales that create substantial computational and deployment challenges across servers and edge devices.ViT-G/14 has 2 billion parameters and requires 2860 GFLOPs per image, while LLaMA-3-405B has hundreds of billions of parameters.
  • Motivation: Fine-tuning-based quantization updates parameters through gradient descent, making it increasingly difficult as model size grows.Fine-tuning a 70B-parameter language model can require 8 A100 GPUs for 8 days.
  • Existing approach: GPTQ is a widely adopted finetuning-free quantization method because it combines speed, accuracy, broad API support, and straightforward implementation.The paper reports more than 5,321 quantized transformers on Hugging Face using GPTQ.
  • Problem and proposal: GPTQ’s symmetric calibration uses inputs from previous quantized layers, which deviate from the original model’s full-precision activations.GPTAQ instead uses full-precision input activations in an asymmetric calibration scheme.
  • Problem and proposal: GPTAQ accounts for quantization error, inverse Hessian information, and input deviation while parallelizing output channels and decomposing residual errors.The method adds about 20 lines of code to GPTQ and is applied to LLaMA3.1-405B and EVA-02.

2. Related Work

Finetuning-free quantization avoids the substantial computation of gradient-based optimization and can directly export quantized checkpoints. GPTAQ extends the Optimal Brain Compression framework with an input correction term for asymmetric calibration.

  • Finetuning-Free Quantization: Finetuning-free methods reduce precision without updating model parameters through training and can immediately export quantized checkpoints.Existing approaches include bias-and-scale correction, outlier reduction, and architecture modifications such as channel splitting and merging.
  • Finetuning-Free Quantization: GPTQ optimizes weight elements with closed-form solutions and does not require backpropagation.GPTQ and related methods can also be combined with other finetuning-free quantization techniques.
  • Finetuning-based Quantization: Finetuning-based quantization can achieve good performance but requires more computation and remains restricted to smaller models.Local fine-tuning reduces the scale problem but still requires more time and resources than finetuning-free approaches.
  • Optimal Brain Surgeon and Compression: GPTAQ extends Optimal Brain Compression by adding a correction term for the difference between quantized-layer inputs and ground-truth inputs.The resulting framework performs asymmetric calibration rather than the symmetric calibration used by GPTQ and original OBC.

3. Background

The paper formulates layer quantization as preserving the original layer output under weight quantization. OBQ provides an iterative closed-form solution, while GPTQ makes this approach practical for very large transformers through parallelization and Cholesky reformulation.

  • Notations: The notation represents a linear layer as y = wX, with w as an output-channel weight row and X as the input activation matrix.Quantization is written as ˆw = quant(w), and negative indices denote removal of input neurons.
  • OBQ and GPTQ: OBQ calibration minimizes the difference between the original and quantized layer outputs when converting FP16 weights to integer representations.The calibration process is based on preserving model behavior after quantization.
  • OBQ and GPTQ: OBQ iteratively computes an optimal quantized value and weight adjustment for each selected weight.Its inverse Hessian is represented by H^-1 = (XX⊤)^-1 and updated after each quantization step to exclude the quantized entry.
  • OBQ and GPTQ: GPTQ improves OBQ’s scalability through enhanced parallelization and Cholesky reformulation for numerical stability.These changes make layer-wise quantization practical for models with hundreds of billions of parameters.

4. GPTAQ Methodology

GPTAQ addresses accumulated activation deviations by calibrating each quantized layer against full-precision inputs, then derives and accelerates an asymmetric optimization procedure. Its implementation combines arbitrary processing orders, residual decomposition, row parallelism, and Cholesky reformulation to approach GPTQ-like efficiency.

  • Asymmetric calibration: GPTAQ preserves full-precision layer-input characteristics by optimizing against quantized inputs ˜X rather than treating activations symmetrically.Previous-layer activation and weight quantization create deviations that accumulate with network depth.
  • Optimal framework: The asymmetric objective introduces residual output errors r = w eX − wX into the closed-form weight-update problem.For each output channel, the method minimizes residual error while enforcing the quantization constraint ∆w = ˆw − w.
  • Optimal framework: Quantization proceeds iteratively by selecting q = arg minq Lq, quantizing ˆwq, and updating the remaining full-precision weights.The process repeats until all weight elements are quantized, while maintaining the inverse-Hessian updates used by the framework.
  • Efficient solution: Arbitrary weight orders enable parallel processing across rows, avoiding the GPU-parallelization barriers caused by different optimal q orderings across output channels.The method adopts GPTQ’s sequential column order while computing weight updates across all rows simultaneously.
  • Efficient solution: Residual decomposition eliminates repeated residual re-estimation by splitting R into neuron-specific components and estimating R once before layer calibration.The second residual term can then be computed with W_:,qP_q,: at O(mn) complexity, reducing its complexity by a factor of n.
  • Efficient solution: Cholesky decomposition factorizes H^-1 = LL^T to improve numerical stability and support efficient computation and fusion of the residual term.The reformulation integrates with GPTQ’s Cholesky-based implementation and supports lazy batching for better GPU utilization.

5. Experiments

GPTAQ improves finetuning-free low-bit quantization across vision and language transformers by accounting for asymmetric input deviations and accumulated prior-layer errors. Experiments show gains over GPTQ and scalability to extremely large models.

  • Vision Transformer: GPTAQ improves 4-bit DeiT-S accuracy by 1% and DeiT-B accuracy by 0.7% over GPTQ.
  • Vision Transformer: 46.8% accuracy on W2A4 DeiT-S exceeds GPTQ’s 38.4% and RepQ-ViT’s 0.23%.
  • Language Transformer: GPTAQ improves LLaMA2-7B perplexity from GPTQ’s 6.0 to 5.85 after rotation-based calibration.
  • Language Transformer: 6.93 perplexity on 4-bit LLaMA3-70B improves over GPTQ’s 9.44, while W2A4 GPTAQ reduces GPTQ perplexity by 20%∼90%.
  • Language Transformer: GPTAQ reduces GPTQ’s full-precision accuracy gaps from 7.2% to 4.7% for 8B models and from 18% to 11% for 70B models.
  • Language Transformer: 63.8% average accuracy for LLaMA3-8B-Instruct is 2.4% above AWQ and 1.3% above GPTQ under 3-bit per-group weight quantization.
  • Huge Transformers: On one A100 GPU, GPTAQ reduces EVA-02’s accuracy gap to 1.7% and achieves 4.32 perplexity on LLaMA3.1-405B.
  • Ablation Study: Combining current-layer and previous-layer error terms further improves quantization performance, indicating accumulated prior-layer errors matter during calibration.

Conclusion

GPTAQ is an efficient finetuning-free quantization method designed to reduce accumulated asymmetry error. It parallelizes optimal weight-update computation and improves quantization performance without finetuning.

  • GPTAQ reduces accumulated asymmetry error in quantization without involving finetuning.
  • The method introduces four steps to parallelize and accelerate optimal weight-update computation.
  • GPTAQ adapts to GPTQ with minimum implementation effort while improving quantization performance.The paper describes GPTAQ as easy to implement within the previous GPTQ framework.

A. Theoretical Derivation

The theoretical derivation obtains the optimal framework by differentiating the Lagrangian and simplifying the resulting loss. The resulting update accounts for quantization and residual-output errors.

  • The derivation finds local minima of the Lagrangian by setting its partial derivatives to zero.
  • The weight update Δw is obtained by solving the resulting equations and right-multiplying by the inverse Hessian.
  • The loss Lq is derived by substituting the optimal Δw into ||ΔwX − r||2 and expanding the resulting expression.

A.2. Proof of Lemma 4.1

The proof of Lemma 4.1 uses Cholesky structure and recursive elimination to derive relationships among blocks of the inverse Hessian.

  • The proof considers the inverse Hessian H−1 and uses its Cholesky decomposition H−1 = LL⊤.
  • The Cholesky factor is partitioned into blocks, producing a linear system involving L2:,1 and L2:,2:.
  • The lemma is derived recursively by removing the first row and column from the current inverse Hessian.

A.3. Proof of Theorem 4.2

The theorem proof computes each row of P using the Cholesky factor and triangular structure. Masking enables efficient matrix construction before multiplication by L⊤.

  • The proof begins by computing each row of P from its stated matrix formula.
  • Because L i+1:,i+1: is triangular, entries of P are nonzero only under the corresponding index condition.
  • The matrix O is computed by masking the lower-triangular area of ΔXX⊤L.
  • Since O has zeros in its lower-triangular area, it can be directly multiplied by L⊤ to obtain P.

B.1. Weight-only Quantization with Rotation

The section evaluates weight-only quantization on LLaMA models and describes GPTAQ’s blockwise calibration procedure. QuaRot+GPTAQ improves low-bit weight-only results, especially in W2A16 settings.

  • Evaluation setup: Weight-only quantization is evaluated on LLaMA2 and LLaMA3 with per-channel asymmetric 2-, 3-, and 4-bit weights.
  • Evaluation setup: The comparison includes AWQ, OmniQuant, QuaRot, and QuaRot+GPTQ baselines.
  • GPTAQ procedure: GPTAQ processes the transformer block by block, storing full-precision block inputs before quantizing each layer.Only one block is loaded into GPU memory during the procedure.
  • GPTAQ procedure: During calibration, GPTAQ computes H and ΔXX⊤, applies its layerwise algorithm, quantizes each layer’s weights, and updates the quantized block input.
  • Results: ∼50% perplexity reduction in W2A16 cases is reported for GPTAQ relative to GPTQ, while QuaRot+GPTAQ also enhances weight-only quantization performance.The reported metric is Wikitext2 perplexity.

C. Memory Analysis

The memory analysis limits temporary full-precision activations to the block being calibrated while retaining only the smaller update matrix P on the GPU. Model blocks and activation data can otherwise be staged through CPU memory to improve GPU efficiency.

  • Memory components: ˜X requires temporary storage only for computing ΔXX⊤ and can be released after that computation.
  • Memory components: P remains in GPU memory during iterative quantization updates, but its storage requirement is very small because m and n have relatively small dimensionality.
  • Peak-memory control: Materializing ˜X for the entire model can cause high peak GPU memory usage because k is large.
  • Peak-memory control: Algorithm 2 materializes only the ˜X associated with the block currently awaiting calibration, reducing temporary GPU storage.For a block with l layers, the temporary-memory requirement is analyzed blockwise.
  • Memory workflow: Blocks and full-precision activation information are staged through CPU memory and loaded to the GPU when needed, with empirically negligible latency overhead.
  • Memory workflow: The entire quantization process keeps only one copy of the model block inside GPU memory.Table 8 describes GPTQ/GPTAQ matrix dimensions, and Table 9 reports LLaMA2-7B calibration memory requirements with B = 128.
Loading 2504.02692v3…