提出无损二值适配方法,让低精度大模型微调后性能接近高精度水平。
LoTA-QAF: Lossless Ternary Adaptation for Quantization-Aware Fine-Tuning
- 设计二值适配权重,与量化网格对齐并调整所有量化参数
- 实现适配权重无损融合,4比特量化模型在MMLU上比16位LoRA高5.14%
- 适用于边缘设备部署,兼顾精度与计算效率,适合资源受限场景
量化与微调对在资源受限的边缘设备上部署大语言模型至关重要。然而,量化模型的微调面临三大挑战:第一,低精度量化权重(如4比特)与高精度适配权重(如16比特)之间存在数据类型不匹配,限制了推理时的计算效率;第二,将高精度适配权重合并到低精度权重时可能造成精度下降,因适配权重常需近似或截断;第三,目前尚无方法能支持适配权重的无损合并并同时调整所有量化权重。为此,本文提出无损二值适配的量化感知微调方法(LoTA-QAF)。该方法通过三方面实现:(i) 自定义二值适配(TA),使二值权重与量化网格对齐,并用于调整量化权重;(ii) 基于TA的机制实现适配权重无损融合;(iii) 使用二值符号梯度下降(t-SignSGD)更新TA权重。我们在Llama-3.1/3.3和Qwen-2.5模型族上应用该方法,在多个下游任务中验证其有效性。在MMLU基准上,该方法有效恢复量化模型性能,最高超越16位LoRA达5.14%。针对特定任务微调,16位LoRA表现更优,但LoTA-QAF仍优于其他方法。代码开源:github.com/KingdalfGoodman/LoTA-QAF。
原文摘要 · Abstract (English)
Quantization and fine-tuning are crucial for deploying large language models (LLMs) on resource-constrained edge devices. However, fine-tuning quantized models presents significant challenges, primarily stemming from: First, the mismatch in data types between the low-precision quantized weights (e.g., 4-bit) and the high-precision adaptation weights (e.g., 16-bit). This mismatch limits the computational efficiency advantage offered by quantized weights during inference. Second, potential accuracy degradation when merging these high-precision adaptation weights into the low-precision quantized weights, as the adaptation weights often necessitate approximation or truncation. Third, as far as we know, no existing methods support the lossless merging of adaptation while adjusting all quantized weights. To address these challenges, we introduce lossless ternary adaptation for quantization-aware fine-tuning (LoTA-QAF). This is a novel fine-tuning method specifically designed for quantized LLMs, enabling the lossless merging of ternary adaptation weights into quantized weights and the adjustment of all quantized weights. LoTA-QAF operates through a combination of: i) A custom-designed ternary adaptation (TA) that aligns ternary weights with the quantization grid and uses these ternary weights to adjust quantized weights. ii) A TA-based mechanism that enables the lossless merging of adaptation weights. iii) Ternary signed gradient descent (t-SignSGD) for updating the TA weights. We apply LoTA-QAF to Llama-3.1/3.3 and Qwen-2.5 model families and validate its effectiveness on several downstream tasks. On the MMLU benchmark, our method effectively recovers performance for quantized models, surpassing 16-bit LoRA by up to 5.14\%. For task-specific fine-tuning, 16-bit LoRA achieves superior results, but LoTA-QAF still outperforms other methods. Code: github.com/KingdalfGoodman/LoTA-QAF.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。