peft-fine-tuning

Fine-tune LLMs with LoRA, QLoRA, and adapter methods using HuggingFace PEFT.

1|Updated Jun 19, 2026
One-click install
npx skills add https://github.com/Lento47/arcana-community --skill peft-fine-tuning-lento47
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: peft-fine-tuning
Source: https://github.com/Lento47/arcana-community/tree/main/skills/mlops/peft
Command: npx skills add https://github.com/Lento47/arcana-community --skill peft-fine-tuning-lento47

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Full fine-tuning of large language models (7B-70B parameters) requires enormous GPU memory and compute. This Skill enables parameter-efficient fine-tuning that trains less than 1% of model parameters, producing 6MB adapters instead of 14GB checkpoints, so you can fine-tune large models on consumer GPUs. ## Core Features & Use Cases - LoRA and QLoRA Fine-Tuning: Train low-rank adapters on models from 7B to 70B parameters, with 4-bit quantization support to fit a 70B model on a single 24GB GPU. - 25+ PEFT Methods: Includes AdaLoRA, IA3, Prefix Tuning, Prompt Tuning, DoRA, LoftQ, and rsLoRA with guidance on rank, alpha, and target module selection per architecture. - Multi-Adapter Serving: Load, switch, merge, and compose multiple adapters at runtime, with integration patterns for TRL, Axolotl, and vLLM. - Use Case: Fine-tune Llama 3.1 8B on the Dolly instruction dataset with LoRA rank 16 on a single RTX 4090, then merge the adapter and deploy through vLLM. ## Quick Start Fine-tune Llama 3.1 8B on my instruction dataset using LoRA with rank 16 and save the adapter to ./lora-adapter.

Frequently Asked Questions about peft-fine-tuning

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 16, alpha 32, and target modules like q_proj and v_proj, then wrap the model with get_peft_model and train with the standard Trainer. Save only the adapter weights with save_pretrained, producing a file around 6MB instead of the full 16GB model.

What is the difference between LoRA and QLoRA?▼

QLoRA combines LoRA adapters with 4-bit quantization of the base model using bitsandbytes NF4 quantization. This reduces memory from around 18GB to 6GB for an 8B model, enabling 70B fine-tuning on a single 24GB GPU at the cost of roughly 5% quality and slower training speed.

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

Start with rank 8-16 for general fine-tuning, which trains about 7-14M parameters on an 8B model. Use rank 32-64 for complex tasks, domain adaptation, or 70B models, and set lora_alpha to twice the rank as a starting point.

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

Yes, PEFT supports loading multiple adapters with load_adapter and switching between them at runtime using set_adapter. For production serving, vLLM supports concurrent LoRA requests via LoRARequest with configurable max_loras and max_lora_rank.

Why do I get CUDA out of memory during LoRA training?▼

OOM usually comes from batch size, missing gradient checkpointing, or unquantized weights. Enable gradient checkpointing with prepare_model_for_kbit_training, reduce per-device batch size while increasing gradient accumulation, or switch to QLoRA with 4-bit NF4 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 and compute budget allows, or when significant domain shift requires updating all weights. PEFT methods train under 1% of parameters and trade a small amount of accuracy for large memory savings.