Skip to content

Guide · Agent skill

How to use the PEFT fine-tuning agent skill: setup and examples

Updated · written with AI from the project's own documentation and checked against our catalogue data

The PEFT fine-tuning skill (skill name: peft-fine-tuning) teaches an AI agent to adapt a large language model to a specific task by training small add-on layers instead of all of the model's billions of parameters. It is aimed at developers and data scientists who want to fine-tune 7B to 70B open models on limited GPU memory. This guide explains what the skill does, how to install it, how to ask for it in plain language, and what you need before running any of the code it produces.

PEFT Efficient Fine-TuningOrchestra-Research/AI-Research-SKILLs · MIT

Quick start

  1. 1Download and unzip the skill. Download the peft-fine-tuning ZIP from this page and unzip it into ~/.claude/skills/ or your project's .claude/skills/ folder.
  2. 2Check your environment. Confirm you have Python, a GPU with enough memory for your model, and the packages peft, transformers, torch, and bitsandbytes at the minimum versions listed.
  3. 3Describe your fine-tuning goal. Ask the agent in plain words, naming the model size, GPU memory and task, for example a LoRA setup for an 8B model.
  4. 4Review the generated code. Read the setup and training code before running it, especially any download or push_to_hub steps.
  5. 5Train and save the adapter. Run the training script and save the adapter with save_pretrained so you keep only the small adapter files.
  6. 6Load, switch or merge. Load the adapter for testing, use set_adapter to switch between tasks, or merge_and_unload for deployment.

What the skill makes the agent do

Fine-tuning normally means updating every weight in a model, which needs a lot of memory. The PEFT skill instead uses LoRA (low-rank adaptation) and QLoRA (quantized LoRA), which train only a small set of adapter layers, often a few megabytes, on top of a base model. The skill's source notes that PEFT trains under 1% of parameters, and gives an example of about 6MB adapters against a 14GB full model.

  • Write setup code for LoRA or QLoRA fine-tuning with the transformers and peft libraries
  • Choose LoRA settings such as rank (r), lora_alpha and target modules for your model architecture
  • Load trained adapters, merge them into a base model, or switch between several adapters on one base model
  • Suggest when QLoRA or full fine-tuning is the better choice

Install the skill (ZIP download or Claude apps)

Download the skill ZIP from this page and unzip it. The skill folder contains SKILL.md plus two reference files, references/advanced-usage.md and references/troubleshooting.md. Put the unzipped folder in one of these locations:

You can also upload the skill in the Claude apps under Settings → Capabilities → Skills.

  • Personal skills: ~/.claude/skills/
  • Project skills: .claude/skills/ inside your project folder

Trigger the skill with natural requests

You do not need to name the skill. The skill's description covers requests about fine-tuning large models with limited GPU memory, training under 1% of parameters, and multi-adapter serving. Describe your goal and your hardware in plain words; the more specific you are about model size and GPU, the better the agent's suggestions will fit.

  • "Set up LoRA fine-tuning for an 8B model on my 24GB GPU using this dataset."
  • "Should I use QLoRA or LoRA to fine-tune a 70B model with limited memory?"
  • "Which target modules should I use for a Mistral model with LoRA?"
  • "Merge my LoRA adapter into the base model and prepare it for deployment."
  • "Help me serve three task-specific adapters from one base model and switch between them."

What you need before you start

The code assumes a working Python machine with a GPU that has enough memory for the model you choose. The source lists these packages: peft>=0.13.0, transformers>=4.45.0, torch>=2.0.0 and bitsandbytes>=0.43.0 (for QLoRA). It recommends the full stack of peft, transformers, accelerate, bitsandbytes and datasets. The examples load gated base models such as Llama, so you need a Hugging Face account with access granted to that model.

  • Python environment with the packages above
  • GPU with sufficient memory for your chosen model
  • Hugging Face account and access to gated base models (for downloading or pushing)
pip install peft transformers accelerate bitsandbytes datasets

Safety notes: scripts and network access

This skill runs scripts and uses the network. The examples download base models and datasets, and show pushing merged models to the Hugging Face Hub with push_to_hub. Review each command and script before running it, and check where your data is going before you upload anything. Do not train on sensitive data unless you have reviewed the datasets and the hosting choices.

The troubleshooting reference includes commands that uninstall and reinstall bitsandbytes and that compile it from source. Read these before running them on a machine you care about.

  • Check dataset licences and contents before training
  • Keep private data off the Hub unless you have decided it can go there
  • Read installation commands from the troubleshooting file before executing them

Tips for better results

Start with a small rank such as r=8 or r=16, which the skill recommends as a starting point, and increase it only if quality is not good enough. The skill suggests setting lora_alpha to about twice the rank. For QLoRA on very large models, the skill uses a higher rank such as 64 with more target modules.

If you are unsure which modules to target, the skill lists common choices by architecture, including Llama, Mistral and Qwen, GPT-2, Falcon and BLOOM, and an all-linear option for PEFT 0.6.0 and later. The advanced reference covers DoRA and AdaLoRA variants.

  • Begin with r=8 or r=16 and alpha around 2 × rank
  • Use the architecture-specific target module list for your model
  • Save the adapter alone for small files; merge only when deploying

What people use it for

  • Fine-tuning an 8B open model on a single consumer GPU for a customer-support style task
  • Training a 70B model with QLoRA on a 24GB GPU when memory is the main limit
  • Keeping one base model and several small task adapters, switching between them at runtime
  • Comparing LoRA rank and alpha settings to trade memory against quality

Frequently asked questions

Is the PEFT fine-tuning skill free to use?

The skill is published under the MIT licence, according to its listing. The underlying PEFT library is HuggingFace's official library, and the skill's code also depends on models and tools you may need to access separately.

What do I need to install before using this skill?

You need a Python environment and a GPU with enough memory for your chosen model. The source lists peft>=0.13.0, transformers>=4.45.0, torch>=2.0.0 and bitsandbytes>=0.43.0 for QLoRA, with accelerate and datasets recommended.

Do I need a Hugging Face account?

The source says a Hugging Face account and access to gated base models such as Llama are needed for pushing or downloading. The examples also show pushing merged models to the Hub.

Can I use this skill with a small model?

The skill recommends full fine-tuning instead for models under 1B parameters. It is designed for large models such as 7B to 70B.

Where do I put the skill files?

Unzip the downloaded folder into ~/.claude/skills/ for personal use or into .claude/skills/ in a project. You can also upload it in the Claude apps under Settings → Capabilities → Skills.

What do I do if bitsandbytes gives a CUDA error?

The troubleshooting reference covers this error. It suggests checking your CUDA version with nvcc --version, then reinstalling bitsandbytes with pip, or compiling it from source for your CUDA version. Read those commands before running them.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you are a developer or data scientist with Python and a GPU who wants to fine-tune 7B to 70B open models on limited memory or serve several task adapters from one base model. Pick something else if you have no Python or GPU experience, if your model is under 1B parameters, or if you cannot review the scripts and data before they run.

Download the skill