Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Decision framework for making a model do a task — choosing between in-context learning, RAG, fine-tuning (LoRA/QLoRA/DPO), and distillation. Maps the gap you have (knowledge / behavior / capability / cost) to the right lever, names when each is the WRONG tool, and covers data requirements, eval, catastrophic forgetting, and combining methods.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-12 | ✗→✓ | ▲ Improved | 308% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 529% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 951% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 253% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 267% | 0% |
You have a base model. It doesn't do the task well enough. You have four levers to change that, and they are not interchangeable — each changes a different thing. Picking the wrong one is the most expensive recoverable mistake in applied AI: weeks of labeling, a training run, and an eval suite, all to solve a problem a 200-token prompt would have fixed.
The whole discipline reduces to one question: what kind of gap do you have?
| Gap | Symptom | Right lever | |-----|---------|-------------| | Knowledge | Model doesn't know a fact, doc, or current state | RAG | | Behavior / format | Model knows enough but won't reliably do it the way you need (tone, structure, JSON, domain register) | Fine-tune (after prompt+RAG exhausted) | | Capability | Model literally can't — reasoning depth, hard task it fails at any prompt | Bigger model, then ICL to steer it | | Cost / latency at scale | Quality is fine, the bill or the p95 isn't | Distill or fine-tune a small model |
Memorize that table. Everything below is detail on each lever and the failure modes of using one in the wrong row.
Prompt engineering, few-shot examples, instructions, in-prompt context. Changes behavior at inference time only — zero weight updates.
Retrieve relevant chunks from a knowledge source and inject them into the prompt. For KNOWLEDGE, freshness, and attribution — not for behavior. (Full retrieval/chunking/eval detail lives in the rag skill; here we only place it among the levers.)
Update the model's weights on task data. For BEHAVIOR, format, style, domain register, and latency-by-shrinking-the-prompt. Variants:
| Variant | What it does | When | |---------|--------------|------| | Full SFT | Updates all weights | Rare now; large data + budget + ops, max control | | LoRA | Trains small low-rank adapter matrices, freezes base | Default for behavior/format adaptation | | QLoRA | LoRA on a 4-bit-quantized base | LoRA when VRAM-constrained (fine-tune a 70B on one big GPU) | | DPO / preference tuning | Aligns to preferred vs rejected pairs, no reward model | Shape judgment — "prefer concise," "refuse X" — not just imitate |
A capability gap is when the base model can't do the task at any prompt — the reasoning is too deep, the chain too long, the judgment too hard. This is the one row where adaptation can't save you.
Train a small model on a big model's outputs for a specific task. For cost/latency at a fixed quality bar on a narrow task.
┌─────────────────────────────────────┐
│ Start: model underperforms on task │
└──────────────────┬──────────────────┘
▼
┌───────────────────────────────────────────────┐
│ Have you SERIOUSLY tried prompt + few-shot? │
└───────────────┬───────────────────────┬───────┘
no │ yes │
▼ ▼
Do that first. Cheapest ┌──────────────────────────┐
fix, instant iteration. │ What kind of gap remains? │
└─────────────┬────────────┘
┌──────────────────┬─────────────────────┬─────┴───────────────┐
▼ ▼ ▼ ▼
KNOWLEDGE BEHAVIOR/FORMAT CAPABILITY COST/LATENCY
(missing facts, (won't follow style, (can't do the task (quality OK, bill
freshness, cites) format, tone) at any prompt) or p95 too high)
│ │ │ │
▼ ▼ ▼ ▼
RAG Fine-tune (LoRA/DPO) Bigger/better model Distill teacher→
(update index, on 100s–1000s of OR more ICL/CoT. student, OR fine-
not weights) curated examples. Fine-tuning will tune a small model
Need an eval set. NOT add capability on the stable task.
the base lacks.Read it as a priority order, not a menu. Cheapest, most reversible levers first: prompt → RAG → fine-tune small → distill → full fine-tune. Climb only when the cheaper rung is genuinely exhausted against a real eval, not against a hunch.
A blunter heuristic:
| You're tempted to… | Don't, because… | Do instead | |--------------------|-----------------|------------| | Fine-tune to add facts | Fine-tuning does not reliably inject knowledge — the model parrots the form of your examples and still hallucinates the content. Worse, it forgets other things (§5). Facts also go stale the day after you train. | RAG. Knowledge belongs in a retrievable index, not in weights. | | RAG to fix tone/format | Retrieving better passages changes what the model sees, not how it writes. You'll get correct facts in the wrong shape. | Prompt (cheap) or fine-tune (if the prompt fix doesn't stick at scale). | | Fine-tune before exhausting prompt + RAG | Premature: expensive, slow to iterate, and brittle — you've frozen a guess into weights and now own retrains forever. Most "we need to fine-tune" problems are a weak prompt or missing context. | Exhaust prompt → RAG first. Fine-tune only when a good prompt provably can't get there or is too expensive per call. | | Distill without a stable task | If the task definition still moves, the student is obsolete on arrival and you can't even tell — the eval keeps changing. | Stabilize the task + eval first. Distill last, when quality is settled and only cost/latency remains. | | Keep using ICL when the prompt is huge & repeated | A 3K-token instruction block sent on every call is a permanent tax on cost and latency, and long prompts dilute attention. | Fine-tune to bake the stable instructions into weights; calls get shorter, cheaper, faster. | | Reach for a bigger model for a format problem | Capability isn't the gap; you'll overpay for reasoning you don't need and still get inconsistent format. | Fine-tune a small model on the format. |
The single most common and most expensive error: fine-tuning to make the model "know" something. It is the wrong tool by mechanism, not by degree. Knowledge → RAG. Always.
r, typ. 8–64) into attention/MLP layers; only those train. ~0.1–1% of params updated. Cheap, fast, and you can swap adapters per task without storing full model copies.(prompt, chosen, rejected) triples. No separate reward model, simpler than RLHF/PPO.| Failure | What it looks like | Guard | |---------|--------------------|-------| | Fine-tuning to memorize facts | Confident, fluent, wrong answers; right format, fabricated content | Put knowledge in RAG; fine-tune only for behavior | | No eval set | "Seems better" with no number; can't defend the change | Build held-out eval before training; gate the run on it | | Data leakage (train ↔ eval) | Eval score great, production score bad | Dedup + split by source/entity before training; verify zero overlap | | Overfitting | Memorizes train examples, fails near-duplicates; brittle to phrasing | Fewer epochs, lower LoRA rank, more diverse data, early-stop on eval loss | | Catastrophic forgetting | Now great at the task, worse at things it used to do | PEFT (less invasive than full SFT), lower LR, mix in general data, regression-test broad ability | | Drift | Quality silently decays as the world / inputs move | Monitor production metrics; schedule retrains; keep volatile facts in RAG, not weights | | Distilling an unstable task | Student ships already-obsolete; can't tell because eval moves | Freeze task + eval first; distill last | | Retrain treadmill underestimated | "One training run" becomes a quarterly ops burden | Budget the lifecycle (data refresh, retrain, re-eval, redeploy), not just run #1 |
Catastrophic forgetting deserves its own emphasis: weights are shared, so teaching one thing can erase another. It is the hidden cost that makes fine-tuning-for-facts doubly wrong — you pay to not learn the fact and to forget something useful. Mitigate with PEFT, conservative learning rates, mixing in general-purpose data, and a broad regression eval after every run.
These are not exclusive. Production systems stack them:
Guiding split when combining: knowledge → retrieval (mutable, external); behavior → weights (stable, internal). Put each thing where it belongs and they stop fighting.
Scenario: a customer-support assistant. It must (a) answer using the current product docs and this customer's plan/usage, and (b) reply in the company's terse, no-fluff house voice with a fixed structure (answer → next step → doc link).
The lazy instinct is "fine-tune it on our support transcripts." Walk the gaps instead:
Resolution: RAG + LoRA together (§6's canonical pair). Knowledge lives in the swappable index and stays fresh; behavior lives in the adapter and stays consistent. Each lever does its own job and they stop fighting.
Mini-case (cost only): a field-extraction step where a good prompt already hits the quality bar — but it's 10M calls/month on a frontier model. Quality gap = zero; the entire problem is cost/latency. → Distill the frontier model's outputs into a small student (or fine-tune a small model directly) once the schema is frozen. No new quality is needed, so no bigger model and no RAG — just move the same quality onto a cheaper engine.
| Dimension | In-context learning | RAG | Fine-tuning (LoRA/QLoRA) | Distillation | |-----------|---------------------|-----|--------------------------|--------------| | Changes | Behavior at inference | Knowledge in context | Weights (behavior baked in) | A small model's weights | | Solves the gap | Capability-steering, quick format | Knowledge, freshness, citation | Behavior, format, style, tone, prompt-shrink | Cost/latency at fixed quality | | Training cost | None | None (build index once) | Moderate (one run, repeated on drift) | Moderate–high (dataset + run) | | Per-call cost | High (tokens every call) | Medium (retrieval + context tokens) | Low (short prompt) | Lowest (small model) | | Latency | Higher (long prompts) | Medium (retrieval hop) | Low | Lowest | | Iteration speed | Instant | Fast (re-index) | Slow (label → train → eval) | Slowest (needs stable task) | | Freshness | Per-call | Excellent (update index) | Poor (stale until retrain) | Poor (retrain) | | Data needed | A few examples | A corpus to index | 100s–1000s clean examples + eval | Teacher outputs + eval | | Reversibility | Trivial (edit string) | Easy (swap index) | Hard (own retrains, forgetting) | Hard (rebuild dataset) | | Ops burden | None | Index pipeline, retrieval eval | Train + eval + monitor + retrain | Same as fine-tune + teacher |
Do
Don't
Cross-references: retrieval/chunking/index/retrieval-eval detail → rag skill. Prompt structure, few-shot design, output schemas → prompt-engineer skill. Eval-suite construction → your evaluation skill of record.
Other measured skills in the registry, with their headline benchmark lift.