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 $0.00058 $0.01187
Sonnet 5 $0.00023 $0.00475
Haiku 4.5 $0.00012 $0.00237

Measured 12d ago against content hash 35007465e4a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 12d 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. 12d 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 (22 stars, last pushed 18d ago), licensed MIT. It adds 116 tokens to every session and 2,373 once invoked, about $0.0006 per session on Opus 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

Other skills, from other repositories

prompt-library

Curated collection of high-quality prompts for various use cases. Includes role-based prompts, task-specific templates, and prompt refinement techniques. Use when user needs prompt templates, role-play prompts, or ready-to-use prompt examples for coding, writing, analysis, or creative tasks.

davila7/claude-code-templates · 57 tokens

edgartools

Python library for accessing, analyzing, and extracting data from SEC EDGAR filings. Use when working with SEC filings, financial statements (income statement, balance sheet, cash flow), XBRL financial data, insider trading (Form 4), institutional holdings (13F), company financials, annual/quarterly reports (10-K…

foryourhealth111-pixel/Vibe-Skills · 110 tokens

rag-patterns

RAG: embeddings, chunking, hybrid search (BM25+vector), reranking, CRAG, multi-hop. Triggers: RAG, embedding, pgvector, Qdrant, Pinecone, Weaviate, reranker, semantic search.

softspark/ai-toolkit · 57 tokens

evaluate

Evaluates RAG retrieval and LLM-as-judge metrics (faithfulness, relevancy, context precision). Triggers: measure RAG quality, knowledge gap, RAG eval, golden dataset.

softspark/ai-toolkit · 42 tokens

instinct-review

Reviews/promotes/removes instincts from .claude/instincts/.md. Triggers: instinct review, curate instincts, manage instincts, promote instinct.

softspark/ai-toolkit · 36 tokens

repeat

Runs prompt/slash command on recurring interval until done or limit. Triggers: repeat, recurring task, poll status, run every N minutes, interval.

softspark/ai-toolkit · 33 tokens