fine-tuning-preparer
Skill1 starsChanged 5 months agoApache-2.0View on GitHub
Prepares datasets and training configurations for fine-tuning LLMs. Use when customizing a base model on domain-specific data using LoRA, QLoRA, or supervised fine-tuning.
In this repository58 other files it gives its agents.
- agent-chain-designerSkill
- api-wrapper-builderSkill
- embeddings-builderSkill
- evaluation-harnessSkill
- llm-router-builderSkill
- ml-model-trainerSkill
- model-benchmarkerSkill
- prompt-engineerSkill
- rag-pipeline-builderSkill
- synthetic-data-generatorSkill
- vector-db-integratorSkill
- csv-processorSkill
- database-schema-designerSkill
- data-pipeline-builderSkill
- etl-workflow-designerSkill
- json-transformerSkill
- pandas-data-cleanerSkill
- report-generatorSkill
- sql-query-optimizerSkill
- time-series-analyzerSkill
- visualization-generatorSkill
- backup-strategySkill
- ci-cd-optimizerSkill
- docker-compose-generatorSkill
- github-actions-pipelineSkill
- kubernetes-deploymentSkill
- load-balancer-configSkill
- log-aggregator-setupSkill
- monitoring-dashboardSkill
- nginx-config-generatorSkill
- security-hardeningSkill
- ssl-certificate-managerSkill
- terraform-module-builderSkill
- api-security-auditorSkill
- compliance-checkerSkill
- dependency-checkerSkill
- incident-responderSkill
- jwt-security-auditorSkill
- owasp-checkerSkill
- penetration-test-plannerSkill
- secret-detectorSkill
- threat-model-designerSkill
- vulnerability-scannerSkill
- accessibility-auditorSkill
- api-route-builderSkill
- auth-flow-builderSkill
- css-animation-crafterSkill
- form-validatorSkill
- graphql-schema-designerSkill
- html-component-builderSkill
- nextjs-app-scaffoldSkill
- performance-auditorSkill
- pwa-setupSkill
- react-component-generatorSkill
- responsive-layout-systemSkill
- seo-optimizerSkill
- tailwind-design-systemSkill
- websocket-integrationSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Prefer RAG + good prompting for factual recall over large private corpora.
- Distinctive: line 42
Remove duplicates (exact + near-duplicate via embedding similarity).
- Distinctive: line 49
Ensure no leakage (same conversation or document not split across sets).
- Distinctive: line 58
Use TRL SFTTrainer or Axolotl for simpler config.
- Distinctive: line 81
Catastrophic forgetting: Use LoRA (low rank), small learning rate, short training, or replay of general data.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
Prepares high-quality datasets and training configurations for fine-tuning LLMs (LoRA, QLoRA, full SFT). Covers when to fine-tune vs prompt engineering vs RAG, dataset formats (instruction-response JSONL), quality filtering, train/val/test splits, hyperparameter selection, LoRA config, Hugging Face Trainer / TRL setup, evaluation, and cost/latency estimation.
When to Use This Skill
- You have domain-specific data (support tickets, legal docs, internal knowledge, code style, product data) that a base model doesn't handle well.
- Prompt engineering + RAG has hit a quality ceiling.
- You need the model to output in a very specific style, format, or with deep domain knowledge.
Prerequisites
- A dataset of input → desired output pairs (hundreds to tens of thousands of examples).
- GPU access (single A100/H100 for QLoRA on 7-13B models is common; more for larger).
- Hugging Face account + transformers + peft + bitsandbytes + trl (or Axolotl/Unsloth for easier workflows).
Steps
- Decide if fine-tuning is the right tool:
- Fine-tune when you need new behavior/knowledge that is hard to prompt or retrieve.
- Prefer RAG + good prompting for factual recall over large private corpora.
- Combine both when appropriate.
- Dataset format:
- Instruction tuning:
{"instruction": "...", "input": "...", "output": "..."}or chat format. - JSONL, one example per line.
- For chat models: messages array in the model's chat template.
- Instruction tuning:
- Quality filtering (critical):
- Remove duplicates (exact + near-duplicate via embedding similarity).
- Length filters (too short or extremely long).
- Quality heuristics or LLM-as-judge scoring.
- Human review of a sample (aim for >95% high quality).
- Split strategy:
- 80/10/10 or 90/5/5 (train/val/test).
- Ensure no leakage (same conversation or document not split across sets).
- LoRA / QLoRA config:
- Rank (r): 8-64 (16-32 common starting point).
- Alpha, dropout.
- Target modules (q_proj, v_proj, etc. for most models).
- 4-bit or 8-bit quantization for QLoRA.
- Training setup (Hugging Face):
- Use TRL SFTTrainer or Axolotl for simpler config.
- Learning rate, batch size, gradient accumulation, epochs (usually 1-3 for instruction tuning).
- Evaluation strategy, save best, early stopping.
- Packing / packing for efficiency.
- Evaluation:
- Held-out test set with exact or fuzzy match + LLM judge.
- Qualitative review of outputs.
- Compare to base model + few-shot on the same test set.
- Output:
- Cleaned, split dataset files.
config.yamlor Python training script (LoRA + QLoRA).- Evaluation script.
- Cost estimate (GPU hours × price).
- Merging and inference notes (how to merge LoRA adapters back into base).
Examples
A complete pipeline for fine-tuning a 7B or 13B model on a customer support / internal knowledge dataset: dataset cleaning script, JSONL preparation, QLoRA config, TRL training script, and evaluation harness with LLM-as-judge is included.
Edge Cases & Error Handling
- Catastrophic forgetting: Use LoRA (low rank), small learning rate, short training, or replay of general data.
- Small datasets (<1k examples): Heavy augmentation or start with very low rank LoRA + more epochs.
- Evaluation contamination: Strict separation of train/val/test.
Verification
- Dataset passes quality filters and split checks.
- Training runs without OOM on the target hardware (with QLoRA).
- Validation loss decreases and plateaus reasonably.
- On the held-out test set, the fine-tuned model outperforms the base model + good prompting (by automatic metrics and human/LLM judgment).
- Merged model loads and generates correctly.
- Success: The fine-tuned model shows clear improvement on the target domain/task with acceptable generalization.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

