[Paper Review] LoraHub: Efficient Cross-Task Generalization via Dynamic LoRA Composition
LoraHub automatically composes pre-trained LoRA modules to adapt LLMs to unseen tasks using few-shot examples, achieving near in-context learning performance with fewer input tokens and no extra parameters.
Low-rank adaptations (LoRA) are often employed to fine-tune large language models (LLMs) for new tasks. This paper investigates LoRA composability for cross-task generalization and introduces LoraHub, a simple framework devised for the purposive assembly of LoRA modules trained on diverse given tasks, with the objective of achieving adaptable performance on unseen tasks. With just a few examples from a new task, LoraHub can fluidly combine multiple LoRA modules, eliminating the need for human expertise and assumptions. Notably, the composition requires neither additional model parameters nor gradients. Empirical results on the Big-Bench Hard benchmark suggest that LoraHub, while not surpassing the performance of in-context learning, offers a notable performance-efficiency trade-off in few-shot scenarios by employing a significantly reduced number of tokens per example during inference. Notably, LoraHub establishes a better upper bound compared to in-context learning when paired with different demonstration examples, demonstrating its potential for future development. Our vision is to establish a platform for LoRA modules, empowering users to share their trained LoRA modules. This collaborative approach facilitates the seamless application of LoRA modules to novel tasks, contributing to an adaptive ecosystem. Our code is available at https://github.com/sail-sg/lorahub, and all the pre-trained LoRA modules are released at https://huggingface.co/lorahub.
Motivation & Objective
- Investigate cross-task generalization using modular LoRA adapters trained on diverse tasks.
- Develop a two-stage framework (Compose and Adapt) to assemble and tune LoRA modules for unseen tasks.
- Eliminate manual module selection and additional model parameters during adaptation.
- Evaluate efficiency and performance trade-offs against zero-shot and in-context learning on BBH with FLAN-T5.
- Propose a platform-centric vision for sharing LoRA modules to foster reusable components.
Proposed method
- Train multiple LoRA modules on distinct upstream tasks to capture diverse skills.
- Compose stage: linearly combine LoRA modules into a single hat{m} using scalar coefficients w_i.
- Adapt stage: apply gradient-free optimization (e.g., CMA-ES) to tune w for few-shot examples, minimizing L + alpha * sum|w_i|.
- Finalize: integrate the optimized hat{m} with the base LLM to perform the unseen task without further parameter updates.
- Evaluate inference efficiency by keeping inputs lean and avoiding per-example demonstrations during inference.

Experimental results
Research questions
- RQ1Can a library of LoRA modules trained on diverse tasks be effectively composed to generalize to unseen tasks?
- RQ2Does gradient-free optimization of module coefficients achieve competitive performance with few-shot examples?
- RQ3What are the efficiency and performance trade-offs between LoraHub and in-context learning on standard benchmarks?
- RQ4How does the number and rank of LoRA modules affect cross-task generalization and stability?
Key findings
- LoraHub approaching in-context learning performance in few-shot BBH settings while using the same or fewer tokens per example.
- The method can achieve a notable upper-bound advantage over ICL when paired with different demonstration examples.
- Gradient-free CMA-ES optimization effectively identifies suitable LoRA weights with modest compute (e.g., less than a minute on a single A100).
- LoraHub can operate with CPU-only processing for LoRA processing, assuming LLM inference is available, enabling a democratized workflow.
- Compared to gradient-based fine-tuning, LoraHub preserves base model parameters and avoids per-example prompts during inference.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.