model-fine-tuner

model-fine-tuner is a skill for Claude Code, Codex from khalilbenaz/claude-skills-collection. It costs 116 tokens per session (2,373 once invoked), scanned A, original, MIT.

A step-by-step guide for adapting machine-learning or large language models to a specific task using methods such as LoRA, QLoRA, and PEFT.

In plain words
What is it for?
Use it to plan fine-tuning, format instruction datasets, select settings based on available hardware, and avoid common training mistakes.
Why use it?
It helps choose a training approach, prepare the data, and measure whether the adapted model actually improves.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is # python llama.cpp/convert_hf_to_gguf.py ./final-model --outtype q5_k_m.

Good fit Use it to plan fine-tuning, format instruction datasets, select settings based on available hardware, and avoid common training mistakes.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/khalilbenaz/claude-skills-collection
agentmods
npx agentmods add skills/khalilbenaz/claude-skills-collection/model-fine-tuner

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for model-fine-tuner

README.md
[![agentmods](https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/model-fine-tuner/github.svg)](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/model-fine-tuner)
Your own site
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/model-fine-tuner"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/model-fine-tuner/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for model-fine-tuner

Your own site · 80×15
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/model-fine-tuner"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/model-fine-tuner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 116 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,373 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00116 $0.02373
Opus 5.5 $0.00046 $0.00949
Sonnet 5.5 $0.00023 $0.00475
Haiku 4.5 $0.00012 $0.00237

Measured 3mo ago against content hash 35007465e4a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

model-fine-tuner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

ai-ml-skills/model-fine-tuner/SKILL.md · 246 lines

How it starts

The opening of the file, as written. The whole thing — 246 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Model Fine-Tuner

Critères de décision : quelle méthode choisir ?

Situation Méthode recommandée
GPU < 24 Go, LLM > 7B QLoRA 4-bit
GPU 24–80 Go, besoin de vitesse LoRA bfloat16
Petite tâche de classification Full fine-tune BERT/DeBERTa
Tâche très spécifique, budget compute IA3 ou Prefix Tuning
Modèle > 70B, multi-GPU FSDP + LoRA
Données < 500 exemples Prompt engineering d'abord, fine-tune ensuite

Workflow

1. Baseline — mesurer avant de toucher quoi que ce soit

# Exemple : évaluer Mistral-7B zero-shot sur votre tâche
python eval.py --model mistralai/Mistral-7B-v0.3 --dataset data/test.jsonl --metric f1

Sans baseline chiffrée, l'amélioration est invérifiable. Loguer la baseline dans MLflow/W&B immédiatement.

2. Préparer le dataset

Format instruction/response (standard Alpaca / ChatML) :

# Format Alpaca
{"instruction": "Classe cette phrase.", "input": "Le produit est excellent.", "output": "positif"}

# Format ChatML (préféré pour les LLM modernes)
{"messages": [
  {"role": "system", "content": "Tu es un classificateur de sentiment."},
  {"role": "user", "content": "Le produit est excellent."},
  {"role": "assistant", "content": "positif"}
]}

Validation obligatoire avant entraînement :

from datasets import load_dataset
ds = load_dataset("json", data_files={"train": "train.jsonl", "test": "test.jsonl"})

# Vérifier la distribution des labels
from collections import Counter
Counter(ds["train"]["label"])

# Vérifier les longueurs de tokens
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.3")
lengths = [len(tok(x["instruction"] + x["output"])["input_ids"]) for x in ds["train"]]
print(f"max={max(lengths)}, p95={sorted(lengths)[int(0.95*len(lengths))]}")

Règle : si p95 > max_seq_length, tronquer ou filtrer — ne jamais silencieusement perdre des tokens en production.

3. Configurer LoRA / QLoRA

from transformers import AutoModelForCausalLM, BitsAndBytesConfig
from peft import LoraConfig, get_peft_model, TaskType
import torch

# QLoRA 4-bit (≈ 5 Go pour 7B)
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16,
    bnb_4bit_use_double_quant=True,
)

model = AutoModelForCausalLM.from_pretrained(
    "mistralai/Mistral-7B-v0.3",
    quantization_config=bnb_config,
    device_map="auto",
)

lora_config = LoraConfig(
    r=16,              # rang : 8 (léger) → 64 (expressif)
    lora_alpha=32,     # scaling = alpha/r, garder alpha = 2*r
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
    lora_dropout=0.05,
    bias="none",
    task_type=TaskType.CAUSAL_LM,
)

model = get_peft_model(model)
model.print_trainable_parameters()
# → "trainable params: 4,194,304 || all params: 3,756,462,080 || trainable%: 0.1117"

Read the full file on GitHub · 246 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 246 lines · 116 tokens per session scan A 35007465e4a3

Subscribe to this mod's changes

model-fine-tuner is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (27 stars, last pushed 3mo ago), licensed MIT. It adds 116 tokens to every session and 2,373 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

model-fine-tuner compared with skills from other repositories

model-fine-tuner next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
model-fine-tunerkhalilbenaz/claude-skills-collectionSkill273mo agoMITA116Claude Code, Codex
model-architecture-litgptdavila7/claude-code-templatesSkill35ktodayMITA75Claude Code, Codex
prompt-librarydavila7/claude-code-templatesSkill35ktodayMITA57Claude Code, Codex
ki-arbeitsauftrag-formulierenKlotzkette/claude-fuer-deutsches-rechtSkill1.9k3d agoApache-2.0A56Claude Code
get-more-from-aimohitagw15856/pm-claude-skillsSkill1.6ktodayMITA140Claude Code
spot-ai-mistakesmohitagw15856/pm-claude-skillsSkill1.6ktodayMITA145Claude Code
financial-statement-explainermohitagw15856/pm-claude-skillsSkill1.6ktodayMITA107Claude Code