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.
翻译:量化是服务于大语言模型(LLMs)不可或缺的技术,且近来已融入LoRA微调流程。本文聚焦于在预训练模型上同时应用量化与LoRA微调的场景。在此类情境下,常可观察到全微调方法与"量化+LoRA微调"方法在下游任务性能之间存在持续性差距。为此,我们提出LoftQ(LoRA微调感知量化)——一种新型量化框架,能在量化LLM的同时为其LoRA微调找到合适的低秩初始化。这种初始化方式可缓解量化模型与全精度模型之间的差异,并显著提升下游任务的泛化性能。我们在自然语言理解、问答、摘要生成及自然语言生成任务上评估了该方法。实验表明,我们的方法极为有效,且优于现有量化方法,尤其在具有挑战性的2比特和2/4比特混合精度场景下。我们将公开发布代码。