Adapter framework for parameter-efficient fine-tuning of LLMs (research paper)
Top 33.6% on sourcepulse
This repository provides LLM-Adapters, a framework for parameter-efficient fine-tuning (PEFT) of large language models, extending HuggingFace's PEFT library. It targets researchers and practitioners seeking to adapt LLMs like LLaMA, OPT, BLOOM, and GPT-J to specific tasks using various adapter types, including LoRA, Bottleneck, Parallel, and Prefix Tuning, with demonstrated performance improvements on commonsense reasoning and arithmetic tasks.
How It Works
LLM-Adapters integrates multiple PEFT techniques by injecting adapter modules into the transformer architecture. It supports various adapter configurations, including LoRA, AdapterH (bottleneck), AdapterP, and Parallel adapters, allowing for flexible customization. The framework enables efficient fine-tuning by updating only these adapter parameters, significantly reducing computational cost and memory requirements compared to full fine-tuning.
Quick Start & Requirements
pip install -r requirements.txt
BASE_MODEL
environment variable (e.g., export BASE_MODEL=yahma/llama-7b-hf
).torchrun --nproc_per_node=2 --master_port=3192 finetune.py --base_model 'yahma/llama-7b-hf' --data_path 'math_10k.json' --output_dir './trained_models/llama-lora' --adapter_name lora
torchrun generate.py --base_model 'yahma/llama-7b-hf' --lora_weights './trained_models/llama-lora'
python evaluate.py --model LLaMA-7B --adapter LoRA --dataset SVAMP --base_model 'yahma/llama-7b-hf' --lora_weights './trained_models/llama-lora'
Highlighted Details
math_10k.json
and commonsense170k
.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
math_10k.json
dataset, affecting specific benchmarks.1 year ago
1 day