Accurate and Efficient Fine-Tuning of Quantized Large Language Models Through Optimal Balance

Ao Shen, Qiang Wang, Zhiquan Lai, Xionglve Li, Dongsheng Li
7/24/2024
cs.LG

Official code: xiaocaigou/qbaraqahira (6 stars, last commit 2025-02-27).

Abstract

Large Language Models (LLMs) have demonstrated impressive performance across various domains. However, the enormous number of model parameters makes fine-tuning challenging, significantly limiting their application and deployment. Existing solutions combine parameter quantization with Low-Rank Adaptation (LoRA), reducing memory usage but causing performance degradation. Additionally, converting fine-tuned models to low-precision representations further degrades performance. In this paper, we identify an imbalance in fine-tuning quantized LLMs with LoRA: overly complex adapter inputs and outputs versus low effective trainability of the adapter, leading to underfitting during fine-tuning. Thus, we propose Quantized LLMs fine-tuning with Balanced Low-Rank Adaptation (Q-BLoRA), which simplifies the adapter's inputs and outputs while increasing the adapter's rank to alleviate underfitting during fine-tuning. For low-precision deployment, we propose Quantization-Aware fine-tuning with Balanced Low-Rank Adaptation (QA-BLoRA), which aligns with the block-wise quantization and facilitates quantization-aware fine-tuning of low-rank adaptation based on the parameter merging of Q-BLoRA. Both Q-BLoRA and QA-BLoRA are easily implemented and offer the following optimizations: (i) Q-BLoRA consistently achieves state-of-the-art accuracy compared to baselines and other variants; (ii) QA-BLoRA enables the direct generation of low-precision inference models, which exhibit significant performance improvements over other low-precision models. We validate the effectiveness of Q-BLoRA and QA-BLoRA across various models and scenarios. Code will be made available at \href{https://github.com/xiaocaigou/qbaraqahira}{https://github.com/xiaocaigou/qbaraqahira}

View on arXivView PDF

Code Implementations(1)

Official PyTorch implementation of Q-BaRA and QA-HiRA

60Shell, PythonJul 22, 20241 years ago

Cite this paper

@article{shen2024accurate,
  title  = {Accurate and Efficient Fine-Tuning of Quantized Large Language Models Through Optimal Balance},
  author = {Ao Shen and Qiang Wang and Zhiquan Lai and Xionglve Li and Dongsheng Li},
  year   = {2024},
  eprint = {2407.17029},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.17029v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.17029.svg)](https://codeofpaper.com/paper/2407.17029)

Discussion