peft

Fine-tune large language models with LoRA and QLoRA adapters on limited GPU memory.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/loteiron/ZeusAgent --skill peft-loteiron
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: peft
Source: https://github.com/loteiron/ZeusAgent/tree/main/optional-skills/mlops/peft
Command: npx skills add https://github.com/loteiron/ZeusAgent --skill peft-loteiron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires peft, transformers, torch, bitsandbytes, and includes references (resource) components.

What problem does it solve? Full fine-tuning of 7B-70B parameter models requires 60+ GB of GPU memory and produces multi-gigabyte checkpoints, making it impractical on consumer hardware. This Skill trains less than 1% of parameters using LoRA, QLoRA, and other adapter methods, producing 6MB adapters instead of 14GB full models. ## Core Features & Use Cases - LoRA and QLoRA Fine-Tuning: Configure rank, alpha, dropout, and target modules to fine-tune models like Llama 3.1 8B on an 18GB GPU, or a 70B model on a single 24GB GPU with 4-bit quantization. - Adapter Management: Load, merge, and switch between multiple trained adapters at runtime, enabling multi-task serving from one base model with vLLM. - Integration Recipes: Ready-made patterns for TRL SFTTrainer, Axolotl YAML configs, Flash Attention 2, and architecture-specific target modules for Llama, Mistral, Falcon, and BLOOM. - Use Case: Fine-tune Llama 3.1 8B on the Dolly-15k instruction dataset with rank-16 LoRA, train only 0.17% of parameters, and save a 6MB adapter that can be merged or served alongside other task adapters. ## Quick Start Fine-tune the Llama 3.1 8B model on my instruction dataset using LoRA with rank 16 and save the resulting adapter.

Frequently Asked Questions about peft

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fine-tune a Llama model with LoRA?▼

Load the base model with transformers, create a LoraConfig with rank 8-16, alpha set to twice the rank, and target attention modules like q_proj and v_proj. Apply it with get_peft_model, then train with the standard Trainer and save only the adapter weights.

What is the difference between LoRA and QLoRA?▼

QLoRA combines LoRA adapters with 4-bit NF4 quantization of the base model, reducing memory from 18GB to 6GB for an 8B model. Use QLoRA when memory is the primary constraint, accepting roughly a 5% quality trade-off versus full fine-tuning.

What LoRA rank should I use for fine-tuning?▼

Start with rank 8-16 for general fine-tuning, which trains around 7-14M parameters. Use rank 32-64 for complex tasks, domain adaptation, or 70B models, and rank 4 only for simple tasks or prototyping.

Can I serve multiple LoRA adapters from one base model?▼

Yes, load additional adapters with load_adapter and switch between them at runtime using set_adapter. vLLM also supports batched inference with different adapters via LoRARequest when initialized with enable_lora=True.

Why does LoRA training run out of CUDA memory?▼

OOM occurs from large batch sizes, high rank, or missing gradient checkpointing. Enable gradient checkpointing with prepare_model_for_kbit_training, reduce per-device batch size with gradient accumulation, or switch to QLoRA with 4-bit quantization.

When should I use full fine-tuning instead of PEFT?▼

Use full fine-tuning for models under 1B parameters, when maximum quality is required with sufficient compute budget, or when significant domain shift requires updating all weights. PEFT suits 7B-70B models on limited GPU memory.