Quantized Side Tuning: Fast and Memory-Efficient Tuning of Quantized Large Language Models
作者: Zhengxin Zhang, Dan Zhao, Xupeng Miao, Gabriele Oliaro, Qing Li, Yong Jiang, Zhihao Jia
分类: cs.LG, cs.AI
发布日期: 2024-01-13
💡 一句话要点
提出量化侧调优以解决大语言模型调优的内存和速度问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 量化模型 侧网络 内存优化 大语言模型 微调技术 机器学习 自然语言处理
📋 核心要点
- 现有微调方法在内存占用和速度上存在显著不足,无法同时优化模型权重、优化器状态和中间激活的内存需求。
- 本文提出的量化侧调优(QST)通过量化模型权重和引入侧网络,避免了在LLM中进行反向传播,从而实现高效微调。
- 实验结果显示,QST在内存占用上可减少最多2.3倍,微调速度提升最多3倍,且在性能上与当前最优方法相当。
📝 摘要(中文)
对大型语言模型(LLMs)的微调在多种下游任务中已被证明有效。现有方法要么专注于参数高效的微调,仅更新少量可训练参数,要么试图在微调训练阶段减少内存占用。然而,现有方法仍需大量内存,且无法同时减轻模型权重、优化器状态和中间激活的内存占用。本文提出量化侧调优(QST),通过双阶段过程实现内存高效和快速的LLM微调。首先,QST将LLM的模型权重量化为4位,以减少内存占用;其次,QST引入一个与LLM分离的侧网络,利用LLM的隐藏状态进行任务特定预测,从而避免在LLM中进行反向传播,减少中间激活的内存需求。此外,QST利用低秩适配器和无梯度下采样模块显著减少可训练参数,从而节省优化器状态的内存占用。实验表明,QST可以将总内存占用减少最多2.3倍,并将微调过程加速最多3倍,同时在性能上与最先进的方法相当。对于完全微调,QST可将总内存占用减少最多7倍。
🔬 方法详解
问题定义:本文旨在解决大型语言模型微调过程中内存占用过高和速度缓慢的问题。现有方法在处理模型权重、优化器状态和中间激活时,无法有效降低内存需求,导致训练效率低下。
核心思路:论文提出的量化侧调优(QST)通过将模型权重量化为4位,并引入一个独立的侧网络,利用LLM的隐藏状态进行任务特定预测,从而避免在LLM中进行反向传播,显著降低内存需求。
技术框架:QST的整体架构包括两个主要阶段:第一阶段是对LLM的模型权重进行量化,第二阶段是通过侧网络进行任务特定的预测。侧网络的设计使得中间激活的内存需求大幅降低,同时结合低秩适配器和无梯度下采样模块,进一步减少可训练参数。
关键创新:QST的核心创新在于通过量化和侧网络的结合,解决了现有方法无法同时优化内存占用的难题。与传统方法不同,QST避免了在LLM中进行反向传播,从而有效降低了内存需求。
关键设计:在具体实现中,QST采用4位量化技术来压缩模型权重,并设计了低秩适配器和无梯度下采样模块,以减少优化器状态的内存占用。侧网络的结构设计也经过优化,以确保在进行任务特定预测时,能够高效利用LLM的隐藏状态。
🖼️ 关键图片
📊 实验亮点
实验结果表明,QST在内存占用上可减少最多2.3倍,微调速度提升最多3倍,且在性能上与当前最先进的方法相当。在完全微调的情况下,QST能够将总内存占用减少最多7倍,显示出其在实际应用中的巨大潜力。
🎯 应用场景
该研究的潜在应用领域包括自然语言处理、对话系统和文本生成等。通过提高大型语言模型的微调效率,QST能够加速模型在实际应用中的部署,降低资源消耗,提升用户体验。未来,QST有望在更广泛的AI应用中发挥重要作用,推动大规模模型的普及与应用。
📄 摘要(原文)
Finetuning large language models (LLMs) has been empirically effective on a variety of downstream tasks. Existing approaches to finetuning an LLM either focus on parameter-efficient finetuning, which only updates a small number of trainable parameters, or attempt to reduce the memory footprint during the training phase of the finetuning. Typically, the memory footprint during finetuning stems from three contributors: model weights, optimizer states, and intermediate activations. However, existing works still require considerable memory and none can simultaneously mitigate memory footprint for all three sources. In this paper, we present Quantized Side Tuing (QST), which enables memory-efficient and fast finetuning of LLMs by operating through a dual-stage process. First, QST quantizes an LLM's model weights into 4-bit to reduce the memory footprint of the LLM's original weights; QST also introduces a side network separated from the LLM, which utilizes the hidden states of the LLM to make task-specific predictions. Using a separate side network avoids performing backpropagation through the LLM, thus reducing the memory requirement of the intermediate activations. Furthermore, QST leverages several low-rank adaptors and gradient-free downsample modules to significantly reduce the trainable parameters, so as to save the memory footprint of the optimizer states. Experiments show that QST can reduce the total memory footprint by up to 2.3 $\times$ and speed up the finetuning process by up to 3 $\times$ while achieving competent performance compared with the state-of-the-art. When it comes to full finetuning, QST can reduce the total memory footprint up to 7 $\times$.