Quantization is an indispensable technique for serving Large Language Models (LLMs) and has recently found its way into LoRA fine-tuning. In this work we focus on the scenario where quantization and LoRA fine-tuning are applied together on a pre-trained model. In such cases it is common to observe a consistent gap in the performance on downstream tasks between full fine-tuning and quantization plus LoRA fine-tuning approach. In response, we propose LoftQ (LoRA-Fine-Tuning-aware Quantization), a novel quantization framework that simultaneously quantizes an LLM and finds a proper low-rank initialization for LoRA fine-tuning. Such an initialization alleviates the discrepancy between the quantized and full-precision model and significantly improves the generalization in downstream tasks. We evaluate our method on natural language understanding, question answering, summarization, and natural language generation tasks. Experiments show that our method is highly effective and outperforms existing quantization methods, especially in the challenging 2-bit and 2/4-bit mixed precision regimes. We will release our code.
翻译:量化是服务于大语言模型(LLM)不可或缺的技术,并已开始应用于LoRA微调。本研究聚焦于在预训练模型上同时采用量化与LoRA微调的场景。在此类场景中,通常观察到全精度微调与"量化+LoRA微调"方法在下游任务性能上存在持续差距。为此,我们提出LoftQ(LoRA微调感知量化)——一种新颖的量化框架,可同步实现LLM量化与为LoRA微调寻找合适的低秩初始化。这种初始化方法能减小量化模型与全精度模型之间的差异,显著提升下游任务的泛化能力。我们在自然语言理解、问答、摘要生成及自然语言生成任务上评估了该方法。实验表明,本方法效果显著,特别是在2比特和2/4比特混合精度等具有挑战性的量化场景中,其表现优于现有量化方法。我们将公开发布代码实现。