Abstract
Despite the remarkable strides of Large Language Models (LLMs) in various fields, the wide applications of LLMs on edge devices are limited due to their massive parameters and computations. To address this, quantization is commonly adopted to generate lightweight LLMs with efficient computations and fast inference. However, Post-Training Quantization (PTQ) methods dramatically degrade in quality when quantizing weights, activations, and KV cache together to below 8 bits. Besides, many Quantization-Aware Training (QAT) works quantize model weights, leaving the activations untouched, which do not fully exploit the potential of quantization for inference acceleration on the edge. In this paper, we propose EdgeQAT, the Entropy and Distribution Guided QAT for the optimization of lightweight LLMs to achieve inference acceleration on Edge devices. We first identify that the performance drop of quantization primarily stems from the information distortion in quantized attention maps, demonstrated by the different distributions in quantized query and key of the self-attention mechanism. Then, the entropy and distribution guided QAT is proposed to mitigate the information distortion. Moreover, we design a token importance-aware adaptive method to dynamically quantize the tokens with different bit widths for further optimization and acceleration. Our extensive experiments verify the substantial improvements with our framework across various datasets. Furthermore, we achieve an on-device speedup of up to 2.37x compared with its FP16 counterparts across multiple edge devices, signaling a groundbreaking advancement.
Introduction
As privacy concerns and cloud costs rise, there is a significant push to move AI from the cloud to the "edge"—smartphones and local IoT devices. Small Language Models (SLMs) with fewer than a billion parameters are ideal candidates for this transition. However, making these models run efficiently on mobile hardware requires quantization: reducing the precision of weights and activations from 16-bit floats to 4-bit or 8-bit integers. Standard quantization often causes a massive drop in accuracy, especially at 4-bit. While advanced fine-grained quantization methods exist, they are often incompatible with the SIMD (Single Instruction Multiple Data) hardware found in mobile CPUs, leading to computational overhead rather than speedups.
Methodology: The EdgeQAT Framework
The EdgeQAT framework (also referred to as Squat) addresses these challenges through a software-hardware co-design approach:
- Entropy-Guided & Distribution-Aligned Distillation: The framework introduces a loss function that maximizes the "information entropy" of quantized values and aligns their distribution with the original FP16 model. This preserves the representational power of the model even at low bit-widths.
- Token Adaptive Quantization: Recognizing that not all tokens are equally important, EdgeQAT uses attention maps to identify critical tokens and assigns them 8 bits, while less critical tokens are compressed to 4 bits. This reduces redundancy without sacrificing linguistic accuracy.
- MKMP Multiplier: To ensure mixed-precision math runs efficiently on standard hardware, the researchers developed a Multi-Kernel Mixed-Precision (MKMP) multiplier. This custom kernel allows standard mobile CPUs to process 4-bit operands using existing high-speed INT8 instructions.
Key Insights: The Attention Bottleneck
A critical finding in this research was identifying the primary source of accuracy loss during quantization. The researchers discovered that the distortion in the attention map—specifically how tokens interact with the very first token in a sequence—is the biggest casualty of precision reduction. By focusing optimization on the Queries (Q) and Keys (K) in the self-attention mechanism, the framework effectively "fights back" against the loss of precision.
Experimental Results
The researchers evaluated EdgeQAT using LLaMA-58M and GPT2-97M models across benchmarks like BLiMP and GLUE.
- Near-Lossless Accuracy: In a W4A8 configuration (4-bit weights, 8-bit activations), EdgeQAT achieved an average accuracy of 69.4% on BLiMP, nearly matching the FP16 baseline of 69.7%.
- Significant Speedups: On a Snapdragon 8 Gen 2 (OnePlus 11), the framework achieved a 2.24× speedup. On a Raspberry Pi 5, it reached a 2.31× speedup, with peak performance reaching 2.37×.
- Superiority over Baselines: EdgeQAT consistently outperformed state-of-the-art QAT methods like NIPQ and LLM-QAT, particularly in aggressive 4-bit settings where other methods often saw accuracy collapse.
Conclusion
EdgeQAT demonstrates that high-performance SLM deployment on edge devices is achievable through entropy-guided optimization and hardware-aware design. While current experiments focused on models under 100M parameters, future work will explore scaling these techniques to the 1B to 3B parameter range and extending hardware-aware kernels to mobile GPUs and NPUs.
Summary updated