Prompting vs RAG vs fine-tuning: when to use which?
MediumRAGFine-tuningArchitecture
When should you use prompting, RAG or fine-tuning?
TL;DR
Go in order of cost and complexity. Start with prompting (clear instructions, few-shot examples, structured output); it solves more than people expect. Use RAG when the model needs knowledge it doesn't have: private, frequently changing or citable information. Use fine-tuning to change behavior: a consistent format or style, a narrow task done reliably, or a smaller, cheaper model matching a big one on that task. Rule of thumb: RAG for knowledge, fine-tuning for behavior. They combine well.
Key points
| Prompting | RAG | Fine-tuning | |
|---|---|---|---|
| Adds new knowledge | Only what fits in the prompt | ✅ Yes, updatable | Poorly; hard to update, may hallucinate |
| Changes style or format | Somewhat | No | ✅ Strongly |
| Up-front cost | Minimal | Indexing pipeline | Data, training, evals |
| Update speed | Instant | Re-index | Retrain |
| Citations | No | ✅ Yes | No |
- Fine-tuning needs data: hundreds to thousands of high-quality examples, plus an eval set to show it beat the prompted baseline.
- Distillation: fine-tune a small model on a large model's outputs to cut cost and latency at scale.
- Fine-tuning risks: catastrophic forgetting of general skills, and maintenance whenever the base model updates.
- Before fine-tuning, check that prompting plus good evals truly can't reach the target.
- Parameter-efficient methods (LoRA) make fine-tuning much cheaper.
Example
- Support bot answering from the help center: RAG.
- Extracting fields from invoices into a fixed JSON format at very high volume: prompting first; then fine-tune a small model if cost or latency matters.
- Writing in a specific brand voice: few-shot prompting, then fine-tuning if it's not consistent enough.
- Legal assistant citing current regulations: RAG (knowledge changes, citations needed), maybe with a fine-tune for format.
Common follow-ups
- Can fine-tuning teach the model new facts? Somewhat, but unreliably, and it can increase confident hallucination. RAG is the better tool for facts.
- How do you decide it's worth fine-tuning? When a prompted baseline plateaus on your eval set, and the gain or the cost savings justify the data and maintenance work.
What interviewers look for
Tip
Escalate from prompting to RAG to fine-tuning, "knowledge vs behavior", and a decision driven by evals and cost.
- Red flag: jumping straight to fine-tuning to add company knowledge.