llm-finetuning

llm-finetuning is a skill for Claude Code, Codex from param087/agent-ml-skills. It costs 53 tokens per session (946 once invoked), scanned A, original, MIT.

A guide to adapting a large language model, which is an AI model that works with text, to a particular task, format, or writing style.

In plain words
What is it for?
Use it to format chat or instruction datasets, choose a fine-tuning method, set key training options, and evaluate a customized model.
Why use it?
It helps decide whether fine-tuning is needed instead of using prompts or retrieval, and explains how to prepare examples without overfitting the model. It covers full training and smaller-update methods such as LoRA and QLoRA.

Skill for Claude CodeCodex

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

Good fit Use it to format chat or instruction datasets, choose a fine-tuning method, set key training options, and evaluate a customized model.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/param087/agent-ml-skills/llm-finetuning
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add param087/agent-ml-skills --skill llm-finetuning
Clone the repo
git clone --depth 1 https://github.com/param087/agent-ml-skills

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 llm-finetuning

README.md
[![agentmods](https://agentmods.dev/badge/skills/param087/agent-ml-skills/llm-finetuning/github.svg)](https://agentmods.dev/skills/param087/agent-ml-skills/llm-finetuning)
Your own site
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/llm-finetuning"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/llm-finetuning/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 llm-finetuning

Your own site · 80×15
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/llm-finetuning"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/llm-finetuning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 946 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.
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.00053 $0.00946
Opus 5.5 $0.00021 $0.00378
Sonnet 5.5 $0.00011 $0.00189
Haiku 4.5 $0.00005 $0.00095

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

Security

Grade A, and why

llm-finetuning 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 2mo 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.

skills/llm-finetuning/SKILL.md · 91 lines

How it starts

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

LLM Fine-Tuning

Overview

Fine-tuning adapts a base LLM to a task or style. For almost all practitioners the right default is parameter-efficient fine-tuning (LoRA/QLoRA) — it trains <1% of weights, fits on a single GPU, and avoids catastrophic forgetting. Reach for full fine-tuning only with strong justification and budget.

When to use

  • A base/instruct model is close but needs domain style, format, or behavior.
  • You have a few hundred to tens of thousands of quality examples.

First decide: do you even need to fine-tune?

Try prompting + few-shot + RAG first (see the rag-pipeline skill). Fine-tune when you need consistent format/style, lower latency/cost than long prompts, or to internalize a large example set.

Method selection

Method Trains VRAM Use when
Full FT 100% Very high Large data + budget, max quality
LoRA ~0.1-1% Moderate Default for most tasks
QLoRA ~0.1-1% Low (4-bit) Single consumer GPU

Dataset formatting (chat / instruction)

Use the model's chat template; quality > quantity. A few thousand clean, diverse examples beat a noisy 100k dump.

def to_chat(example):
    return {"messages": [
        {"role": "system", "content": "You are a helpful support agent."},
        {"role": "user", "content": example["question"]},
        {"role": "assistant", "content": example["answer"]},
    ]}

QLoRA with TRL

from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import LoraConfig
from trl import SFTTrainer, SFTConfig
import torch

bnb = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
                         bnb_4bit_compute_dtype=torch.bfloat16)
model = AutoModelForCausalLM.from_pretrained(BASE, quantization_config=bnb, device_map="auto")

peft_cfg = LoraConfig(r=16, lora_alpha=32, lora_dropout=0.05, bias="none",
                      task_type="CAUSAL_LM",
                      target_modules=["q_proj", "k_proj", "v_proj", "o_proj"])

trainer = SFTTrainer(
    model=model, train_dataset=train_ds, eval_dataset=eval_ds, peft_config=peft_cfg,
    args=SFTConfig(per_device_train_batch_size=2, gradient_accumulation_steps=8,
                   learning_rate=2e-4, num_train_epochs=2, warmup_ratio=0.03,
                   lr_scheduler_type="cosine", bf16=True, logging_steps=10,
                   eval_strategy="steps", eval_steps=100, output_dir="out"),
)
trainer.train()

Read the full file on GitHub · 91 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. 2mo ago First seen · 91 lines · 53 tokens per session scan A de5ab7bdcf4f

Subscribe to this mod's changes

llm-finetuning is a skill published in the GitHub repository param087/agent-ml-skills (13 stars, last pushed 5mo ago), licensed MIT. It adds 53 tokens to every session and 946 once invoked, about $0.0002 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-31.

Related

llm-finetuning compared with skills from other repositories

llm-finetuning next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
llm-finetuningparam087/agent-ml-skillsSkill135mo agoMITA53Claude Code, Codex
spark-training-gotchaswshobson/agentsSkill42kyesterdayMITA63Claude Code
9router-sttdecolua/9routerSkill32k9d agoMITA63Claude Code, Codex
9routerdecolua/9routerSkill32k9d agoMITA84Claude Code, Codex
9router-embeddingsdecolua/9routerSkill32k9d agoMITA66Claude Code, Codex
dashscopecalesthio/OpenMontageSkill77k3d agoAGPL-3.0A93Claude Code, Codex
ultralytics-platformfcakyon/claude-codex-settingsSkill1.2kyesterdayApache-2.0A135Claude Code