4-bit量化让大模型轻装上阵,精度不降反升。
Qrazor: Reliable and Effortless 4-bit LLM Quantization by Significant Data Razoring
- 先用8/16位整数粗量化,再保留最显著4比特
- 零样本推理准确率超顶尖方法12点以上
- 无需微调或训练,适合快速部署
大规模语言模型在语言任务中表现优异,但因高内存和计算需求难以部署。4比特量化虽具潜力,却常导致精度大幅下降或需复杂预处理。为此,我们提出QRazor,一种简单有效的量化方案,可对基于Transformer的LLM权重、激活值及键值缓存进行4比特量化。该方法分两阶段:第一阶段使用8或16位整数结合绝对最大值缩放进行量化,保持接近全精度模型的精度;第二阶段通过显著数据削薄(SDR)技术将量化数据压缩至4比特,仅保留最显著的四位。无需微调或额外训练,QRazor在LLaMA2-7B模型上零样本推理任务中,准确率超越Smoothquant和QLLM超过12点,优于Quarot(RTN)超过2.9点。此外,我们设计了面向QRazor的整数算术单元,支持直接在SDR数据上进行低精度运算,无需解压。
原文摘要 · Abstract (English)
Large-scale language models (LLMs) excel in language processing tasks but face deployment challenges due to high memory and computational demands. While low-bit quantization, such as 4-bit techniques, offers a potential solution, these methods often suffer from significant accuracy loss or require considerable effort for implementation such as reordering, rotation, etc. To address these challenges, we propose QRazor, a simple yet effective quantization scheme that enables 4-bit quantization of weights, activations, and KV cache in transformer-based LLMs. QRazor operates in two stages: first, quantizing data using 8 or 16-bit integers as a basis with absolute max scaling to preserve accuracy close to full-precision models, and second, compressing the quantized data to 4-bit using our significant data razoring (SDR) technique, which retains only the four most salient bits. Without any additional requirment of fine-tuning or additional training, QRazor achieves performance similar or better compared to state-of-the-art in 4-bit quantization method, surpassing Smoothquant and QLLM by over 12 points and Quarot(RTN) by more than 2.9 points in zero-shot reasoning task accuracy on the LLaMA2-7B model. Additionally, we introduce an integer-based arithmetic unit optimized for QRazor, allowing direct low-precision operations on SDR data without decompression.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。