Tooluck logoTooluck
SKILL.md

peft-fine-tuning

Agent skill fromOpenRaiser/NanoResearch

Parameter-efficient fine-tuning for LLMs using LoRA, QLoRA, and 25+ methods. Use when fine-tuning large models (7B-70B) with limited GPU memory, when you need to train <1% of parameters with minimal accuracy loss, or for multi-adapter serving. HuggingFace's official library integrated with transformers ecosystem.

How to install peft-fine-tuning

install peft-fine-tuning
# install the NanoResearch pack with the skills CLI
npx skills add OpenRaiser/NanoResearch

# or add only this skill to Claude Code: copy the folder

skills/vendor-ai-research/peft/

# into

~/.claude/skills/peft/ (all projects)

.claude/skills/peft/ (one project)

skills/vendor-ai-research/peft/SKILL.md

MITFull file
1# PEFT (Parameter-Efficient Fine-Tuning)
2
3Fine-tune LLMs by training <1% of parameters using LoRA, QLoRA, and 25+ adapter methods.
4
5## When to use PEFT
6
7**Use PEFT/LoRA when:**
8- Fine-tuning 7B-70B models on consumer GPUs (RTX 4090, A100)
9- Need to train <1% parameters (6MB adapters vs 14GB full model)
10- Want fast iteration with multiple task specific adapters
11- Deploying multiple fine-tuned variants from one base model
12
13**Use QLoRA (PEFT + quantization) when:**
14- Fine-tuning 70B models on single 24GB GPU
15- Memory is the primary constraint
16- Can accept ~5% quality trade-off vs full fine-tuning
17
18**Use full fine-tuning instead when:**
19- Training small models (<1B parameters)
20- Need maximum quality and have compute budget
21- Significant domain shift requires updating all weights
22
23## Quick start
24
25### Installation
26
27```bash
28# Basic installation
29pip install peft
30
31# With quantization support (recommended)
32pip install peft bitsandbytes
33
34# Full stack
35pip install peft transformers accelerate bitsandbytes datasets
36```
37
38### LoRA fine-tuning (standard)
39
40```python
41from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, Trainer
42from peft import get_peft_model, LoraConfig, TaskType
43from datasets import load_dataset
44
45# Load base model
46model_name = "meta-llama/Llama-3.1-8B"
47model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
48tokenizer = AutoTokenizer.from_pretrained(model_name)
49tokenizer.pad_token = tokenizer.eos_token
50…

Excerpt shown under the repository's MIT license.

More skills in NanoResearch

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates