Abstract
Large Language Models (LLMs) are proficient in natural language processing tasks, but their deployment is often restricted by extensive parameter sizes and computational demands. This paper focuses on post-training quantization (PTQ) in LLMs, specifically 4-bit weight and 8-bit activation (W4A8) quantization, to enhance computational efficiency—a topic less explored compared to weight-only quantization. We present two innovative techniques: activation-quantization-aware scaling (AQAS) and sequence-length-aware calibration (SLAC) to enhance PTQ by considering the combined effects on weights and activations and aligning calibration sequence lengths to target tasks. Moreover, we introduce dINT, a hybrid data format combining integer and denormal representations, to address the underflow issue in W4A8 quantization, where small values are rounded to zero. Through rigorous evaluations of LLMs, including OPT and LLaMA, we demonstrate that our techniques significantly boost task accuracies to levels comparable with full-precision models. By developing arithmetic units compatible with dINT, we further confirm that our methods yield a 2× hardware efficiency improvement compared to 8-bit integer MAC unit.
Introduction
While Large Language Models (LLMs) have revolutionized natural language processing, their massive scale presents significant deployment challenges. Most current compression efforts focus on weight-only quantization (e.g., 4-bit weights), which reduces memory footprint but leaves activations in high precision (FP16). This mismatch means that while memory is saved, the actual computation remains bottlenecked by expensive floating-point units. To achieve true hardware speedups, both weights and activations must be quantized (W4A8). However, quantizing activations is notoriously difficult due to extreme outliers and architectural variances. This paper introduces a robust framework to make W4A8 quantization near-lossless and hardware-efficient.
The Challenges of W4A8 Quantization
The transition to W4A8 quantization is hindered by three primary factors identified through empirical analysis:
- Architecture Variance: Models like OPT and LLaMA handle normalization differently. In OPT, LayerNorm is fused with subsequent weights, leading to normalized activations. In LLaMA, non-fused normalization results in significantly higher activation ranges and more aggressive outliers.
- Activation Diversity: Activation statistics are not static; they shift as the input sequence length increases. Longer sequences tend to produce larger dynamic ranges, making standard static calibration unreliable.
- The Underflow Problem: In 4-bit weight quantization, many small but critical values are rounded to zero. This "underflow" is a major source of accuracy degradation that traditional integer formats fail to address.
Proposed Methodology
To address these hurdles, we propose a three-pronged approach combining scaling, calibration, and a novel data format.
Activation-Quantization-Aware Scaling (AQAS)
Existing methods often optimize either activation scaling (like SmoothQuant) or weight scaling (like AWQ), frequently at the expense of the other. AQAS employs a hybrid approach using a Mean Squared Error (MSE) objective function to find optimal scaling factors that balance quantization errors for both weights and activations simultaneously. This ensures that reducing activation outliers does not inadvertently inflate weight quantization errors.
Sequence-Length-Aware Calibration (SLAC)
Recognizing that sequence length is a statistical feature of activation distributions, we introduce SLAC. This technique aligns the sequence length of the calibration dataset with the expected length of the target task. By tuning quantization parameters to the specific dynamic range the model will encounter during inference, we significantly improve the robustness of the quantized model.
dINT: Integer with Denormal Representation
To solve the underflow problem, we introduce dINT, a hybrid data format. Unlike standard INT4, which has a uniform spread, dINT reserves specific bit-patterns to represent "denormal" values at ±0.5 of the step size. This prevents small, important weights from being rounded to zero, preserving the model's reasoning capabilities without requiring the complexity of full floating-point hardware.
Evaluation and Results
Our framework was evaluated across the OPT and LLaMA model families on benchmarks including Wikitext-2, CommonSenseQA, and MMLU.
- Accuracy: On LLaMA-7B, our W4A8 method achieved performance within 1% of the full-precision (FP16) baseline across MMLU and reasoning tasks. It consistently outperformed 4-bit floating-point (FP4) formats due to its superior handling of small values.
- Hardware Efficiency: We synthesized a custom Multiply-Accumulate (MAC) unit for the dINT format. Compared to a standard INT8 unit, the dINT4 unit is 1.93× smaller in area and 2.56× more power-efficient, validating the 2× hardware efficiency claim.
Conclusion
By addressing architecture-specific outliers, sequence-length dependency, and the underflow problem, this work provides a viable path for W4A8 quantization in LLMs. The combination of AQAS, SLAC, and the dINT format enables near-lossless model compression that translates directly into significant hardware efficiency gains, moving LLM deployment beyond memory-only savings toward true computational acceleration.
Summary updated