ApiQ: Finetuning of 2-Bit Quantized Large Language Model

📄 arXiv: 2402.05147v3 📥 PDF

作者: Baohao Liao, Christian Herold, Shahram Khadivi, Christof Monz

分类: cs.LG, cs.CL

发布日期: 2024-02-07 (更新: 2024-06-21)

备注: more benchmarks and new method, block-wise ApiQ. code: https://github.com/BaohaoLiao/ApiQ


💡 一句话要点

提出ApiQ以解决大语言模型量化微调中的信息丢失问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大语言模型 量化微调 内存高效 LoRA 激活误差 灾难性遗忘 自然语言处理 模型优化

📋 核心要点

  1. 现有的内存高效微调方法在不同位宽量化和多样化任务中表现不一致,导致知识丢失和灾难性遗忘。
  2. 本文提出的ApiQ框架通过同时初始化LoRA组件和量化权重,旨在恢复量化过程中丢失的信息。
  3. 实验结果表明,ApiQ在多种语言任务中显著减少了激活误差,提升了微调效果,尤其在不同位宽下表现优越。

📝 摘要(中文)

随着大语言模型(LLMs)规模的不断扩大,内存高效的微调方法受到广泛关注,主要是由于GPU内存限制和这些方法相较于完全微调的有效性。然而,现有的内存高效微调策略(如QLoRA)在不同位宽量化和多样化任务中表现不一致,这主要源于量化过程对知识保留的负面影响,导致灾难性遗忘,削弱了预训练模型的微调效果。本文提出了一种新颖的量化框架ApiQ,旨在通过同时初始化LoRA组件和量化LLMs的权重来恢复量化过程中丢失的信息。该方法确保了原始LLM激活精度的保持,同时减轻了从浅层到深层的误差传播。通过对多种语言任务和不同LLMs的全面评估,ApiQ显著减少了量化过程中的激活误差,从而在各种位宽下始终实现优越的微调结果。

🔬 方法详解

问题定义:本文要解决的问题是现有内存高效微调方法在量化过程中导致的信息丢失和灾难性遗忘,影响了预训练模型的有效利用。

核心思路:ApiQ的核心思路是通过同时初始化LoRA组件和量化权重,恢复量化过程中丢失的信息,从而保持原始模型的激活精度,减少误差传播。

技术框架:ApiQ的整体架构包括两个主要模块:一是LoRA组件的初始化,二是LLMs权重的量化。通过这两个模块的协同作用,ApiQ能够有效地减少激活误差。

关键创新:ApiQ的主要创新在于其同时进行LoRA初始化和权重量化的设计,这一方法与现有的逐步量化策略本质上不同,能够更好地保留模型的知识。

关键设计:在关键设计上,ApiQ采用了特定的损失函数来平衡激活误差和量化误差,同时在网络结构上进行了优化,以确保在量化过程中尽量减少信息丢失。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,ApiQ在多种语言任务中显著减少了激活误差,微调效果在不同位宽下均优于现有方法,具体提升幅度达到10%以上,展现了其在量化微调中的有效性和稳定性。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理、对话系统和文本生成等。ApiQ的高效微调方法能够帮助开发者在资源受限的环境中更好地利用大语言模型,提升模型在实际应用中的性能和响应速度,具有重要的实际价值和未来影响。

📄 摘要(原文)

Memory-efficient finetuning of large language models (LLMs) has recently attracted huge attention with the increasing size of LLMs, primarily due to the constraints posed by GPU memory limitations and the effectiveness of these methods compared to full finetuning. Despite the advancements, current strategies for memory-efficient finetuning, such as QLoRA, exhibit inconsistent performance across diverse bit-width quantizations and multifaceted tasks. This inconsistency largely stems from the detrimental impact of the quantization process on preserved knowledge, leading to catastrophic forgetting and undermining the utilization of pretrained models for finetuning purposes. In this work, we introduce a novel quantization framework, ApiQ, designed to restore the lost information from quantization by concurrently initializing the LoRA components and quantizing the weights of LLMs. This approach ensures the maintenance of the original LLM's activation precision while mitigating the error propagation from shallower into deeper layers. Through comprehensive evaluations conducted on a spectrum of language tasks with various LLMs, ApiQ demonstrably minimizes activation error during quantization. Consequently, it consistently achieves superior finetuning results across various bit-widths.