[Paper Review] QA-LoRA: Quantization-Aware Low-Rank Adaptation of Large Language Models
QA-LoRA jointly quantizes and abducts adaptation weights to enable low-bit fine-tuning and deployment, outperforming QLoRA with PTQ while maintaining quantized inference.
Recently years have witnessed a rapid development of large language models (LLMs). Despite the strong ability in many language-understanding tasks, the heavy computational burden largely restricts the application of LLMs especially when one needs to deploy them onto edge devices. In this paper, we propose a quantization-aware low-rank adaptation (QA-LoRA) algorithm. The motivation lies in the imbalanced degrees of freedom of quantization and adaptation, and the solution is to use group-wise operators which increase the degree of freedom of quantization meanwhile decreasing that of adaptation. QA-LoRA is easily implemented with a few lines of code, and it equips the original LoRA with two-fold abilities: (i) during fine-tuning, the LLM's weights are quantized (e.g., into INT4) to reduce time and memory usage; (ii) after fine-tuning, the LLM and auxiliary weights are naturally integrated into a quantized model without loss of accuracy. We apply QA-LoRA to the LLaMA and LLaMA2 model families and validate its effectiveness in different fine-tuning datasets and downstream scenarios. Code will be made available at https://github.com/yuhuixu1993/qa-lora.
Motivation & Objective
- Motivate reducing both training and inference costs for large language models by marrying quantization with parameter-efficient fine-tuning.
- Propose a group-wise quantization strategy that increases quantization freedom while constraining adaptation freedom.
- Enable fine-tuning with low-bit quantized weights and merge fine-tuned weights back into a quantized model for efficient deployment.
- Demonstrate applicability to LLaMA and LLaMA2 families across multiple datasets and bit-widths.
Proposed method
- Introduce QA-LoRA, which partitions each input column of W into L groups and quantizes each group independently.
- Constrain LoRA adaptation by sharing row vectors within the same group, reducing adaptation parameter count.
- Quantize W into low-bit representations during fine-tuning using per-column scaling/zero factors, while incorporating the LoRA term s*A*B.
- Merge the adapted weights back into a quantized form (W' = W~ + s*A*B) without requiring post-training quantization.
- Provide a PyTorch-like implementation that adds only a few lines of code to standard LoRA/QLoRA pipelines.
- Use group-wise quantization to balance degrees of freedom between quantization and adaptation, improving accuracy at low bit-widths.
Experimental results
Research questions
- RQ1Can quantization-aware low-rank adaptation maintain or improve accuracy when fine-tuning LLMs with low-bit quantization?
- RQ2Does group-wise quantization increase the degrees of freedom for quantization sufficiently to compensate for adaptation during fine-tuning?
- RQ3How does QA-LoRA compare to LoRA and QLoRA (with/without PTQ) in terms of accuracy and inference/fine-tuning speed across model scales and datasets?
Key findings
- QA-LoRA consistently outperforms QLoRA with PTQ across model scales and fine-tuning datasets in MMLU and zero-/few-shot settings.
- QA-LoRA achieves faster fine-tuning and inference than QLoRA due to INT4 quantization and maintained quantized representation after training.
- Compared to QLoRA without PTQ, QA-LoRA maintains competitive or superior accuracy while avoiding costly PTQ steps.
- QA-LoRA shows stronger gains when bit width is lower (e.g., INT3 or INT2) and on smaller foundation models.
- The method remains lightweight and easy to implement, requiring only minor code changes.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.