lora gsm8k low-rank-adaptation llama-2 human-eval mt-bench glue parameter-efficient-fine-tuning
Abstract
Fine-tuning large-scale pretrained models is prohibitively expensive in terms of computational and memory costs. LoRA, as one of the most popular Parameter-Efficient Fine-Tuning (PEFT) methods, offers a cost-effective alternative by fine-tuning an auxiliary low-rank model that has significantly fewer parameters. Although LoRA reduces the computational and memory requirements significantly at each iteration, extensive empirical evidence indicates that it converges at a considerably slower rate compared to full fine-tuning, ultimately leading to increased overall compute and often worse test performance. In our paper, we perform an in-depth investigation of the initialization method of LoRA and show that careful initialization (without any change of the architecture and the training algorithm) can significantly enhance both efficiency and performance. In particular, we introduce a novel initialization method, LoRA-GA (Low Rank Adaptation with Gradient Approximation), which aligns the gradients of low-rank matrix product with those of full fine-tuning at the first step. Our extensive experiments demonstrate that LoRA-GA achieves a convergence rate comparable to that of full fine-tuning (hence being significantly faster than vanilla LoRA as well as various recent improvements) while simultaneously attaining comparable or even better performance. For example, on the subset of the GLUE dataset with T5-Base, LoRA-GA outperforms LoRA by 5.69% on average. On larger models such as Llama 2-7B, LoRA-GA shows performance improvements of 0.34, 11.52%, and 5.05% on MT-bench, GSM8K, and Human-eval, respectively. Additionally, we observe up to 2-4 times convergence speed improvement compared to vanilla LoRA, validating its effectiveness in accelerating convergence and enhancing model performance. Code is available at https://github.com/Outsider565/LoRA-GA.
한국어 요약
한 줄 요약
LoRA-GA는 LoRA의 초기화를 개선하여 수렴 속도와 성능을 동시에 향상시키는 저비용 파인튜닝 방법이다.
핵심 기여도
- LoRA-GA는 LoRA의 초기화를 개선하여, 첫 스텝에서 저랭크 행렬의 그래디언트가 전체 파인튜닝과 일치하도록 설계됨.
- T5-Base 모델에서 GLUE 서브셋에서 LoRA 대비 평균 5.69% 성능 향상.
- Llama 2-7B 모델에서 MT-bench(0.34%), GSM8K(11.52%), Human-eval(5.05%)에서 성능 개선.
- LoRA 대비 최대 2~4배 빠른 수렴 속도를 달성.
핵심 아이디어
LoRA는 사전 학습된 모델의 선형 레이어에 저랭크 행렬 $ B $와 $ A $를 추가하여 파라미터 효율적인 파인튜닝을 수행하지만, 기본 초기화 방식(예: Kaiming 초기화 + $ B $를 0으로 설정)으로 인해 수렴 속도가 느리고 성능 저하가 발생한다. 본 연구는 LoRA-GA를 제안하며, $ A_{\text{init}} $와 $ B_{\text{init}} $를 전체 그래디언트 행렬의 고유벡터로 초기화함으로써, 저랭크 행렬 $ BA $의 그래디언트가 전체 파인튜닝의 그래디언트 방향과 일치하도록 한다. 이는 첫 스텝부터 학습 방향을 정확히 맞추어 수렴 속도를 빠르게 하고, 최종 성능을 향상시킨다. 또한, 스케일링 인자 $ \eta $를 조정하여 어댑터 출력의 분산이 랭크와 입력 차원에 무관하게 유지되도록 보장한다.
기술적 접근법
- **LoRA-GA 초기화**: $ A_{\text{init}} $와 $ B_{\text{init}} $를 전체 그래디언트 행렬의 고유벡터로 초기화.
- **스케일링 인자 $ \eta $**: 어댑터 출력의 분산을 입력 차원과 랭크에 따라 동일하게 유지.
- **수정된 레이어 표현식**: $ y = (W + \eta BA)x $, 여기서 $ W $는 고정, $ B $와 $ A $는 파인튜닝.
- **실험 설정**: T5-Base와 Llama 2-7B 모델을 사용, GLUE, MT-bench, GSM8K, Human-eval 데이터셋에서 평가.
- **하이퍼파라미터**: 학습률, 배치 크기, 랭크(r=64)는 LoRA와 동일하게 유지.
주요 결과
- **GLUE 서브셋 (T5-Base)**: LoRA-GA는 LoRA 대비 평균 5.69% 성능 향상.
- **Llama 2-7B 모델**:
- MT-bench: +0.34%
- GSM8K: +11.52%
- Human-eval: +5.05%
- **수렴 속도**: LoRA 대비 최대 2~4배 빠른 수렴.
- **성능**: 전체 파인튜닝 수준에 근접하거나 초과.
의의 및 한계
LoRA-GA는 LoRA의 아키텍처와 학습 알고리즘을 변경하지 않고 초기화만 조정함으로써, 파인튜닝의 효율성과 성능을 동시에 향상시킨다. 이는 대규모 모델의 파인튜닝 비용을 줄이는 데 기여하며, 다양한 LoRA 변형(예: ReLoRA)과 결합 가능성을 열어준다. 그러나 본 연구는 특정 랭크(r=64)와 고정된 하이퍼파라미터 조건에서 실험되었으며, 다른 랭크나 모델 구조에서의 일반화 가능성은 추가 연구가 필요하다. 또한, LoRA-GA는 초기화에만 의존하므로, 학습 중간의 그래디언트 변화에 대한 적응력은 제한될 수 있다.
실용적 활용
LoRA-GA는 대규모 언어 모델의 파인튜닝을 필요로 하는 산업 분야(예: 고객 서비스, 코드 생성, 수학 문제 해결)에서 유용하게 활용될 수 있다. 특히, 컴퓨팅 자원이 제한된 환경에서 빠른 수렴과 높은 성능을 동시에 달성할 수 있어, 클라우드 기반 모델 서빙이나 모바일 애플리케이션에 적합하다. 또한, 연구자들이 다양한 LoRA 변형과 결합하여 성능을 추가 개선하는 데도 활용 가능하다.