LoRA-Flow: Dynamic LoRA Fusion for Large Language Models in Generative Tasks

Hanqing Wang, Bowen Ping, Shuo Wang, Xu Han, Yun Chen +2 more
2/18/2024
cs.CL

No official code found. Best implementation: thunlp/LoRAFlow (25 stars, last commit 2024-10-09).

Abstract

LoRA employs lightweight modules to customize large language models (LLMs) for each downstream task or domain, where different learned additional modules represent diverse skills. Combining existing LoRAs to address new tasks can enhance the reusability of learned LoRAs, particularly beneficial for tasks with limited annotated data. Most prior works on LoRA combination primarily rely on task-level weights for each involved LoRA, making different examples and tokens share the same LoRA weights. However, in generative tasks, different tokens may necessitate diverse skills to manage. Taking the Chinese math task as an example, understanding the problem description may depend more on the Chinese LoRA, while the calculation part may rely more on the math LoRA. To this end, we propose LoRA-Flow, which utilizes dynamic weights to adjust the impact of different LoRAs. The weights at each step are determined by a fusion gate with extremely few parameters, which can be learned with only 200 training examples. Experiments across six generative tasks demonstrate that our method consistently outperforms baselines with task-level fusion weights. This underscores the necessity of introducing dynamic fusion weights for LoRA combination.

View on arXivView PDF

Code Implementations(1)

thunlp/LoRAFlowCommunity70%

ACL 2024: LoRA-Flow Dynamic LoRA Fusion for Large Language Models in Generative Tasks

251C, C++Oct 9, 20242 years ago

Similar Papers

Cite this paper

@article{wang2024loraflow,
  title  = {LoRA-Flow: Dynamic LoRA Fusion for Large Language Models in Generative Tasks},
  author = {Hanqing Wang and Bowen Ping and Shuo Wang and Xu Han and Yun Chen and Zhiyuan Liu and Maosong Sun},
  year   = {2024},
  eprint = {2402.11455},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.11455v1}
}

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/2402.11455.svg)](https://codeofpaper.com/paper/2402.11455)

Discussion