fine-tuning-peft — Claude Code skill: LoRA and QLoRA for LLMs
A skill that walks through fine-tuning large language models with LoRA, QLoRA and other adapter methods when GPU memory is tight.
npx claude-code-templates@latest --skill ai-research/fine-tuning-peftWhat fine-tuning-peft does
The skill covers training 7B–70B models while updating under 1% of the weights. It builds on HuggingFace's PEFT library, which plugs into the transformers stack. Adapters come out in megabytes rather than gigabytes, so keeping several task-specific variants of one base model is cheaper than keeping full copies.
You get working code samples: plain LoRA through LoraConfig, QLoRA with 4-bit quantization via BitsAndBytesConfig, loading and merging adapters, picking rank and lora_alpha, plus target module lists for Llama, Mistral, Qwen, GPT-2, Falcon and BLOOM. A rank table spans 4 to 64, and the guidance suggests starting at 8 or 16.
Dependencies are peft>=0.13.0, transformers>=4.45.0, torch>=2.0.0 and bitsandbytes>=0.43.0. Skip the last one and quantization will not run. QLoRA targets a single 24GB card, at a cost of roughly 5% quality against full fine-tuning. For models under 1B parameters, or when the domain shift is large, the skill points you to full fine-tuning instead.
What it helps with
- fine-tune a 70B model on one GPU
- save an adapter of a few megabytes instead of a full model copy
- choose rank and alpha for a given task
- run several task adapters on top of one base model
- merge a trained adapter into the base model before deployment
Example prompts for the agent
- Set up LoRA for
meta-llama/Llama-3.1-8Bwith rank 16 and save only the adapter - Show a 4-bit QLoRA config so a 70B model fits in 24GB of VRAM
- How do I merge the adapter in
./lora-llama-adapterinto the base model?
How to install fine-tuning-peft
1claude-code-templates
npx claude-code-templates@latest --skill ai-research/fine-tuning-peft2Skills CLI (Vercel)
npx skills add davila7/claude-code-templates --skill fine-tuning-peft -a claude-code3Manually: put the files in place
~/.claude/skills/fine-tuning-peft/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/fine-tuning-peft/
Manually: put the files in place
.agents/skills/fine-tuning-peft/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/fine-tuning-peft/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install davila7/claude-code-templates fine-tuning-peft2Manually: put the files in place
.github/skills/fine-tuning-peft/SKILL.mdPlatform CLI
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/ai-research/fine-tuning-peftManually: put the files in place
.devin/skills/fine-tuning-peft/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about fine-tuning-peft
How do I install fine-tuning-peft in Claude Code?
Use the templates command: npx claude-code-templates@latest --skill ai-research/fine-tuning-peft. Or run npx skills add davila7/claude-code-templates --skill fine-tuning-peft -a claude-code. The skill file lands at ~/.claude/skills/fine-tuning-peft/SKILL.md.
What does fine-tuning-peft do?
It guides adapter-based fine-tuning of LLMs: LoRA, QLoRA and more than twenty other methods. Expect configs, training examples and adapter loading built on the PEFT library.
How is QLoRA different from plain LoRA?
QLoRA adds 4-bit quantization of the base model, which lets a 70B model fit on a single 24GB GPU. In exchange, quality drops by about 5% versus full fine-tuning.