lorahub  by sail-sg

Framework for efficient cross-task generalization via dynamic LoRA composition

Created 2 years ago
652 stars

Top 51.2% 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

Inactive

Pull Requests (30d)
0
Issues (30d)
1
Star History
7 stars in the last 30 days

Explore Similar Projects

Starred by Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
5 more.

punica by punica-ai

0.2%
1k
LoRA serving system (research paper) for multi-tenant LLM inference
Created 2 years ago
Updated 1 year ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Yaowei Zheng Yaowei Zheng(Author of LLaMA-Factory), and
1 more.

DoRA by NVlabs

0.3%
854
PyTorch code for weight-decomposed low-rank adaptation (DoRA)
Created 1 year ago
Updated 11 months ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Patrick von Platen Patrick von Platen(Author of Hugging Face Diffusers; Research Engineer at Mistral), and
15 more.

LoRA by microsoft

0.3%
13k
PyTorch library for low-rank adaptation (LoRA) of LLMs
Created 4 years ago
Updated 9 months ago
Feedback? Help us improve.