Quality and safety
Fine-tuning vs prompting vs RAG
When to change weights instead of the prompt or the retrieved context, and how to decide with evals.
Fine-tuning continues training a model on your examples so behavior is baked into weights instead of restated in every prompt. It is powerful and often unnecessary. Most failures that feel like "the model does not get us" are fixed by clearer prompts, better context or RAG, measured with evals.
One sentence to keep: fine-tuning teaches how to respond; RAG supplies what to respond with. Confusing those two is the expensive mistake.
Fine-tuning shines when you need consistent style or format, a narrow skill at high reliability, or a smaller, cheaper model that matches a larger teacher on one task.
The decision ladder
Walk the rungs in order. Skip a rung only with evidence from evals.
| Approach | Changes | Best for | Weak at |
|---|---|---|---|
| Prompting | Input only | Instructions, few-shot behavior | Huge policy docs every call |
| Context / RAG | Input plus retrieved facts | Private, large or frequently updated knowledge | Teaching a new writing style |
| Fine-tuning | Weights | Consistent format, classification, distillation | Fresh facts and weekly doc updates |
Trade-off
Prompting iterates in minutes. RAG updates knowledge without retraining. Fine-tuning needs data, training jobs, evals and a plan for base-model upgrades. Default: exhaust prompting and RAG. Fine-tune when evals show a plateau and the failure is behavioral, not factual.
When it helps, and when it does not
Good for. Brand voice. Always-valid shapes when constrained decoding is not enough. Narrow classification and routing, often cheaper as a small classifier than a frontier model with a long prompt. Distillation: a large teacher generates targets, a 7B to 70B student learns them. Compressing a 5k-token instruction block into weights, after a held-out set shows quality holds.
Bad for. Fresh knowledge. Weights are a blurry memory. New prices, policies and SKUs belong in retrieval or tools. Fine-tuning on docs produces unciteable mush that goes stale the day after training. It also will not fix retrieval: if the model never saw the right chunk, more SFT will not invent the fact. A weekend LoRA on 40 Slack messages looks magical and fails in production.
Warning
Do not fine-tune to "make the model know our wiki." Build RAG first. Fine-tune later if tone or format is still wrong given the right evidence.
Concepts in this section
| Step | Concept | What it answers |
|---|---|---|
| 1 | Kinds of fine-tuning | SFT, preferences, distillation, or LoRA? |
| 2 | Fine-tuning data | What examples do you need, and how many? |
| 3 | Serving fine-tunes | Managed API or open-weight LoRA, and how do you keep it current? |
Common mistakes
- Fine-tuning a knowledge problem. The wiki belongs in RAG. The weights belong to style and format.
- No held-out baseline. A 4-point lift on a contaminated suite, then the prompted baseline with two better few-shots is within 1 point, and multilingual cases you never measured are broken.
- One training run a year. Bases improve every few months. Old adapters do not automatically transfer.
Key takeaways
- Climb prompting, then context or RAG, then fine-tuning. Use evals at every step.
- Fine-tune for behavior, format, narrow skills and distillation, not for fresh facts.
- Data quality and a frozen baseline matter more than optimizer cleverness.
- Keep RAG and fine-tuning as complements: evidence in context, style in weights.
Further learning
Chip Huyen's book is the practitioner reference for when fine-tuning fits.
AI Engineering (Chip Huyen)oreilly.com What We Learned from a Year of Building with LLMsA practical guide to building successful LLM products, covering the tactical, operational, and strategic.Applied LLMs
LoRA explained by its inventor.
Related
Kinds of fine-tuning
SFT teaches an input-to-output map. Preference methods rank answers. Distillation copies a teacher. LoRA makes the update cheap.
Evaluating LLM apps
A fixed set of inputs plus a way to score outputs, so you can tell whether a change helped.
Supervised fine-tuning and PEFT
Instruction tuning, chat formats, data quality, LoRA/QLoRA math, and the tooling that turns a base model into a useful assistant.