量子化全参数微调:在低成本资源下对大语言模型的全参数微调
QFT: Quantized Full-parameter Tuning of LLMs with Affordable Resources
AI总结:
本文提出QFT框架,通过将训练状态量化为INT8格式,减少内存占用,实现低成本全参数微调。采用Lion优化器和混合特征量化器,确保训练性能,使LLaMA-7B模型在A6000 GPU上仅需<30GB内存。
摘要:
大型语言模型(LLMs)在自然语言处理任务中展现了显著影响。对这些预训练模型进行微调可进一步提升性能,但通常需要大量昂贵的高端GPU。尽管已有参数高效微调的努力,但无法完全释放全参数微调的潜力。本文提出QFT,一种用于LLMs的量子化全参数微调框架,将所有训练状态(包括权重、梯度和优化器状态)量化并存储为INT8格式,以减少训练内存,从而在低成本资源下实现全参数微调。为确保训练性能,我们采取两项关键措施:i)对于量化梯度和优化器状态,我们理论证明Lion优化器因其一致的更新幅度而对量化具有高度鲁棒性;ii)对于量化权重,我们采用混合特征量化器,识别并保护一小部分稀疏关键特征,同时量化其余密集特征,从而确保准确的权重更新而无需FP32备份。此外,为支持整数上下文中的反向传播,我们开发了一种基于栈的梯度流方案,具有O(1)复杂度,形成统一的整数训练流水线。结果,QFT将模型状态内存减少到标准方案的21%,同时实现可比性能,例如,微调LLaMA-7B模型仅需<30GB内存,使其在单个A6000 GPU上成为可能。
英文摘要:
Large Language Models (LLMs) have showcased remarkable impacts across a wide spectrum of natural language processing tasks. Fine-tuning these pretrained models on downstream datasets provides further significant performance gains; however, this process typically requires a large number of expensive, high-end GPUs. Although there have been efforts focused on parameter-efficient fine-tuning, they cannot fully unlock the powerful potential of full-parameter fine-tuning. In this paper, we propose QFT, a Quantized Full-parameter Tuning framework for LLMs that quantizes and stores all training states, including weights, gradients, and optimizer states, in INT8 format to reduce training memory, thereby enabling full-parameter fine-tuning on existing GPUs at an affordable cost. To ensure training performance, we make two key efforts: i) for quantized gradients and optimizer states, we theoretically prove that the Lion optimizer, with its property of consistent update magnitudes, is highly robust to quantization; ii) and for quantized weights, we employ the hybrid feature quantizer, which identifies and protects a small subset of sparse critical features while quantizing the remaining dense features, thus ensuring accurate weight updates without FP32 backups. Moreover, to support backpropagation in the integer context, we develop a stack-based gradient flow scheme with O(1) complexity, forming a unified integer training pipeline. As a result, QFT reduces the model state memory to 21% of the standard solution while achieving comparable performance, e.g., tuning a LLaMA-7B model requires only <30GB of memory, making it feasible on a single A6000 GPU.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。