AgentStack
SKILL verified MIT Self-run

Fine Tuning

skill-nimadorostkar-claude-skills-collection-fine-tuning · by nimadorostkar

Use when considering fine-tuning a model. Covers when fine-tuning beats prompting or RAG, dataset construction, LoRA and full fine-tuning, evaluation, and the failure modes that waste the effort.

No reviews yet
0 installs
4 views
0.0% view→install

Install

$ agentstack add skill-nimadorostkar-claude-skills-collection-fine-tuning

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Fine Tuning? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Fine-Tuning

Purpose

Decide whether fine-tuning is warranted, and do it properly if it is. Most fine-tuning projects should have been prompt engineering or retrieval, and the ones that should be fine-tuning usually fail on dataset quality rather than on the training.

When to Use

  • A task where prompting has plateaued below the required accuracy.
  • A specific output format, style, or domain vocabulary the model will not adopt reliably.
  • Reducing cost by making a small model do what currently requires a large one.
  • Evaluating an existing fine-tuned model that underperforms.

Capabilities

  • Deciding between prompting, RAG, and fine-tuning.
  • Dataset construction, curation, and splitting.
  • LoRA and QLoRA versus full fine-tuning.
  • Hyperparameter selection and overfitting detection.
  • Evaluation against the base model on the same set.

Inputs

  • The task, and the accuracy prompting achieves on it.
  • Available training data — its volume, and honestly, its quality.
  • Latency and cost constraints.

Outputs

  • A justified decision to fine-tune, or not to.
  • A curated dataset with clean train/validation/test splits.
  • A model measurably better than the base model on a held-out set.

Workflow

  1. Exhaust prompting first — Few-shot examples, a clearer output contract, a better model. Fine-tuning cannot teach knowledge the model lacks; it teaches behavior. If the problem is that the model does not know something, use retrieval instead.
  2. Decide what fine-tuning is actually for — Format adherence, tone, a domain-specific classification boundary, or distilling a large model's behavior into a small one. Those are the cases where it works.
  3. Build the dataset carefully — This is where the project succeeds or fails. A thousand clean, consistent examples beat fifty thousand noisy ones. Inconsistent labels teach the model to be inconsistent.
  4. Split before you look — Train, validation, test. The test set is touched once, at the end. Selecting a checkpoint on the test set is how you produce a model that scores well and performs badly.
  5. Start with LoRA — It is cheap, fast, and sufficient for the majority of tasks. Full fine-tuning is warranted rarely.
  6. Compare against the base model on the same test set — With the same prompt. A fine-tuned model that does not beat a well-prompted base model is a liability, not an asset.

Best Practices

  • Fine-tuning teaches form, not facts. A model fine-tuned on your documentation will produce text that sounds like your documentation, with invented details. Use RAG for facts.
  • Dataset quality dominates every other factor. Inconsistent labeling in the training set is the most common cause of a fine-tune that underperforms.
  • Watch the validation loss. When it rises while training loss falls, you are overfitting — stop, do not train longer.
  • A fine-tuned model is a maintenance liability: it must be re-trained when the base model updates, and it is a fixed artifact while prompts are editable in minutes.
  • Distillation — fine-tuning a small model on a large model's outputs — is the most reliably valuable use of fine-tuning, because the training data can be generated at scale and is internally consistent by construction.
  • Keep the training data. When you need to retrain in a year, reconstructing it will be impossible.

Examples

The decision, made honestly:

Task: classify support tickets into 40 internal categories.

Baseline (prompt only, large model):     71% accuracy
+ 8 few-shot examples:                   79%
+ clarified overlapping category defs:   86%      DatasetReport:
    return DatasetReport(
        total=len(examples),

        # Near-duplicates inflate the count and cause memorization.
        duplicates=count_near_duplicates(examples, threshold=0.95),

        # Class balance: a category with 4 examples will not be learned.
        per_class=Counter(e.label for e in examples),
        underrepresented=[c for c, n in Counter(e.label for e in examples).items() if n  the labeling guidelines are ambiguous. Fix them and relabel.
#   underrepresented       -> gather more, or merge the category.
#   train_test_overlap > 0 -> the test score is meaningless. Re-split.

Notes

  • Cohen's kappa below 0.8 between annotators means the task itself is under-defined. No amount of training will make the model more consistent than its training data.
  • LoRA adapters are small (megabytes) and can be swapped at inference. Several task-specific adapters over one base model is usually a better architecture than several fully fine-tuned models.
  • The most valuable output of a failed fine-tuning project is usually the evaluation set that was built for it. Keep it — it makes every subsequent prompt change measurable.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.