RAG vs Fine-tuning vs Prompt Engineering: Decision Framework
RAG, fine-tuning, and prompt engineering are not competing approaches — they solve different problems. RAG grounds an LLM in fresh, external facts. Fine-tuning changes behavior or style. Prompt engineering shapes intent within an already-capable model.
Last reviewed:
What we're comparing
- Prompt engineering
Shape output by carefully constructing the input prompt (roles, examples, structure).
- RAG
Fetch relevant documents at query time and inject them into the prompt as grounding context.
- Fine-tuning
Update model weights (full or LoRA) on task-specific data to change behavior or style.
Side-by-side
| Attribute | Prompt engineering | RAG | Fine-tuning |
|---|---|---|---|
| Freshness | Static per prompt | Live (index refresh cadence) | Frozen at training time |
| Factual grounding | Weak | Strong (source-attributable) | Weak (knowledge diffuses) |
| Latency overhead | None | Adds a retrieval step per query | None at inference |
| Setup cost | Low | Medium (index + retriever) | High (data curation + compute) |
| Ongoing cost | Per-token only | Per-token + retrieval infra | Training runs + custom-model hosting or per-token rates (provider-dependent) |
| Best for | Task shaping, few-shot behavior | Grounded QA, freshness, citations | Style/format, restricted vocab, low-resource domains |
| Anti-pattern | Trying to encode all knowledge in prompt | Fine-tuning what a retriever should surface | Fine-tuning to add facts (they will drift) |
When to use which
- Use Prompt engineering
Start here. It handles many real use cases on its own and is the cheapest approach to iterate on.
- Use RAG
You need current, source-attributable answers from a corpus larger than the context window.
- Use Fine-tuning
You need consistent output structure/style, or domain-specific behavior that prompting cannot reliably produce.
FAQs
Can I combine them?
Yes. Many production systems do — prompting for task shape, RAG for facts, and fine-tuning only where style or format cannot be reached by prompting.
Is fine-tuning obsolete now that context windows are huge?
No, but its niche is narrower. A fine-tuned smaller model can be cheaper and faster than prompting a larger one at high volume. Hosted options are shifting: OpenAI is winding down its fine-tuning platform (closed to new users), while Amazon Bedrock and Google Cloud still offer hosted fine-tuning, and open-weights models can be tuned anywhere. Long context is a substitute for RAG in narrow cases, not a replacement.
Get updates when this comparison changes
We re-review comparisons as tools and pricing move. One practical GenAI note per month, plus alerts on material changes. Unsubscribe anytime.