1---
2name: fine-tuning
3slug: fine-tuning
4description: Fine-tune LLMs with data preparation, provider selection, cost estimation, evaluation, and compliance checks.
5metadata:
6 source: https://skillmd.com/skills/modbender/fine-tuning
7---
8
9## When to Use
10
11User wants to fine-tune a language model, evaluate if fine-tuning is worth it, or debug training issues.
12
13## Quick Reference
14
15| Topic | File |
16|-------|------|
17| Provider comparison & pricing | `providers.md` |
18| Data preparation & validation | `data-prep.md` |
19| Training configuration | `training.md` |
20| Evaluation & debugging | `evaluation.md` |
21| Cost estimation & ROI | `costs.md` |
22| Compliance & security | `compliance.md` |
23
24## Core Capabilities
25
261. **Decide fit** — Analyze if fine-tuning beats prompting for the use case
272. **Prepare data** — Convert raw data to JSONL, deduplicate, validate format
283. **Select provider** — Compare OpenAI, Anthropic (Bedrock), Google, open source based on constraints
294. **Estimate costs** — Calculate training cost, inference savings, break-even point
305. **Configure training** — Set hyperparameters (learning rate, epochs, LoRA rank)
316. **Run evaluation** — Compare fine-tuned vs base model on task-specific metrics
327. **Debug failures** — Diagnose loss curves, overfitting, catastrophic forgetting
338. **Handle compliance** — Scan for PII, configure on-premise training, generate audit logs
34
35## Decision Checklist
36
37Before recommending fine-tuning, ask:
38- [ ] What's the failure mode with prompting? (format, style, knowledge, cost)
39- [ ] How many training examples available? (minimum 50-100)
40- [ ] Expected inference volume? (affects ROI calculation)
41- [ ] Privacy constraints? (determines provider options)
42- [ ] Budget for training + ongoing inference?
43
44## Fine-Tune vs Prompt Decision
45
46| Signal | Recommendation |
47|--------|----------------|
48| Format/style inconsistency | Fine-tune ✓ |
49| Missing domain knowledge | RAG first, then fine-tune if needed |
50| High inference volume (>100K/mo) | Fine-tune for cost savings |
51| Requirements change frequently | Stick with prompting |
52| <50 quality examples | Prompting + few-shot |
53
54## Critical Rules
55
56- **Data quality > quantity** — 100 great examples beat 1000 noisy ones
57- **LoRA first** — Never jump to full fine-tuning; LoRA is 10-100x cheaper
58- **Hold out eval set** — Always 80/10/10 split; never peek at test data
59- **Same precision** — Train and serve at identical precision (4-bit, 16-bit)
60- **Baseline first** — Run eval on base model before training to measure actual improvement
61- **Expect iteration** — First attempt rarely optimal; plan for 2-3 cycles
62
63## Common Pitfalls
64
65| Mistake | Fix |
66|---------|-----|
67| Training on inconsistent data | Manual review of 100+ samples before training |
68| Learning rate too high | Start with 2e-4 for SFT, 5e-6 for RLHF |
69| Expecting new knowledge | Fine-tuning adjusts behavior, not knowledge — use RAG |
70| No baseline comparison | Always test base model on same eval set |
71| Ignoring forgetting | Mix 20% general data to preserve capabilities |