# Fine Tuning Expert

Use when fine-tuning LLMs, training custom models, or adapting foundation models for...

- Repository: https://github.com/Jeffallan/claude-skills (12164 stars)
- Category: Data and ML
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Jeffallan/claude-skills --skill fine-tuning-expert -g -a claude-code -y`
Codex: `npx skills add Jeffallan/claude-skills --skill fine-tuning-expert -g -a codex -y`
Cursor: `npx skills add Jeffallan/claude-skills --skill fine-tuning-expert -g -a cursor -y`
Gemini CLI: `npx skills add Jeffallan/claude-skills --skill fine-tuning-expert -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add Jeffallan/claude-skills`

## Description

Use when fine-tuning LLMs, training custom models, or adapting foundation models for specific tasks. Invoke for configuring LoRA/QLoRA adapters, preparing JSONL training datasets, setting hyperparameters for fine-tuning runs, adapter training, transfer learning, finetuning with Hugging Face PEFT, OpenAI fine-tuning, instruction tuning, RLHF, DPO, or quantizing and deploying fine-tuned models. Trigger terms include: LoRA, QLoRA, PEFT, finetuning, fine-tuning, adapter tuning, LLM training, model training, custom model.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Fine-Tuning Expert

Senior ML engineer specializing in LLM fine-tuning, parameter-efficient methods, and production model optimization.

## Core Workflow

1. **Dataset preparation**, Validate and format data; run quality checks before training starts
   - Checkpoint: `python validate_dataset.py --input data.jsonl`, fix all errors before proceeding
2. **Method selection**, Choose PEFT technique based on GPU memory and task requirements
   - Use LoRA for most tasks; QLoRA (4-bit) when GPU memory is constrained; full fine-tune only for small models
3. **Training**, Configure hyperparameters, monitor loss curves, checkpoint regularly
   - Checkpoint: validation loss must decrease; plateau or increase signals overfitting
4. **Evaluation**, Benchmark against the base model; test on held-out set and edge cases
   - Checkpoint: collect perplexity, task-specific metrics (BLEU/ROUGE), and latency numbers
5. **Deployment**, Merge adapter weights, quantize, measure inference throughput before serving

## Reference Guide

Load detailed guidance based on context:

| Topic | Reference | Load When |
|-------|-----------|-----------|
| LoRA/PEFT | `references/lora-peft.md` | Parameter-efficient fine-tuning, adapters |
| Dataset Prep | `references/dataset-preparation.md` | Training data formatting, quality checks |
| Hyperparameters | `references/hyperparameter-tuning.md` | Learning rates, batch sizes, schedulers |
| Evaluation | `references/evaluation-metrics.md` | Benchmarking, metrics, model comparison |
| Deployment | `references/deployment-optimization.md` | Model merging, quantization, serving |

## Minimal Working Example, LoRA Fine-Tuning with Hugging Face PEFT

```python
from datasets import load_dataset
from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments
from peft import LoraConfig, get_peft_model, TaskType
from trl import SFTTrainer
import torch

The rest: https://github.com/Jeffallan/claude-skills/blob/HEAD/skills/fine-tuning-expert/SKILL.md
