기본 정보
- 저자
- DOI
- 10.18653/v1/2024.findings-emnlp.811
- 저널
- –
- 발행년도
- 2024
- 발행기관
- –
- 피인용수
- 2
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.18653/v1/2024.findings-emnlp.811
- 토픽
- Advancements in Photolithography Techniques
- OpenAlex ID
- W4404780918
평가 내용
- 관련도
- 사업분야
- 수소연료전지 · (6) PEM(고분자전해질막)
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '수소연료전지 > PEM(고분자전해질막)' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
본문 67,609자
본문 펼치기
섹션 본문 84문단 · 38,262자
(제목 없음)
1With the rapid growth in the use of fine-tuning for large language models (LLMs), optimizing fine-tuning while keeping inference efficient has become highly important.However, this is a challenging task as it requires improvements in all aspects, including inference speed, fine-tuning speed, memory consumption, and, most importantly, model quality.Previous studies have attempted to achieve this by combining quantization with fine-tuning, but they have failed to enhance all four aspects simultaneously.In this study, we propose a new lightweight technique called Quantization for Efficient Fine-Tuning (QEFT).QEFT accelerates both inference and fine-tuning, is supported by robust theoretical foundations, offers high flexibility, and maintains good hardware compatibility.Our extensive experiments demonstrate that QEFT matches the quality and versatility of full-precision parameter-efficient fine-tuning, while using fewer resources.Our code is available at https://github.com/xvyaward/qeft.
Introduction
2While the outstanding zero-shot performance of large language models (LLMs) (Brown et al., 2020;Radford et al., 2019;Touvron et al., 2023;Zhang et al., 2022) significantly contributes to their popularity, their versatility and adaptability are also crucial factors in their widespread adoption.Through transfer learning and fine-tuning, LLMs can be extended to handle unseen or complex tasks, including new data types, which opens up new possibilities across various applications (Qin et al., 2023;Hao et al., 2024).As efficient inference and finetuning become increasingly important, this paper explores methods to enhance the efficiency of both inference and fine-tuning for LLMs.
3Examining past research, several methods have been proposed to enhance the efficiency of in- ference, including pruning (Frantar and Alistarh, 2023;Sun et al., 2023), speculative decoding (Leviathan et al., 2023;Miao et al., 2023), KV caching (Hooper et al., 2024), and, particularly, weight quantization (Frantar et al., 2022;Lin et al., 2023;Yao et al., 2022;Shao et al., 2023;Lee et al., 2024).However, studies focusing on lightweight approaches for fine-tuning remain relatively limited.This is because when considering both finetuning and inference, the factors requiring optimization-such as inference speed, training speed, memory consumption, and accuracy-become significantly varied.Balancing all these conditions simultaneously presents a substantial challenge.
4In this context, LoRA (Hu et al., 2022) is a representative study enabling parameter-efficient finetuning (PEFT) (Houlsby et al., 2019;Zaken et al., 2022;Liu et al., 2022;Hu et al., 2022) by freezing the pre-trained weights while adding a decomposed path that undergoes updates.This approach opens up new opportunities for updating LLMs flexibly with limited resources, leading to numerous emerging applications (Kim et al., 2023;Lee et al., 2023;Wang et al., 2023).In addition, several studies have advanced this concept by attempting to harmonize weight quantization and LoRA to reap the benefits of both methods.For instance, in QLoRA (Dettmers et al., 2023) and QA-LoRA (Xu arXiv:2410.08661v1 [cs.CL] 11 Oct 2024Oct et al., 2023)), the pre-trained weights remain fixed after quantization, while only the FP16 low-rank path is added and updated exclusively.However, QLoRA exhibits slow inference speeds, and both methods still entail noticeable fine-tuning overhead.Achieving improvements in all aspects of inference and fine-tuning is not easily accomplished by simply applying multiple optimizations in parallel.
5In this study, we propose a new quantization technique called Quantization for Efficient Fine-Tuning (QEFT), designed to achieve optimal performance in both inference and training.This method employs the data format of OWQ (Lee et al., 2024), storing weak columns vulnerable to quantization in FP16 while storing the majority of weights in 4-bit or less, and updating only the weak columns during fine-tuning.This approach allows us to enjoy the benefits of quantization while implementing PEFT.
6However, QEFT offers its own unique innovations.First, OWQ suffers from the irregular mixed precision of columns in the weights of linear layers, resulting in low hardware compatibility.In contrast, QEFT achieves a structured mixed precision representation based on the novel Offline Global Reordering (OGR), improving hardware compatibility and resulting in substantial speed improvements in both training and inference, as shown in Fig. 1.Additionally, QEFT provides a theoretical framework for selecting weak columns to minimize loss values after fine-tuning.Lastly, despite being implemented differently from LoRA, we validate that QEFT can replace and be applied to applications that previously used LoRA, demonstrating its flexibility.Through various experiments, we showed that QEFT is the state-of-the-art method in terms of inference speed, training speed, and model quality.While it consumes slightly more memory than OWQ, QEFT outperforms it in every other aspect and surpasses other baselines in all areas.
72 Related Work
Weight-only Quantization of LLMs
8Weight-only quantization stands out as one of the most successful optimization methods for LLMs, significantly reducing the model's footprint and mitigating memory bottlenecks during generation, thereby notably accelerating inference.OPTQ (Frantar et al., 2022) pioneered this approach by demonstrating that the OPT-175B model can be quantized to sub-4-bit without notable accuracy degradation.Moreover, this low-precision approach addresses the memory bottleneck, achieving performance benefits on real GPU devices.AWQ (Lin et al., 2023) and TEQ (Cheng et al., 2023) make advances that improve the model quality via fine-grained group-wise quantization.
Parameter-efficient Fine-tuning (PEFT)
9PEFT is designed to minimize fine-tuning costs for LLMs, unlocking their potential to address new problems affordably.LoRA (Hu et al., 2022) is a representative study that freezes pre-trained weights and adds low-rank parameters, which are updated exclusively during fine-tuning.LoRA demonstrates PEFT's potential by showcasing LLMs' remarkable adaptation to unseen tasks with a constrained update scheme.
Quantization-aware PEFT
10QLoRA (Dettmers et al., 2023) expands upon the LoRA concept by incorporating weight quantization, compressing pretrained weight through quantization.While this makes the fine-tuning process more lightweight, the additional path slows down inference performance, as the additional FP16 path cannot be freely merged to quantized base weights.
11QA-LoRA (Xu et al., 2023) offers an alternative approach where the updated weight is merged on top of the zero-point of the low-precision weight.This eliminates the need for a high-precision path after fine-tuning unlike QLoRA, and demonstrates comparable fine-tuning quality; however, it still has a large fine-tuning overhead, and the flexibility for the advanced LoRA applications such as PEFT merging is not explored.
Outlier-aware Weight Quantization
12Recently, OWQ (Lee et al., 2024) introduced intralayer mixed precision quantization scheme for weight only quantization.In OWQ, the goal is to reduce the layer-wise error, which is broken down into the error for the i-th output channel as follows:
13The Hessian of the weight matrix plays a crucial role in estimating the sensitivity of specific weights.However, the weights in the same output channel share an identical Hessian value, calculated as:
14(2) From this formulation, it was observed that activation outliers can significantly increase the sensitivity of specific weight columns even when only weight quantization is applied.In OWQ, they calculated the sensitivity of j-th column due to weight quantization as follows:
15where λ is a diagonal element of the Hessian.Afterward, they preserved the top-k most sensitive columns (weak columns) in FP16 and compressed only the remaining robust weights into 4 or 3-bit.OWQ enhances the model quality significantly while only adding an extra 0.01 bits on average.However, its mixed-precision format poses challenges in deployment in both GPU and non-GPU environments, limiting thier practical benefits.
Weak Column Tuning
16OWQ also introduced the concept that enables PEFT with mixed-precision.This idea, known as Weak Column Tuning (WCT), updates the FP16 weak columns in a task-specific manner while freezing the remaining quantized data.WCT in OWQ sustains the benefits of low precision for both inference and fine-tuning, but it also has several limitations; WCT lacks theoretical support to guarantee its optimality in selecting tuning parameters based on weak columns and has only demonstrated feasibility for specific tasks.Furthermore, the versatility of WCT has not yet been validated, making it less favored than LoRA-based approaches.Most importantly, the irregular mixed-precision weights in OWQ poses challenges for acceleration.
Detailed Overview of QEFT
17In this study, we introduce QEFT, a mixedprecision quantization that achieves higher speed for both inference and fine-tuning and better finetuned quality thanks to its hardware-friendly and expressiveness.We begin by detailing QEFT in this section and explain fine-tuning capabilities in Sec. 4.Then, we discuss PEFT merging, an advanced example validating its versatility, in Sec. 5.
Data Structure and Quantization Process
18QEFT applies mixed-precision quantization to the dense weights of linear layers in LLMs.After quantization, three data components are generated: the dense low-precision matrix, group-wise quantization parameters, and high-precision weak columns, as depicted in Fig. 2(c).Similar to OWQ, we begin by identifying the top-k sensitive columns and preserving them in FP16.However, the key difference in implementation is that QEFT employs novel Offline Global Reordering (OGR), as described in Sec.3.2, ensuring a structured format unlike to the irregularity of OWQ (Fig. 2(b)).
19Subsequently, the remaining weights are stored in 4-bit or less.We introduce group-wise quantization (Lin et al., 2023) to further minimize quantization errors from per-channel quantization based OWQ.Therefore, every adjacent g weights share the same quantization parameters, such as scaling factor and zero-point.We perform a grid search for each group to find the quantization parameters that minimize the squared error of weights after truncation.Then, we apply OPTQ (Frantar et al., 2022) using the searched parameters to find the best low-precision mapping.While OPTQ originally relies on channel-wise min-max quantization, ours leverage the benefits of group-wise quantization and truncation (Esser et al., 2019;Li et al., 2021;Nahshan et al., 2021;Wei et al., 2022), resulting in high-quality quantized weights.
Offline Global Reordering
20In OWQ, mixed-precision makes it difficult to accelerate.While the indices of weak columns are predetermined offline, correlated with the location of activation outliers (Fig. 2(b)), the irregular mixedprecision format introduces multiple branches in the decompression process, causing complex implementation and slowdown.Moreover, these characteristics are difficult to support on emerging hardware, such as in-DRAM accelerators (Lee et al., 2021) or NPUs (Intel, 2024), which only support dense computation in general.
21To address this limitation, we must revise the data representation for predictability and contigu- ity.Previous efforts, such as reordering activations in the normalization layer during inference (Yuan et al., 2023), grouped the activation channels in clusters.Although this mitigates the quantization difficulty of the activations, the online reordering incurs additional inference latency, amortizing the benefits of quantization.
22To eliminate irregularities without incurring online costs, we introduce a novel concept called Offline Global Reordering (OGR).This idea is motivated by our key observation that outlier channel indices significantly overlap across layers, as shown in Fig. 3(a), which visualizes the layer-wise indices of the top-8 weak columns for each transformer block in the Llama-2 7B model.This overlap occurs because outlier activations propagate through subsequent layers via residual connections, causing weak column indices to align across layers.Based on this observation, we identify and use the common (global) weak columns across the entire network, as depicted in Fig. 3(a).Since weight perturbation can vary significantly across layers, we use only λ j , instead of λ j ||∆W :,j || 2 2 in Eq. ( 3).The optimality of this metric is discussed in Sec. 4, and the detailed selection algorithm is in Appendix B.
23Once the global weak columns are selected, we can rearrange the weights of the embedding and head layers, as well as the layers within the transformer block, offline, as shown in Fig. 3(b).By globally reordering the model, the weak columns of each linear layer form a structured dense matrix, and their corresponding activations are located contiguously.One exception is the attention output projection layer, or W O in Fig. 3(b).To maintain the multi-head attention mechanism, reordering is not applicable to the W O weight.In this case, the mixed-precision format is used without reordering.
24Tab. 1 shows the effect of the component proposed in QEFT for Llama-2 7B.For reference, we begin with the OWQ configuration and measure the impact of online reordering and OGR, respectively.The table indicates that online reordering offers limited benefits due to its overhead, whereas OGR significantly accelerates inference.Although most weak columns overlap, utilizing global weak columns may result in subtle accuracy degradation due to the small number of non-overlapping column indices.To realize the Pareto-front solution, we seek to address this degradation and consider using group quantization instead of OWQ's channelwise quantization.A group size of 128 was used by default and it improves the fine-tuned performance by reducing quantization error, with negligible hardware overhead thanks to our optimized kernel.Due to the increased number of group-wise parameters, a slight increase in memory usage occurs from 3923MB to 4107MB.Results show that using OGR with group quantization is the best option and globally reordered model exhibits nearly the same few-shot scores as the optimal selection at each layer while greatly enhancing inference speed.
GPU Acceleration Kernel for QEFT
25To realize the full potential of QEFT, we developed a customized matrix-vector multiplication GPU kernel tailored for the reordered format.This kernel first processes the quantized dense matrix by dequantizing the weights into FP16 format and multiplying them with the activations.Subsequently, it performs the multiplication of the high-precision dense weights and activations.Thanks to OGR, we can seamlessly apply two dense computations, which are fused into a single kernel in practice.The impact of our customized kernel on inference performance is validated in Sec.6.4.
Efficient Backward Computation
26Utilizing QEFT provides another significant advantage for fine-tuning.As depicted in Fig. 4, the backward computation of the linear layer involves two GeMM operations: calculating gradients for the input X and the weights W . Unlike LoRAbased approaches, QEFT reduces the GeMM cost by computing gradients only for the rectangularshaped trainable weights, thus decreasing the overall FLOPs of weight gradients to k/IC.This reduction offers substantial performance benefits during fine-tuning.Additionally, as shown in Fig. 4, we only need to store the subset of activations corresponding to the weak columns.The gradient of weights for weak columns can be computed without requiring the entire activation tensor, reducing the memory footprint to k/IC.A crucial aspect of QEFT is that it uses a structural data representation based on OGR, allowing for easy backward implementation in existing frameworks such as PyTorch (Paszke et al., 2019).
Optimal Weak Column Selection
27While QEFT is efficient for both fine-tuning and inference, it also offers superior fine-tuning quality.In this section, we provide theoretical support by proving that selecting weak columns as mask for tunable parameters is an optimal strategy for minimizing the loss value after sparse PEFT, under the following conditions: 1.A fixed budget is allocated to each linear layer.2. The selection is applied at a per-channel granularity.
28Firstly, we formulate the sparse PEFT as follows:
29where θ 0 ∈ R OC×IC represents the pre-trained weights, and OC and IC represent the output and input channel dimensions, respectively.∆θ ∈ R OC×IC represents the updated weights, L represents the target loss function, and M ∈ R IC×IC represents the channel-wise parameter mask, where
30To maximize the effect of fine-tuning, we need to select an appropriate M that can minimize the loss.According to the second-order approximation method of (Fu et al., 2023), we can find out the optimal mask based on the magnitude of the gradient.Theorem.
31where ∇L(θ 0 ):,i is the i-th channel of ∇L(θ 0 ), then
32In the constraints of the channel-wise parameter mask, this theorem states that the mask M minimizing the infimum of loss can be constructed by selecting the top-k channel indices in order of largest |∇L(θ 0 ) 2 :,i | values.In QEFT, tunable weak columns are selected by Eq. ( 3), which is based on λ i and the weight perturbation.Meanwhile, the gradient of the weight in the linear layer is calculated by the chain rule:
33where X represents the activation and y = θX.
34Most importantly, the presence of activation outliers causes both weak column selection (Eq.( 3)) and weight gradient to be dominated by the activation, thus the selection metric of QEFT is also valid for selecting columns with the largest |∇L(θ 0 ) 2 :,i |.Fig. 5 illustrates the correlation between Eq. (3) and |∇L(θ 0 ) 2 :,i |.Sorting the channels using quantization sensitivity reveals that the top-k channels (weak columns) also represent the columns with the largest gradient magnitude.This implies that although we select weak columns considering the quantization sensitivity, fine-tuning quality is also accounted for.
Advanced Application: PEFT Merging
35QEFT is designed for efficient inference and finetuning, but it also needs to be general enough to be an alternative to the LoRA-based approach.To validate this, we applied QEFT to an advanced application of LoRA known as PEFT merging (Lee et al., 2023).Fig. 6 provides an overview of this process.As shown in the figure, the LoRA adapter is fine-tuned using the Open-Platypus dataset (Lee et al., 2023) on the Llama-2 model.After finetuning, the updated weights are transferred to the StableBeluga (Mahan et al., 2023) model, which was also initialized with Llama-2 but fine-tuned on a different dataset, resulting in the creation of Stable-Platypus2.Despite potential differences in semantics, Stable-Platypus2 surprisingly exhibits better quality than each model before the merge.
36To assess the merging ability of QEFT, we also attempt a similar approach, called QEFT merging.We generate the quantized Llama-2 model and fine-tune the weak columns for the Open-Platypus dataset.The updates of the weak columns (∆ = A ′ − A) are then merged into the StableBeluga model.If the target model is a full-precision model, we add the update according to the weak column index.For the quantized StableBeluga, we add the update to the corresponding weak columns.We show that QEFT merging works surprisingly well in Sec.6.3, validating its generality.6 Experiments
Experiments Setting
37To demonstrate the superiority of QEFT, we conducted extensive analysis.The fine-tuning environment adheres to the setup of a baseline, Platypus (Lee et al., 2023).We utilized the Open-Platypus dataset for fine-tuning, which is specially filtered to remove duplicates and redundancy among 11 open-source datasets.Given that the Open-Platypus dataset focuses on STEM and logic question domains, we also adopted their evaluation method, which includes few-shot tasks from the open-llmleaderboard (Beeching et al., 2023).
38Following the recent version of the leaderboard, we report scores for 6 tasks (MMLU (Hendrycks et al., 2020), HellaSwag (Zellers et al., 2019), ARCc (Clark et al., 2018), TruthfulQA (Lin et al., 2022), Winogrande (Sakaguchi et al., 2021), and GSM8k (Cobbe et al., 2021)), along with their average, to assess fine-tuning performance.Additionally, we report the average score of four tasks (MMLU, Hel-laSwag, ARC-c, and TruthfulQA) used for evaluation in previous studies (Lee et al., 2023;Xu et al., 2023).We utilized lm-eval-harness (Gao et al., 2023) to measure few-shot accuracy.
39We used Adamw optimizer with batch size of 16.We used constant learning rate of 1e-5 and 5e-6 for k = 16 and 128, respectively.We observed the overfitting issue of OPTQ reconstruction in the 70B model, which is also found in the previous work (Wu et al., 2023).Therefore, we utilized simple round-to-nearest quantization instead of OPTQ for 4-bit Llama-2 70B results.Please refer to Appendix A for the detailed experiment setups.
Overall Fine-tuning Results
40In order to compare the superiority of QEFT, we selecte five representative counterparts: LoRA, Platypus, QLoRA, QA-LoRA, and OWQ.Platypus (Lee et al., 2023) utilizes 8-bit quantization for the base model and integrates the LoRA module only into the FFNs.QLoRA/QA-LoRA and OWQ are included for quality and performance comparisons using 4-bit quantization.QLoRA/QA-LoRA applies the LoRA module to all linear layers, while OWQ retains k weak columns as FP16 for all linear layers.It's important to note that k/2 ≃ r in terms of tunable parameters, as each LoRA module employs two d × r adapters.We reproduced all results for our control groups (LoRA, Platypus, QLoRA, QA-LoRA, and OWQ), excluding Platypus 70B due to its resourceintensive nature (requiring 8xA100 GPUs) and lengthy training time.Instead, we utilized the officially provided pre-trained weights of Platypus 70B from Huggingface.Since OWQ does not provide tuning code, we implemented it based on our setup.Therefore, the tuning of OWQ was also accelerated by using the QEFT's customized code.In addition, different from inference, computations are mostly compute-bound matrix multiplication during finetuning.In this case, the speed gain of OGR just comes from the simple dequantization process, resulting in negligible benefit (∼ 0.1h reduction of training time) compared to OWQ.
41Experimental results are detailed in Tab. 2. QEFT clearly outperforms the other quantizationaware PEFTs in the 13B model.However, Platypus demonstrates the best tuning performance in the 7B model, primarily because accuracy degradation due to quantization is dominant for the smaller model.Yet, when considering the base size (6.7GB vs. 4.1GB), QEFT's performance stands out.Moreover, even in the 7B case, QEFT with k = 128 shows better results than other 4-bit baselines, and in the 13B case, QEFT with just a budget of k = 16 exhibits tuning performance that outperforms others.Interestingly, Platypus, LoRA, and QLoRA consistently display low GSM8k scores on 7B and 13B, indicating they might be overly tuned for conventional 4 benchmarks.
42Platypus reports that their 70B model fine-tuning required 4 × A100 GPUs for 22 hours.In contrast, QEFT can be completed in 11 hours with just a Table 3: PT, FT, and target + X denote pre-trained model, full fine-tuning, and merging of target full fine-tuned model and PEFT module X, respectively.Among the PEFT merging results, we bold the best score and underline the second-best score.
43single A100 GPU.This represents approximately an 8-fold acceleration in terms of GPU hours, highlighting the memory-time efficiency feature of the proposed method.Despite having only 1/8 of the training cost, the fine-tuned quality of QEFT-based model is comparable to or better than the Platypus-70B, significantly surpassing the baseline Llama-2 70B.Compared to other 4-bit methods, QEFT consistently shows better accuracy.In particular, QEFT has a much lower tuning time than LoRA-based approaches.
PEFT Merging Results
44Tab. 3 presents the PEFT merging results for two fully fine-tuned models, StableBeluga and OpenOrca (Lian et al., 2023).Following the objective of merging strategy from the Platypus study, we report the scores of the four tasks (MMLU, HellaSwag, ARC-c, and TruthfulQA) to assess complementary effects.Although QEFT merging only modifies the weight columns corresponding to weak columns of the fully fine-tuned models, all QEFT merging cases increase MMLU, ARC, and TruthfulQA scores together; thus, merging tuned weak columns enhances both reasoning ability and knowledge capability.Furthermore, QEFT merging with a quantized target model (indicated as 4-bits in the table) demonstrates comparable accuracy to FP16 LoRA merging.In this scenario, we benefit from a reduced merged model size and faster inference from the QEFT format.Both merging techniques prove highly beneficial for enhancing model quality.This observation confirms that QEFT aligns well with the idea of PEFT merging.
Inference Acceleration
45In this section, we demonstrate performance benefits of QEFT in auto-regressive generation sce- narios.We benchmark inference speed on the Llama families on A100 80GB GPU, using the full-precision model and different tuning methods as a baseline.In this experiment, we utilize the optimized multi-head attention kernel and layer normalization kernel of FasterTransformer (NVIDIA, 2023) for all methods except QA-LoRA, as they use AutoGPTQ (AutoGPTQ, 2024) framework.Please refer to Appendix A.2 for details.We report the results as the median of generated tokens per second, generating 256 tokens at batch size 1.
46As shown in the Tab.2, the low-rank path in LoRA-based methods introduces a bottleneck in inference, notably reducing overall speed.Additionally, as described in Tab. 2 and Fig. 7, even though OWQ also utilizes their optimized kernel, QEFT consistently achieved speedups of about 30% over OWQ across all model sizes in LLaMA/Llama family.This improvement stems from eliminating the irregular memory access, a major contributor to the overhead of mixed-precision operations, through OGR.In particular, QEFT is about 2.4x faster on the Llama-3 8B model compared to OWQ, because QEFT's kernel exhibits high parallel throughput even for the model with small-sized linear layers and group query attention.
47The storage and computation demands of LLMs present significant barriers to widespread adoption.While quantization and PEFT optimize inference and fine-tuning, respectively, their harmonization is overlooked.In this work, we introduce QEFT, designed to ensure fine-tuning compatibility while prioritizing hardware compatibility.Our experiments confirm that QEFT achieves the fastest fine-tuning and yields the highest few-shot accuracy.Moreover, QEFT shows superior performance in inference, highlighting its excellence across all aspects.
Limitations
48Although model quantization and parameterefficient fine-tuning can serve as regularizers during training (AskariHemmat et al., 2022;Fu et al., 2023), an explicit regularization mechanism is often beneficial for stabilizing fine-tuning outcomes.In practice, additional regularizers like Dropout (Srivastava et al., 2014) are employed in LoRA modules to ensure stable training.However, in QEFT, the Dropout-like regularizer is not currently incorporated.While our experiments did not exhibit evident signs of overfitting, this limitation may lead to unaddressed overfitting concerns depending on the specific task.As a future direction, we aim to explore potential candidates for regularization.
49In terms of performance, QEFT requires time to convert FP16 to low-precision representation.Typically, the conversion process for the Llama-2 13B model takes about an hour and further details are in the Tab. 8. We did not incorporate this conversion cost into Tab. 2 because it is a one-time expense, and its cost can be amortized by reusing the quantized model for multiple downstream tasks.However, if LLM capacities are further increased, it may be necessary to consider this conversion cost.
50While we can determine the global weak columns and enjoy the benefit of OGR, the 'out_proj' weight cannot be reordered either offline or via equivalent out channel reordering of previous layers.Therefore, we have to specially handle the reordering of 'out_proj' on the fly, utilizing the customized kernel based on OWQ.This hinders the advantage of QEFT's high-throughput generation system.
A.1 Experimental Details of Fine-tuning
51We used lm-eval-harness (Gao et al., 2023) commit version b281b09 for a fair comparison.GSM8k is the only task involving generation among the tasks, so we used a batch size of 1 for evaluating GSM8k to minimize the padding effect.Other few-shot tasks were evaluated using the maximum available batch size.We followed the evaluation methods and datasets provided by lm-eval-harness, for example, HellaSwag was evaluated using 10k validation data and GSM8k was evaluated using 1.3k test data.
52We utilized gradient checkpointing and gradient accumulation to reduce fine-tuning memory usage.Although gradient checkpointing makes training slower, our tuning costs (GPUh) were measured using these options by default.For QEFT tuning of the Llama-2 70B model, we used the max_grad_norm value of 0.0.For the fine-tuning configurations of our control groups, we mostly followed the original training strategy and experimental configurations of each control group.Additionally, the QA-LoRA model is quantized using 128 calibration samples extracted from the C4 dataset.We report the 2 seed average score for 7B/13B in Tab. 2. Please refer to the Tab. 4 for detailed hyperparameters.
A.2 Experimental Details of the Generation Benchmark
53QA-LoRA exploits the AutoGPTQ (AutoGPTQ, 2024) library for their fine-tuning and inference.However, we found that the datatype of AutoG-PTQ's zero point is integer while QA-LoRA utilizes floating point zero point.This difference could potentially lead to a decrease in the kernel speed of QA-LoRA when considering full functionality.QEFT's matrix vector multiplication kernel implementation is based on TensorRT-LLM (NVIDIA, 2024).
B Algorithm for Global Weak Column Index Selection
54In the Sec.3.2, we analyzed the location of weak columns and proposed efficient reordering by taking advantage of the fact that they overlap a lot.Nevertheless, there are weak columns that do not overlap.To determine optimal global weak column index within limited budget (top-k < union of weak columns), we propose Algorithm 1 based on their sensitivity value.We added results for 3-bit settings to Tab. 5.The accuracy gap between QEFT and other methods increases, except for a single case: QA-LoRA with Llama-2 13B.Two factors mainly affect fine-tuned accuracy: (1) mask selection and corresponding fine-tuning ability, and (2) quality of the frozen quantized weights.
55In the case of OWQ and QEFT, the fine-tuning ability of (1) is the same according to the convergence analysis in Section 3. Therefore, the difference in accuracy is caused by (2), where groupwise quantization of QEFT makes a gap in quantization quality.Thus, it is also natural that the accuracy gap increases in 3-bit, where quantization quality is even more important.
56On the other hand, QA-LoRA utilizes a group size of 32, so generally QA-LoRA has a better quantization quality regarding (2) while having a large storage overhead of base size in return, as clearly shown in the Tab. 5. Nevertheless, as QEFT guarantees lower convergence, QEFT shows better accuracy in most 4-bit and 3-bit cases as QEFT's (1) dominates QA-LoRA's (2).However, as quantization quality becomes more important in 3-bit, we assume a single reversed result occurred for 13B.
57In this case, the base size of QA-LoRA is 6.68GB, which is about 12% larger than QEFT's 6.05GB.However, it is difficult to match all other configurations and conditions (e.g., tuning cost, base size, inference speed, etc.).
C.2 Comparison of Quantization Methods
58Selecting an adequate quantization method is important as it is directly connected to the post-tuned performance.While fine-tuning can boost taskspecific accuracy, quantization-aware PEFT must overcome the accuracy degradation from quantization.We compared two quantization schemes, OWQ and round-to-nearest (RTN) method on Llama-2 7B.In both cases, we preserve k = 8 weak columns as FP16.OWQ searches clipping value and reduces quantization error by reconstruction, while RTN uses naive minmax quantization.Tab.6 shows that few-shot accuracies using OWQ as quantization are consistently better than RTN.Interestingly, perplexity score after quantization (without fine-tuning) is similar in both cases.Analyzing more on the effect of quantization on finetuning is our future research direction.
C.3 The Number of Weak Columns k
59In this paper, k presents the number of weak columns, which are preserved in full-precision in each linear weight.There is a trade-off depending on the k value between the number of tunable pa- rameters and the overall model cost.To find out the effect of k on tuning performance, we measured the score by changing the value of k (Tab.7).When we used the same learning rate, the score seemed irrelevant to the k values.The results are the average of the three seed values, and although there is some variation, it was confirmed that the performance improves as the k value increases.k = 16 and 128 were used for the experiments in Tab. 2 to match the number of learnable parameters to the control groups.
60C.4 Quantization Cost for QEFT and OWQ
61We measured quantization time and storage cost for QEFT and OWQ on Llama-2 family (Tab.8).
62In the 7B and 13B models, QEFT is more expensive than OWQ because it applies group-wise quan- ward times for a single model run with an input length of 512.These results are reported in Tab. 9. Compared to QLoRA, QEFT is significantly faster in both forward and backward passes because there is no low-rank decomposed path.In particular, the backward pass is further accelerated due to the reduced amount of computation, as explained in Sec.3.3.When we compare the combined forward and backward time of QEFT and QLoRA, QEFT is more than twice as fast, which is consistent with the overall tuning time of the two methods in Tab. 2.
D.1 Fine-tuning Memory Footprint
63Tab. 10 shows the memory footprint during finetuning using each PEFT method.We used the same configuration as Tab. 2 for all methods, except input sequence length, where we used 512 for this.OWQ and QEFT use k = 16.First, the training memory footprint is dominated by the base model size.LoRA has the largest memory footprint because it uses a 16-bit base model, followed by Platypus with an 8-bit base model.Please note that as OWQ does not provide tuning code, we implemented it based on our setup.Therefore, OWQ also benefits from QEFT's customized backward implementation, while both memory footprints are much lower than other methods.The slight difference in memory footprint between OWQ and QEFT is due to the use of groups.
64We further detailed a breakdown of memory usage during training in Fig. 8.The memory used by the input-enabled gradient in all methods is small because gradient checkpointing is applied, and the batch size is set to 1.At the k = 16 setting, QEFT incurs the smallest memory usage among QEFT, QLoRA, and Platypus.
D.2 GPU Memory Overhead of the Quantization process
65Additionally, we report the peak GPU memory usage during the QEFT quantization process in Tab.11.First, the memory usage of the quantization process in QEFT, OWQ, and QA-LoRA follows the block-wise reconstruction method of OPTQ, where only each decoder block is kept in GPU memory every time.Therefore, the memory consumption of these methods is almost identical.When we use OPTQ's implementation, the forward process of the calibration set between each block consumes the most GPU memory usage, as it keeps both 128 input and 128 output tensors on GPU memory.This requirement is identical for QEFT, OPTQ, OWQ, and QA-LoRA, demanding a reasonable amount of GPU memory, as seen in the "unoptimized" column of the Table.
66However, in our experiment, we further optimized the original OPTQ reconstruction process to lower peak GPU memory usage.By allowing only one calibration sample to be allocated to GPU memory at a time on demand, without affecting the quantization process, we reduced memory consumption by half ("optimized" column of the Table ) over the original OPTQ implementation.Please note that all of OPTQ-related algorithms benefit from this optimization as well.In environments where GPU memory for parameter-efficient finetuning is available, the base model can be quantized without difficulty.
FineFigure 1 :
67Figure 1: Pareto-front comparison of PEFT methods.(Left): Average few-shot accuracy after fine-tuning vs. inference speed.(Right): Fine-tuning time vs. inference speed.For more details, please see Sec. 6.1.
FrozenFigure 2 :
68Figure 2: The overview of adaptable quantization includes: (a) QLoRA, (b) OWQ, and (c) the proposed QEFT with OGR.k = 4 case as an example.
Figure 3 :
69Figure 3: (a) Weak column indices at all transformer blocks in the Llama-2 7B model, where "attn" indicates input activation of the attention block and "ffn" indicates input activation of the feed-forward block.(b) An overview of the offline global reordering.
Figure 4 :
70Figure 4: Visualization of the reduction in computation and memory usage of QEFT in linear layers.
Figure 5 :
71Figure 5: Channel-wise sensitivity and the average magnitude of the gradient in Llama-2 7B model.The yellow box indicates the selected weak columns for k = 128 case.
Figure 6 :
72Figure 6: An overview of LoRA-based PEFT merging and its QEFT counterparts, QEFT merging.(a) Target model + LoRA case.(b) Target model + QEFT case.
Figure 7 :
73Figure 7: The number of generated tokens per second in auto-regressive generation scenario at the single batch.
Figure 8 :
74Figure 8: The memory usage for training with QEFT and baselines.
Table 1 :
75Ablation results of QEFT (k = 128) for the few-shot average scores and inference speed on Llama-2 7B.The bottom row represents QEFT.For more details, please see Sec. 6.1.
76ReorderGroup-wise 6task 4task Inference speed technique quantization Avg.↑ Avg.↑ (tokens/s) ↑
Table 4 :
77The experimental configurations and hyperparameters for fine-tuning.
Table 5 :
78Comparison of PEFT methods for various few-shot tasks on 3-bit base settings.The model group is divided into 7B, 13B, and 70B by horizontal lines.Among the average scores, we bold the best score and underline the second scores.
Table 6 :
79Comparison of quantization methods for the base model.
Table 7 :
80Average score of 6 few-shot tasks according to change in the value of k.
Table 8 :
81Quantization costs for QEFT and OWQ.
Table 9 :
82Speed measurement results for forward and backward operations in QEFT and QLoRA.Gradient checkpointing is applied to all methods.
Table 10 :
83Training memory footprint (GB) of each PEFT method.
Table 11 :
84Peak GPU Memory Usage during quantization process of QEFT (and other OPTQ-based methods).
참고문헌
참고문헌 정보가 없습니다.