peft-fine-tuning

Fine-tune large language models with LoRA, QLoRA, and adapter methods using HuggingFace PEFT.

5|2|Updated Aug 10, 2026
One-click install
npx skills add https://github.com/MedTiLab/Auto-meta-analysis --skill peft-fine-tuning-medtilab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: peft-fine-tuning
Source: https://github.com/MedTiLab/Auto-meta-analysis/tree/main/skills/fine-tuning/peft
Command: npx skills add https://github.com/MedTiLab/Auto-meta-analysis --skill peft-fine-tuning-medtilab

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 language models requires prohibitive GPU memory and produces multi-gigabyte checkpoints. This Skill guides parameter-efficient fine-tuning with LoRA, QLoRA, and 25+ adapter methods so you can train under 1% of parameters on consumer GPUs while keeping accuracy close to full fine-tuning. ## Core Features & Use Cases - LoRA and QLoRA workflows: Configure rank, alpha, dropout, and target modules, with 4-bit quantization to fit a 70B model on a single 24GB GPU. - Adapter management: Load, merge, and switch between multiple trained adapters at runtime for multi-task serving with vLLM. - Advanced variants and troubleshooting: Reference guides cover DoRA, AdaLoRA, LoftQ, rsLoRA, custom module targeting, and fixes for CUDA OOM, NaN loss, and adapter loading errors. - Use Case: Fine-tune Llama 3.1 8B on an instruction dataset with LoRA r=16 on one RTX 4090, producing a 6MB adapter instead of a 16GB checkpoint, then merge it for deployment. ## Quick Start Fine-tune Llama 3.1 8B on my instruction dataset using LoRA with rank 16 and show me how to save and reload the 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, alpha, and target modules like q_proj and v_proj, then wrap the model with get_peft_model. Train with the standard Trainer and save only the adapter weights with save_pretrained.

What is the difference between LoRA and QLoRA?▼

QLoRA combines LoRA adapters with 4-bit NF4 quantization of the base model, cutting memory from about 18GB to 6GB for an 8B model. Use QLoRA when memory is the primary constraint and you can accept roughly 5% quality trade-off.

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

Start with rank 8-16 for general fine-tuning, which trains about 0.17% of parameters. Increase to 32-64 for complex tasks, domain adaptation, or 70B models, and set lora_alpha to roughly twice the rank.

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

Yes. Load additional adapters with load_adapter and switch at runtime using set_adapter, or serve them concurrently with vLLM by enabling enable_lora and passing LoRARequest objects per prompt.

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

Enable gradient checkpointing, reduce per-device batch size while increasing gradient accumulation, or switch to QLoRA with 4-bit quantization. Lowering the rank or targeting fewer modules also reduces memory usage.

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 rather than a small adapter.