fine-tuning

fine-tuning is a skill for Claude Code, Codex from LuuOW/meridian-mcp. It costs 80 tokens per session (2,381 once invoked), scanned A, original, MIT.

A guide to adapting large language models by training them on examples or preferences, instead of relying only on prompts. It covers methods such as LoRA, supervised training, preference training, quantization, serving, and evaluation.

In plain words
What is it for?
Use it to prepare datasets, choose a fine-tuning method, train and align models, reduce deployment memory needs, serve them, and evaluate results.
Why use it?
It helps teams change a model’s behavior for a specific domain, task, or style and measure whether the training worked.

Skill for Claude CodeCodex

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

Good fit Use it to prepare datasets, choose a fine-tuning method, train and align models, reduce deployment memory needs, serve them, and evaluate results.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/luuow/meridian-mcp/fine-tuning
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 LuuOW/meridian-mcp --skill fine-tuning
Clone the repo
git clone --depth 1 https://github.com/LuuOW/meridian-mcp

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 fine-tuning

README.md
[![agentmods](https://agentmods.dev/badge/skills/luuow/meridian-mcp/fine-tuning/github.svg)](https://agentmods.dev/skills/luuow/meridian-mcp/fine-tuning)
Your own site
<a href="https://agentmods.dev/skills/luuow/meridian-mcp/fine-tuning"><img src="https://agentmods.dev/badge/skills/luuow/meridian-mcp/fine-tuning/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 fine-tuning

Your own site · 80×15
<a href="https://agentmods.dev/skills/luuow/meridian-mcp/fine-tuning"><img src="https://agentmods.dev/badge/skills/luuow/meridian-mcp/fine-tuning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,381 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.00080 $0.02381
Opus 5 $0.00040 $0.01190
Sonnet 5 $0.00016 $0.00476
Haiku 4.5 $0.00008 $0.00238

Measured 11d ago against content hash b7622232c6d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

fine-tuning 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 11d 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/fine-tuning/SKILL.md · 235 lines

How it starts

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

Fine-Tuning

Production authority on adapting large language models: parameter-efficient fine-tuning with LoRA/QLoRA, full supervised fine-tuning, preference alignment via DPO and RLHF, quantization for deployment, and systematic evaluation. Use this skill when training or adapting any LLM beyond prompting, including domain adaptation, instruction following, and RLHF pipelines.

Core Concepts

LoRA vs QLoRA vs Full Fine-Tune

LoRA (Low-Rank Adaptation) injects trainable rank-decomposition matrices into attention layers, leaving base weights frozen. A rank-16 LoRA on a 7B model trains ~8M parameters instead of 7B — fits in ~24 GB VRAM. QLoRA adds 4-bit NF4 quantization of the frozen base weights (via bitsandbytes), enabling 7B fine-tuning on a single 16 GB GPU. Full fine-tuning is reserved for fundamental domain shifts where LoRA rank capacity is genuinely insufficient, or when you have 8+ A100s.

PEFT + Hugging Face Trainer (LoRA SFT)

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

MODEL_ID = "meta-llama/Meta-Llama-3-8B-Instruct"

tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
tokenizer.pad_token = tokenizer.eos_token
tokenizer.padding_side = "right"  # critical for causal LM training

model = AutoModelForCausalLM.from_pretrained(
    MODEL_ID,
    torch_dtype=torch.bfloat16,   # bf16 > fp16 for training stability
    device_map="auto",
    attn_implementation="flash_attention_2",  # 3-5x memory savings
)

lora_config = LoraConfig(
    r=16,                    # rank — higher = more capacity, more VRAM
    lora_alpha=32,           # scaling factor; effective lr scales as alpha/r
    target_modules=[         # target all attention projections
        "q_proj", "k_proj", "v_proj", "o_proj",
        "gate_proj", "up_proj", "down_proj",  # include MLP for better perf
    ],
    lora_dropout=0.05,
    bias="none",
    task_type=TaskType.CAUSAL_LM,
)
model = get_peft_model(model, lora_config)
model.print_trainable_parameters()
# trainable params: 41,943,040 || all params: 8,072,204,288 || trainable%: 0.52

dataset = load_dataset("json", data_files={"train": "train.jsonl", "test": "test.jsonl"})

args = TrainingArguments(
    output_dir="./llama3-8b-lora",
    num_train_epochs=3,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=4,   # effective batch = 16
    learning_rate=2e-4,
    lr_scheduler_type="cosine",
    warmup_ratio=0.03,
    weight_decay=0.01,
    bf16=True,
    logging_steps=10,
    save_strategy="epoch",
    eval_strategy="epoch",
    load_best_model_at_end=True,
    report_to="wandb",
)

trainer = SFTTrainer(
    model=model,
    args=args,
    train_dataset=dataset["train"],
    eval_dataset=dataset["test"],
    dataset_text_field="text",      # or use formatting_func for chat templates
    max_seq_length=4096,
    packing=True,                   # pack short sequences to fill context window
)
trainer.train()
model.save_pretrained("./final-lora-adapter")

Read the full file on GitHub · 235 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. 11d ago First seen · 235 lines · 80 tokens per session scan A b7622232c6d5

Subscribe to this mod's changes

fine-tuning is a skill published in the GitHub repository LuuOW/meridian-mcp (0 stars, last pushed yesterday), licensed MIT. It adds 80 tokens to every session and 2,381 once invoked, about $0.0004 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-31.

Related

Other skills, from other repositories

finetuning

Use when adapting an open-weight model to a target form or behavior — tone, output format, reasoning pattern — via LoRA/QLoRA or full fine-tuning with TRL SFTTrainer, then preference optimization (DPO/ORPO/KTO/GRPO), and for fine-tune vs prompt vs RAG. NOT adding facts to a model (that is rag); NOT the single-GPU…

ericrisco/rsc-harness · 102 tokens

fine-tuning-with-trl

Fine-tune LLMs using reinforcement learning with TRL - SFT for instruction tuning, DPO for preference alignment, PPO/GRPO for reward optimization, and reward model training. Use when need RLHF, align model with preferences, or train from human feedback. Works with HuggingFace Transformers.

davila7/claude-code-templates · 69 tokens

axolotl

Expert guidance for fine-tuning LLMs with Axolotl - YAML configs, 100+ models, LoRA/QLoRA, DPO/KTO/ORPO/GRPO, multimodal support.

davila7/claude-code-templates · 47 tokens

fine-tuning-with-trl

Fine-tune LLMs using reinforcement learning with TRL - SFT for instruction tuning, DPO for preference alignment, PPO/GRPO for reward optimization, and reward model training. Use when need RLHF, align model with preferences, or train from human feedback. Works with HuggingFace Transformers.

OpenLAIR/dr-claw · 69 tokens

axolotl

Expert guidance for fine-tuning LLMs with Axolotl - YAML configs, 100+ models, LoRA/QLoRA, DPO/KTO/ORPO/GRPO, multimodal support.

OpenLAIR/dr-claw · 47 tokens

axolotl

Expert guidance for fine-tuning LLMs with Axolotl - YAML configs, 100+ models, LoRA/QLoRA, DPO/KTO/ORPO/GRPO, multimodal support.

synthetic-sciences/openscience · 47 tokens