Source-linked AI summary

QDyLoRA: Quantized Dynamic Low-Rank Adaptation for Efficient Large Language Model Tuning

Hossein Rajabzadeh, Mojtaba Valipour, Tianshu Zhu, Marzieh Tahaei, Hyock Ju Kwon, Ali Ghodsi, Boxing Chen, Mehdi Rezagholizadeh

arXiv:2402.10462v1cs.LGcs.CL

TL;DR

Large-model fine-tuning is memory-intensive, and choosing a LoRA rank is challenging because performance varies with rank. QDyLoRA combines dynamic low-rank adaptation with quantization to fine-tune across ranks in one run; the authors report that it consistently outperforms QLoRA, including at low optimal ranks.

  • Problem

    Fine-tuning large LLMs is costly, and choosing a LoRA rank is difficult because performance varies across ranks and rank searches or device-specific models take time.

    Source: §1 · p. 1
  • Method

    QDyLoRA combines DyLoRA’s dynamic rank adaptation with QLoRA’s 4-bit quantization to fine-tune LLMs across a predefined range of ranks.

    Source: §1 · p. 2, §2 · p. 3
  • Results

    QDyLoRA consistently outperforms QLoRA in the reported experiments, with its optimal rank sometimes surprisingly low.

    Source: §1 · p. 2, §5 · p. 4, §3 · p. 4
  • Takeaways & Limitations

    QDyLoRA can avoid fine-tuning multiple models to find an optimal rank and offers flexibility for deployment across different contexts.

    Source: §5 · p. 4

    The 4-bit QDyLoRA does not reach full-precision fine-tuning performance; further study is needed on the LoRA scalar and rank range.

    Source: Limitations · p. 5

Abstract

from arXiv · show

Finetuning large language models requires huge GPU memory, restricting the choice to acquire Larger models. While the quantized version of the Low-Rank Adaptation technique, named QLoRA, significantly alleviates this issue, finding the efficient LoRA rank is still challenging. Moreover, QLoRA is trained on a pre-defined rank and, therefore, cannot be reconfigured for its lower ranks without requiring further fine-tuning steps. This paper proposes QDyLoRA -Quantized Dynamic Low-Rank Adaptation-, as an efficient quantization approach for dynamic low-rank adaptation. Motivated by Dynamic LoRA, QDyLoRA is able to efficiently finetune LLMs on a set of pre-defined LoRA ranks. QDyLoRA enables fine-tuning Falcon-40b for ranks 1 to 64 on a single 32 GB V100-GPU through one round of fine-tuning. Experimental results show that QDyLoRA is competitive to QLoRA and outperforms when employing its optimal rank.

1 Introduction

QDyLoRA combines dynamic low-rank adaptation with QLoRA’s quantization scheme to tune LLMs across ranks in one round, addressing the costly challenge of selecting a LoRA rank. The related work covers low-rank adapters, quantization-aware PEFT, and dynamic-rank training.

1.1 Related Work

  • QLoRA combines LoRA modules with 4-bit NF4, Double Quantization, and Paged Optimizers to reduce memory use during fine-tuning.The introduction reports fine-tuning a 65-billion-parameter model on one 48GB GPU while maintaining full 16-bit fine-tuning performance.Source: §1 · p. 1, §1.1 · pp. 2–3

1 Introduction

  • LoRA rank selection is difficult because task performance varies with rank, while searches or separate models for different device configurations are costly and time-consuming.Higher ranks can also be problematic on sensitive devices because they increase parameter count.Source: §1 · p. 1

1.1 Related Work

  • DyLoRA trains adapter blocks across a sorted spectrum of ranks, allowing rank selection at inference without additional training time.The approach is inspired by nested dropout and is reported to outperform LoRA.Source: §1 · p. 2

1 Introduction

  • QDyLoRA combines DyLoRA with QLoRA’s quantization scheme and tunes LLaMA-7b, LLaMA-13b, and Falcon-40b across ranks 1–64 on one 32GB V100 GPU.The authors report that the optimal rank can be low yet outperform QLoRA; Table 1 compares the methods on 5-shot MMLU across model sizes and reports the best QDyLoRA rank in brackets.Source: §1 · p. 2, Table 1 · p. 2

1.1 Related Work

  • Earlier PEFT work includes low-rank projections and adapters inserted after feed-forward or attention blocks, as well as parallel trainable modules and LoRA’s integrable low-rank updates.The related-work discussion connects low-rank adaptation to evidence that pretrained language models have low intrinsic dimension.Source: §1.1 · p. 2
  • Alpha-Tuning combines parameter-efficient adaptation with post-training quantization by fine-tuning task-specific scaling factors while keeping binary weights fixed.This approach is described as a quantization-aware PEFT method.Source: §1.1 · p. 2

2 Proposed Method: Quantized DyLoRA

QDyLoRA computes each forward pass using a rank-truncated submodel, with the selected rank varying during training. It stores pretrained weights in 4-bit NF4 and dequantizes them for BFloat16 computation.

2 Proposed Method: Quantized DyLoRA

  • At each iteration, the forward pass uses a truncated submodel at a selected rank b, with α as the LoRA scalar.The paper defines the truncated weight as W[:b,:] and describes a dynamic objective that evaluates the truncated submodel.Source: §2 · p. 3
  • Pretrained weights are stored in 4-bit NF4 and dequantized for BFloat16 computations before dynamic LoRA parameters are updated.The workflow is described in Algorithm 1.Source: §2 · p. 3

3 Experiments and Evaluation

Experiments compare QDyLoRA with QLoRA and DyLoRA across benchmarks, models, datasets, and evaluation ranks. Results favor QDyLoRA, especially at its optimal ranks, while DyLoRA runs out of memory on a larger-model setting.

3 Experiments and Evaluation

  • The experiments include instruct-fine-tuning tasks and compare methods under the same settings, with maximum LoRA rank set to 64 for Table 3.Table 3 reports exact matching across evaluation ranks.Source: §3 · pp. 3–4, Table 3 · p. 4
  • QDyLoRA consistently outperforms QLoRA on MMLU across the reported models and datasets by finding its optimal rank.The comparison uses the same training budget and maximum LoRA rank of 2 for both techniques.Source: §3 · p. 4
  • QDyLoRA outperforms QLoRA on WebGLM at Rank 2 and GSM8k at Rank 8, with particular consistency at lower ranks.The Falcon-40b comparison reports test performance across ranks.Source: §3 · p. 4
  • For LLaMA-7b, DyLoRA and QDyLoRA outperform QLoRA, while on LLaMA2-13b DyLoRA encounters an out-of-memory error and QDyLoRA performs best.The comparison covers TriviaQA as well as the reported model settings.Source: §3 · p. 4

4 On the semi-sorted behavior of QDyLoRA

QDyLoRA's performance across ranks is semi-sorted under a limited fine-tuning budget: lower ranks receive updates more often than higher ranks.

4 On the semi-sorted behavior of QDyLoRA

  • Under a limited fine-tuning budget, lower ranks are updated more frequently because selecting a higher rank also updates lower ranks.The authors identify this unequal update frequency as the reason lower ranks are more tuned, producing semi-sorted performance across ranks.Source: §4 · p. 4

5 Conclusion

The conclusion presents QDyLoRA as an efficient LoRA fine-tuning approach that can avoid training multiple models to find an optimal rank. Experiments indicate that the optimal rank can be low and that QDyLoRA consistently outperforms QLoRA.

5 Conclusion

  • QDyLoRA eliminates the need to fine-tune multiple models to find the optimal LoRA rank.The conclusion also identifies the possibility of fine-tuning larger LLMs as an advantage.Source: §5 · p. 4
  • Experiments show that QDyLoRA's optimal rank can be surprisingly low while it consistently outperforms QLoRA.Source: §5 · p. 4
  • The authors conclude that QDyLoRA offers a flexible approach to deploying LLMs in varied contexts and may make fine-tuning more accessible and efficient.Source: §5 · p. 4

Limitations

The 4-bit QDyLoRA results fall short of full-precision fine-tuning. The authors propose dynamic quantization as one possible direction and identify additional QDyLoRA design choices for investigation.

Limitations

  • 4-bit QDyLoRA does not reach the performance of full-precision fine-tuning.Source: Limitations · p. 5
  • Dynamic quantized DyLoRA is proposed as a possible approach, with quantization levels switching during fine-tuning based on predefined learning feedback.Source: Limitations · p. 5
  • Further research is needed on the impact of LoRA's scalar and the range of underlying ranks in QDyLoRA.Source: Limitations · p. 5

A.1 Hyperparameters

The experiments use shared and experiment-specific hyperparameters to configure optimization, LoRA layers, quantization, reproducibility, and training hardware.

A.1 Hyperparameters

  • Shared settings include the optimizer, Adam-Beta2 value, maximum gradient norm, and warmup ratio.These parameters influence how model weights adjust during training.Source: §A.1 · p. 6
  • LoRA dropout, maximum rank, and alpha configure LoRA layers, while double quantization and quantization type affect numerical precision.The quantization settings are the same as the baselines.Source: §A.1 · p. 6
  • Learning-rate scheduling, weight decay, random seeds, and GPU choice specify optimization, reproducibility, and training hardware.Configurations are tailored to Web-GLM, GSM8k, or the experiment in Table 1 and to available computational resources.Source: §A.1 · p. 6

A.2 Generated Text Quality

The authors assess generated text using a GSM8k query answered by Falcon-40b at different QDyLoRA ranks. Ranks 16, 28, and 32 give the same answer, while the rank-64 reasoning contains an arithmetic inconsistency despite reaching the same final amount.

A.2 Generated Text Quality

  • The quality check feeds Falcon-40b a sample GSM8k query and reports generated answers at different LoRA ranks.The query asks for daily market earnings from selling the eggs left after breakfast and muffin use.Source: §A.2 · p. 6
  • Rank 64 also gives a final amount of $18, but its reasoning inconsistently changes 7 eggs remaining into 9 eggs sold.It first calculates 16 - 3 - 4 = 7, then reports 7 - 16 = 9.Source: §A.2 · p. 6
  • For ranks 16 and 28, Janet earns $18 per day at the market: each account has 9 eggs remaining after breakfast and muffins and sells them for $2 each.Source: §A.2 · p. 6
Loading 2402.10462v1…