lorahub  by sail-sg

Framework for efficient cross-task generalization via dynamic LoRA composition

created 2 years ago
644 stars

Top 52.7% on sourcepulse

GitHubView on GitHub
Project Summary

LoraHub is a framework designed to enhance the efficiency of fine-tuning large language models (LLMs) for new tasks by dynamically composing pre-trained Low-Rank Adaptation (LoRA) modules. It targets researchers and developers seeking to achieve strong few-shot performance on unseen tasks without requiring additional training or parameters, effectively acting as a "marketplace" for reusable LoRA modules.

How It Works

LoraHub employs a two-stage process: Compose and Adapt. In the Compose stage, multiple LoRA modules trained on different tasks are integrated into a single, unified module using learned coefficients. The Adapt stage then refines these coefficients on a few examples from the target task using a gradient-free optimization algorithm. This approach aims to match the performance of in-context learning (ICL) while maintaining the inference throughput of zero-shot learning.

Quick Start & Requirements

  • Install via pip: pip install lorahub
  • Requires a collection of pre-trained LoRA modules. The project suggests using modules trained on Flan-T5 tasks, available at Hugging Face (https://huggingface.co/models?search=lorahub).
  • Example usage is provided in example.py.

Highlighted Details

  • Achieves performance close to in-context learning (ICL) on the BIG-Bench Hard (BBH) benchmark with similar inference throughput to zero-shot learning.
  • Enables cross-task generalization by composing existing LoRA modules.
  • Uses a gradient-free algorithm to adapt composed LoRA modules to new tasks.
  • Supports customization of the loss function and regularization terms.

Maintenance & Community

  • The project paper was accepted by COLM 2024.
  • Code and demo are available.
  • Integrated into Replicate.

Licensing & Compatibility

  • The README does not explicitly state the license.

Limitations & Caveats

  • The effectiveness relies on the availability and quality of pre-trained LoRA modules.
  • The project is presented as a research artifact, and extensive production-readiness is not detailed.
Health Check
Last commit

1 year ago

Responsiveness

1+ week

Pull Requests (30d)
0
Issues (30d)
0
Star History
16 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers), and
6 more.

LoRA by microsoft

0.3%
12k
PyTorch library for low-rank adaptation (LoRA) of LLMs
created 4 years ago
updated 7 months ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Ying Sheng Ying Sheng(Author of SGLang), and
9 more.

alpaca-lora by tloen

0.0%
19k
LoRA fine-tuning for LLaMA
created 2 years ago
updated 1 year ago
Feedback? Help us improve.